diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum.lean new file mode 100644 index 0000000000000000000000000000000000000000..153306295e5cd1afb267ba346c9334ac6d8db334 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum.lean @@ -0,0 +1,940 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.ClockPathBound +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.ClockWeightedBound +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumAcceptance +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumAdjacentCnot +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumAdjacentProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumAlgebraicHeight +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumAlgebraicHistory +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumAlgebraicScalar +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumAlgebraicScalarProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumAnchorDensity +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumAncilla +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumAncillaCompression +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumAncillaCount +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumAxisSample +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumAxisSampleAccuracy +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumAxisSampleProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBitTransfer +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBlockBasis +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBlockBudget +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBlockCoefficientBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBlockEdges +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBlockExchange +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBlockFull +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBlockHamiltonian +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBlockRational +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedArmProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedArms +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedCells +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedCongestion +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedCounts +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedDetour +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedDogleg +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedEndpointWalk +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedExtent +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedFanout +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedGridEdge +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedIntersections +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedLanes +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedListProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedNodes +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedPortChain +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedPortLinks +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedPortRealization +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedRay +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedSharedEdge +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedSourceCells +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCellCatalogProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCellCorridor +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCellCrossings +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCellMatching +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCellPassages +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCellPathProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCellPathTemplates +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCellRouteCatalog +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCellRouteSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCellTranslate +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCellVisitPaths +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumChosenSlots +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCircuitCode +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCircuitPadding +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCircuitPauli +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCircuitPromise +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCircuitTwoLocal +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumClockAnchor +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumClockCells +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumClockPath +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumClockSector +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumClockStep +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumClockTransition +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCoefficientEnvelopeProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCoefficientHeight +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCoefficientPrograms +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCoerciveInverse +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumComputedAccuracy +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumComputedCrossingBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumComputedCrossingRelabel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumComputedRouteSelector +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumComputedRoutingTable +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCoordinateSpectrum +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCornerPatch +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCorridorEndpoints +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCorridorInterior +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCorridorSeparation +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCountedHistory +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCountertermProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCountertermSample +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingCalibration +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingCoefficientBound +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingCompiled +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingDirections +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingEffective +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingGraph +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingListActual +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingListBlock +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingListFamily +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingListLayer +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingListMatrix +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingListSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingMove +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingOutputRoutes +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingPacketBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingPacketEnergy +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingPairSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingParallel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingPatch +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingPatchChart +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingPlacement +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingPlanarRoutes +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingPorts +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingPositionProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingPositionRelabel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingRetention +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingScaleProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingSelectCorrectness +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingSelectFromSites +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingSelectProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingSelection +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingSelectionRelabel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingSelectionUnique +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingSiteProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingSiteRelabel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingSites +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingSize +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingSpectrum +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingSupportRelabel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingsGraph +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumDefinedRealization +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumDegreeReduction +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumDescriptorSiteProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumDescriptorSites +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumDiagonalTableProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumDiagonalTensor +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumDistinctCrossings +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumDistributedClock +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumDistributedFamily +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumDistributedGap +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumDistributedInput +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumDistributedMatrix +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumDistributedPositive +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumDistributedRebit +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumDistributedSpectrum +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumDistributedWitness +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEightBasis +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEndpoint +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEndpointListProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEndpointPorts +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEndpointRelabel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEntryParity +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEvenListPieces +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEvenRouteData +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEvenRouteLabels +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEvenRoutePlacement +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEvenRouteRealization +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEvenTapeGeometry +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEvenTapeOrder +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEvenTapeOutputBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEvenTapeProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEvenTapeWeights +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEvolution +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumExchangeCrossings +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumExchangeLanes +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumExchangeRounding +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumExchangeRoutes +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumExchangeSample +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumExchangeSampleProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFanoutPaths +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFanoutPorts +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFieldSample +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFinalPrecision +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFinalRoutingProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFineRoute +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFiniteHistory +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFiniteMembership +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFiniteRouteSearch +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFirstUse +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFirstUseProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFirstUseSites +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFixedMatrixProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFixedPauli +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFixedPauliProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkBackground +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkCalibration +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkCells +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkDegreeBound +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkDegrees +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkEffective +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkGraph +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkGridInitial +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkGridProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkInitial +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkInitialCells +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkInitialLocality +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkInitialMatrix +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkInitialSize +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkIteration +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListAccuracy +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListActive +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListBackground +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListBoundProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListCalibration +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListCellIteration +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListCellLocality +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListCellMass +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListCellProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListCells +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListData +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListDegree +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListDegreeIteration +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListEnvelope +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListFinalDegree +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListFullCells +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListFullDegree +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListGraph +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListIndex +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListInitial +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListInitialAccuracy +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListInitialBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListInitialCalibration +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListInitialCellMass +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListInitialCells +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListInitialDegree +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListInitialMatrix +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListInitialPairs +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListInitialPhysical +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListInitialProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListInitialRealization +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListInitialSpatial +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListInitialStateProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListInitialSum +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListInitialWeights +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListIterateWeights +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListIteration +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListMatrix +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListNext +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListNextBackground +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListNextDegree +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListNextPorts +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListNextValid +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListNextWeights +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListOrdinal +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListOuter +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListOutputBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListPartition +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListPoints +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListRealization +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListRound +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListScale +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListSites +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListSize +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListSpatialPackage +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListSum +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListWeights +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkLocality +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkParallel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkPatch +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkPlaced +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkPortSums +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkPorts +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkRounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkRoutingData +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkRoutingPaths +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkSpectrum +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkStarGround +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkStarIndex +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkState +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkStateAccuracy +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkStateDegree +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkStateMatrix +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkStateNextMatrix +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkWeightBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourAxis +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourBasis +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourCorrelation +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourCorrelationCertificate +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourCounterterm +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourCouplingBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourCouplingScale +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourCross +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourDoubleGap +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourEffective +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourEncoding +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourFields +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourGapCertificate +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourGround +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourIsometry +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourLogical +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourNorm +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourPositive +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourProjector +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourSpatial +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourSpin +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourSpinCertificate +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourSpinTable +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourSpinTransition +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourStencils +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorCoefficientBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorComparison +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorCompression +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorCross +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorEffective +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorEffectiveError +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorError +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorFamily +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorFamilyAccuracy +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorFamilyBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorFields +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorForms +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorFullFamily +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorGap +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorGround +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorHilbert +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorInverse +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorNorm +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorOnsite +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorOperatorBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorOrthogonal +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorScale +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorSpin +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorWeighted +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourWeighted +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGadgetAlgebra +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGadgetCounterterms +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGateArrival +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGateCode +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGateEntryProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGateLocality +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGateProduct +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGateScalarReduction +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGateUnitary +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGates +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGeometryPowers +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGraphCoefficientBound +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGraphDegree +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridAcceptance +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridCircuit +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridColor +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridCoordinates +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridFrame +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridLocality +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridMidpoint +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridNeighbors +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridNeighborsFour +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridPorts +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridSlots +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridWalk +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGroundComparison +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHalfCorridor +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistory +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryBitProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryCellProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryCells +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryComparison +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryDegree +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryDelta +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryDeltaProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryDescriptorProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryDescriptors +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryDiagonal +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryDiagonalProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryEnergy +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryEnumeration +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryFork +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryHeight +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryIncidence +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryLattice +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryLiteralCorrectness +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryLiteralPromise +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryMatrix +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryMatrixForm +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryOutputBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryParameterBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryPrecisionProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryPreparedProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryRawCells +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryRoutedEnergy +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryRoutingProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistorySamplerProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistorySampling +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistorySiteProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistorySizeBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistorySourcePowers +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistorySourceProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistorySourcePromise +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistorySpatial +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistorySpatialProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistorySpectrum +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryTableCorrectness +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryTableProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryThreeLocal +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryThreeLocalEnergy +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryWitness +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryXZ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryXZBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryXZPromise +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumInflatedListProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumInflatedPath +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumInflatedSeparation +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumInnerPorts +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumInputProjection +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumInternalHalfSeparation +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumInternalRouteSeparation +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLaneSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLaneUnaryProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLatticeCoefficient +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLatticeEncoding +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLatticeEnvelope +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLatticePromise +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLatticeSerialization +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLatticeSource +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLatticeSourceBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListGraph +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListLattice +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListLatticeProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListMerge +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListMergeMatrix +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListMergeProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListMergeProperties +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListPathAccuracy +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListPathInput +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListPathMatrix +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListPathProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListPathStep +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListRouteLattice +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListRouteMatching +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListRouteNextPoint +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListRouteNextPosition +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListRouteNextWork +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListRouteOutputBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListRouteOutputProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListRoutePathOrder +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListRoutePieces +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListRoutePreservation +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListRouteProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListRouteRepresentation +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListRouteSelection +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListSchedule +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListScheduleBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListScheduleGeometry +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListScheduleGraph +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListScheduleLabels +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListScheduleOrder +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListScheduleProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListScheduleRealization +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListScheduleRelabel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListScheduleScale +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListScheduleWeights +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalAction +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalCoordinates +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalCore +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalDecomposition +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalEnlarge +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalError +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalFamily +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalInput +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalJoin +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalLift +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalModel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalPathClearance +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalPauli +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalPenalties +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalPropagation +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalRealification +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalSubdivision +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalSupported +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalTensor +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalThird +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalThirdSupported +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumManhattanListProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumManhattanRoute +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumManhattanSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumMappedGate +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumMask +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumMatrixError +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumMediatorGeometry +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumMergeEdges +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumMergedCoefficientBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumMergedEndpointPairs +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumMergedOutputRoutes +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumMergedSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumNearestCircuit +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumNearestGate +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumNearestProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOddPathGeometry +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOffsetProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOffsetSample +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOperatorQuadratic +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedCellProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedCellTable +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedCoefficient +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedDescriptorProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedDescriptors +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedFinalBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedHistory +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedIncidence +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelBlocks +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelCompile +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelCorrectness +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelData +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelEnergy +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelFamily +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelOutput +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelPacking +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelPipeline +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelSubdivision +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelTable +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelThird +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelYY +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedModel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedOutputBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedOutputSpatial +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedPrivate +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedPrivateSpatial +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedRawBlock +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedRawCells +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedRawPacking +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedRawPackingProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedReference +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedSampling +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedSourceIndex +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedSpatial +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedSpatialComplete +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedSpatialSites +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedSplit +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedSubdivision +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedTable +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedThird +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedThirdSites +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedThirdXZ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedTriple +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedTripleFactors +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedTwoStage +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedWeightBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedWeightProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedXZEnergy +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedXZPipeline +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedXZTerm +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedYYFactors +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedYYReduction +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrdinalPlacement +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrdinalProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrdinalSlots +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrdinalSpatial +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPackedSchedule +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPacketGeometry +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPacketRoutingGeometry +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedBasis +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedEvolution +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedGate +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedHistory +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedInput +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedLabelData +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedLabelEnergy +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedLabelMeaning +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedLabelProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedLabelTable +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedLocal +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedPacketProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedPauli +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedSampling +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedTableProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPairDedup +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumParallelGraph +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumParallelRouteSearch +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPartialPaths +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPatchEdgeCover +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPatchPhysical +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPatchPoints +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPatchSeparation +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathCoverage +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathCoverageReverse +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathDegrees +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathEmbedding +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathIteratedBound +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathPatch +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathPieces +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathPlacement +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathPolynomialBound +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathRelabeling +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathRelabelingIteration +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathRelabelingNext +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathRelabelingProperties +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathScaleProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathSchedule +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathScheduleSize +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathSpectrum +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathSubdivision +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathTable +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathVisitCorrectness +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathVisitProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathWeightBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathsCalibration +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathsGraph +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathsParallel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliAlgebra +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliBasis +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliCongestion +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliExpansion +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliExtend +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliLocal +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliMonomial +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliParity +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliProduct +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliReal +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliRounding +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliSingle +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliSplit +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliSubdivision +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliThird +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliTripleSplit +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPermittedEndpointAvoidance +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPermittedRouteSeparation +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPhysicalCells +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPhysicalEndpointCover +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPinnedClock +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPlanarDegree +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPlanarListData +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPlanarRelabel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPlanarRouteData +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPlanarRouteRealization +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPlanarSelectorTransport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPlanarTapeGeometry +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPlanarTapeProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPlanarTapeSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPolarizedSubdivision +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPolarizedThird +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPolynomialUnary +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortCellPositive +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortChain +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortChainActual +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortChainBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortChainProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortChainSeparation +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortCrossingSelection +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortGraphPairs +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortInnerPair +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortLinks +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortPairing +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortPlanarRealization +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortRank +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortRankActual +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortRankProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortRaySupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortRouteData +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortScheduleActual +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortSchedulePacking +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortScheduleTape +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortSelectionProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortSpinCoverage +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPrefix +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPreparedCircuit +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPreparedLattice +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPreparedVerifier +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPrivateAccuracy +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPrivateCompiler +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPrivateFamily +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPrivateList +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPrivateProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPrivateRaw +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPrivateSupported +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPrivateTerms +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPromisePowers +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPropagationAction +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPropagationOrder +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPropagationSampler +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPropagationSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPropagationTable +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumQuadratic +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumQuadraticReindex +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRationalCrossing +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRationalDegreeReduction +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRationalFork +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRationalPathStep +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRationalSpatialPackage +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawCellDensity +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawCellLocality +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawCoefficientBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawCompiler +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawCorrectness +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawEnvelope +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawExchange +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawFamilyCorrectness +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawFamilyProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawIncidence +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawOutputBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawOutputSize +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawSchedule +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawTermProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRealCircuit +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRealLocalFamily +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRealification +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRebitDiagonal +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRebitLocal +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRebitSoundness +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRectangularOperator +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceBasis +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceBlocks +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceComparison +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceCongestion +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceEdgeTable +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceEdges +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceFamily +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceHistory +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceLocal +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceLower +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceModel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferencePenalty +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceReal +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceTensor +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceTerms +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceWalls +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRetainedCrossing +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRetainedGeometry +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRetainedRoutes +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRetainedSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRouteCandidates +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRouteCongestion +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRouteEnumeration +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRouteLanes +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRouteLeaf +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRouteLeafProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutePermissionCongr +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRouteProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRouteSelectorCorrectness +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRouteSelectorProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutedSubdivision +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingBlocks +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingCrossingTest +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingFamily +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingForms +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingGraph +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingInputActual +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingInputProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingPhysical +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingScale +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingSize +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingSpectrum +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingTable +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingTableCorrectness +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRowInsertion +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRowOrder +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRowStageBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRowStageSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRowTransfer +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSampleAssembly +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSampleBudget +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSamplePrecision +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumScalarFaithful +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumScalarReindex +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumScaledDirection +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumScaledEdge +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumScheduleCrossingGeometry +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSelectedRoute +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSingletStar +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSingletStarBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSingletStarSpectrum +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSortedTime +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSoundness +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpacedListProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSparseEndpoint +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSparseFirstUse +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialCircuit +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialClockTerms +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialCrossingGeometry +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialCrossingProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialCrossingSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialDegreeReduction +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialDegreeThree +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialExchange +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialExchangeCircuit +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialExchangeModel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialFinalCount +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialFinalEnergy +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialFinalGeometry +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialGadgets +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialInput +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialInputBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialInputTape +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialLattice +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialModel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialOccupancy +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialPlaced +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialPlanarBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialPlanarRealization +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialPortBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialPortMatching +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialPortProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialPrivate +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialPropagation +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialRational +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialReference +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialReindex +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialRoutingTape +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialSlotProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialSourcePromise +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialSubdivision +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialTerms +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialThird +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialTotal +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialXZ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialXZBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpecifiedLattice +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumStageIndex +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumStagePath +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumStageStep +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSubdivisionSites +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSupportDedup +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSupportLookup +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSupportedSubdivision +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSupportedThird +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSwapConjugation +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSweepCellProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSweepCells +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSweepCircuit +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSweepCongestion +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSweepCoverage +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSweepCursor +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSweepEndpoint +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSweepIndex +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSweepListProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSweepProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTaggedRouteProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTaggedStage +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTaggedSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTaggedSweep +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTaggedTransfer +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTensorAction +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTensorMatrix +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTensorPair +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTensorPairLinear +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTensorSucc +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTermTime +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumThirdCounterterm +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTimeCongestion +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTimeGrouping +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTransferGate +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTransferIndex +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTransferSweep +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTranslatedInternalSeparation +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTranslatedPatch +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTripleSupported +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnaryClock +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnaryEmbedding +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnaryEmbeddingEnergy +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnaryEnergy +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnaryForm +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnaryMatrix +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnaryPenalty +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnaryPrefix +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnaryPrefixCertificate +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnaryPrefixRun +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnaryPrefixTransfers +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnarySoundness +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnarySpectrum +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnitaryGround +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUntouchedInput +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumVerifier +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumWalkErasure +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumWalkErasureProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumWalkSeek +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumWalkSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumWireGrid +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumWireIntertwining +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumWireRelabel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumWireRouting +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumWireState +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumWireSwap +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZEnvelopes +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZFamily +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZFamilySplit +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZHeisenberg +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZModel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZPrivate +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZReduction +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZSample +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZScalarSample +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZSubdivision +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZSupportFactors +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZSupported +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZTerms +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZThird +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZThirdSupported +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZTriple +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumYYElimination +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumYYFactor +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumYYReduction +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumYYSupported +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorAncilla +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorForms +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorGround +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorHilbert +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorMatrix +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorNorm +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorNormBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorPenalty +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorPhysical +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorProjection +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorSeriesError +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorSeriesMatrix +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorTargetGround +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorThirdForm +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorTrial +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitPhase +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitPhaseLocal +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitPhasePhysical +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitPhysicalComparison +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionCalibration +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionDecomposition +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionEnvelope +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionGadget +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionGround +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionHermitian +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionLocalFamily +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionMatrix +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionNorm +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionReal +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionScale +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdCalibration +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdDecomposition +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdEnvelope +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdFamilyBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdGadget +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdHermitian +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdLocalFamily +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdLocality +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdNormBudget +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdPhased +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdPhasedLocal diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalPathClearance.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalPathClearance.lean new file mode 100644 index 0000000000000000000000000000000000000000..5ee2d04b5e1b41d0321aa7f9d151cba996d208d2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalPathClearance.lean @@ -0,0 +1,44 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHalfCorridor + +namespace OAI + +/-! Exact endpoint clearance inside one cell. These finite facts separate +external corridors from the rays, ordinary pairs and nine gadget paths. -/ + +namespace ContinuumCoulomb + +def qmaLocalPhysicalSites (cross : Bool) : Finset (ℕ × ℕ) := + if cross then {(16,16),(10,16),(16,22),(22,16),(16,10),(14,18),(18,14)} + else {(16,16),(23,16),(16,23),(9,16),(16,9)} + +theorem qmaHalfCorridor_sites (cross : Bool) (a : Fin 4) : + Disjoint ((qmaHalfCorridorPath cross a).drop 1).toFinset (qmaLocalPhysicalSites cross) := by + cases cross <;> fin_cases a <;> decide + +theorem qmaCellRay_sites (a : Fin 4) : + Disjoint (((qmaCellRayPath a).drop 1).dropLast).toFinset (qmaLocalPhysicalSites false) := by + fin_cases a <;> decide + +theorem qmaLocalPatch_sites (e : Fin 9) : + Disjoint (((qmaLocalPatchPath e).drop 1).dropLast).toFinset (qmaLocalPhysicalSites true) := by + fin_cases e <;> decide + +theorem qmaCellPair_half (e : Fin 6) (a : Fin 4) : + Disjoint (((qmaCellPairPath e).drop 1).dropLast).toFinset (qmaHalfCorridorPath false a).toFinset := by + fin_cases e <;> fin_cases a <;> decide + +theorem qmaCellRay_half (e a : Fin 4) : + Disjoint (((qmaCellRayPath e).drop 1).dropLast).toFinset (qmaHalfCorridorPath false a).toFinset := by + fin_cases e <;> fin_cases a <;> decide + +theorem qmaLocalPatch_half (e : Fin 9) (a : Fin 4) : + Disjoint (((qmaLocalPatchPath e).drop 1).dropLast).toFinset (qmaHalfCorridorPath true a).toFinset := by + fin_cases e <;> fin_cases a <;> decide + +theorem qmaLocalPatch_bounded (e : Fin 9) : + ∀ p ∈ qmaLocalPatchPath e, 10 ≤ p.1 ∧ p.1 ≤ 22 ∧ 10 ≤ p.2 ∧ p.2 ≤ 22 := by + fin_cases e <;> decide + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalPauli.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalPauli.lean new file mode 100644 index 0000000000000000000000000000000000000000..81a763bd167bd904142d52ee089151a62dd86f13 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalPauli.lean @@ -0,0 +1,91 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliExtend + +namespace OAI + +/-! A bounded-support real family expands into only even-Y Pauli words. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι α : Type*} [Fintype ι] [DecidableEq ι] [Fintype α] + +abbrev QMALocalPauliTerm (S : α → Finset ι) := + (a : α) × ({i // i ∈ S a} → Fin 4) + +abbrev QMALocalEvenPauliTerm (S : α → Finset ι) := + {p : QMALocalPauliTerm S // Even (qmaPauliYCount p.2)} + +def qmaLocalPauliWord (S : α → Finset ι) (p : QMALocalPauliTerm S) : ι → Fin 4 := + qmaPauliExtend (S p.1) p.2 + +def qmaLocalPauliCoefficient (F : α → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (S : α → Finset ι) (p : QMALocalPauliTerm S) : ℝ := + (qmaPauliCoefficient (qmaLocalCore (S p.1) (F p.1)) p.2).re + +def qmaLocalPauliMatrix (F : α → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (S : α → Finset ι) (p : QMALocalPauliTerm S) : Matrix (ι → Fin 2) (ι → Fin 2) ℂ := + (qmaLocalPauliCoefficient F S p : ℂ) • qmaPauliWord (qmaLocalPauliWord S p) + +theorem qmaLocalPauli_sum (F : α → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (S : α → Finset ι) (hF : ∀ a, QMALocalOn (S a) (F a)) (hH : ∀ a, (F a).IsHermitian) : + (∑ p : QMALocalPauliTerm S, qmaLocalPauliMatrix F S p) = ∑ a, F a := by + rw [Fintype.sum_sigma] + apply Finset.sum_congr rfl + intro a _ + simp only [qmaLocalPauliMatrix,qmaLocalPauliWord,qmaPauliExtend_lift] + exact (hF a).pauli_expansion (hH a) + +omit [Fintype α] in +theorem qmaLocalPauli_odd_zero (F : α → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (S : α → Finset ι) (hH : ∀ a, (F a).IsHermitian) + (hR : ∀ a, QMAEntryParity false (F a)) (p : QMALocalPauliTerm S) + (hp : Odd (qmaPauliYCount p.2)) : qmaLocalPauliMatrix F S p = 0 := by + have he := qmaPauliCoefficient_odd_zero (qmaLocalCore (S p.1) (F p.1)) + (qmaLocalCore_hermitian _ _ (hH p.1)) (qmaLocalCore_real _ _ (hR p.1)) p.2 hp + simp only [qmaLocalPauliMatrix,qmaLocalPauliCoefficient,he,Complex.zero_re, + Complex.ofReal_zero,zero_smul] + +theorem qmaLocalEvenPauli_sum (F : α → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (S : α → Finset ι) (hF : ∀ a, QMALocalOn (S a) (F a)) (hH : ∀ a, (F a).IsHermitian) + (hR : ∀ a, QMAEntryParity false (F a)) : + (∑ p : QMALocalEvenPauliTerm S, qmaLocalPauliMatrix F S p.val) = ∑ a, F a := by + rw [← qmaLocalPauli_sum F S hF hH] + let T : Finset (QMALocalPauliTerm S) := Finset.univ.filter (fun p => Even (qmaPauliYCount p.2)) + have hsub := Finset.sum_subtype (F := inferInstance) T + (by simp [T] : ∀ p, p ∈ T ↔ Even (qmaPauliYCount p.2)) (qmaLocalPauliMatrix F S) + rw [← hsub] + apply Finset.sum_subset (Finset.subset_univ T) + intro p _ hp + have hn : ¬Even (qmaPauliYCount p.2) := by simpa [T] using hp + exact qmaLocalPauli_odd_zero F S hH hR p ((Nat.even_or_odd _).resolve_left hn) + +omit [Fintype ι] in +theorem qmaLocalEvenPauli_count (S : α → Finset ι) {d : ℕ} (hS : ∀ a, (S a).card ≤ d) : + Fintype.card (QMALocalEvenPauliTerm S) ≤ 4^d*Fintype.card α := by + apply (Fintype.card_subtype_le _).trans + calc + Fintype.card (QMALocalPauliTerm S) = ∑ a : α, 4^(S a).card := by + simp only [QMALocalPauliTerm,Fintype.card_sigma,Fintype.card_fun,Fintype.card_fin, + Fintype.card_coe] + _ ≤ ∑ _a : α, 4^d := Finset.sum_le_sum (fun a _ => + pow_le_pow_right₀ (by norm_num : (1:ℕ) ≤ 4) (hS a)) + _ = _ := by simp [Nat.mul_comm] + +omit [Fintype α] in +theorem qmaLocalEvenPauli_support (S : α → Finset ι) {d : ℕ} + (hS : ∀ a, (S a).card ≤ d) (p : QMALocalEvenPauliTerm S) : + (qmaPauliSupport (qmaLocalPauliWord S p.val)).card ≤ d := + (Finset.card_le_card (qmaPauliExtend_support _ _)).trans (hS p.val.1) + +omit [Fintype α] in +theorem qmaLocalEvenPauli_even (S : α → Finset ι) (p : QMALocalEvenPauliTerm S) : + Even (qmaPauliYCount (qmaLocalPauliWord S p.val)) := by + rw [qmaLocalPauliWord,qmaPauliExtend_yCount] + exact p.property + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalPenalties.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalPenalties.lean new file mode 100644 index 0000000000000000000000000000000000000000..a9f9f7f29ac355f4a08920b2e2b783d45029e530 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalPenalties.lean @@ -0,0 +1,79 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalPropagation + +namespace OAI + +/-! The clock and endpoint penalties are explicit one- and two-qubit terms. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +def qmaBitDiagonal (i : ι) (f : Fin 2 → ℂ) : Matrix (ι → Fin 2) (ι → Fin 2) ℂ := + Matrix.diagonal (fun s => f (s i)) + +def qmaPairDiagonal (i j : ι) (f : Fin 2 → Fin 2 → ℂ) : + Matrix (ι → Fin 2) (ι → Fin 2) ℂ := + Matrix.diagonal (fun s => f (s i) (s j)) + +theorem qmaBitDiagonal_local (i : ι) (f : Fin 2 → ℂ) : + QMALocalOn {i} (qmaBitDiagonal i f) := by + apply qmaLocalOn_diagonal + intro s t h + rw [h i (by simp)] + +theorem qmaPairDiagonal_local (i j : ι) (f : Fin 2 → Fin 2 → ℂ) : + QMALocalOn {i,j} (qmaPairDiagonal i j f) := by + apply qmaLocalOn_diagonal + intro s t h + rw [h i (by simp),h j (by simp)] + +def qmaClockFaultTerm (c : QMACircuit) (i : Fin (c.gates.length+1)) : + Matrix (QMACircuitQubit c → Fin 2) (QMACircuitQubit c → Fin 2) ℂ := + qmaPairDiagonal (Sum.inl i.castSucc) (Sum.inl i.succ) + (fun a b => if a = 0 ∧ b = 1 then 1 else 0) + +def qmaClockLeftTerm (c : QMACircuit) : + Matrix (QMACircuitQubit c → Fin 2) (QMACircuitQubit c → Fin 2) ℂ := + qmaBitDiagonal (Sum.inl 0) (fun a => if a = 1 then 0 else 1) + +def qmaClockRightTerm (c : QMACircuit) : + Matrix (QMACircuitQubit c → Fin 2) (QMACircuitQubit c → Fin 2) ℂ := + qmaBitDiagonal (Sum.inl (Fin.last (c.gates.length+1))) (fun a => if a = 0 then 0 else 1) + +def qmaInputTerm (c : QMACircuit) (i : Fin (c.work+1)) : + Matrix (QMACircuitQubit c → Fin 2) (QMACircuitQubit c → Fin 2) ℂ := + qmaPairDiagonal (Sum.inl (qmaInputMarker c)) (Sum.inr i) + (fun a b => if a = 0 then if c.witness ≤ i.val ∧ b ≠ 0 then 7 else 0 else 0) + +def qmaOutputTerm (c : QMACircuit) : + Matrix (QMACircuitQubit c → Fin 2) (QMACircuitQubit c → Fin 2) ℂ := + qmaPairDiagonal (Sum.inl (qmaOutputMarker c)) (Sum.inr (Fin.last c.work)) + (fun a b => if a = 1 ∧ b ≠ 1 then 1 else 0) + +theorem qmaClockFaultTerm_local (c : QMACircuit) (i : Fin (c.gates.length+1)) : + QMALocalOn {Sum.inl i.castSucc,Sum.inl i.succ} (qmaClockFaultTerm c i) := + qmaPairDiagonal_local _ _ _ + +theorem qmaClockLeftTerm_local (c : QMACircuit) : + QMALocalOn {Sum.inl 0} (qmaClockLeftTerm c) := qmaBitDiagonal_local _ _ + +theorem qmaClockRightTerm_local (c : QMACircuit) : + QMALocalOn {Sum.inl (Fin.last (c.gates.length+1))} (qmaClockRightTerm c) := + qmaBitDiagonal_local _ _ + +theorem qmaInputTerm_local (c : QMACircuit) (i : Fin (c.work+1)) : + QMALocalOn {Sum.inl (qmaInputMarker c),Sum.inr i} (qmaInputTerm c i) := + qmaPairDiagonal_local _ _ _ + +theorem qmaOutputTerm_local (c : QMACircuit) : + QMALocalOn {Sum.inl (qmaOutputMarker c),Sum.inr (Fin.last c.work)} (qmaOutputTerm c) := + qmaPairDiagonal_local _ _ _ + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalPropagation.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalPropagation.lean new file mode 100644 index 0000000000000000000000000000000000000000..76b65d9fcdf38b6b6bad0c3fda61ffd20756f334 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalPropagation.lean @@ -0,0 +1,87 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalAction + +namespace OAI + +/-! Every guarded propagation term acts on three clock bits and at most two +computation bits. This is the actual unary-clock operator. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +abbrev QMACircuitQubit (c : QMACircuit) := Fin (c.gates.length+2) ⊕ Fin (c.work+1) + +def qmaCircuitQubitSplit (c : QMACircuit) : + (QMACircuitQubit c → Fin 2) ≃ QMAUnaryBasis c := + Equiv.sumArrowEquivProdArrow _ _ _ + +def qmaPropagationSites (c : QMACircuit) (t : Fin c.gates.length) : Finset (QMACircuitQubit c) := + {Sum.inl (qmaClockLeft c.gates.length t),Sum.inl (qmaClockMiddle c.gates.length t), + Sum.inl (qmaClockRight c.gates.length t)} ∪ + (qmaGateSites c.work (c.gates.getD t.val (.hadamard 0))).map Function.Embedding.inr + +theorem qmaPropagationSites_card (c : QMACircuit) (t : Fin c.gates.length) : + (qmaPropagationSites c t).card ≤ 5 := by + have h := Finset.card_union_le + ({Sum.inl (qmaClockLeft c.gates.length t),Sum.inl (qmaClockMiddle c.gates.length t), + Sum.inl (qmaClockRight c.gates.length t)} : Finset (QMACircuitQubit c)) + ((qmaGateSites c.work (c.gates.getD t.val (.hadamard 0))).map Function.Embedding.inr) + have hclock : ({Sum.inl (qmaClockLeft c.gates.length t), + Sum.inl (qmaClockMiddle c.gates.length t),Sum.inl (qmaClockRight c.gates.length t)} : + Finset (QMACircuitQubit c)).card ≤ 3 := by + apply le_trans (Finset.card_insert_le _ _) + have h2 := Finset.card_insert_le (Sum.inl (qmaClockMiddle c.gates.length t)) + ({Sum.inl (qmaClockRight c.gates.length t)} : Finset (QMACircuitQubit c)) + simp only [Finset.card_singleton] at h2 + omega + have hgate := qmaGateSites_card c.work (c.gates.getD t.val (.hadamard 0)) + simp only [Finset.card_map] at h + unfold qmaPropagationSites + omega + +def qmaGuardProjection (c : QMACircuit) (t : Fin c.gates.length) : + Matrix (QMACircuitQubit c → Fin 2) (QMACircuitQubit c → Fin 2) ℂ := + Matrix.diagonal (fun s => if QMAClockGuard c.gates.length t (s ∘ Sum.inl) ∧ + s (Sum.inl (qmaClockMiddle c.gates.length t)) = 0 then 1 else 0) + +def qmaLocalPropagationDelta (c : QMACircuit) (t : Fin c.gates.length) : + Matrix (QMACircuitQubit c → Fin 2) (QMACircuitQubit c → Fin 2) ℂ := + qmaGuardProjection c t * + (qmaBitFlipMatrix (Sum.inl (qmaClockMiddle c.gates.length t))- + qmaJoinMatrix 1 (qmaStepMatrix c t.val)) + +theorem qmaGuardProjection_local (c : QMACircuit) (t : Fin c.gates.length) : + QMALocalOn (qmaPropagationSites c t) (qmaGuardProjection c t) := by + apply qmaLocalOn_diagonal + intro s r h + have hl := h (Sum.inl (qmaClockLeft c.gates.length t)) (by simp [qmaPropagationSites]) + have hm := h (Sum.inl (qmaClockMiddle c.gates.length t)) (by simp [qmaPropagationSites]) + have hr := h (Sum.inl (qmaClockRight c.gates.length t)) (by simp [qmaPropagationSites]) + simp only [QMAClockGuard,Function.comp_apply,hl,hm,hr] + split_ifs with hp + · exact (ite_eq_left hp).symm + · exact (ite_eq_right hp).symm + +theorem qmaLocalPropagationDelta_local (c : QMACircuit) (t : Fin c.gates.length) : + QMALocalOn (qmaPropagationSites c t) (qmaLocalPropagationDelta c t) := by + have hf := (qmaBitFlipMatrix_local (Sum.inl (qmaClockMiddle c.gates.length t))).mono + (T := qmaPropagationSites c t) + (by intro i hi; simp only [Finset.mem_singleton] at hi; subst i; simp [qmaPropagationSites]) + have hg := ((qmaGateMatrix_local c.work (c.gates.getD t.val (.hadamard 0))).joinRight + (ι := Fin (c.gates.length+2))).mono (T := qmaPropagationSites c t) (Finset.subset_union_right) + have hn := hg.smul (-1) + have hs := hf.add hn + simp only [neg_one_smul,←sub_eq_add_neg] at hs + exact (qmaGuardProjection_local c t).mul hs + +theorem qmaLocalPropagationGram_local (c : QMACircuit) (t : Fin c.gates.length) : + QMALocalOn (qmaPropagationSites c t) + ((qmaLocalPropagationDelta c t).conjTranspose*qmaLocalPropagationDelta c t) := + (qmaLocalPropagationDelta_local c t).adjoint.mul (qmaLocalPropagationDelta_local c t) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalRealification.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalRealification.lean new file mode 100644 index 0000000000000000000000000000000000000000..fac6069b66c7f7912adb7371368be39fe13eeb1f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalRealification.lean @@ -0,0 +1,86 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalCoordinates + +namespace OAI + +/-! The realification uses one shared extra qubit and adds at most one +qubit to each interaction support. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +def qmaRebitSites (S : Finset ι) : Finset (Unit ⊕ ι) := + insert (Sum.inl ()) (S.map Function.Embedding.inr) + +def qmaRebitOnQubits (A : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) : + Matrix (Unit ⊕ ι → Fin 2) (Unit ⊕ ι → Fin 2) ℂ := + fun s t => qmaRebitMatrix A (s (Sum.inl ()),s ∘ Sum.inr) (t (Sum.inl ()),t ∘ Sum.inr) + +omit [Fintype ι] in +theorem qmaRebitSites_card (S : Finset ι) : (qmaRebitSites S).card = S.card+1 := by + simp [qmaRebitSites] + +theorem qmaRebitOnQubits_local {S : Finset ι} + {A : Matrix (ι → Fin 2) (ι → Fin 2) ℂ} (hA : QMALocalOn S A) : + QMALocalOn (qmaRebitSites S) (qmaRebitOnQubits A) := by + obtain ⟨B,rfl⟩ := hA + let z : {i // i ∈ qmaRebitSites S} := ⟨Sum.inl (),by simp [qmaRebitSites]⟩ + let k : {i // i ∈ S} → {i // i ∈ qmaRebitSites S} := fun i => + ⟨Sum.inr i.val,by simp [qmaRebitSites,i.property]⟩ + refine ⟨(fun u v => qmaRebitMatrix B (u z,u ∘ k) (v z,v ∘ k)),?_⟩ + ext s t + change qmaRebitMatrix (qmaLocalLift S B) (s (Sum.inl ()),s ∘ Sum.inr) + (t (Sum.inl ()),t ∘ Sum.inr) = + qmaRebitMatrix B (s (Sum.inl ()),fun i => s (Sum.inr i.val)) + (t (Sum.inl ()),fun i => t (Sum.inr i.val))* + if (fun i : {i // i ∉ qmaRebitSites S} => s i.val) = + (fun i : {i // i ∉ qmaRebitSites S} => t i.val) then 1 else 0 + have he : ((fun i : {i // i ∉ qmaRebitSites S} => s i.val) = + (fun i : {i // i ∉ qmaRebitSites S} => t i.val)) ↔ + ((fun i : {i // i ∉ S} => s (Sum.inr i.val)) = + (fun i : {i // i ∉ S} => t (Sum.inr i.val))) := by + constructor + · intro h + funext i + exact congrFun h ⟨Sum.inr i.val,by simpa [qmaRebitSites] using i.property⟩ + · intro h + funext i + rcases i with ⟨i,hi⟩ + cases i with + | inl j => exact False.elim (hi (by simp [qmaRebitSites])) + | inr j => exact congrFun h ⟨j,by simpa [qmaRebitSites] using hi⟩ + by_cases hr : (fun i : {i // i ∉ S} => s (Sum.inr i.val)) = + (fun i : {i // i ∉ S} => t (Sum.inr i.val)) + · have hr' := he.mpr hr + simp only [qmaRebitMatrix,qmaLocalLift_apply, + Function.comp_apply,hr,hr',ite_true,mul_one] + · have hr' : (fun i : {i // i ∉ qmaRebitSites S} => s i.val) ≠ + (fun i : {i // i ∉ qmaRebitSites S} => t i.val) := fun h => hr (he.mp h) + simp only [qmaRebitMatrix,qmaLocalLift_apply, + Function.comp_apply,hr,hr',ite_false,mul_zero,Complex.zero_re,Complex.zero_im, + Complex.ofReal_zero,neg_zero,ite_self] + +omit [Fintype ι] [DecidableEq ι] in +theorem qmaRebitOnQubits_add (A B : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) : + qmaRebitOnQubits (A+B) = qmaRebitOnQubits A+qmaRebitOnQubits B := by + ext s t + simp only [qmaRebitOnQubits,qmaRebitMatrix,Matrix.add_apply,Complex.add_re,Complex.add_im] + split_ifs <;> push_cast <;> ring + +omit [Fintype ι] [DecidableEq ι] in +theorem qmaRebitOnQubits_smul (a : ℝ) (A : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) : + qmaRebitOnQubits ((a:ℂ) • A) = (a:ℂ) • qmaRebitOnQubits A := by + ext s t + simp only [qmaRebitOnQubits,qmaRebitMatrix,Matrix.smul_apply,smul_eq_mul, + Complex.mul_re,Complex.mul_im,Complex.ofReal_re,Complex.ofReal_im,zero_mul, + add_zero,sub_zero] + split_ifs <;> push_cast <;> ring + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalSubdivision.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalSubdivision.lean new file mode 100644 index 0000000000000000000000000000000000000000..03d8e1176abc2a52a364a9b07a2cde3de384a559 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalSubdivision.lean @@ -0,0 +1,44 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliSubdivision +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalPauli + +namespace OAI + +/-! Each real local family admits the actual simultaneous subdivision step. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι α : Type*} [Fintype ι] [DecidableEq ι] [Fintype α] + +theorem qmaLocalSubdivision_exists (F : α → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (S : α → Finset ι) {d : ℕ} (hS : ∀ a, (S a).card ≤ 2*d) + (hF : ∀ a, QMALocalOn (S a) (F a)) (hH : ∀ a, (F a).IsHermitian) + (hR : ∀ a, QMAEntryParity false (F a)) {N : ℝ} (hN : 1 ≤ N) : + ∃ G : (QMALocalEvenPauliTerm S × Fin 4) → + Matrix (ι ⊕ QMALocalEvenPauliTerm S → Fin 2) (ι ⊕ QMALocalEvenPauliTerm S → Fin 2) ℂ, + (∀ p, (G p).IsHermitian) ∧ (∀ p, QMAEntryParity false (G p)) ∧ + (∀ p, ∃ T : Finset (ι ⊕ QMALocalEvenPauliTerm S), T.card ≤ d+1 ∧ QMALocalOn T (G p)) ∧ + |MediatorGraph.normalizedBottom (∑ p, G p)-MediatorGraph.normalizedBottom (∑ a, F a)| ≤ 1/N := by + obtain ⟨G,hGH,hGR,hGS,hGE⟩ := qmaPauliSubdivision_exists + (fun p : QMALocalEvenPauliTerm S => qmaLocalPauliWord S p.val) + (fun p => qmaLocalPauliCoefficient F S p.val) + (qmaLocalEvenPauli_support S hS) (qmaLocalEvenPauli_even S) hN + refine ⟨G,hGH,hGR,hGS,?_⟩ + have hs : (∑ p : QMALocalEvenPauliTerm S, + (qmaLocalPauliCoefficient F S p.val : ℂ) • qmaPauliWord (qmaLocalPauliWord S p.val)) = + ∑ a, F a := qmaLocalEvenPauli_sum F S hF hH hR + rwa [hs] at hGE + +theorem qmaLocalSubdivision_size (S : α → Finset ι) {d : ℕ} (hS : ∀ a, (S a).card ≤ 2*d) : + Fintype.card (ι ⊕ QMALocalEvenPauliTerm S) ≤ Fintype.card ι+4^(2*d)*Fintype.card α ∧ + Fintype.card (QMALocalEvenPauliTerm S × Fin 4) ≤ 4*4^(2*d)*Fintype.card α := by + have hc := qmaLocalEvenPauli_count S hS + simp only [Fintype.card_sum,Fintype.card_prod,Fintype.card_fin] + constructor <;> nlinarith + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalSupported.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalSupported.lean new file mode 100644 index 0000000000000000000000000000000000000000..40476669641f159662592bbe525d19f846d9aa9c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalSupported.lean @@ -0,0 +1,41 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSupportedSubdivision +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalPauli + +namespace OAI + +/-! Each real local family admits the actual simultaneous subdivision step. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι α : Type*} [Fintype ι] [DecidableEq ι] [Fintype α] + +theorem qmaLocalSubdivision_supported (F : α → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (S : α → Finset ι) {d : ℕ} (hS : ∀ a, (S a).card ≤ 2*d) + (hF : ∀ a, QMALocalOn (S a) (F a)) (hH : ∀ a, (F a).IsHermitian) + (hR : ∀ a, QMAEntryParity false (F a)) {N : ℝ} (hN : 1 ≤ N) : + ∃ G : (QMALocalEvenPauliTerm S × Fin 4) → + Matrix (ι ⊕ QMALocalEvenPauliTerm S → Fin 2) (ι ⊕ QMALocalEvenPauliTerm S → Fin 2) ℂ, + (∀ p, (G p).IsHermitian) ∧ (∀ p, QMAEntryParity false (G p)) ∧ + (∀ p, ∃ T : Finset (ι ⊕ QMALocalEvenPauliTerm S), T.card ≤ d+1 ∧ QMALocalOn T (G p) ∧ + T ⊆ qmaMediatorSupport (S p.1.val.1) p.1) ∧ + |MediatorGraph.normalizedBottom (∑ p, G p)-MediatorGraph.normalizedBottom (∑ a, F a)| ≤ 1/N := by + obtain ⟨G,hGH,hGR,hGS,hGE⟩ := qmaPauliSubdivision_supported + (fun p : QMALocalEvenPauliTerm S => qmaLocalPauliWord S p.val) + (fun p => qmaLocalPauliCoefficient F S p.val) + (qmaLocalEvenPauli_support S hS) (qmaLocalEvenPauli_even S) hN + refine ⟨G,hGH,hGR,?_,?_⟩ + · intro p + obtain ⟨T,hTc,hTl,hTs⟩ := hGS p + exact ⟨T,hTc,hTl,hTs.trans (qmaMediatorSupport_mono (qmaPauliExtend_support _ _) _)⟩ + · have hs : (∑ p : QMALocalEvenPauliTerm S, + (qmaLocalPauliCoefficient F S p.val : ℂ) • qmaPauliWord (qmaLocalPauliWord S p.val)) = + ∑ a, F a := qmaLocalEvenPauli_sum F S hF hH hR + rwa [hs] at hGE + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalTensor.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..1fe06df015e5bbf5b2fba9d5eaf8152dcdf5d035 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalTensor.lean @@ -0,0 +1,76 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalLift + +namespace OAI + +/-! Tensor products with identity spectators are actual finite-support +operators, with their small matrix given explicitly. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +theorem qmaLocalLift_apply (S : Finset ι) + (A : Matrix (QMASupportBasis S) (QMASupportBasis S) ℂ) (s t : ι → Fin 2) : + qmaLocalLift S A s t = + A (fun i => s i.val) (fun i => t i.val)* + if (fun i : {i // i ∉ S} => s i.val) = (fun i : {i // i ∉ S} => t i.val) then 1 else 0 := by + rfl + +theorem qmaLocalOn_permutation (S : Finset ι) (F : (ι → Fin 2) → (ι → Fin 2)) + (f : QMASupportBasis S → QMASupportBasis S) + (hcore : ∀ t, (qmaSupportSplit S (F t)).1 = f (qmaSupportSplit S t).1) + (hrest : ∀ t, (qmaSupportSplit S (F t)).2 = (qmaSupportSplit S t).2) : + QMALocalOn S (fun s t => if s = F t then (1:ℂ) else 0) := by + refine ⟨(fun s t => if s = f t then 1 else 0),?_⟩ + ext s t + change (if s = F t then (1:ℂ) else 0) = + (if (qmaSupportSplit S s).1 = f (qmaSupportSplit S t).1 then 1 else 0)* + if (qmaSupportSplit S s).2 = (qmaSupportSplit S t).2 then 1 else 0 + by_cases hr : (qmaSupportSplit S s).2 = (qmaSupportSplit S t).2 + · have he : (qmaSupportSplit S s).1 = f (qmaSupportSplit S t).1 ↔ s = F t := by + constructor + · intro hc + apply (qmaSupportSplit S).injective + exact Prod.ext (hc.trans (hcore t).symm) (hr.trans (hrest t).symm) + · intro h + subst s + exact hcore t + simp [hr,he] + · have he : s ≠ F t := by + intro h + subst s + exact hr (hrest t) + simp [hr,he] + +theorem qmaLocalOn_sourceTensor (n : ℕ) (S : Finset (Fin n)) + (M : Fin n → Matrix (Fin 2) (Fin 2) ℂ) (hM : ∀ i, i ∉ S → M i = 1) : + QMALocalOn S (sourceTensor n M) := by + refine ⟨(fun s t => ∏ i : {i // i ∈ S}, M i.val (s i) (t i)),?_⟩ + ext s t + change (∏ i, M i (s i) (t i)) = + (∏ i : {i // i ∈ S}, M i.val (s i.val) (t i.val))* + if (fun i : {i // i ∉ S} => s i.val) = (fun i : {i // i ∉ S} => t i.val) then 1 else 0 + by_cases hr : (fun i : {i // i ∉ S} => s i.val) = (fun i : {i // i ∉ S} => t i.val) + · rw [ite_eq_left hr,mul_one] + have he (i : Fin n) (_hi : i ∈ Finset.univ) (hi : i ∉ S) : M i (s i) (t i) = 1 := by + rw [hM i hi] + have ht := congrFun hr ⟨i,hi⟩ + exact ite_eq_left ht + have hp := Finset.prod_subset (Finset.subset_univ S) he + have hs := Finset.prod_subtype (F := inferInstance) S + (by simp : ∀ i, i ∈ S ↔ i ∈ S) (fun i => M i (s i) (t i)) + exact hp.symm.trans hs + · rw [ite_eq_right hr,mul_zero] + obtain ⟨i,hi⟩ := Function.ne_iff.mp hr + apply Finset.prod_eq_zero (Finset.mem_univ i.val) + rw [hM i.val i.property] + exact ite_eq_right hi + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalThird.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalThird.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3a3ebfae412913977bd70b23c813d8cb053c93c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalThird.lean @@ -0,0 +1,46 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliThird +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalPauli + +namespace OAI + +/-! A real three-local family reduces to a real two-local family, with +seven output terms per even Pauli word and the actual spectral error. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι α : Type*} [Fintype ι] [DecidableEq ι] [Fintype α] + +theorem qmaLocalThird_exists (F : α → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (S : α → Finset ι) (hS : ∀ a, (S a).card ≤ 3) + (hF : ∀ a, QMALocalOn (S a) (F a)) (hH : ∀ a, (F a).IsHermitian) + (hR : ∀ a, QMAEntryParity false (F a)) {N : ℝ} (hN : 1 ≤ N) : + ∃ G : (QMALocalEvenPauliTerm S × Fin 7) → + Matrix (ι ⊕ QMALocalEvenPauliTerm S → Fin 2) (ι ⊕ QMALocalEvenPauliTerm S → Fin 2) ℂ, + (∀ p, (G p).IsHermitian) ∧ (∀ p, QMAEntryParity false (G p)) ∧ + (∀ p, ∃ T : Finset (ι ⊕ QMALocalEvenPauliTerm S), T.card ≤ 2 ∧ QMALocalOn T (G p)) ∧ + |MediatorGraph.normalizedBottom (∑ p, G p)-MediatorGraph.normalizedBottom (∑ a, F a)| ≤ 1/N := by + obtain ⟨G,hGH,hGR,hGS,hGE⟩ := qmaPauliThird_exists + (fun p : QMALocalEvenPauliTerm S => qmaLocalPauliWord S p.val) + (fun p => qmaLocalPauliCoefficient F S p.val) + (qmaLocalEvenPauli_support S hS) (qmaLocalEvenPauli_even S) hN + refine ⟨G,hGH,hGR,hGS,?_⟩ + have hs : (∑ p : QMALocalEvenPauliTerm S, + (qmaLocalPauliCoefficient F S p.val : ℂ) • qmaPauliWord (qmaLocalPauliWord S p.val)) = + ∑ a, F a := qmaLocalEvenPauli_sum F S hF hH hR + rwa [hs] at hGE + +theorem qmaLocalThird_size (S : α → Finset ι) (hS : ∀ a, (S a).card ≤ 3) : + Fintype.card (ι ⊕ QMALocalEvenPauliTerm S) ≤ Fintype.card ι+64*Fintype.card α ∧ + Fintype.card (QMALocalEvenPauliTerm S × Fin 7) ≤ 448*Fintype.card α := by + have hc := qmaLocalEvenPauli_count S hS + norm_num only [show (4:ℕ)^3 = 64 by norm_num] at hc + simp only [Fintype.card_sum,Fintype.card_prod,Fintype.card_fin] + constructor <;> omega + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalThirdSupported.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalThirdSupported.lean new file mode 100644 index 0000000000000000000000000000000000000000..84b540f7d6c97986a1153feef0dd3c98173f4447 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumLocalThirdSupported.lean @@ -0,0 +1,41 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSupportedThird +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalPauli + +namespace OAI + +/-! Each real local family admits the actual simultaneous subdivision step. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι α : Type*} [Fintype ι] [DecidableEq ι] [Fintype α] + +theorem qmaLocalThird_supported (F : α → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (S : α → Finset ι) (hS : ∀ a, (S a).card ≤ 3) + (hF : ∀ a, QMALocalOn (S a) (F a)) (hH : ∀ a, (F a).IsHermitian) + (hR : ∀ a, QMAEntryParity false (F a)) {N : ℝ} (hN : 1 ≤ N) : + ∃ G : (QMALocalEvenPauliTerm S × Fin 7) → + Matrix (ι ⊕ QMALocalEvenPauliTerm S → Fin 2) (ι ⊕ QMALocalEvenPauliTerm S → Fin 2) ℂ, + (∀ p, (G p).IsHermitian) ∧ (∀ p, QMAEntryParity false (G p)) ∧ + (∀ p, ∃ T : Finset (ι ⊕ QMALocalEvenPauliTerm S), T.card ≤ 2 ∧ QMALocalOn T (G p) ∧ + T ⊆ qmaMediatorSupport (S p.1.val.1) p.1) ∧ + |MediatorGraph.normalizedBottom (∑ p, G p)-MediatorGraph.normalizedBottom (∑ a, F a)| ≤ 1/N := by + obtain ⟨G,hGH,hGR,hGS,hGE⟩ := qmaPauliThird_supported + (fun p : QMALocalEvenPauliTerm S => qmaLocalPauliWord S p.val) + (fun p => qmaLocalPauliCoefficient F S p.val) + (qmaLocalEvenPauli_support S hS) (qmaLocalEvenPauli_even S) hN + refine ⟨G,hGH,hGR,?_,?_⟩ + · intro p + obtain ⟨T,hTc,hTl,hTs⟩ := hGS p + exact ⟨T,hTc,hTl,hTs.trans (qmaMediatorSupport_mono (qmaPauliExtend_support _ _) _)⟩ + · have hs : (∑ p : QMALocalEvenPauliTerm S, + (qmaLocalPauliCoefficient F S p.val : ℂ) • qmaPauliWord (qmaLocalPauliWord S p.val)) = + ∑ a, F a := qmaLocalEvenPauli_sum F S hF hH hR + rwa [hs] at hGE + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumManhattanListProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumManhattanListProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..ab4ff11f15f2c745366d75b448f6f81e6324c707 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumManhattanListProgram.lean @@ -0,0 +1,43 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRouteProgram +import OAI.Computability.QuantumFactoring.BitStackBoundedUnary +import OAI.Computability.QuantumFactoring.BitStackTabulate + +namespace OAI + +/-! Enumerate the Manhattan segment with an explicit fixed route budget. +The cap makes enumeration polynomial on every input, and disappears for +the spatial routes satisfying the proved length bound. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumManhattanListProgram +open ExactQuantumFactoring.BitStackProgram QuantumRouteCode + +abbrev Ends := Pair × Pair +def endsCode : Ends → List Bool := prodCode pairCode pairCode + +def value (K : ℕ) (x : Ends) : List Pair := + (List.range (min K (qmaManhattanLength x.1 x.2)+1)).map (qmaManhattanPoint x.1 x.2) + +noncomputable def distanceProgram : Procedure endsCode Nat.bits + (fun x => qmaManhattanLength x.1 x.2) := + QuantumRouteCode.lengthProgram.comp + ((Procedure.identity endsCode).pair (Procedure.constant endsCode Nat.bits 0)) + +noncomputable def program (K : ℕ) : Procedure endsCode (listCode pairCode) (value K) := by + let length := Procedure.clippedUnary.comp + ((Procedure.constant endsCode unaryCode K).pair distanceProgram) + let point := QuantumRouteCode.pointProgram.comp + ((Procedure.second unaryCode endsCode).pair + (Procedure.unaryToBits.comp (Procedure.first unaryCode endsCode))) + exact (Procedure.tabulate (f := fun x i => qmaManhattanPoint x.1 x.2 i) (0,0) point).comp + ((Procedure.unarySuccessor.comp length).pair (Procedure.identity endsCode)) + +theorem value_exact (K : ℕ) (x : Ends) (h : qmaManhattanLength x.1 x.2 ≤ K) : + value K x = (List.range (qmaManhattanLength x.1 x.2+1)).map (qmaManhattanPoint x.1 x.2) := by + simp only [value,Nat.min_eq_right h] + +end ContinuumCoulomb.QuantumManhattanListProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumManhattanRoute.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumManhattanRoute.lean new file mode 100644 index 0000000000000000000000000000000000000000..5dffbe9afc872da8a7d32d9839812a5d393a5ead --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumManhattanRoute.lean @@ -0,0 +1,130 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridSlots +import Mathlib.Data.Nat.Dist +import Mathlib.Data.Int.NatAbs + +namespace OAI + +/-! Short, simple lattice paths between the bounded-density fine-grid sites. -/ + +namespace ContinuumCoulomb + +def qmaAxisWalk (a b k : ℕ) : ℕ := if a ≤ b then a+k else a-k + +@[simp] theorem qmaAxisWalk_zero (a b : ℕ) : qmaAxisWalk a b 0 = a := by + simp [qmaAxisWalk] + +@[simp] theorem qmaAxisWalk_last (a b : ℕ) : qmaAxisWalk a b (Nat.dist a b) = b := by + unfold qmaAxisWalk Nat.dist + split_ifs <;> omega + +theorem qmaAxisWalk_distance (a b k : ℕ) (hk : k ≤ Nat.dist a b) : + Nat.dist a (qmaAxisWalk a b k) = k := by + unfold qmaAxisWalk Nat.dist at * + split_ifs <;> omega + +theorem qmaAxisWalk_step (a b k : ℕ) (hk : k < Nat.dist a b) : + Nat.dist (qmaAxisWalk a b k) (qmaAxisWalk a b (k+1)) = 1 := by + unfold qmaAxisWalk Nat.dist at * + split_ifs <;> omega + +theorem qmaAxisWalk_bounds (a b k : ℕ) (hk : k ≤ Nat.dist a b) : + min a b ≤ qmaAxisWalk a b k ∧ qmaAxisWalk a b k ≤ max a b := by + unfold qmaAxisWalk Nat.dist at * + split_ifs <;> omega + +def qmaManhattanLength (p q : ℕ × ℕ) : ℕ := Nat.dist p.1 q.1+Nat.dist p.2 q.2 + +def qmaManhattanPoint (p q : ℕ × ℕ) (k : ℕ) : ℕ × ℕ := + if k ≤ Nat.dist p.1 q.1 then (qmaAxisWalk p.1 q.1 k,p.2) + else (q.1,qmaAxisWalk p.2 q.2 (k-Nat.dist p.1 q.1)) + +@[simp] theorem qmaManhattanPoint_zero (p q : ℕ × ℕ) : qmaManhattanPoint p q 0 = p := by + simp [qmaManhattanPoint] + +@[simp] theorem qmaManhattanPoint_last (p q : ℕ × ℕ) : + qmaManhattanPoint p q (qmaManhattanLength p q) = q := by + by_cases h : Nat.dist p.2 q.2 = 0 + · have he := Nat.eq_of_dist_eq_zero h + simp [qmaManhattanLength,qmaManhattanPoint,he] + · have hn : ¬qmaManhattanLength p q ≤ Nat.dist p.1 q.1 := by unfold qmaManhattanLength; omega + simp only [qmaManhattanPoint,ite_eq_right hn] + simp [qmaManhattanLength] + +theorem qmaManhattanPoint_distance (p q : ℕ × ℕ) (k : ℕ) (hk : k ≤ qmaManhattanLength p q) : + Nat.dist p.1 (qmaManhattanPoint p q k).1+ + Nat.dist p.2 (qmaManhattanPoint p q k).2 = k := by + by_cases hx : k ≤ Nat.dist p.1 q.1 + · simp [qmaManhattanPoint,hx,qmaAxisWalk_distance _ _ _ hx] + · have hy : k-Nat.dist p.1 q.1 ≤ Nat.dist p.2 q.2 := by unfold qmaManhattanLength at hk; omega + simp only [qmaManhattanPoint,hx,ite_false] + rw [qmaAxisWalk_distance _ _ _ hy] + omega + +theorem qmaManhattanPoint_step (p q : ℕ × ℕ) (k : ℕ) (hk : k < qmaManhattanLength p q) : + Nat.dist (qmaManhattanPoint p q k).1 (qmaManhattanPoint p q (k+1)).1+ + Nat.dist (qmaManhattanPoint p q k).2 (qmaManhattanPoint p q (k+1)).2 = 1 := by + by_cases hx : k < Nat.dist p.1 q.1 + · have hx0 : k ≤ Nat.dist p.1 q.1 := by omega + have hx1 : k+1 ≤ Nat.dist p.1 q.1 := by omega + simp [qmaManhattanPoint,hx0,hx1,qmaAxisWalk_step _ _ _ hx] + · by_cases he : k = Nat.dist p.1 q.1 + · subst k + have hy : 0 < Nat.dist p.2 q.2 := by unfold qmaManhattanLength at hk; omega + simpa [qmaManhattanPoint] using qmaAxisWalk_step p.2 q.2 0 hy + · have hx0 : ¬k ≤ Nat.dist p.1 q.1 := by omega + have hx1 : ¬k+1 ≤ Nat.dist p.1 q.1 := by omega + have hy : k-Nat.dist p.1 q.1 < Nat.dist p.2 q.2 := by unfold qmaManhattanLength at hk; omega + have hs : k+1-Nat.dist p.1 q.1 = (k-Nat.dist p.1 q.1)+1 := by omega + simp [qmaManhattanPoint,hx0,hx1,hs,qmaAxisWalk_step _ _ _ hy] + +def qmaManhattanRoute (p q : ℕ × ℕ) : Fin (qmaManhattanLength p q+1) → ℕ × ℕ := + fun k => qmaManhattanPoint p q k.val + +theorem qmaManhattanRoute_injective (p q : ℕ × ℕ) : Function.Injective (qmaManhattanRoute p q) := by + intro a b hab + apply Fin.ext + have ha := qmaManhattanPoint_distance p q a.val (by omega) + have hb := qmaManhattanPoint_distance p q b.val (by omega) + change qmaManhattanPoint p q a.val = qmaManhattanPoint p q b.val at hab + rw [hab] at ha + omega + +theorem qmaManhattanPoint_bounds (p q : ℕ × ℕ) (k : ℕ) (hk : k ≤ qmaManhattanLength p q) : + min p.1 q.1 ≤ (qmaManhattanPoint p q k).1 ∧ + (qmaManhattanPoint p q k).1 ≤ max p.1 q.1 ∧ + min p.2 q.2 ≤ (qmaManhattanPoint p q k).2 ∧ + (qmaManhattanPoint p q k).2 ≤ max p.2 q.2 := by + by_cases hx : k ≤ Nat.dist p.1 q.1 + · simpa only [qmaManhattanPoint,hx,ite_true] using + And.intro (qmaAxisWalk_bounds _ _ _ hx).1 + (And.intro (qmaAxisWalk_bounds _ _ _ hx).2 (And.intro (min_le_left _ _) (le_max_left _ _))) + · have hy : k-Nat.dist p.1 q.1 ≤ Nat.dist p.2 q.2 := by unfold qmaManhattanLength at hk; omega + simpa only [qmaManhattanPoint,hx,ite_false] using + And.intro (min_le_right _ _) + (And.intro (le_max_right _ _) (qmaAxisWalk_bounds _ _ _ hy)) + +noncomputable def qmaFineGridPoint {Q : Type*} [Fintype Q] {rows width A : ℕ} + (cell : Q → QMAGridCell rows width) + (h : ∀ p, (Finset.univ.filter (fun q => cell q = p)).card ≤ A) (q : Q) : ℕ × ℕ := + ((qmaFineGridSite cell h q).1.val,(qmaFineGridSite cell h q).2.val) + +theorem qmaFineGridPoint_length {Q : Type*} [Fintype Q] {rows width A : ℕ} + (cell : Q → QMAGridCell rows width) + (h : ∀ p, (Finset.univ.filter (fun q => cell q = p)).card ≤ A) + (p q : Q) (a : QMAGridCell rows width) + (hp : QMAGridCellsNear (cell p) a) (hq : QMAGridCellsNear (cell q) a) : + qmaManhattanLength (qmaFineGridPoint cell h p) (qmaFineGridPoint cell h q) ≤ 3*A+2 := by + obtain ⟨hp1,hp2,hp3,hp4⟩ := qmaFineGridSite_bounds cell h p a hp + obtain ⟨hq1,hq2,hq3,hq4⟩ := qmaFineGridSite_bounds cell h q a hq + simp only [Nat.add_mul] at hp1 hq1 + unfold qmaManhattanLength qmaFineGridPoint Nat.dist + omega + +theorem qmaNatDist_eq_int (a b : ℕ) : Nat.dist a b = Int.natAbs ((a:ℤ)-(b:ℤ)) := by + by_cases h : a ≤ b + · rw [Nat.dist_eq_sub_of_le h,Int.natAbs_natCast_sub_natCast_of_le h] + · rw [Nat.dist_eq_sub_of_le_right (by omega),Int.natAbs_natCast_sub_natCast_of_ge (by omega)] + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumManhattanSupport.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumManhattanSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..d55bbcdb13c7675f7ae9b27206eb3f03ba626291 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumManhattanSupport.lean @@ -0,0 +1,61 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumManhattanRoute + +namespace OAI + +/-! Exact support of the two-segment lattice route. -/ + +namespace ContinuumCoulomb + +def qmaBetween (a b x : ℕ) : Prop := min a b ≤ x ∧ x ≤ max a b + +def qmaManhattanSupport (p q z : ℕ × ℕ) : Prop := + (z.2 = p.2 ∧ qmaBetween p.1 q.1 z.1) ∨ + (z.1 = q.1 ∧ qmaBetween p.2 q.2 z.2) + +theorem qmaAxisWalk_at_between {a b x : ℕ} (h : qmaBetween a b x) : + qmaAxisWalk a b (Nat.dist a x) = x ∧ Nat.dist a x ≤ Nat.dist a b := by + unfold qmaBetween qmaAxisWalk Nat.dist at * + split_ifs <;> omega + +theorem qmaManhattanPoint_support (p q : ℕ × ℕ) (k : ℕ) + (hk : k ≤ qmaManhattanLength p q) : qmaManhattanSupport p q (qmaManhattanPoint p q k) := by + by_cases hx : k ≤ Nat.dist p.1 q.1 + · left + simp only [qmaManhattanPoint,ite_eq_left hx] + exact ⟨True.intro,qmaAxisWalk_bounds _ _ _ hx⟩ + · right + have hy : k-Nat.dist p.1 q.1 ≤ Nat.dist p.2 q.2 := by + unfold qmaManhattanLength at hk + omega + simp only [qmaManhattanPoint,ite_eq_right hx] + exact ⟨True.intro,qmaAxisWalk_bounds _ _ _ hy⟩ + +theorem qmaManhattanSupport_point {p q z : ℕ × ℕ} (hz : qmaManhattanSupport p q z) : + ∃ k, k ≤ qmaManhattanLength p q ∧ qmaManhattanPoint p q k = z := by + rcases hz with ⟨hy,hx⟩ | ⟨hx,hy⟩ + · obtain ⟨he,hk⟩ := qmaAxisWalk_at_between hx + refine ⟨Nat.dist p.1 z.1,by unfold qmaManhattanLength; omega,?_⟩ + simp only [qmaManhattanPoint,ite_eq_left hk,he] + exact Prod.ext rfl hy.symm + · obtain ⟨he,hk⟩ := qmaAxisWalk_at_between hy + refine ⟨Nat.dist p.1 q.1+Nat.dist p.2 z.2,by unfold qmaManhattanLength; omega,?_⟩ + by_cases hzero : Nat.dist p.2 z.2 = 0 + · have hyz := Nat.eq_of_dist_eq_zero hzero + simp only [qmaManhattanPoint,hzero,add_zero,le_refl,ite_true,qmaAxisWalk_last] + exact Prod.ext hx.symm hyz + · have hn : ¬Nat.dist p.1 q.1+Nat.dist p.2 z.2 ≤ Nat.dist p.1 q.1 := by omega + simp only [qmaManhattanPoint,ite_eq_right hn,Nat.add_sub_cancel_left,he] + exact Prod.ext hx.symm rfl + +theorem qmaManhattanRoute_range (p q z : ℕ × ℕ) : + z ∈ Set.range (qmaManhattanRoute p q) ↔ qmaManhattanSupport p q z := by + constructor + · rintro ⟨k,rfl⟩ + exact qmaManhattanPoint_support p q k.val (by omega) + · intro hz + obtain ⟨k,hk,he⟩ := qmaManhattanSupport_point hz + exact ⟨⟨k,by omega⟩,he⟩ + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMappedGate.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMappedGate.lean new file mode 100644 index 0000000000000000000000000000000000000000..966a6784c2a85fd4f8ffd7d5fdbd41b4698e9c13 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMappedGate.lean @@ -0,0 +1,49 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumWireRouting + +namespace OAI + +/-! Explicit gate addresses for a logical register embedded in a larger wire grid. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +def qmaMapGate (sourceWork targetWork : ℕ) (f : Fin (sourceWork+1) → Fin (targetWork+1)) : + QMAGate → QMAGate + | .hadamard i => .hadamard (f (qmaQubit sourceWork i)).val + | .phaseT i => .phaseT (f (qmaQubit sourceWork i)).val + | .controlledNot i j => + .controlledNot (f (qmaQubit sourceWork i)).val (f (qmaQubit sourceWork j)).val + +theorem qmaMapGate_wellFormed (sourceWork targetWork : ℕ) + (f : Fin (sourceWork+1) → Fin (targetWork+1)) (hf : Function.Injective f) + (g : QMAGate) (hg : g.WellFormed (sourceWork+1)) : + (qmaMapGate sourceWork targetWork f g).WellFormed (targetWork+1) := by + cases g with + | hadamard i => exact (f (qmaQubit sourceWork i)).isLt + | phaseT i => exact (f (qmaQubit sourceWork i)).isLt + | controlledNot i j => + refine ⟨(f (qmaQubit sourceWork i)).isLt,(f (qmaQubit sourceWork j)).isLt,?_⟩ + intro he + have h := congrArg Fin.val (hf (Fin.ext he)) + simp only [qmaQubit,Nat.mod_eq_of_lt hg.1,Nat.mod_eq_of_lt hg.2.1] at h + exact hg.2.2 h + +theorem qmaRelabelGate_map (sourceWork targetWork : ℕ) + (f : Fin (sourceWork+1) → Fin (targetWork+1)) + (σ : Equiv.Perm (Fin (targetWork+1))) (g : QMAGate) : + qmaRelabelGate targetWork σ (qmaMapGate sourceWork targetWork f g) = + qmaMapGate sourceWork targetWork (σ ∘ f) g := by + cases g <;> simp only [qmaMapGate,qmaRelabelGate,qmaQubit_fin,Function.comp_apply] + +theorem qmaMapGate_congr (sourceWork targetWork : ℕ) + (f h : Fin (sourceWork+1) → Fin (targetWork+1)) (he : ∀ i, f i = h i) (g : QMAGate) : + qmaMapGate sourceWork targetWork f g = qmaMapGate sourceWork targetWork h g := by + have hf : f = h := funext he + rw [hf] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMask.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMask.lean new file mode 100644 index 0000000000000000000000000000000000000000..cedd557ef24f25e309c9b3385f271932e19a6dd7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMask.lean @@ -0,0 +1,65 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumAncilla + +namespace OAI + +/-! Coordinate projections for the initial and output penalties. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators Classical + +def qmaMask {n : ℕ} (p : SourceSpinBasis n → Prop) : + EuclideanSpace ℂ (SourceSpinBasis n) →ₗ[ℂ] EuclideanSpace ℂ (SourceSpinBasis n) := by + classical + exact { + toFun := fun u => WithLp.toLp 2 (fun s => if p s then u s else 0) + map_add' := by intro u v; ext s; by_cases hs : p s <;> simp [hs] + map_smul' := by intro a u; ext s; by_cases hs : p s <;> simp [hs] } + +@[simp] theorem qmaMask_apply {n : ℕ} (p : SourceSpinBasis n → Prop) + (u : EuclideanSpace ℂ (SourceSpinBasis n)) (s : SourceSpinBasis n) : + qmaMask p u s = if p s then u s else 0 := rfl + +theorem qmaMask_norm_le {n : ℕ} (p : SourceSpinBasis n → Prop) + (u : EuclideanSpace ℂ (SourceSpinBasis n)) : ‖qmaMask p u‖ ≤ ‖u‖ := by + classical + apply (sq_le_sq₀ (norm_nonneg _) (norm_nonneg _)).mp + rw [EuclideanSpace.norm_sq_eq,EuclideanSpace.norm_sq_eq] + apply Finset.sum_le_sum + intro s _ + by_cases hs : p s <;> simp [qmaMask_apply,hs] + +theorem qmaMask_complement_square {n : ℕ} (p : SourceSpinBasis n → Prop) + (u : EuclideanSpace ℂ (SourceSpinBasis n)) : + ‖qmaMask p u‖^2+‖qmaMask (fun s => ¬p s) u‖^2 = ‖u‖^2 := by + classical + simp only [EuclideanSpace.norm_sq_eq,←Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro s _ + by_cases hs : p s <;> simp [hs] + +theorem qmaMask_sub_norm_le {n : ℕ} (p : SourceSpinBasis n → Prop) + (u v : EuclideanSpace ℂ (SourceSpinBasis n)) : + ‖qmaMask p u-qmaMask p v‖ ≤ ‖u-v‖ := by + rw [←map_sub] + exact qmaMask_norm_le p (u-v) + +theorem qmaMask_square_difference {n : ℕ} (p : SourceSpinBasis n → Prop) + (u v : EuclideanSpace ℂ (SourceSpinBasis n)) : + |‖qmaMask p u‖^2-‖qmaMask p v‖^2| ≤ (‖u‖+‖v‖)*‖u-v‖ := by + rw [sq_sub_sq,abs_mul,abs_of_nonneg (add_nonneg (norm_nonneg _) (norm_nonneg _))] + have ha := (abs_norm_sub_norm_le (qmaMask p u) (qmaMask p v)).trans (qmaMask_sub_norm_le p u v) + have hb := add_le_add (qmaMask_norm_le p u) (qmaMask_norm_le p v) + exact mul_le_mul hb ha (abs_nonneg _) (by positivity) + +theorem qmaMask_sub_self {n : ℕ} (p : SourceSpinBasis n → Prop) + (u : EuclideanSpace ℂ (SourceSpinBasis n)) : + u-qmaMask p u = qmaMask (fun s => ¬p s) u := by + ext s + by_cases hs : p s <;> simp [hs] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMatrixError.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMatrixError.lean new file mode 100644 index 0000000000000000000000000000000000000000..380db6d317bafeb9fd092f8e02fc7d606e7a8467 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMatrixError.lean @@ -0,0 +1,53 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalCore + +namespace OAI + +/-! Entrywise errors of the bounded-size local matrices give quadratic +bounds that can be summed before any spectral approximation. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +theorem qmaQuadratic_entry_bound {ι : Type*} [Fintype ι] + (A : Matrix ι ι ℂ) (B : ℝ) (hB : 0 ≤ B) (hA : ∀ i j, ‖A i j‖ ≤ B) + (u : ι → ℂ) : + |qmaQuadratic A u| ≤ (Fintype.card ι:ℝ)*B*(∑ i, ‖u i‖^2) := by + have he : qmaQuadratic A u = (∑ i, ∑ j, star (u i)*(A i j*u j)).re := by + simp [qmaQuadratic,Matrix.mulVec,dotProduct,Finset.mul_sum] + rw [he] + calc + _ ≤ ‖∑ i, ∑ j, star (u i)*(A i j*u j)‖ := Complex.abs_re_le_norm _ + _ ≤ ∑ i, ∑ j, ‖star (u i)*(A i j*u j)‖ := by + apply (norm_sum_le _ _).trans + apply Finset.sum_le_sum + intro i _ + exact norm_sum_le _ _ + _ ≤ ∑ i, ∑ j, ‖u i‖*B*‖u j‖ := by + apply Finset.sum_le_sum + intro i _ + apply Finset.sum_le_sum + intro j _ + simp only [norm_mul,norm_star] + calc + _ ≤ ‖u i‖*(B*‖u j‖) := mul_le_mul_of_nonneg_left + (mul_le_mul_of_nonneg_right (hA i j) (norm_nonneg _)) (norm_nonneg _) + _ = _ := by ring + _ ≤ ∑ i, ∑ j, (B/2)*(‖u i‖^2+‖u j‖^2) := by + apply Finset.sum_le_sum + intro i _ + apply Finset.sum_le_sum + intro j _ + have h := mul_nonneg hB (sq_nonneg (‖u i‖-‖u j‖)) + nlinarith + _ = _ := by + simp only [mul_add,Finset.sum_add_distrib,←Finset.mul_sum,Finset.sum_const, + nsmul_eq_mul,Finset.card_univ] + ring + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMediatorGeometry.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMediatorGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..02db56d23fc6dced6c42ac2e55f14fe79874a72e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMediatorGeometry.lean @@ -0,0 +1,36 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialModel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalSupported + +namespace OAI + +/-! Placing a mediator at its source term's anchor preserves the spatial support bound. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical +variable {ι κ : Type*} [DecidableEq ι] [DecidableEq κ] + +omit [DecidableEq ι] [DecidableEq κ] in +def qmaMediatorCell {rows width : ℕ} (cell : ι → QMAGridCell rows width) + (anchor : κ → QMAGridCell rows width) : ι ⊕ κ → QMAGridCell rows width := + Sum.elim cell anchor + +theorem qmaMediatorSupport_geometry {rows width : ℕ} (cell : ι → QMAGridCell rows width) + (anchor : κ → QMAGridCell rows width) (S : Finset ι) (e : κ) + (hS : ∀ i ∈ S, QMAGridCellsNear (cell i) (anchor e)) + (q : ι ⊕ κ) (hq : q ∈ qmaMediatorSupport S e) : + QMAGridCellsNear (qmaMediatorCell cell anchor q) (anchor e) := by + cases q with + | inl i => + apply hS + simpa [qmaMediatorSupport] using hq + | inr j => + have he : j = e := by simpa [qmaMediatorSupport] using hq + subst j + exact qmaGridCellsNear_refl _ + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMergeEdges.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMergeEdges.lean new file mode 100644 index 0000000000000000000000000000000000000000..35c4d1c06ff388d439adfbefbd45847f1b9b0170 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMergeEdges.lean @@ -0,0 +1,104 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRationalPathStep + +namespace OAI + +/-! Parallel interactions are combined at one canonically ordered physical edge. +This is an exact matrix operation, with no perturbative error. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators Classical +namespace QMARationalExchangeGraph + +def orderedPair (G : QMARationalExchangeGraph) (e : G.Edge) : Fin G.n × Fin G.n := + (min (G.left e) (G.right e),max (G.left e) (G.right e)) + +def edgePairs (G : QMARationalExchangeGraph) : Finset (Fin G.n × Fin G.n) := + Finset.univ.image G.orderedPair + +abbrev MergedEdge (G : QMARationalExchangeGraph) := {p // p ∈ G.edgePairs} + +def edgeClass (G : QMARationalExchangeGraph) (e : G.Edge) : G.MergedEdge := + ⟨G.orderedPair e,Finset.mem_image.mpr ⟨e,Finset.mem_univ _,rfl⟩⟩ + +theorem orderedPair_lt (G : QMARationalExchangeGraph) (e : G.Edge) : + (G.orderedPair e).1 < (G.orderedPair e).2 := by + rcases lt_or_gt_of_ne (G.distinct e) with h | h + · simpa only [orderedPair,min_eq_left h.le,max_eq_right h.le] using h + · simpa only [orderedPair,min_eq_right h.le,max_eq_left h.le] using h + +theorem mergedEdge_lt (G : QMARationalExchangeGraph) (p : G.MergedEdge) : p.val.1 < p.val.2 := by + obtain ⟨e,_,he⟩ := Finset.mem_image.mp p.property + rw [← he] + exact G.orderedPair_lt e + +theorem orderedPair_matrix (G : QMARationalExchangeGraph) (e : G.Edge) : + sourceHeisenbergMatrix G.n (G.orderedPair e).1 (G.orderedPair e).2 = + sourceHeisenbergMatrix G.n (G.left e) (G.right e) := by + rcases le_total (G.left e) (G.right e) with h | h + · simp only [orderedPair,min_eq_left h,max_eq_right h] + · simpa only [orderedPair,min_eq_right h,max_eq_left h] using + qmaHeisenberg_symm G.n (G.right e) (G.left e) + +def merge (G : QMARationalExchangeGraph) : QMARationalExchangeGraph where + n := G.n + Edge := G.MergedEdge + left := fun p => p.val.1 + right := fun p => p.val.2 + distinct := fun p => (G.mergedEdge_lt p).ne + weight := fun p => ∑ e, if G.edgeClass e = p then G.weight e else 0 + constant := G.constant + +theorem merge_matrix (G : QMARationalExchangeGraph) : + qmaExchangeMatrix G.merge.left G.merge.right (fun e => (G.merge.weight e:ℝ)) G.merge.constant = + qmaExchangeMatrix G.left G.right (fun e => (G.weight e:ℝ)) G.constant := by + unfold qmaExchangeMatrix + congr 1 + change (∑ p : G.MergedEdge, + (((∑ e, if G.edgeClass e = p then G.weight e else 0):ℚ):ℂ) • + sourceHeisenbergMatrix G.n p.val.1 p.val.2) = _ + push_cast + simp only [Finset.sum_smul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro e _ + have hcast (p : G.MergedEdge) : (((if G.edgeClass e = p then G.weight e else 0):ℚ):ℂ) = + (if G.edgeClass e = p then (G.weight e:ℂ) else 0) := by split_ifs <;> simp + simp_rw [hcast,ite_smul,zero_smul] + rw [Finset.sum_ite_eq] + simp only [Finset.mem_univ,ite_true] + rw [show (G.edgeClass e).val = G.orderedPair e from rfl,G.orderedPair_matrix] + +theorem merge_energy (G : QMARationalExchangeGraph) : G.merge.energy = G.energy := by + unfold energy + rw [G.merge_matrix] + rfl + +theorem merge_pair_injective (G : QMARationalExchangeGraph) : + Function.Injective (fun e : G.merge.Edge => (G.merge.left e,G.merge.right e)) := by + intro e f h + exact Subtype.ext h + +theorem merge_edge_count (G : QMARationalExchangeGraph) : Fintype.card G.merge.Edge ≤ Fintype.card G.Edge := by + change Fintype.card G.MergedEdge ≤ _ + rw [Fintype.card_coe] + exact (Finset.card_image_le).trans_eq (Finset.card_univ) + +theorem merge_edge_source (G : QMARationalExchangeGraph) (p : G.merge.Edge) : + ∃ e : G.Edge, (G.merge.left p = G.left e ∧ G.merge.right p = G.right e) ∨ + (G.merge.left p = G.right e ∧ G.merge.right p = G.left e) := by + obtain ⟨e,_,he⟩ := Finset.mem_image.mp p.property + refine ⟨e,?_⟩ + change (p.val.1 = G.left e ∧ p.val.2 = G.right e) ∨ + (p.val.1 = G.right e ∧ p.val.2 = G.left e) + rw [← he] + rcases le_total (G.left e) (G.right e) with h | h + · exact Or.inl ⟨min_eq_left h,max_eq_right h⟩ + · exact Or.inr ⟨min_eq_right h,max_eq_left h⟩ + +end QMARationalExchangeGraph +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMergedCoefficientBounds.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMergedCoefficientBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..42a95ae2fbbfb654449dc6d85a89e248bda17bfc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMergedCoefficientBounds.lean @@ -0,0 +1,142 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingPacketBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPlanarTapeSupport + +namespace OAI + +/-! Merging the actual bond tape reduces its length and increases each +coefficient by at most the input length. These bounds apply directly to the +numeric graph used by the final route compiler. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumListMerge +open MediatorListProgram + +theorem value_length_le_input (n : ℕ) (xs : List Bond) : + (value n xs).length ≤ xs.length := by + have hs : support n xs ⊆ xs.map ordered := by + intro p hp + exact of_decide_eq_true (List.mem_filter.mp hp).2 + have h := (support_nodup n xs).length_le_of_subset hs + simpa only [value,List.length_map] using h + +theorem value_coefficient_bound (n : ℕ) (xs : List Bond) {L : ℝ} + (hL : 0 ≤ L) (hw : ∀ e ∈ xs, |(e.2.2 : ℝ)| ≤ L) : + ∀ e ∈ value n xs, |(e.2.2 : ℝ)| ≤ xs.length*L := by + intro e he + obtain ⟨p,_,rfl⟩ := List.mem_map.mp he + exact weight_abs_le xs p hL hw + +end ContinuumCoulomb.QuantumListMerge + +namespace ContinuumCoulomb.QuantumPlanarTapeGeometry +open QuantumPlanarTapeProgram +open scoped Classical + +theorem graph_count (x : Input) (hn : ∀ e ∈ x.1.1.2.1, e.1 ≠ e.2.1) : + Fintype.card (graph x hn).Edge ≤ x.1.1.2.1.length := by + change Fintype.card (Fin (merged x).length) ≤ _ + rw [Fintype.card_fin] + exact QuantumListMerge.value_length_le_input _ _ + +theorem graph_coefficientBound (x : Input) + (hn : ∀ e ∈ x.1.1.2.1, e.1 ≠ e.2.1) {m L : ℝ} + (hm : (x.1.1.2.1.length : ℝ) ≤ m) (hL : 0 ≤ L) + (hc : |(x.1.1.2.2 : ℝ)| ≤ L) + (hw : ∀ e ∈ x.1.1.2.1, |(e.2.2 : ℝ)| ≤ L) : + (graph x hn).CoefficientBound ((m+1)*L) := by + have hm0 : 0 ≤ m := (Nat.cast_nonneg _).trans hm + constructor + · change |(x.1.1.2.2 : ℝ)| ≤ _ + nlinarith + · intro e + have h := QuantumListMerge.value_coefficient_bound x.1.1.1 x.1.1.2.1 hL hw + _ (List.get_mem (merged x) e) + change |(((merged x).get e).2.2 : ℝ)| ≤ _ + exact h.trans ((mul_le_mul_of_nonneg_right hm hL).trans (by nlinarith)) + +theorem graph_coefficientBound_of_raw (x : Input) + (hb : SourceBondLists.bounded x.1.1.1 x.1.1.2.1) + (hn : ∀ e ∈ x.1.1.2.1, e.1 ≠ e.2.1) {m L : ℝ} + (hm : (Fintype.card (rawGraph x hb hn).Edge : ℝ) ≤ m) (hL : 0 ≤ L) + (hc : (rawGraph x hb hn).CoefficientBound L) : + (graph x hn).CoefficientBound ((m+1)*L) := by + have hlen : (x.1.1.2.1.length : ℝ) ≤ m := by + change (Fintype.card (Fin x.1.1.2.1.length) : ℝ) ≤ m at hm + simpa only [Fintype.card_fin] using hm + apply graph_coefficientBound x hn hlen hL hc.1 + intro e he + obtain ⟨i,rfl⟩ := List.mem_iff_get.mp he + exact hc.2 i + +end ContinuumCoulomb.QuantumPlanarTapeGeometry + +namespace ContinuumCoulomb.QuantumCrossingSelectProgram +open QuantumPlanarTapeProgram +open scoped Classical + +variable {G : QMARationalExchangeGraph} {r k : ℕ} + (S : QMARationalCrossingSelection G r) (labels : G.Edge ≃ Fin k) + +theorem compiled_planar_bounds {N : ℚ} (hN : 0 ≤ N) {m L T : ℝ} + (hm : (Fintype.card G.Edge : ℝ) ≤ m) (hL : 1 ≤ L) (hT : |(N : ℝ)| ≤ T) + (hc : G.CoefficientBound L) (x : QuantumPlanarTapeProgram.Input) + (hx : x.1.1 = QuantumCrossingListLayer.value + (QuantumCrossingListLayer.actualInput (computedLayer S labels) N (Equiv.refl _))) + (hn : ∀ e ∈ x.1.1.2.1, e.1 ≠ e.2.1) : + (QuantumPlanarTapeGeometry.graph x hn).CoefficientBound + ((m+9*r+1)*qmaCrossingCoefficientBound m r ((m+1)*L) T) ∧ + (Fintype.card (QuantumPlanarTapeGeometry.graph x hn).Edge : ℝ) ≤ m+9*r := by + let E := qmaCrossingCoefficientBound m r ((m+1)*L) T + have hm0 : 0 ≤ m := (Nat.cast_nonneg _).trans hm + have hL0 : 0 ≤ L := by linarith + have hE : 0 ≤ E := by + dsimp [E,qmaCrossingCoefficientBound] + positivity + have hout := computedLayer_output_coefficientBound S labels hN hm hL hT hc + have hlen : (x.1.1.2.1.length : ℝ) ≤ m+9*r := by + rw [hx] + change ((QuantumCrossingListLayer.bonds + (QuantumCrossingListLayer.actualInput (computedLayer S labels) N (Equiv.refl _))).length : ℝ) + ≤ m+9*r + have h := compiled_graph_count S labels hm N + change (Fintype.card (Fin (QuantumCrossingListLayer.bonds + (QuantumCrossingListLayer.actualInput (computedLayer S labels) N (Equiv.refl _))).length) : ℝ) + ≤ m+9*r at h + simpa only [Fintype.card_fin] using h + constructor + · apply QuantumPlanarTapeGeometry.graph_coefficientBound x hn hlen hE + · rw [hx] + change |(QuantumCrossingListLayer.constant + (QuantumCrossingListLayer.actualInput (computedLayer S labels) N (Equiv.refl _)) : ℝ)| ≤ E + rw [QuantumCrossingListLayer.constant_actual (computedLayer S labels) N (Equiv.refl _)] + exact hout.1 + · intro e he + rw [hx] at he + exact QuantumCrossingListLayer.actual_bonds_coefficientBound _ _ _ hout e he + · have h : (Fintype.card (QuantumPlanarTapeGeometry.graph x hn).Edge : ℝ) ≤ + (x.1.1.2.1.length : ℝ) := by + exact_mod_cast QuantumPlanarTapeGeometry.graph_count x hn + exact h.trans hlen + +theorem compiled_planar_nat {N : ℚ} (hN : 0 ≤ N) {m L T : ℕ} + (hm : Fintype.card G.Edge ≤ m) (hL : 1 ≤ L) (hT : |(N : ℝ)| ≤ T) + (hc : G.CoefficientBound L) (x : QuantumPlanarTapeProgram.Input) + (hx : x.1.1 = QuantumCrossingListLayer.value + (QuantumCrossingListLayer.actualInput (computedLayer S labels) N (Equiv.refl _))) + (hn : ∀ e ∈ x.1.1.2.1, e.1 ≠ e.2.1) : + (QuantumPlanarTapeGeometry.graph x hn).CoefficientBound + ((m+9*r+1)*QuantumCoefficientPrograms.crossingCoefficient m r ((m+1)*L) T) ∧ + Fintype.card (QuantumPlanarTapeGeometry.graph x hn).Edge ≤ m+9*r := by + have hm' : (Fintype.card G.Edge : ℝ) ≤ m := by exact_mod_cast hm + have hL' : (1 : ℝ) ≤ L := by exact_mod_cast hL + have h := compiled_planar_bounds S labels hN hm' hL' hT hc x hx hn + constructor + · simpa only [Nat.cast_mul,Nat.cast_add,Nat.cast_one,Nat.cast_ofNat, + QuantumCoefficientPrograms.crossingCoefficient_cast] using h.1 + · exact_mod_cast h.2 + +end ContinuumCoulomb.QuantumCrossingSelectProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMergedEndpointPairs.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMergedEndpointPairs.lean new file mode 100644 index 0000000000000000000000000000000000000000..e97940782588ae9f5da598244b1e9f68effbe1cd --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMergedEndpointPairs.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumMergedOutputRoutes + +namespace OAI + +/-! Distinct merged interactions have different unordered physical endpoints. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +theorem qmaMergedEndpointPairs_injective (G : QMARationalExchangeGraph) + (position : Fin G.n → ℕ × ℕ) (hp : Function.Injective position) : + Function.Injective (fun e : G.merge.Edge => s(position (G.merge.left e),position (G.merge.right e))) := by + intro e f h + rcases Sym2.eq_iff.mp h with ⟨hl,hr⟩ | ⟨hl,hr⟩ + · exact G.merge_pair_injective (Prod.ext (hp hl) (hp hr)) + · have hleft := hp hl + have hright := hp hr + have he := G.mergedEdge_lt e + have hf := G.mergedEdge_lt f + change G.merge.left e < G.merge.right e at he + change G.merge.left f < G.merge.right f at hf + rw [hleft,hright] at he + exact (lt_asymm he hf).elim + +namespace QMACellRoute + +def endpointPair (R : QMACellRoute) : Sym2 (ℕ × ℕ) := s(R.source,R.target) + +theorem endpointPair_body (R : QMACellRoute) : R.endpointPair = s(R.body.source,R.body.target) := by + rcases R with ⟨b,r⟩ + cases r + · rfl + · exact Sym2.eq_swap + +end QMACellRoute +namespace QMAPortRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + +theorem mergedOutputRoute_pairs_injective (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) + (havoid : ∀ i : P.Interior, ∀ v, P.cell i ≠ P.position v) : + Function.Injective (fun e => (P.mergedOutputRoute N hD havoid e).endpointPair) := by + intro e f h + apply qmaMergedEndpointPairs_injective (P.crossingOutput N hD) + (P.crossingPosition N D) (P.crossingPosition_injective N D) + have he := P.mergedOutputRoute_spec N hD havoid e + have hf := P.mergedOutputRoute_spec N hD havoid f + simpa only [QMACellRoute.endpointPair,he.2.2.1,he.2.2.2,hf.2.2.1,hf.2.2.2] using h + +end QMAPortRouteData +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMergedOutputRoutes.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMergedOutputRoutes.lean new file mode 100644 index 0000000000000000000000000000000000000000..9a593bd09d4f0e47683c0f2ef76835f78f37acfe --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMergedOutputRoutes.lean @@ -0,0 +1,104 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingOutputRoutes +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumMergeEdges +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRouteEnumeration + +namespace OAI + +/-! Exact parallel-edge merging preserves the physical placement and reverses +the catalog route when canonical endpoint ordering requires it. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical +namespace QMACellRoute + +def reverse (R : QMACellRoute) : QMACellRoute := ⟨R.body,!R.reversed⟩ + +@[simp] theorem reverse_body (R : QMACellRoute) : R.reverse.body = R.body := rfl + +@[simp] theorem reverse_source (R : QMACellRoute) : R.reverse.source = R.target := by + rcases R with ⟨b,r⟩ + cases r <;> rfl + +@[simp] theorem reverse_target (R : QMACellRoute) : R.reverse.target = R.source := by + rcases R with ⟨b,r⟩ + cases r <;> rfl + +@[simp] theorem reverse_valid (R : QMACellRoute) : R.reverse.Valid = R.Valid := rfl + +end QMACellRoute +namespace QMAPortRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + +theorem mergedOutput_route_exists (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) + (havoid : ∀ i : P.Interior, ∀ v, P.cell i ≠ P.position v) + (e : (P.crossingOutput N hD).merge.Edge) : + ∃ R : QMACellRoute, P.RoutingAllowed R.body ∧ R.Valid ∧ + R.source = P.crossingPosition N D ((P.crossingOutput N hD).merge.left e) ∧ + R.target = P.crossingPosition N D ((P.crossingOutput N hD).merge.right e) := by + obtain ⟨f,hf⟩ := (P.crossingOutput N hD).merge_edge_source e + obtain ⟨R,hR,hv,hl,hr⟩ := P.crossingOutput_route_exists N hD havoid f + rcases hf with ⟨hleft,hright⟩ | ⟨hleft,hright⟩ + · exact ⟨R,hR,hv,hl.trans (congrArg (P.crossingPosition N D) hleft.symm), + hr.trans (congrArg (P.crossingPosition N D) hright.symm)⟩ + · refine ⟨R.reverse,hR,hv,?_,?_⟩ + · exact R.reverse_source.trans (hr.trans (congrArg (P.crossingPosition N D) hleft.symm)) + · exact R.reverse_target.trans (hl.trans (congrArg (P.crossingPosition N D) hright.symm)) + +def findMergedRoute (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) + (e : (P.crossingOutput N hD).merge.Edge) : Option QMACellRoute := + (qmaRouteCandidates + (P.crossingPosition N D ((P.crossingOutput N hD).merge.left e)) + (P.crossingPosition N D ((P.crossingOutput N hD).merge.right e))).find? (fun R => + decide (P.RoutingAllowed R.body ∧ R.Valid ∧ + R.source = P.crossingPosition N D ((P.crossingOutput N hD).merge.left e) ∧ + R.target = P.crossingPosition N D ((P.crossingOutput N hD).merge.right e))) + +theorem findMergedRoute_isSome (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) + (havoid : ∀ i : P.Interior, ∀ v, P.cell i ≠ P.position v) + (e : (P.crossingOutput N hD).merge.Edge) : (P.findMergedRoute N hD e).isSome := by + obtain ⟨R,hR,hvalid,hs,ht⟩ := P.mergedOutput_route_exists N hD havoid e + apply List.find?_isSome.mpr + refine ⟨R,?_,?_⟩ + · simpa only [hs,ht] using qmaRouteCandidates_complete R + · exact decide_eq_true ⟨hR,hvalid,hs,ht⟩ + +theorem findMergedRoute_spec (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) + (e : (P.crossingOutput N hD).merge.Edge) {R : QMACellRoute} + (h : P.findMergedRoute N hD e = some R) : + P.RoutingAllowed R.body ∧ R.Valid ∧ + R.source = P.crossingPosition N D ((P.crossingOutput N hD).merge.left e) ∧ + R.target = P.crossingPosition N D ((P.crossingOutput N hD).merge.right e) := by + unfold findMergedRoute at h + have hp := List.find?_some h + exact of_decide_eq_true hp + + +def mergedOutputRoute (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) + (havoid : ∀ i : P.Interior, ∀ v, P.cell i ≠ P.position v) + (e : (P.crossingOutput N hD).merge.Edge) : QMACellRoute := + (P.findMergedRoute N hD e).get (P.findMergedRoute_isSome N hD havoid e) + +theorem mergedOutputRoute_spec (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) + (havoid : ∀ i : P.Interior, ∀ v, P.cell i ≠ P.position v) + (e : (P.crossingOutput N hD).merge.Edge) : + P.RoutingAllowed (P.mergedOutputRoute N hD havoid e).body ∧ + (P.mergedOutputRoute N hD havoid e).Valid ∧ + (P.mergedOutputRoute N hD havoid e).source = + P.crossingPosition N D ((P.crossingOutput N hD).merge.left e) ∧ + (P.mergedOutputRoute N hD havoid e).target = + P.crossingPosition N D ((P.crossingOutput N hD).merge.right e) := by + apply P.findMergedRoute_spec N hD e + exact (Option.some_get (P.findMergedRoute_isSome N hD havoid e)).symm + +theorem mergedOutput_energy_error {N : ℚ} (hN : 0 < N) {D : ℕ} (hD : ∀ e, P.length e ≤ D) : + |(P.crossingOutput N hD).merge.energy-G.energy| ≤ ((D+1:ℕ):ℝ)/(N:ℝ) := by + rw [QMARationalExchangeGraph.merge_energy] + exact P.portCrossing_energy_error hN hD + +end QMAPortRouteData +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMergedSupport.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMergedSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..3dd67a31a9ce53669eae33ebfc5fee9958eddcec --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumMergedSupport.lean @@ -0,0 +1,168 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListMergeProperties +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumMergeEdges + +namespace OAI + +/-! Canonical merging preserves exactly the unordered endpoint support. +This includes edges whose merged coefficient is zero. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +theorem qmaUnorderedPair_map {α β : Type*} (f : α → β) {a b c d : α} + (h : s(a,b) = s(c,d)) : s(f a,f b) = s(f c,f d) := by + rcases Sym2.eq_iff.mp h with ⟨ha,hb⟩ | ⟨ha,hb⟩ + · rw [ha,hb] + · rw [ha,hb] + exact Sym2.eq_swap + +namespace QuantumListMerge +open MediatorListProgram + +theorem ordered_endpointPair (e : Bond) : + s((ordered e).1,(ordered e).2) = s(e.1,e.2.1) := by + rcases le_total e.1 e.2.1 with h | h + · simp only [ordered,min_eq_left h,max_eq_right h] + · simpa only [ordered,min_eq_right h,max_eq_left h] using + (Sym2.eq_swap : s(e.2.1,e.1) = s(e.1,e.2.1)) + +theorem value_edge_source (n : ℕ) (xs : List Bond) {e : Bond} + (he : e ∈ value n xs) : + ∃ f ∈ xs, s(e.1,e.2.1) = s(f.1,f.2.1) := by + obtain ⟨p,hp,rfl⟩ := List.mem_map.mp he + have hm := of_decide_eq_true (List.mem_filter.mp hp).2 + obtain ⟨f,hf,hfp⟩ := List.mem_map.mp hm + refine ⟨f,hf,?_⟩ + rw [← hfp] + exact ordered_endpointPair f + +theorem value_edge_target {n : ℕ} {xs : List Bond} + (hb : SourceBondLists.bounded n xs) {f : Bond} (hf : f ∈ xs) : + ∃ e ∈ value n xs, s(e.1,e.2.1) = s(f.1,f.2.1) := by + have hp : ordered f ∈ support n xs := + (mem_support hb _).mpr (List.mem_map.mpr ⟨f,hf,rfl⟩) + refine ⟨((ordered f).1,(ordered f).2,weight xs (ordered f)),?_,ordered_endpointPair f⟩ + exact List.mem_map.mpr ⟨ordered f,hp,rfl⟩ + +theorem value_support {n : ℕ} {xs : List Bond} + (hb : SourceBondLists.bounded n xs) (p : Sym2 ℕ) : + (∃ e ∈ value n xs, s(e.1,e.2.1) = p) ↔ ∃ e ∈ xs, s(e.1,e.2.1) = p := by + constructor + · rintro ⟨e,he,hp⟩ + obtain ⟨f,hf,hef⟩ := value_edge_source n xs he + exact ⟨f,hf,hef.symm.trans hp⟩ + · rintro ⟨f,hf,hp⟩ + obtain ⟨e,he,hef⟩ := value_edge_target hb hf + exact ⟨e,he,hef.trans hp⟩ + +end QuantumListMerge + +namespace QMARationalExchangeGraph + +theorem orderedPair_endpointPair (G : QMARationalExchangeGraph) (e : G.Edge) : + s((G.orderedPair e).1,(G.orderedPair e).2) = s(G.left e,G.right e) := by + rcases le_total (G.left e) (G.right e) with h | h + · simp only [orderedPair,min_eq_left h,max_eq_right h] + · simpa only [orderedPair,min_eq_right h,max_eq_left h] using + (Sym2.eq_swap : s(G.right e,G.left e) = s(G.left e,G.right e)) + +theorem merge_unordered_source (G : QMARationalExchangeGraph) (e : G.merge.Edge) : + ∃ f : G.Edge, s(G.merge.left e,G.merge.right e) = s(G.left f,G.right f) := by + obtain ⟨f,hf⟩ := G.merge_edge_source e + exact ⟨f,Sym2.eq_iff.mpr hf⟩ + +theorem merge_unordered_target (G : QMARationalExchangeGraph) (f : G.Edge) : + ∃ e : G.merge.Edge, s(G.merge.left e,G.merge.right e) = s(G.left f,G.right f) := + ⟨G.edgeClass f,G.orderedPair_endpointPair f⟩ + +theorem merge_support (G : QMARationalExchangeGraph) (p : Sym2 (Fin G.n)) : + (∃ e : G.merge.Edge, s(G.merge.left e,G.merge.right e) = p) ↔ + ∃ f : G.Edge, s(G.left f,G.right f) = p := by + constructor + · rintro ⟨e,hp⟩ + obtain ⟨f,hef⟩ := G.merge_unordered_source e + exact ⟨f,hef.symm.trans hp⟩ + · rintro ⟨f,hp⟩ + obtain ⟨e,hef⟩ := G.merge_unordered_target f + exact ⟨e,hef.trans hp⟩ + +theorem merge_nat_support (G : QMARationalExchangeGraph) (p : Sym2 ℕ) : + (∃ e : G.merge.Edge, s((G.merge.left e).val,(G.merge.right e).val) = p) ↔ + ∃ f : G.Edge, s((G.left f).val,(G.right f).val) = p := by + constructor + · rintro ⟨e,hp⟩ + obtain ⟨f,hef⟩ := G.merge_unordered_source e + exact ⟨f,(qmaUnorderedPair_map Fin.val hef).symm.trans hp⟩ + · rintro ⟨f,hp⟩ + obtain ⟨e,hef⟩ := G.merge_unordered_target f + exact ⟨e,(qmaUnorderedPair_map Fin.val hef).trans hp⟩ + +variable (G H : QMARationalExchangeGraph) (vertex : Fin G.n ≃ Fin H.n) + +theorem merge_support_forward + (forward : ∀ e : G.Edge, ∃ f : H.Edge, + s(vertex (G.left e),vertex (G.right e)) = s(H.left f,H.right f)) + (e : G.merge.Edge) : + ∃ f : H.merge.Edge, + s(vertex (G.merge.left e),vertex (G.merge.right e)) = s(H.merge.left f,H.merge.right f) := by + obtain ⟨a,ha⟩ := G.merge_unordered_source e + obtain ⟨b,hb⟩ := forward a + obtain ⟨f,hf⟩ := H.merge_unordered_target b + exact ⟨f,(qmaUnorderedPair_map vertex ha).trans (hb.trans hf.symm)⟩ + +theorem merge_support_backward + (backward : ∀ f : H.Edge, ∃ e : G.Edge, + s(vertex (G.left e),vertex (G.right e)) = s(H.left f,H.right f)) + (f : H.merge.Edge) : + ∃ e : G.merge.Edge, + s(vertex (G.merge.left e),vertex (G.merge.right e)) = s(H.merge.left f,H.merge.right f) := by + obtain ⟨b,hb⟩ := H.merge_unordered_source f + obtain ⟨a,ha⟩ := backward b + obtain ⟨e,he⟩ := G.merge_unordered_target a + exact ⟨e,(qmaUnorderedPair_map vertex he).trans (ha.trans hb.symm)⟩ + +end QMARationalExchangeGraph + +namespace QuantumListGraph +open MediatorListProgram + +theorem ofBonds_nat_support (n : ℕ) (xs : List Bond) (c : ℚ) + (hb : SourceBondLists.bounded n xs) (hn : ∀ e ∈ xs, e.1 ≠ e.2.1) + (p : Sym2 ℕ) : + (∃ i : (ofBonds n xs c hb hn).Edge, + s(((ofBonds n xs c hb hn).left i).val,((ofBonds n xs c hb hn).right i).val) = p) ↔ + ∃ e ∈ xs, s(e.1,e.2.1) = p := by + constructor + · rintro ⟨i,hi⟩ + exact ⟨xs.get i,List.get_mem xs i,hi⟩ + · rintro ⟨e,he,hp⟩ + obtain ⟨i,hi⟩ := List.mem_iff_get.mp he + refine ⟨i,?_⟩ + change s((xs.get i).1,(xs.get i).2.1) = p + rwa [hi] + +theorem mergedTape_nat_support (n : ℕ) (xs : List Bond) (c : ℚ) + (hb : SourceBondLists.bounded n xs) (hn : ∀ e ∈ xs, e.1 ≠ e.2.1) + (p : Sym2 ℕ) : + (∃ i : (ofBonds n (QuantumListMerge.value n xs) c + (QuantumListMerge.bounded n xs) (QuantumListMerge.noLoops hn)).Edge, + s(((ofBonds n (QuantumListMerge.value n xs) c + (QuantumListMerge.bounded n xs) (QuantumListMerge.noLoops hn)).left i).val, + ((ofBonds n (QuantumListMerge.value n xs) c + (QuantumListMerge.bounded n xs) (QuantumListMerge.noLoops hn)).right i).val) = p) ↔ + ∃ e : (ofBonds n xs c hb hn).merge.Edge, + s((((ofBonds n xs c hb hn).merge).left e).val, + (((ofBonds n xs c hb hn).merge).right e).val) = p := by + exact (ofBonds_nat_support n (QuantumListMerge.value n xs) c + (QuantumListMerge.bounded n xs) (QuantumListMerge.noLoops hn) p).trans + ((QuantumListMerge.value_support hb p).trans + ((ofBonds_nat_support n xs c hb hn p).symm.trans + ((ofBonds n xs c hb hn).merge_nat_support p).symm)) + +end QuantumListGraph +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumNearestCircuit.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumNearestCircuit.lean new file mode 100644 index 0000000000000000000000000000000000000000..fed957f20f1069e1790b1c42a9507b5ae00d20b9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumNearestCircuit.lean @@ -0,0 +1,66 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumNearestGate + +namespace OAI + +/-! Exact nearest-neighbor compilation with an explicit polynomial size bound. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped Classical + +theorem qmaNearestList_matrix (work : ℕ) (gs : List QMAGate) : + qmaGateProduct work (gs.flatMap (qmaNearestGate work)) = qmaGateProduct work gs := by + induction gs with + | nil => rfl + | cons g gs ih => + change qmaGateProduct work (qmaNearestGate work g ++ gs.flatMap (qmaNearestGate work)) = _ + rw [qmaGateProduct_append,ih,qmaNearestGate_matrix] + change _ = qmaGateProduct work ([g]++gs) + rw [qmaGateProduct_append,qmaGateProduct_singleton] + +theorem qmaNearestList_length (work : ℕ) (gs : List QMAGate) : + (gs.flatMap (qmaNearestGate work)).length ≤ (6*work+7)*gs.length := by + induction gs with + | nil => simp + | cons g gs ih => + simp only [List.flatMap_cons,List.length_append,List.length_cons] + have hg := qmaNearestGate_length work g + nlinarith + +abbrev qmaNearestCircuit (c : QMACircuit) : QMACircuit := + ⟨c.work,c.witness,c.gates.flatMap (qmaNearestGate c.work)⟩ + +theorem qmaNearestCircuit_wellFormed (c : QMACircuit) (hc : c.WellFormed) : + (qmaNearestCircuit c).WellFormed := by + refine ⟨hc.1,?_⟩ + intro g hg + obtain ⟨k,hk,hg⟩ := List.mem_flatMap.mp hg + exact (qmaNearestGate_valid c.work k (hc.2 k hk) g hg).1 + +theorem qmaNearestCircuit_adjacent (c : QMACircuit) (hc : c.WellFormed) : + ∀ g ∈ (qmaNearestCircuit c).gates, g.Adjacent := by + intro g hg + obtain ⟨k,hk,hg⟩ := List.mem_flatMap.mp hg + exact (qmaNearestGate_valid c.work k (hc.2 k hk) g hg).2 + +theorem qmaNearestCircuit_acceptance (c : QMACircuit) (hc : c.WellFormed) + (psi : EuclideanSpace ℂ (SourceSpinBasis c.witness)) : + qmaAcceptance (qmaNearestCircuit c) (qmaNearestCircuit_wellFormed c hc) psi = + qmaAcceptance c hc psi := by + have hm : qmaCircuitMatrix (qmaNearestCircuit c) = qmaCircuitMatrix c := + qmaNearestList_matrix c.work c.gates + unfold qmaAcceptance + rw [hm] + rfl + +theorem qmaNearestCircuit_size (c : QMACircuit) : + (qmaNearestCircuit c).work+(qmaNearestCircuit c).gates.length ≤ + c.work+(6*c.work+7)*c.gates.length := by + exact Nat.add_le_add_left (qmaNearestList_length c.work c.gates) c.work + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumNearestGate.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumNearestGate.lean new file mode 100644 index 0000000000000000000000000000000000000000..2e6196d24b8af29c138d407f25569d2af3aaba45 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumNearestGate.lean @@ -0,0 +1,102 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumAdjacentCnot + +namespace OAI + +/-! Replacing a gate by an exact bounded-length nearest-neighbor gate sequence. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped Classical + +def QMAGate.Adjacent : QMAGate → Prop + | .controlledNot i j => i+1 = j ∨ j+1 = i + | _ => True + +theorem qmaAdjacentCnot_valid (work a d : ℕ) (h : a+d+1 < work+1) (b : Bool) : + ∀ g ∈ qmaAdjacentCnot work a d h b, g.WellFormed (work+1) ∧ g.Adjacent := by + induction d generalizing a with + | zero => + intro g hg + have he : g = qmaOrderedCnot a (a+1) b := by simpa [qmaAdjacentCnot] using hg + subst g + cases b <;> simp only [qmaOrderedCnot,Bool.false_eq_true,ite_false,ite_true, + QMAGate.WellFormed,QMAGate.Adjacent] + · exact ⟨⟨h,by omega,by omega⟩,by simp⟩ + · exact ⟨⟨by omega,h,by omega⟩,by simp⟩ + | succ d ih => + intro g hg + simp only [qmaAdjacentCnot,List.mem_append] at hg + rcases hg with (hg | hg) | hg + · have hs : g.WellFormed (work+1) := qmaWireSwapGates_wellFormed + (⟨a,by omega⟩ : Fin (work+1)) ⟨a+1,by omega⟩ (by intro he; cases he) g hg + refine ⟨hs,?_⟩ + simp only [qmaWireSwapGates,List.mem_cons,List.not_mem_nil,or_false] at hg + rcases hg with rfl | rfl | rfl <;> simp [QMAGate.Adjacent] + · exact ih (a+1) (by omega) g hg + · have hs : g.WellFormed (work+1) := qmaWireSwapGates_wellFormed + (⟨a,by omega⟩ : Fin (work+1)) ⟨a+1,by omega⟩ (by intro he; cases he) g hg + refine ⟨hs,?_⟩ + simp only [qmaWireSwapGates,List.mem_cons,List.not_mem_nil,or_false] at hg + rcases hg with rfl | rfl | rfl <;> simp [QMAGate.Adjacent] + +def qmaNearestGate (work : ℕ) : QMAGate → List QMAGate + | .controlledNot i j => + if h : i < j ∧ j < work+1 then + qmaAdjacentCnot work i (j-i-1) (by omega) true + else if h : j < i ∧ i < work+1 then + qmaAdjacentCnot work j (i-j-1) (by omega) false + else [.controlledNot i j] + | g => [g] + +theorem qmaNearestGate_matrix (work : ℕ) (g : QMAGate) : + qmaGateProduct work (qmaNearestGate work g) = qmaGateMatrix work g := by + cases g with + | hadamard i => exact qmaGateProduct_singleton _ _ + | phaseT i => exact qmaGateProduct_singleton _ _ + | controlledNot i j => + by_cases h : i < j ∧ j < work+1 + · simp only [qmaNearestGate,dite_eq_left h,qmaAdjacentCnot_matrix,qmaOrderedCnot,ite_true] + have he : i+(j-i-1)+1 = j := by omega + rw [he] + · by_cases h' : j < i ∧ i < work+1 + · simp only [qmaNearestGate,dite_eq_right h,dite_eq_left h',qmaAdjacentCnot_matrix, + qmaOrderedCnot,Bool.false_eq_true,ite_false] + have he : j+(i-j-1)+1 = i := by omega + rw [he] + · simp only [qmaNearestGate,dite_eq_right h,dite_eq_right h',qmaGateProduct_singleton] + +theorem qmaNearestGate_valid (work : ℕ) (g : QMAGate) (hg : g.WellFormed (work+1)) : + ∀ k ∈ qmaNearestGate work g, k.WellFormed (work+1) ∧ k.Adjacent := by + cases g with + | hadamard i => simpa [qmaNearestGate,QMAGate.Adjacent] using hg + | phaseT i => simpa [qmaNearestGate,QMAGate.Adjacent] using hg + | controlledNot i j => + rcases hg with ⟨hi,hj,hne⟩ + by_cases h : i < j ∧ j < work+1 + · simp only [qmaNearestGate,dite_eq_left h] + exact qmaAdjacentCnot_valid _ _ _ _ _ + · have h' : j < i ∧ i < work+1 := by omega + simp only [qmaNearestGate,dite_eq_right h,dite_eq_left h'] + exact qmaAdjacentCnot_valid _ _ _ _ _ + +theorem qmaNearestGate_length (work : ℕ) (g : QMAGate) : + (qmaNearestGate work g).length ≤ 6*work+7 := by + cases g with + | hadamard i => simp [qmaNearestGate] + | phaseT i => simp [qmaNearestGate] + | controlledNot i j => + by_cases h : i < j ∧ j < work+1 + · simp only [qmaNearestGate,dite_eq_left h,qmaAdjacentCnot_length] + omega + · by_cases h' : j < i ∧ i < work+1 + · simp only [qmaNearestGate,dite_eq_right h,dite_eq_left h',qmaAdjacentCnot_length] + omega + · simp only [qmaNearestGate,dite_eq_right h,dite_eq_right h',List.length_singleton] + omega + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumNearestProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumNearestProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..cb0821e622678f28fdf4725ca8700ccc2ab8f82d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumNearestProgram.lean @@ -0,0 +1,128 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumAdjacentProgram + +namespace OAI + +/-! Literal nearest-neighbor gate compilation. All finite loops use the +unary work bound; malformed gate indices take the original singleton branch. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumCircuitCode +open ExactQuantumFactoring.BitStackProgram + +abbrev NearestInput := ℕ × QMAGate +def nearestInputCode : NearestInput → List Bool := prodCode unaryCode gateCode + +def forwardGuard (x : NearestInput) : Bool := + decide (gateLeft x.2+1 ≤ gateRight x.2 ∧ gateRight x.2 ≤ x.1) +def backwardGuard (x : NearestInput) : Bool := + decide (gateRight x.2+1 ≤ gateLeft x.2 ∧ gateLeft x.2 ≤ x.1) + +def nearestValue (x : NearestInput) : List QMAGate := + if gateTag x.2=2 then + if forwardGuard x then + adjacentList (gateLeft x.2) (min x.1 (gateRight x.2-gateLeft x.2-1)) true + else if backwardGuard x then + adjacentList (gateRight x.2) (min x.1 (gateLeft x.2-gateRight x.2-1)) false + else [x.2] + else [x.2] + +theorem nearestValue_eq (x : NearestInput) : nearestValue x=qmaNearestGate x.1 x.2 := by + rcases x with ⟨work,g⟩ + cases g with + | hadamard i => rfl + | phaseT i => rfl + | controlledNot i j => + by_cases h : i < j ∧ j < work+1 + · have hg : forwardGuard (work,.controlledNot i j)=true := by + change decide (i+1 ≤ j ∧ j ≤ work) = true + simp only [decide_eq_true_eq] + omega + have hd : j-i-1 ≤ work := by omega + simp only [nearestValue,gateTag,gateLeft,gateRight,ite_true,hg,min_eq_right hd, + qmaNearestGate,dite_eq_left h] + exact (adjacentList_eq work i (j-i-1) (by omega) true).symm + · have hg : forwardGuard (work,.controlledNot i j)=false := by + change decide (i+1 ≤ j ∧ j ≤ work) = false + simp only [decide_eq_false_iff_not] + omega + by_cases h' : j < i ∧ i < work+1 + · have hr : backwardGuard (work,.controlledNot i j)=true := by + change decide (j+1 ≤ i ∧ i ≤ work) = true + simp only [decide_eq_true_eq] + omega + have hd : i-j-1 ≤ work := by omega + simp only [nearestValue,gateTag,gateLeft,gateRight,ite_true,hg,Bool.false_eq_true,ite_false,hr,min_eq_right hd, + qmaNearestGate,dite_eq_right h,dite_eq_left h'] + exact (adjacentList_eq work j (i-j-1) (by omega) false).symm + · have hr : backwardGuard (work,.controlledNot i j)=false := by + change decide (j+1 ≤ i ∧ i ≤ work) = false + simp only [decide_eq_false_iff_not] + omega + simp only [nearestValue,gateTag,gateLeft,gateRight,ite_true,hg,hr,Bool.false_eq_true,ite_false, + qmaNearestGate,dite_eq_right h,dite_eq_right h'] + +private noncomputable def workBits : Procedure nearestInputCode Nat.bits Prod.fst := + Procedure.unaryToBits.comp (Procedure.first unaryCode gateCode) +private noncomputable def leftBits : Procedure nearestInputCode Nat.bits (fun x => gateLeft x.2) := + gateLeftProgram.comp (Procedure.second unaryCode gateCode) +private noncomputable def rightBits : Procedure nearestInputCode Nat.bits (fun x => gateRight x.2) := + gateRightProgram.comp (Procedure.second unaryCode gateCode) + +noncomputable def forwardGuardProgram : Procedure nearestInputCode Procedure.boolCode forwardGuard := + (Procedure.boolAnd.comp + ((Procedure.binaryLe.comp ((Procedure.successor.comp leftBits).pair rightBits)).pair + (Procedure.binaryLe.comp (rightBits.pair workBits)))).congrFun (by + intro x + simp [forwardGuard,Function.comp_apply]) + +noncomputable def backwardGuardProgram : Procedure nearestInputCode Procedure.boolCode backwardGuard := + (Procedure.boolAnd.comp + ((Procedure.binaryLe.comp ((Procedure.successor.comp rightBits).pair leftBits)).pair + (Procedure.binaryLe.comp (leftBits.pair workBits)))).congrFun (by + intro x + simp [backwardGuard,Function.comp_apply]) + +noncomputable def nearestProgram : Procedure nearestInputCode (listCode gateCode) nearestValue := by + let work := Procedure.first unaryCode gateCode + let gate := Procedure.second unaryCode gateCode + let one := (Procedure.listCons gateCode).comp + (gate.pair (Procedure.constant nearestInputCode (listCode gateCode) [])) + let dForward := Procedure.binarySub.comp + ((Procedure.binarySub.comp (rightBits.pair leftBits)).pair + (Procedure.constant nearestInputCode Nat.bits 1)) + let dBackward := Procedure.binarySub.comp + ((Procedure.binarySub.comp (leftBits.pair rightBits)).pair + (Procedure.constant nearestInputCode Nat.bits 1)) + let forward := adjacentProgram.comp ((Procedure.clippedUnary.comp (work.pair dForward)).pair + (leftBits.pair (Procedure.constant nearestInputCode Procedure.boolCode true))) + let backward := adjacentProgram.comp ((Procedure.clippedUnary.comp (work.pair dBackward)).pair + (rightBits.pair (Procedure.constant nearestInputCode Procedure.boolCode false))) + let cnot := Procedure.binaryEq.comp ((gateTagProgram.comp gate).pair + (Procedure.constant nearestInputCode Nat.bits 2)) + exact (Procedure.conditional cnot + (Procedure.conditional forwardGuardProgram forward + (Procedure.conditional backwardGuardProgram backward one)) one).congrFun (by + intro x + simp only [nearestValue,Function.comp_apply,decide_eq_true_eq]) + +noncomputable def nearestListProgram : + Procedure circuitCode (listCode gateCode) (fun c => c.gates.flatMap (qmaNearestGate c.work)) := by + let rows := Procedure.listMapWith (ea := unaryCode) (eb := gateCode) (ec := listCode gateCode) + (f := fun work g => nearestValue (work,g)) (.hadamard 0) [] nearestProgram + exact ((QuantumRawExchange.flattenProgram gateCode (.hadamard 0)).comp + (rows.comp (workProgram.pair gatesProgram))).congrFun (by + intro c + simp only [Function.comp_apply,List.flatMap_def] + congr 1 + apply List.map_congr_left + intro g _ + exact nearestValue_eq (c.work,g)) + +noncomputable def nearestCircuitProgram : Procedure circuitCode circuitCode qmaNearestCircuit := + (workProgram.pair (witnessProgram.pair nearestListProgram)).result (by intro c; rfl) + +end ContinuumCoulomb.QuantumCircuitCode + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOddPathGeometry.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOddPathGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..06059639b3d5ca5364de8a0b307ab54cf30922d1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOddPathGeometry.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridWalk + +namespace OAI + +/-! The odd subdivision gadget splits a routed edge into two unit edges and +its reversed remaining tail. The two fresh vertices are the first two route points. -/ + +namespace ContinuumCoulomb + +def qmaOddSplitLength (L : ℕ) : Fin 3 → ℕ := ![1,1,L-2] +def qmaOddSplitIndex (L : ℕ) (e : Fin 3) (k : ℕ) : ℕ := + if e = 0 then k+1 else if e = 1 then k else L-k + +theorem qmaOddSplitIndex_bounds {L : ℕ} (hL : 3 ≤ L) (e : Fin 3) {k : ℕ} + (hk : k ≤ qmaOddSplitLength L e) : qmaOddSplitIndex L e k ≤ L := by + fin_cases e <;> simp [qmaOddSplitLength,qmaOddSplitIndex] at * <;> omega + +theorem qmaOddSplitIndex_zero (L : ℕ) : + (fun e => qmaOddSplitIndex L e 0) = ![1,0,L] := by + funext e + fin_cases e <;> simp [qmaOddSplitIndex] + +theorem qmaOddSplitIndex_last {L : ℕ} (hL : 3 ≤ L) : + (fun e => qmaOddSplitIndex L e (qmaOddSplitLength L e)) = ![2,1,2] := by + funext e + fin_cases e <;> simp [qmaOddSplitLength,qmaOddSplitIndex] + omega + +theorem qmaOddSplitIndex_injective {L : ℕ} (hL : 3 ≤ L) (e : Fin 3) + {i j : ℕ} (hi : i ≤ qmaOddSplitLength L e) (hj : j ≤ qmaOddSplitLength L e) + (h : qmaOddSplitIndex L e i = qmaOddSplitIndex L e j) : i = j := by + fin_cases e <;> (simp [qmaOddSplitLength,qmaOddSplitIndex] at *; omega) + +theorem qmaOddSplitIndex_interior {L : ℕ} (hL : 3 ≤ L) (e : Fin 3) {i : ℕ} + (hi0 : 0 < i) (hi : i < qmaOddSplitLength L e) : + e = 2 ∧ 2 < qmaOddSplitIndex L e i ∧ qmaOddSplitIndex L e i < L := by + fin_cases e <;> simp [qmaOddSplitLength,qmaOddSplitIndex] at * <;> omega + +theorem qmaOddSplitIndex_separated {L : ℕ} (hL : 3 ≤ L) (e f : Fin 3) {i j : ℕ} + (hi0 : 0 < i) (hi : i < qmaOddSplitLength L e) + (hj : j ≤ qmaOddSplitLength L f) + (h : qmaOddSplitIndex L e i = qmaOddSplitIndex L f j) : e = f := by + obtain ⟨rfl,hi2,hiL⟩ := qmaOddSplitIndex_interior hL e hi0 hi + fin_cases f <;> simp [qmaOddSplitLength,qmaOddSplitIndex] at * <;> omega + +theorem qmaOddSplitIndex_step {L : ℕ} (hL : 3 ≤ L) (e : Fin 3) {i : ℕ} + (hi : i < qmaOddSplitLength L e) : + qmaOddSplitIndex L e (i+1) = qmaOddSplitIndex L e i+1 ∨ + qmaOddSplitIndex L e i = qmaOddSplitIndex L e (i+1)+1 := by + fin_cases e <;> simp [qmaOddSplitLength,qmaOddSplitIndex] at * + omega + +theorem qmaOddSplitPoint_step {L : ℕ} (hL : 3 ≤ L) (p : ℕ → ℕ × ℕ) + (hp : ∀ i < L, qmaSquareGrid.Adj (p i) (p (i+1))) (e : Fin 3) {i : ℕ} + (hi : i < qmaOddSplitLength L e) : + qmaSquareGrid.Adj (p (qmaOddSplitIndex L e i)) (p (qmaOddSplitIndex L e (i+1))) := by + rcases qmaOddSplitIndex_step hL e hi with h | h + · have hn := qmaOddSplitIndex_bounds hL e (k := i+1) (Nat.succ_le_iff.mpr hi) + have hk : qmaOddSplitIndex L e i < L := by omega + simpa only [h] using hp (qmaOddSplitIndex L e i) hk + · have hb := qmaOddSplitIndex_bounds hL e (k := i) (Nat.le_of_lt hi) + have hk : qmaOddSplitIndex L e (i+1) < L := by omega + simpa only [h] using (hp (qmaOddSplitIndex L e (i+1)) hk).symm + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOffsetProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOffsetProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..fb57a981b36d07c4a803d39a2432ccf4836554d4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOffsetProgram.lean @@ -0,0 +1,47 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOffsetSample + +namespace OAI + +/-! Polynomial programs for the counterterm field coefficients and scalar offset. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumAxisSample +open ExactQuantumFactoring.BitStackProgram + +noncomputable opaque shiftValueProgram (a : Fin 2) : Procedure ratCode ratCode (shiftValue a) := by + by_cases ha : a = 0 + · exact (Procedure.constant ratCode ratCode 0).congrFun (by intro t; simp [shiftValue,ha]) + · exact (Procedure.ratMul.comp ((Procedure.identity ratCode).pair + (Procedure.constant ratCode ratCode (1/2)))).congrFun (by + intro t + simp only [shiftValue,ha,ite_false,Function.comp_apply,id_eq] + ring) + +noncomputable opaque counterFieldAProgram (a b : Fin 2) (e : Fin 3) : + Procedure radialCode ratCode (fun x => fieldValue x.1 a (counterA x.1 a b x.2) e) := + ((fieldValueProgram a e).comp (inputPrecisionProgram.pair (counterAProgram a b))).congrFun + (by intro x; rfl) + +noncomputable opaque counterFieldBProgram (a b : Fin 2) (e : Fin 3) : + Procedure radialCode ratCode (fun x => fieldValue x.1 b (counterB x.1 a b x.2) e) := + ((fieldValueProgram b e).comp (inputPrecisionProgram.pair (counterBProgram a b))).congrFun + (by intro x; rfl) + +noncomputable opaque offsetProgram (a b : Fin 2) : Procedure radialCode ratCode + (fun x => offset x.1 a b x.2) := by + let left := (shiftValueProgram a).comp (counterAProgram a b) + let right := (shiftValueProgram b).comp (counterBProgram a b) + let first := Procedure.ratMul.comp ((factorProgram a b).pair (Procedure.constant radialCode ratCode (shift a true))) + let second := (shiftProgram b).comp inputCoefficientProgram + let product := Procedure.ratMul.comp (first.pair second) + exact (Procedure.ratSub.comp ((Procedure.ratAdd.comp (left.pair right)).pair product)).congrFun + (by intro x; rfl) + +noncomputable def offsetCertificate (a b : Fin 2) : Turing.TM2ComputableInPolyTime + radialCode ratCode (fun x => offset x.1 a b x.2) := (offsetProgram a b).toTM2 + +end ContinuumCoulomb.QuantumAxisSample + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOffsetSample.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOffsetSample.lean new file mode 100644 index 0000000000000000000000000000000000000000..3a1ea501e5c45b18b4193d775cd118ee0b505475 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOffsetSample.lean @@ -0,0 +1,104 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCountertermProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFieldSample + +namespace OAI + +/-! Error bounds for the sampled counterterm fields and their scalar shifts. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumAxisSample +open ExactQuantumFactoring.BitStackProgram +open scoped Classical + +theorem counterA_abs (k : ℕ) (a b : Fin 2) (t : ℚ) : + |(counterA k a b t:ℝ)| ≤ 400*|(t:ℝ)| := by + simp only [counterA,Rat.cast_mul,Rat.cast_abs,shift_cast,sign_cast,abs_mul,abs_abs, + abs_of_nonneg (value_bounds k b).1] + calc + _ ≤ (|(t:ℝ)| *1)*400 := mul_le_mul + (mul_le_mul_of_nonneg_left (value_bounds k b).2 (abs_nonneg _)) + (qmaFourAxisShift_abs_bound b _) (abs_nonneg _) (by positivity) + _ = _ := by ring + +theorem counterB_abs (k : ℕ) (a b : Fin 2) (t : ℚ) : + |(counterB k a b t:ℝ)| ≤ 400*|(t:ℝ)| := by + simp only [counterB,Rat.cast_mul,Rat.cast_abs,shift_cast,polarity_cast,abs_mul,abs_abs, + abs_of_nonneg (value_bounds k a).1,qmaFourAxisSign_abs,mul_one] + calc + _ ≤ (|(t:ℝ)| *1)*400 := mul_le_mul + (mul_le_mul_of_nonneg_left (value_bounds k a).2 (abs_nonneg _)) + (qmaFourAxisShift_abs_bound a true) (abs_nonneg _) (by positivity) + _ = _ := by ring + +theorem counterFieldA_error (k : ℕ) (a b : Fin 2) (t : ℚ) (e : Fin 3) : + |(fieldValue k a (counterA k a b t) e:ℝ)-qmaFieldEdgeWeight a (qmaFourCounterA a b (t:ℝ)) e| ≤ + 26000*|(t:ℝ)| *(2:ℝ)⁻¹^k := by + have hfield := fieldValue_error k a (counterA k a b t) e + have hcoef := counterA_abs k a b t + have hsample := counterA_error k a b t + have hweight := (fieldWeight_lipschitz a (counterA k a b t:ℝ) (qmaFourCounterA a b (t:ℝ)) e).trans hsample + apply ((abs_sub_le _ _ _).trans (add_le_add hfield hweight)).trans + have hm := mul_le_mul_of_nonneg_right hcoef (by positivity : 0 ≤ (2:ℝ)⁻¹^k) + nlinarith + +theorem counterFieldB_error (k : ℕ) (a b : Fin 2) (t : ℚ) (e : Fin 3) : + |(fieldValue k b (counterB k a b t) e:ℝ)-qmaFieldEdgeWeight b (qmaFourCounterB a b (t:ℝ)) e| ≤ + 26000*|(t:ℝ)| *(2:ℝ)⁻¹^k := by + have hfield := fieldValue_error k b (counterB k a b t) e + have hcoef := counterB_abs k a b t + have hsample := counterB_error k a b t + have hweight := (fieldWeight_lipschitz b (counterB k a b t:ℝ) (qmaFourCounterB a b (t:ℝ)) e).trans hsample + apply ((abs_sub_le _ _ _).trans (add_le_add hfield hweight)).trans + have hm := mul_le_mul_of_nonneg_right hcoef (by positivity : 0 ≤ (2:ℝ)⁻¹^k) + nlinarith + +def shiftValue (a : Fin 2) (t : ℚ) : ℚ := if a = 0 then 0 else t/2 + +theorem shiftValue_error (a : Fin 2) (q : ℚ) (x : ℝ) : + |(shiftValue a q:ℝ)-qmaFourAxisFieldShift a x| ≤ |(q:ℝ)-x| := by + by_cases ha : a = 0 + · simp [shiftValue,qmaFourAxisFieldShift,ha] + · simp only [shiftValue,qmaFourAxisFieldShift,ha,ite_false,Rat.cast_div,Rat.cast_ofNat] + rw [← sub_div,abs_div] + norm_num + +def offset (k : ℕ) (a b : Fin 2) (t : ℚ) : ℚ := + shiftValue a (counterA k a b t)+shiftValue b (counterB k a b t)- + factor k a b t*shift a true*shift b (decide (t ≤ 0)) + +theorem offset_error (k : ℕ) (a b : Fin 2) (t : ℚ) : + |(offset k a b t:ℝ)-qmaFourEnergyOffset a b (t:ℝ)| ≤ + 320800*|(t:ℝ)| *(2:ℝ)⁻¹^k := by + have ha := (shiftValue_error a (counterA k a b t) (qmaFourCounterA a b (t:ℝ))).trans + (counterA_error k a b t) + have hb := (shiftValue_error b (counterB k a b t) (qmaFourCounterB a b (t:ℝ))).trans + (counterB_error k a b t) + have hc : |((factor k a b t:ℝ)-qmaFourCouplingFactor a b (t:ℝ))*qmaFourAxisShift a true* + qmaFourAxisShift b (qmaFourCouplingSign (t:ℝ))| ≤ 320000*|(t:ℝ)| *(2:ℝ)⁻¹^k := by + rw [abs_mul,abs_mul] + calc + _ ≤ ((2*|(t:ℝ)| *(2:ℝ)⁻¹^k)*400)*400 := mul_le_mul + (mul_le_mul (factor_error k a b t) (qmaFourAxisShift_abs_bound a true) + (abs_nonneg _) (by positivity)) (qmaFourAxisShift_abs_bound b _) + (abs_nonneg _) (by positivity) + _ = _ := by ring + have he : (offset k a b t:ℝ)-qmaFourEnergyOffset a b (t:ℝ) = + ((shiftValue a (counterA k a b t):ℝ)-qmaFourAxisFieldShift a (qmaFourCounterA a b (t:ℝ)))+ + ((shiftValue b (counterB k a b t):ℝ)-qmaFourAxisFieldShift b (qmaFourCounterB a b (t:ℝ)))- + ((factor k a b t:ℝ)-qmaFourCouplingFactor a b (t:ℝ))*qmaFourAxisShift a true* + qmaFourAxisShift b (qmaFourCouplingSign (t:ℝ)) := by + simp only [offset,qmaFourEnergyOffset,Rat.cast_sub,Rat.cast_add,Rat.cast_mul,shift_cast,sign_cast] + ring + rw [he] + apply (abs_sub _ _).trans + apply (add_le_add (abs_add_le _ _) le_rfl).trans + calc + _ ≤ (400*|(t:ℝ)| *(2:ℝ)⁻¹^k+400*|(t:ℝ)| *(2:ℝ)⁻¹^k)+320000*|(t:ℝ)| *(2:ℝ)⁻¹^k := + add_le_add (add_le_add ha hb) hc + _ = _ := by ring + +end ContinuumCoulomb.QuantumAxisSample + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOperatorQuadratic.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOperatorQuadratic.lean new file mode 100644 index 0000000000000000000000000000000000000000..2a1eda700e56bd59403bef0c6dde9c82186830cb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOperatorQuadratic.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRectangularOperator + +namespace OAI + +/-! Matrix quadratic forms agree with the real forms of their actual +complex Euclidean operators, including rectangular compressions. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped InnerProductSpace +variable {α β : Type*} [Fintype α] [Fintype β] + +theorem qmaMatrixOperator_real_adjoint (B : Matrix α β ℂ) + (p : EuclideanSpace ℂ β) (y : EuclideanSpace ℂ α) : + ⟪qmaMatrixOperator B p,y⟫_ℝ = ⟪p,qmaMatrixOperator B.conjTranspose y⟫_ℝ := by + rw [qmaEuclidean_real_inner,qmaEuclidean_real_inner] + have h := ContinuousLinearMap.adjoint_inner_right (qmaMatrixOperator B) p y + rw [← qmaMatrixOperator_star] at h + exact congrArg Complex.re h.symm + +theorem qmaQuadratic_operator (M : Matrix α α ℂ) (p : EuclideanSpace ℂ α) : + qmaQuadratic M (fun i => p i) = ⟪p,qmaMatrixOperator M p⟫_ℝ := by + rw [qmaEuclidean_real_inner] + simp only [qmaQuadratic,PiLp.inner_apply,RCLike.inner_apply',qmaMatrixOperator_apply, + Matrix.mulVec,dotProduct,Pi.star_apply,starRingEnd_apply] + +theorem qmaQuadratic_sandwich [DecidableEq α] [DecidableEq β] (B : Matrix α β ℂ) (M : Matrix α α ℂ) + (p : EuclideanSpace ℂ β) : + qmaQuadratic (B.conjTranspose*M*B) (fun i => p i) = + ⟪qmaMatrixOperator B p,qmaMatrixOperator M (qmaMatrixOperator B p)⟫_ℝ := by + rw [qmaQuadratic_operator,qmaMatrixOperator_mul,qmaMatrixOperator_mul] + simp only [ContinuousLinearMap.comp_apply] + exact (qmaMatrixOperator_real_adjoint B p _).symm + +theorem qmaQuadratic_sub (M N : Matrix α α ℂ) (p : α → ℂ) : + qmaQuadratic (M-N) p = qmaQuadratic M p-qmaQuadratic N p := by + have hn : qmaQuadratic (-N) p = -qmaQuadratic N p := by + have h := qmaQuadratic_smul N (-1) p + simpa using h + simp only [sub_eq_add_neg,qmaQuadratic_add,hn] + +theorem qmaQuadratic_real_smul (M : Matrix α α ℂ) (a : ℝ) (p : α → ℂ) : + qmaQuadratic (a • M) p = a*qmaQuadratic M p := by + have he : a • M = (a:ℂ) • M := rfl + rw [he,qmaQuadratic_smul] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedCellProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedCellProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..53f085fa654a3fd5ff3b88aeec7cdabed8a068b7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedCellProgram.lean @@ -0,0 +1,61 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingInputProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawFamilyProgram + +namespace OAI + +/-! Cell arrays follow the same term-major order as the literal local-word +compiler. Each new mediator inherits its term's cell; each output word retains +that cell as its anchor. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedCellProgram +open ExactQuantumFactoring.BitStackProgram QuantumRouteCode + +abbrev State := List Pair × List Pair +def stateCode : State → List Bool := prodCode (listCode pairCode) (listCode pairCode) + +def anchors (d : ℕ) (xs : List Pair) : List Pair := + (xs.map (fun p => List.replicate d p)).flatten + +def value (d : ℕ) (x : State) : State := (x.1++x.2,anchors d x.2) + +noncomputable def repeatProgram (d : ℕ) : + Procedure pairCode (listCode pairCode) (fun p : Pair => List.replicate d p) := + (QuantumRawExchange.fixedListProgram pairCode pairCode d (fun _ p => p) + (fun _ => Procedure.identity pairCode)).congrFun (by intro p; simp) + +noncomputable def anchorsProgram (d : ℕ) : + Procedure (listCode pairCode) (listCode pairCode) (anchors d) := + (QuantumRawExchange.flattenProgram pairCode (0,0)).comp + (Procedure.listMap (0,0) [] (repeatProgram d)) + +noncomputable def program (d : ℕ) : Procedure stateCode stateCode (value d) := + (Procedure.listAppend pairCode (0,0)).pair + ((anchorsProgram d).comp (Procedure.second (listCode pairCode) (listCode pairCode))) + +theorem cells_length (d : ℕ) (x : State) : (value d x).1.length=x.1.length+x.2.length := + List.length_append + +theorem anchors_length (d : ℕ) (xs : List Pair) : (anchors d xs).length=xs.length*d := by + induction xs with + | nil => simp [anchors] + | cons p xs ih => + simp only [anchors,List.map_cons,List.flatten_cons,List.length_append,List.length_replicate] at * + rw [ih,List.length_cons] + simp only [Nat.add_mul,Nat.one_mul] + omega + +theorem cells_ofFn {n m : ℕ} (d : ℕ) (cell : Fin n → Pair) (anchor : Fin m → Pair) : + (value d (List.ofFn cell,List.ofFn anchor)).1=List.ofFn (Fin.append cell anchor) := + (List.ofFn_fin_append cell anchor).symm + +theorem anchors_ofFn {m : ℕ} (d : ℕ) (anchor : Fin m → Pair) : + anchors d (List.ofFn anchor)= + (List.ofFn (fun i : Fin m => List.ofFn (fun _ : Fin d => anchor i))).flatten := by + simp only [anchors,List.map_ofFn,List.ofFn_const,Function.comp_def] + +end ContinuumCoulomb.QuantumOrderedCellProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedCellTable.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedCellTable.lean new file mode 100644 index 0000000000000000000000000000000000000000..55eb29440fa22b3bdfcfa98f14f9d2188e0dd28a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedCellTable.lean @@ -0,0 +1,57 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedSpatialComplete +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedCellProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelOutput + +namespace OAI + +/-! The computed spatial arrays use exactly the same sum/product enumeration +as the actual ordered Hamiltonian compiler. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedCellTable +open QuantumOrderedCellProgram QuantumOrderedLabelTable QuantumOrderedSpatialComplete +open ExactQuantumFactoring.BitStackProgram +open QuantumRouteCode +variable {ι κ : Type} {n m : ℕ} + +def table (q : Fin n ≃ ι) (e : Fin m ≃ κ) (cell : ι → Pair) (anchor : κ → Pair) : State := + (List.ofFn (fun i => cell (q i)),List.ofFn (fun i => anchor (e i))) + +theorem value_table (d : ℕ) (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (cell : ι → Pair) (anchor : κ → Pair) : + value d (table q e cell anchor)= + table (nextQubit q e) (nextTerm e d) (extendCell cell anchor) (extendAnchor d anchor) := by + apply Prod.ext + · rw [show (value d (table q e cell anchor)).1= + List.ofFn (Fin.append (fun i => cell (q i)) (fun i => anchor (e i))) from cells_ofFn d _ _] + apply congrArg List.ofFn + funext i + obtain ⟨i,rfl⟩ := (finSumFinEquiv : Fin n ⊕ Fin m ≃ Fin (n+m)).surjective i + cases i <;> simp [nextQubit,extendCell,Fin.append] + · change anchors d (List.ofFn (fun i => anchor (e i)))=List.ofFn _ + rw [anchors_ofFn] + rw [← product_table (fun p : Fin m × Fin d => anchor (e p.1))] + apply congrArg List.ofFn + funext i + rfl + +def complete (x : State) : State := value 4 (value 7 (value 4 (value 7 (value 4 (value 4 x))))) + +noncomputable def completeProgram : Procedure stateCode stateCode complete := + (program 4).comp ((program 7).comp ((program 4).comp ((program 7).comp + ((program 4).comp (program 4))))) + +theorem complete_table (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (cell : ι → Pair) (anchor : κ → Pair) : + complete (table q e cell anchor)= + table (QuantumOrderedLabelTable.qubits6 q e) (QuantumOrderedLabelTable.terms6 e) + (cell6 cell anchor) (anchor6 anchor) := by + unfold complete + rw [value_table,value_table,value_table,value_table,value_table,value_table] + rfl + +end ContinuumCoulomb.QuantumOrderedCellTable + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedCoefficient.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedCoefficient.lean new file mode 100644 index 0000000000000000000000000000000000000000..d57131a0032cc0c11ebd06611fd4c297a8fa9bb5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedCoefficient.lean @@ -0,0 +1,199 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumAlgebraicHistory + +namespace OAI + +/-! Exact rational-register tables for every actual ordered history term. +Only the propagation core is multiplied, so its summation has at most +32 states regardless of the number of spectator qubits. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumAlgebraicHistory +open QuantumAlgebraicScalar QuantumFixedPauli Matrix +open scoped BigOperators Classical + +def diagonal {α : Type} [DecidableEq α] (f : α → ℚ) : Matrix α α Scalar := + fun s t => if s = t then rat (f s) else rat 0 + +theorem denote_diagonal {α : Type} [DecidableEq α] (f : α → ℚ) : + denote (diagonal f) = Matrix.diagonal (fun s => (f s:ℂ)) := by + ext s t + by_cases h : s = t <;> simp [denote,QuantumAlgebraicHistory.diagonal,h] + +def distributed (c : QMACircuit) (τ : Fin (c.work+1) → Fin (c.gates.length+1)) : + QMACircuitTerm c → Matrix (QMACircuitQubit c → Fin 2) (QMACircuitQubit c → Fin 2) Scalar + | .inl i => diagonal (fun s => + if s (Sum.inl i.castSucc) = 0 ∧ s (Sum.inl i.succ) = 1 then 1 else 0) + | .inr (.inl b) => if b = 0 then + diagonal (fun s => if s (Sum.inl 0) = 1 then 0 else 1) else + diagonal (fun s => if s (Sum.inl (Fin.last (c.gates.length+1))) = 0 then 0 else 1) + | .inr (.inr (.inl i)) => diagonal (fun s => + if qmaClockAt c.gates.length (τ i) (s ∘ Sum.inl) ∧ + qmaInputCheck c i (s ∘ Sum.inr) then 14 else 0) + | .inr (.inr (.inr (.inl _))) => diagonal (fun s => + if s (Sum.inl (qmaOutputMarker c)) = 1 ∧ s (Sum.inr (Fin.last c.work)) ≠ 1 then 1 else 0) + | .inr (.inr (.inr (.inr t))) => fun s r => + mul (rat ((14*(c.work+1)+8)*c.gates.length:ℚ)) + (lift (qmaPropagationSites c t) (propagationCore c t) s r) + +theorem denote_distributed (c : QMACircuit) + (τ : Fin (c.work+1) → Fin (c.gates.length+1)) (a : QMACircuitTerm c) : + denote (distributed c τ a) = qmaDistributedTermMatrix c τ a := by + rcases a with i | (b | (i | (u | t))) + · ext s r + simp only [distributed,denote,QuantumAlgebraicHistory.diagonal,qmaDistributedTermMatrix,qmaClockFaultTerm, + qmaPairDiagonal,Matrix.diagonal_apply] + split_ifs <;> simp + · fin_cases b + · change denote (QuantumAlgebraicHistory.diagonal + (fun s : QMACircuitQubit c → Fin 2 => if s (Sum.inl 0) = 1 then 0 else 1)) = + qmaClockLeftTerm c + rw [denote_diagonal] + ext s r + simp only [qmaClockLeftTerm,qmaBitDiagonal,Matrix.diagonal_apply] + split_ifs <;> norm_num + · change denote (QuantumAlgebraicHistory.diagonal + (fun s : QMACircuitQubit c → Fin 2 => + if s (Sum.inl (Fin.last (c.gates.length+1))) = 0 then 0 else 1)) = + qmaClockRightTerm c + rw [denote_diagonal] + ext s r + simp only [qmaClockRightTerm,qmaBitDiagonal,Matrix.diagonal_apply] + split_ifs <;> norm_num + · ext s r + simp only [distributed,denote,QuantumAlgebraicHistory.diagonal,qmaDistributedTermMatrix, + qmaDistributedInputTerm,Matrix.diagonal_apply] + split_ifs <;> simp + · cases u + ext s r + simp only [distributed,denote,QuantumAlgebraicHistory.diagonal,qmaDistributedTermMatrix,qmaOutputTerm, + qmaPairDiagonal,Matrix.diagonal_apply] + split_ifs <;> simp + · change (fun s r => value (mul _ (lift _ _ s r))) = _ + simp only [value_mul,value_rat] + have hl := denote_lift (qmaPropagationSites c t) (propagationCore c t) + rw [denote_propagationCore] at hl + have hc := (qmaLocalPropagationGram_local c t).core_lift + rw [hc] at hl + ext s r + have he := congrFun (congrFun hl s) r + dsimp only [denote] at he + rw [he] + simp only [qmaDistributedTermMatrix,Matrix.smul_apply,smul_eq_mul] + push_cast + rfl + +def localY (n : ℕ) (i : Fin n) (s t : SourceSpinBasis n) : Scalar := + finiteProduct (fun k => if k = i then QuantumFixedPauli.pauli 2 (s k) (t k) else identity (s k) (t k)) + +theorem value_localY (n : ℕ) (i : Fin n) (s t : SourceSpinBasis n) : + value (localY n i s t) = sourceLocalPauli n i 1 s t := by + rw [localY,value_finiteProduct] + unfold sourceLocalPauli sourceTensor + apply Finset.prod_congr rfl + intro k _ + by_cases h : k = i + · simp only [h,ite_true,value_pauli] + rfl + · simp only [h,ite_false,value_identity] + +def rebit {ι : Type} [Fintype ι] [DecidableEq ι] (n : ℕ) (i : Fin n) + (A : Matrix (ι → Fin 2) (ι → Fin 2) Scalar) + (s t : Fin n ⊕ ι → Fin 2) : Scalar := + add (mul (identity (s ∘ Sum.inl) (t ∘ Sum.inl)) + (realPart (A (s ∘ Sum.inr) (t ∘ Sum.inr)))) + (mul (neg imaginary) (mul (localY n i (s ∘ Sum.inl) (t ∘ Sum.inl)) + (imagPart (A (s ∘ Sum.inr) (t ∘ Sum.inr))))) + +theorem denote_rebit {ι : Type} [Fintype ι] [DecidableEq ι] (n : ℕ) (i : Fin n) + (A : Matrix (ι → Fin 2) (ι → Fin 2) Scalar) : + denote (rebit n i A) = qmaDistributedRebitOnQubits n i (denote A) := by + rw [qmaDistributedRebitOnQubits_eq] + ext s t + simp only [denote,rebit,value_add,value_mul,value_identity,value_realPart,value_imagPart, + value_neg,value_imaginary,value_localY,qmaJoinMatrix,Matrix.add_apply, + Matrix.smul_apply,smul_eq_mul,Matrix.submatrix_apply] + rfl + +def pairY (n : ℕ) (i j : Fin n) (s t : SourceSpinBasis n) : Scalar := + mul (mul (QuantumFixedPauli.pauli 2 (s i) (t i)) (QuantumFixedPauli.pauli 2 (s j) (t j))) + (rat (if ∀ k, k ≠ i → k ≠ j → s k = t k then 1 else 0)) + +theorem value_pairY (n : ℕ) (i j : Fin n) (hne : i ≠ j) (s t : SourceSpinBasis n) : + value (pairY n i j s t) = (sourceLocalPauli n i 1*sourceLocalPauli n j 1) s t := by + rw [sourceLocalPauli_product_entry n i j hne] + simp only [pairY,value_mul,value_pauli] + have he (a b : Fin 2) : qmaPauli 2 a b = ContinuumCoulomb.pauli 1 a b := rfl + rw [he,he] + by_cases h : ∀ k, k ≠ i → k ≠ j → s k = t k + · rw [ite_eq_left h,sourceSpectatorDelta_eq_one n i j s t h] + simp + · rw [ite_eq_right h,sourceSpectatorDelta_eq_zero n i j s t h] + simp + +def referenceEdge {ι : Type} [Fintype ι] [DecidableEq ι] (n : ℕ) (i : Fin n) + (s t : Fin (n+1) ⊕ ι → Fin 2) : Scalar := + mul (mul (rat (1/2)) (sub (identity (s ∘ Sum.inl) (t ∘ Sum.inl)) + (pairY (n+1) i.castSucc i.succ (s ∘ Sum.inl) (t ∘ Sum.inl)))) + (identity (s ∘ Sum.inr) (t ∘ Sum.inr)) + +theorem denote_referenceEdge {ι : Type} [Fintype ι] [DecidableEq ι] (n : ℕ) (i : Fin n) : + denote (referenceEdge (ι := ι) n i) = qmaReferenceEdgeOnQubits (ι := ι) n i := by + have hne : i.castSucc ≠ i.succ := by + intro h + have he := congrArg Fin.val h + simp at he + ext s t + simp only [denote,referenceEdge,value_mul,value_rat,value_sub,value_identity, + value_pairY _ _ _ hne,qmaReferenceEdgeOnQubits,qmaJoinMatrix,qmaReferenceYEdge, + Matrix.submatrix_apply,Matrix.kroneckerMap_apply,Matrix.smul_apply,smul_eq_mul, + Matrix.sub_apply] + norm_num + rfl + +def orderedTerm (c : QMACircuit) (hT : 0 < c.gates.length) : + QMAReferenceTerm (qmaHistoryReferenceWork c) → + Matrix (Fin (qmaHistoryReferenceWork c+1) ⊕ QMACircuitQubit c → Fin 2) + (Fin (qmaHistoryReferenceWork c+1) ⊕ QMACircuitQubit c → Fin 2) Scalar + | .inl i => rebit (qmaHistoryReferenceWork c+1) i + (distributed c (qmaFirstUseTime c) (qmaOrderedTermEquiv c hT (qmaFirstUseTime c) i)) + | .inr i => referenceEdge (qmaHistoryReferenceWork c) i + +theorem denote_orderedTerm (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) : + denote (orderedTerm c hT a) = (qmaOrderedHistoryModel c hT).matrix a := by + cases a with + | inl i => + rw [orderedTerm,denote_rebit,denote_distributed] + rfl + | inr i => + rw [orderedTerm,denote_referenceEdge] + rfl + +def orderedCore (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) : + Matrix (QMASupportBasis ((qmaOrderedHistoryModel c hT).sites a)) + (QMASupportBasis ((qmaOrderedHistoryModel c hT).sites a)) Scalar := + fun s t => orderedTerm c hT a (qmaSupportExtend _ s) (qmaSupportExtend _ t) + +theorem denote_orderedCore (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) : + denote (orderedCore c hT a) = qmaLocalCore ((qmaOrderedHistoryModel c hT).sites a) + ((qmaOrderedHistoryModel c hT).matrix a) := by + ext s t + exact congrFun (congrFun (denote_orderedTerm c hT a) _) _ + +theorem orderedCoefficient_eq (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) + (w : {x // x ∈ (qmaOrderedHistoryModel c hT).sites a} → Fin 4) : + realValue (realCoefficient (orderedCore c hT a) w) = + (qmaPauliCoefficient (qmaLocalCore ((qmaOrderedHistoryModel c hT).sites a) + ((qmaOrderedHistoryModel c hT).matrix a)) w).re := by + rw [realCoefficient_eq] + change (qmaPauliCoefficient (denote (orderedCore c hT a)) w).re = _ + rw [denote_orderedCore] + +end ContinuumCoulomb.QuantumAlgebraicHistory + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedDescriptorProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedDescriptorProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..d9d8d1d1fde0a0c3521ad10c7b6715fe5e0068d8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedDescriptorProgram.lean @@ -0,0 +1,99 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedDescriptors +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawFamilyProgram + +namespace OAI + +/-! A literal polynomial program for the exact time-grouped descriptor list. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumHistoryDescriptors +open ExactQuantumFactoring.BitStackProgram QuantumCircuitCode + +abbrev TimeInput := QMACircuit × Descriptor +def timeCode : TimeInput → List Bool := prodCode circuitCode descriptorCode + +noncomputable opaque timeValueProgram : Procedure timeCode Nat.bits + (fun x => timeValue x.1 x.2) := by + let c := Procedure.first circuitCode descriptorCode + let d := Procedure.second circuitCode descriptorCode + let tag := (Procedure.first Nat.bits Nat.bits).comp d + let index := (Procedure.second Nat.bits Nat.bits).comp d + let time := Procedure.unaryToBits.comp (timeProgram.comp c) + let last := Procedure.binarySub.comp + (time.pair (Procedure.constant timeCode Nat.bits 1)) + let test (n : ℕ) := Procedure.binaryEq.comp + (tag.pair (Procedure.constant timeCode Nat.bits n)) + let minWithLast {f : TimeInput → ℕ} (p : Procedure timeCode Nat.bits f) : + Procedure timeCode Nat.bits (fun x => min (f x) (x.1.gates.length-1)) := + (Procedure.conditional (Procedure.binaryLe.comp (p.pair last)) p last).congrFun + (by intro x; simp only [Function.comp_apply,id_eq,decide_eq_true_eq]; split_ifs <;> omega) + let firstUse := Procedure.unaryToBits.comp + (QuantumFirstUseProgram.program.comp (c.pair index)) + let boundary := Procedure.conditional + (Procedure.binaryEq.comp (index.pair (Procedure.constant timeCode Nat.bits 0))) + (Procedure.constant timeCode Nat.bits 0) last + exact (Procedure.conditional (test 0) (minWithLast index) + (Procedure.conditional (test 1) boundary + (Procedure.conditional (test 2) (minWithLast firstUse) + (Procedure.conditional (test 3) last index)))).congrFun (by + intro x + simp only [timeValue,Function.comp_apply,id_eq,decide_eq_true_eq]) + +abbrev BucketInput := QMACircuit × ℕ +def bucketCode : BucketInput → List Bool := prodCode circuitCode Nat.bits +abbrev ChunkInput := BucketInput × Descriptor +def chunkCode : ChunkInput → List Bool := prodCode bucketCode descriptorCode + +def chunk (x : ChunkInput) : List Descriptor := + if timeValue x.1.1 x.2=x.1.2 then [x.2] else [] + +noncomputable opaque chunkProgram : Procedure chunkCode (listCode descriptorCode) chunk := by + let env := Procedure.first bucketCode descriptorCode + let c := (Procedure.first circuitCode Nat.bits).comp env + let t := (Procedure.second circuitCode Nat.bits).comp env + let d := Procedure.second bucketCode descriptorCode + let hit := Procedure.binaryEq.comp ((timeValueProgram.comp (c.pair d)).pair t) + let nil := Procedure.constant chunkCode (listCode descriptorCode) [] + exact (Procedure.conditional hit ((Procedure.listCons descriptorCode).comp (d.pair nil)) + nil).congrFun (by intro x; simp only [chunk,Function.comp_apply,decide_eq_true_eq]) + +private theorem chunks_eq (c : QMACircuit) (t : ℕ) (xs : List Descriptor) : + (xs.map (fun d => chunk ((c,t),d))).flatten = + xs.filter (fun d => decide (timeValue c d=t)) := by + induction xs with + | nil => rfl + | cons d xs ih => + simp only [List.map_cons,List.flatten_cons,ih,List.filter_cons] + by_cases h : timeValue c d=t + · simp [chunk,h] + · simp [chunk,h] + +noncomputable opaque bucketProgram : Procedure bucketCode (listCode descriptorCode) + (fun x => bucket x.1 x.2) := by + let chunks := (Procedure.listMapWith (f := fun e d => chunk (e,d)) (0,0) [] + chunkProgram).comp ((Procedure.identity bucketCode).pair + (sourceProgram.comp (Procedure.first circuitCode Nat.bits))) + exact ((QuantumRawExchange.flattenProgram descriptorCode (0,0)).comp chunks).congrFun + (by intro x; exact chunks_eq x.1 x.2 (source x.1)) + +noncomputable opaque orderedEntryProgram : + Procedure (prodCode unaryCode circuitCode) (listCode descriptorCode) + (fun x => bucket x.2 x.1) := + bucketProgram.comp ((Procedure.second unaryCode circuitCode).pair + (Procedure.unaryToBits.comp (Procedure.first unaryCode circuitCode))) + +noncomputable opaque orderedProgram : Procedure circuitCode (listCode descriptorCode) ordered := + ((QuantumRawExchange.flattenProgram descriptorCode (0,0)).comp + ((Procedure.tabulate (f := fun c i => bucket c i) [] orderedEntryProgram).comp + (timeProgram.pair (Procedure.identity circuitCode)))).congrFun (by + intro c + simp only [ordered,List.flatMap_def,Function.comp_apply,id_eq]) + +noncomputable def orderedCertificate : Turing.TM2ComputableInPolyTime circuitCode + (listCode descriptorCode) ordered := orderedProgram.toTM2 + +end ContinuumCoulomb.QuantumHistoryDescriptors + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedDescriptors.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedDescriptors.lean new file mode 100644 index 0000000000000000000000000000000000000000..2697feb14f42150196067400a142a459b2de31f6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedDescriptors.lean @@ -0,0 +1,91 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryDescriptorProgram + +namespace OAI + +/-! Numeric time grouping agrees with the exact ordered reference family. +The first-use time is computed from the actual gate list. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumHistoryDescriptors +open ExactQuantumFactoring.BitStackProgram QuantumCircuitCode + +def timeValue (c : QMACircuit) (a : Descriptor) : ℕ := + if a.1=0 then min a.2 (c.gates.length-1) else + if a.1=1 then (if a.2=0 then 0 else c.gates.length-1) else + if a.1=2 then min (QuantumFirstUseProgram.value (c,a.2)) (c.gates.length-1) else + if a.1=3 then c.gates.length-1 else a.2 + +theorem time_encode (c : QMACircuit) (hT : 0 decide (timeValue c a=t)) + +def ordered (c : QMACircuit) : List Descriptor := + (List.range c.gates.length).flatMap (bucket c) + +theorem bucket_actual (c : QMACircuit) (hT : 0 decide (qmaHistoryTermTime c hT (qmaFirstUseTime c) a=t))).map + (encode c) := by + rw [bucket,source_actual,List.filter_map] + congr 1 + apply List.filter_congr + intro a _ + change decide (timeValue c (encode c a)=t.val) = _ + rw [time_encode c hT] + simp only [Fin.ext_iff] + +theorem ordered_actual (c : QMACircuit) (hT : 0 t)).map Fin.val := by + apply List.ext_getElem + · simp + · intro i hi hj + simp only [List.getElem_range,List.getElem_map,List.getElem_ofFn] + rw [hr,List.flatMap_map] + apply List.flatMap_congr + intro t _ + exact bucket_actual c hT t + +theorem ordered_length (c : QMACircuit) (hT : 0 B + | k+1 => stepNat (3136*m) (pipelineNat m B N k) N + +theorem weightNat_cast (R B : ℕ) : (weightNat R B:ℚ)=weightEnvelope R B := by + simp only [weightNat,weightEnvelope,Nat.cast_add,Nat.cast_mul,Nat.cast_pow, + Nat.cast_one] + +theorem scaleNat_cast (m B N : ℕ) : (scaleNat m B N:ℚ)=scaleEnvelope m B N := by + simp only [scaleNat,scaleEnvelope,Nat.cast_add,Nat.cast_mul,Nat.cast_pow, + Nat.cast_one,Nat.cast_ofNat] + +theorem stepNat_cast (m B N : ℕ) : (stepNat m B N:ℚ)=stepEnvelope m B N := by + simp only [stepNat,stepEnvelope,weightNat_cast,scaleNat_cast] + +theorem pipelineNat_cast (m B N k : ℕ) : (pipelineNat m B N k:ℚ)=pipelineBound m B N k := by + induction k with + | zero => rfl + | succ k ih => simp only [pipelineNat,stepNat_cast,ih,pipelineBound] + +theorem outputTerm_card {κ : Type} [Fintype κ] : + Fintype.card (OutputTerm κ)=3136*Fintype.card κ := by + simp only [OutputTerm,XZThreeTerm,TwoTerm,ThreeTerm,Fintype.card_prod,Fintype.card_fin] + ring + +theorem private_coefficient_bound {κ : Type} [Fintype κ] (J : κ → ℚ) + {m B : ℕ} (hm : Fintype.card κ ≤ m) (hJ : ∀ e, |J e| ≤ (B:ℚ)) + (N : ℕ) (p : OutputTerm κ × Fin 4) : + |QuantumOrderedPrivate.outputCoefficient (coefficient J N) N p| ≤ + (pipelineNat m B N 6:ℚ) := by + have hB : (0:ℚ) ≤ B := Nat.cast_nonneg B + have hc := pipeline_coefficient_bound J hB hm hJ N + have hcount : Fintype.card (OutputTerm κ) ≤ 3136*m := by + rw [outputTerm_card] + exact Nat.mul_le_mul_left 3136 hm + have h := subdivision_coefficient_bound (coefficient J N) + (pipelineBound_nonneg m hB N 5) hcount hc N p + change |QuantumOrderedSubdivision.outputCoefficient (coefficient J N) N p| ≤ + (stepNat (3136*m) (pipelineNat m B N 5) N:ℚ) + rw [stepNat_cast,pipelineNat_cast] + exact h + +end ContinuumCoulomb.QuantumOrderedXZ + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedHistory.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedHistory.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e8f177d1b7da2e71382105621c578bd05df21b8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedHistory.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedReference + +namespace OAI + +/-! Reordering actual history terms preserves the full-space reference gap. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +def qmaOrderedReferenceTerms (c : QMACircuit) (hT : 0 < c.gates.length) + (τ : Fin (c.work+1) → Fin (c.gates.length+1)) + (i : Fin (qmaHistoryReferenceWork c+1)) := + qmaDistributedTermMatrix c τ (qmaOrderedTermEquiv c hT τ i) + +theorem qmaOrderedReferenceTerms_sum (c : QMACircuit) (hT : 0 < c.gates.length) + (τ : Fin (c.work+1) → Fin (c.gates.length+1)) : + (∑ i, qmaOrderedReferenceTerms c hT τ i) = qmaDistributedQubitHamiltonian c τ := by + unfold qmaOrderedReferenceTerms + rw [(qmaOrderedTermEquiv c hT τ).sum_comp,qmaDistributedTerm_sum] + +def qmaOrderedReferenceHistory (c : QMACircuit) (hT : 0 < c.gates.length) + (τ : Fin (c.work+1) → Fin (c.gates.length+1)) : + Matrix (QMAHistoryReferenceBasis c) (QMAHistoryReferenceBasis c) ℂ := + qmaReferenceFamily (qmaHistoryReferenceWork c) (qmaOrderedReferenceTerms c hT τ) 1 + +theorem qmaOrderedReferenceHistory_lower (c : QMACircuit) (hc : c.WellFormed) + (hT : 0 < c.gates.length) (τ : Fin (c.work+1) → Fin (c.gates.length+1)) + (hi : ∀ i, ∀ g ∈ c.gates.take (τ i).val, i ∉ qmaGateSites c.work g) + (hsound : ∀ psi : EuclideanSpace ℂ (SourceSpinBasis c.witness), + ‖psi‖ = 1 → qmaAcceptance c hc psi ≤ 1/3) + (u : QMAHistoryReferenceBasis c → ℂ) : + (2/(5*(c.gates.length+1:ℝ)))*(∑ p, Complex.normSq (u p)) ≤ + qmaQuadratic (qmaOrderedReferenceHistory c hT τ) u := by + have hd : 0 < 5*(c.gates.length+1:ℝ) := by positivity + have ha : (2:ℝ)/(5*(c.gates.length+1:ℝ)) ≤ 1 := by + apply (div_le_one hd).mpr + have : (0:ℝ) ≤ c.gates.length := Nat.cast_nonneg _ + linarith + apply qmaReferenceFamily_lower _ _ (fun i => qmaDistributedTerm_nonnegative c τ _) _ _ + (by positivity) ha + intro v + change _ ≤ qmaQuadratic (∑ i, qmaOrderedReferenceTerms c hT τ i) v + rw [qmaOrderedReferenceTerms_sum] + exact qmaDistributedQubit_lower c hc τ hi hsound v + +theorem qmaOrderedReferenceHistory_accepting (c : QMACircuit) (hc : c.WellFormed) + (hT : 0 < c.gates.length) (τ : Fin (c.work+1) → Fin (c.gates.length+1)) + (hi : ∀ i, ∀ g ∈ c.gates.take (τ i).val, i ∉ qmaGateSites c.work g) + (psi : EuclideanSpace ℂ (SourceSpinBasis c.witness)) (hpsi : ‖psi‖ = 1) + (hacc : 2/3 ≤ qmaAcceptance c hc psi) : + ∃ u : QMAHistoryReferenceBasis c → ℂ, (∑ p, Complex.normSq (u p)) = 1 ∧ + 3*(c.gates.length+1:ℝ)*qmaQuadratic (qmaOrderedReferenceHistory c hT τ) u ≤ 1 := by + obtain ⟨v,hv,he⟩ := qmaDistributedQubit_accepting c hc τ hi psi hpsi hacc + refine ⟨qmaReferenceTrial (qmaHistoryReferenceWork c) v,?_,?_⟩ + · rw [qmaReferenceTrial_mass] + exact hv + · unfold qmaOrderedReferenceHistory + rw [qmaReferenceTrial_energy,qmaOrderedReferenceTerms_sum] + exact he + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedIncidence.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedIncidence.lean new file mode 100644 index 0000000000000000000000000000000000000000..b38b7626cecf580d5ec98faff77267bd0225bad5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedIncidence.lean @@ -0,0 +1,180 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedXZPipeline +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedPrivate + +namespace OAI + +/-! Uniform incidence bounds for the actual ordered local reductions. Every +new site belongs to one input term, while old sites remain in that term's +stored support. The bound counts zero-coefficient terms as well. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedIncidence +open scoped BigOperators Classical + +variable {ι κ : Type} [Fintype κ] + +def count (xs : κ → List ι) (q : ι) : ℕ := + ∑ e, if q ∈ xs e then 1 else 0 + +def Bounded (xs : κ → List ι) (D : ℕ) : Prop := ∀ q, count xs q ≤ D + +def Origin (xs : κ → List ι) (e : κ) : ι ⊕ κ → Prop := + Sum.elim (fun q => q ∈ xs e) (fun f => f = e) + +theorem extension_bound {d D : ℕ} (xs : κ → List ι) + (ys : κ × Fin d → List (ι ⊕ κ)) (hD : 1 ≤ D) (hx : Bounded xs D) + (hy : ∀ p q, q ∈ ys p → Origin xs p.1 q) : Bounded ys (d*D) := by + intro q + cases q with + | inl q => + calc + count ys (Sum.inl q) ≤ ∑ p : κ × Fin d, if q ∈ xs p.1 then 1 else 0 := by + apply Finset.sum_le_sum + intro p _ + by_cases h : Sum.inl q ∈ ys p + · have ho : q ∈ xs p.1 := hy p _ h + simp only [h,ho,ite_true,le_refl] + · simp only [h,ite_false,Nat.zero_le] + _ = d*count xs q := by + rw [Fintype.sum_prod_type] + have hi (e : κ) : (∑ _k : Fin d, if q ∈ xs e then 1 else 0) = + d*(if q ∈ xs e then 1 else 0) := by + by_cases h : q ∈ xs e <;> simp [h] + simp_rw [hi] + exact (Finset.mul_sum _ _ _).symm + _ ≤ d*D := Nat.mul_le_mul_left d (hx q) + | inr q => + calc + count ys (Sum.inr q) ≤ ∑ p : κ × Fin d, if q=p.1 then 1 else 0 := by + apply Finset.sum_le_sum + intro p _ + by_cases h : Sum.inr q ∈ ys p + · have ho : q=p.1 := hy p _ h + rw [ite_eq_left h,ite_eq_left ho] + · simp only [h,ite_false,Nat.zero_le] + _ = d := by + rw [Fintype.sum_prod_type] + have hi (e : κ) : (∑ _k : Fin d, if q=e then 1 else 0) = + if q=e then d else 0 := by + by_cases h : q=e <;> simp [h] + simp_rw [hi] + simp + _ ≤ d*D := by simpa only [Nat.mul_one] using Nat.mul_le_mul_left d hD + +omit [Fintype κ] in +theorem append_origin (xs : κ → List ι) (e : κ) (zs : List ι) + (hz : ∀ q ∈ zs, q ∈ xs e) (q : ι ⊕ κ) + (hq : q ∈ QuantumOrderedSubdivision.appendMediator zs e) : Origin xs e q := by + cases q with + | inl q => + exact hz q (by simpa only [QuantumOrderedSubdivision.appendMediator, + List.mem_append,List.mem_map,Sum.inl.injEq,exists_eq_right,List.mem_singleton, + Sum.inl_ne_inr,or_false] using hq) + | inr q => + simpa only [Origin,Sum.elim_inr,QuantumOrderedSubdivision.appendMediator, + List.mem_append,List.mem_map,Sum.inl_ne_inr,and_false,exists_false,List.mem_singleton, + Sum.inr.injEq,false_or] using hq + +omit [Fintype κ] in +theorem subdivision_origin (xs : κ → List ι) (d : ℕ) + (p : κ × Fin 4) (q : ι ⊕ κ) + (hq : q ∈ QuantumOrderedSubdivision.outputSites xs d p) : Origin xs p.1 q := by + rcases p with ⟨e,k⟩ + fin_cases k + · simp [QuantumOrderedSubdivision.outputSites] at hq + · have he : q=Sum.inr e := by simpa [QuantumOrderedSubdivision.outputSites] using hq + subst q + rfl + · exact append_origin xs e _ (fun _ h => List.mem_of_mem_take h) q hq + · exact append_origin xs e _ (fun _ h => List.mem_of_mem_drop h) q hq + +theorem subdivision_bound {D : ℕ} (xs : κ → List ι) (d : ℕ) + (hD : 1 ≤ D) (hx : Bounded xs D) : + Bounded (QuantumOrderedSubdivision.outputSites xs d) (4*D) := + extension_bound xs _ hD hx (subdivision_origin xs d) + +omit [Fintype κ] in +theorem yy_origin (xs : κ → List ι) (p : κ × Fin 4) (q : ι ⊕ κ) + (hq : q ∈ QuantumOrderedYY.outputSites xs p) : Origin xs p.1 q := by + rcases p with ⟨e,k⟩ + fin_cases k + · simp [QuantumOrderedYY.outputSites] at hq + · have he : q=Sum.inr e := by simpa [QuantumOrderedYY.outputSites] using hq + subst q + rfl + · exact append_origin xs e _ (fun _ h => h) q hq + · exact append_origin xs e _ (fun _ h => h) q hq + +theorem yy_bound [Fintype ι] [DecidableEq ι] [DecidableEq κ] + {D : ℕ} (xs : κ → List ι) (hD : 1 ≤ D) (hx : Bounded xs D) : + Bounded (QuantumOrderedYY.outputSites xs) (4*D) := + extension_bound xs _ hD hx (yy_origin xs) + +omit [Fintype κ] in +theorem third_origin (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 3) (p : κ × Fin 7) (q : ι ⊕ κ) + (hq : q ∈ QuantumOrderedThird.outputSites xs w p) : Origin xs p.1 q := by + rcases p with ⟨e,k⟩ + have hp : ∀ i ∈ (QuantumOrderedTriple.partition (xs e) (w e)).1, i ∈ xs e := by + intro i hi + exact (QuantumOrderedTriple.partition_spec (xs e) (w e) (hlen e)).1.mem_iff.mp + (List.mem_append_left _ hi) + have hr : ∀ i ∈ (QuantumOrderedTriple.partition (xs e) (w e)).2, i ∈ xs e := by + intro i hi + exact (QuantumOrderedTriple.partition_spec (xs e) (w e) (hlen e)).1.mem_iff.mp + (List.mem_append_right _ hi) + fin_cases k + · simp [QuantumOrderedThird.outputSites] at hq + · have he : q=Sum.inr e := by simpa [QuantumOrderedThird.outputSites] using hq + subst q + rfl + · obtain ⟨i,hi,rfl⟩ := List.mem_map.mp hq + exact hp i hi + · obtain ⟨i,hi,rfl⟩ := List.mem_map.mp hq + exact hr i hi + · exact append_origin xs e _ hr q hq + · exact append_origin xs e _ (fun i h => hp i (List.mem_of_mem_take h)) q hq + · exact append_origin xs e _ (fun i h => hp i (List.mem_of_mem_drop h)) q hq + +theorem third_bound [Fintype ι] [DecidableEq ι] [DecidableEq κ] + {D : ℕ} (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 3) (hD : 1 ≤ D) (hx : Bounded xs D) : + Bounded (QuantumOrderedThird.outputSites xs w) (7*D) := + extension_bound xs _ hD hx (third_origin xs w hlen) + +theorem xz_bound [Fintype ι] [DecidableEq ι] [DecidableEq κ] + {D : ℕ} (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 6) (hD : 1 ≤ D) (hx : Bounded xs D) : + Bounded (QuantumOrderedXZ.sites xs w) (3136*D) := by + have h1 := subdivision_bound xs 3 hD hx + have h2 := subdivision_bound (QuantumOrderedSubdivision.outputSites xs 3) 2 + (by omega : 1 ≤ 4*D) h1 + have h3 := third_bound (QuantumOrderedXZ.threeSites xs) (QuantumOrderedXZ.threeWord xs w) + (QuantumOrderedXZ.threeSites_length xs hlen) (by omega : 1 ≤ 4*(4*D)) h2 + have h4 := yy_bound (QuantumOrderedXZ.twoSites xs w) (by omega : 1 ≤ 7*(4*(4*D))) h3 + have h5 := third_bound (QuantumOrderedXZ.xzThreeSites xs w) + (QuantumOrderedXZ.xzThreeWord xs w) (QuantumOrderedXZ.xzThreeSites_length xs w hlen) + (by omega : 1 ≤ 4*(7*(4*(4*D)))) h4 + change Bounded (QuantumOrderedXZ.sites xs w) (7*(4*(7*(4*(4*D))))) at h5 + convert h5 using 1 + omega + +theorem private_bound [Fintype ι] [DecidableEq ι] [DecidableEq κ] + {D : ℕ} (xs : κ → List ι) (hD : 1 ≤ D) (hx : Bounded xs D) : + Bounded (QuantumOrderedPrivate.outputSites xs) (4*D) := + subdivision_bound xs 1 hD hx + +theorem complete_bound [Fintype ι] [DecidableEq ι] [DecidableEq κ] + {D : ℕ} (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 6) (hD : 1 ≤ D) (hx : Bounded xs D) : + Bounded (QuantumOrderedPrivate.outputSites (QuantumOrderedXZ.sites xs w)) (12544*D) := by + have h := private_bound (QuantumOrderedXZ.sites xs w) + (by omega : 1 ≤ 3136*D) (xz_bound xs w hlen hD hx) + convert h using 1 + omega + +end ContinuumCoulomb.QuantumOrderedIncidence + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelBlocks.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelBlocks.lean new file mode 100644 index 0000000000000000000000000000000000000000..e3830fa9b6a377571c94f3ff14b7a7f7a0090cae --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelBlocks.lean @@ -0,0 +1,176 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelYY +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelProgram + +namespace OAI + +/-! Literal fixed-size programs for the triple partition and YY/private +blocks. The branch tests inspect only the stored support labels. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedLabelData +open ExactQuantumFactoring.BitStackProgram + +noncomputable opaque entryProgram (k : ℕ) : Procedure labelsCode labelCode + (fun xs => (xs.drop k).headD (0,0)) := + (Procedure.listGet labelCode (0,0)).comp + ((Procedure.constant labelsCode Nat.bits k).pair (Procedure.identity labelsCode)) +noncomputable opaque labelTest (k a : ℕ) : Procedure labelsCode Procedure.boolCode + (fun xs => decide (((xs.drop k).headD (0,0)).2=a)) := + Procedure.binaryEq.comp (((Procedure.second Nat.bits Nat.bits).comp (entryProgram k)).pair + (Procedure.constant labelsCode Nat.bits a)) +noncomputable opaque lengthTest (n : ℕ) : Procedure labelsCode Procedure.boolCode + (fun xs => decide (xs.length=n)) := + Procedure.binaryEq.comp ((Procedure.unaryToBits.comp + (ExactQuantumFactoring.NativeAIG.Emission.listUnaryLength labelCode (0,0))).pair + (Procedure.constant labelsCode Nat.bits n)) + +private def selected (a b : ℕ) (xs : List Letter) : List Letter := + [(xs.drop a).headD (0,0),(xs.drop b).headD (0,0)] +private noncomputable def selectedProgram (a b : ℕ) : Procedure labelsCode labelsCode + (selected a b) := + (Procedure.listCons labelCode).comp ((entryProgram a).pair + (singletonProgram _ (entryProgram b))) + +private def partitionLookup (xs : List Letter) : List Letter × List Letter := + if xs.length=3 then + if ((xs.drop 0).headD (0,0)).2=2 then + if ((xs.drop 1).headD (0,0)).2=2 then + (selected 0 1 xs,[(xs.drop 2).headD (0,0)]) + else (selected 0 2 xs,[(xs.drop 1).headD (0,0)]) + else (selected 1 2 xs,[(xs.drop 0).headD (0,0)]) + else (xs,[]) + +private theorem partitionLookup_eq (xs : List Letter) : partitionLookup xs=partition xs := by + cases xs with + | nil => rfl + | cons a xs => + cases xs with + | nil => rfl + | cons b xs => + cases xs with + | nil => rfl + | cons c xs => + cases xs with + | nil => simp [partitionLookup,partition,selected] + | cons d xs => simp [partitionLookup,partition,List.length_cons] + +noncomputable opaque partitionProgram : + Procedure labelsCode (prodCode labelsCode labelsCode) partition := by + let p01 := (selectedProgram 0 1).pair (singletonProgram _ (entryProgram 2)) + let p02 := (selectedProgram 0 2).pair (singletonProgram _ (entryProgram 1)) + let p12 := (selectedProgram 1 2).pair (singletonProgram _ (entryProgram 0)) + let p := Procedure.conditional (lengthTest 3) + (Procedure.conditional (labelTest 0 2) (Procedure.conditional (labelTest 1 2) p01 p02) p12) + ((Procedure.identity labelsCode).pair (Procedure.constant labelsCode labelsCode [])) + exact p.congrFun (by + intro xs + simpa only [partitionLookup,decide_eq_true_eq,id_eq] using partitionLookup_eq xs) + +noncomputable opaque pairLabelsProgram : Procedure blockCode labelsCode + (fun x => (partition x.2).1) := + ((Procedure.first labelsCode labelsCode).comp partitionProgram).comp labelsProgram +noncomputable opaque realLabelsProgram : Procedure blockCode labelsCode + (fun x => (partition x.2).2) := + ((Procedure.second labelsCode labelsCode).comp partitionProgram).comp labelsProgram +noncomputable opaque thirdMediatorProgram : Procedure blockCode labelCode + (fun x => (x.1,axis ((partition x.2).1.take 1))) := + mediatorProgram.pair (axisProgram.comp ((takeProgram 1).comp pairLabelsProgram)) + +noncomputable opaque thirdBlockProgram (k : Fin 7) : + Procedure blockCode labelsCode (fun x => thirdBlock x.1 x.2 k) := by + refine Fin.cases ?_ (fun k => ?_) k + · exact Procedure.constant blockCode labelsCode [] + · refine Fin.cases ?_ (fun k => ?_) k + · exact singletonProgram (fun x : BlockInput => (x.1,3)) + (mediatorProgram.pair (Procedure.constant blockCode Nat.bits 3)) + · refine Fin.cases ?_ (fun k => ?_) k + · exact pairLabelsProgram + · refine Fin.cases ?_ (fun k => ?_) k + · exact realLabelsProgram + · refine Fin.cases ?_ (fun k => ?_) k + · exact (Procedure.listAppend labelCode (0,0)).comp + (realLabelsProgram.pair (singletonProgram (fun x : BlockInput => (x.1,3)) + (mediatorProgram.pair (Procedure.constant blockCode Nat.bits 3)))) + · refine Fin.cases ?_ (fun k => ?_) k + · exact (Procedure.listAppend labelCode (0,0)).comp + (((takeProgram 1).comp pairLabelsProgram).pair + (singletonProgram _ thirdMediatorProgram)) + · refine Fin.cases ?_ (fun k => Fin.elim0 k) k + exact (Procedure.listAppend labelCode (0,0)).comp + (((dropProgram 1).comp pairLabelsProgram).pair + (singletonProgram _ thirdMediatorProgram)) + +noncomputable opaque zerosProgram : Procedure labelsCode labelsCode zeros := + Procedure.listMap (0,0) (0,0) ((Procedure.first Nat.bits Nat.bits).pair + (Procedure.constant labelCode Nat.bits 0)) + +private def yyLookup (xs : List Letter) : List Letter × List Letter := + if xs.length=2 ∧ ((xs.drop 0).headD (0,0)).2=2 then + ([(((xs.drop 0).headD (0,0)).1,1),(((xs.drop 1).headD (0,0)).1,3)], + [(((xs.drop 0).headD (0,0)).1,3),(((xs.drop 1).headD (0,0)).1,1)]) + else (xs,zeros xs) +private theorem yyLookup_eq (xs : List Letter) : yyLookup xs=yyFactors xs := by + cases xs with + | nil => rfl + | cons a xs => + cases xs with + | nil => simp [yyLookup,yyFactors] + | cons b xs => + cases xs with + | nil => simp [yyLookup,yyFactors] + | cons c xs => simp [yyLookup,yyFactors,List.length_cons] + +private noncomputable def relabelProgram (k a : ℕ) : Procedure labelsCode labelCode + (fun xs => (((xs.drop k).headD (0,0)).1,a)) := + ((Procedure.first Nat.bits Nat.bits).comp (entryProgram k)).pair + (Procedure.constant labelsCode Nat.bits a) +private noncomputable def crossedProgram (a b : ℕ) : Procedure labelsCode labelsCode + (fun xs => [(((xs.drop 0).headD (0,0)).1,a),(((xs.drop 1).headD (0,0)).1,b)]) := + (Procedure.listCons labelCode).comp ((relabelProgram 0 a).pair + (singletonProgram _ (relabelProgram 1 b))) +noncomputable opaque yyFactorsProgram : Procedure labelsCode (prodCode labelsCode labelsCode) + yyFactors := by + let p := Procedure.conditional (Procedure.boolAnd.comp + ((lengthTest 2).pair (labelTest 0 2))) + ((crossedProgram 1 3).pair (crossedProgram 3 1)) + ((Procedure.identity labelsCode).pair zerosProgram) + exact p.congrFun (by + intro xs + simpa only [yyLookup,Function.comp_apply,id_eq,Bool.and_eq_true,decide_eq_true_eq] + using yyLookup_eq xs) + +noncomputable opaque yyBlockProgram (k : Fin 4) : + Procedure blockCode labelsCode (fun x => yyBlock x.1 x.2 k) := by + let med := singletonProgram (fun x : BlockInput => (x.1,1)) + (mediatorProgram.pair (Procedure.constant blockCode Nat.bits 1)) + refine Fin.cases ?_ (fun k => ?_) k + · exact Procedure.constant blockCode labelsCode [] + · refine Fin.cases ?_ (fun k => ?_) k + · exact singletonProgram (fun x : BlockInput => (x.1,3)) + (mediatorProgram.pair (Procedure.constant blockCode Nat.bits 3)) + · refine Fin.cases ?_ (fun k => ?_) k + · exact (Procedure.listAppend labelCode (0,0)).comp + ((((Procedure.first labelsCode labelsCode).comp yyFactorsProgram).comp labelsProgram).pair med) + · refine Fin.cases ?_ (fun k => Fin.elim0 k) k + exact (Procedure.listAppend labelCode (0,0)).comp + ((((Procedure.second labelsCode labelsCode).comp yyFactorsProgram).comp labelsProgram).pair med) + +noncomputable opaque privateBlockProgram (k : Fin 4) : + Procedure blockCode labelsCode (fun x => privateBlock x.1 x.2 k) := by + let med := singletonProgram (fun x : BlockInput => (x.1,1)) + (mediatorProgram.pair (Procedure.constant blockCode Nat.bits 1)) + refine Fin.cases ?_ (fun k => ?_) k + · exact Procedure.constant blockCode labelsCode [] + · refine Fin.cases ?_ (fun k => ?_) k + · exact singletonProgram (fun x : BlockInput => (x.1,3)) + (mediatorProgram.pair (Procedure.constant blockCode Nat.bits 3)) + · refine Fin.cases ?_ (fun k => ?_) k + · exact (Procedure.listAppend labelCode (0,0)).comp ((prefixProgram 1).pair med) + · refine Fin.cases ?_ (fun k => Fin.elim0 k) k + exact (Procedure.listAppend labelCode (0,0)).comp ((suffixProgram 1).pair med) + +end ContinuumCoulomb.QuantumOrderedLabelData + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelCompile.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelCompile.lean new file mode 100644 index 0000000000000000000000000000000000000000..caebb5add424145b3441e34e86bab1cb778672a9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelCompile.lean @@ -0,0 +1,99 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelPacking +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedRawPackingProgram + +namespace OAI + +/-! The literal six-local sparse-word compiler followed by the rational +four-spin compiler. Its only input is a precision, a unary qubit count, +and the ordered rational sparse-word list. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedLabelCompile +open ExactQuantumFactoring.BitStackProgram QuantumOrderedLabelFamily +open QuantumOrderedLabelTable +open scoped Classical + +abbrev Input := QuantumOrderedLabelFamily.Input + +def qubitCount (x : Input) : ℕ := 4*(QuantumOrderedLabelPipeline.output x).1 + +def classify (xs : List Entry) : List QuantumRawExchange.Raw := + xs.map QuantumOrderedRawPacking.value + +def labelEntries (x : Input) : List Entry := (QuantumOrderedLabelPipeline.output x).2 + +def rawEntries : Input → List QuantumRawExchange.Raw := classify ∘ labelEntries + +def outputCount : Input → ℕ := Prod.fst ∘ QuantumOrderedLabelPipeline.output + +def rawInput (x : Input) : QuantumRawExchange.ScheduleInput := + (outputCount x,x.1,rawEntries x) + +def output : Input → List MediatorListProgram.Bond × ℚ := + QuantumRawExchange.compile ∘ rawInput + +noncomputable opaque classifyProgram : Procedure (listCode entryCode) + (listCode QuantumRawExchange.rawCode) classify := by + let p := Procedure.listMap ([],0) QuantumRawExchange.zeroRaw QuantumOrderedRawPacking.program + exact p.congrEncoding (by intro xs; rfl) (by intro ys; rfl) + +noncomputable opaque labelEntriesProgram : Procedure inputCode (listCode entryCode) + labelEntries := + (Procedure.second unaryCode (listCode entryCode)).comp + QuantumOrderedLabelPipeline.outputProgram + +noncomputable opaque rawEntriesProgram : Procedure inputCode + (listCode QuantumRawExchange.rawCode) rawEntries := + Procedure.comp (f := labelEntries) (g := classify) classifyProgram labelEntriesProgram + +noncomputable opaque outputCountProgram : Procedure inputCode unaryCode outputCount := + (Procedure.first unaryCode (listCode entryCode)).comp QuantumOrderedLabelPipeline.outputProgram + +noncomputable opaque outputProgram : Procedure inputCode + (prodCode (listCode MediatorListProgram.bondCode) ratCode) output := by + let input : Procedure inputCode QuantumRawExchange.scheduleCode rawInput := + outputCountProgram.pair + ((Procedure.unaryToBits.comp precisionProgram).pair rawEntriesProgram) + exact QuantumRawExchange.compileProgram.comp input + +noncomputable def certificate : Turing.TM2ComputableInPolyTime inputCode + (prodCode (listCode MediatorListProgram.bondCode) ratCode) output := outputProgram.toTM2 + +variable {ι κ : Type} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] +variable {m n : ℕ} + +def finalSites (xs : κ → List ι) (w : κ → ι → Fin 4) := + QuantumOrderedPrivate.outputSites (QuantumOrderedXZ.sites xs w) + +def finalWord (xs : κ → List ι) (w : κ → ι → Fin 4) := + QuantumOrderedPrivate.outputWord (QuantumOrderedXZ.sites xs w) (QuantumOrderedXZ.word xs w) + +def finalCoefficient (J : κ → ℚ) (N : ℕ) := + QuantumOrderedPrivate.outputCoefficient (QuantumOrderedXZ.coefficient J N) N + +theorem output_table (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) + (hlen : ∀ a, (xs a).length ≤ 6) (hx : ∀ a, (xs a).Nodup) (N : ℕ) : + output (N,n,table e (index q) xs w J) = + QuantumOrderedRawBlock.output N + (numberedSites (qubits6 q e) (terms6 e) (finalSites xs w)) + (numberedWord (qubits6 q e) (terms6 e) (finalWord xs w)) + (fun i => finalCoefficient J N (terms6 e i)) := by + unfold output rawInput outputCount rawEntries labelEntries classify + simp only [Function.comp_apply] + simp only [QuantumOrderedLabelTable.output_table q e xs w J hlen hx N] + rw [packed_table] + rfl + +omit [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] in +theorem qubitCount_table (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) (N : ℕ) : + qubitCount (N,n,table e (index q) xs w J)=4*(n+3717*m) := by + rw [qubitCount,QuantumOrderedLabelPipeline.output_qubits] + simp only [table,List.length_ofFn] + +end ContinuumCoulomb.QuantumOrderedLabelCompile + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelCorrectness.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelCorrectness.lean new file mode 100644 index 0000000000000000000000000000000000000000..f50daeb0efc470a6dbe1c1332200a7b1b73a4a6c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelCorrectness.lean @@ -0,0 +1,89 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelTable +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelPipeline + +namespace OAI + +/-! Each literal list stage is exactly the corresponding ordered Pauli +construction, with explicit finite product and sum enumerations. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedLabelTable +open QuantumOrderedLabelData QuantumOrderedLabelFamily +open scoped Classical + +variable {ι κ : Type} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] +variable {m n d : ℕ} + +omit [Fintype ι] [DecidableEq ι] [DecidableEq κ] in +theorem value_table (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) (N : ℕ) + (f : ℕ → List Letter → Fin d → List Letter) + (g : ℚ → ℚ → Fin d → ℚ) + (ys : κ × Fin d → List (ι ⊕ κ)) (v : κ × Fin d → ι ⊕ κ → Fin 4) + (h : ∀ p, tag (Sum.elim (index q) (fun a => n+(e.symm a).val)) (ys p) (v p) = + f (n+(e.symm p.1).val) (tag (index q) (xs p.1) (w p.1)) p.2) : + value d f g (N,n,table e (index q) xs w J) = + (n+m,table (nextTerm e d) (index (nextQubit q e)) ys v + (fun p => g (QuantumOrderedSubdivision.scale J N) (J p.1) p.2)) := by + apply Prod.ext + · simp only [value,table,List.length_ofFn] + · rw [show (value d f g (N,n,table e (index q) xs w J)).2 = + family d f g (N,n,table e (index q) xs w J) from rfl, + family_table] + unfold table + apply congrArg List.ofFn + funext i + dsimp only + rw [nextQubit_index,h] + +theorem subdivision_table (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) + (hx : ∀ a, (xs a).Nodup) (N cut : ℕ) : + QuantumOrderedLabelPipeline.subdivisionStep cut (N,n,table e (index q) xs w J) = + (N,n+m,table (nextTerm e 4) (index (nextQubit q e)) + (QuantumOrderedSubdivision.outputSites xs cut) + (QuantumOrderedSubdivision.outputWord xs cut w) + (QuantumOrderedSubdivision.outputCoefficient J N)) := by + apply congrArg (Prod.mk N) + exact value_table q e xs w J N _ _ _ _ + (subdivision_tag (index q) (fun a => n+(e.symm a).val) xs w hx cut) + +theorem third_table (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) + (hlen : ∀ a, (xs a).length ≤ 3) (hx : ∀ a, (xs a).Nodup) (N : ℕ) : + QuantumOrderedLabelPipeline.thirdStep (N,n,table e (index q) xs w J) = + (N,n+m,table (nextTerm e 7) (index (nextQubit q e)) + (QuantumOrderedThird.outputSites xs w) (QuantumOrderedThird.outputWord xs w) + (QuantumOrderedThird.outputCoefficient J N)) := by + apply congrArg (Prod.mk N) + exact value_table q e xs w J N _ _ _ _ + (thirdBlock_tag (index q) (fun a => n+(e.symm a).val) xs w hlen hx) + +omit [Fintype ι] in +theorem yy_table (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) + (hx : ∀ a, (xs a).Nodup) (N : ℕ) : + QuantumOrderedLabelPipeline.yyStep (N,n,table e (index q) xs w J) = + (N,n+m,table (nextTerm e 4) (index (nextQubit q e)) + (QuantumOrderedYY.outputSites xs) (QuantumOrderedYY.outputWord xs w) + (QuantumOrderedYY.outputCoefficient J N)) := by + apply congrArg (Prod.mk N) + exact value_table q e xs w J N _ _ _ _ + (yyBlock_tag (index q) (fun a => n+(e.symm a).val) xs w hx) + +omit [Fintype ι] in +theorem private_table (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) (N : ℕ) : + QuantumOrderedLabelPipeline.privateStep (N,n,table e (index q) xs w J) = + (N,n+m,table (nextTerm e 4) (index (nextQubit q e)) + (QuantumOrderedPrivate.outputSites xs) (QuantumOrderedPrivate.outputWord xs w) + (QuantumOrderedPrivate.outputCoefficient J N)) := by + apply congrArg (Prod.mk N) + exact value_table q e xs w J N _ _ _ _ + (privateBlock_tag (index q) (fun a => n+(e.symm a).val) xs w) + +end ContinuumCoulomb.QuantumOrderedLabelTable + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelData.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelData.lean new file mode 100644 index 0000000000000000000000000000000000000000..96859272cdc20530c69fb380cd94e99a2072ab3b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelData.lean @@ -0,0 +1,107 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedRawPacking +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedThirdSites +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedYYReduction + +namespace OAI + +/-! Ordered sparse site/letter arrays. Every word carries the already +proved support list; the bounded gadget operations inspect at most six +letters, and retain the original order even for identity letters. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedLabelData +open scoped BigOperators Classical + +abbrev Letter := QuantumOrderedRawPacking.Letter + +def tag {ι : Type} (index : ι → ℕ) (xs : List ι) (w : ι → Fin 4) : List Letter := + xs.map (fun i => (index i,(w i).val)) + +def partition (xs : List Letter) : List Letter × List Letter := + match xs with + | [a,b,c] => if a.2=2 then + if b.2=2 then ([a,b],[c]) else ([a,c],[b]) + else ([b,c],[a]) + | _ => (xs,[]) + +def yCount (xs : List Letter) : ℕ := (xs.filter (fun a => a.2=2)).length + +def axis (xs : List Letter) : ℕ := if Odd (yCount xs) then 2 else 1 + +theorem tag_length {ι : Type} (index : ι → ℕ) (xs : List ι) (w : ι → Fin 4) : + (tag index xs w).length=xs.length := List.length_map _ + +theorem tag_take {ι : Type} (index : ι → ℕ) (xs : List ι) (w : ι → Fin 4) (d : ℕ) : + tag index (xs.take d) w = (tag index xs w).take d := by + simp only [tag,List.map_take] + +theorem tag_drop {ι : Type} (index : ι → ℕ) (xs : List ι) (w : ι → Fin 4) (d : ℕ) : + tag index (xs.drop d) w = (tag index xs w).drop d := by + simp only [tag,List.map_drop] + +theorem partition_tag {ι : Type} (index : ι → ℕ) (xs : List ι) (w : ι → Fin 4) : + partition (tag index xs w) = + (tag index (QuantumOrderedTriple.partition xs w).1 w, + tag index (QuantumOrderedTriple.partition xs w).2 w) := by + cases xs with + | nil => rfl + | cons a xs => + cases xs with + | nil => rfl + | cons b xs => + cases xs with + | nil => rfl + | cons c xs => + cases xs with + | cons d xs => rfl + | nil => + have ha : (w a).val=2 ↔ w a=2 := by + constructor + · intro h; exact Fin.ext h + · intro h; exact congrArg Fin.val h + have hb : (w b).val=2 ↔ w b=2 := by + constructor + · intro h; exact Fin.ext h + · intro h; exact congrArg Fin.val h + simp only [tag,List.map_cons,List.map_nil,partition,ha,hb, + QuantumOrderedTriple.partition] + split_ifs <;> rfl + +variable {ι : Type} [Fintype ι] [DecidableEq ι] + +theorem yCount_tag (index : ι → ℕ) (xs : List ι) (w : ι → Fin 4) + (hx : xs.Nodup) (hw : qmaPauliSupport w ⊆ xs.toFinset) : + yCount (tag index xs w)=qmaPauliYCount w := by + have hfilter : (xs.filter (fun i => w i=2)).toFinset = + Finset.univ.filter (fun i => w i=2) := by + ext i + simp only [List.mem_toFinset,List.mem_filter,Finset.mem_filter, + Finset.mem_univ,true_and,decide_eq_true_eq] + constructor + · exact fun h => h.2 + · intro h + exact ⟨List.mem_toFinset.mp (hw (by simp [qmaPauliSupport,h])),h⟩ + have hcount := List.toFinset_card_of_nodup (hx.filter (fun i => w i=2)) + rw [hfilter] at hcount + unfold yCount tag + rw [List.filter_map] + have hv : (fun i : ι => decide ((w i).val=2)) = (fun i => decide (w i=2)) := by + funext i + congr 1 + exact propext ⟨fun h => Fin.ext h,fun h => congrArg Fin.val h⟩ + simp only [Function.comp_def,hv,List.length_map] + exact hcount.symm + +omit [Fintype ι] in +theorem tag_restrict (index : ι → ℕ) (xs : List ι) (w : ι → Fin 4) + (ys : List ι) (hys : ∀ i ∈ xs, i ∈ ys) : + tag index xs (qmaPauliRestrict ys.toFinset w)=tag index xs w := by + apply List.map_congr_left + intro i hi + simp only [qmaPauliRestrict,List.mem_toFinset.mpr (hys i hi),ite_true] + +end ContinuumCoulomb.QuantumOrderedLabelData + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelEnergy.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..9fbdebcebc2bae0e30e56296a00dd822f30c4c4f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelEnergy.lean @@ -0,0 +1,84 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelCompile +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedXZEnergy + +namespace OAI + +/-! Full-space energy guarantee for the emitted raw exchange list, with +the five early reductions, private-pair subdivision, and four-spin error +all accounted for. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedLabelCompile +open QuantumOrderedLabelTable +open scoped Classical + +def outputEnergy (x : Input) : ℝ := + MediatorGraph.normalizedBottom (QuantumRawExchange.rawMatrix (qubitCount x) (output x)) + +variable {ι κ : Type} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] +variable {m n : ℕ} + +def finalEnergy (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) (N : ℕ) : ℝ := + MediatorGraph.normalizedBottom (qmaPauliFamily (finalWord xs w) + (fun p => (finalCoefficient J N p:ℝ))) + +theorem compiled_final_error (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) + (hlen : ∀ a, (xs a).length ≤ 6) (hx : ∀ a, (xs a).Nodup) + (hcover : ∀ a, qmaPauliSupport (w a) ⊆ (xs a).toFinset) + (he : ∀ a, Even (qmaPauliYCount (w a))) (N : ℕ) (hN : 0 < N) : + |outputEnergy (N,n,table e (index q) xs w J)-finalEnergy xs w J N| ≤ 2/(N:ℝ) := by + let qf := qubits6 q e + let ef := terms6 e + have hlenF : ∀ p, (finalSites xs w p).length ≤ 2 := + QuantumOrderedPrivate.outputSites_length _ (QuantumOrderedXZ.sites_length xs w hlen) + have hxF : ∀ p, (finalSites xs w p).Nodup := + QuantumOrderedPrivate.outputSites_nodup _ (QuantumOrderedXZ.sites_nodup xs w hlen hx) + have hsF : ∀ p, qmaPauliSupport (finalWord xs w p) ⊆ (finalSites xs w p).toFinset := + QuantumOrderedPrivate.outputSites_cover _ _ + have hyF : ∀ p i, finalWord xs w p i ≠ 2 := + QuantumOrderedPrivate.output_noY _ _ (QuantumOrderedXZ.noY xs w hlen hx hcover he) + have hpF : ∀ p r, (qmaPauliSupport (finalWord xs w p)).card=2 → + qmaPauliSupport (finalWord xs w p)=qmaPauliSupport (finalWord xs w r) → p=r := + QuantumOrderedPrivate.output_private _ _ (QuantumOrderedXZ.sites_nodup xs w hlen hx) + have hr := QuantumOrderedRawBlock.output_accuracy N hN + (numberedSites qf ef (finalSites xs w)) (numberedWord qf ef (finalWord xs w)) + (fun i => finalCoefficient J N (ef i)) + (fun i => (numbered_sites_length qf ef _ i).trans_le (hlenF (ef i))) + (numbered_sites_nodup qf ef _ hxF) (numbered_cover qf ef _ _ hsF) + (fun i j => hyF (ef i) (qf j)) (numbered_private qf ef _ hpF) + have hn : qubitCount (N,n,table e (index q) xs w J)=finalCount n m*4 := by + rw [qubitCount_table,finalCount_eq] + omega + unfold outputEnergy + rw [hn,output_table q e xs w J hlen hx N] + unfold finalEnergy + rw [← numbered_energy qf ef (finalWord xs w) (fun p => (finalCoefficient J N p:ℝ))] + exact hr + +theorem final_xz_error (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) + (hlen : ∀ a, (xs a).length ≤ 6) (hx : ∀ a, (xs a).Nodup) + (N : ℕ) (hN : 0 < N) : + |finalEnergy xs w J N-QuantumOrderedXZ.energy xs w J N| ≤ 1/(N:ℝ) := + QuantumOrderedPrivate.output_accuracy _ _ _ (QuantumOrderedXZ.sites_nodup xs w hlen hx) + (QuantumOrderedXZ.sites_cover xs w) N (by omega) + +theorem output_accuracy (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) + (hlen : ∀ a, (xs a).length ≤ 6) (hx : ∀ a, (xs a).Nodup) + (hcover : ∀ a, qmaPauliSupport (w a) ⊆ (xs a).toFinset) + (he : ∀ a, Even (qmaPauliYCount (w a))) (N : ℕ) (hN : 0 < N) : + |outputEnergy (N,n,table e (index q) xs w J)- + MediatorGraph.normalizedBottom (qmaPauliFamily w (fun a => (J a:ℝ)))| ≤ 8/(N:ℝ) := by + have h₁ := compiled_final_error q e xs w J hlen hx hcover he N hN + have h₂ := final_xz_error xs w J hlen hx N hN + have h₃ := QuantumOrderedXZ.accuracy xs w J hlen hx hcover he N (by omega) + exact (abs_sub_le _ (finalEnergy xs w J N) _).trans + ((add_le_add h₁ ((abs_sub_le _ (QuantumOrderedXZ.energy xs w J N) _).trans + (add_le_add h₂ h₃))).trans_eq (by ring)) + +end ContinuumCoulomb.QuantumOrderedLabelCompile + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelFamily.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..44b8c71db796bc96e6ec3854dc30ac92586689be --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelFamily.lean @@ -0,0 +1,106 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedWeightProgram + +namespace OAI + +/-! A literal indexed list stage, shared by the six fixed local reductions. +New mediator indices are the old qubit count plus the input term index. +Unary counts bound the output size; rational coefficients stay binary. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedLabelFamily +open ExactQuantumFactoring.BitStackProgram +open QuantumOrderedLabelData + +abbrev Entry := List Letter × ℚ +abbrev State := ℕ × List Entry +abbrev Input := ℕ × State +abbrev BlockInput := (ℕ × ℚ) × Entry + +def entryCode : Entry → List Bool := prodCode labelsCode ratCode +def stateCode : State → List Bool := prodCode unaryCode (listCode entryCode) +def inputCode : Input → List Bool := prodCode unaryCode stateCode +def blockCode : BlockInput → List Bool := prodCode (prodCode Nat.bits ratCode) entryCode + +def weights (x : Input) : QuantumOrderedWeightProgram.Input := (x.1,x.2.2.map Prod.snd) +def radius (x : Input) : ℚ := QuantumOrderedWeightProgram.scale (weights x) +def indexed (x : ℕ × Input) : BlockInput := + ((x.2.2.1+x.1,radius x.2),(x.2.2.2.drop x.1).headD ([],0)) + +def block (d : ℕ) (f : ℕ → List Letter → Fin d → List Letter) + (g : ℚ → ℚ → Fin d → ℚ) (x : BlockInput) : List Entry := + List.ofFn (fun k => (f x.1.1 x.2.1 k,g x.1.2 x.2.2 k)) + +def family (d : ℕ) (f : ℕ → List Letter → Fin d → List Letter) + (g : ℚ → ℚ → Fin d → ℚ) (x : Input) : List Entry := + ((List.range x.2.2.length).map (fun i => block d f g (indexed (i,x)))).flatten + +def value (d : ℕ) (f : ℕ → List Letter → Fin d → List Letter) + (g : ℚ → ℚ → Fin d → ℚ) (x : Input) : State := + (x.2.1+x.2.2.length,family d f g x) + +noncomputable opaque stateProgram : Procedure inputCode stateCode Prod.snd := Procedure.second _ _ +noncomputable opaque precisionProgram : Procedure inputCode unaryCode Prod.fst := Procedure.first _ _ +noncomputable opaque countProgram : Procedure inputCode unaryCode (fun x => x.2.1) := + (Procedure.first _ _).comp stateProgram +noncomputable opaque entriesProgram : Procedure inputCode (listCode entryCode) (fun x => x.2.2) := + (Procedure.second _ _).comp stateProgram +noncomputable opaque lengthProgram : Procedure inputCode unaryCode (fun x => x.2.2.length) := + (ExactQuantumFactoring.NativeAIG.Emission.listUnaryLength entryCode ([],0)).comp entriesProgram +noncomputable opaque weightsProgram : Procedure inputCode QuantumOrderedWeightProgram.inputCode weights := + precisionProgram.pair ((Procedure.listMap ([],0) 0 + (Procedure.second labelsCode ratCode)).comp entriesProgram) +noncomputable opaque radiusProgram : Procedure inputCode ratCode radius := + QuantumOrderedWeightProgram.scaleProgram.comp weightsProgram + +noncomputable opaque indexedProgram : Procedure (prodCode unaryCode inputCode) blockCode indexed := by + let i := Procedure.first unaryCode inputCode + let x := Procedure.second unaryCode inputCode + let n := (Procedure.unaryToBits.comp countProgram).comp x + let j := Procedure.unaryToBits.comp i + let selected := (Procedure.listGet entryCode ([],0)).comp (j.pair (entriesProgram.comp x)) + exact ((Procedure.binaryAdd.comp (n.pair j)).pair (radiusProgram.comp x)).pair selected + +noncomputable def blockProgram (d : ℕ) + (f : ℕ → List Letter → Fin d → List Letter) (g : ℚ → ℚ → Fin d → ℚ) + (pf : ∀ k, Procedure QuantumOrderedLabelData.blockCode labelsCode (fun x => f x.1 x.2 k)) + (pg : ∀ k, Procedure QuantumOrderedWeightProgram.pairCode ratCode (fun x => g x.1 x.2 k)) : + Procedure blockCode (listCode entryCode) (block d f g) := by + let params := Procedure.first (prodCode Nat.bits ratCode) entryCode + let entry := Procedure.second (prodCode Nat.bits ratCode) entryCode + let mediator := (Procedure.first Nat.bits ratCode).comp params + let scale := (Procedure.second Nat.bits ratCode).comp params + let labels := (Procedure.first labelsCode ratCode).comp entry + let coefficient := (Procedure.second labelsCode ratCode).comp entry + exact QuantumRawExchange.fixedListProgram blockCode entryCode d _ + (fun k => ((pf k).comp (mediator.pair labels)).pair + ((pg k).comp (scale.pair coefficient))) + +noncomputable def familyProgram (d : ℕ) + (f : ℕ → List Letter → Fin d → List Letter) (g : ℚ → ℚ → Fin d → ℚ) + (p : Procedure blockCode (listCode entryCode) (block d f g)) : + Procedure inputCode (listCode entryCode) (family d f g) := by + let tab := Procedure.tabulate (f := fun x i => block d f g (indexed (i,x))) [] + (p.comp indexedProgram) + exact (QuantumRawExchange.flattenProgram entryCode ([],0)).comp + (tab.comp (lengthProgram.pair (Procedure.identity inputCode))) + +noncomputable def valueProgram (d : ℕ) + (f : ℕ → List Letter → Fin d → List Letter) (g : ℚ → ℚ → Fin d → ℚ) + (p : Procedure blockCode (listCode entryCode) (block d f g)) : + Procedure inputCode stateCode (value d f g) := + (Procedure.unaryAdd.comp (countProgram.pair lengthProgram)).pair (familyProgram d f g p) + +theorem family_length (d : ℕ) + (f : ℕ → List Letter → Fin d → List Letter) (g : ℚ → ℚ → Fin d → ℚ) + (x : Input) : (family d f g x).length=x.2.2.length*d := by + unfold family + rw [List.length_flatten,List.map_map] + simp only [Function.comp_def,block,List.length_ofFn] + simp + +end ContinuumCoulomb.QuantumOrderedLabelFamily + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelOutput.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelOutput.lean new file mode 100644 index 0000000000000000000000000000000000000000..9f60ea9e53049f134220e2125a16c467cf63430f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelOutput.lean @@ -0,0 +1,93 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelCorrectness + +namespace OAI + +/-! The complete literal sparse-label compiler equals the actual ordered +six-to-four-to-three-to-two-to-XZ construction and private-pair stage. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedLabelTable +open scoped Classical + +variable {ι κ : Type} {m n : ℕ} + +def terms1 (e : Fin m ≃ κ) := nextTerm e 4 +def terms2 (e : Fin m ≃ κ) := nextTerm (terms1 e) 4 +def terms3 (e : Fin m ≃ κ) := nextTerm (terms2 e) 7 +def terms4 (e : Fin m ≃ κ) := nextTerm (terms3 e) 4 +def terms5 (e : Fin m ≃ κ) := nextTerm (terms4 e) 7 +def terms6 (e : Fin m ≃ κ) := nextTerm (terms5 e) 4 + +def qubits1 (q : Fin n ≃ ι) (e : Fin m ≃ κ) := nextQubit q e +def qubits2 (q : Fin n ≃ ι) (e : Fin m ≃ κ) := nextQubit (qubits1 q e) (terms1 e) +def qubits3 (q : Fin n ≃ ι) (e : Fin m ≃ κ) := nextQubit (qubits2 q e) (terms2 e) +def qubits4 (q : Fin n ≃ ι) (e : Fin m ≃ κ) := nextQubit (qubits3 q e) (terms3 e) +def qubits5 (q : Fin n ≃ ι) (e : Fin m ≃ κ) := nextQubit (qubits4 q e) (terms4 e) +def qubits6 (q : Fin n ≃ ι) (e : Fin m ≃ κ) := nextQubit (qubits5 q e) (terms5 e) + +def finalCount (n m : ℕ) : ℕ := + n+m+m*4+m*4*4+m*4*4*7+m*4*4*7*4+m*4*4*7*4*7 + +theorem finalCount_eq (n m : ℕ) : finalCount n m=n+3717*m := by + unfold finalCount + omega + +variable [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +theorem output_table (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) + (hlen : ∀ a, (xs a).length ≤ 6) (hx : ∀ a, (xs a).Nodup) (N : ℕ) : + QuantumOrderedLabelPipeline.output (N,n,table e (index q) xs w J) = + (finalCount n m,table (terms6 e) (index (qubits6 q e)) + (QuantumOrderedPrivate.outputSites (QuantumOrderedXZ.sites xs w)) + (QuantumOrderedPrivate.outputWord (QuantumOrderedXZ.sites xs w) + (QuantumOrderedXZ.word xs w)) + (QuantumOrderedPrivate.outputCoefficient (QuantumOrderedXZ.coefficient J N) N)) := by + have h1 := subdivision_table q e xs w J hx N 3 + have h2 := subdivision_table (qubits1 q e) (terms1 e) + (QuantumOrderedSubdivision.outputSites xs 3) + (QuantumOrderedSubdivision.outputWord xs 3 w) + (QuantumOrderedSubdivision.outputCoefficient J N) + (QuantumOrderedSubdivision.outputSites_nodup xs 3 hx) N 2 + have h3 := third_table (qubits2 q e) (terms2 e) + (QuantumOrderedXZ.threeSites xs) (QuantumOrderedXZ.threeWord xs w) + (QuantumOrderedXZ.threeCoefficient J N) + (QuantumOrderedXZ.threeSites_length xs hlen) (QuantumOrderedXZ.threeSites_nodup xs hx) N + have h4 := yy_table (qubits3 q e) (terms3 e) + (QuantumOrderedXZ.twoSites xs w) (QuantumOrderedXZ.twoWord xs w) + (QuantumOrderedXZ.twoCoefficient J N) + (QuantumOrderedXZ.twoSites_nodup xs w hlen hx) N + have h5 := third_table (qubits4 q e) (terms4 e) + (QuantumOrderedXZ.xzThreeSites xs w) (QuantumOrderedXZ.xzThreeWord xs w) + (QuantumOrderedXZ.xzThreeCoefficient J N) + (QuantumOrderedXZ.xzThreeSites_length xs w hlen) + (QuantumOrderedXZ.xzThreeSites_nodup xs w hlen hx) N + have h6 := private_table (qubits5 q e) (terms5 e) + (QuantumOrderedXZ.sites xs w) (QuantumOrderedXZ.word xs w) + (QuantumOrderedXZ.coefficient J N) N + change _ = (N,n+m,table (terms1 e) (index (qubits1 q e)) + (QuantumOrderedSubdivision.outputSites xs 3) + (QuantumOrderedSubdivision.outputWord xs 3 w) + (QuantumOrderedSubdivision.outputCoefficient J N)) at h1 + change _ = (N,n+m+m*4,table (terms2 e) (index (qubits2 q e)) + (QuantumOrderedXZ.threeSites xs) (QuantumOrderedXZ.threeWord xs w) + (QuantumOrderedXZ.threeCoefficient J N)) at h2 + change _ = (N,n+m+m*4+m*4*4,table (terms3 e) (index (qubits3 q e)) + (QuantumOrderedXZ.twoSites xs w) (QuantumOrderedXZ.twoWord xs w) + (QuantumOrderedXZ.twoCoefficient J N)) at h3 + change _ = (N,n+m+m*4+m*4*4+m*4*4*7,table (terms4 e) (index (qubits4 q e)) + (QuantumOrderedXZ.xzThreeSites xs w) (QuantumOrderedXZ.xzThreeWord xs w) + (QuantumOrderedXZ.xzThreeCoefficient J N)) at h4 + change _ = (N,n+m+m*4+m*4*4+m*4*4*7+m*4*4*7*4, + table (terms5 e) (index (qubits5 q e)) + (QuantumOrderedXZ.sites xs w) (QuantumOrderedXZ.word xs w) + (QuantumOrderedXZ.coefficient J N)) at h5 + unfold QuantumOrderedLabelPipeline.output + rw [h1,h2,h3,h4,h5,h6] + rfl + +end ContinuumCoulomb.QuantumOrderedLabelTable + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelPacking.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelPacking.lean new file mode 100644 index 0000000000000000000000000000000000000000..02dba9667fe8d9cb91b786a319cf5bafc05db201 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelPacking.lean @@ -0,0 +1,106 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelOutput +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedRawBlock +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialReindex + +namespace OAI + +/-! Conversion of the actual ordered sparse labels into the literal raw +X/Z instructions, including the explicit finite relabeling of their energy. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedLabelTable +open scoped BigOperators Classical + +variable {ι κ : Type} {n m : ℕ} + +def numberedSites (q : Fin n ≃ ι) (e : Fin m ≃ κ) (xs : κ → List ι) : + Fin m → List (Fin n) := fun a => (xs (e a)).map q.symm + +def numberedWord (q : Fin n ≃ ι) (e : Fin m ≃ κ) (w : κ → ι → Fin 4) : + Fin m → Fin n → Fin 4 := fun a i => w (e a) (q i) + +private theorem tag_numbered (q : Fin n ≃ ι) (xs : List ι) (w : ι → Fin 4) : + QuantumOrderedLabelData.tag (index q) xs w = + ((xs.map q.symm).map (fun i => (i.val,(w (q i)).val))) := by + simp only [QuantumOrderedLabelData.tag,List.map_map,Function.comp_def, + Equiv.apply_symm_apply,index] + +theorem packed_table (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) : + (table e (index q) xs w J).map QuantumOrderedRawPacking.value = + QuantumRawExchange.packed (QuantumOrderedRawBlock.terms + (numberedSites q e xs) (numberedWord q e w)) (fun i => J (e i)) := by + simp only [table,List.map_ofFn,Function.comp_def,QuantumRawExchange.packed] + apply congrArg List.ofFn + funext i + rw [tag_numbered] + exact QuantumOrderedRawPacking.value_pack _ _ _ + +variable [Fintype ι] [DecidableEq ι] [Fintype κ] + +omit [Fintype ι] [DecidableEq ι] [Fintype κ] in +theorem numbered_sites_length (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (xs : κ → List ι) (i : Fin m) : + (numberedSites q e xs i).length=(xs (e i)).length := List.length_map _ + +omit [Fintype ι] [DecidableEq ι] [Fintype κ] in +theorem numbered_sites_nodup (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (xs : κ → List ι) (hx : ∀ a, (xs a).Nodup) (i : Fin m) : + (numberedSites q e xs i).Nodup := (hx (e i)).map q.symm.injective + +omit [DecidableEq ι] [Fintype κ] in +theorem numbered_support (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (w : κ → ι → Fin 4) (i : Fin m) : + qmaPauliSupport (numberedWord q e w i)= + (qmaPauliSupport (w (e i))).map q.symm.toEmbedding := + qmaPauliSupport_relabel q.symm (w (e i)) + +omit [Fintype κ] in +theorem numbered_cover (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (xs : κ → List ι) (w : κ → ι → Fin 4) + (hs : ∀ a, qmaPauliSupport (w a) ⊆ (xs a).toFinset) (i : Fin m) : + qmaPauliSupport (numberedWord q e w i) ⊆ (numberedSites q e xs i).toFinset := by + rw [numbered_support] + intro j hj + obtain ⟨a,ha,rfl⟩ := Finset.mem_map.mp hj + exact List.mem_toFinset.mpr (List.mem_map.mpr + ⟨a,List.mem_toFinset.mp (hs (e i) ha),rfl⟩) + +omit [DecidableEq ι] [Fintype κ] in +theorem numbered_private (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (w : κ → ι → Fin 4) + (hp : ∀ a b, (qmaPauliSupport (w a)).card=2 → + qmaPauliSupport (w a)=qmaPauliSupport (w b) → a=b) + (i j : Fin m) (hi : (qmaPauliSupport (numberedWord q e w i)).card=2) + (hij : qmaPauliSupport (numberedWord q e w i)= + qmaPauliSupport (numberedWord q e w j)) : i=j := by + apply e.injective + apply hp (e i) (e j) + · simpa only [numbered_support,Finset.card_map] using hi + · rw [numbered_support,numbered_support] at hij + exact (Finset.map_injective q.symm.toEmbedding) hij + +theorem numbered_energy (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (w : κ → ι → Fin 4) (J : κ → ℝ) : + MediatorGraph.normalizedBottom (qmaPauliFamily (numberedWord q e w) (fun i => J (e i))) = + MediatorGraph.normalizedBottom (qmaPauliFamily w J) := by + have hw (i : Fin m) : qmaPauliWord (numberedWord q e w i) = + (qmaPauliWord (w (e i))).submatrix + (qmaQubitBasisEquiv q.symm) (qmaQubitBasisEquiv q.symm) := + qmaPauliWord_relabel q.symm (w (e i)) + have hm : qmaPauliFamily (numberedWord q e w) (fun i => J (e i)) = + (qmaPauliFamily w J).submatrix + (qmaQubitBasisEquiv q.symm) (qmaQubitBasisEquiv q.symm) := by + ext s t + simp only [qmaPauliFamily,Matrix.sum_apply,Matrix.smul_apply, + Matrix.submatrix_apply,hw,smul_eq_mul] + exact e.sum_comp (fun a => (J a:ℂ)* + qmaPauliWord (w a) (qmaQubitBasisEquiv q.symm s) (qmaQubitBasisEquiv q.symm t)) + rw [hm] + exact MediatorGraph.normalizedBottom_reindex (qmaQubitBasisEquiv q.symm) _ + +end ContinuumCoulomb.QuantumOrderedLabelTable + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelPipeline.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelPipeline.lean new file mode 100644 index 0000000000000000000000000000000000000000..766dd9c5d86fbf80738dc5bdd2b0d6b4277e180a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelPipeline.lean @@ -0,0 +1,61 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelBlocks +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelFamily + +namespace OAI + +/-! A fixed six-stage literal sparse-word compiler. The final stage assigns +a private mediator to every two-local term before the four-spin encoding. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedLabelPipeline +open ExactQuantumFactoring.BitStackProgram +open QuantumOrderedLabelData QuantumOrderedLabelFamily + +abbrev Input := QuantumOrderedLabelFamily.Input +abbrev State := QuantumOrderedLabelFamily.State + +def fourWeight (r j : ℚ) := QuantumPolarizedSubdivision.weight r j +def sevenWeight (r j : ℚ) := QuantumPolarizedThird.weight r j + +def subdivisionStep (d : ℕ) (x : Input) : Input := + (x.1,value 4 (fun n xs => subdivision n d xs) fourWeight x) +def thirdStep (x : Input) : Input := (x.1,value 7 thirdBlock sevenWeight x) +def yyStep (x : Input) : Input := (x.1,value 4 yyBlock fourWeight x) +def privateStep (x : Input) : Input := (x.1,value 4 privateBlock fourWeight x) +def output (x : Input) : State := + (privateStep (thirdStep (yyStep (thirdStep (subdivisionStep 2 (subdivisionStep 3 x)))))).2 + +noncomputable opaque subdivisionStepProgram (d : ℕ) : Procedure inputCode inputCode + (subdivisionStep d) := + precisionProgram.pair (valueProgram 4 _ fourWeight + (blockProgram 4 _ fourWeight (subdivisionProgram d) QuantumOrderedWeightProgram.fourProgram)) +noncomputable opaque thirdStepProgram : Procedure inputCode inputCode thirdStep := + precisionProgram.pair (valueProgram 7 thirdBlock sevenWeight + (blockProgram 7 thirdBlock sevenWeight thirdBlockProgram QuantumOrderedWeightProgram.sevenProgram)) +noncomputable opaque yyStepProgram : Procedure inputCode inputCode yyStep := + precisionProgram.pair (valueProgram 4 yyBlock fourWeight + (blockProgram 4 yyBlock fourWeight yyBlockProgram QuantumOrderedWeightProgram.fourProgram)) +noncomputable opaque privateStepProgram : Procedure inputCode inputCode privateStep := + precisionProgram.pair (valueProgram 4 privateBlock fourWeight + (blockProgram 4 privateBlock fourWeight privateBlockProgram QuantumOrderedWeightProgram.fourProgram)) +noncomputable opaque outputProgram : Procedure inputCode stateCode output := + (Procedure.second unaryCode stateCode).comp (privateStepProgram.comp + (thirdStepProgram.comp (yyStepProgram.comp (thirdStepProgram.comp + ((subdivisionStepProgram 2).comp (subdivisionStepProgram 3)))))) + +noncomputable def certificate : Turing.TM2ComputableInPolyTime inputCode stateCode output := + outputProgram.toTM2 + +theorem output_length (x : Input) : (output x).2.length=12544*x.2.2.length := by + simp only [output,privateStep,thirdStep,yyStep,subdivisionStep,value,family_length] + omega + +theorem output_qubits (x : Input) : (output x).1=x.2.1+3717*x.2.2.length := by + simp only [output,privateStep,thirdStep,yyStep,subdivisionStep,value,family_length] + omega + +end ContinuumCoulomb.QuantumOrderedLabelPipeline + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..729314e54279a5c01a5b0dcc333cfd862990c261 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelProgram.lean @@ -0,0 +1,117 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelSubdivision +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedRawPackingProgram + +namespace OAI + +/-! Polynomial list programs for the literal support-label operations. +Only constant-length prefixes are split in the early gadget compiler. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedLabelData +open ExactQuantumFactoring.BitStackProgram + +abbrev labelCode := QuantumOrderedRawPacking.letterCode +abbrev labelsCode := listCode labelCode + +noncomputable def takeProgram (d : ℕ) : Procedure labelsCode labelsCode + (fun xs => xs.take d) := by + induction d with + | zero => exact (Procedure.constant labelsCode labelsCode []).congrFun (by intro xs; rfl) + | succ d ih => + let cons := (Procedure.listCons labelCode).comp + ((Procedure.listHead labelCode (0,0)).pair (ih.comp (Procedure.listTail labelCode))) + exact (Procedure.conditional (Procedure.listEmpty labelCode) + (Procedure.constant labelsCode labelsCode []) cons).congrFun (by + intro xs + cases xs <;> rfl) + +noncomputable def dropProgram (d : ℕ) : Procedure labelsCode labelsCode + (fun xs => xs.drop d) := + (Procedure.listDrop labelCode).comp + ((Procedure.constant labelsCode Nat.bits d).pair (Procedure.identity labelsCode)) + +def oddLetters (xs : List Letter) : Bool := + xs.foldr (fun a b => xor (decide (a.2=2)) b) false + +private theorem oddLetters_eq (xs : List Letter) : + oddLetters xs=decide (Odd (yCount xs)) := by + induction xs with + | nil => rfl + | cons a xs ih => + change xor (decide (a.2=2)) (oddLetters xs)=_ + rw [ih] + by_cases ha : a.2=2 + · have hc : yCount (a::xs)=yCount xs+1 := by simp [yCount,ha] + simp only [hc,Nat.odd_add_one,ha,decide_true,Bool.true_xor,decide_not] + · have hc : yCount (a::xs)=yCount xs := by simp [yCount,ha] + rw [hc] + simp [ha] + +private theorem fold_oddLetters (xs : List Letter) (b : Bool) : + xs.foldl (fun b a => xor (decide (a.2=2)) b) b=xor (oddLetters xs) b := by + induction xs generalizing b with + | nil => simp [oddLetters] + | cons a xs ih => + rw [List.foldl_cons,ih] + change xor (oddLetters xs) (xor (decide (a.2=2)) b)= + xor (xor (decide (a.2=2)) (oddLetters xs)) b + cases b <;> cases ha : decide (a.2=2) <;> cases hx : oddLetters xs <;> rfl + +noncomputable opaque oddProgram : Procedure labelsCode Procedure.boolCode + (fun xs => decide (Odd (yCount xs))) := by + let head := Procedure.first labelCode Procedure.boolCode + let letter := (Procedure.second Nat.bits Nat.bits).comp head + let test := Procedure.binaryEq.comp + (letter.pair (Procedure.constant (prodCode labelCode Procedure.boolCode) Nat.bits 2)) + let state := Procedure.second labelCode Procedure.boolCode + let step := Procedure.boolXor.comp (test.pair state) + let fold := Procedure.foldList (0,0) step (Polynomial.C 1) (by + intro xs b i + simp only [Procedure.boolCode,List.length_singleton,Polynomial.eval_C] + exact le_rfl) + exact (fold.comp ((Procedure.identity labelsCode).pair + (Procedure.constant labelsCode Procedure.boolCode false))).congrFun (by + intro xs + simp only [Function.comp_apply,id_eq,fold_oddLetters,Bool.xor_false,oddLetters_eq]) + +noncomputable opaque axisProgram : Procedure labelsCode Nat.bits axis := + (Procedure.conditional oddProgram (Procedure.constant labelsCode Nat.bits 2) + (Procedure.constant labelsCode Nat.bits 1)).congrFun (by + intro xs + simp only [axis,decide_eq_true_eq]) + +abbrev BlockInput := ℕ × List Letter +abbrev blockCode := prodCode Nat.bits labelsCode +noncomputable opaque mediatorProgram : Procedure blockCode Nat.bits Prod.fst := Procedure.first _ _ +noncomputable opaque labelsProgram : Procedure blockCode labelsCode Prod.snd := Procedure.second _ _ +noncomputable opaque prefixProgram (d : ℕ) : Procedure blockCode labelsCode + (fun x => x.2.take d) := (takeProgram d).comp labelsProgram +noncomputable opaque suffixProgram (d : ℕ) : Procedure blockCode labelsCode + (fun x => x.2.drop d) := (dropProgram d).comp labelsProgram +noncomputable opaque mediatorLabelProgram (d : ℕ) : Procedure blockCode labelCode + (fun x => (x.1,axis (x.2.take d))) := + mediatorProgram.pair (axisProgram.comp (prefixProgram d)) +noncomputable def singletonProgram {α : Type} {ea : α → List Bool} + (f : α → Letter) (p : Procedure ea labelCode f) : + Procedure ea labelsCode (fun x => [f x]) := + (Procedure.listCons labelCode).comp (p.pair (Procedure.constant ea labelsCode [])) + +noncomputable opaque subdivisionProgram (d : ℕ) (k : Fin 4) : + Procedure blockCode labelsCode (fun x => subdivision x.1 d x.2 k) := by + refine Fin.cases ?_ (fun k => ?_) k + · exact Procedure.constant blockCode labelsCode [] + · refine Fin.cases ?_ (fun k => ?_) k + · exact singletonProgram (fun x : BlockInput => (x.1,3)) + (mediatorProgram.pair (Procedure.constant blockCode Nat.bits 3)) + · refine Fin.cases ?_ (fun k => ?_) k + · exact (Procedure.listAppend labelCode (0,0)).comp + ((prefixProgram d).pair (singletonProgram _ (mediatorLabelProgram d))) + · refine Fin.cases ?_ (fun k => Fin.elim0 k) k + exact (Procedure.listAppend labelCode (0,0)).comp + ((suffixProgram d).pair (singletonProgram _ (mediatorLabelProgram d))) + +end ContinuumCoulomb.QuantumOrderedLabelData + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelSubdivision.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelSubdivision.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa303aaf0b2cc4546c00ed7a3eea05b2fb88b3f0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelSubdivision.lean @@ -0,0 +1,94 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelData + +namespace OAI + +/-! Literal bounded arrays for polarized subdivision. The exact array +identity below keeps the supplied site order and the matching mediator. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedLabelData +open scoped Classical + +variable {ι κ : Type} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +def subdivision (mediator d : ℕ) (xs : List Letter) : Fin 4 → List Letter := + ![[],[(mediator,3)],xs.take d++[(mediator,axis (xs.take d))], + xs.drop d++[(mediator,axis (xs.take d))]] + +omit [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ] in +theorem tag_lift (index : ι → ℕ) (slot : κ → ℕ) (xs : List ι) + (w : ι → Fin 4) (v : κ → Fin 4) : + tag (Sum.elim index slot) (xs.map Sum.inl) (Sum.elim w v) =tag index xs w := by + simp only [tag,List.map_map,Function.comp_def,Sum.elim_inl] + +omit [Fintype ι] [Fintype κ] [DecidableEq ι] in +theorem tag_appendMediator (index : ι → ℕ) (slot : κ → ℕ) (xs : List ι) + (w : ι → Fin 4) (e : κ) (a : Fin 4) : + tag (Sum.elim index slot) (QuantumOrderedSubdivision.appendMediator xs e) + (Sum.elim w (qmaSinglePauliWord e a)) =tag index xs w++[(slot e,a.val)] := by + simp only [QuantumOrderedSubdivision.appendMediator,tag,List.map_append,List.map_map, + Function.comp_def,Sum.elim_inl,List.map_cons,List.map_nil,Sum.elim_inr, + qmaSinglePauliWord,ite_true] + +omit [Fintype ι] [Fintype κ] [DecidableEq κ] in +theorem first_tag (index : ι → ℕ) (xs : List ι) (w : ι → Fin 4) (d : ℕ) : + tag index (xs.take d) (QuantumOrderedSplit.firstWord xs d w) = + (tag index xs w).take d := by + rw [QuantumOrderedSplit.firstWord,QuantumOrderedSplit.left, + tag_restrict index (xs.take d) w (xs.take d) (fun _ h => h),tag_take] + +omit [Fintype ι] [Fintype κ] [DecidableEq κ] in +theorem second_tag (index : ι → ℕ) (xs : List ι) (w : ι → Fin 4) (d : ℕ) : + tag index (xs.drop d) (QuantumOrderedSplit.secondWord xs d w) = + (tag index xs w).drop d := by + rw [QuantumOrderedSplit.secondWord,QuantumOrderedSplit.right, + tag_restrict index (xs.drop d) w (xs.drop d) (fun _ h => h),tag_drop] + +omit [Fintype κ] [DecidableEq κ] in +theorem first_axis (index : ι → ℕ) (xs : List ι) (w : ι → Fin 4) + (hx : xs.Nodup) (d : ℕ) : + axis ((tag index xs w).take d) = + (QuantumPolarizedSubdivision.axis + (decide (Odd (qmaPauliYCount (QuantumOrderedSplit.firstWord xs d w))))).val := by + have hc := yCount_tag index (xs.take d) (QuantumOrderedSplit.firstWord xs d w) + (hx.sublist (List.take_sublist d xs)) (qmaPauliRestrict_support _ _) + rw [first_tag] at hc + simp only [axis,hc,QuantumPolarizedSubdivision.axis,decide_eq_true_eq] + split_ifs <;> rfl + +omit [Fintype κ] in +theorem subdivision_tag (index : ι → ℕ) (slot : κ → ℕ) + (xs : κ → List ι) (w : κ → ι → Fin 4) + (hx : ∀ e, (xs e).Nodup) (d : ℕ) (p : κ × Fin 4) : + tag (Sum.elim index slot) (QuantumOrderedSubdivision.outputSites xs d p) + (QuantumOrderedSubdivision.outputWord xs d w p) = + subdivision (slot p.1) d (tag index (xs p.1) (w p.1)) p.2 := by + rcases p with ⟨e,k⟩ + fin_cases k + · rfl + · change tag (Sum.elim index slot) [Sum.inr e] + (Sum.elim (fun _ : ι => 0) (qmaSinglePauliWord e 3)) = [(slot e,3)] + simp only [tag,List.map_cons,List.map_nil,Sum.elim_inr,qmaSinglePauliWord,ite_true] + rfl + · change tag (Sum.elim index slot) (QuantumOrderedSubdivision.appendMediator ((xs e).take d) e) + (Sum.elim (QuantumOrderedSplit.firstWord (xs e) d (w e)) + (qmaSinglePauliWord e (QuantumPolarizedSubdivision.axis + (QuantumOrderedSubdivision.phase xs d w e)))) = + (tag index (xs e) (w e)).take d ++ + [(slot e,axis ((tag index (xs e) (w e)).take d))] + rw [tag_appendMediator,first_tag,first_axis index (xs e) (w e) (hx e)] + rfl + · change tag (Sum.elim index slot) (QuantumOrderedSubdivision.appendMediator ((xs e).drop d) e) + (Sum.elim (QuantumOrderedSplit.secondWord (xs e) d (w e)) + (qmaSinglePauliWord e (QuantumPolarizedSubdivision.axis + (QuantumOrderedSubdivision.phase xs d w e)))) = + (tag index (xs e) (w e)).drop d ++ + [(slot e,axis ((tag index (xs e) (w e)).take d))] + rw [tag_appendMediator,second_tag,first_axis index (xs e) (w e) (hx e)] + rfl + +end ContinuumCoulomb.QuantumOrderedLabelData + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelTable.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelTable.lean new file mode 100644 index 0000000000000000000000000000000000000000..04129c98a9fc57af63d648cd3c1e710c06508130 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelTable.lean @@ -0,0 +1,103 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelFamily + +namespace OAI + +/-! Ordered finite tables and their literal product enumeration. These +identities compare the computed lists with the actual finite Pauli family. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedLabelTable +open QuantumOrderedLabelData QuantumOrderedLabelFamily +open scoped BigOperators Classical + +variable {ι κ : Type} {m n d : ℕ} + +def table (e : Fin m ≃ κ) (index : ι → ℕ) (xs : κ → List ι) + (w : κ → ι → Fin 4) (J : κ → ℚ) : List Entry := + List.ofFn (fun i => (tag index (xs (e i)) (w (e i)),J (e i))) + +def nextTerm (e : Fin m ≃ κ) (d : ℕ) : Fin (m*d) ≃ κ × Fin d := + finProdFinEquiv.symm.trans (Equiv.prodCongr e (Equiv.refl _)) + +def index (q : Fin n ≃ ι) (i : ι) : ℕ := (q.symm i).val + +def nextQubit (q : Fin n ≃ ι) (e : Fin m ≃ κ) : Fin (n+m) ≃ ι ⊕ κ := + finSumFinEquiv.symm.trans (Equiv.sumCongr q e) + +theorem nextQubit_index (q : Fin n ≃ ι) (e : Fin m ≃ κ) : + index (nextQubit q e) = Sum.elim (index q) (fun a => n+(e.symm a).val) := by + funext a + cases a <;> simp [index,nextQubit] + +private theorem lookup_ofFn {α : Type} (v : Fin m → α) (fallback : α) (i : Fin m) : + ((List.ofFn v).drop i.val).headD fallback=v i := by + rw [List.drop_eq_getElem_cons (by simpa only [List.length_ofFn] using i.isLt)] + simp only [List.headD_cons,List.getElem_ofFn] + +theorem product_table {α : Type} (v : Fin m × Fin d → α) : + List.ofFn (fun i => v (finProdFinEquiv.symm i)) = + (List.ofFn (fun a => List.ofFn (fun b => v (a,b)))).flatten := by + rw [List.ofFn_mul] + apply congrArg List.flatten + apply congrArg List.ofFn + funext a + apply congrArg List.ofFn + funext b + have h : finProdFinEquiv (a,b) = + (⟨a.val*d+b.val,by nlinarith [a.isLt,b.isLt]⟩ : Fin (m*d)) := by + apply Fin.ext + change b.val+d*a.val=a.val*d+b.val + ac_rfl + rw [← h,Equiv.symm_apply_apply] + +variable [Fintype κ] + +theorem radius_table (e : Fin m ≃ κ) (ix : ι → ℕ) (xs : κ → List ι) + (w : κ → ι → Fin 4) (J : κ → ℚ) (N n : ℕ) : + radius (N,n,table e ix xs w J)=QuantumOrderedSubdivision.scale J N := by + simp only [radius,weights,table,List.map_ofFn,Function.comp_def,List.sum_ofFn, + QuantumOrderedWeightProgram.scale,QuantumOrderedSubdivision.scale, + QuantumOrderedSubdivision.budget] + rw [e.sum_comp (fun a => (1+|J a|)^2)] + +/-- A literal stage is the same product-ordered finite table as its supplied +word and coefficient formulas. The hypotheses are pointwise identities. -/ +theorem family_table (e : Fin m ≃ κ) (ix : ι → ℕ) (xs : κ → List ι) + (w : κ → ι → Fin 4) (J : κ → ℚ) (N n : ℕ) + (f : ℕ → List Letter → Fin d → List Letter) + (g : ℚ → ℚ → Fin d → ℚ) : + family d f g (N,n,table e ix xs w J) = + List.ofFn (fun i : Fin (m*d) => + let p := nextTerm e d i + (f (n+(e.symm p.1).val) (tag ix (xs p.1) (w p.1)) p.2, + g (QuantumOrderedSubdivision.scale J N) (J p.1) p.2)) := by + let v : Fin m → Entry := fun i => (tag ix (xs (e i)) (w (e i)),J (e i)) + have hr := radius_table e ix xs w J N n + have hrows : (List.range m).map (fun i => + block d f g ((n+i,radius (N,n,table e ix xs w J)),((List.ofFn v).drop i).headD ([],0))) = + List.ofFn (fun a : Fin m => block d f g + ((n+a.val,QuantumOrderedSubdivision.scale J N),v a)) := by + apply List.ext_getElem + · simp + · intro i hi hj + have hi' : i < m := by simpa using hi + simp only [List.getElem_map,List.getElem_range,List.getElem_ofFn] + rw [hr,lookup_ofFn v ([],0) ⟨i,hi'⟩] + change ((List.range (List.ofFn v).length).map (fun i => + block d f g ((n+i,radius (N,n,table e ix xs w J)),((List.ofFn v).drop i).headD ([],0)))).flatten = _ + rw [List.length_ofFn,hrows] + symm + convert product_table (fun p : Fin m × Fin d => + (f (n+p.1.val) (v p.1).1 p.2, + g (QuantumOrderedSubdivision.scale J N) (v p.1).2 p.2)) using 1 + · congr 1 + funext i + simp only [nextTerm,Equiv.trans_apply,Equiv.prodCongr_apply,Prod.map_fst,Prod.map_snd, + Equiv.refl_apply,Equiv.symm_apply_apply,v] + · rfl + +end ContinuumCoulomb.QuantumOrderedLabelTable + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelThird.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelThird.lean new file mode 100644 index 0000000000000000000000000000000000000000..585bcefe042458185d17d1b7c75ef4c9a8b16d0f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelThird.lean @@ -0,0 +1,111 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelSubdivision + +namespace OAI + +/-! Ordered support-label arrays for the seven third-order terms. The +same literal three-entry partition selects the real factor and the two +matching-parity factors. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedLabelData +open scoped Classical + +variable {ι κ : Type} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +def thirdBlock (mediator : ℕ) (xs : List Letter) : Fin 7 → List Letter := + let p := partition xs + ![[],[(mediator,3)],p.1,p.2,p.2++[(mediator,3)], + p.1.take 1++[(mediator,axis (p.1.take 1))], + p.1.drop 1++[(mediator,axis (p.1.take 1))]] + +omit [Fintype ι] [Fintype κ] [DecidableEq κ] in +theorem pair_tag (index : ι → ℕ) (xs : List ι) (w : ι → Fin 4) : + tag index (QuantumOrderedTriple.partition xs w).1 + (QuantumOrderedTriple.pairWord xs w)=(partition (tag index xs w)).1 := by + rw [QuantumOrderedTriple.pairWord,tag_restrict index _ w _ (fun _ h => h)] + exact (congrArg Prod.fst (partition_tag index xs w)).symm + +omit [Fintype ι] [Fintype κ] [DecidableEq κ] in +theorem real_tag (index : ι → ℕ) (xs : List ι) (w : ι → Fin 4) : + tag index (QuantumOrderedTriple.partition xs w).2 + (QuantumOrderedTriple.third xs w)=(partition (tag index xs w)).2 := by + rw [QuantumOrderedTriple.third,tag_restrict index _ w _ (fun _ h => h)] + exact (congrArg Prod.snd (partition_tag index xs w)).symm + +omit [Fintype ι] [Fintype κ] [DecidableEq κ] in +theorem third_first_tag (index : ι → ℕ) (xs : List ι) (w : ι → Fin 4) : + tag index ((QuantumOrderedTriple.partition xs w).1.take 1) + (QuantumOrderedTriple.first xs w)=(partition (tag index xs w)).1.take 1 := by + rw [QuantumOrderedTriple.first,first_tag] + exact congrArg (List.take 1) (congrArg Prod.fst (partition_tag index xs w)).symm + +omit [Fintype ι] [Fintype κ] [DecidableEq κ] in +theorem third_second_tag (index : ι → ℕ) (xs : List ι) (w : ι → Fin 4) : + tag index ((QuantumOrderedTriple.partition xs w).1.drop 1) + (QuantumOrderedTriple.second xs w)=(partition (tag index xs w)).1.drop 1 := by + rw [QuantumOrderedTriple.second,second_tag] + exact congrArg (List.drop 1) (congrArg Prod.fst (partition_tag index xs w)).symm + +omit [Fintype κ] [DecidableEq κ] in +theorem third_axis (index : ι → ℕ) (xs : List ι) (w : ι → Fin 4) + (hlen : xs.length ≤ 3) (hx : xs.Nodup) : + axis ((partition (tag index xs w)).1.take 1) = + (QuantumPolarizedSubdivision.axis + (decide (Odd (qmaPauliYCount (QuantumOrderedTriple.first xs w))))).val := by + have hp := (congrArg Prod.fst (partition_tag index xs w)).symm + rw [← hp] + exact first_axis index _ w (QuantumOrderedTriple.pair_nodup xs w hlen hx) 1 + +omit [Fintype κ] in +theorem thirdBlock_tag (index : ι → ℕ) (slot : κ → ℕ) + (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 3) (hx : ∀ e, (xs e).Nodup) (p : κ × Fin 7) : + tag (Sum.elim index slot) (QuantumOrderedThird.outputSites xs w p) + (QuantumOrderedThird.outputWord xs w p) = + thirdBlock (slot p.1) (tag index (xs p.1) (w p.1)) p.2 := by + rcases p with ⟨e,k⟩ + fin_cases k + · rfl + · change tag (Sum.elim index slot) [Sum.inr e] + (Sum.elim (fun _ : ι => 0) (qmaSinglePauliWord e 3)) = [(slot e,3)] + simp only [tag,List.map_cons,List.map_nil,Sum.elim_inr,qmaSinglePauliWord,ite_true] + rfl + · change tag (Sum.elim index slot) ((QuantumOrderedTriple.partition (xs e) (w e)).1.map Sum.inl) + (Sum.elim (QuantumOrderedTriple.pairWord (xs e) (w e)) (fun _ => 0)) = _ + rw [tag_lift,pair_tag] + rfl + · change tag (Sum.elim index slot) ((QuantumOrderedTriple.partition (xs e) (w e)).2.map Sum.inl) + (Sum.elim (QuantumOrderedTriple.third (xs e) (w e)) (fun _ => 0)) = _ + rw [tag_lift,real_tag] + rfl + · change tag (Sum.elim index slot) + (QuantumOrderedSubdivision.appendMediator (QuantumOrderedTriple.partition (xs e) (w e)).2 e) + (Sum.elim (QuantumOrderedTriple.third (xs e) (w e)) (qmaSinglePauliWord e 3)) = _ + rw [tag_appendMediator,real_tag] + rfl + · change tag (Sum.elim index slot) + (QuantumOrderedSubdivision.appendMediator ((QuantumOrderedTriple.partition (xs e) (w e)).1.take 1) e) + (Sum.elim (QuantumOrderedTriple.first (xs e) (w e)) + (qmaSinglePauliWord e (QuantumPolarizedSubdivision.axis + (QuantumOrderedThird.phase xs w e)))) = _ + rw [tag_appendMediator,third_first_tag] + change _ = (partition (tag index (xs e) (w e))).1.take 1 ++ + [(slot e,axis ((partition (tag index (xs e) (w e))).1.take 1))] + rw [third_axis index (xs e) (w e) (hlen e) (hx e)] + rfl + · change tag (Sum.elim index slot) + (QuantumOrderedSubdivision.appendMediator ((QuantumOrderedTriple.partition (xs e) (w e)).1.drop 1) e) + (Sum.elim (QuantumOrderedTriple.second (xs e) (w e)) + (qmaSinglePauliWord e (QuantumPolarizedSubdivision.axis + (QuantumOrderedThird.phase xs w e)))) = _ + rw [tag_appendMediator,third_second_tag] + change _ = (partition (tag index (xs e) (w e))).1.drop 1 ++ + [(slot e,axis ((partition (tag index (xs e) (w e))).1.take 1))] + rw [third_axis index (xs e) (w e) (hlen e) (hx e)] + rfl + +end ContinuumCoulomb.QuantumOrderedLabelData + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelYY.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelYY.lean new file mode 100644 index 0000000000000000000000000000000000000000..76b070fc723e107bd0dba8be13ef14787a1a084c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedLabelYY.lean @@ -0,0 +1,117 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelThird +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedPrivate + +namespace OAI + +/-! Exact sparse letters for YY removal and the final private-pair split. +Zero-labelled entries are retained so support-list order stays literal. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedLabelData +open scoped Classical + +variable {ι κ : Type} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +def zeros (xs : List Letter) : List Letter := xs.map (fun p => (p.1,0)) + +def yyFactors (xs : List Letter) : List Letter × List Letter := + match xs with + | [a,b] => if a.2=2 then + ([(a.1,1),(b.1,3)],[(a.1,3),(b.1,1)]) else (xs,zeros xs) + | _ => (xs,zeros xs) + +def yyBlock (mediator : ℕ) (xs : List Letter) : Fin 4 → List Letter := + ![[],[(mediator,3)],(yyFactors xs).1++[(mediator,1)], + (yyFactors xs).2++[(mediator,1)]] + +def privateBlock (mediator : ℕ) (xs : List Letter) : Fin 4 → List Letter := + ![[],[(mediator,3)],xs.take 1++[(mediator,1)],xs.drop 1++[(mediator,1)]] + +omit [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ] in +theorem tag_zeros (index : ι → ℕ) (xs : List ι) (w : ι → Fin 4) : + tag index xs (fun _ => 0)=zeros (tag index xs w) := by + simp only [tag,zeros,List.map_map,Function.comp_def,Fin.val_zero] + +omit [Fintype ι] [Fintype κ] [DecidableEq κ] in +theorem yyFactors_tag (index : ι → ℕ) (xs : List ι) (w : ι → Fin 4) + (hx : xs.Nodup) : + (tag index xs (QuantumOrderedYY.factor xs w).1, + tag index xs (QuantumOrderedYY.factor xs w).2)=yyFactors (tag index xs w) := by + cases xs with + | nil => rfl + | cons a xs => + cases xs with + | nil => + change (tag index [a] w,tag index [a] (fun _ => 0)) = + (tag index [a] w,zeros (tag index [a] w)) + exact congrArg (fun z => (tag index [a] w,z)) (tag_zeros index [a] w) + | cons b xs => + cases xs with + | cons c xs => + change (tag index (a::b::c::xs) w,tag index (a::b::c::xs) (fun _ => 0)) = + (tag index (a::b::c::xs) w,zeros (tag index (a::b::c::xs) w)) + exact congrArg (fun z => (tag index (a::b::c::xs) w,z)) + (tag_zeros index (a::b::c::xs) w) + | nil => + have hab : a ≠ b := by simpa using hx + have ha : (w a).val=2 ↔ w a=2 := + ⟨fun h => Fin.ext h,fun h => congrArg Fin.val h⟩ + by_cases h : w a=2 + · simp [QuantumOrderedYY.factor,yyFactors,tag,h,qmaTwoPauliWord,Ne.symm hab] + · simp only [QuantumOrderedYY.factor,h,ite_false,tag,List.map_cons,List.map_nil, + yyFactors,ha] + exact Prod.ext rfl (tag_zeros index [a,b] w) + +omit [Fintype ι] [Fintype κ] in +theorem yyBlock_tag (index : ι → ℕ) (slot : κ → ℕ) + (xs : κ → List ι) (w : κ → ι → Fin 4) + (hx : ∀ e, (xs e).Nodup) (p : κ × Fin 4) : + tag (Sum.elim index slot) (QuantumOrderedYY.outputSites xs p) + (QuantumOrderedYY.outputWord xs w p) = + yyBlock (slot p.1) (tag index (xs p.1) (w p.1)) p.2 := by + rcases p with ⟨e,k⟩ + have hleft := congrArg Prod.fst (yyFactors_tag index (xs e) (w e) (hx e)) + have hright := congrArg Prod.snd (yyFactors_tag index (xs e) (w e) (hx e)) + dsimp only [Prod.fst,Prod.snd] at hleft hright + fin_cases k + · rfl + · change tag (Sum.elim index slot) [Sum.inr e] + (Sum.elim (fun _ : ι => 0) (qmaSinglePauliWord e 3)) = [(slot e,3)] + simp only [tag,List.map_cons,List.map_nil,Sum.elim_inr,qmaSinglePauliWord,ite_true] + rfl + · change tag (Sum.elim index slot) (QuantumOrderedSubdivision.appendMediator (xs e) e) + (Sum.elim (QuantumOrderedYY.factor (xs e) (w e)).1 (qmaSinglePauliWord e 1)) = _ + rw [tag_appendMediator,hleft] + rfl + · change tag (Sum.elim index slot) (QuantumOrderedSubdivision.appendMediator (xs e) e) + (Sum.elim (QuantumOrderedYY.factor (xs e) (w e)).2 (qmaSinglePauliWord e 1)) = _ + rw [tag_appendMediator,hright] + rfl + +omit [Fintype ι] [Fintype κ] in +theorem privateBlock_tag (index : ι → ℕ) (slot : κ → ℕ) + (xs : κ → List ι) (w : κ → ι → Fin 4) (p : κ × Fin 4) : + tag (Sum.elim index slot) (QuantumOrderedPrivate.outputSites xs p) + (QuantumOrderedPrivate.outputWord xs w p) = + privateBlock (slot p.1) (tag index (xs p.1) (w p.1)) p.2 := by + rcases p with ⟨e,k⟩ + fin_cases k + · rfl + · change tag (Sum.elim index slot) [Sum.inr e] + (Sum.elim (fun _ : ι => 0) (qmaSinglePauliWord e 3)) = [(slot e,3)] + simp only [tag,List.map_cons,List.map_nil,Sum.elim_inr,qmaSinglePauliWord,ite_true] + rfl + · change tag (Sum.elim index slot) (QuantumOrderedSubdivision.appendMediator ((xs e).take 1) e) + (Sum.elim (QuantumOrderedSplit.firstWord (xs e) 1 (w e)) (qmaSinglePauliWord e 1)) = _ + rw [tag_appendMediator,first_tag] + rfl + · change tag (Sum.elim index slot) (QuantumOrderedSubdivision.appendMediator ((xs e).drop 1) e) + (Sum.elim (QuantumOrderedSplit.secondWord (xs e) 1 (w e)) (qmaSinglePauliWord e 1)) = _ + rw [tag_appendMediator,second_tag] + rfl + +end ContinuumCoulomb.QuantumOrderedLabelData + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedModel.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..9143b072183493a00c2ec7d706060804a98b3fc9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedModel.lean @@ -0,0 +1,105 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedHistory +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalModel + +namespace OAI + +/-! The time-ordered real six-local model retains both verifier bounds. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +def qmaOrderedHistorySites (c : QMACircuit) (hT : 0 < c.gates.length) (i : Fin (qmaHistoryReferenceWork c+1)) : + Finset (QMACircuitQubit c) := + qmaDistributedTermSites c (qmaFirstUseTime c) (qmaOrderedTermEquiv c hT (qmaFirstUseTime c) i) + +def qmaOrderedHistoryModel (c : QMACircuit) (hT : 0 < c.gates.length) : QMARealLocalModel 6 where + Q := Fin (qmaHistoryReferenceWork c+1) ⊕ QMACircuitQubit c + Term := QMAReferenceTerm (qmaHistoryReferenceWork c) + qFinite := inferInstance + qDecidable := inferInstance + termFinite := inferInstance + matrix := qmaReferenceTermMatrix (qmaHistoryReferenceWork c) + (qmaOrderedReferenceTerms c hT (qmaFirstUseTime c)) + sites := qmaReferenceTermSites (qmaHistoryReferenceWork c) (qmaOrderedHistorySites c hT) + localOn := qmaReferenceTerm_local _ _ _ (fun _ => qmaDistributedTerm_local c _ _) + card := qmaReferenceTerm_card _ _ (fun _ => qmaDistributedTerm_support_card c _ _) + hermitian := qmaReferenceTerm_hermitian _ _ (fun _ => qmaDistributedTerm_hermitian c _ _) + real := qmaReferenceTerm_real _ _ + +theorem qmaOrderedHistoryModel_sum (c : QMACircuit) (hT : 0 < c.gates.length) : + (∑ t, (qmaOrderedHistoryModel c hT).matrix t) = + qmaReferenceOnQubits (qmaHistoryReferenceWork c) + (qmaOrderedReferenceTerms c hT (qmaFirstUseTime c)) := + qmaReferenceTerm_sum _ _ + +theorem qmaOrderedHistoryModel_size (c : QMACircuit) (hT : 0 < c.gates.length) : + (qmaOrderedHistoryModel c hT).qubits = 3*c.gates.length+2*c.work+8 ∧ + (qmaOrderedHistoryModel c hT).terms = 4*c.gates.length+2*c.work+9 := by + constructor + · change Fintype.card (Fin (2*c.gates.length+c.work+4+1) ⊕ + (Fin (c.gates.length+2) ⊕ Fin (c.work+1))) = _ + simp only [Fintype.card_sum,Fintype.card_fin] + omega + · change Fintype.card (Fin (2*c.gates.length+c.work+4+1) ⊕ + Fin (2*c.gates.length+c.work+4)) = _ + simp only [Fintype.card_sum,Fintype.card_fin] + omega + +theorem qmaOrderedHistoryModel_yes (c : QMACircuit) (hT : 0 < c.gates.length) (hc : c.WellFormed) + (psi : EuclideanSpace ℂ (SourceSpinBasis c.witness)) (hpsi : ‖psi‖ = 1) + (hacc : 2/3 ≤ qmaAcceptance c hc psi) : + (qmaOrderedHistoryModel c hT).energy ≤ 1/(3*(c.gates.length+1:ℝ)) := by + obtain ⟨v,hv,he⟩ := qmaOrderedReferenceHistory_accepting c hc hT (qmaFirstUseTime c) + (qmaFirstUse_untouched c) psi hpsi hacc + let e := Equiv.sumArrowEquivProdArrow (Fin (qmaHistoryReferenceWork c+1)) + (QMACircuitQubit c) (Fin 2) + let u : EuclideanSpace ℂ ((Fin (qmaHistoryReferenceWork c+1) ⊕ QMACircuitQubit c) → Fin 2) := + WithLp.toLp 2 (v ∘ e) + have hu : ‖u‖ = 1 := by + apply (sq_eq_sq₀ (norm_nonneg _) (by norm_num : (0:ℝ) ≤ 1)).mp + simp only [u,EuclideanSpace.norm_sq_eq,Complex.sq_norm,one_pow] + exact (e.sum_comp (fun p => Complex.normSq (v p))).trans hv + unfold QMARealLocalModel.energy + rw [qmaOrderedHistoryModel_sum] + apply (qmaNormalizedBottom_le _ u hu).trans + have hq : qmaQuadratic (qmaReferenceOnQubits (qmaHistoryReferenceWork c) + (qmaOrderedReferenceTerms c hT (qmaFirstUseTime c))) (fun p => u p) = + qmaQuadratic (qmaOrderedReferenceHistory c hT (qmaFirstUseTime c)) v := + qmaQuadratic_reindex e _ v + rw [hq] + exact (le_div_iff₀ (by positivity : 0 < 3*(c.gates.length+1:ℝ))).mpr (by linarith) + +theorem qmaOrderedHistoryModel_no (c : QMACircuit) (hT : 0 < c.gates.length) (hc : c.WellFormed) + (hsound : ∀ psi : EuclideanSpace ℂ (SourceSpinBasis c.witness), + ‖psi‖ = 1 → qmaAcceptance c hc psi ≤ 1/3) : + 2/(5*(c.gates.length+1:ℝ)) ≤ (qmaOrderedHistoryModel c hT).energy := by + unfold QMARealLocalModel.energy + rw [qmaOrderedHistoryModel_sum] + apply le_qmaNormalizedBottom _ (EuclideanSpace.single (fun _ => (0:Fin 2)) (1:ℂ)) + (by simp [PiLp.norm_single]) + intro u hu + change EuclideanSpace ℂ ((Fin (qmaHistoryReferenceWork c+1) ⊕ QMACircuitQubit c) → Fin 2) at u + have hu1 : ‖u‖ = 1 := hu + let e := Equiv.sumArrowEquivProdArrow (Fin (qmaHistoryReferenceWork c+1)) + (QMACircuitQubit c) (Fin 2) + have h := qmaOrderedReferenceHistory_lower c hc hT (qmaFirstUseTime c) (qmaFirstUse_untouched c) + hsound ((fun p => u p) ∘ e.symm) + have hm : (∑ p, Complex.normSq (((fun q => u q) ∘ e.symm) p)) = 1 := by + change (∑ p, Complex.normSq (u (e.symm p))) = 1 + rw [qmaMass_reindex e (fun p => u p)] + calc + _ = ‖u‖^2 := by + simpa only [Complex.sq_norm] using (EuclideanSpace.norm_sq_eq u).symm + _ = 1 := by rw [hu1]; norm_num + rw [hm,mul_one] at h + change _ ≤ qmaQuadratic ((qmaOrderedReferenceHistory c hT (qmaFirstUseTime c)).submatrix e e) (fun p => u p) + rw [qmaQuadratic_reindex_equiv] + exact h + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedOutputBounds.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedOutputBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..4728fe120e012582ebea4268a9bf7785f63b92de --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedOutputBounds.lean @@ -0,0 +1,82 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawEnvelope +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedFinalBounds + +namespace OAI + +/-! The polynomial envelopes apply to the actual emitted rational graph, +with the same six-stage table and four-spin instructions used by its energy proof. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedLabelCompile +open QuantumOrderedLabelTable +open scoped Classical +variable {ι κ : Type} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] +variable {n m : ℕ} + +theorem rawInput_table (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) + (hlen : ∀ a, (xs a).length ≤ 6) (hdup : ∀ a, (xs a).Nodup) (N : ℕ) : + rawInput (N,n,table e (index q) xs w J) = + (finalCount n m,N,QuantumRawExchange.packed + (QuantumOrderedRawBlock.terms + (numberedSites (qubits6 q e) (terms6 e) (finalSites xs w)) + (numberedWord (qubits6 q e) (terms6 e) (finalWord xs w))) + (fun i => finalCoefficient J N (terms6 e i))) := by + unfold rawInput outputCount rawEntries labelEntries classify + simp only [Function.comp_apply,QuantumOrderedLabelTable.output_table q e xs w J hlen hdup N] + rw [packed_table] + rfl + +def coefficientEnvelope (n m B N : ℕ) : ℕ := QuantumRawExchange.outputNat + (n+3717*m) (12544*m) (QuantumOrderedXZ.pipelineNat m B N 6) N + +omit [DecidableEq κ] in +theorem final_raw_weights (e : Fin m ≃ κ) (J : κ → ℚ) {B : ℕ} + (hJ : ∀ p, |J p| ≤ (B:ℚ)) (N : ℕ) : + ∀ i, |(finalCoefficient J N (terms6 e i):ℝ)| ≤ QuantumOrderedXZ.pipelineNat m B N 6 := by + have hm : Fintype.card κ ≤ m := le_of_eq ((Fintype.card_congr e).symm.trans (Fintype.card_fin m)) + intro i + exact_mod_cast QuantumOrderedXZ.private_coefficient_bound J hm hJ N (terms6 e i) + +theorem output_coefficients (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) + (hlen : ∀ a, (xs a).length ≤ 6) (hdup : ∀ a, (xs a).Nodup) + {B : ℕ} (hJ : ∀ p, |J p| ≤ (B:ℚ)) (N : ℕ) : + |((output (N,n,table e (index q) xs w J)).2:ℝ)| ≤ coefficientEnvelope n m B N ∧ + ∀ b ∈ (output (N,n,table e (index q) xs w J)).1, + |(b.2.2:ℝ)| ≤ coefficientEnvelope n m B N := by + let t := QuantumOrderedRawBlock.terms + (numberedSites (qubits6 q e) (terms6 e) (finalSites xs w)) + (numberedWord (qubits6 q e) (terms6 e) (finalWord xs w)) + let c := fun i => finalCoefficient J N (terms6 e i) + let bs := QuantumRawExchange.packed t c + have hlenbs : bs.length=12544*m := by + simp only [bs,QuantumRawExchange.packed,List.length_ofFn] + ring + have hw : ∀ b ∈ bs, |(b.2.2.2:ℝ)| ≤ QuantumOrderedXZ.pipelineNat m B N 6 := by + intro b hb + obtain ⟨i,rfl⟩ := List.mem_ofFn.mp hb + rw [QuantumRawExchange.pack_weight] + exact final_raw_weights e J hJ N i + change _ ≤ (coefficientEnvelope n m B N:ℝ) ∧ _ + unfold output + simp only [Function.comp_apply] + rw [rawInput_table q e xs w J hlen hdup N] + constructor + · have h := QuantumRawExchange.compile_scalar_bound (finalCount n m) N + (QuantumOrderedXZ.pipelineNat m B N 6) bs hw + rw [hlenbs] at h + conv at h => rhs; rw [finalCount_eq] + exact h + · intro b hb + have h := QuantumRawExchange.compile_bond_bound (finalCount n m) N + (QuantumOrderedXZ.pipelineNat m B N 6) bs hw b hb + rw [hlenbs] at h + conv at h => rhs; rw [finalCount_eq] + exact h + +end ContinuumCoulomb.QuantumOrderedLabelCompile + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedOutputSpatial.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedOutputSpatial.lean new file mode 100644 index 0000000000000000000000000000000000000000..7a690731dc1ed096666354ecbb867bea3adff209 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedOutputSpatial.lean @@ -0,0 +1,98 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListInitialSpatial +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawCellDensity +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedSpatialComplete +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryDegree + +namespace OAI + +/-! Spatial input data for the actual six-stage and four-spin compiler, +using the exact numeric qubit order and full emitted bond list. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedOutputSpatial +open QuantumOrderedLabelTable QuantumOrderedSpatialComplete QuantumRawCellLocality +open scoped Classical +variable {ι κ : Type} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] +variable {n m rows width : ℕ} + +local instance gridDecision (r w : ℕ) : DecidableEq (QMAGridCell r w) := Classical.decEq _ + +def logicalCell (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (cell : ι → QMAGridCell rows width) (anchor : κ → QMAGridCell rows width) : + Fin (finalCount n m) → QMAGridCell rows width := + fun i => cell6 cell anchor (qubits6 q e i) + +def physicalCell (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (cell : ι → QMAGridCell rows width) (anchor : κ → QMAGridCell rows width) : + ℕ → QMAGridCell rows width := blockCell (QuantumRawCellLocality.extendCell (logicalCell q e cell anchor)) + +omit [DecidableEq ι] [DecidableEq κ] in +theorem logical_density (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (cell : ι → QMAGridCell rows width) (anchor : κ → QMAGridCell rows width) + {A B : ℕ} (hc : ∀ p, (Finset.univ.filter (fun i => cell i=p)).card ≤ A) + (ha : ∀ p, (Finset.univ.filter (fun i => anchor i=p)).card ≤ B) + (p : QMAGridCell rows width) : + (Finset.univ.filter (fun i => logicalCell q e cell anchor i=p)).card ≤ A+3717*B := by + have he : (Finset.univ.filter (fun i => logicalCell q e cell anchor i=p)).card = + (Finset.univ.filter (fun i => cell6 cell anchor i=p)).card := by + apply Finset.card_equiv (qubits6 q e) + intro i + constructor <;> intro h + · exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,(Finset.mem_filter.mp h).2⟩ + · exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,(Finset.mem_filter.mp h).2⟩ + rw [he] + exact (complete_density (ι := ι) (κ := κ) (A := A) (B := B) cell anchor hc ha).1 p + +theorem output_local (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) + (hlen : ∀ a, (xs a).length ≤ 6) (hdup : ∀ a, (xs a).Nodup) + (cell : ι → QMAGridCell rows width) (anchor : κ → QMAGridCell rows width) + (hx : ∀ a i, i ∈ xs a → QMAGridCellsNear (cell i) (anchor a)) (N : ℕ) : + QuantumForkList.BondLocal + (QuantumOrderedLabelCompile.output (N,n,table e (index q) xs w J)).1 + (physicalCell q e cell anchor) QuantumForkList.CommonCell := by + rw [QuantumOrderedLabelCompile.output_table q e xs w J hlen hdup N] + apply QuantumRawCellLocality.output_local N _ _ _ _ (fun a => anchor6 anchor (terms6 e a)) + intro a i hi + obtain ⟨j,hj,rfl⟩ := List.mem_map.mp hi + rw [extendCell_fin (logicalCell q e cell anchor) ((qubits6 q e).symm j)] + change QMAGridCellsNear (cell6 cell anchor (qubits6 q e ((qubits6 q e).symm j))) _ + rw [Equiv.apply_symm_apply] + exact complete_geometry xs w hlen cell anchor QMAGridCellsNear + qmaGridCellsNear_refl hx (terms6 e a) j hj + +def input (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) + (hlen : ∀ a, (xs a).length ≤ 6) (hdup : ∀ a, (xs a).Nodup) + (cell : ι → QMAGridCell rows width) (anchor : κ → QMAGridCell rows width) + {A B D : ℕ} (hc : ∀ p, (Finset.univ.filter (fun i => cell i=p)).card ≤ A) + (ha : ∀ p, (Finset.univ.filter (fun i => anchor i=p)).card ≤ B) + (hx : ∀ a i, i ∈ xs a → QMAGridCellsNear (cell i) (anchor a)) + (hD : 1 ≤ D) (hi : QuantumOrderedIncidence.Bounded xs D) (N : ℕ) : + QuantumForkList.SpatialInput rows width (4*(A+3717*B)) (6+22*(12544*D)) where + n := QuantumOrderedLabelCompile.qubitCount (N,n,table e (index q) xs w J) + bonds := (QuantumOrderedLabelCompile.output (N,n,table e (index q) xs w J)).1 + constant := (QuantumOrderedLabelCompile.output (N,n,table e (index q) xs w J)).2 + precision := N + cell := physicalCell q e cell anchor + bounded := fun b hb => ⟨(QuantumOrderedLabelCompile.output_valid q e xs w J hlen hdup N b hb).1, + (QuantumOrderedLabelCompile.output_valid q e xs w J hlen hdup N b hb).2.1⟩ + noLoops := fun b hb => (QuantumOrderedLabelCompile.output_valid q e xs w J hlen hdup N b hb).2.2 + degree := fun v => QuantumOrderedLabelCompile.output_degree q e xs w J hlen hdup hD hi N v.val v.isLt + density := by + intro p + have hn : QuantumOrderedLabelCompile.qubitCount (N,n,table e (index q) xs w J)= + finalCount n m*4 := by + rw [QuantumOrderedLabelCompile.qubitCount_table,finalCount_eq] + omega + rw [hn] + apply blockCell_density (logicalCell q e cell anchor) ?_ p + intro a + convert logical_density q e cell anchor hc ha a using 1; congr + locality := output_local q e xs w J hlen hdup cell anchor hx N + +end ContinuumCoulomb.QuantumOrderedOutputSpatial + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedPrivate.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedPrivate.lean new file mode 100644 index 0000000000000000000000000000000000000000..45537e3cd3a7150986b4bfd9e944be4f4341ae2e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedPrivate.lean @@ -0,0 +1,106 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedYYReduction +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZPrivate + +namespace OAI + +/-! A literal private-pair subdivision of an ordered X/Z family. The +source site's list order determines both factors and every output site. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedPrivate +open Matrix QuantumOrderedSubdivision +open scoped BigOperators Classical +variable {ι κ : Type} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +def outputWord (xs : κ → List ι) (w : κ → ι → Fin 4) : + κ × Fin 4 → (ι ⊕ κ → Fin 4) := + fun p => qmaXZSubdivisionWord + (QuantumOrderedSplit.firstWord (xs p.1) 1 (w p.1)) + (QuantumOrderedSplit.secondWord (xs p.1) 1 (w p.1)) p.1 p.2 + +def outputSites (xs : κ → List ι) : κ × Fin 4 → List (ι ⊕ κ) := + QuantumOrderedSubdivision.outputSites xs 1 + +def outputCoefficient (J : κ → ℚ) (N : ℕ) (p : κ × Fin 4) : ℚ := + QuantumOrderedSubdivision.outputCoefficient J N p + +omit [Fintype ι] [Fintype κ] in +theorem output_noY (xs : κ → List ι) (w : κ → ι → Fin 4) + (hy : ∀ e i, w e i ≠ 2) (p : κ × Fin 4) (i : ι ⊕ κ) : + outputWord xs w p i ≠ 2 := + qmaXZSubdivision_noY _ _ _ (qmaPauliRestrict_noY _ _ (hy p.1)) + (qmaPauliRestrict_noY _ _ (hy p.1)) _ _ + +omit [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] in +theorem outputSites_nodup (xs : κ → List ι) (hx : ∀ e, (xs e).Nodup) + (p : κ × Fin 4) : (outputSites xs p).Nodup := + QuantumOrderedSubdivision.outputSites_nodup xs 1 hx p + +omit [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] in +theorem outputSites_length (xs : κ → List ι) (hx : ∀ e, (xs e).length ≤ 2) + (p : κ × Fin 4) : (outputSites xs p).length ≤ 2 := + QuantumOrderedSubdivision.outputSites_length xs 1 hx p + +theorem outputSites_cover (xs : κ → List ι) (w : κ → ι → Fin 4) + (p : κ × Fin 4) : + qmaPauliSupport (outputWord xs w p) ⊆ (outputSites xs p).toFinset := by + rcases p with ⟨e,k⟩ + fin_cases k + · change qmaPauliSupport (fun _ : ι ⊕ κ => 0) ⊆ ([] : List (ι ⊕ κ)).toFinset + simp [qmaPauliSupport] + · intro x hx + cases x with + | inl i => simp [outputWord,qmaXZSubdivisionWord,qmaPauliSupport] at hx + | inr j => + have hj : j ∈ qmaPauliSupport (qmaSinglePauliWord e 3) := by + simpa [outputWord,qmaXZSubdivisionWord,qmaPauliSupport] using hx + simpa [outputSites,QuantumOrderedSubdivision.outputSites] using + qmaSinglePauliWord_support e 3 hj + · exact join_support_cover ((xs e).take 1) + (QuantumOrderedSplit.firstWord (xs e) 1 (w e)) + (qmaPauliRestrict_support _ _) e 1 + · exact join_support_cover ((xs e).drop 1) + (QuantumOrderedSplit.secondWord (xs e) 1 (w e)) + (qmaPauliRestrict_support _ _) e 1 + +theorem output_private (xs : κ → List ι) (w : κ → ι → Fin 4) + (hx : ∀ e, (xs e).Nodup) (p q : κ × Fin 4) + (hp : (qmaPauliSupport (outputWord xs w p)).card = 2) + (hpq : qmaPauliSupport (outputWord xs w p) = qmaPauliSupport (outputWord xs w q)) : + p = q := by + have hd (e : κ) : Disjoint + (qmaPauliSupport (QuantumOrderedSplit.firstWord (xs e) 1 (w e))) + (qmaPauliSupport (QuantumOrderedSplit.secondWord (xs e) 1 (w e))) := + (QuantumOrderedSplit.disjoint (xs e) (hx e) 1).mono + (qmaPauliRestrict_support _ _) (qmaPauliRestrict_support _ _) + obtain ⟨he,hk⟩ := qmaXZSubdivision_private_pair + (fun e => QuantumOrderedSplit.firstWord (xs e) 1 (w e)) + (fun e => QuantumOrderedSplit.secondWord (xs e) 1 (w e)) hd p.1 q.1 p.2 q.2 hp hpq + exact Prod.ext he hk + +theorem output_accuracy (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) + (hx : ∀ e, (xs e).Nodup) + (hcover : ∀ e, qmaPauliSupport (w e) ⊆ (xs e).toFinset) + (N : ℕ) (hN : 1 ≤ N) : + |MediatorGraph.normalizedBottom (qmaPauliFamily (outputWord xs w) + (fun p => (outputCoefficient J N p:ℝ)))- + MediatorGraph.normalizedBottom (qmaPauliFamily w (fun e => (J e:ℝ)))| ≤ 1/(N:ℝ) := by + let a := fun e => QuantumOrderedSplit.firstWord (xs e) 1 (w e) + let b := fun e => QuantumOrderedSplit.secondWord (xs e) 1 (w e) + have hfactor (e : κ) : qmaPauliWord (a e)*qmaPauliWord (b e) = qmaPauliWord (w e) := + QuantumOrderedSplit.factor (xs e) (hx e) 1 (w e) (hcover e) + have hcomm (e : κ) : qmaPauliWord (a e)*qmaPauliWord (b e) = + qmaPauliWord (b e)*qmaPauliWord (a e) := + QuantumOrderedSplit.commute (xs e) (hx e) 1 (w e) + have hNR : (1:ℝ) ≤ N := by exact_mod_cast hN + have h := qmaXZSubdivision_accuracy a b (fun e => (J e:ℝ)) hcomm hNR + simp only [qmaPauliFamily,outputWord,outputCoefficient, + QuantumOrderedSubdivision.outputCoefficient,QuantumPolarizedSubdivision.weight_cast, + QuantumOrderedSubdivision.scale_cast] + simpa only [hfactor,a,b] using h + +end ContinuumCoulomb.QuantumOrderedPrivate + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedPrivateSpatial.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedPrivateSpatial.lean new file mode 100644 index 0000000000000000000000000000000000000000..bf2050bfbdd6928fb5370ec446e737825dd7e2fb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedPrivateSpatial.lean @@ -0,0 +1,76 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedPrivate +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedSpatial + +namespace OAI + +/-! The literal private-pair stage retains neighboring cells and bounded +density, including the exact five-stage output as its input. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedPrivate +open scoped Classical +variable {ι κ : Type} {rows width : ℕ} + +def outputAnchor (anchor : κ → QMAGridCell rows width) (p : κ × Fin 4) := anchor p.1 + +theorem output_near (xs : κ → List ι) + (cell : ι → QMAGridCell rows width) (anchor : κ → QMAGridCell rows width) + (h : QuantumOrderedSpatial.Near xs cell anchor) : + QuantumOrderedSpatial.Near (outputSites xs) (qmaMediatorCell cell anchor) + (outputAnchor anchor) := + QuantumOrderedSpatial.subdivision_near xs 1 cell anchor h + +variable [Fintype ι] [Fintype κ] + +theorem output_density (cell : ι → QMAGridCell rows width) + (anchor : κ → QMAGridCell rows width) {A B : ℕ} + (hc : ∀ p, (Finset.univ.filter (fun q => cell q = p)).card ≤ A) + (ha : ∀ p, (Finset.univ.filter (fun e => anchor e = p)).card ≤ B) : + (∀ p, (Finset.univ.filter (fun q : ι ⊕ κ => qmaMediatorCell cell anchor q = p)).card + ≤ A+B) ∧ + (∀ p, (Finset.univ.filter (fun e : κ × Fin 4 => outputAnchor anchor e = p)).card + ≤ 4*B) := by + constructor + · intro p + rw [qmaSumFilter_card] + exact Nat.add_le_add (hc p) (ha p) + · intro p + change (Finset.univ.filter (fun e : κ × Fin 4 => anchor e.1 = p)).card ≤ _ + exact (qmaProdFilter_card 4 (fun e => anchor e = p)).trans_le + (Nat.mul_le_mul_left _ (ha p)) + +variable [DecidableEq ι] [DecidableEq κ] + +theorem pipeline_near (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 6) + (cell : ι → QMAGridCell rows width) (anchor : κ → QMAGridCell rows width) + (h : QuantumOrderedSpatial.Near xs cell anchor) : + QuantumOrderedSpatial.Near (outputSites (QuantumOrderedXZ.sites xs w)) + (qmaMediatorCell (QuantumOrderedSpatial.outputCell cell anchor) + (QuantumOrderedSpatial.outputAnchor anchor)) + (outputAnchor (QuantumOrderedSpatial.outputAnchor anchor)) := + output_near _ _ _ (QuantumOrderedSpatial.output_near xs w hlen cell anchor h) + +omit [DecidableEq ι] [DecidableEq κ] in +theorem pipeline_density (cell : ι → QMAGridCell rows width) + (anchor : κ → QMAGridCell rows width) {A B : ℕ} + (hc : ∀ p, (Finset.univ.filter (fun q => cell q = p)).card ≤ A) + (ha : ∀ p, (Finset.univ.filter (fun e => anchor e = p)).card ≤ B) : + (∀ p, (Finset.univ.filter (fun q => qmaMediatorCell + (QuantumOrderedSpatial.outputCell cell anchor) + (QuantumOrderedSpatial.outputAnchor anchor) q = p)).card ≤ A+3717*B) ∧ + (∀ p, (Finset.univ.filter (fun e => + outputAnchor (QuantumOrderedSpatial.outputAnchor anchor) e = p)).card ≤ 12544*B) := by + obtain ⟨h1,h2⟩ := QuantumOrderedSpatial.output_density cell anchor hc ha + obtain ⟨h3,h4⟩ := output_density _ _ h1 h2 + constructor + · intro p + exact (h3 p).trans_eq (by omega) + · intro p + exact (h4 p).trans_eq (by omega) + +end ContinuumCoulomb.QuantumOrderedPrivate + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedRawBlock.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedRawBlock.lean new file mode 100644 index 0000000000000000000000000000000000000000..4bbad43bd4f729f926500500996b9a231da8b24a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedRawBlock.lean @@ -0,0 +1,61 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedXZTerm +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawCompiler +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliRounding + +namespace OAI + +/-! The existing literal rational four-spin compiler applied to the actual +ordered X/Z words. Its input list preserves term and endpoint order. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedRawBlock +open scoped BigOperators Classical + +def terms {n m : ℕ} (xs : Fin m → List (Fin n)) (w : Fin m → Fin n → Fin 4) : + Fin m → QMAXZTerm n := fun e => QuantumOrderedXZTerm.ofSites (xs e) (w e) + +def output {n m : ℕ} (N : ℕ) (xs : Fin m → List (Fin n)) + (w : Fin m → Fin n → Fin 4) (J : Fin m → ℚ) := + QuantumRawExchange.compile (n,N,QuantumRawExchange.packed (terms xs w) J) + +theorem private_terms {n m : ℕ} (xs : Fin m → List (Fin n)) + (w : Fin m → Fin n → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 2) (hx : ∀ e, (xs e).Nodup) + (hs : ∀ e, qmaPauliSupport (w e) ⊆ (xs e).toFinset) (hy : ∀ e i, w e i ≠ 2) + (hp : ∀ e f, (qmaPauliSupport (w e)).card = 2 → + qmaPauliSupport (w e) = qmaPauliSupport (w f) → e = f) : + ∀ e f, (qmaPauliSupport (terms xs w e).word).card = 2 → + qmaPauliSupport (terms xs w e).word = qmaPauliSupport (terms xs w f).word → e = f := by + intro e f he hef + have ht (i : Fin m) : (terms xs w i).word = w i := + QuantumOrderedXZTerm.word_eq (xs i) (w i) (hlen i) (hx i) (hs i) (hy i) + rw [ht e] at he + rw [ht e,ht f] at hef + exact hp e f he hef + +theorem output_accuracy {n m : ℕ} (N : ℕ) (hN : 0 < N) + (xs : Fin m → List (Fin n)) (w : Fin m → Fin n → Fin 4) (J : Fin m → ℚ) + (hlen : ∀ e, (xs e).length ≤ 2) (hx : ∀ e, (xs e).Nodup) + (hs : ∀ e, qmaPauliSupport (w e) ⊆ (xs e).toFinset) (hy : ∀ e i, w e i ≠ 2) + (hp : ∀ e f, (qmaPauliSupport (w e)).card = 2 → + qmaPauliSupport (w e) = qmaPauliSupport (w f) → e = f) : + |MediatorGraph.normalizedBottom (QuantumRawExchange.rawMatrix (n*4) (output N xs w J))- + MediatorGraph.normalizedBottom (qmaPauliFamily w (fun e => (J e:ℝ)))| ≤ 2/(N:ℝ) := by + have h := QuantumRawExchange.compile_accuracy N hN (terms xs w) J + (private_terms xs w hlen hx hs hy hp) + have ht (e : Fin m) : (terms xs w e).matrix = qmaPauliWord (w e) := + QuantumOrderedXZTerm.matrix_eq (xs e) (w e) (hlen e) (hx e) (hs e) (hy e) + have hc (q : ℚ) : ((q:ℝ):ℂ) = (q:ℂ) := by norm_cast + simpa only [output,qmaPauliFamily,hc,ht] using h + +theorem output_valid {n m : ℕ} (N : ℕ) (xs : Fin m → List (Fin n)) + (w : Fin m → Fin n → Fin 4) (J : Fin m → ℚ) + (b : MediatorListProgram.Bond) (hb : b ∈ (output N xs w J).1) : + b.1 < n*4 ∧ b.2.1 < n*4 ∧ b.1 ≠ b.2.1 := + QuantumRawExchange.compile_valid N (terms xs w) J b hb + +end ContinuumCoulomb.QuantumOrderedRawBlock + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedRawCells.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedRawCells.lean new file mode 100644 index 0000000000000000000000000000000000000000..a82b9682da6899000437a189a189c4ad7877b956 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedRawCells.lean @@ -0,0 +1,37 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedCellTable + +namespace OAI + +/-! The raw four-spin compiler repeats each computed logical cell four times, +in exactly the order of its physical spin indices. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedRawCells +open QuantumOrderedCellProgram QuantumOrderedCellTable QuantumOrderedSpatialComplete +open QuantumOrderedLabelTable QuantumRouteCode +open ExactQuantumFactoring.BitStackProgram + +def value (x : State) : List Pair := anchors 4 (complete x).1 + +noncomputable def program : Procedure stateCode (listCode pairCode) value := + (anchorsProgram 4).comp ((Procedure.first (listCode pairCode) (listCode pairCode)).comp completeProgram) + +theorem four_ofFn {n : ℕ} (cell : Fin n → Pair) : + anchors 4 (List.ofFn cell)= + List.ofFn (fun i : Fin (n*4) => cell (finProdFinEquiv.symm i).1) := by + rw [anchors_ofFn,← product_table (fun p : Fin n × Fin 4 => cell p.1)] + +theorem value_table {ι κ : Type} {n m : ℕ} (q : Fin n ≃ ι) (e : Fin m ≃ κ) + (cell : ι → Pair) (anchor : κ → Pair) : + value (table q e cell anchor)= + List.ofFn (fun i : Fin (finalCount n m*4) => + cell6 cell anchor (qubits6 q e (finProdFinEquiv.symm i).1)) := by + unfold value + rw [complete_table] + exact four_ofFn _ + +end ContinuumCoulomb.QuantumOrderedRawCells + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedRawPacking.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedRawPacking.lean new file mode 100644 index 0000000000000000000000000000000000000000..edd7ce1f306caa7a0890937d60f7f2a94ac6ec2d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedRawPacking.lean @@ -0,0 +1,69 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedXZTerm +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawExchange + +namespace OAI + +/-! Raw scalar/field/pair instructions read directly from the ordered +site-label list. Only two entries are inspected at the final X/Z stage. -/ + +namespace ContinuumCoulomb.QuantumOrderedRawPacking + +abbrev Letter := ℕ × ℕ +abbrev Input := List Letter × ℚ + +def scalar (j : ℚ) : QuantumRawExchange.Raw := + ((false,false),((0,0),((false,false),j))) + +def field (u : Letter) (j : ℚ) : QuantumRawExchange.Raw := + if u.2 = 0 then scalar j else + ((false,true),((u.1,0),((decide (u.2=1),false),j))) + +def pair (u v : Letter) (j : ℚ) : QuantumRawExchange.Raw := + ((true,false),((u.1,v.1),((decide (u.2=1),decide (v.2=1)),j))) + +def value (x : Input) : QuantumRawExchange.Raw := + match x.1 with + | [] => scalar x.2 + | [u] => field u x.2 + | u :: v :: _ => if u.1=v.1 then field u x.2 else + if u.2=0 then field v x.2 else + if v.2=0 then field u x.2 else pair u v x.2 + +theorem axis_zero (a : Fin 4) : + decide (QuantumOrderedXZTerm.axis a = 0) = decide (a.val = 1) := by + fin_cases a <;> rfl + +theorem field_pack {n : ℕ} (w : Fin n → Fin 4) (i : Fin n) (j : ℚ) : + field (i.val,(w i).val) j = QuantumRawExchange.pack (QuantumOrderedXZTerm.field w i) j := by + by_cases hi : w i = 0 + · simp [field,scalar,QuantumOrderedXZTerm.field,hi,QuantumRawExchange.pack] + · have hv : (w i).val ≠ 0 := fun h => hi (Fin.ext h) + simp only [field,hv,ite_false,QuantumOrderedXZTerm.field,hi,QuantumRawExchange.pack, + axis_zero] + +theorem value_pack {n : ℕ} (xs : List (Fin n)) (w : Fin n → Fin 4) (j : ℚ) : + value (xs.map (fun i => (i.val,(w i).val)),j) = + QuantumRawExchange.pack (QuantumOrderedXZTerm.ofSites xs w) j := by + cases xs with + | nil => rfl + | cons i xs => + cases xs with + | nil => exact field_pack w i j + | cons k xs => + by_cases hik : i=k + · subst k + simp only [List.map_cons,value,ite_true,QuantumOrderedXZTerm.ofSites,dite_true] + exact field_pack w i j + · have hv : i.val ≠ k.val := fun h => hik (Fin.ext h) + have hi : (w i).val=0 ↔ w i=0 := Fin.val_eq_zero_iff + have hk : (w k).val=0 ↔ w k=0 := Fin.val_eq_zero_iff + simp only [List.map_cons,value,hv,ite_false,QuantumOrderedXZTerm.ofSites, + dite_eq_right hik,hi,hk] + split_ifs with hi hk + · exact field_pack w k j + · exact field_pack w i j + · simp only [pair,QuantumRawExchange.pack,axis_zero] + +end ContinuumCoulomb.QuantumOrderedRawPacking + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedRawPackingProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedRawPackingProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..1bae0ed166c39f88b73c6c712d2a2a5597d277ac --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedRawPackingProgram.lean @@ -0,0 +1,101 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedRawPacking +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawFamilyProgram + +namespace OAI + +/-! A literal polynomial program for the final ordered X/Z classifier. +It reads two site-label pairs and never enumerates a spin basis. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedRawPacking +open ExactQuantumFactoring.BitStackProgram + +def letterCode : Letter → List Bool := prodCode Nat.bits Nat.bits +def inputCode : Input → List Bool := prodCode (listCode letterCode) ratCode +def entry (k : ℕ) (x : Input) : Letter := (x.1.drop k).headD (0,0) + +noncomputable opaque weightProgram : Procedure inputCode ratCode Prod.snd := Procedure.second _ _ +noncomputable opaque entriesProgram : Procedure inputCode (listCode letterCode) Prod.fst := + Procedure.first _ _ +noncomputable opaque entryProgram (k : ℕ) : Procedure inputCode letterCode (entry k) := + (Procedure.listGet letterCode (0,0)).comp + ((Procedure.constant inputCode Nat.bits k).pair entriesProgram) +noncomputable opaque indexProgram (k : ℕ) : Procedure inputCode Nat.bits (fun x => (entry k x).1) := + (Procedure.first Nat.bits Nat.bits).comp (entryProgram k) +noncomputable opaque labelProgram (k : ℕ) : Procedure inputCode Nat.bits (fun x => (entry k x).2) := + (Procedure.second Nat.bits Nat.bits).comp (entryProgram k) +noncomputable opaque labelTest (k a : ℕ) : Procedure inputCode Procedure.boolCode + (fun x => decide ((entry k x).2=a)) := + Procedure.binaryEq.comp ((labelProgram k).pair (Procedure.constant inputCode Nat.bits a)) +noncomputable opaque lengthProgram : Procedure inputCode Nat.bits (fun x => x.1.length) := + Procedure.unaryToBits.comp + ((ExactQuantumFactoring.NativeAIG.Emission.listUnaryLength letterCode (0,0)).comp entriesProgram) +noncomputable opaque lengthTest (k : ℕ) : Procedure inputCode Procedure.boolCode + (fun x => decide (x.1.length=k)) := + Procedure.binaryEq.comp (lengthProgram.pair (Procedure.constant inputCode Nat.bits k)) +noncomputable opaque sameIndexProgram : Procedure inputCode Procedure.boolCode + (fun x => decide ((entry 0 x).1=(entry 1 x).1)) := + Procedure.binaryEq.comp ((indexProgram 0).pair (indexProgram 1)) + +noncomputable opaque scalarProgram : Procedure inputCode QuantumRawExchange.rawCode + (fun x => scalar x.2) := + (Procedure.constant inputCode (prodCode Procedure.boolCode Procedure.boolCode) (false,false)).pair + ((Procedure.constant inputCode (prodCode Nat.bits Nat.bits) (0,0)).pair + ((Procedure.constant inputCode (prodCode Procedure.boolCode Procedure.boolCode) + (false,false)).pair weightProgram)) + +noncomputable opaque nonzeroFieldProgram (k : ℕ) : + Procedure inputCode QuantumRawExchange.rawCode (fun x => + ((false,true),(((entry k x).1,0),((decide ((entry k x).2=1),false),x.2)))) := + (Procedure.constant inputCode (prodCode Procedure.boolCode Procedure.boolCode) (false,true)).pair + (((indexProgram k).pair (Procedure.constant inputCode Nat.bits 0)).pair + (((labelTest k 1).pair (Procedure.constant inputCode Procedure.boolCode false)).pair + weightProgram)) + +noncomputable opaque fieldProgram (k : ℕ) : Procedure inputCode QuantumRawExchange.rawCode + (fun x => field (entry k x) x.2) := + (Procedure.conditional (labelTest k 0) scalarProgram (nonzeroFieldProgram k)).congrFun (by + intro x + simp only [field,decide_eq_true_eq]) + +noncomputable opaque pairProgram : Procedure inputCode QuantumRawExchange.rawCode + (fun x => pair (entry 0 x) (entry 1 x) x.2) := + (Procedure.constant inputCode (prodCode Procedure.boolCode Procedure.boolCode) (true,false)).pair + (((indexProgram 0).pair (indexProgram 1)).pair + (((labelTest 0 1).pair (labelTest 1 1)).pair weightProgram)) + +def lookupValue (x : Input) : QuantumRawExchange.Raw := + if x.1.length=0 then scalar x.2 else + if x.1.length=1 then field (entry 0 x) x.2 else + if (entry 0 x).1=(entry 1 x).1 then field (entry 0 x) x.2 else + if (entry 0 x).2=0 then field (entry 1 x) x.2 else + if (entry 1 x).2=0 then field (entry 0 x) x.2 else + pair (entry 0 x) (entry 1 x) x.2 + +theorem lookupValue_eq (x : Input) : lookupValue x = value x := by + rcases x with ⟨xs,j⟩ + cases xs with + | nil => rfl + | cons u xs => + cases xs with + | nil => simp [lookupValue,value,entry] + | cons v xs => simp [lookupValue,value,entry] + +noncomputable opaque program : Procedure inputCode QuantumRawExchange.rawCode value := by + let p := Procedure.conditional (lengthTest 0) scalarProgram + (Procedure.conditional (lengthTest 1) (fieldProgram 0) + (Procedure.conditional sameIndexProgram (fieldProgram 0) + (Procedure.conditional (labelTest 0 0) (fieldProgram 1) + (Procedure.conditional (labelTest 1 0) (fieldProgram 0) pairProgram)))) + exact p.congrFun (by + intro x + simpa only [lookupValue,Function.comp_apply,decide_eq_true_eq] using lookupValue_eq x) + +noncomputable def certificate : + Turing.TM2ComputableInPolyTime inputCode QuantumRawExchange.rawCode value := program.toTM2 + +end ContinuumCoulomb.QuantumOrderedRawPacking + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedReference.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedReference.lean new file mode 100644 index 0000000000000000000000000000000000000000..1930fbecd09b2ef4259de961296bb69ccbb1e2fa --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedReference.lean @@ -0,0 +1,66 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSortedTime + +namespace OAI + +/-! A consecutive reference label for the time-ordered actual interaction family. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +def qmaOrderedTermEquiv (c : QMACircuit) (hT : 0 < c.gates.length) + (τ : Fin (c.work+1) → Fin (c.gates.length+1)) : + Fin (qmaHistoryReferenceWork c+1) ≃ QMACircuitTerm c := + (finCongr (qmaOrderedHistoryTerms_length c hT τ).symm).trans + (List.Nodup.getEquivOfForallMemList _ (qmaOrderedHistoryTerms_nodup c hT τ) + (qmaOrderedHistoryTerms_mem c hT τ)) + +theorem qmaOrderedTermEquiv_get (c : QMACircuit) (hT : 0 < c.gates.length) + (τ : Fin (c.work+1) → Fin (c.gates.length+1)) + (i : Fin (qmaHistoryReferenceWork c+1)) : + qmaOrderedTermEquiv c hT τ i = (qmaOrderedHistoryTerms c hT τ)[i.val]'(by + rw [qmaOrderedHistoryTerms_length]; exact i.isLt) := rfl + +def qmaOrderedReferenceTime (c : QMACircuit) (hT : 0 < c.gates.length) + (τ : Fin (c.work+1) → Fin (c.gates.length+1)) + (i : Fin (qmaHistoryReferenceWork c+1)) : Fin c.gates.length := + qmaHistoryTermTime c hT τ (qmaOrderedTermEquiv c hT τ i) + +theorem qmaOrderedReferenceTime_step (c : QMACircuit) (hT : 0 < c.gates.length) + (τ : Fin (c.work+1) → Fin (c.gates.length+1)) (i : Fin (qmaHistoryReferenceWork c)) : + (qmaOrderedReferenceTime c hT τ i.castSucc).val ≤ + (qmaOrderedReferenceTime c hT τ i.succ).val ∧ + (qmaOrderedReferenceTime c hT τ i.succ).val ≤ + (qmaOrderedReferenceTime c hT τ i.castSucc).val+1 := by + let j : Fin (qmaOrderedHistoryTerms c hT τ).length := + i.castSucc.cast (qmaOrderedHistoryTerms_length c hT τ).symm + let k : Fin (qmaOrderedHistoryTerms c hT τ).length := + i.succ.cast (qmaOrderedHistoryTerms_length c hT τ).symm + have hjk : k.val = j.val+1 := rfl + have hle := (qmaOrderedHistoryTerms_sorted c hT τ).rel_getElem_of_lt j.isLt k.isLt + (by change i.val < i.val+1; omega) + have hstep := qmaOrderedHistoryTerms_step c hT τ j k hjk + simp only [qmaOrderedReferenceTime,qmaOrderedTermEquiv_get] + exact ⟨hle,hstep⟩ + +def qmaOrderedSparseReferenceCell (c : QMACircuit) + (hT : 0 < (qmaSparseCircuit c).gates.length) + (i : Fin (qmaHistoryReferenceWork (qmaSparseCircuit c)+1)) : + QMAGridCell (qmaNearestCircuit c).gates.length c.work := + qmaSparseGateCell c (qmaOrderedReferenceTime (qmaSparseCircuit c) hT + (qmaFirstUseTime (qmaSparseCircuit c)) i) + +theorem qmaOrderedSparseReferenceCell_near (c : QMACircuit) + (hT : 0 < (qmaSparseCircuit c).gates.length) + (i : Fin (qmaHistoryReferenceWork (qmaSparseCircuit c))) : + QMAGridCellsNear (qmaOrderedSparseReferenceCell c hT i.castSucc) + (qmaOrderedSparseReferenceCell c hT i.succ) := by + have h := qmaOrderedReferenceTime_step (qmaSparseCircuit c) hT + (qmaFirstUseTime (qmaSparseCircuit c)) i + exact qmaSparseGateCells_near c _ _ (by omega) h.2 + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedSampling.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedSampling.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d9f6d8c0b040c61864737024a73104df97ebcda --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedSampling.lean @@ -0,0 +1,82 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedCoefficient +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliRounding + +namespace OAI + +/-! Sampling the exact ordered-history coefficients controls the actual +full-space ground energy. Odd-Y words are omitted by the proved real +Pauli expansion, leaving at most 4096 words per six-site history term. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumAlgebraicHistory +open QuantumAlgebraicScalar QuantumFixedPauli Matrix +open scoped BigOperators Classical + +abbrev OrderedPauliTerm (c : QMACircuit) (hT : 0 < c.gates.length) := + QMALocalEvenPauliTerm (qmaOrderedHistoryModel c hT).sites + +def orderedWord (c : QMACircuit) (hT : 0 < c.gates.length) + (p : OrderedPauliTerm c hT) := + qmaLocalPauliWord (qmaOrderedHistoryModel c hT).sites p.val + +def orderedRealCoefficient (c : QMACircuit) (hT : 0 < c.gates.length) + (p : OrderedPauliTerm c hT) : RealScalar := + realCoefficient (orderedCore c hT p.val.1) p.val.2 + +theorem orderedRealCoefficient_value (c : QMACircuit) (hT : 0 < c.gates.length) + (p : OrderedPauliTerm c hT) : + realValue (orderedRealCoefficient c hT p) = + qmaLocalPauliCoefficient (qmaOrderedHistoryModel c hT).matrix + (qmaOrderedHistoryModel c hT).sites p.val := + orderedCoefficient_eq c hT p.val.1 p.val.2 + +theorem orderedWord_even (c : QMACircuit) (hT : 0 < c.gates.length) + (p : OrderedPauliTerm c hT) : Even (qmaPauliYCount (orderedWord c hT p)) := + qmaLocalEvenPauli_even _ p + +theorem orderedWord_support (c : QMACircuit) (hT : 0 < c.gates.length) + (p : OrderedPauliTerm c hT) : (qmaPauliSupport (orderedWord c hT p)).card ≤ 6 := + qmaLocalEvenPauli_support _ (qmaOrderedHistoryModel c hT).card p + +theorem orderedWord_count (c : QMACircuit) (hT : 0 < c.gates.length) : + Fintype.card (OrderedPauliTerm c hT) ≤ + 4096*(4*c.gates.length+2*c.work+9) := by + have h := qmaLocalEvenPauli_count (qmaOrderedHistoryModel c hT).sites + (qmaOrderedHistoryModel c hT).card + have he := (qmaOrderedHistoryModel_size c hT).2 + change Fintype.card (OrderedPauliTerm c hT) ≤ 4^6*(qmaOrderedHistoryModel c hT).terms at h + rw [he] at h + norm_num only [show (4:ℕ)^6 = 4096 by norm_num] at h + exact h + +theorem orderedPauli_sum (c : QMACircuit) (hT : 0 < c.gates.length) : + qmaPauliFamily (orderedWord c hT) + (fun p => realValue (orderedRealCoefficient c hT p)) = + ∑ a, (qmaOrderedHistoryModel c hT).matrix a := by + simp only [qmaPauliFamily,orderedWord,orderedRealCoefficient_value] + exact qmaLocalEvenPauli_sum _ _ (qmaOrderedHistoryModel c hT).localOn + (qmaOrderedHistoryModel c hT).hermitian (qmaOrderedHistoryModel c hT).real + +def sampledOrderedWeight (k : ℕ) (c : QMACircuit) (hT : 0 < c.gates.length) + (p : OrderedPauliTerm c hT) : ℚ := + sample k (orderedRealCoefficient c hT p) + +theorem sampledOrdered_error (k : ℕ) (c : QMACircuit) (hT : 0 < c.gates.length) : + |MediatorGraph.normalizedBottom + (qmaPauliFamily (orderedWord c hT) (fun p => (sampledOrderedWeight k c hT p:ℝ))) - + (qmaOrderedHistoryModel c hT).energy| ≤ + ∑ p : OrderedPauliTerm c hT, + |((orderedRealCoefficient c hT p).2:ℝ)| * (2:ℝ)⁻¹^k := by + change |MediatorGraph.normalizedBottom _ - + MediatorGraph.normalizedBottom (∑ a, (qmaOrderedHistoryModel c hT).matrix a)| ≤ _ + rw [← orderedPauli_sum] + apply (qmaPauliFamily_ground_error _ _ _).trans + apply Finset.sum_le_sum + intro p _ + exact QuantumAlgebraicScalar.sample_error k (orderedRealCoefficient c hT p) + +end ContinuumCoulomb.QuantumAlgebraicHistory + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedSourceIndex.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedSourceIndex.lean new file mode 100644 index 0000000000000000000000000000000000000000..76274066e5704cb5b69d4264f0943ccaf29169a0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedSourceIndex.lean @@ -0,0 +1,65 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelTable +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedHistory + +namespace OAI + +/-! Explicit finite sum/product indices for the history qubits and padded +terms. Their natural values are the literal support-list site numbers. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedSourceIndex +open scoped Classical + +def qubitCount (c : QMACircuit) : ℕ := + qmaHistoryReferenceWork c+1+((c.gates.length+2)+(c.work+1)) + +def qubits (c : QMACircuit) : Fin (qubitCount c) ≃ QuantumOrderedSupport.Qubit c := + finSumFinEquiv.symm.trans + (Equiv.sumCongr (Equiv.refl _) (finSumFinEquiv.symm)) + +theorem qubitCount_eq (c : QMACircuit) : qubitCount c=3*c.gates.length+2*c.work+8 := by + simp only [qubitCount,qmaHistoryReferenceWork] + omega + +theorem qubits_index (c : QMACircuit) : + QuantumOrderedLabelTable.index (qubits c)=QuantumOrderedSupport.siteNumber c := by + funext i + rcases i with i | (i | i) + · rfl + · rfl + · change qmaHistoryReferenceWork c+1+((c.gates.length+2)+i.val) = + qmaHistoryReferenceWork c+1+(c.gates.length+2)+i.val + omega + +def referenceCount (c : QMACircuit) : ℕ := + (qmaHistoryReferenceWork c+1)+qmaHistoryReferenceWork c + +def reference (c : QMACircuit) : + Fin (referenceCount c) ≃ QMAReferenceTerm (qmaHistoryReferenceWork c) := + finSumFinEquiv.symm + +theorem referenceCount_eq (c : QMACircuit) : + referenceCount c=4*c.gates.length+2*c.work+9 := by + simp only [referenceCount,qmaHistoryReferenceWork] + omega + +abbrev Pattern := Fin 6 → Fin 4 +def patternCount : ℕ := Fintype.card Pattern +noncomputable def patterns : Fin patternCount ≃ Pattern := (Fintype.equivFin Pattern).symm + +def termCount (c : QMACircuit) : ℕ := referenceCount c*patternCount +noncomputable def terms (c : QMACircuit) : Fin (termCount c) ≃ QuantumPaddedHistory.Term c := + finProdFinEquiv.symm.trans (Equiv.prodCongr (reference c) patterns) + +theorem termCount_eq (c : QMACircuit) : + termCount c=4096*(4*c.gates.length+2*c.work+9) := by + rw [termCount,referenceCount_eq] + have h : patternCount=4096 := by + norm_num [patternCount,Pattern,Fintype.card_fun] + rw [h,Nat.mul_comm] + +end ContinuumCoulomb.QuantumOrderedSourceIndex + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedSpatial.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedSpatial.lean new file mode 100644 index 0000000000000000000000000000000000000000..40cb2682f72c59cd196854aa02c3281769443b4c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedSpatial.lean @@ -0,0 +1,147 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedSpatialSites +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialSubdivision + +namespace OAI + +/-! Exact cell maps for the five literal early stages. No vertex or term +enumeration is changed while assigning the mediator cells. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedSpatial +open QuantumOrderedXZ +open scoped Classical + +variable {ι κ : Type} {rows width : ℕ} + +def anchor1 (anchor : κ → QMAGridCell rows width) (p : κ × Fin 4) := anchor p.1 +def anchor2 (anchor : κ → QMAGridCell rows width) (p : ThreeTerm κ) := anchor1 anchor p.1 +def anchor3 (anchor : κ → QMAGridCell rows width) (p : TwoTerm κ) := anchor2 anchor p.1 +def anchor4 (anchor : κ → QMAGridCell rows width) (p : XZThreeTerm κ) := anchor3 anchor p.1 +def outputAnchor (anchor : κ → QMAGridCell rows width) (p : OutputTerm κ) := anchor4 anchor p.1 + +def cell1 (cell : ι → QMAGridCell rows width) (anchor : κ → QMAGridCell rows width) := + qmaMediatorCell cell anchor +def cell2 (cell : ι → QMAGridCell rows width) (anchor : κ → QMAGridCell rows width) := + qmaMediatorCell (cell1 cell anchor) (anchor1 anchor) +def cell3 (cell : ι → QMAGridCell rows width) (anchor : κ → QMAGridCell rows width) := + qmaMediatorCell (cell2 cell anchor) (anchor2 anchor) +def cell4 (cell : ι → QMAGridCell rows width) (anchor : κ → QMAGridCell rows width) := + qmaMediatorCell (cell3 cell anchor) (anchor3 anchor) +def outputCell (cell : ι → QMAGridCell rows width) (anchor : κ → QMAGridCell rows width) := + qmaMediatorCell (cell4 cell anchor) (anchor4 anchor) + +variable [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +theorem output_near (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 6) + (cell : ι → QMAGridCell rows width) (anchor : κ → QMAGridCell rows width) + (h : Near xs cell anchor) : + Near (QuantumOrderedXZ.sites xs w) (outputCell cell anchor) (outputAnchor anchor) := by + have h1 : Near (QuantumOrderedTwoStage.firstSites xs) (cell1 cell anchor) (anchor1 anchor) := + subdivision_near xs 3 cell anchor h + have h2 : Near (threeSites xs) (cell2 cell anchor) (anchor2 anchor) := + subdivision_near (QuantumOrderedTwoStage.firstSites xs) 2 _ _ h1 + have h3 : Near (twoSites xs w) (cell3 cell anchor) (anchor3 anchor) := + third_near (threeSites xs) (threeWord xs w) (threeSites_length xs hlen) _ _ h2 + have h4 : Near (xzThreeSites xs w) (cell4 cell anchor) (anchor4 anchor) := + yy_near (twoSites xs w) _ _ h3 + exact third_near (xzThreeSites xs w) (xzThreeWord xs w) + (xzThreeSites_length xs w hlen) _ _ h4 + +omit [DecidableEq κ] in +private theorem anchor1_card (anchor : κ → QMAGridCell rows width) + (p : QMAGridCell rows width) : + (Finset.univ.filter (fun e : κ × Fin 4 => anchor1 anchor e = p)).card = + 4*(Finset.univ.filter (fun e : κ => anchor e = p)).card := + qmaProdFilter_card 4 (fun e => anchor e = p) + +omit [DecidableEq κ] in +private theorem anchor2_card (anchor : κ → QMAGridCell rows width) + (p : QMAGridCell rows width) : + (Finset.univ.filter (fun e : ThreeTerm κ => anchor2 anchor e = p)).card = + 16*(Finset.univ.filter (fun e : κ => anchor e = p)).card := by + calc + _ = 4*(Finset.univ.filter (fun e : κ × Fin 4 => anchor1 anchor e = p)).card := + qmaProdFilter_card 4 (fun e => anchor1 anchor e = p) + _ = _ := by rw [anchor1_card]; omega + +omit [DecidableEq κ] in +private theorem anchor3_card (anchor : κ → QMAGridCell rows width) + (p : QMAGridCell rows width) : + (Finset.univ.filter (fun e : TwoTerm κ => anchor3 anchor e = p)).card = + 112*(Finset.univ.filter (fun e : κ => anchor e = p)).card := by + calc + _ = 7*(Finset.univ.filter (fun e : ThreeTerm κ => anchor2 anchor e = p)).card := + qmaProdFilter_card 7 (fun e => anchor2 anchor e = p) + _ = _ := by rw [anchor2_card]; omega + +omit [DecidableEq κ] in +private theorem anchor4_card (anchor : κ → QMAGridCell rows width) + (p : QMAGridCell rows width) : + (Finset.univ.filter (fun e : XZThreeTerm κ => anchor4 anchor e = p)).card = + 448*(Finset.univ.filter (fun e : κ => anchor e = p)).card := by + calc + _ = 4*(Finset.univ.filter (fun e : TwoTerm κ => anchor3 anchor e = p)).card := + qmaProdFilter_card 4 (fun e => anchor3 anchor e = p) + _ = _ := by rw [anchor3_card]; omega + +omit [DecidableEq κ] in +theorem outputAnchor_card (anchor : κ → QMAGridCell rows width) + (p : QMAGridCell rows width) : + (Finset.univ.filter (fun e : OutputTerm κ => outputAnchor anchor e = p)).card = + 3136*(Finset.univ.filter (fun e : κ => anchor e = p)).card := by + calc + _ = 7*(Finset.univ.filter (fun e : XZThreeTerm κ => anchor4 anchor e = p)).card := + qmaProdFilter_card 7 (fun e => anchor4 anchor e = p) + _ = _ := by rw [anchor4_card]; omega + +omit [DecidableEq ι] [DecidableEq κ] in +theorem outputCell_card (cell : ι → QMAGridCell rows width) + (anchor : κ → QMAGridCell rows width) (p : QMAGridCell rows width) : + (Finset.univ.filter (fun q : OutputQubit ι κ => outputCell cell anchor q = p)).card = + (Finset.univ.filter (fun q : ι => cell q = p)).card+ + 581*(Finset.univ.filter (fun e : κ => anchor e = p)).card := by + have h1 : (Finset.univ.filter (fun q => cell1 cell anchor q = p)).card = + (Finset.univ.filter (fun q => cell q = p)).card+ + (Finset.univ.filter (fun e => anchor e = p)).card := + qmaSumFilter_card (fun q => cell1 cell anchor q = p) + have h2 : (Finset.univ.filter (fun q => cell2 cell anchor q = p)).card = + (Finset.univ.filter (fun q => cell1 cell anchor q = p)).card+ + (Finset.univ.filter (fun e => anchor1 anchor e = p)).card := + qmaSumFilter_card (fun q => cell2 cell anchor q = p) + have h3 : (Finset.univ.filter (fun q => cell3 cell anchor q = p)).card = + (Finset.univ.filter (fun q => cell2 cell anchor q = p)).card+ + (Finset.univ.filter (fun e => anchor2 anchor e = p)).card := + qmaSumFilter_card (fun q => cell3 cell anchor q = p) + have h4 : (Finset.univ.filter (fun q => cell4 cell anchor q = p)).card = + (Finset.univ.filter (fun q => cell3 cell anchor q = p)).card+ + (Finset.univ.filter (fun e => anchor3 anchor e = p)).card := + qmaSumFilter_card (fun q => cell4 cell anchor q = p) + calc + _ = (Finset.univ.filter (fun q => cell4 cell anchor q = p)).card+ + (Finset.univ.filter (fun e => anchor4 anchor e = p)).card := + qmaSumFilter_card (fun q => outputCell cell anchor q = p) + _ = _ := by rw [h4,h3,h2,h1,anchor1_card,anchor2_card,anchor3_card,anchor4_card]; omega + +omit [DecidableEq ι] [DecidableEq κ] in +theorem output_density (cell : ι → QMAGridCell rows width) + (anchor : κ → QMAGridCell rows width) {A B : ℕ} + (hc : ∀ p, (Finset.univ.filter (fun q => cell q = p)).card ≤ A) + (ha : ∀ p, (Finset.univ.filter (fun e => anchor e = p)).card ≤ B) : + (∀ p, (Finset.univ.filter (fun q : OutputQubit ι κ => outputCell cell anchor q = p)).card + ≤ A+581*B) ∧ + (∀ p, (Finset.univ.filter (fun e : OutputTerm κ => outputAnchor anchor e = p)).card + ≤ 3136*B) := by + constructor + · intro p + rw [outputCell_card] + exact Nat.add_le_add (hc p) (Nat.mul_le_mul_left _ (ha p)) + · intro p + rw [outputAnchor_card] + exact Nat.mul_le_mul_left _ (ha p) + +end ContinuumCoulomb.QuantumOrderedSpatial + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedSpatialComplete.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedSpatialComplete.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce2bc1573ecdeef2fb245671d250636820340b1d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedSpatialComplete.lean @@ -0,0 +1,115 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedIncidence +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourSpatial + +namespace OAI + +/-! Spatial data for the literal ordered six-stage compiler. A mediator is +placed in its parent term's cell, and each emitted term retains that anchor. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedSpatialComplete +open scoped Classical +variable {ι κ C : Type} + +def extendCell (cell : ι → C) (anchor : κ → C) : ι ⊕ κ → C := Sum.elim cell anchor +def extendAnchor (d : ℕ) (anchor : κ → C) : κ × Fin d → C := fun p => anchor p.1 + +theorem extension_geometry {d : ℕ} (xs : κ → List ι) + (ys : κ × Fin d → List (ι ⊕ κ)) (cell : ι → C) (anchor : κ → C) + (R : C → C → Prop) (hR : ∀ p, R p p) + (hx : ∀ e q, q ∈ xs e → R (cell q) (anchor e)) + (hy : ∀ e q, q ∈ ys e → QuantumOrderedIncidence.Origin xs e.1 q) : + ∀ e q, q ∈ ys e → R (extendCell cell anchor q) (extendAnchor d anchor e) := by + intro e q hq + have ho := hy e q hq + cases q with + | inl q => exact hx e.1 q ho + | inr q => + change q=e.1 at ho + subst q + exact hR _ + +theorem extendCell_density [Fintype ι] [Fintype κ] (cell : ι → C) (anchor : κ → C) + {A B : ℕ} (hc : ∀ p, (Finset.univ.filter (fun q => cell q=p)).card ≤ A) + (ha : ∀ p, (Finset.univ.filter (fun e => anchor e=p)).card ≤ B) (p : C) : + (Finset.univ.filter (fun q => extendCell cell anchor q=p)).card ≤ A+B := by + rw [qmaSumFilter_card] + exact Nat.add_le_add (hc p) (ha p) + +theorem extendAnchor_density [Fintype κ] (d : ℕ) (anchor : κ → C) {B : ℕ} + (ha : ∀ p, (Finset.univ.filter (fun e => anchor e=p)).card ≤ B) (p : C) : + (Finset.univ.filter (fun e => extendAnchor d anchor e=p)).card ≤ d*B := by + change (Finset.univ.filter (fun e : κ × Fin d => anchor e.1=p)).card ≤ _ + rw [qmaProdFilter_card d (fun e : κ => anchor e=p)] + exact Nat.mul_le_mul_left d (ha p) + +def cell1 (cell : ι → C) (anchor : κ → C) := extendCell cell anchor +def anchor1 (anchor : κ → C) := extendAnchor 4 anchor +def cell2 (cell : ι → C) (anchor : κ → C) := extendCell (cell1 cell anchor) (anchor1 anchor) +def anchor2 (anchor : κ → C) := extendAnchor 4 (anchor1 anchor) +def cell3 (cell : ι → C) (anchor : κ → C) := extendCell (cell2 cell anchor) (anchor2 anchor) +def anchor3 (anchor : κ → C) := extendAnchor 7 (anchor2 anchor) +def cell4 (cell : ι → C) (anchor : κ → C) := extendCell (cell3 cell anchor) (anchor3 anchor) +def anchor4 (anchor : κ → C) := extendAnchor 4 (anchor3 anchor) +def cell5 (cell : ι → C) (anchor : κ → C) := extendCell (cell4 cell anchor) (anchor4 anchor) +def anchor5 (anchor : κ → C) := extendAnchor 7 (anchor4 anchor) +def cell6 (cell : ι → C) (anchor : κ → C) := extendCell (cell5 cell anchor) (anchor5 anchor) +def anchor6 (anchor : κ → C) := extendAnchor 4 (anchor5 anchor) + +variable [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +theorem complete_geometry (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 6) (cell : ι → C) (anchor : κ → C) + (R : C → C → Prop) (hR : ∀ p, R p p) + (hx : ∀ e q, q ∈ xs e → R (cell q) (anchor e)) : + ∀ e q, q ∈ QuantumOrderedPrivate.outputSites (QuantumOrderedXZ.sites xs w) e → + R (cell6 cell anchor q) (anchor6 anchor e) := by + have h1 := extension_geometry xs _ cell anchor R hR hx + (QuantumOrderedIncidence.subdivision_origin xs 3) + have h2 := extension_geometry (QuantumOrderedSubdivision.outputSites xs 3) _ + (cell1 cell anchor) (anchor1 anchor) R hR h1 + (QuantumOrderedIncidence.subdivision_origin (QuantumOrderedSubdivision.outputSites xs 3) 2) + have h3 := extension_geometry (QuantumOrderedXZ.threeSites xs) (QuantumOrderedXZ.twoSites xs w) + (cell2 cell anchor) (anchor2 anchor) R hR h2 + (QuantumOrderedIncidence.third_origin (QuantumOrderedXZ.threeSites xs) + (QuantumOrderedXZ.threeWord xs w) (QuantumOrderedXZ.threeSites_length xs hlen)) + have h4 := extension_geometry (QuantumOrderedXZ.twoSites xs w) _ + (cell3 cell anchor) (anchor3 anchor) R hR h3 + (QuantumOrderedIncidence.yy_origin _) + have h5 := extension_geometry (QuantumOrderedXZ.xzThreeSites xs w) (QuantumOrderedXZ.sites xs w) + (cell4 cell anchor) (anchor4 anchor) R hR h4 + (QuantumOrderedIncidence.third_origin (QuantumOrderedXZ.xzThreeSites xs w) + (QuantumOrderedXZ.xzThreeWord xs w) (QuantumOrderedXZ.xzThreeSites_length xs w hlen)) + exact extension_geometry (QuantumOrderedXZ.sites xs w) _ + (cell5 cell anchor) (anchor5 anchor) R hR h5 + (QuantumOrderedIncidence.subdivision_origin _ 1) + +omit [DecidableEq ι] [DecidableEq κ] in +theorem complete_density (cell : ι → C) (anchor : κ → C) {A B : ℕ} + (hc : ∀ p, (Finset.univ.filter (fun q => cell q=p)).card ≤ A) + (ha : ∀ p, (Finset.univ.filter (fun e => anchor e=p)).card ≤ B) : + (∀ p, (Finset.univ.filter (fun q => cell6 cell anchor q=p)).card ≤ A+3717*B) ∧ + (∀ p, (Finset.univ.filter (fun e => anchor6 anchor e=p)).card ≤ 12544*B) := by + have hc1 := extendCell_density cell anchor hc ha + have ha1 := extendAnchor_density 4 anchor ha + have hc2 := extendCell_density (cell1 cell anchor) (anchor1 anchor) hc1 ha1 + have ha2 := extendAnchor_density 4 (anchor1 anchor) ha1 + have hc3 := extendCell_density (cell2 cell anchor) (anchor2 anchor) hc2 ha2 + have ha3 := extendAnchor_density 7 (anchor2 anchor) ha2 + have hc4 := extendCell_density (cell3 cell anchor) (anchor3 anchor) hc3 ha3 + have ha4 := extendAnchor_density 4 (anchor3 anchor) ha3 + have hc5 := extendCell_density (cell4 cell anchor) (anchor4 anchor) hc4 ha4 + have ha5 := extendAnchor_density 7 (anchor4 anchor) ha4 + have hc6 := extendCell_density (cell5 cell anchor) (anchor5 anchor) hc5 ha5 + have ha6 := extendAnchor_density 4 (anchor5 anchor) ha5 + constructor + · intro p + exact (hc6 p).trans (by omega) + · intro p + exact (ha6 p).trans (by omega) + +end ContinuumCoulomb.QuantumOrderedSpatialComplete + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedSpatialSites.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedSpatialSites.lean new file mode 100644 index 0000000000000000000000000000000000000000..2bda8b329dfede3e20fc68d7c1591ef986c3875b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedSpatialSites.lean @@ -0,0 +1,114 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedXZPipeline +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumMediatorGeometry + +namespace OAI + +/-! The literal early compiler places each mediator at the anchor of its +source word. These geometric statements retain the exact ordered word types. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedSpatial +open QuantumOrderedSubdivision +open scoped Classical + +variable {ι κ : Type} {rows width : ℕ} + +def Near (xs : κ → List ι) (cell : ι → QMAGridCell rows width) + (anchor : κ → QMAGridCell rows width) : Prop := + ∀ e, ∀ i ∈ xs e, QMAGridCellsNear (cell i) (anchor e) + +theorem map_near (cell : ι → QMAGridCell rows width) + (anchor : κ → QMAGridCell rows width) (e : κ) (xs : List ι) + (h : ∀ i ∈ xs, QMAGridCellsNear (cell i) (anchor e)) : + ∀ q ∈ xs.map (Sum.inl : ι → ι ⊕ κ), + QMAGridCellsNear (qmaMediatorCell cell anchor q) (anchor e) := by + intro q hq + obtain ⟨i,hi,rfl⟩ := List.mem_map.mp hq + exact h i hi + +theorem append_near (cell : ι → QMAGridCell rows width) + (anchor : κ → QMAGridCell rows width) (e : κ) (xs : List ι) + (h : ∀ i ∈ xs, QMAGridCellsNear (cell i) (anchor e)) : + ∀ q ∈ appendMediator xs e, + QMAGridCellsNear (qmaMediatorCell cell anchor q) (anchor e) := by + intro q hq + rcases List.mem_append.mp hq with hq | hq + · exact map_near cell anchor e xs h q hq + · have he : q = Sum.inr e := by simpa only [List.mem_singleton] using hq + subst q + exact qmaGridCellsNear_refl _ + +theorem subdivision_near (xs : κ → List ι) (d : ℕ) + (cell : ι → QMAGridCell rows width) (anchor : κ → QMAGridCell rows width) + (h : Near xs cell anchor) : + Near (QuantumOrderedSubdivision.outputSites xs d) (qmaMediatorCell cell anchor) + (fun p => anchor p.1) := by + rintro ⟨e,k⟩ q hq + fin_cases k + · exact False.elim (List.not_mem_nil hq) + · change q ∈ [Sum.inr e] at hq + have he : q = Sum.inr e := List.mem_singleton.mp hq + subst q + exact qmaGridCellsNear_refl _ + · exact append_near cell anchor e ((xs e).take d) + (fun i hi => h e i (List.mem_of_mem_take hi)) q hq + · exact append_near cell anchor e ((xs e).drop d) + (fun i hi => h e i (List.mem_of_mem_drop hi)) q hq + +variable [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +omit [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] in +theorem third_near (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 3) + (cell : ι → QMAGridCell rows width) (anchor : κ → QMAGridCell rows width) + (h : Near xs cell anchor) : + Near (QuantumOrderedThird.outputSites xs w) (qmaMediatorCell cell anchor) + (fun p => anchor p.1) := by + rintro ⟨e,k⟩ q hq + have hp : ∀ i ∈ (QuantumOrderedTriple.partition (xs e) (w e)).1, + QMAGridCellsNear (cell i) (anchor e) := by + intro i hi + apply h e i + exact (QuantumOrderedTriple.partition_spec (xs e) (w e) (hlen e)).1.mem_iff.mp + (List.mem_append_left _ hi) + have hr : ∀ i ∈ (QuantumOrderedTriple.partition (xs e) (w e)).2, + QMAGridCellsNear (cell i) (anchor e) := by + intro i hi + apply h e i + exact (QuantumOrderedTriple.partition_spec (xs e) (w e) (hlen e)).1.mem_iff.mp + (List.mem_append_right _ hi) + fin_cases k + · exact False.elim (List.not_mem_nil hq) + · change q ∈ [Sum.inr e] at hq + have he : q = Sum.inr e := List.mem_singleton.mp hq + subst q + exact qmaGridCellsNear_refl _ + · exact map_near cell anchor e _ hp q hq + · exact map_near cell anchor e _ hr q hq + · exact append_near cell anchor e _ hr q hq + · exact append_near cell anchor e _ + (fun i hi => hp i (List.mem_of_mem_take hi)) q hq + · exact append_near cell anchor e _ + (fun i hi => hp i (List.mem_of_mem_drop hi)) q hq + +omit [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] in +theorem yy_near (xs : κ → List ι) + (cell : ι → QMAGridCell rows width) (anchor : κ → QMAGridCell rows width) + (h : Near xs cell anchor) : + Near (QuantumOrderedYY.outputSites xs) (qmaMediatorCell cell anchor) + (fun p => anchor p.1) := by + rintro ⟨e,k⟩ q hq + fin_cases k + · exact False.elim (List.not_mem_nil hq) + · change q ∈ [Sum.inr e] at hq + have he : q = Sum.inr e := List.mem_singleton.mp hq + subst q + exact qmaGridCellsNear_refl _ + · exact append_near cell anchor e _ (h e) q hq + · exact append_near cell anchor e _ (h e) q hq + +end ContinuumCoulomb.QuantumOrderedSpatial + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedSplit.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedSplit.lean new file mode 100644 index 0000000000000000000000000000000000000000..ea137f6aa954f76a8e9aa27541164680cebc6060 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedSplit.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEntryParity + +namespace OAI + +/-! Deterministic balanced support factors. The actual compiler carries +ordered lists of sites and splits them with take/drop; no chosen finite +subset is needed by either subdivision stage. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedSplit +open Matrix +open scoped BigOperators Classical +variable {ι : Type} [Fintype ι] [DecidableEq ι] + +def left (xs : List ι) (d : ℕ) : Finset ι := (xs.take d).toFinset +def right (xs : List ι) (d : ℕ) : Finset ι := (xs.drop d).toFinset + +omit [Fintype ι] in +theorem union (xs : List ι) (d : ℕ) : left xs d ∪ right xs d = xs.toFinset := by + rw [left,right,← List.toFinset_append,List.take_append_drop] + +omit [Fintype ι] in +theorem disjoint (xs : List ι) (hx : xs.Nodup) (d : ℕ) : + Disjoint (left xs d) (right xs d) := by + apply List.disjoint_toFinset_iff_disjoint.mpr + apply List.disjoint_of_nodup_append + simpa only [List.take_append_drop] using hx + +omit [Fintype ι] in +theorem left_card (xs : List ι) (d : ℕ) : (left xs d).card ≤ d := by + exact (List.toFinset_card_le _).trans (by simp) + +omit [Fintype ι] in +theorem right_card (xs : List ι) (d : ℕ) (hx : xs.length ≤ 2*d) : + (right xs d).card ≤ d := by + apply (List.toFinset_card_le _).trans + rw [List.length_drop] + omega + +def firstWord (xs : List ι) (d : ℕ) (w : ι → Fin 4) : ι → Fin 4 := + qmaPauliRestrict (left xs d) w + +def secondWord (xs : List ι) (d : ℕ) (w : ι → Fin 4) : ι → Fin 4 := + qmaPauliRestrict (right xs d) w + +theorem first_support (xs : List ι) (d : ℕ) (w : ι → Fin 4) : + (qmaPauliSupport (firstWord xs d w)).card ≤ d := + (Finset.card_le_card (qmaPauliRestrict_support _ _)).trans (left_card xs d) + +theorem second_support (xs : List ι) (d : ℕ) (w : ι → Fin 4) + (hx : xs.length ≤ 2*d) : (qmaPauliSupport (secondWord xs d w)).card ≤ d := + (Finset.card_le_card (qmaPauliRestrict_support _ _)).trans (right_card xs d hx) + +theorem factor (xs : List ι) (hx : xs.Nodup) (d : ℕ) (w : ι → Fin 4) + (hw : qmaPauliSupport w ⊆ xs.toFinset) : + qmaPauliWord (firstWord xs d w)*qmaPauliWord (secondWord xs d w) = qmaPauliWord w := by + apply qmaPauliRestrict_factor _ _ _ (disjoint xs hx d) + rwa [union] + +theorem commute (xs : List ι) (hx : xs.Nodup) (d : ℕ) (w : ι → Fin 4) : + qmaPauliWord (firstWord xs d w)*qmaPauliWord (secondWord xs d w) = + qmaPauliWord (secondWord xs d w)*qmaPauliWord (firstWord xs d w) := + qmaPauliRestrict_commute _ _ _ (disjoint xs hx d) + +theorem same_parity (xs : List ι) (hx : xs.Nodup) (d : ℕ) (w : ι → Fin 4) + (hw : qmaPauliSupport w ⊆ xs.toFinset) (he : Even (qmaPauliYCount w)) : + decide (Odd (qmaPauliYCount (firstWord xs d w))) = + decide (Odd (qmaPauliYCount (secondWord xs d w))) := by + apply qmaPauliRestrict_same_parity _ _ _ (disjoint xs hx d) _ he + rwa [union] + +end ContinuumCoulomb.QuantumOrderedSplit + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedSubdivision.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedSubdivision.lean new file mode 100644 index 0000000000000000000000000000000000000000..98c53b4da34626b98d9444c5647671d5637039b6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedSubdivision.lean @@ -0,0 +1,100 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPolarizedSubdivision +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionGadget +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliRounding + +namespace OAI + +/-! An explicit simultaneous subdivision of an ordered rational Pauli +family. This is the actual four-word Hamiltonian, with a rational scale +and a full-space ground-energy estimate. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedSubdivision +open Matrix +open scoped BigOperators Classical +variable {ι κ : Type} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +def budget (J : κ → ℚ) : ℚ := 4*(1+∑ e, (1+|J e|)^2) +def scale (J : κ → ℚ) (N : ℕ) : ℚ := 8*(budget J)^4*N + +omit [DecidableEq κ] in +theorem budget_cast (J : κ → ℚ) : + (budget J:ℝ) = qmaThirdBudget 0 (fun e => (J e:ℝ)) := by + simp [budget,qmaThirdBudget,qmaThirdWeight] + +omit [DecidableEq κ] in +theorem scale_cast (J : κ → ℚ) (N : ℕ) : + (scale J N:ℝ) = 8*(qmaThirdBudget 0 (fun e => (J e:ℝ)))^4*N := by + simp [scale,budget_cast] + +def phase (xs : κ → List ι) (d : ℕ) (w : κ → ι → Fin 4) : κ → Bool := + fun e => decide (Odd (qmaPauliYCount (QuantumOrderedSplit.firstWord (xs e) d (w e)))) + +def outputWord (xs : κ → List ι) (d : ℕ) (w : κ → ι → Fin 4) : + κ × Fin 4 → (ι ⊕ κ → Fin 4) := + fun p => QuantumPolarizedSubdivision.word + (QuantumOrderedSplit.firstWord (xs p.1) d (w p.1)) + (QuantumOrderedSplit.secondWord (xs p.1) d (w p.1)) p.1 (phase xs d w) p.2 + +def outputCoefficient (J : κ → ℚ) (N : ℕ) (p : κ × Fin 4) : ℚ := + QuantumPolarizedSubdivision.weight (scale J N) (J p.1) p.2 + +theorem output_support (xs : κ → List ι) (d : ℕ) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 2*d) (p : κ × Fin 4) : + (qmaPauliSupport (outputWord xs d w p)).card ≤ d+1 := + QuantumPolarizedSubdivision.support _ _ _ _ + (QuantumOrderedSplit.first_support (xs p.1) d (w p.1)) + (QuantumOrderedSplit.second_support (xs p.1) d (w p.1) (hlen p.1)) p.2 + +theorem output_even (xs : κ → List ι) (d : ℕ) (w : κ → ι → Fin 4) + (hxs : ∀ e, (xs e).Nodup) + (hcover : ∀ e, qmaPauliSupport (w e) ⊆ (xs e).toFinset) + (he : ∀ e, Even (qmaPauliYCount (w e))) (p : κ × Fin 4) : + Even (qmaPauliYCount (outputWord xs d w p)) := by + exact QuantumPolarizedSubdivision.even + (QuantumOrderedSplit.firstWord (xs p.1) d (w p.1)) + (QuantumOrderedSplit.secondWord (xs p.1) d (w p.1)) p.1 (phase xs d w) rfl + (QuantumOrderedSplit.same_parity (xs p.1) (hxs p.1) d (w p.1) + (hcover p.1) (he p.1)) p.2 + +theorem output_accuracy (xs : κ → List ι) (d : ℕ) (w : κ → ι → Fin 4) + (J : κ → ℚ) (hxs : ∀ e, (xs e).Nodup) + (hcover : ∀ e, qmaPauliSupport (w e) ⊆ (xs e).toFinset) + (N : ℕ) (hN : 1 ≤ N) : + |MediatorGraph.normalizedBottom + (qmaPauliFamily (outputWord xs d w) (fun p => (outputCoefficient J N p:ℝ)))- + MediatorGraph.normalizedBottom (qmaPauliFamily w (fun e => (J e:ℝ)))| ≤ 1/(N:ℝ) := by + let A := fun e => qmaPauliWord (QuantumOrderedSplit.firstWord (xs e) d (w e)) + let B := fun e => qmaPauliWord (QuantumOrderedSplit.secondWord (xs e) d (w e)) + let m := phase xs d w + have hAB (e : κ) : A e*B e = B e*A e := + QuantumOrderedSplit.commute (xs e) (hxs e) d (w e) + have hfactor (e : κ) : A e*B e = qmaPauliWord (w e) := + QuantumOrderedSplit.factor (xs e) (hxs e) d (w e) (hcover e) + have hsum : qmaPauliFamily (outputWord xs d w) (fun p => (outputCoefficient J N p:ℝ)) = + qmaSubdivisionOnQubits 0 A B (scale J N:ℝ) (fun e => (J e:ℝ)) m := by + have hc (q : ℚ) : ((q:ℝ):ℂ) = (q:ℂ) := by norm_cast + simp only [qmaPauliFamily,Fintype.sum_prod_type,outputWord,outputCoefficient,hc] + simp_rw [QuantumPolarizedSubdivision.sum_eq] + unfold qmaSubdivisionOnQubits + rw [qmaSubdivisionPolarized_decomposition] + simp only [Matrix.zero_kronecker,zero_add,MediatorGraph.submatrix_sum, + qmaSubdivisionPiece_reindex] + rfl + have htarget : qmaSubdivisionTarget 0 A B (fun e => ((J e:ℝ):ℂ)) = + qmaPauliFamily w (fun e => (J e:ℝ)) := by + simp only [qmaSubdivisionTarget,zero_add,hfactor,qmaPauliFamily] + rw [hsum,qmaSubdivisionOnQubits_bottom,← htarget] + have hNR : (1:ℝ) ≤ N := by exact_mod_cast hN + have h := qmaSubdivision_polynomial_accuracy 0 A B (fun e => (J e:ℝ)) + (by norm_num : (0:ℝ) ≤ 0) hNR Matrix.conjTranspose_zero (by simp) + (fun e => qmaPauliWord_hermitian _) (fun e => qmaPauliWord_hermitian _) + (fun e => qmaPauliWord_square _) (fun e => qmaPauliWord_square _) hAB + (EuclideanSpace.single (fun _ : ι => (0:Fin 2)) (1:ℂ)) (by simp [PiLp.norm_single]) + simpa only [scale_cast] using h + +end ContinuumCoulomb.QuantumOrderedSubdivision + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedSupport.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..6d87ce10a7cc664da9c13a0320558fae4c3d4de1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedSupport.lean @@ -0,0 +1,174 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedModel +import Mathlib.Data.List.NodupEquivFin + +namespace OAI + +/-! Literal short support lists for the time-ordered history compiler. +The list order, duplicate removal, and local-coordinate equivalence are +explicit; no arbitrary finite-type enumeration enters the input algorithm. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedSupport +open scoped Classical + +def gateSites (work : ℕ) : QMAGate → List (Fin (work+1)) + | .hadamard i => [qmaQubit work i] + | .phaseT i => [qmaQubit work i] + | .controlledNot i j => [qmaQubit work i,qmaQubit work j] + +theorem gateSites_finset (work : ℕ) (g : QMAGate) : + (gateSites work g).toFinset = qmaGateSites work g := by + cases g <;> simp [gateSites,qmaGateSites] + +theorem gateSites_length (work : ℕ) (g : QMAGate) : (gateSites work g).length ≤ 2 := by + cases g <;> simp [gateSites] + +def propagationSites (c : QMACircuit) (t : Fin c.gates.length) : List (QMACircuitQubit c) := + [Sum.inl (qmaClockLeft c.gates.length t),Sum.inl (qmaClockMiddle c.gates.length t), + Sum.inl (qmaClockRight c.gates.length t)] ++ + (gateSites c.work (c.gates.getD t.val (.hadamard 0))).map Sum.inr + +theorem propagationSites_finset (c : QMACircuit) (t : Fin c.gates.length) : + (propagationSites c t).toFinset = qmaPropagationSites c t := by + ext i + simp [propagationSites,qmaPropagationSites,← gateSites_finset,Finset.mem_map] + +theorem propagationSites_length (c : QMACircuit) (t : Fin c.gates.length) : + (propagationSites c t).length ≤ 5 := by + have h := gateSites_length c.work (c.gates.getD t.val (.hadamard 0)) + simpa only [propagationSites,List.length_append,List.length_cons,List.length_nil, + List.length_map] using Nat.add_le_add_left h 3 + +def distributedSites (c : QMACircuit) + (τ : Fin (c.work+1) → Fin (c.gates.length+1)) : + QMACircuitTerm c → List (QMACircuitQubit c) + | .inl i => [Sum.inl i.castSucc,Sum.inl i.succ] + | .inr (.inl b) => if b = 0 then [Sum.inl 0] + else [Sum.inl (Fin.last (c.gates.length+1))] + | .inr (.inr (.inl i)) => [Sum.inl (τ i).castSucc,Sum.inl (τ i).succ,Sum.inr i] + | .inr (.inr (.inr (.inl _))) => + [Sum.inl (qmaOutputMarker c),Sum.inr (Fin.last c.work)] + | .inr (.inr (.inr (.inr t))) => propagationSites c t + +theorem distributedSites_finset (c : QMACircuit) + (τ : Fin (c.work+1) → Fin (c.gates.length+1)) (a : QMACircuitTerm c) : + (distributedSites c τ a).toFinset = qmaDistributedTermSites c τ a := by + rcases a with i | (b | (i | (u | t))) + · simp [distributedSites,qmaDistributedTermSites,qmaCircuitTermSites] + · by_cases hb : b = 0 <;> + simp [distributedSites,qmaDistributedTermSites,qmaCircuitTermSites,hb] + · simp [distributedSites,qmaDistributedTermSites,qmaDistributedInputSites] + · simp [distributedSites,qmaDistributedTermSites,qmaCircuitTermSites] + · exact propagationSites_finset c t + +theorem distributedSites_length (c : QMACircuit) + (τ : Fin (c.work+1) → Fin (c.gates.length+1)) (a : QMACircuitTerm c) : + (distributedSites c τ a).length ≤ 5 := by + rcases a with i | (b | (i | (u | t))) + · simp [distributedSites] + · by_cases hb : b = 0 <;> simp [distributedSites,hb] + · simp [distributedSites] + · simp [distributedSites] + · exact propagationSites_length c t + +abbrev Qubit (c : QMACircuit) := Fin (qmaHistoryReferenceWork c+1) ⊕ QMACircuitQubit c + +def rawSites (c : QMACircuit) (hT : 0 < c.gates.length) : + QMAReferenceTerm (qmaHistoryReferenceWork c) → List (Qubit c) + | .inl i => Sum.inl i :: + (distributedSites c (qmaFirstUseTime c) + (qmaOrderedTermEquiv c hT (qmaFirstUseTime c) i)).map Sum.inr + | .inr i => [Sum.inl i.castSucc,Sum.inl i.succ] + +theorem rawSites_finset (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) : + (rawSites c hT a).toFinset = (qmaOrderedHistoryModel c hT).sites a := by + cases a with + | inl i => + ext x + simp [rawSites,qmaOrderedHistoryModel,qmaReferenceTermSites,qmaDistributedRebitSites, + qmaOrderedHistorySites,← distributedSites_finset,Finset.mem_map] + | inr i => simp [rawSites,qmaOrderedHistoryModel,qmaReferenceTermSites,qmaReferenceEdgeSites] + +theorem rawSites_length (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) : (rawSites c hT a).length ≤ 6 := by + cases a with + | inl i => + have h := distributedSites_length c (qmaFirstUseTime c) + (qmaOrderedTermEquiv c hT (qmaFirstUseTime c) i) + simpa only [rawSites,List.length_cons,List.length_map] using Nat.succ_le_succ h + | inr i => simp [rawSites] + +def sites (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) : List (Qubit c) := + (rawSites c hT a).dedup + +theorem sites_nodup (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) : (sites c hT a).Nodup := by + exact List.nodup_dedup _ + +theorem sites_finset (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) : + (sites c hT a).toFinset = (qmaOrderedHistoryModel c hT).sites a := by + simpa [sites] using rawSites_finset c hT a + +theorem sites_length (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) : (sites c hT a).length ≤ 6 := by + rw [← List.toFinset_card_of_nodup (sites_nodup c hT a),sites_finset] + exact (qmaOrderedHistoryModel c hT).card a + +def supportEquiv (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) : + Fin (sites c hT a).length ≃ {x // x ∈ (qmaOrderedHistoryModel c hT).sites a} := + (List.Nodup.getEquiv (sites c hT a) (sites_nodup c hT a)).trans + (Equiv.subtypeEquivRight (fun x => by + have he := congrArg (fun S : Finset (Qubit c) => x ∈ S) (sites_finset c hT a) + exact List.mem_toFinset.symm.trans (Iff.of_eq he))) + +theorem supportEquiv_apply (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) (i : Fin (sites c hT a).length) : + (supportEquiv c hT a i).val = (sites c hT a).get i := rfl + +def siteNumber (c : QMACircuit) : Qubit c → ℕ + | .inl i => i.val + | .inr (.inl i) => qmaHistoryReferenceWork c+1+i.val + | .inr (.inr i) => qmaHistoryReferenceWork c+1+(c.gates.length+2)+i.val + +theorem siteNumber_lt (c : QMACircuit) (i : Qubit c) : + siteNumber c i < 3*c.gates.length+2*c.work+8 := by + rcases i with i | (i | i) <;> have h := i.isLt <;> + simp only [siteNumber,qmaHistoryReferenceWork] at * <;> omega + +theorem siteNumber_injective (c : QMACircuit) : Function.Injective (siteNumber c) := by + intro i j h + rcases i with i | (i | i) <;> rcases j with j | (j | j) <;> + simp only [siteNumber] at h + all_goals have hi := i.isLt + all_goals have hj := j.isLt + · exact congrArg Sum.inl (Fin.ext h) + · omega + · omega + · omega + · exact congrArg (fun x => Sum.inr (Sum.inl x)) (Fin.ext (by omega)) + · omega + · omega + · omega + · exact congrArg (fun x => Sum.inr (Sum.inr x)) (Fin.ext (by omega)) + +def encodedSites (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) : List ℕ := + (sites c hT a).map (siteNumber c) + +theorem encodedSites_nodup (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) : (encodedSites c hT a).Nodup := + (sites_nodup c hT a).map (siteNumber_injective c) + +theorem encodedSites_length (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) : (encodedSites c hT a).length ≤ 6 := by + simpa only [encodedSites,List.length_map] using sites_length c hT a + +end ContinuumCoulomb.QuantumOrderedSupport + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedTable.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedTable.lean new file mode 100644 index 0000000000000000000000000000000000000000..ecf540c53ba5abf3e3572a272ba8d73d105c3a58 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedTable.lean @@ -0,0 +1,84 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedCoefficient +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedSupport + +namespace OAI + +/-! The literal support-list order indexes the small matrix table. Its +Pauli coefficients agree with the actual ordered-history coefficients. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumAlgebraicHistory +open QuantumAlgebraicScalar QuantumFixedPauli Matrix +open scoped BigOperators Classical + +theorem pauliWord_reindex {α β : Type} [Fintype α] [Fintype β] + [DecidableEq α] [DecidableEq β] (e : α ≃ β) (w : β → Fin 4) + (s t : α → Fin 2) : + qmaPauliWord (fun a => w (e a)) s t = + qmaPauliWord w (fun b => s (e.symm b)) (fun b => t (e.symm b)) := by + unfold qmaPauliWord + simpa only [e.symm_apply_apply] using e.prod_comp + (fun b => qmaPauli (w b) (s (e.symm b)) (t (e.symm b))) + +theorem pauliCoefficient_reindex {α β : Type} [Fintype α] [Fintype β] + [DecidableEq α] [DecidableEq β] (e : α ≃ β) + (A : Matrix (β → Fin 2) (β → Fin 2) ℂ) (w : β → Fin 4) : + qmaPauliCoefficient + (fun s t : α → Fin 2 => A (fun b => s (e.symm b)) (fun b => t (e.symm b))) + (fun a => w (e a)) = qmaPauliCoefficient A w := by + let E : (α → Fin 2) ≃ (β → Fin 2) := e.arrowCongr (Equiv.refl _) + have hword (s t : α → Fin 2) : + qmaPauliWord (fun a => w (e a)) t s = qmaPauliWord w (E t) (E s) := + pauliWord_reindex e w t s + simp only [qmaPauliCoefficient,hword,Fintype.card_congr e] + congr 1 + calc + _ = ∑ s : α → Fin 2, ∑ t : β → Fin 2, A (E s) t*qmaPauliWord w t (E s) := by + apply Finset.sum_congr rfl + intro s _ + exact E.sum_comp (fun t => A (E s) t*qmaPauliWord w t (E s)) + _ = _ := E.sum_comp (fun s => ∑ t : β → Fin 2, A s t*qmaPauliWord w t s) + +def orderedTable (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) : + Matrix (Fin (QuantumOrderedSupport.sites c hT a).length → Fin 2) + (Fin (QuantumOrderedSupport.sites c hT a).length → Fin 2) Scalar := + let e := QuantumOrderedSupport.supportEquiv c hT a + fun s t => orderedCore c hT a (fun i => s (e.symm i)) (fun i => t (e.symm i)) + +def tableWord (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) + (w : Fin (QuantumOrderedSupport.sites c hT a).length → Fin 4) : + {i // i ∈ (qmaOrderedHistoryModel c hT).sites a} → Fin 4 := + fun i => w ((QuantumOrderedSupport.supportEquiv c hT a).symm i) + +theorem orderedTable_coefficient (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) + (w : Fin (QuantumOrderedSupport.sites c hT a).length → Fin 4) : + realValue (realCoefficient (orderedTable c hT a) w) = + (qmaPauliCoefficient (qmaLocalCore ((qmaOrderedHistoryModel c hT).sites a) + ((qmaOrderedHistoryModel c hT).matrix a)) (tableWord c hT a w)).re := by + rw [realCoefficient_eq] + let e := QuantumOrderedSupport.supportEquiv c hT a + have hentries : + (fun s t => value (orderedTable c hT a s t)) = + (fun s t => qmaLocalCore ((qmaOrderedHistoryModel c hT).sites a) + ((qmaOrderedHistoryModel c hT).matrix a) + (fun i => s (e.symm i)) (fun i => t (e.symm i))) := by + funext s t + exact congrFun (congrFun (denote_orderedCore c hT a) _) _ + rw [hentries] + have hw : (fun i => tableWord c hT a w (e i)) = w := by + funext i + simp only [tableWord,e,Equiv.symm_apply_apply] + have hp := pauliCoefficient_reindex e + (qmaLocalCore ((qmaOrderedHistoryModel c hT).sites a) + ((qmaOrderedHistoryModel c hT).matrix a)) (tableWord c hT a w) + rw [hw] at hp + exact congrArg Complex.re hp + +end ContinuumCoulomb.QuantumAlgebraicHistory + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedThird.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedThird.lean new file mode 100644 index 0000000000000000000000000000000000000000..5aa25d04d1d35cbcbafe8aff94d482600933602c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedThird.lean @@ -0,0 +1,99 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedTripleFactors +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPolarizedThird +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedSubdivision +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdEnvelope + +namespace OAI + +/-! The literal simultaneous rational three-to-two-local reduction, with +ordered factors and an ordinary full-Hilbert-space energy estimate. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedThird +open Matrix QuantumOrderedTriple +open scoped BigOperators Classical +variable {ι κ : Type} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +def phase (xs : κ → List ι) (w : κ → ι → Fin 4) : κ → Bool := + fun e => decide (Odd (qmaPauliYCount (first (xs e) (w e)))) + +def outputWord (xs : κ → List ι) (w : κ → ι → Fin 4) : + κ × Fin 7 → (ι ⊕ κ → Fin 4) := + fun p => QuantumPolarizedThird.word (first (xs p.1) (w p.1)) + (second (xs p.1) (w p.1)) (third (xs p.1) (w p.1)) + (pairWord (xs p.1) (w p.1)) p.1 (phase xs w) p.2 + +def outputCoefficient (J : κ → ℚ) (N : ℕ) (p : κ × Fin 7) : ℚ := + QuantumPolarizedThird.weight (QuantumOrderedSubdivision.scale J N) (J p.1) p.2 + +theorem output_support (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 3) (hx : ∀ e, (xs e).Nodup) + (hcover : ∀ e, qmaPauliSupport (w e) ⊆ (xs e).toFinset) + (he : ∀ e, Even (qmaPauliYCount (w e))) (p : κ × Fin 7) : + (qmaPauliSupport (outputWord xs w p)).card ≤ 2 := by + obtain ⟨ha,hb,hc,_⟩ := factors (xs p.1) (w p.1) (hlen p.1) + (hx p.1) (hcover p.1) (he p.1) + exact QuantumPolarizedThird.support (first (xs p.1) (w p.1)) + (second (xs p.1) (w p.1)) (third (xs p.1) (w p.1)) + (pairWord (xs p.1) (w p.1)) p.1 (phase xs w) ha hb hc + (pair_support _ _ (hlen p.1)) p.2 + +theorem output_even (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 3) (hx : ∀ e, (xs e).Nodup) + (hcover : ∀ e, qmaPauliSupport (w e) ⊆ (xs e).toFinset) + (he : ∀ e, Even (qmaPauliYCount (w e))) (p : κ × Fin 7) : + Even (qmaPauliYCount (outputWord xs w p)) := by + obtain ⟨_,_,_,_,_,_,_,_,hpar,hc⟩ := factors (xs p.1) (w p.1) (hlen p.1) + (hx p.1) (hcover p.1) (he p.1) + exact QuantumPolarizedThird.even (first (xs p.1) (w p.1)) + (second (xs p.1) (w p.1)) (third (xs p.1) (w p.1)) + (pairWord (xs p.1) (w p.1)) p.1 (phase xs w) rfl hpar hc + (pair_even _ _ (hlen p.1) (hx p.1) (hcover p.1) (he p.1)) p.2 + +theorem output_accuracy (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) + (hlen : ∀ e, (xs e).length ≤ 3) (hx : ∀ e, (xs e).Nodup) + (hcover : ∀ e, qmaPauliSupport (w e) ⊆ (xs e).toFinset) + (he : ∀ e, Even (qmaPauliYCount (w e))) (N : ℕ) (hN : 1 ≤ N) : + |MediatorGraph.normalizedBottom (qmaPauliFamily (outputWord xs w) + (fun p => (outputCoefficient J N p:ℝ)))- + MediatorGraph.normalizedBottom (qmaPauliFamily w (fun e => (J e:ℝ)))| ≤ 1/(N:ℝ) := by + let A := fun e => qmaPauliWord (first (xs e) (w e)) + let B := fun e => qmaPauliWord (second (xs e) (w e)) + let C := fun e => qmaPauliWord (third (xs e) (w e)) + let m := phase xs w + have hf (e : κ) := factors (xs e) (w e) (hlen e) (hx e) (hcover e) (he e) + have hpair (e : κ) : A e*B e = qmaPauliWord (pairWord (xs e) (w e)) := (hf e).2.2.2.1 + have habc (e : κ) : A e*B e*C e = qmaPauliWord (w e) := (hf e).2.2.2.2.1 + have hab (e : κ) : A e*B e = B e*A e := (hf e).2.2.2.2.2.1 + have hac (e : κ) : A e*C e = C e*A e := (hf e).2.2.2.2.2.2.1 + have hbc (e : κ) : B e*C e = C e*B e := (hf e).2.2.2.2.2.2.2.1 + have hsum : qmaPauliFamily (outputWord xs w) (fun p => (outputCoefficient J N p:ℝ)) = + (qmaThirdPhased 0 A B C (QuantumOrderedSubdivision.scale J N:ℝ) + (fun e => (J e:ℝ)) m).submatrix + (Equiv.sumArrowEquivProdArrow ι κ (Fin 2)) + (Equiv.sumArrowEquivProdArrow ι κ (Fin 2)) := by + have hc (q : ℚ) : ((q:ℝ):ℂ) = (q:ℂ) := by norm_cast + simp only [qmaPauliFamily,Fintype.sum_prod_type,outputWord,outputCoefficient,hc] + simp_rw [QuantumPolarizedThird.sum_eq _ _ _ _ _ _ _ _ (hpair _)] + rw [qmaThirdPhased_decomposition] + simp only [Matrix.zero_kronecker,zero_add,MediatorGraph.submatrix_sum] + rfl + have htarget : qmaThirdSeriesTarget 0 A B C (fun e => ((J e:ℝ):ℂ)) = + qmaPauliFamily w (fun e => (J e:ℝ)) := by + simp only [qmaThirdSeriesTarget,zero_add,habc,qmaPauliFamily] + rw [hsum,MediatorGraph.normalizedBottom_reindex,qmaThirdPhased_bottom,← htarget] + have hNR : (1:ℝ) ≤ N := by exact_mod_cast hN + have h := qmaThirdGadget_polynomial_accuracy 0 A B C (fun e => (J e:ℝ)) + (by norm_num : (0:ℝ) ≤ 0) hNR Matrix.conjTranspose_zero (by simp) + (fun _ => qmaPauliWord_hermitian _) (fun _ => qmaPauliWord_hermitian _) + (fun _ => qmaPauliWord_hermitian _) + (fun _ => qmaPauliWord_square _) (fun _ => qmaPauliWord_square _) + (fun _ => qmaPauliWord_square _) hab hac hbc + (EuclideanSpace.single (fun _ : ι => (0:Fin 2)) (1:ℂ)) (by simp [PiLp.norm_single]) + simpa only [QuantumOrderedSubdivision.scale_cast] using h + +end ContinuumCoulomb.QuantumOrderedThird + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedThirdSites.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedThirdSites.lean new file mode 100644 index 0000000000000000000000000000000000000000..12c47c40c1036888e4802d23f95cfec145049658 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedThirdSites.lean @@ -0,0 +1,97 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedThird +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSubdivisionSites + +namespace OAI + +/-! Exact ordered support lists for the seven emitted third-order terms. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedThird +open QuantumOrderedTriple QuantumOrderedSubdivision +open scoped Classical +variable {ι κ : Type} + +def outputSites (xs : κ → List ι) (w : κ → ι → Fin 4) (p : κ × Fin 7) : List (ι ⊕ κ) := + let pair := (partition (xs p.1) (w p.1)).1 + let real := (partition (xs p.1) (w p.1)).2 + ![[],[Sum.inr p.1],pair.map Sum.inl,real.map Sum.inl, + appendMediator real p.1,appendMediator (pair.take 1) p.1, + appendMediator (pair.drop 1) p.1] p.2 + +theorem outputSites_nodup (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 3) (hx : ∀ e, (xs e).Nodup) (p : κ × Fin 7) : + (outputSites xs w p).Nodup := by + rcases p with ⟨e,k⟩ + have hp := pair_nodup (xs e) (w e) (hlen e) (hx e) + have hc := (partition_nodup (xs e) (w e) (hlen e) (hx e)).of_append_right + fin_cases k + · exact List.nodup_nil + · exact List.nodup_singleton _ + · exact hp.map Sum.inl_injective + · exact hc.map Sum.inl_injective + · exact appendMediator_nodup _ hc e + · exact appendMediator_nodup _ (hp.sublist (List.take_sublist 1 _)) e + · exact appendMediator_nodup _ (hp.sublist (List.drop_sublist 1 _)) e + +theorem outputSites_length (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 3) (p : κ × Fin 7) : + (outputSites xs w p).length ≤ 2 := by + rcases p with ⟨e,k⟩ + have hp := (partition_spec (xs e) (w e) (hlen e)).2.1 + have hc := (partition_spec (xs e) (w e) (hlen e)).2.2 + fin_cases k + · change 0 ≤ 2 + omega + · change 1 ≤ 2 + omega + · change ((partition (xs e) (w e)).1.map Sum.inl).length ≤ 2 + simpa only [List.length_map] using hp + · change ((partition (xs e) (w e)).2.map Sum.inl).length ≤ 2 + simpa only [List.length_map] using hc.trans (by omega : 1 ≤ 2) + · change (appendMediator (partition (xs e) (w e)).2 e).length ≤ 2 + rw [appendMediator_length] + omega + · change (appendMediator ((partition (xs e) (w e)).1.take 1) e).length ≤ 2 + rw [appendMediator_length,List.length_take] + omega + · change (appendMediator ((partition (xs e) (w e)).1.drop 1) e).length ≤ 2 + rw [appendMediator_length,List.length_drop] + omega + +variable [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +theorem lift_support_cover (xs : List ι) (w : ι → Fin 4) + (h : qmaPauliSupport w ⊆ xs.toFinset) : + qmaPauliSupport (Sum.elim w (fun _ : κ => 0)) ⊆ (xs.map Sum.inl).toFinset := by + intro x hx + cases x with + | inl i => + have hi : i ∈ qmaPauliSupport w := by simpa [qmaPauliSupport] using hx + simpa using h hi + | inr j => simp [qmaPauliSupport] at hx + +theorem outputSites_cover (xs : κ → List ι) (w : κ → ι → Fin 4) (p : κ × Fin 7) : + qmaPauliSupport (outputWord xs w p) ⊆ (outputSites xs w p).toFinset := by + rcases p with ⟨e,k⟩ + fin_cases k + · change qmaPauliSupport (fun _ : ι ⊕ κ => 0) ⊆ ([] : List (ι ⊕ κ)).toFinset + simp [qmaPauliSupport] + · intro x hx + cases x with + | inl i => simp [outputWord,QuantumPolarizedThird.word,qmaPauliSupport] at hx + | inr j => + have hj : j ∈ qmaPauliSupport (qmaSinglePauliWord e 3) := by + simpa [outputWord,QuantumPolarizedThird.word,qmaPauliSupport] using hx + have hje := qmaSinglePauliWord_support e 3 hj + simpa [outputSites] using hje + · exact lift_support_cover _ (pairWord (xs e) (w e)) (qmaPauliRestrict_support _ _) + · exact lift_support_cover _ (third (xs e) (w e)) (qmaPauliRestrict_support _ _) + · exact join_support_cover _ (third (xs e) (w e)) (qmaPauliRestrict_support _ _) e 3 + · exact join_support_cover _ (first (xs e) (w e)) (qmaPauliRestrict_support _ _) e _ + · exact join_support_cover _ (second (xs e) (w e)) (qmaPauliRestrict_support _ _) e _ + +end ContinuumCoulomb.QuantumOrderedThird + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedThirdXZ.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedThirdXZ.lean new file mode 100644 index 0000000000000000000000000000000000000000..dee13c17d48b13ee50f2277a82d28e1c6b4c5cd7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedThirdXZ.lean @@ -0,0 +1,32 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedThirdSites + +namespace OAI + +/-! The ordered third-order gadget preserves X/Z-only input words. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedThird +open QuantumOrderedTriple +open scoped Classical +variable {ι κ : Type} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +omit [Fintype κ] in +theorem output_noY (xs : κ → List ι) (w : κ → ι → Fin 4) + (hy : ∀ e i, w e i ≠ 2) (p : κ × Fin 7) (i : ι ⊕ κ) : + outputWord xs w p i ≠ 2 := by + have ha : ∀ i, first (xs p.1) (w p.1) i ≠ 2 := qmaPauliRestrict_noY _ _ (hy p.1) + have hb : ∀ i, second (xs p.1) (w p.1) i ≠ 2 := qmaPauliRestrict_noY _ _ (hy p.1) + have hc : ∀ i, third (xs p.1) (w p.1) i ≠ 2 := qmaPauliRestrict_noY _ _ (hy p.1) + have hv : ∀ i, pairWord (xs p.1) (w p.1) i ≠ 2 := qmaPauliRestrict_noY _ _ (hy p.1) + have hm : phase xs w p.1 = false := by + simp [phase,qmaPauliYCount_zero _ ha] + rcases p with ⟨e,k⟩ + fin_cases k <;> cases i <;> + simp [outputWord,QuantumPolarizedThird.word,QuantumPolarizedSubdivision.axis, + hm,qmaSinglePauliWord,ha,hb,hc,hv] <;> split_ifs <;> decide + +end ContinuumCoulomb.QuantumOrderedThird + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedTriple.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedTriple.lean new file mode 100644 index 0000000000000000000000000000000000000000..cdc836a299dc886e7fad325cc3c0fc53c59090e8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedTriple.lean @@ -0,0 +1,116 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedSplit +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliTripleSplit + +namespace OAI + +/-! A deterministic three-site partition for the third-order gadget. +For three sites the last factor is the first available non-Y letter; +shorter lists give an empty last factor. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedTriple +open scoped Classical +variable {ι : Type} + +def partition (xs : List ι) (w : ι → Fin 4) : List ι × List ι := + match xs with + | [a,b,c] => if w a = 2 then + if w b = 2 then ([a,b],[c]) else ([a,c],[b]) + else ([b,c],[a]) + | _ => (xs,[]) + +theorem partition_spec (xs : List ι) (w : ι → Fin 4) (hlen : xs.length ≤ 3) : + ((partition xs w).1++(partition xs w).2).Perm xs ∧ + (partition xs w).1.length ≤ 2 ∧ (partition xs w).2.length ≤ 1 := by + cases xs with + | nil => simp [partition] + | cons a xs => + cases xs with + | nil => simp [partition] + | cons b xs => + cases xs with + | nil => simp [partition] + | cons c xs => + cases xs with + | nil => + by_cases ha : w a = 2 + · by_cases hb : w b = 2 + · simp [partition,ha,hb] + · refine ⟨?_,by simp [partition,ha,hb]⟩ + simpa [partition,ha,hb] using + (List.Perm.cons a (List.perm_append_comm (l₁ := [c]) (l₂ := [b]))) + · refine ⟨?_,by simp [partition,ha]⟩ + simpa [partition,ha] using (List.perm_append_comm (l₁ := [b,c]) (l₂ := [a])) + | cons d xs => simp at hlen; omega + +theorem partition_nodup (xs : List ι) (w : ι → Fin 4) (hlen : xs.length ≤ 3) + (hx : xs.Nodup) : ((partition xs w).1++(partition xs w).2).Nodup := + (partition_spec xs w hlen).1.nodup_iff.mpr hx + +theorem pair_nodup (xs : List ι) (w : ι → Fin 4) (hlen : xs.length ≤ 3) + (hx : xs.Nodup) : (partition xs w).1.Nodup := + (partition_nodup xs w hlen hx).of_append_left + +variable [Fintype ι] [DecidableEq ι] + +omit [Fintype ι] in +theorem partition_cover (xs : List ι) (w : ι → Fin 4) (hlen : xs.length ≤ 3) : + (partition xs w).1.toFinset ∪ (partition xs w).2.toFinset = xs.toFinset := by + rw [← List.toFinset_append] + ext i + simp only [List.mem_toFinset] + exact (partition_spec xs w hlen).1.mem_iff + +omit [Fintype ι] in +theorem partition_disjoint (xs : List ι) (w : ι → Fin 4) (hlen : xs.length ≤ 3) + (hx : xs.Nodup) : + Disjoint (partition xs w).1.toFinset (partition xs w).2.toFinset := + List.disjoint_toFinset_iff_disjoint.mpr + (List.disjoint_of_nodup_append (partition_nodup xs w hlen hx)) + +private theorem not_three_y (a b c : ι) (w : ι → Fin 4) + (hx : [a,b,c].Nodup) (hcover : qmaPauliSupport w ⊆ [a,b,c].toFinset) + (he : Even (qmaPauliYCount w)) : ¬(w a = 2 ∧ w b = 2 ∧ w c = 2) := by + rintro ⟨ha,hb,hc⟩ + have hs : Finset.univ.filter (fun i => w i = 2) = [a,b,c].toFinset := by + ext i + constructor + · intro hi + have hy := (Finset.mem_filter.mp hi).2 + exact hcover (by simp [qmaPauliSupport,hy]) + · intro hi + have hi' : i = a ∨ i = b ∨ i = c := by simpa using hi + rcases hi' with rfl | rfl | rfl <;> simp [ha,hb,hc] + have hcount : qmaPauliYCount w = 3 := by + rw [qmaPauliYCount,hs,List.toFinset_card_of_nodup hx] + rfl + rw [hcount] at he + norm_num at he + +theorem real_part (xs : List ι) (w : ι → Fin 4) (hlen : xs.length ≤ 3) + (hx : xs.Nodup) (hcover : qmaPauliSupport w ⊆ xs.toFinset) + (he : Even (qmaPauliYCount w)) : ∀ i ∈ (partition xs w).2, w i ≠ 2 := by + cases xs with + | nil => simp [partition] + | cons a xs => + cases xs with + | nil => simp [partition] + | cons b xs => + cases xs with + | nil => simp [partition] + | cons c xs => + cases xs with + | nil => + by_cases ha : w a = 2 + · by_cases hb : w b = 2 + · have hc : w c ≠ 2 := fun hc => not_three_y a b c w hx hcover he ⟨ha,hb,hc⟩ + simp [partition,ha,hb,hc] + · simp [partition,ha,hb] + · simp [partition,ha] + | cons d xs => simp at hlen; omega + +end ContinuumCoulomb.QuantumOrderedTriple + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedTripleFactors.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedTripleFactors.lean new file mode 100644 index 0000000000000000000000000000000000000000..f1552706f61d127ffbb3076836dafe9c6d06fee2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedTripleFactors.lean @@ -0,0 +1,116 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedTriple + +namespace OAI + +/-! Exact Pauli factors from the ordered three-site partition. The first +two factors have matching Y parity and the last is real. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedTriple +open scoped Classical +variable {ι : Type} [Fintype ι] [DecidableEq ι] + +def first (xs : List ι) (w : ι → Fin 4) : ι → Fin 4 := + QuantumOrderedSplit.firstWord (partition xs w).1 1 w + +def second (xs : List ι) (w : ι → Fin 4) : ι → Fin 4 := + QuantumOrderedSplit.secondWord (partition xs w).1 1 w + +def third (xs : List ι) (w : ι → Fin 4) : ι → Fin 4 := + qmaPauliRestrict (partition xs w).2.toFinset w + +def pairWord (xs : List ι) (w : ι → Fin 4) : ι → Fin 4 := + qmaPauliRestrict (partition xs w).1.toFinset w + +theorem third_yCount (xs : List ι) (w : ι → Fin 4) (hlen : xs.length ≤ 3) + (hx : xs.Nodup) (hcover : qmaPauliSupport w ⊆ xs.toFinset) + (he : Even (qmaPauliYCount w)) : qmaPauliYCount (third xs w) = 0 := by + apply qmaPauliYCount_zero + intro i + by_cases hi : i ∈ (partition xs w).2.toFinset + · simpa only [third,qmaPauliRestrict,hi,ite_true] using + real_part xs w hlen hx hcover he i (List.mem_toFinset.mp hi) + · simp [third,qmaPauliRestrict,hi] + +theorem pair_support (xs : List ι) (w : ι → Fin 4) (hlen : xs.length ≤ 3) : + (qmaPauliSupport (pairWord xs w)).card ≤ 2 := + (Finset.card_le_card (qmaPauliRestrict_support _ _)).trans + ((List.toFinset_card_le _).trans (partition_spec xs w hlen).2.1) + +theorem pair_even (xs : List ι) (w : ι → Fin 4) (hlen : xs.length ≤ 3) + (hx : xs.Nodup) (hcover : qmaPauliSupport w ⊆ xs.toFinset) + (he : Even (qmaPauliYCount w)) : Even (qmaPauliYCount (pairWord xs w)) := by + have hs := qmaPauliYCount_split (partition xs w).1.toFinset + (partition xs w).2.toFinset w (partition_disjoint xs w hlen hx) + (by rw [partition_cover xs w hlen]; exact hcover) + change qmaPauliYCount (pairWord xs w)+qmaPauliYCount (third xs w) = qmaPauliYCount w at hs + rw [third_yCount xs w hlen hx hcover he,add_zero] at hs + rwa [hs] + +theorem factors (xs : List ι) (w : ι → Fin 4) (hlen : xs.length ≤ 3) + (hx : xs.Nodup) (hcover : qmaPauliSupport w ⊆ xs.toFinset) + (he : Even (qmaPauliYCount w)) : + (qmaPauliSupport (first xs w)).card ≤ 1 ∧ + (qmaPauliSupport (second xs w)).card ≤ 1 ∧ + (qmaPauliSupport (third xs w)).card ≤ 1 ∧ + qmaPauliWord (first xs w)*qmaPauliWord (second xs w) = qmaPauliWord (pairWord xs w) ∧ + qmaPauliWord (first xs w)*qmaPauliWord (second xs w)*qmaPauliWord (third xs w) = qmaPauliWord w ∧ + qmaPauliWord (first xs w)*qmaPauliWord (second xs w) = + qmaPauliWord (second xs w)*qmaPauliWord (first xs w) ∧ + qmaPauliWord (first xs w)*qmaPauliWord (third xs w) = + qmaPauliWord (third xs w)*qmaPauliWord (first xs w) ∧ + qmaPauliWord (second xs w)*qmaPauliWord (third xs w) = + qmaPauliWord (third xs w)*qmaPauliWord (second xs w) ∧ + decide (Odd (qmaPauliYCount (first xs w))) = + decide (Odd (qmaPauliYCount (second xs w))) ∧ + Even (qmaPauliYCount (third xs w)) := by + let P := (partition xs w).1.toFinset + let C := (partition xs w).2.toFinset + let L := QuantumOrderedSplit.left (partition xs w).1 1 + let T := QuantumOrderedSplit.right (partition xs w).1 1 + have hplen := (partition_spec xs w hlen).2.1 + have hclen := (partition_spec xs w hlen).2.2 + have hPC : Disjoint P C := partition_disjoint xs w hlen hx + have hwhole : P ∪ C = xs.toFinset := partition_cover xs w hlen + have hLT : Disjoint L T := QuantumOrderedSplit.disjoint _ (pair_nodup xs w hlen hx) 1 + have hunion : L ∪ T = P := QuantumOrderedSplit.union _ 1 + have hLP : L ⊆ P := by rw [← hunion]; exact Finset.subset_union_left + have hTP : T ⊆ P := by rw [← hunion]; exact Finset.subset_union_right + have hvcover : qmaPauliSupport (pairWord xs w) ⊆ L ∪ T := by + rw [hunion] + exact qmaPauliRestrict_support _ _ + have hc0 := third_yCount xs w hlen hx hcover he + have hv : Even (qmaPauliYCount (pairWord xs w)) := by + have hs := qmaPauliYCount_split P C w hPC (by rw [hwhole]; exact hcover) + change qmaPauliYCount (pairWord xs w)+qmaPauliYCount (third xs w) = qmaPauliYCount w at hs + rw [hc0,add_zero] at hs + rwa [hs] + have hab : qmaPauliWord (first xs w)*qmaPauliWord (second xs w) = + qmaPauliWord (pairWord xs w) := by + have h := qmaPauliRestrict_factor L T (pairWord xs w) hLT hvcover + change qmaPauliWord (qmaPauliRestrict L (qmaPauliRestrict P w)) * + qmaPauliWord (qmaPauliRestrict T (qmaPauliRestrict P w)) = qmaPauliWord (pairWord xs w) at h + rw [qmaPauliRestrict_restrict L P w hLP,qmaPauliRestrict_restrict T P w hTP] at h + exact h + refine ⟨QuantumOrderedSplit.first_support _ 1 w, + QuantumOrderedSplit.second_support _ 1 w hplen, + (Finset.card_le_card (qmaPauliRestrict_support _ _)).trans + ((List.toFinset_card_le _).trans hclen),hab,?_,?_,?_,?_,?_,?_⟩ + · rw [hab] + exact qmaPauliRestrict_factor P C w hPC (by rw [hwhole]; exact hcover) + · exact qmaPauliRestrict_commute L T w hLT + · exact qmaPauliRestrict_commute L C w (hPC.mono_left hLP) + · exact qmaPauliRestrict_commute T C w (hPC.mono_left hTP) + · have h := qmaPauliRestrict_same_parity L T (pairWord xs w) hLT hvcover hv + change decide (Odd (qmaPauliYCount (qmaPauliRestrict L (qmaPauliRestrict P w)))) = + decide (Odd (qmaPauliYCount (qmaPauliRestrict T (qmaPauliRestrict P w)))) at h + rw [qmaPauliRestrict_restrict L P w hLP,qmaPauliRestrict_restrict T P w hTP] at h + exact h + · rw [hc0] + norm_num + +end ContinuumCoulomb.QuantumOrderedTriple + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedTwoStage.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedTwoStage.lean new file mode 100644 index 0000000000000000000000000000000000000000..b44a3900762f105e70de27f051ef7abbf6764695 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedTwoStage.lean @@ -0,0 +1,83 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSubdivisionSites + +namespace OAI + +/-! The literal rational six-to-four-to-three-local compiler. Every +intermediate word retains its ordered site list, and the estimate compares +the ordinary full Hilbert-space ground energies. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedTwoStage +open QuantumOrderedSubdivision +open scoped Classical +variable {ι κ : Type} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +def firstWord (xs : κ → List ι) (w : κ → ι → Fin 4) := outputWord xs 3 w +def firstSites (xs : κ → List ι) := outputSites xs 3 +def firstCoefficient (J : κ → ℚ) (N : ℕ) := outputCoefficient J N + +def word (xs : κ → List ι) (w : κ → ι → Fin 4) := + outputWord (firstSites xs) 2 (firstWord xs w) + +def sites (xs : κ → List ι) := outputSites (firstSites xs) 2 + +def coefficient (J : κ → ℚ) (N : ℕ) := + outputCoefficient (firstCoefficient J N) N + +omit [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] in +theorem sites_nodup (xs : κ → List ι) (hx : ∀ e, (xs e).Nodup) + (p : (κ × Fin 4) × Fin 4) : (sites xs p).Nodup := + outputSites_nodup _ _ (outputSites_nodup xs 3 hx) p + +omit [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] in +theorem sites_length (xs : κ → List ι) (hx : ∀ e, (xs e).length ≤ 6) + (p : (κ × Fin 4) × Fin 4) : (sites xs p).length ≤ 3 := by + apply outputSites_length _ 2 + intro e + exact outputSites_length xs 3 hx e + +theorem support_cover (xs : κ → List ι) (w : κ → ι → Fin 4) + (p : (κ × Fin 4) × Fin 4) : qmaPauliSupport (word xs w p) ⊆ (sites xs p).toFinset := + outputSites_cover _ _ _ p + +theorem support (xs : κ → List ι) (hx : ∀ e, (xs e).length ≤ 6) + (w : κ → ι → Fin 4) (p : (κ × Fin 4) × Fin 4) : + (qmaPauliSupport (word xs w p)).card ≤ 3 := + (Finset.card_le_card (support_cover xs w p)).trans + ((List.toFinset_card_le _).trans (sites_length xs hx p)) + +theorem even (xs : κ → List ι) (w : κ → ι → Fin 4) + (hx : ∀ e, (xs e).Nodup) + (hcover : ∀ e, qmaPauliSupport (w e) ⊆ (xs e).toFinset) + (he : ∀ e, Even (qmaPauliYCount (w e))) (p : (κ × Fin 4) × Fin 4) : + Even (qmaPauliYCount (word xs w p)) := + output_even _ _ _ (outputSites_nodup xs 3 hx) (outputSites_cover xs 3 w) + (output_even xs 3 w hx hcover he) p + +theorem accuracy (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) + (hx : ∀ e, (xs e).Nodup) + (hcover : ∀ e, qmaPauliSupport (w e) ⊆ (xs e).toFinset) + (N : ℕ) (hN : 1 ≤ N) : + |MediatorGraph.normalizedBottom (qmaPauliFamily (word xs w) + (fun p => (coefficient J N p:ℝ)))- + MediatorGraph.normalizedBottom (qmaPauliFamily w (fun e => (J e:ℝ)))| ≤ 2/(N:ℝ) := by + have hfirst := output_accuracy xs 3 w J hx hcover N hN + have hsecond := output_accuracy (firstSites xs) 2 (firstWord xs w) + (firstCoefficient J N) (outputSites_nodup xs 3 hx) (outputSites_cover xs 3 w) N hN + calc + _ ≤ |MediatorGraph.normalizedBottom (qmaPauliFamily (word xs w) + (fun p => (coefficient J N p:ℝ)))- + MediatorGraph.normalizedBottom (qmaPauliFamily (firstWord xs w) + (fun p => (firstCoefficient J N p:ℝ)))|+ + |MediatorGraph.normalizedBottom (qmaPauliFamily (firstWord xs w) + (fun p => (firstCoefficient J N p:ℝ)))- + MediatorGraph.normalizedBottom (qmaPauliFamily w (fun e => (J e:ℝ)))| := + abs_sub_le _ _ _ + _ ≤ 1/(N:ℝ)+1/(N:ℝ) := add_le_add hsecond hfirst + _ = 2/(N:ℝ) := by ring + +end ContinuumCoulomb.QuantumOrderedTwoStage + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedWeightBounds.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedWeightBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..1474212447275839d6680ec116f019cd20ccf59d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedWeightBounds.lean @@ -0,0 +1,198 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedXZPipeline + +namespace OAI + +/-! Explicit polynomial envelopes for the literal four- and seven-word gadgets. +Only the term count, input coefficient bound and unary precision enter these +envelopes. No bound on the Hilbert-space dimension is used. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedXZ +open scoped BigOperators Classical + +def weightEnvelope (R B : ℚ) : ℚ := + R^3+R^2*B+R^2+R*(1+B^2)+1+B^2 + +theorem weightEnvelope_nonneg {R B : ℚ} (hR : 0 ≤ R) (hB : 0 ≤ B) : + 0 ≤ weightEnvelope R B := by unfold weightEnvelope; positivity + +theorem weightEnvelope_mono {R S B C : ℚ} (hR : 0 ≤ R) (hB : 0 ≤ B) + (hRS : R ≤ S) (hBC : B ≤ C) : weightEnvelope R B ≤ weightEnvelope S C := by + have hS : 0 ≤ S := hR.trans hRS + unfold weightEnvelope + gcongr + +private theorem input_square_bound {j B : ℚ} (_hB : 0 ≤ B) (hj : |j| ≤ B) : + j^2 ≤ B^2 := by + have h := abs_le.mp hj + nlinarith [mul_nonneg (sub_nonneg.mpr h.2) (by linarith : 0 ≤ B+j)] + +private theorem middle_bound (B : ℚ) : B ≤ 1+B^2 := by + nlinarith [sq_nonneg (B-1)] + +theorem four_weight_bound {R j B : ℚ} (hR : 0 ≤ R) (hB : 0 ≤ B) + (hj : |j| ≤ B) (k : Fin 4) : + |QuantumPolarizedSubdivision.weight R j k| ≤ weightEnvelope R B := by + have hj2 := input_square_bound hB hj + have hR3 : 0 ≤ R^3 := pow_nonneg hR _ + have hR2B : 0 ≤ R^2*B := mul_nonneg (sq_nonneg R) hB + have hRB2 : 0 ≤ R*B^2 := mul_nonneg hR (sq_nonneg B) + have hRB : R*|j| ≤ R*(1+B^2) := + mul_le_mul_of_nonneg_left (hj.trans (middle_bound B)) hR + fin_cases k + · change |R^2/2+1+(j/2)^2| ≤ _ + rw [abs_of_nonneg (by positivity)] + unfold weightEnvelope + nlinarith [sq_nonneg R,sq_nonneg B] + · change |-R^2/2| ≤ _ + rw [neg_div] + rw [abs_neg,abs_of_nonneg (by positivity)] + unfold weightEnvelope + nlinarith [sq_nonneg R,sq_nonneg B] + · change |R| ≤ _ + rw [abs_of_nonneg hR] + unfold weightEnvelope + nlinarith [sq_nonneg R,sq_nonneg B] + · change |-R*j/2| ≤ _ + rw [abs_div,abs_mul,abs_neg,abs_of_nonneg hR] + norm_num only [abs_of_pos (by norm_num : (0:ℚ) < 2)] + unfold weightEnvelope + nlinarith [sq_nonneg R,sq_nonneg B] + +theorem seven_weight_bound {R j B : ℚ} (hR : 0 ≤ R) (hB : 0 ≤ B) + (hj : |j| ≤ B) (k : Fin 7) : + |QuantumPolarizedThird.weight R j k| ≤ weightEnvelope R B := by + have hj2 := input_square_bound hB hj + have hR3 : 0 ≤ R^3 := pow_nonneg hR _ + have hR2B : 0 ≤ R^2*B := mul_nonneg (sq_nonneg R) hB + have hRB2 : 0 ≤ R*B^2 := mul_nonneg hR (sq_nonneg B) + have hRj2 : R*j^2 ≤ R*B^2 := mul_le_mul_of_nonneg_left hj2 hR + have hRB : R*|j| ≤ R*(1+B^2) := + mul_le_mul_of_nonneg_left (hj.trans (middle_bound B)) hR + have hR2j : R^2*|j| ≤ R^2*B := mul_le_mul_of_nonneg_left hj (sq_nonneg R) + fin_cases k + · change |R^3/2+R*(1+(j/2)^2)| ≤ _ + rw [abs_of_nonneg (by positivity)] + unfold weightEnvelope + nlinarith [sq_nonneg R,sq_nonneg B] + · change |-R^3/2| ≤ _ + rw [neg_div] + rw [abs_neg,abs_of_nonneg (by positivity)] + unfold weightEnvelope + nlinarith [sq_nonneg R,sq_nonneg B] + · change |R*j| ≤ _ + rw [abs_mul,abs_of_nonneg hR] + unfold weightEnvelope + nlinarith [sq_nonneg R,sq_nonneg B] + · change |R^2/2-(1+(j/2)^2)| ≤ _ + apply (abs_sub _ _).trans + rw [abs_of_nonneg (by positivity),abs_of_nonneg (by positivity)] + unfold weightEnvelope + nlinarith [sq_nonneg R,sq_nonneg B] + · change |-R^2/2| ≤ _ + rw [neg_div] + rw [abs_neg,abs_of_nonneg (by positivity)] + unfold weightEnvelope + nlinarith [sq_nonneg R,sq_nonneg B] + · change |R^2| ≤ _ + rw [abs_of_nonneg (sq_nonneg R)] + unfold weightEnvelope + nlinarith [sq_nonneg R,sq_nonneg B] + · change |R^2*j/2| ≤ _ + rw [abs_div,abs_mul,abs_of_nonneg (sq_nonneg R)] + norm_num only [abs_of_pos (by norm_num : (0:ℚ) < 2)] + unfold weightEnvelope + nlinarith [sq_nonneg R,sq_nonneg B] + +def scaleEnvelope (m : ℕ) (B : ℚ) (N : ℕ) : ℚ := + 8*(4*(1+(m:ℚ)*(1+B)^2))^4*N + +def stepEnvelope (m : ℕ) (B : ℚ) (N : ℕ) : ℚ := weightEnvelope (scaleEnvelope m B N) B + +theorem scaleEnvelope_nonneg (m : ℕ) {B : ℚ} (_hB : 0 ≤ B) (N : ℕ) : + 0 ≤ scaleEnvelope m B N := by unfold scaleEnvelope; positivity + +theorem stepEnvelope_nonneg (m : ℕ) {B : ℚ} (hB : 0 ≤ B) (N : ℕ) : + 0 ≤ stepEnvelope m B N := weightEnvelope_nonneg (scaleEnvelope_nonneg m hB N) hB + +variable {κ : Type} [Fintype κ] + +theorem scale_le_envelope (J : κ → ℚ) {m : ℕ} {B : ℚ} (_hB : 0 ≤ B) + (hm : Fintype.card κ ≤ m) (hJ : ∀ e, |J e| ≤ B) (N : ℕ) : + QuantumOrderedSubdivision.scale J N ≤ scaleEnvelope m B N := by + have hs : (∑ e, (1+|J e|)^2) ≤ (m:ℚ)*(1+B)^2 := calc + _ ≤ ∑ _e : κ, (1+B)^2 := by + apply Finset.sum_le_sum + intro e _ + gcongr + exact hJ e + _ = (Fintype.card κ:ℚ)*(1+B)^2 := by simp + _ ≤ (m:ℚ)*(1+B)^2 := mul_le_mul_of_nonneg_right (by exact_mod_cast hm) (sq_nonneg _) + unfold QuantumOrderedSubdivision.scale QuantumOrderedSubdivision.budget scaleEnvelope + gcongr + +theorem subdivision_coefficient_bound (J : κ → ℚ) {m : ℕ} {B : ℚ} (hB : 0 ≤ B) + (hm : Fintype.card κ ≤ m) (hJ : ∀ e, |J e| ≤ B) (N : ℕ) (p : κ × Fin 4) : + |QuantumOrderedSubdivision.outputCoefficient J N p| ≤ stepEnvelope m B N := by + have hR : 0 ≤ QuantumOrderedSubdivision.scale J N := by + unfold QuantumOrderedSubdivision.scale QuantumOrderedSubdivision.budget + positivity + exact (four_weight_bound hR hB (hJ p.1) p.2).trans + (weightEnvelope_mono hR hB (scale_le_envelope J hB hm hJ N) le_rfl) + +theorem third_coefficient_bound (J : κ → ℚ) {m : ℕ} {B : ℚ} (hB : 0 ≤ B) + (hm : Fintype.card κ ≤ m) (hJ : ∀ e, |J e| ≤ B) (N : ℕ) (p : κ × Fin 7) : + |QuantumOrderedThird.outputCoefficient J N p| ≤ stepEnvelope m B N := by + have hR : 0 ≤ QuantumOrderedSubdivision.scale J N := by + unfold QuantumOrderedSubdivision.scale QuantumOrderedSubdivision.budget + positivity + exact (seven_weight_bound hR hB (hJ p.1) p.2).trans + (weightEnvelope_mono hR hB (scale_le_envelope J hB hm hJ N) le_rfl) + +/-- A fixed fivefold composition of explicit polynomials. -/ +def pipelineBound (m : ℕ) (B : ℚ) (N : ℕ) : ℕ → ℚ + | 0 => B + | k+1 => stepEnvelope (3136*m) (pipelineBound m B N k) N + +theorem pipelineBound_nonneg (m : ℕ) {B : ℚ} (hB : 0 ≤ B) (N k : ℕ) : + 0 ≤ pipelineBound m B N k := by + induction k with + | zero => exact hB + | succ k ih => exact stepEnvelope_nonneg _ ih _ + +theorem pipeline_coefficient_bound (J : κ → ℚ) {m : ℕ} {B : ℚ} (hB : 0 ≤ B) + (hm : Fintype.card κ ≤ m) (hJ : ∀ e, |J e| ≤ B) (N : ℕ) (p : OutputTerm κ) : + |coefficient J N p| ≤ pipelineBound m B N 5 := by + have hm0 : Fintype.card κ ≤ 3136*m := by omega + have hm1 : Fintype.card (κ × Fin 4) ≤ 3136*m := by + simp only [Fintype.card_prod,Fintype.card_fin] + omega + have hm2 : Fintype.card (ThreeTerm κ) ≤ 3136*m := by + simp only [ThreeTerm,Fintype.card_prod,Fintype.card_fin] + omega + have hm3 : Fintype.card (TwoTerm κ) ≤ 3136*m := by + simp only [TwoTerm,ThreeTerm,Fintype.card_prod,Fintype.card_fin] + omega + have hm4 : Fintype.card (XZThreeTerm κ) ≤ 3136*m := by + simp only [XZThreeTerm,TwoTerm,ThreeTerm,Fintype.card_prod,Fintype.card_fin] + omega + have h1 (e : κ × Fin 4) : + |QuantumOrderedTwoStage.firstCoefficient J N e| ≤ pipelineBound m B N 1 := + subdivision_coefficient_bound J hB hm0 hJ N e + have h2 (e : ThreeTerm κ) : |threeCoefficient J N e| ≤ pipelineBound m B N 2 := + subdivision_coefficient_bound (QuantumOrderedTwoStage.firstCoefficient J N) + (pipelineBound_nonneg m hB N 1) hm1 h1 N e + have h3 (e : TwoTerm κ) : |twoCoefficient J N e| ≤ pipelineBound m B N 3 := + third_coefficient_bound (threeCoefficient J N) + (pipelineBound_nonneg m hB N 2) hm2 h2 N e + have h4 (e : XZThreeTerm κ) : |xzThreeCoefficient J N e| ≤ pipelineBound m B N 4 := + subdivision_coefficient_bound (twoCoefficient J N) + (pipelineBound_nonneg m hB N 3) hm3 h3 N e + exact third_coefficient_bound (xzThreeCoefficient J N) + (pipelineBound_nonneg m hB N 4) hm4 h4 N p + +end ContinuumCoulomb.QuantumOrderedXZ + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedWeightProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedWeightProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..402724d0bd13aefc9924213ef92c8c1dcea7d858 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedWeightProgram.lean @@ -0,0 +1,169 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedXZPipeline +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathScaleProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawFamilyProgram + +namespace OAI + +/-! Uniform literal rational-list programs for all five early gadget stages. +The lists retain input order and emit each fixed block in its word order. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedWeightProgram +open ExactQuantumFactoring.BitStackProgram +open scoped BigOperators Classical + +abbrev Pair := ℚ × ℚ +def pairCode : Pair → List Bool := prodCode ratCode ratCode +noncomputable opaque radius : Procedure pairCode ratCode Prod.fst := Procedure.first _ _ +noncomputable opaque coupling : Procedure pairCode ratCode Prod.snd := Procedure.second _ _ +noncomputable opaque radiusSquare : Procedure pairCode ratCode (fun x => x.1^2) := + QuantumRoutingCode.squareProgram radius +noncomputable opaque radiusCube : Procedure pairCode ratCode (fun x => x.1^3) := + (Procedure.ratMul.comp (radiusSquare.pair radius)).congrFun (by intro x; dsimp; ring) +noncomputable opaque radiusHalf : Procedure pairCode ratCode (fun x => x.1^2/2) := + Procedure.ratDiv.comp (radiusSquare.pair (Procedure.constant pairCode ratCode 2)) +noncomputable opaque cubeHalf : Procedure pairCode ratCode (fun x => x.1^3/2) := + Procedure.ratDiv.comp (radiusCube.pair (Procedure.constant pairCode ratCode 2)) +noncomputable opaque couplingHalf : Procedure pairCode ratCode (fun x => x.2/2) := + Procedure.ratDiv.comp (coupling.pair (Procedure.constant pairCode ratCode 2)) +noncomputable opaque correction : Procedure pairCode ratCode (fun x => 1+(x.2/2)^2) := + Procedure.ratAdd.comp ((Procedure.constant pairCode ratCode 1).pair + (QuantumRoutingCode.squareProgram couplingHalf)) + +noncomputable opaque fourProgram (k : Fin 4) : Procedure pairCode ratCode + (fun x => QuantumPolarizedSubdivision.weight x.1 x.2 k) := by + refine Fin.cases ?_ (fun k => ?_) k + · exact (Procedure.ratAdd.comp (radiusHalf.pair correction)).congrFun + (by intro x; change x.1^2/2+(1+(x.2/2)^2) = x.1^2/2+1+(x.2/2)^2; ring) + · refine Fin.cases ?_ (fun k => ?_) k + · exact (Procedure.ratNeg.comp radiusHalf).congrFun (by + intro x; change -(x.1^2/2) = -x.1^2/2; ring) + · refine Fin.cases ?_ (fun k => ?_) k + · exact radius.congrFun (by intro x; rfl) + · refine Fin.cases ?_ (fun k => Fin.elim0 k) k + exact (Procedure.ratDiv.comp ((Procedure.ratMul.comp + ((Procedure.ratNeg.comp radius).pair coupling)).pair + (Procedure.constant pairCode ratCode 2))).congrFun (by intro x; rfl) + +noncomputable opaque sevenProgram (k : Fin 7) : Procedure pairCode ratCode + (fun x => QuantumPolarizedThird.weight x.1 x.2 k) := by + refine Fin.cases ?_ (fun k => ?_) k + · exact (Procedure.ratAdd.comp (cubeHalf.pair + (Procedure.ratMul.comp (radius.pair correction)))).congrFun (by intro x; rfl) + · refine Fin.cases ?_ (fun k => ?_) k + · exact (Procedure.ratNeg.comp cubeHalf).congrFun (by + intro x; change -(x.1^3/2) = -x.1^3/2; ring) + · refine Fin.cases ?_ (fun k => ?_) k + · exact (Procedure.ratMul.comp (radius.pair coupling)).congrFun (by intro x; rfl) + · refine Fin.cases ?_ (fun k => ?_) k + · exact (Procedure.ratSub.comp (radiusHalf.pair correction)).congrFun (by intro x; rfl) + · refine Fin.cases ?_ (fun k => ?_) k + · exact (Procedure.ratNeg.comp radiusHalf).congrFun (by + intro x; change -(x.1^2/2) = -x.1^2/2; ring) + · refine Fin.cases ?_ (fun k => ?_) k + · exact radiusSquare.congrFun (by intro x; rfl) + · refine Fin.cases ?_ (fun k => Fin.elim0 k) k + exact (Procedure.ratDiv.comp ((Procedure.ratMul.comp (radiusSquare.pair coupling)).pair + (Procedure.constant pairCode ratCode 2))).congrFun (by intro x; rfl) + +abbrev Input := ℕ × List ℚ +def inputCode : Input → List Bool := prodCode unaryCode (listCode ratCode) +def scale (x : Input) : ℚ := 8*(4*(1+(x.2.map (fun j => (1+|j|)^2)).sum))^4*x.1 + +noncomputable opaque scaleProgram : Procedure inputCode ratCode scale := by + let n := Procedure.natToRat.comp (Procedure.unaryToBits.comp + (Procedure.first unaryCode (listCode ratCode))) + let s := (QuantumPathScaleProgram.sumMapProgram QuantumPathScaleProgram.squareProgram).comp + (Procedure.second unaryCode (listCode ratCode)) + let b := Procedure.ratMul.comp ((Procedure.constant inputCode ratCode 4).pair + (Procedure.ratAdd.comp ((Procedure.constant inputCode ratCode 1).pair s))) + let fourth := QuantumRoutingCode.squareProgram (QuantumRoutingCode.squareProgram b) + exact (Procedure.ratMul.comp ((Procedure.ratMul.comp + ((Procedure.constant inputCode ratCode 8).pair fourth)).pair n)).congrFun (by + intro x + simp only [Function.comp_apply,id_eq,scale, + show QuantumPathScaleProgram.squareCost = (fun j : ℚ => (1+|j|)^2) from rfl] + ring) + +def block (d : ℕ) (f : Pair → Fin d → ℚ) (x : Pair) : List ℚ := List.ofFn (f x) +def stage (d : ℕ) (f : Pair → Fin d → ℚ) (x : Input) : List ℚ := + (x.2.map (fun j => block d f (scale x,j))).flatten + +noncomputable def stageProgram (d : ℕ) (f : Pair → Fin d → ℚ) + (p : ∀ k, Procedure pairCode ratCode (fun x => f x k)) : + Procedure inputCode (listCode ratCode) (stage d f) := by + let b : Procedure pairCode (listCode ratCode) (block d f) := + QuantumRawExchange.fixedListProgram pairCode ratCode d (fun k x => f x k) p + let tab := Procedure.listMapWith (ea := ratCode) (eb := ratCode) + (ec := listCode ratCode) (f := fun r j => block d f (r,j)) 0 [] b + let env := scaleProgram.pair (Procedure.second unaryCode (listCode ratCode)) + exact (QuantumRawExchange.flattenProgram ratCode 0).comp (tab.comp env) + +def four (x : Input) : List ℚ := stage 4 + (fun x => QuantumPolarizedSubdivision.weight x.1 x.2) x +def seven (x : Input) : List ℚ := stage 7 + (fun x => QuantumPolarizedThird.weight x.1 x.2) x +noncomputable opaque fourListProgram : Procedure inputCode (listCode ratCode) four := + stageProgram 4 _ fourProgram +noncomputable opaque sevenListProgram : Procedure inputCode (listCode ratCode) seven := + stageProgram 7 _ sevenProgram + +def nextFour (x : Input) : Input := (x.1,four x) +def nextSeven (x : Input) : Input := (x.1,seven x) +noncomputable opaque nextFourProgram : Procedure inputCode inputCode nextFour := + (Procedure.first unaryCode (listCode ratCode)).pair fourListProgram +noncomputable opaque nextSevenProgram : Procedure inputCode inputCode nextSeven := + (Procedure.first unaryCode (listCode ratCode)).pair sevenListProgram + +def output (x : Input) : List ℚ := seven (nextFour (nextSeven (nextFour (nextFour x)))) +noncomputable opaque outputProgram : Procedure inputCode (listCode ratCode) output := + sevenListProgram.comp (nextFourProgram.comp (nextSevenProgram.comp + (nextFourProgram.comp nextFourProgram))) + +noncomputable def certificate : + Turing.TM2ComputableInPolyTime inputCode (listCode ratCode) output := outputProgram.toTM2 + +theorem scale_ofFn {n : ℕ} (J : Fin n → ℚ) (N : ℕ) : + scale (N,List.ofFn J) = QuantumOrderedSubdivision.scale J N := by + simp only [scale,List.map_ofFn,List.sum_ofFn,Function.comp_apply, + QuantumOrderedSubdivision.scale,QuantumOrderedSubdivision.budget] + +theorem four_ofFn {n : ℕ} (J : Fin n → ℚ) (N : ℕ) : + four (N,List.ofFn J) = + (List.ofFn (fun i : Fin n => List.ofFn (fun k : Fin 4 => + QuantumOrderedSubdivision.outputCoefficient J N (i,k)))).flatten := by + unfold four stage + rw [scale_ofFn] + simp only [List.map_ofFn,Function.comp_def,block, + QuantumOrderedSubdivision.outputCoefficient] + +theorem seven_ofFn {n : ℕ} (J : Fin n → ℚ) (N : ℕ) : + seven (N,List.ofFn J) = + (List.ofFn (fun i : Fin n => List.ofFn (fun k : Fin 7 => + QuantumOrderedThird.outputCoefficient J N (i,k)))).flatten := by + unfold seven stage + rw [scale_ofFn] + simp only [List.map_ofFn,Function.comp_def,block, + QuantumOrderedThird.outputCoefficient] + +theorem stage_length (d : ℕ) (f : Pair → Fin d → ℚ) (x : Input) : + (stage d f x).length = x.2.length*d := by + have h (r : ℚ) (ys : List ℚ) : + ((ys.map (fun j => block d f (r,j))).flatten).length = ys.length*d := by + induction ys with + | nil => simp + | cons j js ih => + rw [List.map_cons,List.flatten_cons,List.length_append,ih] + simp only [block,List.length_ofFn,List.length_cons,Nat.add_mul,Nat.one_mul] + omega + exact h _ _ + +theorem output_length (x : Input) : (output x).length = 3136*x.2.length := by + simp only [output,nextFour,nextSeven,four,seven,stage_length] + omega + +end ContinuumCoulomb.QuantumOrderedWeightProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedXZEnergy.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedXZEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..46f9389d30d10b89621a6201a58166bf28f22abf --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedXZEnergy.lean @@ -0,0 +1,124 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedXZPipeline + +namespace OAI + +/-! Full-space error of the literal six-to-four-to-three-to-two-to-XZ compiler. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedXZ +open scoped Classical +variable {ι κ : Type} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +private theorem bottomDifference_instances {α β : Type} + (F G : Fintype α) (d e : DecidableEq α) + (P Q : Fintype β) (a b : DecidableEq β) + (H : Matrix α α ℂ) (K : Matrix β β ℂ) (r : ℝ) + (h : |@MediatorGraph.normalizedBottom α F d H - + @MediatorGraph.normalizedBottom β P a K| ≤ r) : + |@MediatorGraph.normalizedBottom α G e H - + @MediatorGraph.normalizedBottom β Q b K| ≤ r := by + cases Subsingleton.elim F G + cases Subsingleton.elim d e + cases Subsingleton.elim P Q + cases Subsingleton.elim a b + exact h + +def energy (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) (N : ℕ) : ℝ := + MediatorGraph.normalizedBottom (qmaPauliFamily (word xs w) + (fun p => (coefficient J N p:ℝ))) + +def threeEnergy (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) (N : ℕ) : ℝ := + MediatorGraph.normalizedBottom (qmaPauliFamily (threeWord xs w) + (fun p => (threeCoefficient J N p:ℝ))) + +def twoEnergy (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) (N : ℕ) : ℝ := + MediatorGraph.normalizedBottom (qmaPauliFamily (twoWord xs w) + (fun p => (twoCoefficient J N p:ℝ))) + +def xzThreeEnergy (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) (N : ℕ) : ℝ := by + letI : Fintype (XZThreeQubit ι κ) := inferInstance + letI : DecidableEq (XZThreeQubit ι κ) := inferInstance + exact MediatorGraph.normalizedBottom (qmaPauliFamily (xzThreeWord xs w) + (fun p => (xzThreeCoefficient J N p:ℝ))) + +theorem xzThree_even (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 6) (hx : ∀ e, (xs e).Nodup) + (hcover : ∀ e, qmaPauliSupport (w e) ⊆ (xs e).toFinset) + (he : ∀ e, Even (qmaPauliYCount (w e))) : + ∀ p, Even (qmaPauliYCount (xzThreeWord xs w p)) := by + intro p + rw [qmaPauliYCount_zero _ (xzThree_noY xs w hlen hx hcover he p)] + exact ⟨0, rfl⟩ + +theorem threeEnergy_error (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) + (hx : ∀ e, (xs e).Nodup) + (hcover : ∀ e, qmaPauliSupport (w e) ⊆ (xs e).toFinset) + (N : ℕ) (hN : 1 ≤ N) : + |threeEnergy xs w J N-MediatorGraph.normalizedBottom + (qmaPauliFamily w (fun e => (J e:ℝ)))| ≤ 2/(N:ℝ) := + QuantumOrderedTwoStage.accuracy xs w J hx hcover N hN + +theorem twoEnergy_error (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) + (hlen : ∀ e, (xs e).length ≤ 6) (hx : ∀ e, (xs e).Nodup) + (hcover : ∀ e, qmaPauliSupport (w e) ⊆ (xs e).toFinset) + (he : ∀ e, Even (qmaPauliYCount (w e))) (N : ℕ) (hN : 1 ≤ N) : + |twoEnergy xs w J N-threeEnergy xs w J N| ≤ 1/(N:ℝ) := + QuantumOrderedThird.output_accuracy (threeSites xs) (threeWord xs w) + (threeCoefficient J N) (threeSites_length xs hlen) (threeSites_nodup xs hx) + (threeSites_cover xs w) (three_even xs w hx hcover he) N hN + +theorem xzThreeEnergy_error (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) + (hlen : ∀ e, (xs e).length ≤ 6) (hx : ∀ e, (xs e).Nodup) + (hcover : ∀ e, qmaPauliSupport (w e) ⊆ (xs e).toFinset) + (he : ∀ e, Even (qmaPauliYCount (w e))) (N : ℕ) (hN : 1 ≤ N) : + |xzThreeEnergy xs w J N-twoEnergy xs w J N| ≤ 1/(N:ℝ) := by + simpa only [xzThreeEnergy,twoEnergy,xzThreeWord,xzThreeCoefficient] using + (QuantumOrderedYY.output_accuracy (twoSites xs w) (twoWord xs w) + (twoCoefficient J N) (twoSites_length xs w hlen) (twoSites_nodup xs w hlen hx) + (twoSites_cover xs w) (two_even xs w hlen hx hcover he) N hN) + +theorem energy_error (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) + (hlen : ∀ e, (xs e).length ≤ 6) (hx : ∀ e, (xs e).Nodup) + (hcover : ∀ e, qmaPauliSupport (w e) ⊆ (xs e).toFinset) + (he : ∀ e, Even (qmaPauliYCount (w e))) (N : ℕ) (hN : 1 ≤ N) : + |energy xs w J N-xzThreeEnergy xs w J N| ≤ 1/(N:ℝ) := by + have h := QuantumOrderedThird.output_accuracy (xzThreeSites xs w) (xzThreeWord xs w) + (xzThreeCoefficient J N) (xzThreeSites_length xs w hlen) + (xzThreeSites_nodup xs w hlen hx) (xzThreeSites_cover xs w hlen hx hcover he) + (xzThree_even xs w hlen hx hcover he) N hN + unfold energy xzThreeEnergy word coefficient + exact bottomDifference_instances _ _ _ _ _ _ _ _ _ _ _ h + +theorem accuracy (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) + (hlen : ∀ e, (xs e).length ≤ 6) (hx : ∀ e, (xs e).Nodup) + (hcover : ∀ e, qmaPauliSupport (w e) ⊆ (xs e).toFinset) + (he : ∀ e, Even (qmaPauliYCount (w e))) (N : ℕ) (hN : 1 ≤ N) : + |energy xs w J N-MediatorGraph.normalizedBottom + (qmaPauliFamily w (fun e => (J e:ℝ)))| ≤ 5/(N:ℝ) := by + let E₀ : ℝ := MediatorGraph.normalizedBottom (qmaPauliFamily w (fun e => (J e:ℝ))) + let E₁ : ℝ := threeEnergy xs w J N + let E₂ : ℝ := twoEnergy xs w J N + let E₃ : ℝ := xzThreeEnergy xs w J N + have h₁ : |E₁-E₀| ≤ 2/(N:ℝ) := + threeEnergy_error xs w J hx hcover N hN + have h₂ : |E₂-E₁| ≤ 1/(N:ℝ) := + twoEnergy_error xs w J hlen hx hcover he N hN + have h₃ : |E₃-E₂| ≤ 1/(N:ℝ) := + xzThreeEnergy_error xs w J hlen hx hcover he N hN + have h₄ : |energy xs w J N-E₃| ≤ 1/(N:ℝ) := + energy_error xs w J hlen hx hcover he N hN + calc + _ ≤ |energy xs w J N-E₃|+|E₃-E₀| := abs_sub_le _ _ _ + _ ≤ |energy xs w J N-E₃|+(|E₃-E₂|+|E₂-E₀|) := + add_le_add le_rfl (abs_sub_le _ _ _) + _ ≤ |energy xs w J N-E₃|+(|E₃-E₂|+(|E₂-E₁|+|E₁-E₀|)) := + add_le_add le_rfl (add_le_add le_rfl (abs_sub_le _ _ _)) + _ ≤ 1/(N:ℝ)+(1/(N:ℝ)+(1/(N:ℝ)+2/(N:ℝ))) := + add_le_add h₄ (add_le_add h₃ (add_le_add h₂ h₁)) + _ = 5/(N:ℝ) := by ring + +end ContinuumCoulomb.QuantumOrderedXZ + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedXZPipeline.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedXZPipeline.lean new file mode 100644 index 0000000000000000000000000000000000000000..9c09f45f73b368cc59ffcad7bafc421d94f9a102 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedXZPipeline.lean @@ -0,0 +1,177 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedTwoStage +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedYYReduction +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedThirdXZ + +namespace OAI + +/-! One literal rational six-local to two-local X/Z family. The intermediate +types retain the original term index and the bounded gadget-word index. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedXZ +open scoped Classical + +abbrev ThreeTerm (κ : Type) := (κ × Fin 4) × Fin 4 +abbrev ThreeQubit (ι κ : Type) := (ι ⊕ κ) ⊕ (κ × Fin 4) +abbrev TwoTerm (κ : Type) := ThreeTerm κ × Fin 7 +abbrev TwoQubit (ι κ : Type) := ThreeQubit ι κ ⊕ ThreeTerm κ +abbrev XZThreeTerm (κ : Type) := TwoTerm κ × Fin 4 +abbrev XZThreeQubit (ι κ : Type) := TwoQubit ι κ ⊕ TwoTerm κ +abbrev OutputTerm (κ : Type) := XZThreeTerm κ × Fin 7 +abbrev OutputQubit (ι κ : Type) := XZThreeQubit ι κ ⊕ XZThreeTerm κ + +variable {ι κ : Type} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +def threeWord (xs : κ → List ι) (w : κ → ι → Fin 4) : + ThreeTerm κ → ThreeQubit ι κ → Fin 4 := QuantumOrderedTwoStage.word xs w + +def threeSites (xs : κ → List ι) : ThreeTerm κ → List (ThreeQubit ι κ) := + QuantumOrderedTwoStage.sites xs + +def threeCoefficient (J : κ → ℚ) (N : ℕ) : ThreeTerm κ → ℚ := + QuantumOrderedTwoStage.coefficient J N + +def twoWord (xs : κ → List ι) (w : κ → ι → Fin 4) : + TwoTerm κ → TwoQubit ι κ → Fin 4 := + QuantumOrderedThird.outputWord (threeSites xs) (threeWord xs w) + +def twoSites (xs : κ → List ι) (w : κ → ι → Fin 4) : + TwoTerm κ → List (TwoQubit ι κ) := + QuantumOrderedThird.outputSites (threeSites xs) (threeWord xs w) + +def twoCoefficient (J : κ → ℚ) (N : ℕ) : TwoTerm κ → ℚ := + QuantumOrderedThird.outputCoefficient (threeCoefficient J N) N + +def xzThreeWord (xs : κ → List ι) (w : κ → ι → Fin 4) : + XZThreeTerm κ → XZThreeQubit ι κ → Fin 4 := + QuantumOrderedYY.outputWord (twoSites xs w) (twoWord xs w) + +def xzThreeSites (xs : κ → List ι) (w : κ → ι → Fin 4) : + XZThreeTerm κ → List (XZThreeQubit ι κ) := + QuantumOrderedYY.outputSites (twoSites xs w) + +def xzThreeCoefficient (J : κ → ℚ) (N : ℕ) : XZThreeTerm κ → ℚ := + QuantumOrderedYY.outputCoefficient (twoCoefficient J N) N + +def word (xs : κ → List ι) (w : κ → ι → Fin 4) : + OutputTerm κ → OutputQubit ι κ → Fin 4 := + QuantumOrderedThird.outputWord (xzThreeSites xs w) (xzThreeWord xs w) + +def sites (xs : κ → List ι) (w : κ → ι → Fin 4) : + OutputTerm κ → List (OutputQubit ι κ) := + QuantumOrderedThird.outputSites (xzThreeSites xs w) (xzThreeWord xs w) + +def coefficient (J : κ → ℚ) (N : ℕ) : OutputTerm κ → ℚ := + QuantumOrderedThird.outputCoefficient (xzThreeCoefficient J N) N + +omit [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] in +theorem threeSites_nodup (xs : κ → List ι) (hx : ∀ e, (xs e).Nodup) : + ∀ p, (threeSites xs p).Nodup := QuantumOrderedTwoStage.sites_nodup xs hx + +omit [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] in +theorem threeSites_length (xs : κ → List ι) (hlen : ∀ e, (xs e).length ≤ 6) : + ∀ p, (threeSites xs p).length ≤ 3 := QuantumOrderedTwoStage.sites_length xs hlen + +theorem threeSites_cover (xs : κ → List ι) (w : κ → ι → Fin 4) : + ∀ p, qmaPauliSupport (threeWord xs w p) ⊆ (threeSites xs p).toFinset := + QuantumOrderedTwoStage.support_cover xs w + +theorem three_even (xs : κ → List ι) (w : κ → ι → Fin 4) + (hx : ∀ e, (xs e).Nodup) + (hcover : ∀ e, qmaPauliSupport (w e) ⊆ (xs e).toFinset) + (he : ∀ e, Even (qmaPauliYCount (w e))) : + ∀ p, Even (qmaPauliYCount (threeWord xs w p)) := + QuantumOrderedTwoStage.even xs w hx hcover he + +theorem twoSites_nodup (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 6) (hx : ∀ e, (xs e).Nodup) : + ∀ p, (twoSites xs w p).Nodup := + QuantumOrderedThird.outputSites_nodup _ _ + (threeSites_length xs hlen) (threeSites_nodup xs hx) + +theorem twoSites_length (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 6) : ∀ p, (twoSites xs w p).length ≤ 2 := + QuantumOrderedThird.outputSites_length _ _ (threeSites_length xs hlen) + +theorem twoSites_cover (xs : κ → List ι) (w : κ → ι → Fin 4) : + ∀ p, qmaPauliSupport (twoWord xs w p) ⊆ (twoSites xs w p).toFinset := + QuantumOrderedThird.outputSites_cover _ _ + +theorem two_even (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 6) (hx : ∀ e, (xs e).Nodup) + (hcover : ∀ e, qmaPauliSupport (w e) ⊆ (xs e).toFinset) + (he : ∀ e, Even (qmaPauliYCount (w e))) : + ∀ p, Even (qmaPauliYCount (twoWord xs w p)) := + QuantumOrderedThird.output_even _ _ (threeSites_length xs hlen) + (threeSites_nodup xs hx) (threeSites_cover xs w) (three_even xs w hx hcover he) + +theorem xzThreeSites_nodup (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 6) (hx : ∀ e, (xs e).Nodup) : + ∀ p, (xzThreeSites xs w p).Nodup := + QuantumOrderedYY.outputSites_nodup _ (twoSites_nodup xs w hlen hx) + +theorem xzThreeSites_length (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 6) : ∀ p, (xzThreeSites xs w p).length ≤ 3 := + QuantumOrderedYY.outputSites_length _ (twoSites_length xs w hlen) + +theorem xzThreeSites_cover (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 6) (hx : ∀ e, (xs e).Nodup) + (hcover : ∀ e, qmaPauliSupport (w e) ⊆ (xs e).toFinset) + (he : ∀ e, Even (qmaPauliYCount (w e))) : + ∀ p, qmaPauliSupport (xzThreeWord xs w p) ⊆ (xzThreeSites xs w p).toFinset := + QuantumOrderedYY.outputSites_cover _ _ (twoSites_length xs w hlen) + (twoSites_nodup xs w hlen hx) (twoSites_cover xs w) (two_even xs w hlen hx hcover he) + +theorem xzThree_noY (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 6) (hx : ∀ e, (xs e).Nodup) + (hcover : ∀ e, qmaPauliSupport (w e) ⊆ (xs e).toFinset) + (he : ∀ e, Even (qmaPauliYCount (w e))) : ∀ p i, xzThreeWord xs w p i ≠ 2 := + QuantumOrderedYY.output_noY _ _ (twoSites_length xs w hlen) + (twoSites_nodup xs w hlen hx) (twoSites_cover xs w) (two_even xs w hlen hx hcover he) + +theorem sites_nodup (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 6) (hx : ∀ e, (xs e).Nodup) : + ∀ p, (sites xs w p).Nodup := + QuantumOrderedThird.outputSites_nodup _ _ (xzThreeSites_length xs w hlen) + (xzThreeSites_nodup xs w hlen hx) + +theorem sites_length (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 6) : ∀ p, (sites xs w p).length ≤ 2 := + QuantumOrderedThird.outputSites_length _ _ (xzThreeSites_length xs w hlen) + +theorem sites_cover (xs : κ → List ι) (w : κ → ι → Fin 4) : + ∀ p, qmaPauliSupport (word xs w p) ⊆ (sites xs w p).toFinset := by + intro p i hi + have h := QuantumOrderedThird.outputSites_cover (xzThreeSites xs w) (xzThreeWord xs w) p hi + have hm : i ∈ sites xs w p := by simpa only [sites, List.mem_toFinset] using h + exact List.mem_toFinset.mpr hm + +theorem noY (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 6) (hx : ∀ e, (xs e).Nodup) + (hcover : ∀ e, qmaPauliSupport (w e) ⊆ (xs e).toFinset) + (he : ∀ e, Even (qmaPauliYCount (w e))) : ∀ p i, word xs w p i ≠ 2 := + QuantumOrderedThird.output_noY _ _ (xzThree_noY xs w hlen hx hcover he) + +theorem support (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 6) (p : OutputTerm κ) : + (qmaPauliSupport (word xs w p)).card ≤ 2 := + (Finset.card_le_card (sites_cover xs w p)).trans + ((List.toFinset_card_le _).trans (sites_length xs w hlen p)) + +omit [Fintype ι] [DecidableEq ι] [DecidableEq κ] in +theorem term_count : Fintype.card (OutputTerm κ) = 3136*Fintype.card κ := by + simp only [OutputTerm,XZThreeTerm,TwoTerm,ThreeTerm,Fintype.card_prod,Fintype.card_fin] + omega + +omit [DecidableEq ι] [DecidableEq κ] in +theorem qubit_count : Fintype.card (OutputQubit ι κ) = + Fintype.card ι+581*Fintype.card κ := by + simp only [OutputQubit,XZThreeQubit,TwoQubit,ThreeQubit,XZThreeTerm,TwoTerm,ThreeTerm, + Fintype.card_sum,Fintype.card_prod,Fintype.card_fin] + omega + +end ContinuumCoulomb.QuantumOrderedXZ + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedXZTerm.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedXZTerm.lean new file mode 100644 index 0000000000000000000000000000000000000000..6fde5fd82b5dd5f3f03fca9eb8db5421c5f7dc07 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedXZTerm.lean @@ -0,0 +1,98 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZTerms + +namespace OAI + +/-! Deterministic X/Z term classification from a list of at most two sites. +The order of pair endpoints is the supplied order, with no finite-set choice. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedXZTerm +open scoped Classical + +def axis (a : Fin 4) : Fin 2 := if a = 1 then 0 else 1 + +theorem axis_spec (a : Fin 4) (h0 : a ≠ 0) (h2 : a ≠ 2) : + qmaXZLabel (axis a) = a := by + fin_cases a <;> simp_all [axis,qmaXZLabel] + +def field {n : ℕ} (w : Fin n → Fin 4) (i : Fin n) : QMAXZTerm n := + if w i = 0 then .scalar else .field i (axis (w i)) + +def ofSites {n : ℕ} (xs : List (Fin n)) (w : Fin n → Fin 4) : QMAXZTerm n := + match xs with + | [] => .scalar + | [i] => field w i + | i :: j :: _ => + if h : i = j then field w i + else if w i = 0 then field w j + else if w j = 0 then field w i + else .pair i j h (axis (w i)) (axis (w j)) + +private theorem outside {n : ℕ} (w : Fin n → Fin 4) (xs : List (Fin n)) + (hs : qmaPauliSupport w ⊆ xs.toFinset) (i : Fin n) (hi : i ∉ xs) : w i = 0 := by + by_contra h + have hm := hs (Finset.mem_filter.mpr ⟨Finset.mem_univ _,h⟩) + exact hi (List.mem_toFinset.mp hm) + +theorem field_word {n : ℕ} (w : Fin n → Fin 4) (i k : Fin n) + (hy : w i ≠ 2) : (field w i).word k = if k = i then w i else 0 := by + by_cases hz : w i = 0 + · simp [field,hz,QMAXZTerm.word] + · simp only [field,hz,ite_false,QMAXZTerm.word,axis_spec _ hz hy] + +theorem word_eq {n : ℕ} (xs : List (Fin n)) (w : Fin n → Fin 4) + (hlen : xs.length ≤ 2) (hx : xs.Nodup) + (hs : qmaPauliSupport w ⊆ xs.toFinset) (hy : ∀ i, w i ≠ 2) : + (ofSites xs w).word = w := by + cases xs with + | nil => + funext k + exact (outside w [] hs k (by simp)).symm + | cons i xs => + cases xs with + | nil => + funext k + rw [ofSites,field_word w i k (hy i)] + by_cases hk : k = i + · simp [hk] + · simpa [hk] using (outside w [i] hs k (by simp [hk])).symm + | cons j xs => + cases xs with + | cons l xs => simp at hlen + | nil => + have hij : i ≠ j := by simpa using hx + rw [ofSites,dite_eq_right hij] + split_ifs with hi hj + · funext k + rw [field_word w j k (hy j)] + by_cases hkj : k = j + · simp [hkj] + · by_cases hki : k = i + · simp [hki,hi,hij] + · simpa [hkj] using (outside w [i,j] hs k (by simp [hki,hkj])).symm + · funext k + rw [field_word w i k (hy i)] + by_cases hki : k = i + · simp [hki] + · by_cases hkj : k = j + · simp [hkj,hj,Ne.symm hij] + · simpa [hki] using (outside w [i,j] hs k (by simp [hki,hkj])).symm + · funext k + simp only [QMAXZTerm.word,axis_spec _ hi (hy i),axis_spec _ hj (hy j)] + by_cases hki : k = i + · simp [hki] + · by_cases hkj : k = j + · simp [hkj,Ne.symm hij] + · simpa [hki,hkj] using (outside w [i,j] hs k (by simp [hki,hkj])).symm + +theorem matrix_eq {n : ℕ} (xs : List (Fin n)) (w : Fin n → Fin 4) + (hlen : xs.length ≤ 2) (hx : xs.Nodup) + (hs : qmaPauliSupport w ⊆ xs.toFinset) (hy : ∀ i, w i ≠ 2) : + (ofSites xs w).matrix = qmaPauliWord w := by + rw [← QMAXZTerm.word_matrix,word_eq xs w hlen hx hs hy] + +end ContinuumCoulomb.QuantumOrderedXZTerm + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedYYFactors.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedYYFactors.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd76c7ef52bf6c6f5c486bc7a501fd1acf45735c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedYYFactors.lean @@ -0,0 +1,112 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZSupportFactors +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedSplit + +namespace OAI + +/-! Literal XZ/ZX factors for the only possible real two-site Y term. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedYY +open Matrix +open scoped Classical +variable {ι : Type} [Fintype ι] [DecidableEq ι] + +def factor (xs : List ι) (w : ι → Fin 4) : (ι → Fin 4) × (ι → Fin 4) := + match xs with + | [a,b] => if w a = 2 then (qmaTwoPauliWord a b 1 3,qmaTwoPauliWord a b 3 1) + else (w,fun _ => 0) + | _ => (w,fun _ => 0) + +private theorem classify (xs : List ι) (w : ι → Fin 4) (hlen : xs.length ≤ 2) + (hx : xs.Nodup) (hcover : qmaPauliSupport w ⊆ xs.toFinset) + (he : Even (qmaPauliYCount w)) : + (∀ i, w i ≠ 2) ∨ ∃ a b, xs = [a,b] ∧ a ≠ b ∧ w = qmaTwoPauliWord a b 2 2 := by + have hs : (qmaPauliSupport w).card ≤ 2 := + (Finset.card_le_card hcover).trans ((List.toFinset_card_le _).trans hlen) + rcases qmaTwoLocalEvenY_cases w hs he with h | ⟨i,j,hij,rfl⟩ + · exact Or.inl h + · right + rw [qmaTwoPauliYY_support_eq] at hcover + have htwo : 2 ≤ xs.length := calc + 2 = ({i,j} : Finset ι).card := by simp [hij] + _ ≤ xs.toFinset.card := Finset.card_le_card hcover + _ ≤ xs.length := List.toFinset_card_le _ + have hshape : ∃ a b, xs = [a,b] := by + cases xs with + | nil => simp at htwo + | cons a ys => + cases ys with + | nil => simp at htwo + | cons b zs => + cases zs with + | nil => exact ⟨a,b,rfl⟩ + | cons c zs => simp at hlen + obtain ⟨a,b,rfl⟩ := hshape + have hab : a ≠ b := by simpa using hx + have heq : ({i,j} : Finset ι) = [a,b].toFinset := + Finset.eq_of_subset_of_card_le hcover (by simp [hij,hab]) + have ha : a = i ∨ a = j := by + have : a ∈ ({i,j} : Finset ι) := by rw [heq]; simp + simpa using this + have hb : b = i ∨ b = j := by + have : b ∈ ({i,j} : Finset ι) := by rw [heq]; simp + simpa using this + refine ⟨a,b,rfl,hab,?_⟩ + funext k + by_cases hka : k = a + · subst k + rcases ha with rfl | rfl <;> simp [qmaTwoPauliWord] + · by_cases hkb : k = b + · subst k + rcases hb with rfl | rfl <;> simp [qmaTwoPauliWord,hka] + · have hki : k ≠ i := by + intro hki + have : k ∈ [a,b].toFinset := hcover (by simp [hki]) + simp [hka,hkb] at this + have hkj : k ≠ j := by + intro hkj + have : k ∈ [a,b].toFinset := hcover (by simp [hkj]) + simp [hka,hkb] at this + simp [qmaTwoPauliWord,hka,hkb,hki,hkj] + +omit [Fintype ι] in +private theorem factor_noY (xs : List ι) (w : ι → Fin 4) (h : ∀ i, w i ≠ 2) : + factor xs w = (w,fun _ => 0) := by + cases xs with + | nil => rfl + | cons a xs => + cases xs with + | nil => rfl + | cons b xs => + cases xs with + | nil => simp [factor,h] + | cons c xs => rfl + +theorem factors (xs : List ι) (w : ι → Fin 4) (hlen : xs.length ≤ 2) + (hx : xs.Nodup) (hcover : qmaPauliSupport w ⊆ xs.toFinset) + (he : Even (qmaPauliYCount w)) : + (∀ i, (factor xs w).1 i ≠ 2) ∧ (∀ i, (factor xs w).2 i ≠ 2) ∧ + qmaPauliSupport (factor xs w).1 ⊆ xs.toFinset ∧ + qmaPauliSupport (factor xs w).2 ⊆ xs.toFinset ∧ + qmaPauliWord (factor xs w).1*qmaPauliWord (factor xs w).2 = qmaPauliWord w ∧ + qmaPauliWord (factor xs w).1*qmaPauliWord (factor xs w).2 = + qmaPauliWord (factor xs w).2*qmaPauliWord (factor xs w).1 := by + rcases classify xs w hlen hx hcover he with h | ⟨a,b,rfl,hab,rfl⟩ + · rw [factor_noY xs w h] + refine ⟨h,by simp,hcover,by simp [qmaPauliSupport],?_,?_⟩ + · simp only [qmaPauliWord_zero,Matrix.mul_one] + · simp only [qmaPauliWord_zero,Matrix.mul_one,Matrix.one_mul] + · simp only [factor,qmaTwoPauliWord,ite_true] + change (∀ i, qmaTwoPauliWord a b 1 3 i ≠ 2) ∧ + (∀ i, qmaTwoPauliWord a b 3 1 i ≠ 2) ∧ _ + refine ⟨?_,?_,?_,?_,qmaYY_factor a b hab,qmaYY_factor_commute a b hab⟩ + · intro i; simp only [qmaTwoPauliWord]; split_ifs <;> decide + · intro i; simp only [qmaTwoPauliWord]; split_ifs <;> decide + · simpa using qmaTwoPauliWord_support a b 1 3 + · simpa using qmaTwoPauliWord_support a b 3 1 + +end ContinuumCoulomb.QuantumOrderedYY + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedYYReduction.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedYYReduction.lean new file mode 100644 index 0000000000000000000000000000000000000000..0a41c9a1efb79dadf31247364b2e693503fef6e6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrderedYYReduction.lean @@ -0,0 +1,107 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedYYFactors +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumYYReduction +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSubdivisionSites + +namespace OAI + +/-! The literal rational YY-to-XZ subdivision, retaining ordered source sites. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedYY +open Matrix QuantumOrderedSubdivision +open scoped BigOperators Classical +variable {ι κ : Type} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +def outputWord (xs : κ → List ι) (w : κ → ι → Fin 4) : + κ × Fin 4 → (ι ⊕ κ → Fin 4) := + fun p => qmaXZSubdivisionWord (factor (xs p.1) (w p.1)).1 + (factor (xs p.1) (w p.1)).2 p.1 p.2 + +def outputCoefficient (J : κ → ℚ) (N : ℕ) (p : κ × Fin 4) : ℚ := + QuantumOrderedSubdivision.outputCoefficient J N p + +def outputSites (xs : κ → List ι) (p : κ × Fin 4) : List (ι ⊕ κ) := + ![[],[Sum.inr p.1],appendMediator (xs p.1) p.1,appendMediator (xs p.1) p.1] p.2 + +omit [Fintype κ] in +theorem output_noY (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 2) (hx : ∀ e, (xs e).Nodup) + (hcover : ∀ e, qmaPauliSupport (w e) ⊆ (xs e).toFinset) + (he : ∀ e, Even (qmaPauliYCount (w e))) (p : κ × Fin 4) (i : ι ⊕ κ) : + outputWord xs w p i ≠ 2 := by + obtain ⟨ha,hb,_⟩ := factors (xs p.1) (w p.1) (hlen p.1) + (hx p.1) (hcover p.1) (he p.1) + exact qmaXZSubdivision_noY _ _ _ ha hb p.2 i + +omit [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] in +theorem outputSites_nodup (xs : κ → List ι) (hx : ∀ e, (xs e).Nodup) + (p : κ × Fin 4) : (outputSites xs p).Nodup := by + rcases p with ⟨e,k⟩ + fin_cases k + · exact List.nodup_nil + · exact List.nodup_singleton _ + · exact appendMediator_nodup _ (hx e) e + · exact appendMediator_nodup _ (hx e) e + +omit [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] in +theorem outputSites_length (xs : κ → List ι) (hlen : ∀ e, (xs e).length ≤ 2) + (p : κ × Fin 4) : (outputSites xs p).length ≤ 3 := by + rcases p with ⟨e,k⟩ + fin_cases k + · change 0 ≤ 3; omega + · change 1 ≤ 3; omega + · change (appendMediator (xs e) e).length ≤ 3 + rw [appendMediator_length] + have := hlen e + omega + · change (appendMediator (xs e) e).length ≤ 3 + rw [appendMediator_length] + have := hlen e + omega + +theorem outputSites_cover (xs : κ → List ι) (w : κ → ι → Fin 4) + (hlen : ∀ e, (xs e).length ≤ 2) (hx : ∀ e, (xs e).Nodup) + (hcover : ∀ e, qmaPauliSupport (w e) ⊆ (xs e).toFinset) + (he : ∀ e, Even (qmaPauliYCount (w e))) (p : κ × Fin 4) : + qmaPauliSupport (outputWord xs w p) ⊆ (outputSites xs p).toFinset := by + rcases p with ⟨e,k⟩ + obtain ⟨_,_,ha,hb,_⟩ := factors (xs e) (w e) (hlen e) (hx e) (hcover e) (he e) + fin_cases k + · change qmaPauliSupport (fun _ : ι ⊕ κ => 0) ⊆ ([] : List (ι ⊕ κ)).toFinset + simp [qmaPauliSupport] + · intro x hx + cases x with + | inl i => simp [outputWord,qmaXZSubdivisionWord,qmaPauliSupport] at hx + | inr j => + have hj : j ∈ qmaPauliSupport (qmaSinglePauliWord e 3) := by + simpa [outputWord,qmaXZSubdivisionWord,qmaPauliSupport] using hx + simpa [outputSites] using qmaSinglePauliWord_support e 3 hj + · exact join_support_cover (xs e) _ ha e 1 + · exact join_support_cover (xs e) _ hb e 1 + +theorem output_accuracy (xs : κ → List ι) (w : κ → ι → Fin 4) (J : κ → ℚ) + (hlen : ∀ e, (xs e).length ≤ 2) (hx : ∀ e, (xs e).Nodup) + (hcover : ∀ e, qmaPauliSupport (w e) ⊆ (xs e).toFinset) + (he : ∀ e, Even (qmaPauliYCount (w e))) (N : ℕ) (hN : 1 ≤ N) : + |MediatorGraph.normalizedBottom (qmaPauliFamily (outputWord xs w) + (fun p => (outputCoefficient J N p:ℝ)))- + MediatorGraph.normalizedBottom (qmaPauliFamily w (fun e => (J e:ℝ)))| ≤ 1/(N:ℝ) := by + let a := fun e => (factor (xs e) (w e)).1 + let b := fun e => (factor (xs e) (w e)).2 + have hf (e : κ) := factors (xs e) (w e) (hlen e) (hx e) (hcover e) (he e) + have hfactor (e : κ) : qmaPauliWord (a e)*qmaPauliWord (b e) = qmaPauliWord (w e) := + (hf e).2.2.2.2.1 + have hcomm (e : κ) : qmaPauliWord (a e)*qmaPauliWord (b e) = + qmaPauliWord (b e)*qmaPauliWord (a e) := (hf e).2.2.2.2.2 + have hNR : (1:ℝ) ≤ N := by exact_mod_cast hN + have h := qmaXZSubdivision_accuracy a b (fun e => (J e:ℝ)) hcomm hNR + simp only [qmaPauliFamily,outputWord,outputCoefficient, + QuantumOrderedSubdivision.outputCoefficient,QuantumPolarizedSubdivision.weight_cast, + QuantumOrderedSubdivision.scale_cast] + simpa only [hfactor,a,b] using h + +end ContinuumCoulomb.QuantumOrderedYY + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrdinalPlacement.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrdinalPlacement.lean new file mode 100644 index 0000000000000000000000000000000000000000..54c0a94cb557dc3c14ef0da8de9ea13d852a0f80 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrdinalPlacement.lean @@ -0,0 +1,44 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumChosenSlots +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrdinalSlots + +namespace OAI + +/-! Apply explicit ordinal ranks to the cell-slot interface used by geometry. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrdinalPlacement + +private theorem coordinates_eq {rows width : ℕ} (p q : QMAGridCell rows width) : + (p.1.val,p.2.val) = (q.1.val,q.2.val) ↔ p=q := by + constructor + · intro h + exact Prod.ext (Fin.ext (congrArg Prod.fst h)) (Fin.ext (congrArg Prod.snd h)) + · rintro rfl; rfl + + def coordinates {n rows width : ℕ} (cell : Fin n → QMAGridCell rows width) : Fin n → ℕ × ℕ := + fun q => ((cell q).1.val,(cell q).2.val) + + theorem fiber_card {n rows width : ℕ} (cell : Fin n → QMAGridCell rows width) (q : Fin n) : + (Finset.univ.filter (fun r => coordinates cell r = coordinates cell q)).card = + (Finset.univ.filter (fun r => cell r = cell q)).card := by + congr 1 + apply Finset.filter_congr + intro r _ + exact coordinates_eq _ _ + + def slots {n rows width A : ℕ} (cell : Fin n → QMAGridCell rows width) + (hd : ∀ p, (Finset.univ.filter (fun q => cell q=p)).card ≤ A) : QMACellSlots cell A where + index q := ⟨QuantumOrdinalSlots.rank (coordinates cell) q, + (QuantumOrdinalSlots.rank_lt_fiber (coordinates cell) q).trans_le + (by rw [fiber_card]; exact hd (cell q))⟩ + injective := by + intro q r hc hs + apply QuantumOrdinalSlots.rank_injective_on_cell (coordinates cell) + · exact (coordinates_eq _ _).mpr hc + · exact congrArg Fin.val hs + +end ContinuumCoulomb.QuantumOrdinalPlacement + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrdinalProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrdinalProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..635234a8fc261d256b1db7032ada83b0237c3690 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrdinalProgram.lean @@ -0,0 +1,115 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrdinalSlots +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathVisitProgram + +namespace OAI + +/-! A literal ordinal-slot program. For an encoded cell list and a unary +label it counts earlier labels in the same cell; the result agrees with the +bounded injective slots used by the spatial construction. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrdinalProgram +open ExactQuantumFactoring.BitStackProgram QuantumRouteCode + +def increment (x : Bool × ℕ) : ℕ := if x.1 then x.2+1 else x.2 + +theorem fold_increment (xs : List Bool) (k : ℕ) : + xs.foldl (fun n b => increment (b,n)) k = k+xs.countP id := by + induction xs generalizing k with + | nil => simp + | cons b xs ih => + simp only [List.foldl_cons,ih,List.countP_cons] + cases b <;> simp [increment,Nat.add_comm,Nat.add_left_comm] + +noncomputable def incrementProgram : + Procedure (prodCode Procedure.boolCode unaryCode) unaryCode increment := by + let k := Procedure.second Procedure.boolCode unaryCode + exact (Procedure.conditional (Procedure.first Procedure.boolCode unaryCode) + (Procedure.unarySuccessor.comp k) k).congrFun (by intro x; rfl) + +noncomputable def countProgram : + Procedure (listCode Procedure.boolCode) unaryCode (fun xs => xs.countP id) := by + let fold := Procedure.foldList false incrementProgram Polynomial.X (by + intro xs k i + rw [fold_increment] + have hc := List.countP_le_length (p := id) (l := xs.take i) + have ht : (xs.take i).length ≤ xs.length := List.length_take_le' _ _ + have hs := list_length_le_code Procedure.boolCode xs + simp only [unaryCode,List.length_replicate,Polynomial.eval_X] + omega) + exact (fold.comp ((Procedure.identity _).pair + (Procedure.constant _ unaryCode 0))).congrFun (by + intro xs + simp only [Function.comp_apply,id_eq,fold_increment,zero_add]) + +abbrev Input := ℕ × List Pair +def inputCode : Input → List Bool := prodCode unaryCode (listCode pairCode) + +def sameCell (x : Input) (i : ℕ) : Bool := + decide (QuantumPathVisitProgram.lookup x.2 i = QuantumPathVisitProgram.lookup x.2 x.1) + +def value (x : Input) : ℕ := ((List.range x.1).map (sameCell x)).countP id + +noncomputable def sameCellProgram : + Procedure (prodCode unaryCode inputCode) Procedure.boolCode + (fun x => sameCell x.2 x.1) := by + let i := Procedure.unaryToBits.comp (Procedure.first unaryCode inputCode) + let env := Procedure.second unaryCode inputCode + let q := Procedure.unaryToBits.comp + ((Procedure.first unaryCode (listCode pairCode)).comp env) + let xs := (Procedure.second unaryCode (listCode pairCode)).comp env + exact QuantumFiniteMembership.pairEqProgram.comp + (((Procedure.listGet pairCode (0,0)).comp (i.pair xs)).pair + ((Procedure.listGet pairCode (0,0)).comp (q.pair xs))) + +noncomputable def program : Procedure inputCode unaryCode value := + countProgram.comp ((Procedure.tabulate (f := sameCell) false sameCellProgram).comp + ((Procedure.first unaryCode (listCode pairCode)).pair (Procedure.identity inputCode))) + +noncomputable def certificate : Turing.TM2ComputableInPolyTime inputCode unaryCode value := + program.toTM2 + +theorem value_eq_card (x : Input) : + value x = ((Finset.range x.1).filter (fun i => + QuantumPathVisitProgram.lookup x.2 i = QuantumPathVisitProgram.lookup x.2 x.1)).card := by + unfold value sameCell + rw [List.countP_map] + simp only [Function.comp_def,id_eq] + symm + simpa only [List.toFinset_range,Function.comp_apply,id_eq] using + (List.nodup_range (n := x.1)).card_eq_countP + (P := fun i => QuantumPathVisitProgram.lookup x.2 i = QuantumPathVisitProgram.lookup x.2 x.1) + +theorem lookup_ofFn {n : ℕ} (cells : Fin n → Pair) (q : Fin n) : + QuantumPathVisitProgram.lookup (List.ofFn cells) q.val = cells q := by + unfold QuantumPathVisitProgram.lookup + rw [List.headD_eq_head?_getD,List.head?_drop] + simp + +theorem value_ofFn {n : ℕ} (cells : Fin n → Pair) (q : Fin n) : + value (q.val,List.ofFn cells) = QuantumOrdinalSlots.rank cells q := by + rw [value_eq_card] + unfold QuantumOrdinalSlots.rank + symm + apply Finset.card_bij (fun r _ => r.val) + · intro r hr + obtain ⟨_,hlt,hcell⟩ := Finset.mem_filter.mp hr + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_range.mpr hlt,?_⟩ + simpa only [lookup_ofFn] using hcell + · intro r hr s hs h + exact Fin.ext h + · intro i hi + obtain ⟨hi,hcell⟩ := Finset.mem_filter.mp hi + have hiq : i < q.val := Finset.mem_range.mp hi + let r : Fin n := ⟨i,hiq.trans q.isLt⟩ + refine ⟨r,?_,rfl⟩ + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _,hiq,?_⟩ + simpa only [← show r.val=i from rfl,lookup_ofFn] using hcell + +end ContinuumCoulomb.QuantumOrdinalProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrdinalSlots.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrdinalSlots.lean new file mode 100644 index 0000000000000000000000000000000000000000..48b1d54ba271dbb6f97e0ef90b71e6a2b60f5dfb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrdinalSlots.lean @@ -0,0 +1,57 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridSlots + +namespace OAI + +/-! Explicit ordinal ranks give the required injective slots in each bounded +cell fiber. This is the finite ordering used by the spatial output program. -/ + +namespace ContinuumCoulomb.QuantumOrdinalSlots + +def before {n : ℕ} (cells : Fin n → ℕ × ℕ) (q : Fin n) : Finset (Fin n) := + Finset.univ.filter (fun r => r < q ∧ cells r = cells q) + +def rank {n : ℕ} (cells : Fin n → ℕ × ℕ) (q : Fin n) : ℕ := (before cells q).card + + theorem rank_lt_fiber {n : ℕ} (cells : Fin n → ℕ × ℕ) (q : Fin n) : + rank cells q < (Finset.univ.filter (fun r => cells r = cells q)).card := by + have hs : before cells q ⊆ Finset.univ.filter (fun r => cells r = cells q) := by + intro r hr + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,(Finset.mem_filter.mp hr).2.2⟩ + apply Finset.card_lt_card + apply (Finset.ssubset_iff_of_subset hs).mpr + refine ⟨q,by simp,?_⟩ + simp [before] + + theorem rank_lt {n : ℕ} (cells : Fin n → ℕ × ℕ) {q r : Fin n} + (hqr : q < r) (hc : cells q = cells r) : rank cells q < rank cells r := by + have hs : before cells q ⊆ before cells r := by + intro a ha + obtain ⟨_,hq,hcell⟩ := Finset.mem_filter.mp ha + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,hq.trans hqr,hcell.trans hc⟩ + apply Finset.card_lt_card + apply (Finset.ssubset_iff_of_subset hs).mpr + refine ⟨q,?_,?_⟩ + · exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,hqr,hc⟩ + · simp [before] + + theorem rank_injective_on_cell {n : ℕ} (cells : Fin n → ℕ × ℕ) {q r : Fin n} + (hc : cells q = cells r) (hr : rank cells q = rank cells r) : q=r := by + rcases lt_trichotomy q r with h | h | h + · have := rank_lt cells h hc + omega + · exact h + · have := rank_lt cells h hc.symm + omega + + def slot {n A : ℕ} (cells : Fin n → ℕ × ℕ) + (hd : ∀ p, (Finset.univ.filter (fun q => cells q=p)).card ≤ A) (q : Fin n) : Fin A := + ⟨rank cells q,(rank_lt_fiber cells q).trans_le (hd (cells q))⟩ + + theorem slot_injective_on_cell {n A : ℕ} (cells : Fin n → ℕ × ℕ) + (hd : ∀ p, (Finset.univ.filter (fun q => cells q=p)).card ≤ A) + {q r : Fin n} (hc : cells q = cells r) (hs : slot cells hd q = slot cells hd r) : q=r := + rank_injective_on_cell cells hc (congrArg Fin.val hs) + +end ContinuumCoulomb.QuantumOrdinalSlots + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrdinalSpatial.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrdinalSpatial.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd0b4e123a00c9ecef762e109895b46cbb373fbe --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumOrdinalSpatial.lean @@ -0,0 +1,62 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialExchange +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrdinalPlacement + +namespace OAI + +/-! Replace the abstract default slots by the explicit ordinal choice on the +encoded spin and interaction labels. The finite Hamiltonian is unchanged. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +namespace QMACellSlots + def transport {Q R : Type*} {rows width A : ℕ} {cell : Q → QMAGridCell rows width} + (e : Q ≃ R) (S : QMACellSlots (cell ∘ e.symm) A) : QMACellSlots cell A where + index q := S.index (e q) + injective := by + intro q r hc hs + apply e.injective + apply S.injective _ hs + simpa only [Function.comp_apply,Equiv.symm_apply_apply] using hc +end QMACellSlots + +private theorem relabel_density {Q R : Type*} [Fintype Q] [Fintype R] + {rows width A : ℕ} (cell : Q → QMAGridCell rows width) + (hd : ∀ p, (Finset.univ.filter (fun q => cell q=p)).card ≤ A) (e : Q ≃ R) + (p : QMAGridCell rows width) : + (Finset.univ.filter (fun r => (cell ∘ e.symm) r=p)).card ≤ A := by + let f : {q // cell q=p} ≃ {r // (cell ∘ e.symm) r=p} := + Equiv.subtypeEquiv e (by intro q; simp) + have hh := Fintype.card_congr f + simp only [Fintype.card_subtype] at hh + rw [← hh] + exact hd p + +namespace QMASpatialExchangeModel +variable {A B : ℕ} (M : QMASpatialExchangeModel A B) + + def withOrdinalSlots {m : ℕ} (labels : M.Term ≃ Fin m) : QMASpatialExchangeModel A B := + { M with + qubitSlots := QuantumOrdinalPlacement.slots M.cell M.qubitDensity + termSlots := (QuantumOrdinalPlacement.slots (M.anchor ∘ labels.symm) + (relabel_density M.anchor M.termDensity labels)).transport labels } + +@[simp] theorem withOrdinalSlots_energy {m : ℕ} (labels : M.Term ≃ Fin m) : + (M.withOrdinalSlots labels).energy = M.energy := rfl + +@[simp] theorem withOrdinalSlots_qubit_index {m : ℕ} (labels : M.Term ≃ Fin m) (q : Fin M.n) : + ((M.withOrdinalSlots labels).qubitSlots.index q).val = + QuantumOrdinalSlots.rank (QuantumOrdinalPlacement.coordinates M.cell) q := rfl + +@[simp] theorem withOrdinalSlots_term_index {m : ℕ} (labels : M.Term ≃ Fin m) (e : M.Term) : + ((M.withOrdinalSlots labels).termSlots.index e).val = + QuantumOrdinalSlots.rank (QuantumOrdinalPlacement.coordinates (M.anchor ∘ labels.symm)) + (labels e) := rfl + +end QMASpatialExchangeModel +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPackedSchedule.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPackedSchedule.lean new file mode 100644 index 0000000000000000000000000000000000000000..b75fbbd1b706a5a9e1efe789bc7604ccfdfc0676 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPackedSchedule.lean @@ -0,0 +1,101 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortScheduleTape +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathRelabelingProperties + +namespace OAI + +/-! Packing a finite exchange graph with a work counter retains its endpoints +and work exactly. This bridges the literal schedule to the geometric one. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPackedSchedule +open QuantumListSchedule +open scoped Classical + +theorem schedule_congr {s t : State} (h : s=t) (hs : Valid s) (ht : Valid t) : + schedule s hs=schedule t ht := by + cases h + rfl + +def state (G : QMARationalExchangeGraph) {m : ℕ} (labels : G.Edge ≃ Fin m) + (work : G.Edge → ℕ) : State := + (G.n,G.constant,List.ofFn (fun i => (work (labels.symm i), + (G.left (labels.symm i)).val,(G.right (labels.symm i)).val,G.weight (labels.symm i)))) + +theorem erase_state (G : QMARationalExchangeGraph) {m : ℕ} (labels : G.Edge ≃ Fin m) + (work : G.Edge → ℕ) : erase (state G labels work).2.2=QuantumListGraph.packed G labels := by + simp only [erase,state,List.map_ofFn,QuantumListGraph.packed,Function.comp_def] + +theorem valid (G : QMARationalExchangeGraph) {m : ℕ} (labels : G.Edge ≃ Fin m) + (work : G.Edge → ℕ) : Valid (state G labels work) := by + constructor + · rw [erase_state] + exact QuantumListGraph.packed_bounded G labels + · rw [erase_state] + exact QuantumListGraph.packed_noLoops G labels + +def scheduleRelabel (G : QMARationalExchangeGraph) {m : ℕ} (labels : G.Edge ≃ Fin m) + (work : G.Edge → ℕ) : + QMAPathRelabeling (schedule (state G labels work) (valid G labels work)) ⟨G,work⟩ where + vertex := Equiv.refl _ + edge := (finCongr (show (state G labels work).2.2.length = m from List.length_ofFn)).trans labels.symm + left := by + intro e + apply Fin.ext + simp only [schedule,graph,state,List.get_eq_getElem,List.getElem_ofFn] + rfl + right := by + intro e + apply Fin.ext + simp only [schedule,graph,state,List.get_eq_getElem,List.getElem_ofFn] + rfl + work := by + intro e + change ((List.ofFn (fun i : Fin m => (work (labels.symm i), + (G.left (labels.symm i)).val,(G.right (labels.symm i)).val,G.weight (labels.symm i)))).get e).1 = _ + exact (congrArg Prod.fst (List.get_ofFn + (fun i : Fin m => (work (labels.symm i), + (G.left (labels.symm i)).val,(G.right (labels.symm i)).val,G.weight (labels.symm i))) e)) + +theorem energy (G : QMARationalExchangeGraph) {m : ℕ} (labels : G.Edge ≃ Fin m) + (work : G.Edge → ℕ) : QuantumListSchedule.energy (state G labels work)=G.energy := by + unfold QuantumListSchedule.energy + rw [erase_state] + exact congrArg (sourceMatrixBottom G.n) (QuantumListGraph.packed_matrix G labels) + +def layout (G : QMARationalExchangeGraph) {m : ℕ} (labels : G.Edge ≃ Fin m) + (work : G.Edge → ℕ) {Γ : SimpleGraph (ℕ × ℕ)} (P : QMAPathEmbedding ⟨G,work⟩ Γ) : + QuantumListRouteProgram.State := + (state G labels work,List.ofFn P.position,List.ofFn (fun i : Fin m => + (List.range (2*work (labels.symm i)+2)).map (P.point (labels.symm i)))) + +theorem layout_represents (G : QMARationalExchangeGraph) {m : ℕ} (labels : G.Edge ≃ Fin m) + (work : G.Edge → ℕ) {Γ : SimpleGraph (ℕ × ℕ)} (P : QMAPathEmbedding ⟨G,work⟩ Γ) : + QuantumListRouteProgram.Represents (layout G labels work P) (valid G labels work) + ((scheduleRelabel G labels work).symm.transport P) := by + constructor + · rfl + · apply List.ext_getElem + · simp only [layout,List.length_ofFn,schedule,graph,state] + · intro i hi hj + have hi' : i < m := by simpa only [layout,List.length_ofFn] using hi + simp only [layout,List.getElem_ofFn] + have hw := (scheduleRelabel G labels work).work + (⟨i,by simpa only [state,List.length_ofFn] using hi'⟩ : + (schedule (state G labels work) (valid G labels work)).graph.Edge) + rw [hw] + rfl + +theorem layout_has_representation (G : QMARationalExchangeGraph) {m : ℕ} + (labels : G.Edge ≃ Fin m) (work : G.Edge → ℕ) {Γ : SimpleGraph (ℕ × ℕ)} + (P : QMAPathEmbedding ⟨G,work⟩ Γ) {X Y : ℕ} (hb : P.Bounded X Y) : + ∃ (hs : QuantumListSchedule.Valid (layout G labels work P).1) + (Q : QMAPathEmbedding (QuantumListSchedule.schedule (layout G labels work P).1 hs) Γ), + QuantumListRouteProgram.Represents (layout G labels work P) hs Q ∧ Q.Bounded X Y := + ⟨valid G labels work,_,layout_represents G labels work P, + (scheduleRelabel G labels work).symm.transport_bounded P hb⟩ + +end ContinuumCoulomb.QuantumPackedSchedule + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPacketGeometry.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPacketGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..59e6dad98092323b50902c2093d407ecb2fa35cd --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPacketGeometry.lean @@ -0,0 +1,30 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListGraph +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListPathStep + +namespace OAI + +/-! A finite bond packet represents a placed graph when its exact position +array and unordered edge support agree under a vertex permutation. -/ + +noncomputable section +namespace ContinuumCoulomb + +structure QMAPacketGeometry (G : QMARationalExchangeGraph) + (position : Fin G.n → ℕ × ℕ) (q : QuantumListPathStep.Output) + (ps : List (ℕ × ℕ)) : Prop where + bounded : SourceBondLists.bounded q.1 q.2.1 + noLoops : ∀ b ∈ q.2.1, b.1 ≠ b.2.1 + matching : + let H := QuantumListGraph.ofBonds q.1 q.2.1 q.2.2 bounded noLoops + ∃ vertex : Fin H.n ≃ Fin G.n, + ps = List.ofFn (fun v => position (vertex v)) ∧ + (∀ e : H.Edge, ∃ f : G.Edge, + s(vertex (H.left e),vertex (H.right e)) = s(G.left f,G.right f)) ∧ + (∀ f : G.Edge, ∃ e : H.Edge, + s(vertex (H.left e),vertex (H.right e)) = s(G.left f,G.right f)) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPacketRoutingGeometry.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPacketRoutingGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..a0d09fcd74994f0ba212b12ba3dde24039ae2b06 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPacketRoutingGeometry.lean @@ -0,0 +1,57 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPlanarTapeGeometry +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPacketGeometry + +namespace OAI + +/-! Packet support and the finite permission table suffice to recover the +actual emitted planar family and its final nearest-neighbor embedding. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPlanarTapeGeometry +open QuantumPlanarTapeProgram +open scoped Classical + +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) (x : Input) + (hg : QMAPacketGeometry (P.crossingOutput N hD) (P.crossingPosition N D) x.1.1 x.1.2) + (hallowed : ∀ B, QuantumRoutingTable.allowed x.2 B = + QuantumRoutingTable.allowed P.routingTable B) + (havoid : ∀ i : P.Interior, ∀ v, P.cell i ≠ P.position v) + (hpositive : ∀ v, 0 < (P.position v).1 ∧ 0 < (P.position v).2) + {X Y : ℕ} + (hsource : ∀ v, (P.position v).1 < X ∧ (P.position v).2 < Y) + (hpath : ∀ e k, k ≤ P.length e → (P.point e k).1 < X ∧ (P.point e k).2 < Y) + +include hD hg hallowed havoid hpositive hsource hpath in +theorem planar_family : + ∃ R : QMAPlanarRouteData (graph x hg.noLoops), + (N,value x) = QuantumEvenTapeGeometry.input R (Equiv.refl _) N ∧ + (∀ e, R.length e ≤ 20) ∧ R.Bounded (32*X) (32*Y) := by + obtain ⟨v,hpos,hforward,hbackward⟩ := hg.matching + exact ⟨route P N hD x hg.bounded hg.noLoops v hforward hbackward havoid hpositive, + even_input_eq P N hD x hg.bounded hg.noLoops v hforward hbackward havoid hpositive + hpos hallowed N, + route_length P N hD x hg.bounded hg.noLoops v hforward hbackward havoid hpositive, + route_bounded P N hD x hg.bounded hg.noLoops v hforward hbackward havoid hpositive + hsource hpath⟩ + +include hD hg hallowed havoid hpositive hsource hpath in +theorem final_realization (hN : 0 < N) : + let s := QuantumListRouteProgram.iterate N QuantumFinalRoutingProgram.rounds + (QuantumEvenTapeProgram.value (N,value x)) + ∃ (hs : QuantumListSchedule.Valid s.1) + (Q : QMAPathEmbedding (QuantumListSchedule.schedule s.1 hs)), + QuantumListRouteProgram.Represents s hs Q ∧ Q.Bounded (256*X) (256*Y) ∧ + (∀ e, qmaSquareGrid.Adj (Q.position ((QuantumListSchedule.schedule s.1 hs).graph.left e)) + (Q.position ((QuantumListSchedule.schedule s.1 hs).graph.right e))) := by + obtain ⟨R,hinput,hL,hbox⟩ := planar_family P N hD x hg hallowed havoid hpositive hsource hpath + have h := QuantumEvenTapeGeometry.realizes R (Equiv.refl _) N hN hL hbox + rw [← hinput] at h + obtain ⟨hs,Q,hQ,hbox',hgrid,_,_⟩ := h + exact ⟨hs,Q,hQ,by simpa only [← Nat.mul_assoc,show 8*32=256 by decide] using hbox',hgrid⟩ + +end ContinuumCoulomb.QuantumPlanarTapeGeometry + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedBasis.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedBasis.lean new file mode 100644 index 0000000000000000000000000000000000000000..e21ea4f0949309711ddeb7bf35c4e74efba667a6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedBasis.lean @@ -0,0 +1,87 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridCircuit + +namespace OAI + +/-! Splitting the original register from fresh grid wires. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical + +def qmaAppendBasis (n m : ℕ) : SourceSpinBasis (n+m) ≃ SourceSpinBasis n × SourceSpinBasis m where + toFun s := (fun i => s (Fin.castAdd m i),fun j => s (Fin.natAdd n j)) + invFun p := Fin.addCases p.1 p.2 + left_inv s := by + funext k + refine Fin.addCases (fun i => ?_) (fun j => ?_) k + · simp only [Fin.addCases_left] + · simp only [Fin.addCases_right] + right_inv p := by simp + +def qmaPaddedIndex (work extra : ℕ) : Fin ((work+1)+extra) ≃ Fin (work+extra+1) := + finCongr (by omega) + +def qmaPaddedBasis (work extra : ℕ) : + SourceSpinBasis (work+extra+1) ≃ SourceSpinBasis (work+1) × SourceSpinBasis extra := + (Equiv.arrowCongr (qmaPaddedIndex work extra).symm (Equiv.refl (Fin 2))).trans + (qmaAppendBasis (work+1) extra) + +def qmaPaddedLeft (work extra : ℕ) (i : Fin (work+1)) : Fin (work+extra+1) := + qmaPaddedIndex work extra (Fin.castAdd extra i) + +def qmaPaddedRight (work extra : ℕ) (i : Fin extra) : Fin (work+extra+1) := + qmaPaddedIndex work extra (Fin.natAdd (work+1) i) + +theorem qmaPaddedLeft_injective (work extra : ℕ) : Function.Injective (qmaPaddedLeft work extra) := + (qmaPaddedIndex work extra).injective.comp (Fin.castAdd_injective (work+1) extra) + +theorem qmaPaddedLeft_ne_right (work extra : ℕ) (i : Fin (work+1)) (j : Fin extra) : + qmaPaddedLeft work extra i ≠ qmaPaddedRight work extra j := by + intro h + have hv := congrArg Fin.val ((qmaPaddedIndex work extra).injective h) + simp only [Fin.val_castAdd,Fin.val_natAdd] at hv + have hi := i.isLt + omega + +theorem qmaPaddedBasis_left (work extra : ℕ) (s : SourceSpinBasis (work+extra+1)) + (i : Fin (work+1)) : (qmaPaddedBasis work extra s).1 i = s (qmaPaddedLeft work extra i) := rfl + +theorem qmaPaddedBasis_right (work extra : ℕ) (s : SourceSpinBasis (work+extra+1)) + (i : Fin extra) : (qmaPaddedBasis work extra s).2 i = s (qmaPaddedRight work extra i) := rfl + +theorem qmaPaddedBasis_symm_left (work extra : ℕ) + (p : SourceSpinBasis (work+1) × SourceSpinBasis extra) (i : Fin (work+1)) : + (qmaPaddedBasis work extra).symm p (qmaPaddedLeft work extra i) = p.1 i := + congrFun (congrArg Prod.fst ((qmaPaddedBasis work extra).apply_symm_apply p)) i + +theorem qmaPaddedBasis_symm_right (work extra : ℕ) + (p : SourceSpinBasis (work+1) × SourceSpinBasis extra) (i : Fin extra) : + (qmaPaddedBasis work extra).symm p (qmaPaddedRight work extra i) = p.2 i := + congrFun (congrArg Prod.snd ((qmaPaddedBasis work extra).apply_symm_apply p)) i + +theorem sourceTensor_padded (work extra : ℕ) + (M : Fin (work+extra+1) → Matrix (Fin 2) (Fin 2) ℂ) : + (sourceTensor (work+extra+1) M).submatrix + (qmaPaddedBasis work extra).symm (qmaPaddedBasis work extra).symm = + sourceTensor (work+1) (fun i => M (qmaPaddedLeft work extra i)) ⊗ₖ + sourceTensor extra (fun j => M (qmaPaddedRight work extra j)) := by + ext p q + change (∏ k, M k ((qmaPaddedBasis work extra).symm p k) + ((qmaPaddedBasis work extra).symm q k)) = _ + rw [← (qmaPaddedIndex work extra).prod_comp] + rw [Fin.prod_univ_add] + change (∏ i, M (qmaPaddedLeft work extra i) + ((qmaPaddedBasis work extra).symm p (qmaPaddedLeft work extra i)) + ((qmaPaddedBasis work extra).symm q (qmaPaddedLeft work extra i)))* + (∏ j, M (qmaPaddedRight work extra j) + ((qmaPaddedBasis work extra).symm p (qmaPaddedRight work extra j)) + ((qmaPaddedBasis work extra).symm q (qmaPaddedRight work extra j))) = _ + simp only [qmaPaddedBasis_symm_left,qmaPaddedBasis_symm_right] + rfl + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedEvolution.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedEvolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..6783c59ae857b06d93f298124ba905ba50d58284 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedEvolution.lean @@ -0,0 +1,84 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedInput + +namespace OAI + +/-! Exact tensor evolution of the verifier together with zero fresh wires. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical + +theorem qmaTensor_zero_vector {α β : Type*} [Fintype α] [Fintype β] [DecidableEq β] + (M : Matrix α α ℂ) (u : α → ℂ) (b : β) (p : α × β) : + (M ⊗ₖ (1 : Matrix β β ℂ)).mulVec (fun q => u q.1*(if q.2 = b then 1 else 0)) p = + M.mulVec u p.1*(if p.2 = b then 1 else 0) := by + simp only [Matrix.mulVec,dotProduct,Fintype.sum_prod_type] + simp only [mul_ite,mul_one,mul_zero,Finset.sum_ite_eq',Finset.mem_univ,ite_true] + by_cases hp : p.2 = b <;> simp [Matrix.one_apply,hp] + +theorem qmaPadded_apply (work extra : ℕ) + (N : Matrix (SourceSpinBasis (work+extra+1)) (SourceSpinBasis (work+extra+1)) ℂ) + (M : Matrix (SourceSpinBasis (work+1)) (SourceSpinBasis (work+1)) ℂ) + (hN : N.submatrix (qmaPaddedBasis work extra).symm (qmaPaddedBasis work extra).symm = + M ⊗ₖ (1 : Matrix (SourceSpinBasis extra) (SourceSpinBasis extra) ℂ)) + (v : SourceSpinBasis (work+extra+1) → ℂ) (u : SourceSpinBasis (work+1) → ℂ) + (hv : ∀ s, v s = u (qmaPaddedBasis work extra s).1* + (if (qmaPaddedBasis work extra s).2 = 0 then 1 else 0)) + (s : SourceSpinBasis (work+extra+1)) : + N.mulVec v s = M.mulVec u (qmaPaddedBasis work extra s).1* + (if (qmaPaddedBasis work extra s).2 = 0 then 1 else 0) := by + let B := qmaPaddedBasis work extra + have hu : v ∘ B.symm = fun p => u p.1*(if p.2 = 0 then 1 else 0) := by + funext p + simp only [Function.comp_apply,hv,B,Equiv.apply_symm_apply] + have h := Matrix.submatrix_mulVec_equiv N (v ∘ B.symm) B.symm B.symm + have he : (v ∘ B.symm) ∘ B = v := by funext s; simp + change N.submatrix B.symm B.symm *ᵥ (v ∘ B.symm) = + (N *ᵥ ((v ∘ B.symm) ∘ B)) ∘ B.symm at h + rw [he,show N.submatrix B.symm B.symm = _ from hN,hu] at h + have hp := congrFun h (B s) + simpa only [Function.comp_apply,Equiv.symm_apply_apply,qmaTensor_zero_vector] using hp.symm + +theorem qmaOutputVector_padded (c : QMACircuit) (hc : c.WellFormed) (extra : ℕ) + (psi : EuclideanSpace ℂ (SourceSpinBasis c.witness)) + (s : SourceSpinBasis (c.work+extra+1)) : + qmaOutputVector (qmaPaddedCircuit c extra) (qmaPaddedCircuit_wellFormed c hc extra) psi s = + qmaOutputVector c hc psi (qmaPaddedBasis c.work extra s).1 * + if (qmaPaddedBasis c.work extra s).2 = 0 then 1 else 0 := by + apply qmaPadded_apply c.work extra (qmaCircuitMatrix (qmaPaddedCircuit c extra)) + (qmaCircuitMatrix c) (qmaGateProduct_padded c.work extra c.gates) + (qmaInitialState (qmaPaddedCircuit c extra) (qmaPaddedCircuit_wellFormed c hc extra) psi) + (qmaInitialState c hc psi) (qmaInitialState_padded c hc extra psi) s + +theorem qmaPaddedOutput_probability (c : QMACircuit) (hc : c.WellFormed) (extra : ℕ) + (psi : EuclideanSpace ℂ (SourceSpinBasis c.witness)) (i : Fin (c.work+1)) (b : Fin 2) : + ‖qmaMask (fun s => s (qmaPaddedLeft c.work extra i) = b) + (qmaOutputVector (qmaPaddedCircuit c extra) (qmaPaddedCircuit_wellFormed c hc extra) psi)‖^2 = + ‖qmaMask (fun s => s i = b) (qmaOutputVector c hc psi)‖^2 := by + have hout (p : SourceSpinBasis (c.work+1) × SourceSpinBasis extra) : + (qmaOutputVector (qmaPaddedCircuit c extra) + (qmaPaddedCircuit_wellFormed c hc extra) psi).ofLp + ((qmaPaddedBasis c.work extra).symm p) = + (qmaOutputVector c hc psi).ofLp p.1 * (if p.2 = 0 then 1 else 0) := by + simpa only [Equiv.apply_symm_apply] using + qmaOutputVector_padded c hc extra psi ((qmaPaddedBasis c.work extra).symm p) + rw [qmaMask_norm_sq,qmaMask_norm_sq] + rw [←(qmaPaddedBasis c.work extra).symm.sum_comp] + simp only [hout,qmaPaddedBasis_symm_left,Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro a _ + by_cases ha : a i = b + · simp only [ha,ite_true] + rw [Finset.sum_eq_single (0 : SourceSpinBasis extra)] + · simp + · intro x _ hx + simp [hx] + · simp + · simp [ha] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedGate.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedGate.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd63da06739b1e1cb7ab955a13dcf4c6fc3c5637 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedGate.lean @@ -0,0 +1,109 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedBasis + +namespace OAI + +/-! Fresh wires are exact identity spectators for the lifted verifier circuit. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical + +theorem qmaControlledNot_padded_left (work extra : ℕ) (c t : Fin (work+1)) + (s : SourceSpinBasis (work+extra+1)) : + (qmaPaddedBasis work extra + (qmaControlledNot (work+extra) (qmaPaddedLeft work extra c) (qmaPaddedLeft work extra t) s)).1 = + qmaControlledNot work c t (qmaPaddedBasis work extra s).1 := by + funext i + by_cases hit : i = t + · subst i + by_cases hc : s (qmaPaddedLeft work extra c) = 1 <;> + simp [qmaControlledNot,qmaPaddedBasis_left,hc] + · have hleft := (qmaPaddedLeft_injective work extra).ne hit + simp [qmaPaddedBasis_left,qmaControlledNot,hit,hleft] + +theorem qmaControlledNot_padded_right (work extra : ℕ) (c t : Fin (work+1)) + (s : SourceSpinBasis (work+extra+1)) : + (qmaPaddedBasis work extra + (qmaControlledNot (work+extra) (qmaPaddedLeft work extra c) (qmaPaddedLeft work extra t) s)).2 = + (qmaPaddedBasis work extra s).2 := by + funext j + have hj := (qmaPaddedLeft_ne_right work extra t j).symm + simp [qmaPaddedBasis_right,qmaControlledNot,hj] + +theorem qmaGateMatrix_padded (work extra : ℕ) (g : QMAGate) : + (qmaGateMatrix (work+extra) (qmaMapGate work (work+extra) (qmaPaddedLeft work extra) g)).submatrix + (qmaPaddedBasis work extra).symm (qmaPaddedBasis work extra).symm = + qmaGateMatrix work g ⊗ₖ (1 : Matrix (SourceSpinBasis extra) (SourceSpinBasis extra) ℂ) := by + cases g with + | hadamard i => + simp only [qmaMapGate,qmaGateMatrix,qmaQubit_fin] + rw [sourceTensor_padded] + have hl : (fun k : Fin (work+1) => + if qmaPaddedLeft work extra k = qmaPaddedLeft work extra (qmaQubit work i) + then qmaHadamard else 1) = (fun k => if k = qmaQubit work i then qmaHadamard else 1) := by + funext k + simp only [(qmaPaddedLeft_injective work extra).eq_iff] + have hr : (fun k : Fin extra => + if qmaPaddedRight work extra k = qmaPaddedLeft work extra (qmaQubit work i) + then qmaHadamard else 1) = (fun _ => 1) := by + funext k + exact ite_eq_right (qmaPaddedLeft_ne_right work extra (qmaQubit work i) k).symm + rw [hl,hr,sourceTensor_one] + | phaseT i => + simp only [qmaMapGate,qmaGateMatrix,qmaQubit_fin] + rw [sourceTensor_padded] + have hl : (fun k : Fin (work+1) => + if qmaPaddedLeft work extra k = qmaPaddedLeft work extra (qmaQubit work i) + then qmaPhaseT else 1) = (fun k => if k = qmaQubit work i then qmaPhaseT else 1) := by + funext k + simp only [(qmaPaddedLeft_injective work extra).eq_iff] + have hr : (fun k : Fin extra => + if qmaPaddedRight work extra k = qmaPaddedLeft work extra (qmaQubit work i) + then qmaPhaseT else 1) = (fun _ => 1) := by + funext k + exact ite_eq_right (qmaPaddedLeft_ne_right work extra (qmaQubit work i) k).symm + rw [hl,hr,sourceTensor_one] + | controlledNot i j => + simp only [qmaMapGate,qmaGateMatrix,qmaQubit_fin] + ext p q + let B := qmaPaddedBasis work extra + let F := qmaControlledNot (work+extra) (qmaPaddedLeft work extra (qmaQubit work i)) + (qmaPaddedLeft work extra (qmaQubit work j)) + let f := qmaControlledNot work (qmaQubit work i) (qmaQubit work j) + have hb : B (F (B.symm q)) = (f q.1,q.2) := by + apply Prod.ext + · rw [qmaControlledNot_padded_left] + simp only [B,f,Equiv.apply_symm_apply] + · rw [qmaControlledNot_padded_right] + simp only [B,Equiv.apply_symm_apply] + have he : B.symm p = F (B.symm q) ↔ p = (f q.1,q.2) := by + constructor + · intro h + simpa only [Equiv.apply_symm_apply,hb] using congrArg B h + · intro h + apply B.injective + simpa only [Equiv.apply_symm_apply,hb] using h + change (if B.symm p = F (B.symm q) then (1:ℂ) else 0) = + (if p.1 = f q.1 then 1 else 0)*(if p.2 = q.2 then 1 else 0) + by_cases h₁ : p.1 = f q.1 <;> by_cases h₂ : p.2 = q.2 <;> + simp [he,Prod.ext_iff,h₁,h₂] + +theorem qmaGateProduct_padded (work extra : ℕ) (gs : List QMAGate) : + (qmaGateProduct (work+extra) (gs.map (qmaMapGate work (work+extra) (qmaPaddedLeft work extra)))).submatrix + (qmaPaddedBasis work extra).symm (qmaPaddedBasis work extra).symm = + qmaGateProduct work gs ⊗ₖ (1 : Matrix (SourceSpinBasis extra) (SourceSpinBasis extra) ℂ) := by + induction gs using List.reverseRecOn with + | nil => simp [qmaGateProduct_nil,Matrix.submatrix_one_equiv] + | append_singleton gs g ih => + simp only [List.map_append,List.map_cons,List.map_nil,qmaGateProduct_append, + qmaGateProduct_singleton] + rw [←Matrix.submatrix_mul_equiv _ _ (qmaPaddedBasis work extra).symm + (qmaPaddedBasis work extra).symm (qmaPaddedBasis work extra).symm, + qmaGateMatrix_padded,ih,←Matrix.mul_kronecker_mul,one_mul] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedHistory.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedHistory.lean new file mode 100644 index 0000000000000000000000000000000000000000..ff87a62c8418af6552ab03432f3af9303612b082 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedHistory.lean @@ -0,0 +1,119 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedLocal +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliRounding + +namespace OAI + +/-! A literal 4096-word family for each actual ordered history term. The +term type is a product, so its emitted order requires no filtered finite type. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPaddedHistory +open QuantumAlgebraicHistory +open scoped BigOperators Classical + +abbrev Term (c : QMACircuit) := + QMAReferenceTerm (qmaHistoryReferenceWork c) × (Fin 6 → Fin 4) + +def widthIndex (n : ℕ) (hn : n ≤ 6) : + (Fin 6 → Fin 4) ≃ (Fin (n+(6-n)) → Fin 4) := + Equiv.cast (by rw [Nat.add_sub_of_le hn]) + +def tableMatrix (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) := + denote (orderedTable c hT a) + +theorem tableMatrix_eq (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) : + tableMatrix c hT a = + (qmaLocalCore ((qmaOrderedHistoryModel c hT).sites a) + ((qmaOrderedHistoryModel c hT).matrix a)).submatrix + (fun s i => s ((QuantumOrderedSupport.supportEquiv c hT a).symm i)) + (fun s i => s ((QuantumOrderedSupport.supportEquiv c hT a).symm i)) := by + ext s t + exact congrFun (congrFun (denote_orderedCore c hT a) _) _ + +theorem tableMatrix_hermitian (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) : + (tableMatrix c hT a).IsHermitian := by + rw [tableMatrix_eq] + exact (qmaLocalCore_hermitian _ _ ((qmaOrderedHistoryModel c hT).hermitian a)).submatrix _ + +theorem tableMatrix_real (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) (s t) : + (tableMatrix c hT a s t).im = 0 := by + rw [tableMatrix_eq] + exact qmaLocalCore_real _ _ ((qmaOrderedHistoryModel c hT).real a) _ _ + +def word (c : QMACircuit) (hT : 0 < c.gates.length) (p : Term c) : + (qmaOrderedHistoryModel c hT).Q → Fin 4 := + QuantumPaddedLocal.word ((qmaOrderedHistoryModel c hT).sites p.1) + (QuantumOrderedSupport.supportEquiv c hT p.1) + (6-(QuantumOrderedSupport.sites c hT p.1).length) + (widthIndex _ (QuantumOrderedSupport.sites_length c hT p.1) p.2) + +def coefficient (c : QMACircuit) (hT : 0 < c.gates.length) (p : Term c) : ℝ := + QuantumPaddedPauli.paddedCoefficient + (QuantumOrderedSupport.sites c hT p.1).length + (6-(QuantumOrderedSupport.sites c hT p.1).length) + (tableMatrix c hT p.1) + (widthIndex _ (QuantumOrderedSupport.sites_length c hT p.1) p.2) + +theorem term_sum (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) : + (∑ w : Fin 6 → Fin 4, (coefficient c hT (a,w):ℂ) • + qmaPauliWord (word c hT (a,w))) = (qmaOrderedHistoryModel c hT).matrix a := by + let n := (QuantumOrderedSupport.sites c hT a).length + let S : Finset (QuantumOrderedSupport.Qubit c) := (qmaOrderedHistoryModel c hT).sites a + let e : Fin n ≃ {i // i ∈ S} := QuantumOrderedSupport.supportEquiv c hT a + let A := tableMatrix c hT a + let f : (Fin (n+(6-n)) → Fin 4) → + Matrix (QuantumOrderedSupport.Qubit c → Fin 2) (QuantumOrderedSupport.Qubit c → Fin 2) ℂ := + fun v => (QuantumPaddedPauli.paddedCoefficient n (6-n) A v:ℂ) • + qmaPauliWord (QuantumPaddedLocal.word S e (6-n) v) + have hsum := (widthIndex n (QuantumOrderedSupport.sites_length c hT a)).sum_comp f + have hfull := QuantumPaddedLocal.full_expansion S e (6-n) A + (tableMatrix_hermitian c hT a) (tableMatrix_real c hT a) + have he : QuantumPaddedLocal.reindex S e A = + qmaLocalCore ((qmaOrderedHistoryModel c hT).sites a) + ((qmaOrderedHistoryModel c hT).matrix a) := by + dsimp only [A] + rw [tableMatrix_eq] + ext s t + simp only [QuantumPaddedLocal.reindex,Matrix.submatrix_apply, + e] + apply congrArg₂ _ + · funext i + exact congrArg s ((QuantumOrderedSupport.supportEquiv c hT a).apply_symm_apply i) + · funext i + exact congrArg t ((QuantumOrderedSupport.supportEquiv c hT a).apply_symm_apply i) + have hend : qmaLocalLift S (QuantumPaddedLocal.reindex S e A) = + (qmaOrderedHistoryModel c hT).matrix a := by + rw [he] + exact ((qmaOrderedHistoryModel c hT).localOn a).core_lift + exact hsum.trans (hfull.trans hend) + +theorem family_sum (c : QMACircuit) (hT : 0 < c.gates.length) : + qmaPauliFamily (word c hT) (coefficient c hT) = + ∑ a, (qmaOrderedHistoryModel c hT).matrix a := by + rw [qmaPauliFamily,Fintype.sum_prod_type] + exact Finset.sum_congr rfl (fun a _ => term_sum c hT a) + +theorem term_count (c : QMACircuit) : + Fintype.card (Term c) = 4096*(4*c.gates.length+2*c.work+9) := by + simp only [Term,QMAReferenceTerm,Fintype.card_prod,Fintype.card_sum, + Fintype.card_fin,Fintype.card_fun,qmaHistoryReferenceWork] + ring + +theorem support (c : QMACircuit) (hT : 0 < c.gates.length) (p : Term c) : + qmaPauliSupport (word c hT p) ⊆ (qmaOrderedHistoryModel c hT).sites p.1 := + QuantumPaddedLocal.word_support _ _ _ _ + +theorem even (c : QMACircuit) (hT : 0 < c.gates.length) (p : Term c) : + Even (qmaPauliYCount (word c hT p)) := + QuantumPaddedLocal.word_even _ _ _ _ + +end ContinuumCoulomb.QuantumPaddedHistory + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedInput.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedInput.lean new file mode 100644 index 0000000000000000000000000000000000000000..c0083798315e62e503d775e594a324dc68506ddb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedInput.lean @@ -0,0 +1,96 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumWireState + +namespace OAI + +/-! The lifted circuit starts with exactly the original witness and zero fresh wires. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +abbrev qmaPaddedCircuit (c : QMACircuit) (extra : ℕ) : QMACircuit := + ⟨c.work+extra,c.witness, + c.gates.map (qmaMapGate c.work (c.work+extra) (qmaPaddedLeft c.work extra))⟩ + +theorem qmaPaddedCircuit_wellFormed (c : QMACircuit) (hc : c.WellFormed) (extra : ℕ) : + (qmaPaddedCircuit c extra).WellFormed := by + refine ⟨hc.1.trans (Nat.le_add_right _ _),?_⟩ + intro g hg + obtain ⟨f,hf,rfl⟩ := List.mem_map.mp hg + exact qmaMapGate_wellFormed c.work (c.work+extra) _ + (qmaPaddedLeft_injective c.work extra) f (hc.2 f hf) + +@[simp] theorem qmaPaddedLeft_val (work extra : ℕ) (i : Fin (work+1)) : + (qmaPaddedLeft work extra i).val = i.val := rfl + +@[simp] theorem qmaPaddedRight_val (work extra : ℕ) (i : Fin extra) : + (qmaPaddedRight work extra i).val = work+1+i.val := rfl + +theorem qmaPaddedAncillaZero (c : QMACircuit) (hc : c.WellFormed) (extra : ℕ) + (s : SourceSpinBasis (c.work+extra+1)) : + QMAAncillaZero (qmaPaddedCircuit c extra) s ↔ + QMAAncillaZero c (qmaPaddedBasis c.work extra s).1 ∧ + (qmaPaddedBasis c.work extra s).2 = 0 := by + constructor + · intro h + constructor + · intro i hi + exact h (qmaPaddedLeft c.work extra i) hi + · funext j + apply h (qmaPaddedRight c.work extra j) + change c.witness ≤ c.work+1+j.val + have hc' : c.witness ≤ c.work := hc.1 + omega + · rintro ⟨hl,hr⟩ k hk + suffices h : ∀ a : Fin ((c.work+1)+extra), + c.witness ≤ (qmaPaddedIndex c.work extra a).val → + s (qmaPaddedIndex c.work extra a) = 0 by + have hm := h ((qmaPaddedIndex c.work extra).symm k) + have he := (qmaPaddedIndex c.work extra).apply_symm_apply k + rw [he] at hm + exact hm hk + intro a + refine Fin.addCases (fun i => ?_) (fun j => ?_) a + · intro hi + exact hl i hi + · intro _ + exact congrFun hr j + +theorem qmaPaddedWitnessRestrict (c : QMACircuit) (hc : c.WellFormed) (extra : ℕ) + (s : SourceSpinBasis (c.work+extra+1)) : + qmaWitnessRestrict (qmaPaddedCircuit c extra) (qmaPaddedCircuit_wellFormed c hc extra) s = + qmaWitnessRestrict c hc (qmaPaddedBasis c.work extra s).1 := by + funext i + change s ⟨i.val,_⟩ = (qmaPaddedBasis c.work extra s).1 ⟨i.val,_⟩ + rw [qmaPaddedBasis_left] + congr 1 + +theorem qmaInitialState_padded (c : QMACircuit) (hc : c.WellFormed) (extra : ℕ) + (psi : EuclideanSpace ℂ (SourceSpinBasis c.witness)) + (s : SourceSpinBasis (c.work+extra+1)) : + qmaInitialState (qmaPaddedCircuit c extra) (qmaPaddedCircuit_wellFormed c hc extra) psi s = + qmaInitialState c hc psi (qmaPaddedBasis c.work extra s).1 * + if (qmaPaddedBasis c.work extra s).2 = 0 then 1 else 0 := by + by_cases hs : QMAAncillaZero (qmaPaddedCircuit c extra) s + · have hs' : ∀ i : Fin (c.work+extra+1), c.witness ≤ i.val → s i = 0 := hs + obtain ⟨hl,hr⟩ := (qmaPaddedAncillaZero c hc extra s).mp hs + have hl' : ∀ i : Fin (c.work+1), c.witness ≤ i.val → + (qmaPaddedBasis c.work extra s).1 i = 0 := hl + simp only [qmaInitialState,ite_eq_left hs',ite_eq_left hl',ite_eq_left hr,mul_one] + exact congrArg (fun v => psi v) (qmaPaddedWitnessRestrict c hc extra s) + · have hs' : ¬∀ i : Fin (c.work+extra+1), c.witness ≤ i.val → s i = 0 := hs + by_cases hl : QMAAncillaZero c (qmaPaddedBasis c.work extra s).1 + · have hr : (qmaPaddedBasis c.work extra s).2 ≠ 0 := + fun h => hs ((qmaPaddedAncillaZero c hc extra s).mpr ⟨hl,h⟩) + have hl' : ∀ i : Fin (c.work+1), c.witness ≤ i.val → + (qmaPaddedBasis c.work extra s).1 i = 0 := hl + simp only [qmaInitialState,ite_eq_right hs',ite_eq_left hl',ite_eq_right hr,mul_zero] + · have hl' : ¬∀ i : Fin (c.work+1), c.witness ≤ i.val → + (qmaPaddedBasis c.work extra s).1 i = 0 := hl + simp only [qmaInitialState,ite_eq_right hs',ite_eq_right hl',zero_mul] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedLabelData.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedLabelData.lean new file mode 100644 index 0000000000000000000000000000000000000000..1bb7a8a6c0d557613c7d795e68361d2ecf7abcd9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedLabelData.lean @@ -0,0 +1,72 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedHistory +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelData + +namespace OAI + +/-! The actual padded history word is obtained by zipping its literal +site-number list with a fixed local pattern. No spectator basis occurs. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPaddedHistory +open scoped Classical + +variable {ι : Type} [Fintype ι] [DecidableEq ι] + +omit [Fintype ι] in +private theorem local_word_at {n : ℕ} (S : Finset ι) (e : Fin n ≃ {i // i ∈ S}) + (m : ℕ) (w : Fin (n+m) → Fin 4) (i : Fin n) : + QuantumPaddedLocal.word S e m w (e i).val=QuantumPaddedPauli.paddedWord n m w i := by + simp only [QuantumPaddedLocal.word,qmaPauliExtend,dite_eq_left (e i).property] + apply congrArg (QuantumPaddedPauli.paddedWord n m w) + apply e.injective + rw [Equiv.apply_symm_apply] + +private theorem map_get_zip {α β γ : Type} (xs : List α) (g : α → β) + (f : Fin xs.length → γ) : + (List.ofFn (fun i => (g (xs.get i),f i)))= (xs.map g).zip (List.ofFn f) := by + apply List.ext_getElem + · simp + · intro i hi hj + simp + +def localLabels (n m : ℕ) (w : Fin (n+m) → Fin 4) : List ℕ := + List.ofFn (fun i => (QuantumPaddedPauli.paddedWord n m w i).val) + +theorem source_tag (c : QMACircuit) (hT : 0 < c.gates.length) (p : Term c) : + QuantumOrderedLabelData.tag (QuantumOrderedSupport.siteNumber c) + (QuantumOrderedSupport.sites c hT p.1) (word c hT p) = + (QuantumOrderedSupport.encodedSites c hT p.1).zip + (localLabels (QuantumOrderedSupport.sites c hT p.1).length + (6-(QuantumOrderedSupport.sites c hT p.1).length) + (widthIndex _ (QuantumOrderedSupport.sites_length c hT p.1) p.2)) := by + let xs := QuantumOrderedSupport.sites c hT p.1 + let e := QuantumOrderedSupport.supportEquiv c hT p.1 + let v : QuantumOrderedSupport.Qubit c → Fin 4 := word c hT p + let w := widthIndex _ (QuantumOrderedSupport.sites_length c hT p.1) p.2 + have hw (i : Fin xs.length) : + v (xs.get i)= + QuantumPaddedPauli.paddedWord xs.length (6-xs.length) w i := by + have hi := QuantumOrderedSupport.supportEquiv_apply c hT p.1 i + change (e i).val=xs.get i at hi + rw [← hi] + exact local_word_at _ e _ w i + change xs.map (fun i => (QuantumOrderedSupport.siteNumber c i,(v i).val)) = _ + calc + _ = List.ofFn (fun i : Fin xs.length => + (QuantumOrderedSupport.siteNumber c (xs.get i),(v (xs.get i)).val)) := + (List.ofFn_getElem_eq_map xs + (fun i => (QuantumOrderedSupport.siteNumber c i,(v i).val))).symm + _ = List.ofFn (fun i : Fin xs.length => + (QuantumOrderedSupport.siteNumber c (xs.get i), + (QuantumPaddedPauli.paddedWord xs.length (6-xs.length) w i).val)) := by + apply congrArg List.ofFn + funext i + rw [hw] + _ = _ := map_get_zip xs (QuantumOrderedSupport.siteNumber c) + (fun i => (QuantumPaddedPauli.paddedWord xs.length (6-xs.length) w i).val) + +end ContinuumCoulomb.QuantumPaddedHistory + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedLabelEnergy.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedLabelEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..7dceefa90c3802d31131d41160bebdef05ff65cb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedLabelEnergy.lean @@ -0,0 +1,59 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelEnergy +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedLabelTable + +namespace OAI + +/-! The actual padded history packets, followed by the literal local and +four-spin compiler, have total full-space error at most nine over N. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPaddedLabelProgram +open QuantumPaddedHistory QuantumOrderedSourceIndex +open scoped Classical + +def historyInput (c : QMACircuit) (hT : 0 < c.gates.length) (N : ℕ) : + QuantumOrderedLabelFamily.Input := + (N,qubitCount c,sourceEntries (QuantumAlgebraicHistory.samplePrecision c N) c hT) + +def historyOutput (c : QMACircuit) (hT : 0 < c.gates.length) (N : ℕ) := + QuantumOrderedLabelCompile.output (historyInput c hT N) + +def historyQubits (c : QMACircuit) (hT : 0 < c.gates.length) (N : ℕ) : ℕ := + QuantumOrderedLabelCompile.qubitCount (historyInput c hT N) + +theorem historyQubits_eq (c : QMACircuit) (hT : 0 < c.gates.length) (N : ℕ) : + historyQubits c hT N=4*(qubitCount c+3717*termCount c) := by + unfold historyQubits historyInput QuantumOrderedLabelCompile.qubitCount + rw [QuantumOrderedLabelPipeline.output_qubits,sourceEntries_length] + +theorem history_accuracy (c : QMACircuit) (hT : 0 < c.gates.length) + (N : ℕ) (hN : 0 < N) : + |MediatorGraph.normalizedBottom + (QuantumRawExchange.rawMatrix (historyQubits c hT N) (historyOutput c hT N))- + (qmaOrderedHistoryModel c hT).energy| ≤ 9/(N:ℝ) := by + let k := QuantumAlgebraicHistory.samplePrecision c N + have hc (p : Term c) : qmaPauliSupport (sourceWord c hT p) ⊆ + (QuantumOrderedSupport.sites c hT p.1).toFinset := by + rw [QuantumOrderedSupport.sites_finset] + exact support c hT p + have h₁ := QuantumOrderedLabelCompile.output_accuracy (qubits c) (sourceTerms c hT) + (fun p : Term c => QuantumOrderedSupport.sites c hT p.1) + (sourceWord c hT) (sampledWeight k c hT) + (fun p => QuantumOrderedSupport.sites_length c hT p.1) + (fun p => QuantumOrderedSupport.sites_nodup c hT p.1) hc (even c hT) N hN + have hi : historyInput c hT N = + (N,qubitCount c,QuantumOrderedLabelTable.table (sourceTerms c hT) + (QuantumOrderedLabelTable.index (qubits c)) + (fun p : Term c => QuantumOrderedSupport.sites c hT p.1) + (sourceWord c hT) (sampledWeight k c hT)) := by + unfold historyInput + rw [sourceEntries_table] + rw [← hi] at h₁ + have h₂ := sampled_accuracy c hT N hN + exact (abs_sub_le _ _ _).trans ((add_le_add h₁ h₂).trans_eq (by ring)) + +end ContinuumCoulomb.QuantumPaddedLabelProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedLabelMeaning.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedLabelMeaning.lean new file mode 100644 index 0000000000000000000000000000000000000000..f8567a20d68b59157e25e1c8410310a50e557457 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedLabelMeaning.lean @@ -0,0 +1,61 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedLabelProgram + +namespace OAI + +/-! Every emitted local packet entry is the actual padded history word +and its sampled coefficient, in the supplied support-list order. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPaddedLabelProgram +open QuantumAlgebraicScalar QuantumFixedPauli QuantumPaddedHistory +open scoped Classical + +-- The padded scalar table uses this same finite-domain decision. Matching it +-- keeps the fixed matrix enumeration opaque during the source-entry proof. +local instance finDecision (n : ℕ) : DecidableEq (Fin n) := Classical.decEq _ + +private theorem labels_eq_zip (n m : ℕ) (w : Fin (n+m) → Fin 4) + (xs : List ℕ) (hlen : xs.length=n) : + labels n m w xs = xs.zip (localLabels n m w) := by + apply List.ext_getElem + · simp [labels,localLabels,hlen] + · intro i hi hj + have hi' : i < xs.length := by simpa only [labels,List.length_ofFn,← hlen] using hi + simp only [labels,localLabels,List.getElem_ofFn,List.getElem_zip] + rw [List.headD_eq_head?_getD,List.head?_drop,List.getElem?_eq_getElem hi',Option.getD_some] + +theorem entry_source (k : ℕ) (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) + (w : Fin ((QuantumOrderedSupport.sites c hT a).length+ + (6-(QuantumOrderedSupport.sites c hT a).length)) → Fin 4) : + entry (QuantumOrderedSupport.sites c hT a).length + (6-(QuantumOrderedSupport.sites c hT a).length) w + (k,QuantumOrderedSupport.encodedSites c hT a, + matrixData (QuantumAlgebraicHistory.orderedTable c hT a)) = + let p : Term c := (a,(widthIndex _ (QuantumOrderedSupport.sites_length c hT a)).symm w) + (QuantumOrderedLabelData.tag (QuantumOrderedSupport.siteNumber c) + (QuantumOrderedSupport.sites c hT a) (word c hT p),sampledWeight k c hT p) := by + let p : Term c := (a,(widthIndex _ (QuantumOrderedSupport.sites_length c hT a)).symm w) + have hw : widthIndex _ (QuantumOrderedSupport.sites_length c hT a) p.2 = w := + (widthIndex _ (QuantumOrderedSupport.sites_length c hT a)).apply_symm_apply w + apply Prod.ext + · change labels _ _ w (QuantumOrderedSupport.encodedSites c hT a) = _ + rw [labels_eq_zip _ _ w _ (by simp only [QuantumOrderedSupport.encodedSites,List.length_map])] + have hs := source_tag c hT p + change QuantumOrderedLabelData.tag (QuantumOrderedSupport.siteNumber c) + (QuantumOrderedSupport.sites c hT a) (word c hT p) = + (QuantumOrderedSupport.encodedSites c hT a).zip (localLabels _ _ + (widthIndex _ (QuantumOrderedSupport.sites_length c hT a) p.2)) at hs + rw [hw] at hs + exact hs.symm + · change sample k (QuantumPaddedTable.coefficient _ _ _ w) = _ + unfold sampledWeight + apply congrArg (sample k) + unfold scalar + rw [hw] + +end ContinuumCoulomb.QuantumPaddedLabelProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedLabelProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedLabelProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..6f2b28131141e9cfe338bda7dd645160eb6f7a7d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedLabelProgram.lean @@ -0,0 +1,104 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedLabelData +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedSampling +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelFamily + +namespace OAI + +/-! Fixed-arity local history packets: sparse numeric labels and sampled +algebraic coefficients share exactly the same fixed Pauli-word order. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPaddedLabelProgram +open QuantumAlgebraicScalar QuantumFixedPauli QuantumPaddedHistory +open QuantumOrderedLabelData +open ExactQuantumFactoring.BitStackProgram +open scoped Classical + +abbrev Input := ℕ × (List ℕ × List Scalar) +def inputCode : Input → List Bool := + prodCode unaryCode (prodCode (listCode Nat.bits) matrixCode) + +def labels (n m : ℕ) (w : Fin (n+m) → Fin 4) (xs : List ℕ) : List Letter := + List.ofFn (fun i : Fin n => ((xs.drop i.val).headD 0, + (QuantumPaddedPauli.paddedWord n m w i).val)) + +def entry (n m : ℕ) (w : Fin (n+m) → Fin 4) (x : Input) : QuantumOrderedLabelFamily.Entry := + (labels n m w x.2.1,sample x.1 (QuantumPaddedTable.coefficient n m x.2.2 w)) + +def packet (n m : ℕ) (x : Input) : List QuantumOrderedLabelFamily.Entry := + (enumerate (Fin (n+m) → Fin 4)).map (fun w => entry n m w x) + +noncomputable opaque precisionProgram : Procedure inputCode unaryCode Prod.fst := Procedure.first _ _ +noncomputable opaque indicesProgram : Procedure inputCode (listCode Nat.bits) (fun x => x.2.1) := + (Procedure.first _ _).comp (Procedure.second _ _) +noncomputable opaque matrixProgram : Procedure inputCode matrixCode (fun x => x.2.2) := + (Procedure.second _ _).comp (Procedure.second _ _) + +noncomputable def labelsProgram (n m : ℕ) (w : Fin (n+m) → Fin 4) : + Procedure (listCode Nat.bits) labelsCode (labels n m w) := + QuantumRawExchange.fixedListProgram (listCode Nat.bits) labelCode n _ (fun i => + ((Procedure.listGet Nat.bits 0).comp + ((Procedure.constant (listCode Nat.bits) Nat.bits i.val).pair + (Procedure.identity (listCode Nat.bits)))).pair + (Procedure.constant (listCode Nat.bits) Nat.bits + (QuantumPaddedPauli.paddedWord n m w i).val)) + +noncomputable opaque entryProgram (n m : ℕ) (w : Fin (n+m) → Fin 4) : + Procedure inputCode QuantumOrderedLabelFamily.entryCode (entry n m w) := + ((labelsProgram n m w).comp indicesProgram).pair + (sampleProgram.comp (precisionProgram.pair + ((QuantumPaddedTable.coefficientProgram n m w).comp matrixProgram))) + +noncomputable def packetProgram (n m : ℕ) : + Procedure inputCode (listCode QuantumOrderedLabelFamily.entryCode) (packet n m) := + (QuantumRawExchange.fixedListProgram inputCode QuantumOrderedLabelFamily.entryCode + (Fintype.card (Fin (n+m) → Fin 4)) + (fun i x => entry n m ((Fintype.equivFin (Fin (n+m) → Fin 4)).symm i) x) + (fun i => entryProgram n m ((Fintype.equivFin (Fin (n+m) → Fin 4)).symm i))).congrFun + (by intro x; simp only [packet,enumerate,List.map_ofFn,Function.comp_def]) + +def uniformPacket (x : Input) : List QuantumOrderedLabelFamily.Entry := + if x.2.1.length=0 then packet 0 6 x else + if x.2.1.length=1 then packet 1 5 x else + if x.2.1.length=2 then packet 2 4 x else + if x.2.1.length=3 then packet 3 3 x else + if x.2.1.length=4 then packet 4 2 x else + if x.2.1.length=5 then packet 5 1 x else packet 6 0 x + +noncomputable opaque uniformProgram : Procedure inputCode + (listCode QuantumOrderedLabelFamily.entryCode) uniformPacket := by + let count := Procedure.unaryToBits.comp + ((ExactQuantumFactoring.NativeAIG.Emission.listUnaryLength Nat.bits 0).comp indicesProgram) + let test (n : ℕ) := Procedure.binaryEq.comp + (count.pair (Procedure.constant inputCode Nat.bits n)) + exact (Procedure.conditional (test 0) (packetProgram 0 6) + (Procedure.conditional (test 1) (packetProgram 1 5) + (Procedure.conditional (test 2) (packetProgram 2 4) + (Procedure.conditional (test 3) (packetProgram 3 3) + (Procedure.conditional (test 4) (packetProgram 4 2) + (Procedure.conditional (test 5) (packetProgram 5 1) (packetProgram 6 0))))))).congrFun + (by intro x; simp only [uniformPacket,Function.comp_apply,id_eq,decide_eq_true_eq]) + +theorem uniformPacket_eq (x : Input) (h : x.2.1.length ≤ 6) : + uniformPacket x=packet x.2.1.length (6-x.2.1.length) x := by + generalize hn : x.2.1.length=n at * + interval_cases n <;> simp only [uniformPacket,hn] <;> norm_num + +theorem packet_length (n m : ℕ) (x : Input) : + (packet n m x).length=4^(n+m) := by + simp only [packet,List.length_map,enumerate,List.length_ofFn,Fintype.card_fun, + Fintype.card_fin] + +theorem uniformPacket_length (x : Input) (h : x.2.1.length ≤ 6) : + (uniformPacket x).length=4096 := by + rw [uniformPacket_eq x h,packet_length,Nat.add_sub_of_le h] + norm_num + +noncomputable def certificate : Turing.TM2ComputableInPolyTime inputCode + (listCode QuantumOrderedLabelFamily.entryCode) uniformPacket := uniformProgram.toTM2 + +end ContinuumCoulomb.QuantumPaddedLabelProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedLabelTable.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedLabelTable.lean new file mode 100644 index 0000000000000000000000000000000000000000..d0cb4a7b22522a11a735384d2ce60842512b57ae --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedLabelTable.lean @@ -0,0 +1,104 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedLabelMeaning +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedSourceIndex + +namespace OAI + +/-! The literal concatenation of fixed-width history packets is an exact +enumeration of the actual padded history family. The local pattern order is +allowed to depend on the support width; its explicit bijection is retained. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPaddedLabelProgram +open QuantumAlgebraicScalar QuantumFixedPauli QuantumPaddedHistory +open scoped Classical + +private theorem pattern_card (n : ℕ) (hn : n ≤ 6) : + Fintype.card (Fin (n+(6-n)) → Fin 4) = QuantumOrderedSourceIndex.patternCount := by + simp only [QuantumOrderedSourceIndex.patternCount,QuantumOrderedSourceIndex.Pattern, + Fintype.card_fun,Fintype.card_fin,Nat.add_sub_of_le hn] + +def packetPatterns (n : ℕ) (hn : n ≤ 6) : + Fin QuantumOrderedSourceIndex.patternCount ≃ (Fin (n+(6-n)) → Fin 4) := + (finCongr (pattern_card n hn).symm).trans (Fintype.equivFin _).symm + +theorem packet_reindex (n : ℕ) (hn : n ≤ 6) (x : Input) : + packet n (6-n) x = List.ofFn (fun j => entry n (6-n) (packetPatterns n hn j) x) := by + simp only [packet,enumerate,List.map_ofFn,Function.comp_def] + rw [List.ofFn_congr (pattern_card n hn)] + rfl + +local instance tableFinDecision (n : ℕ) : DecidableEq (Fin n) := Classical.decEq _ + +def sourceInput (k : ℕ) (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) : Input := + (k,QuantumOrderedSupport.encodedSites c hT a, + matrixData (QuantumAlgebraicHistory.orderedTable c hT a)) + +def sourceEntries (k : ℕ) (c : QMACircuit) (hT : 0 < c.gates.length) : + List QuantumOrderedLabelFamily.Entry := + (List.ofFn (fun i : Fin (QuantumOrderedSourceIndex.referenceCount c) => + uniformPacket (sourceInput k c hT (QuantumOrderedSourceIndex.reference c i)))).flatten + +def sourceTerms (c : QMACircuit) (hT : 0 < c.gates.length) : + Fin (QuantumOrderedSourceIndex.referenceCount c*QuantumOrderedSourceIndex.patternCount) ≃ Term c := + finProdFinEquiv.symm.trans (Equiv.prodShear (QuantumOrderedSourceIndex.reference c) + (fun i => + let a := QuantumOrderedSourceIndex.reference c i + let hn := QuantumOrderedSupport.sites_length c hT a + (packetPatterns _ hn).trans (widthIndex _ hn).symm)) + +def sourceWord (c : QMACircuit) (hT : 0 < c.gates.length) (p : Term c) : + QuantumOrderedSupport.Qubit c → Fin 4 := word c hT p + +theorem sourceEntries_table (k : ℕ) (c : QMACircuit) (hT : 0 < c.gates.length) : + sourceEntries k c hT = + QuantumOrderedLabelTable.table (sourceTerms c hT) + (QuantumOrderedLabelTable.index (QuantumOrderedSourceIndex.qubits c)) + (fun p => QuantumOrderedSupport.sites c hT p.1) + (sourceWord c hT) (sampledWeight k c hT) := by + unfold sourceEntries QuantumOrderedLabelTable.table sourceTerms + simp only [Equiv.trans_apply] + let entryAt (j : Fin (QuantumOrderedSourceIndex.referenceCount c) × + Fin QuantumOrderedSourceIndex.patternCount) := + let p := Equiv.prodShear (QuantumOrderedSourceIndex.reference c) + (fun i => (packetPatterns _ (QuantumOrderedSupport.sites_length c hT + (QuantumOrderedSourceIndex.reference c i))).trans + (widthIndex _ (QuantumOrderedSupport.sites_length c hT + (QuantumOrderedSourceIndex.reference c i))).symm) j + (QuantumOrderedLabelData.tag + (QuantumOrderedLabelTable.index (QuantumOrderedSourceIndex.qubits c)) + (QuantumOrderedSupport.sites c hT p.1) (sourceWord c hT p),sampledWeight k c hT p) + change _ = List.ofFn (fun i => entryAt (finProdFinEquiv.symm i)) + rw [QuantumOrderedLabelTable.product_table entryAt] + dsimp only [entryAt] + apply congrArg List.flatten + apply congrArg List.ofFn + funext i + let a := QuantumOrderedSourceIndex.reference c i + have hn := QuantumOrderedSupport.sites_length c hT a + rw [uniformPacket_eq _ (by + simpa only [sourceInput,QuantumOrderedSupport.encodedSites,List.length_map] using hn)] + rw [show (sourceInput k c hT (QuantumOrderedSourceIndex.reference c i)).2.1.length = + (QuantumOrderedSupport.sites c hT a).length by + simp only [sourceInput,QuantumOrderedSupport.encodedSites,List.length_map,a]] + change packet (QuantumOrderedSupport.sites c hT a).length + (6-(QuantumOrderedSupport.sites c hT a).length) (sourceInput k c hT a) = _ + rw [packet_reindex _ hn] + apply congrArg List.ofFn + funext j + have h := entry_source k c hT a (packetPatterns _ hn j) + simpa only [sourceInput,sourceWord,Equiv.trans_apply,Equiv.prodShear_apply, + Equiv.symm_apply_apply, + QuantumOrderedSourceIndex.qubits_index] using h + +theorem sourceEntries_length (k : ℕ) (c : QMACircuit) (hT : 0 < c.gates.length) : + (sourceEntries k c hT).length = QuantumOrderedSourceIndex.termCount c := by + rw [sourceEntries_table] + simp only [QuantumOrderedLabelTable.table,List.length_ofFn, + QuantumOrderedSourceIndex.termCount] + +end ContinuumCoulomb.QuantumPaddedLabelProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedLocal.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedLocal.lean new file mode 100644 index 0000000000000000000000000000000000000000..8bdfd62f846f90ac0420dc35e0ce8bedd766417e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedLocal.lean @@ -0,0 +1,82 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedPauli +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedTable + +namespace OAI + +/-! Exact full-space meaning of a fixed-width local coefficient table. +The coordinate map is the order of the literal support list; padding only +duplicates local words and never introduces spectator configurations. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPaddedLocal +open scoped BigOperators Classical + +variable {ι : Type} [Fintype ι] [DecidableEq ι] + +def reindex {n : ℕ} (S : Finset ι) (e : Fin n ≃ {i // i ∈ S}) + (A : Matrix (Fin n → Fin 2) (Fin n → Fin 2) ℂ) : + Matrix (QMASupportBasis S) (QMASupportBasis S) ℂ := + fun s t => A (fun i => s (e i)) (fun i => t (e i)) + +def word {n : ℕ} (S : Finset ι) (e : Fin n ≃ {i // i ∈ S}) (m : ℕ) + (w : Fin (n+m) → Fin 4) : ι → Fin 4 := + qmaPauliExtend S (fun i => QuantumPaddedPauli.paddedWord n m w (e.symm i)) + +theorem word_support {n : ℕ} (S : Finset ι) (e : Fin n ≃ {i // i ∈ S}) + (m : ℕ) (w : Fin (n+m) → Fin 4) : qmaPauliSupport (word S e m w) ⊆ S := + qmaPauliExtend_support _ _ + +theorem yCount_reindex {α β : Type} [Fintype α] [Fintype β] + [DecidableEq α] [DecidableEq β] (e : α ≃ β) (v : β → Fin 4) : + qmaPauliYCount (fun i => v (e i)) = qmaPauliYCount v := by + unfold qmaPauliYCount + refine Finset.card_bij (fun i _ => e i) ?_ ?_ ?_ + · intro i hi + simpa only [Finset.mem_filter,Finset.mem_univ,true_and] using hi + · intro i _ j _ hij + exact e.injective hij + · intro j hj + refine ⟨e.symm j,?_,e.apply_symm_apply j⟩ + simpa only [Finset.mem_filter,Finset.mem_univ,true_and,Equiv.apply_symm_apply] using hj + +theorem word_even {n : ℕ} (S : Finset ι) (e : Fin n ≃ {i // i ∈ S}) + (m : ℕ) (w : Fin (n+m) → Fin 4) : Even (qmaPauliYCount (word S e m w)) := by + rw [word,qmaPauliExtend_yCount,yCount_reindex e.symm] + exact QuantumPaddedPauli.paddedWord_even n m w + +omit [Fintype ι] in +theorem local_word {n : ℕ} (S : Finset ι) (e : Fin n ≃ {i // i ∈ S}) + (v : Fin n → Fin 4) : + qmaPauliWord (fun i => v (e.symm i)) = reindex S e (qmaPauliWord v) := by + ext s t + simpa only [reindex,Equiv.symm_symm] using + QuantumAlgebraicHistory.pauliWord_reindex e.symm v s t + +omit [Fintype ι] in +theorem local_expansion {n : ℕ} (S : Finset ι) (e : Fin n ≃ {i // i ∈ S}) + (m : ℕ) (A : Matrix (Fin n → Fin 2) (Fin n → Fin 2) ℂ) + (hH : A.IsHermitian) (hR : ∀ s t, (A s t).im = 0) : + (∑ w : Fin (n+m) → Fin 4, + (QuantumPaddedPauli.paddedCoefficient n m A w:ℂ) • + qmaPauliWord (fun i => QuantumPaddedPauli.paddedWord n m w (e.symm i))) = + reindex S e A := by + simp only [local_word] + ext s t + have h := congrFun (congrFun (QuantumPaddedPauli.padded_expansion n m A hH hR) + (fun i => s (e i))) (fun i => t (e i)) + simpa only [Matrix.sum_apply,Matrix.smul_apply,smul_eq_mul,reindex] using h + +theorem full_expansion {n : ℕ} (S : Finset ι) (e : Fin n ≃ {i // i ∈ S}) + (m : ℕ) (A : Matrix (Fin n → Fin 2) (Fin n → Fin 2) ℂ) + (hH : A.IsHermitian) (hR : ∀ s t, (A s t).im = 0) : + (∑ w : Fin (n+m) → Fin 4, + (QuantumPaddedPauli.paddedCoefficient n m A w:ℂ) • qmaPauliWord (word S e m w)) = + qmaLocalLift S (reindex S e A) := by + simp only [word,qmaPauliExtend_lift,← qmaLocalLift_smul,← qmaLocalLift_sum] + rw [local_expansion S e m A hH hR] + +end ContinuumCoulomb.QuantumPaddedLocal + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedPacketProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedPacketProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..ca2e81d6bd182c26438958d4cad8f9d7f953d99b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedPacketProgram.lean @@ -0,0 +1,72 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedLabelTable +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelCompile + +namespace OAI + +/-! Polynomial postprocessing of the actual fixed-size local matrix +payloads. This emits the full raw exchange list and its scalar offset. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPaddedPacketProgram +open ExactQuantumFactoring.BitStackProgram QuantumFixedPauli + +abbrev Payload := List ℕ × List QuantumAlgebraicScalar.Scalar +def payloadCode : Payload → List Bool := prodCode (listCode Nat.bits) matrixCode +abbrev FamilyInput := ℕ × List Payload +def familyCode : FamilyInput → List Bool := prodCode unaryCode (listCode payloadCode) + +def family (x : FamilyInput) : List QuantumOrderedLabelFamily.Entry := + (x.2.map (fun p => QuantumPaddedLabelProgram.uniformPacket (x.1,p))).flatten + +noncomputable opaque familyProgram : Procedure familyCode + (listCode QuantumOrderedLabelFamily.entryCode) family := + (QuantumRawExchange.flattenProgram QuantumOrderedLabelFamily.entryCode ([],0)).comp + (Procedure.listMapWith (ea := unaryCode) (eb := payloadCode) + (ec := listCode QuantumOrderedLabelFamily.entryCode) + (f := fun k p => QuantumPaddedLabelProgram.uniformPacket (k,p)) + ([],[]) [] QuantumPaddedLabelProgram.uniformProgram) + +abbrev Input := ℕ × (ℕ × FamilyInput) +def inputCode : Input → List Bool := + prodCode unaryCode (prodCode unaryCode familyCode) + +def prepare (x : Input) : QuantumOrderedLabelFamily.Input := + (x.1,x.2.1,family x.2.2) + +noncomputable opaque prepareProgram : Procedure inputCode + QuantumOrderedLabelFamily.inputCode prepare := + (Procedure.first unaryCode (prodCode unaryCode familyCode)).pair + (((Procedure.first unaryCode familyCode).comp + (Procedure.second unaryCode (prodCode unaryCode familyCode))).pair + (familyProgram.comp ((Procedure.second unaryCode familyCode).comp + (Procedure.second unaryCode (prodCode unaryCode familyCode))))) + +def output (x : Input) := QuantumOrderedLabelCompile.output (prepare x) + +noncomputable opaque outputProgram : Procedure inputCode + (prodCode (listCode MediatorListProgram.bondCode) ratCode) output := + QuantumOrderedLabelCompile.outputProgram.comp prepareProgram + +noncomputable def certificate : Turing.TM2ComputableInPolyTime inputCode + (prodCode (listCode MediatorListProgram.bondCode) ratCode) output := outputProgram.toTM2 + +open QuantumPaddedLabelProgram QuantumOrderedSourceIndex +open scoped Classical + +local instance finDecision (n : ℕ) : DecidableEq (Fin n) := Classical.decEq _ + +def sourcePayloads (c : QMACircuit) (hT : 0 < c.gates.length) : List Payload := + List.ofFn (fun i : Fin (referenceCount c) => + (QuantumOrderedSupport.encodedSites c hT (reference c i), + matrixData (QuantumAlgebraicHistory.orderedTable c hT (reference c i)))) + +theorem family_source (k : ℕ) (c : QMACircuit) (hT : 0 < c.gates.length) : + family (k,sourcePayloads c hT)=sourceEntries k c hT := by + simp only [family,sourcePayloads,sourceEntries,sourceInput,List.map_ofFn, + Function.comp_def] + +end ContinuumCoulomb.QuantumPaddedPacketProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedPauli.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedPauli.lean new file mode 100644 index 0000000000000000000000000000000000000000..a529ad0d307373569a33531304d5da929fbe187a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedPauli.lean @@ -0,0 +1,109 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliParity + +namespace OAI + +/-! Fixed-width Pauli tables. Padding a local word duplicates its coefficient +by a known factor; replacing odd-Y zero terms by the identity keeps every +emitted word real without a dependent filtered index type. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPaddedPauli +open scoped BigOperators Classical + +def splitWords (n m : ℕ) : (Fin (n+m) → Fin 4) ≃ + ((Fin n → Fin 4) × (Fin m → Fin 4)) := + ((finSumFinEquiv.symm).arrowCongr (Equiv.refl (Fin 4))).trans + (Equiv.sumArrowEquivProdArrow (Fin n) (Fin m) (Fin 4)) + +def restrictWord (n m : ℕ) (w : Fin (n+m) → Fin 4) : Fin n → Fin 4 := + fun i => w (Fin.castAdd m i) + +theorem splitWords_first (n m : ℕ) (w : Fin (n+m) → Fin 4) : + (splitWords n m w).1 = restrictWord n m w := rfl + +theorem sum_restrict {A : Type} [AddCommMonoid A] (n m : ℕ) + (f : (Fin n → Fin 4) → A) : + (∑ w : Fin (n+m) → Fin 4, f (restrictWord n m w)) = + 4^m • ∑ v : Fin n → Fin 4, f v := by + calc + _ = ∑ p : (Fin n → Fin 4) × (Fin m → Fin 4), f p.1 := + (splitWords n m).sum_comp (fun p => f p.1) + _ = _ := by simp [Fintype.sum_prod_type,Finset.sum_nsmul] + +theorem normalized_sum_restrict {A : Type} [AddCommMonoid A] [Module ℂ A] + (n m : ℕ) (f : (Fin n → Fin 4) → A) : + (∑ w : Fin (n+m) → Fin 4, ((4:ℂ)^m)⁻¹ • f (restrictWord n m w)) = + ∑ v : Fin n → Fin 4, f v := by + rw [← Finset.smul_sum, sum_restrict, ← Nat.cast_smul_eq_nsmul ℂ, smul_smul] + simp + +variable {ι : Type} [Fintype ι] [DecidableEq ι] + +def evenWord (w : ι → Fin 4) : ι → Fin 4 := + if Even (qmaPauliYCount w) then w else fun _ => 0 + +def evenCoefficient (A : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (w : ι → Fin 4) : ℝ := + if Even (qmaPauliYCount w) then (qmaPauliCoefficient A w).re else 0 + +omit [DecidableEq ι] in +theorem evenWord_even (w : ι → Fin 4) : Even (qmaPauliYCount (evenWord w)) := by + unfold evenWord + split_ifs with h + · exact h + · simp [qmaPauliYCount] + +theorem even_expansion (A : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (hH : A.IsHermitian) (hR : ∀ s t, (A s t).im = 0) : + (∑ w : ι → Fin 4, (evenCoefficient A w:ℂ) • qmaPauliWord (evenWord w)) = A := by + calc + _ = ∑ w : ι → Fin 4, ((qmaPauliCoefficient A w).re:ℂ) • qmaPauliWord w := by + apply Finset.sum_congr rfl + intro w _ + by_cases he : Even (qmaPauliYCount w) + · simp only [evenCoefficient,evenWord,he,ite_true] + · have ho := (Nat.even_or_odd (qmaPauliYCount w)).resolve_left he + have hz := qmaPauliCoefficient_odd_zero A hH hR w ho + simp only [evenCoefficient,evenWord,he,ite_false,hz,Complex.zero_re, + Complex.ofReal_zero,zero_smul] + _ = A := qmaPauli_real_expansion A hH + +def paddedWord (n m : ℕ) (w : Fin (n+m) → Fin 4) : Fin n → Fin 4 := + evenWord (restrictWord n m w) + +def paddedCoefficient (n m : ℕ) + (A : Matrix (Fin n → Fin 2) (Fin n → Fin 2) ℂ) + (w : Fin (n+m) → Fin 4) : ℝ := + evenCoefficient A (restrictWord n m w)/(4:ℝ)^m + +theorem paddedWord_even (n m : ℕ) (w : Fin (n+m) → Fin 4) : + Even (qmaPauliYCount (paddedWord n m w)) := evenWord_even _ + +theorem padded_expansion (n m : ℕ) + (A : Matrix (Fin n → Fin 2) (Fin n → Fin 2) ℂ) + (hH : A.IsHermitian) (hR : ∀ s t, (A s t).im = 0) : + (∑ w : Fin (n+m) → Fin 4, + (paddedCoefficient n m A w:ℂ) • qmaPauliWord (paddedWord n m w)) = A := by + let f : (Fin n → Fin 4) → Matrix (Fin n → Fin 2) (Fin n → Fin 2) ℂ := + fun v => (evenCoefficient A v:ℂ) • qmaPauliWord (evenWord v) + have hf : (∑ w : Fin (n+m) → Fin 4, ((4:ℂ)^m)⁻¹ • f (restrictWord n m w)) = + ∑ v : Fin n → Fin 4, f v := normalized_sum_restrict n m f + calc + _ = ∑ w : Fin (n+m) → Fin 4, + ((4:ℂ)^m)⁻¹ • f (restrictWord n m w) := by + apply Finset.sum_congr rfl + intro w _ + dsimp only [paddedCoefficient,paddedWord,f] + rw [Complex.ofReal_div,Complex.ofReal_pow,Complex.ofReal_ofNat,smul_smul] + congr 1 + rw [div_eq_mul_inv,mul_comm] + _ = ∑ v : Fin n → Fin 4, f v := hf + _ = A := even_expansion A hH hR + +theorem six_word_count : Fintype.card (Fin 6 → Fin 4) = 4096 := by + simp + +end ContinuumCoulomb.QuantumPaddedPauli + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedSampling.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedSampling.lean new file mode 100644 index 0000000000000000000000000000000000000000..0b8fb2497cca5f8b5ad0bc033b5f468bc38eccd2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedSampling.lean @@ -0,0 +1,140 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedHistory +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedTableProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryXZBounds + +namespace OAI + +/-! The literal padded history table has the same polynomial scalar budget +as the supported expansion, and its rational samples approximate the actual +full-space history energy. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPaddedHistory +open QuantumAlgebraicScalar QuantumFixedPauli QuantumAlgebraicHistory +open scoped BigOperators Classical + +section ScalarTable + +local instance finDecision (n : ℕ) : DecidableEq (Fin n) := Classical.decEq _ + +private theorem padded_height (n m : ℕ) + (A : Matrix (Fin n → Fin 2) (Fin n → Fin 2) Scalar) + (w : Fin (n+m) → Fin 4) (C : ℚ) (hC : 0 ≤ C) + (hA : ∀ s t, height (A s t) ≤ C) : + realHeight (QuantumPaddedTable.coefficient n m (matrixData A) w) ≤ 2^n*C := by + let v := QuantumPaddedPauli.restrictWord n m w + have hE : (fun s t : Fin n → Fin 2 => entry (matrixData A) s t) = A := by + funext s t + exact entry_matrixData A s t + have hV : realHeight (realCoefficient A v) ≤ (2:ℚ)^n*C := by + simpa only [Fintype.card_fin] using realHeight_coefficient A v C hA + unfold QuantumPaddedTable.coefficient + change realHeight (if Even (qmaPauliYCount v) then + realMul (realRat (((4:ℚ)^m)⁻¹)) + (realCoefficient (fun s t => entry (matrixData A) s t) v) else realRat 0) ≤ _ + rw [hE] + split_ifs + · have hr : |((4:ℚ)^m)⁻¹| ≤ 1 := by + rw [abs_of_pos (inv_pos.mpr (pow_pos (by norm_num) _))] + exact inv_le_one_of_one_le₀ (one_le_pow₀ (by norm_num)) + calc + _ ≤ realHeight (realRat (((4:ℚ)^m)⁻¹))*realHeight (realCoefficient A v) := + realHeight_mul _ _ + _ ≤ 1*realHeight (realCoefficient A v) := by + rw [realHeight_rat] + exact mul_le_mul_of_nonneg_right hr (realHeight_nonnegative _) + _ ≤ (2:ℚ)^n*C := by simpa only [one_mul] using hV + · simpa only [realHeight_rat,abs_zero] using mul_nonneg (pow_nonneg (by norm_num) n) hC + +def scalar (c : QMACircuit) (hT : 0 < c.gates.length) (p : Term c) : RealScalar := + QuantumPaddedTable.coefficient (QuantumOrderedSupport.sites c hT p.1).length + (6-(QuantumOrderedSupport.sites c hT p.1).length) + (matrixData (orderedTable c hT p.1)) + (widthIndex _ (QuantumOrderedSupport.sites_length c hT p.1) p.2) + +theorem scalar_value (c : QMACircuit) (hT : 0 < c.gates.length) (p : Term c) : + realValue (scalar c hT p) = coefficient c hT p := by + unfold scalar coefficient tableMatrix + exact QuantumPaddedTable.coefficient_value _ _ (orderedTable c hT p.1) _ + +theorem scalar_height (c : QMACircuit) (hT : 0 < c.gates.length) (p : Term c) : + realHeight (scalar c hT p) ≤ (coefficientBudget c:ℚ) := by + have h := padded_height _ _ (orderedTable c hT p.1) + (widthIndex _ (QuantumOrderedSupport.sites_length c hT p.1) p.2) + (2*historyHeight c) (mul_nonneg (by norm_num) (historyHeight_nonnegative c)) + (fun s t => height_orderedCore c hT p.1 _ _) + have hp : (2:ℚ)^(QuantumOrderedSupport.sites c hT p.1).length ≤ 64 := by + exact (pow_le_pow_right₀ (by norm_num : (1:ℚ) ≤ 2) + (QuantumOrderedSupport.sites_length c hT p.1)).trans_eq (by norm_num) + change realHeight (scalar c hT p) ≤ _ at h + calc + _ ≤ (2:ℚ)^(QuantumOrderedSupport.sites c hT p.1).length*(2*historyHeight c) := h + _ ≤ 64*(2*historyHeight c) := + mul_le_mul_of_nonneg_right hp (mul_nonneg (by norm_num) (historyHeight_nonnegative c)) + _ = (coefficientBudget c:ℚ) := by rw [coefficientBudget_cast]; ring + +end ScalarTable + +def sampledWeight (k : ℕ) (c : QMACircuit) (hT : 0 < c.gates.length) (p : Term c) : ℚ := + sample k (scalar c hT p) + +theorem sampledWeight_bound (k : ℕ) (c : QMACircuit) (hT : 0 < c.gates.length) + (p : Term c) : |sampledWeight k c hT p| ≤ (coefficientBudget c:ℚ) := + (sample_height_bound k (scalar c hT p)).trans (scalar_height c hT p) + +theorem sampled_error (k : ℕ) (c : QMACircuit) (hT : 0 < c.gates.length) : + |MediatorGraph.normalizedBottom (qmaPauliFamily (word c hT) + (fun p => (sampledWeight k c hT p:ℝ)))-(qmaOrderedHistoryModel c hT).energy| ≤ + (termBudget c:ℝ)*(coefficientBudget c:ℝ)*(2:ℝ)⁻¹^k := by + change |MediatorGraph.normalizedBottom _ - + MediatorGraph.normalizedBottom (∑ a, (qmaOrderedHistoryModel c hT).matrix a)| ≤ _ + rw [← family_sum] + have hround := qmaPauliFamily_ground_error (word c hT) + (fun p => (sampledWeight k c hT p:ℝ)) (coefficient c hT) + have hterm (p : Term c) : + |(sampledWeight k c hT p:ℝ)-coefficient c hT p| ≤ + (coefficientBudget c:ℝ)*(2:ℝ)⁻¹^k := by + rw [← scalar_value] + exact (sample_error_height k (scalar c hT p)).trans + (mul_le_mul_of_nonneg_right (Rat.cast_le.mpr (scalar_height c hT p)) (by positivity)) + apply hround.trans + calc + _ ≤ ∑ _p : Term c, (coefficientBudget c:ℝ)*(2:ℝ)⁻¹^k := + Finset.sum_le_sum (fun p _ => hterm p) + _ = _ := by + simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul,term_count,termBudget, + Nat.cast_mul,Nat.cast_add,Nat.cast_ofNat] + ring + +theorem sampled_accuracy (c : QMACircuit) (hT : 0 < c.gates.length) + (N : ℕ) (hN : 0 < N) : + |MediatorGraph.normalizedBottom (qmaPauliFamily (word c hT) + (fun p => (sampledWeight (samplePrecision c N) c hT p:ℝ)))- + (qmaOrderedHistoryModel c hT).energy| ≤ 1/(N:ℝ) := by + let k := samplePrecision c N + let M := (termBudget c:ℝ) + let B := (coefficientBudget c:ℝ) + have hM : 0 ≤ M := Nat.cast_nonneg _ + have hB : 0 ≤ B := Nat.cast_nonneg _ + have hNR : (0:ℝ) < N := Nat.cast_pos.mpr hN + have hpow : (k:ℝ)+1 ≤ (2:ℝ)^k := by + have hp : k+1 ≤ 2^k := Nat.succ_le_iff.mpr (Nat.lt_two_pow_self (n := k)) + exact_mod_cast hp + have hkp : (0:ℝ) < (k:ℝ)+1 := + add_pos_of_nonneg_of_pos (Nat.cast_nonneg k) (by norm_num) + have hk : (k:ℝ) = (M+1)*(B+1)*N := by + simp only [k,samplePrecision,M,B,Nat.cast_mul,Nat.cast_add,Nat.cast_one] + calc + _ ≤ M*B*(2:ℝ)⁻¹^k := sampled_error k c hT + _ = M*B/((2:ℝ)^k) := by rw [inv_pow]; rfl + _ ≤ M*B/((k:ℝ)+1) := div_le_div_of_nonneg_left (mul_nonneg hM hB) hkp hpow + _ ≤ 1/(N:ℝ) := by + apply (div_le_div_iff₀ hkp hNR).mpr + rw [hk] + nlinarith + +end ContinuumCoulomb.QuantumPaddedHistory + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedTableProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedTableProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..e8e22e260ada51b6e497e45c768bc52a98affe29 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPaddedTableProgram.lean @@ -0,0 +1,132 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedPauli +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFixedPauliProgram + +namespace OAI + +/-! Fixed-width algebraic coefficient tables, with exact normalization of +the padded words. Each local arity at most six uses a fixed finite program. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPaddedTable +open QuantumAlgebraicScalar QuantumFixedPauli +open ExactQuantumFactoring.BitStackProgram +open scoped Classical + +local instance finDecision (n : ℕ) : DecidableEq (Fin n) := Classical.decEq _ + +private theorem coefficient_decision {ι : Type} [Fintype ι] + (d e : DecidableEq ι) (A : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (w : ι → Fin 4) (r : ℝ) : + r * (@qmaPauliCoefficient ι _ d A w).re = + r * (@qmaPauliCoefficient ι _ e A w).re := by + cases Subsingleton.elim d e + rfl + +def coefficient (n m : ℕ) (xs : List Scalar) (w : Fin (n+m) → Fin 4) : RealScalar := + let v := QuantumPaddedPauli.restrictWord n m w + if Even (qmaPauliYCount v) then + realMul (realRat (((4:ℚ)^m)⁻¹)) + (realCoefficient (fun s t : Fin n → Fin 2 => entry xs s t) v) + else realRat 0 + +noncomputable opaque coefficientProgram (n m : ℕ) (w : Fin (n+m) → Fin 4) : + Procedure matrixCode realCode (fun xs => coefficient n m xs w) := by + by_cases h : Even (qmaPauliYCount (QuantumPaddedPauli.restrictWord n m w)) + · exact (realMulProgram.comp + ((Procedure.constant matrixCode realCode (realRat (((4:ℚ)^m)⁻¹))).pair + (realCoefficientProgram n (QuantumPaddedPauli.restrictWord n m w)))).congrFun + (by intro xs; simp only [coefficient,h,ite_true,Function.comp_apply]) + · exact (Procedure.constant matrixCode realCode (realRat 0)).congrFun + (by intro xs; simp only [coefficient,h,ite_false]) + +def table (n m : ℕ) (xs : List Scalar) : List RealScalar := + (enumerate (Fin (n+m) → Fin 4)).map (coefficient n m xs) + +noncomputable def tableProgram (n m : ℕ) : + Procedure matrixCode (listCode realCode) (table n m) := + (QuantumRawExchange.fixedListProgram matrixCode realCode + (Fintype.card (Fin (n+m) → Fin 4)) + (fun i xs => coefficient n m xs ((Fintype.equivFin (Fin (n+m) → Fin 4)).symm i)) + (fun i => coefficientProgram n m ((Fintype.equivFin (Fin (n+m) → Fin 4)).symm i))).congrFun + (by intro xs; simp only [table,enumerate,List.map_ofFn,Function.comp_def]) + +theorem coefficient_value (n m : ℕ) + (A : Matrix (Fin n → Fin 2) (Fin n → Fin 2) Scalar) + (w : Fin (n+m) → Fin 4) : + realValue (coefficient n m (matrixData A) w) = + QuantumPaddedPauli.paddedCoefficient n m (fun s t => value (A s t)) w := by + let v := QuantumPaddedPauli.restrictWord n m w + by_cases h : Even (qmaPauliYCount v) + · simp only [coefficient,show Even (qmaPauliYCount + (QuantumPaddedPauli.restrictWord n m w)) from h,ite_true, + realValue_mul,realValue_rat,Rat.cast_inv,Rat.cast_pow,Rat.cast_ofNat] + rw [QuantumFixedPauli.coefficient_matrixData] + simp only [QuantumPaddedPauli.paddedCoefficient,QuantumPaddedPauli.evenCoefficient, + show Even (qmaPauliYCount (QuantumPaddedPauli.restrictWord n m w)) from h,ite_true] + simp only [div_eq_mul_inv,mul_comm] + exact coefficient_decision _ _ _ _ _ + · simp only [coefficient,show ¬Even (qmaPauliYCount + (QuantumPaddedPauli.restrictWord n m w)) from h,ite_false,realValue_rat, + Rat.cast_zero,QuantumPaddedPauli.paddedCoefficient, + QuantumPaddedPauli.evenCoefficient,zero_div] + +theorem table_length (n m : ℕ) (xs : List Scalar) : + (table n m xs).length = 4^(n+m) := by + simp only [table,List.length_map,enumerate,List.length_ofFn,Fintype.card_fun, + Fintype.card_fin] + +theorem six_table_length (n : ℕ) (hn : n ≤ 6) (xs : List Scalar) : + (table n (6-n) xs).length = 4096 := by + rw [table_length,Nat.add_sub_of_le hn] + norm_num + +noncomputable def certificate (n m : ℕ) : + Turing.TM2ComputableInPolyTime matrixCode (listCode realCode) (table n m) := + (tableProgram n m).toTM2 + +abbrev Input := ℕ × List Scalar +def inputCode : Input → List Bool := prodCode Nat.bits matrixCode + +/-- Total fixed-arity dispatcher. Invalid arities use the six-site branch. -/ +def uniformTable (x : Input) : List RealScalar := + if x.1=0 then table 0 6 x.2 else + if x.1=1 then table 1 5 x.2 else + if x.1=2 then table 2 4 x.2 else + if x.1=3 then table 3 3 x.2 else + if x.1=4 then table 4 2 x.2 else + if x.1=5 then table 5 1 x.2 else table 6 0 x.2 + +noncomputable opaque uniformProgram : + Procedure inputCode (listCode realCode) uniformTable := by + let arity := Procedure.first Nat.bits matrixCode + let rows := Procedure.second Nat.bits matrixCode + let is (n : ℕ) := Procedure.binaryEq.comp + (arity.pair (Procedure.constant inputCode Nat.bits n)) + let out (n m : ℕ) := (tableProgram n m).comp rows + exact (Procedure.conditional (is 0) (out 0 6) + (Procedure.conditional (is 1) (out 1 5) + (Procedure.conditional (is 2) (out 2 4) + (Procedure.conditional (is 3) (out 3 3) + (Procedure.conditional (is 4) (out 4 2) + (Procedure.conditional (is 5) (out 5 1) (out 6 0))))))).congrFun (by + intro x + simp only [uniformTable,Function.comp_apply,decide_eq_true_eq]) + +theorem uniformTable_eq (n : ℕ) (hn : n ≤ 6) (xs : List Scalar) : + uniformTable (n,xs) = table n (6-n) xs := by + interval_cases n <;> norm_num [uniformTable] + +theorem uniformTable_length (n : ℕ) (hn : n ≤ 6) (xs : List Scalar) : + (uniformTable (n,xs)).length = 4096 := by + rw [uniformTable_eq n hn xs] + exact six_table_length n hn xs + +noncomputable def uniformCertificate : + Turing.TM2ComputableInPolyTime inputCode (listCode realCode) uniformTable := + uniformProgram.toTM2 + +end ContinuumCoulomb.QuantumPaddedTable + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPairDedup.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPairDedup.lean new file mode 100644 index 0000000000000000000000000000000000000000..7ea4325d1e7431083cd1cbe2c4f8688293708a47 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPairDedup.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumWalkErasure +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRouteProgram +import OAI.Computability.QuantumFactoring.BitStackListFold + +namespace OAI + +/-! The crossing compiler retains one occurrence of each coordinate pair, +with an output bound from the original list. -/ + +noncomputable section +open scoped List Classical +namespace ContinuumCoulomb.QuantumPairDedup +open ExactQuantumFactoring.BitStackProgram QuantumRouteCode + +def insertPair (a : Pair) (xs : List Pair) : List Pair := if a ∈ xs then xs else a::xs + +theorem insert_sublist (a : Pair) (xs : List Pair) : insertPair a xs <+ a::xs := by + unfold insertPair + split + · exact List.sublist_cons_self _ _ + · exact List.Sublist.refl _ + +theorem fold_sublist (xs ys : List Pair) : + xs.foldl (fun zs a => insertPair a zs) ys <+ xs.reverse++ys := by + induction xs generalizing ys with + | nil => exact List.Sublist.refl _ + | cons a xs ih => + simp only [List.foldl_cons,List.reverse_cons,List.append_assoc,List.singleton_append] + exact (ih (insertPair a ys)).trans ((insert_sublist a ys).append_left xs.reverse) + +theorem fold_bound (xs ys : List Pair) : + (listCode pairCode (xs.foldl (fun zs a => insertPair a zs) ys)).length ≤ + (listCode pairCode xs).length+(listCode pairCode ys).length := by + have h := QuantumWalkErasure.listCode_length_sublist pairCode (fold_sublist xs ys) + have ha := listCode_length_append pairCode xs.reverse ys + rw [listCode_length_rev] at ha + omega + +theorem foldr_eq (xs : List Pair) : xs.foldr insertPair []=xs.dedup := by + induction xs with + | nil => rfl + | cons a xs ih => + rw [List.foldr_cons,ih,List.dedup_cons'] + by_cases h : a ∈ xs.dedup <;> simp [insertPair,h] + +noncomputable opaque insertProgram : + Procedure (prodCode pairCode (listCode pairCode)) (listCode pairCode) + (fun x => insertPair x.1 x.2) := + (Procedure.conditional (QuantumFiniteMembership.memberProgram pairCode (0,0) QuantumFiniteMembership.pairEqProgram) + (Procedure.second pairCode (listCode pairCode)) (Procedure.listCons pairCode)).congrFun + (by intro x; simp only [insertPair,decide_eq_true_eq]) + +noncomputable opaque foldProgram : + Procedure (prodCode (listCode pairCode) (listCode pairCode)) (listCode pairCode) + (fun x => x.1.foldl (fun zs a => insertPair a zs) x.2) := + Procedure.foldList (0,0) insertProgram Polynomial.X (by + intro xs ys i + have h := fold_bound (xs.take i) ys + have ht := listCode_length_take_le pairCode i xs + simp only [Polynomial.eval_X] + convert h.trans (Nat.add_le_add_right ht _) using 1) + +noncomputable opaque program : Procedure (listCode pairCode) (listCode pairCode) List.dedup := + (foldProgram.comp ((Procedure.listReverse pairCode (0,0)).pair + (Procedure.constant (listCode pairCode) (listCode pairCode) []))).congrFun (by + intro xs + simp only [Function.comp_apply,List.foldl_reverse,foldr_eq]) + +end ContinuumCoulomb.QuantumPairDedup + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumParallelGraph.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumParallelGraph.lean new file mode 100644 index 0000000000000000000000000000000000000000..a0dedfcf6d8c2ee385a5776165bf050ba1e1c936 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumParallelGraph.lean @@ -0,0 +1,98 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingGraph +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkCalibration + +namespace OAI + +/-! Explicit ordinary-spin graph for an entire parallel singlet-routing layer. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix MediatorGraph +open scoped BigOperators Kronecker Classical +variable {ν κ : Type*} [Fintype ν] [Fintype κ] + +def qmaParallelGraphLeft {n r : ℕ} (base : ν → Fin n) (site : Fin r → κ → Fin n) : + ν ⊕ (Fin r ⊕ (Fin r × κ)) → Fin (n+r*2) + | .inl a => old n r (base a) + | .inr (.inl e) => fresh n r e 0 + | .inr (.inr p) => old n r (site p.1 p.2) + +def qmaParallelGraphRight {n r : ℕ} (base : ν → Fin n) (member : Fin r → κ → Fin 2) : + ν ⊕ (Fin r ⊕ (Fin r × κ)) → Fin (n+r*2) + | .inl a => old n r (base a) + | .inr (.inl e) => fresh n r e 1 + | .inr (.inr p) => fresh n r p.1 (member p.1 p.2) + +def qmaParallelGraphWeight {r : ℕ} (base : ν → ℝ) (Delta : ℝ) (amplitude : Fin r → κ → ℝ) : + ν ⊕ (Fin r ⊕ (Fin r × κ)) → ℝ + | .inl a => base a + | .inr (.inl _) => Delta + | .inr (.inr p) => amplitude p.1 p.2 + +omit [Fintype ν] [Fintype κ] in +theorem qmaParallelGraph_distinct {n r : ℕ} (left right : ν → Fin n) + (hneq : ∀ a, left a ≠ right a) (site : Fin r → κ → Fin n) (member : Fin r → κ → Fin 2) : + ∀ a, qmaParallelGraphLeft left site a ≠ qmaParallelGraphRight right member a := by + intro a + rcases a with a | a + · exact fun h => hneq a (old_injective n r h) + rcases a with e | p + · intro h + have hh := congrArg Prod.snd (fresh_injective n r (a₁ := (e,0)) (a₂ := (e,1)) h) + norm_num at hh + · exact old_ne_fresh n r _ _ _ + +def qmaPhysicalParallelHamiltonian (n r : ℕ) (Delta : ℝ) + (C : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) + (site : Fin r → κ → Fin n) (member : Fin r → κ → Fin 2) (amplitude : Fin r → κ → ℝ) : + Matrix (MediatedSpinBasis n r) (MediatedSpinBasis n r) ℂ := + 1 ⊗ₖ physicalMediatorPenalty r Delta + + (C ⊗ₖ 1 + ∑ e, qmaPhysicalSingletStar n r e (site e) (member e) (amplitude e)) + +theorem qmaParallelGraph_matrix {n r : ℕ} (left right : ν → Fin n) + (hneq : ∀ a, left a ≠ right a) (weight : ν → ℝ) (constant Delta : ℝ) + (site : Fin r → κ → Fin n) (member : Fin r → κ → Fin 2) (amplitude : Fin r → κ → ℝ) : + (qmaExchangeMatrix (qmaParallelGraphLeft left site) (qmaParallelGraphRight right member) + (qmaParallelGraphWeight weight Delta amplitude) (constant+3*r*Delta)).submatrix + (basisEquiv n r) (basisEquiv n r) = + qmaPhysicalParallelHamiltonian n r Delta (qmaExchangeMatrix left right weight constant) + site member amplitude := by + simp only [qmaExchangeMatrix,Fintype.sum_sum_type,Fintype.sum_prod_type, + qmaParallelGraphLeft,qmaParallelGraphRight,qmaParallelGraphWeight, + submatrix_add_apply,submatrix_sum,submatrix_smul_apply, + Matrix.submatrix_one_equiv,heisenberg_old n r _ _ (hneq _),heisenberg_central, + heisenberg_spoke] + unfold qmaPhysicalParallelHamiltonian qmaPhysicalSingletStar + rw [physicalMediatorPenalty_offset] + simp only [Matrix.add_kronecker,Matrix.kronecker_add,Matrix.smul_kronecker, + Matrix.kronecker_smul,Matrix.one_kronecker_one,sum_kronecker,kronecker_sum, + Complex.ofReal_add,add_smul,Finset.smul_sum] + abel + +theorem qmaPhysicalParallel_transform (n r : ℕ) (Delta : ℝ) + (C : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) + (site : Fin r → κ → Fin n) (member : Fin r → κ → Fin 2) (amplitude : Fin r → κ → ℝ) : + (fullMediatorBellMatrix n r).conjTranspose * + qmaPhysicalParallelHamiltonian n r Delta C site member amplitude * + fullMediatorBellMatrix n r = + routingHamiltonian n r Delta C (qmaRoutingStars n r site member amplitude) := by + simp only [qmaPhysicalParallelHamiltonian,routingHamiltonian,qmaRoutingStars,mul_add, + add_mul,Finset.mul_sum,Finset.sum_mul,physicalMediatorPenalty_full_transform, + liftedSource_full_transform,qmaPhysicalSingletStar_transform] + +theorem qmaPhysicalParallel_bottom (n r : ℕ) (Delta : ℝ) + (C : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) + (site : Fin r → κ → Fin n) (member : Fin r → κ → Fin 2) (amplitude : Fin r → κ → ℝ) : + mediatorFullBottom n r (qmaPhysicalParallelHamiltonian n r Delta C site member amplitude) = + mediatorFullBottom n r (routingHamiltonian n r Delta C (qmaRoutingStars n r site member amplitude)) := by + have h := mediatorFullBottom_unitary n r (fullMediatorBellMatrix n r) + (qmaPhysicalParallelHamiltonian n r Delta C site member amplitude) + (fullMediatorBellMatrix_gram n r) (fullMediatorBellMatrix_cogram n r) + rw [qmaPhysicalParallel_transform] at h + exact h.symm + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumParallelRouteSearch.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumParallelRouteSearch.lean new file mode 100644 index 0000000000000000000000000000000000000000..78c6fefc531175468497b6db145b71f3c38a3d85 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumParallelRouteSearch.lean @@ -0,0 +1,46 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFiniteRouteSearch + +namespace OAI + +/-! The predicate mask and the path list have the same 140-entry order. +Searching the mask therefore returns the path of the actual first permitted +catalog route, without encoding proof-carrying route objects. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumFiniteRouteSearch +open ExactQuantumFactoring.BitStackProgram + +private theorem mapped_drop_findIdx {α β : Type} (xs : List α) (p : α → Bool) + (f : α → β) (default : β) : + ((xs.map f).drop (xs.findIdx p)).headD default = (xs.find? p).elim default f := by + induction xs with + | nil => rfl + | cons a xs ih => + by_cases h : p a + · simp [List.findIdx_cons,h] + · simpa [List.findIdx_cons,List.find?_cons,h,Nat.add_comm] using ih + +def selectParallelValue {β : Type} (default : β) (x : List β × List Bool) : β := + (x.1.drop (firstTrue 140 x.2)).headD default + +theorem selectParallelValue_eq {α β : Type} (default : β) (xs : List α) + (p : α → Bool) (f : α → β) (hlen : xs.length = 140) {a : α} + (hfind : xs.find? p = some a) : + selectParallelValue default (xs.map f,xs.map p) = f a := by + have hi : firstTrue 140 (xs.map p) = xs.findIdx p := by + rw [firstTrue_eq_findIdx (by simpa using hlen),List.findIdx_map] + rfl + rw [selectParallelValue,hi,mapped_drop_findIdx,hfind] + rfl + +noncomputable def selectParallelProgram {β : Type} (eb : β → List Bool) (default : β) : + Procedure (prodCode (listCode eb) (listCode Procedure.boolCode)) eb + (selectParallelValue default) := + (Procedure.listGet eb default).comp + (((indexProgram 140).comp (Procedure.second _ _)).pair (Procedure.first _ _)) + +end ContinuumCoulomb.QuantumFiniteRouteSearch + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPartialPaths.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPartialPaths.lean new file mode 100644 index 0000000000000000000000000000000000000000..9d9bef79f5a8e6657e75102669b06f624eba648f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPartialPaths.lean @@ -0,0 +1,137 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathsGraph +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingSize +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathDegrees + +namespace OAI + +/-! Subdivide any selected subset of a finite exchange graph in one calibrated layer. -/ + +noncomputable section +namespace ContinuumCoulomb +open MediatorGraph Matrix +open scoped BigOperators Classical + +variable {ν : Type*} [Fintype ν] {n : ℕ} + +def qmaSelectedIndex (s : Finset ν) (i : Fin s.card) : ν := (s.equivFin.symm i).val + +omit [Fintype ν] in +theorem qmaSelectedIndex_mem (s : Finset ν) (i : Fin s.card) : qmaSelectedIndex s i ∈ s := + (s.equivFin.symm i).property + +def qmaSelectedSite (left right : ν → Fin n) (s : Finset ν) (i : Fin s.card) : Fin 2 → Fin n := + ![left (qmaSelectedIndex s i),right (qmaSelectedIndex s i)] + +omit [Fintype ν] in +theorem qmaSelectedSite_injective (left right : ν → Fin n) (hn : ∀ e, left e ≠ right e) + (s : Finset ν) (i : Fin s.card) : Function.Injective (qmaSelectedSite left right s i) := by + intro a b h + have hn' := hn (qmaSelectedIndex s i) + fin_cases a <;> fin_cases b + · rfl + · exact False.elim (hn' h) + · exact False.elim (hn' h.symm) + · rfl + +omit [Fintype ν] in +theorem qmaSelected_sum {M : Type*} [AddCommMonoid M] (s : Finset ν) (f : ν → M) : + (∑ i : Fin s.card, f (qmaSelectedIndex s i)) = ∑ i : {i // i ∈ s}, f i.val := + s.equivFin.symm.sum_comp (fun i => f i.val) + +theorem qmaSelected_partition {M : Type*} [AddCommMonoid M] (s : Finset ν) (f : ν → M) : + (∑ i : {i // i ∉ s}, f i.val) + (∑ i : Fin s.card, f (qmaSelectedIndex s i)) = + ∑ i, f i := by + rw [qmaSelected_sum] + rw [← Finset.sum_subtype s (fun _ => Iff.rfl) f, + ← Finset.sum_subtype sᶜ (fun _ => Finset.mem_compl) f] + exact Finset.sum_compl_add_sum s f + +theorem qmaPartialPaths_source (left right : ν → Fin n) (w : ν → ℝ) (t : ℝ) (s : Finset ν) : + qmaExchangeMatrix (fun e : {e // e ∉ s} => left e.val) (fun e => right e.val) + (fun e => w e.val) t + + ∑ i : Fin s.card, (w (qmaSelectedIndex s i):ℂ) • + sourceHeisenbergMatrix n (qmaSelectedSite left right s i 0) (qmaSelectedSite left right s i 1) = + qmaExchangeMatrix left right w t := by + simp only [qmaSelectedSite,Matrix.cons_val_zero,Matrix.cons_val_one,Matrix.cons_val_fin_one] + have h := qmaSelected_partition s + (fun i => (w i:ℂ) • sourceHeisenbergMatrix n (left i) (right i)) + simp only [qmaExchangeMatrix] + calc + _ = ((∑ e : {e // e ∉ s}, (w e.val:ℂ) • sourceHeisenbergMatrix n (left e.val) (right e.val)) + + ∑ i : Fin s.card, (w (qmaSelectedIndex s i):ℂ) • + sourceHeisenbergMatrix n (left (qmaSelectedIndex s i)) (right (qmaSelectedIndex s i))) + + (t:ℂ) • 1 := by ac_rfl + _ = _ := congrArg (fun x => x+(t:ℂ) • 1) h + +def qmaPartialPathsScale (w : ν → ℝ) (t : ℝ) (s : Finset ν) (N : ℝ) : ℝ := + let B := 3*(∑ e : {e // e ∉ s}, |w e.val|)+|t| + let A := 3*∑ i : Fin s.card, (1+2*|w (qmaSelectedIndex s i)|) + let D := B+4*∑ i : Fin s.card, (1+|w (qmaSelectedIndex s i)|)^2 + qmaRoutingScale A D N + +def qmaPartialPaths (left right : ν → Fin n) (w : ν → ℝ) (t N : ℝ) + (s : Finset ν) (even : Fin s.card → Bool) := + qmaPathsGraph (fun e : {e // e ∉ s} => left e.val) (fun e => right e.val) (fun e => w e.val) + t (qmaPartialPathsScale w t s N) (qmaSelectedSite left right s) even + (fun i => w (qmaSelectedIndex s i)) + +theorem qmaPartialPaths_accuracy (left right : ν → Fin n) (hn : ∀ e, left e ≠ right e) + (w : ν → ℝ) (t : ℝ) (s : Finset ν) (even : Fin s.card → Bool) {N : ℝ} (hN : 0 < N) : + |sourceMatrixBottom (n+s.card*2) (qmaPartialPaths left right w t N s even) - + sourceMatrixBottom n (qmaExchangeMatrix left right w t)| ≤ 1/N := by + have h := qmaPathsGraph_accuracy (fun e : {e // e ∉ s} => left e.val) (fun e => right e.val) + (fun e => hn e.val) (fun e => w e.val) t (qmaSelectedSite left right s) + (qmaSelectedSite_injective left right hn s) even (fun i => w (qmaSelectedIndex s i)) hN + dsimp only at h + rw [qmaPartialPaths_source] at h + exact h + + +abbrev QMAPartialPathsEdge (s : Finset ν) := + {e // e ∉ s} ⊕ (Fin s.card ⊕ (Fin s.card × Fin 2)) + +def qmaPartialPathsLeft (left right : ν → Fin n) (s : Finset ν) : QMAPartialPathsEdge s → Fin (n+s.card*2) := + qmaParallelGraphLeft (fun e : {e // e ∉ s} => left e.val) (qmaSelectedSite left right s) + +def qmaPartialPathsRight (right : ν → Fin n) (s : Finset ν) (even : Fin s.card → Bool) : + QMAPartialPathsEdge s → Fin (n+s.card*2) := + qmaParallelGraphRight (fun e : {e // e ∉ s} => right e.val) (fun i => qmaPathMember (even i)) + +omit [Fintype ν] in +theorem qmaPartialPaths_distinct (left right : ν → Fin n) (hn : ∀ e, left e ≠ right e) + (s : Finset ν) (even : Fin s.card → Bool) : + ∀ e, qmaPartialPathsLeft left right s e ≠ qmaPartialPathsRight right s even e := + qmaParallelGraph_distinct (fun e : {e // e ∉ s} => left e.val) (fun e => right e.val) + (fun e => hn e.val) _ _ + +theorem qmaPartialPaths_edge_count (s : Finset ν) : + Fintype.card (QMAPartialPathsEdge s) = Fintype.card ν+2*s.card := by + have hs : s.card ≤ Fintype.card ν := Finset.card_le_univ s + simp only [QMAPartialPathsEdge,Fintype.card_sum,Fintype.card_prod,Fintype.card_fin, + Fintype.card_subtype_compl,Fintype.card_coe] + omega + +theorem qmaPartialPaths_old_degree (left right : ν → Fin n) (hn : ∀ e, left e ≠ right e) + (s : Finset ν) (even : Fin s.card → Bool) (v : Fin n) : + qmaGraphDegree (qmaPartialPathsLeft left right s) (qmaPartialPathsRight right s even) + (old n s.card v) = qmaGraphDegree left right v := by + dsimp only [qmaPartialPathsLeft,qmaPartialPathsRight] + rw [qmaPaths_old_degree _ _ _ (qmaSelectedSite_injective left right hn s)] + simp only [qmaGraphDegree,Fintype.sum_sum_type] + change (∑ e : {e // e ∉ s}, if left e.val = v ∨ right e.val = v then 1 else 0) + + (∑ i : Fin s.card, if left (qmaSelectedIndex s i) = v ∨ + right (qmaSelectedIndex s i) = v then 1 else 0) = + ∑ e, if left e = v ∨ right e = v then 1 else 0 + exact qmaSelected_partition s (fun e => if left e = v ∨ right e = v then 1 else 0) + +theorem qmaPartialPaths_fresh_degree (left right : ν → Fin n) (s : Finset ν) + (even : Fin s.card → Bool) (e : Fin s.card) (b : Fin 2) : + qmaGraphDegree (qmaPartialPathsLeft left right s) (qmaPartialPathsRight right s even) + (fresh n s.card e b) ≤ 3 := + qmaPaths_new_degree _ _ _ _ _ _ + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPatchEdgeCover.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPatchEdgeCover.lean new file mode 100644 index 0000000000000000000000000000000000000000..af2be21f46942c878fa7a3074028821543be7a1a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPatchEdgeCover.lean @@ -0,0 +1,48 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPatchPhysical +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCellRouteCatalog + +namespace OAI + +/-! The physical output has retained edges and exactly the nine enumerated edges +at each gadget. The last perimeter edge uses the reversed catalog path. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +theorem qmaCrossingsEdge_cover {ν : Type*} {r : ℕ} (e : QMACrossingsGraphEdge ν r) : + (∃ f : ν, e = .inl (.inl f)) ∨ ∃ i k, e = qmaPatchPhysicalEdge i k := by + rcases e with (e | ⟨i,a⟩) | (i | ⟨i,a⟩) + · exact Or.inl ⟨e,rfl⟩ + · apply Or.inr + fin_cases a + · exact ⟨i,5,rfl⟩ + · exact ⟨i,8,rfl⟩ + · exact ⟨i,6,rfl⟩ + · exact ⟨i,7,rfl⟩ + · exact Or.inr ⟨i,0,rfl⟩ + · apply Or.inr + fin_cases a + · exact ⟨i,1,rfl⟩ + · exact ⟨i,2,rfl⟩ + · exact ⟨i,3,rfl⟩ + · exact ⟨i,4,rfl⟩ + +def qmaPatchRoute (p : ℕ × ℕ) (k : Fin 9) : QMACellRoute := + ⟨.patch p k,decide (k = 8)⟩ + +theorem qmaPatchRoute_source (p : ℕ × ℕ) (k : Fin 9) : + (qmaPatchRoute p k).source = qmaPatchTranslate p (qmaCrossingPatchVertex (qmaPatchSource k)) := by + by_cases h : k = 8 <;> + simp [qmaPatchRoute,QMACellRoute.source,QMACellRouteBody.source,QMACellRouteBody.target,qmaPatchSource,h] + +theorem qmaPatchRoute_target (p : ℕ × ℕ) (k : Fin 9) : + (qmaPatchRoute p k).target = qmaPatchTranslate p (qmaCrossingPatchVertex (qmaPatchTarget k)) := by + by_cases h : k = 8 <;> + simp [qmaPatchRoute,QMACellRoute.target,QMACellRouteBody.source,QMACellRouteBody.target,qmaPatchTarget,h] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPatchPhysical.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPatchPhysical.lean new file mode 100644 index 0000000000000000000000000000000000000000..ae00dd67e48763e4f3b97ffcc37ad26d7f4589c5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPatchPhysical.lean @@ -0,0 +1,42 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingsGraph +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingPatch +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingSize + +namespace OAI + +/-! The nine ordinary physical gadget edges are exactly the fixed patch edges, +with only the west-south perimeter edge oriented in reverse. -/ + +noncomputable section +namespace ContinuumCoulomb +open MediatorGraph + +def qmaPatchPhysicalVertex {n r : ℕ} (site : Fin r → Fin 4 → Fin n) (i : Fin r) : Fin 6 → Fin (n+r*2) := + ![old n r (site i 0),old n r (site i 1),old n r (site i 2),old n r (site i 3), + fresh n r i 0,fresh n r i 1] + +def qmaPatchPhysicalEdge {ν : Type*} {r : ℕ} (i : Fin r) : Fin 9 → QMACrossingsGraphEdge ν r := + ![.inr (.inl i),.inr (.inr (i,0)),.inr (.inr (i,1)),.inr (.inr (i,2)),.inr (.inr (i,3)), + .inl (.inr (i,0)),.inl (.inr (i,2)),.inl (.inr (i,3)),.inl (.inr (i,1))] + +def qmaPatchSource (e : Fin 9) : Fin 6 := if e = 8 then qmaCrossingPatchRight e else qmaCrossingPatchLeft e + +def qmaPatchTarget (e : Fin 9) : Fin 6 := if e = 8 then qmaCrossingPatchLeft e else qmaCrossingPatchRight e + +theorem qmaPatchPhysical_left {ν : Type*} {n r : ℕ} (left : ν → Fin n) + (site : Fin r → Fin 4 → Fin n) (i : Fin r) (e : Fin 9) : + qmaParallelGraphLeft (qmaCrossingsBaseLeft left site) site (qmaPatchPhysicalEdge i e) = + qmaPatchPhysicalVertex site i (qmaPatchSource e) := by + fin_cases e <;> rfl + +theorem qmaPatchPhysical_right {ν : Type*} {n r : ℕ} (right : ν → Fin n) + (site : Fin r → Fin 4 → Fin n) (i : Fin r) (e : Fin 9) : + qmaParallelGraphRight (qmaCrossingsBaseRight right site) (fun _ => qmaCrossingMember) + (qmaPatchPhysicalEdge i e) = qmaPatchPhysicalVertex site i (qmaPatchTarget e) := by + fin_cases e <;> rfl + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPatchPoints.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPatchPoints.lean new file mode 100644 index 0000000000000000000000000000000000000000..4ef5cd9de13f025864dde6b1c9586c9693031b05 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPatchPoints.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingPatch +import Mathlib.Data.List.GetD + +namespace OAI + +/-! The fixed crossing-patch lists as bounded, simple coordinate arrays. -/ + +namespace ContinuumCoulomb + +def qmaPatchLength (e : Fin 9) : ℕ := (qmaCrossingPatchPath e).length-1 + +def qmaPatchPoint (e : Fin 9) (k : ℕ) : ℕ × ℕ := + (qmaCrossingPatchPath e).getD k (0,0) + +theorem qmaPatchLength_pos (e : Fin 9) : 0 < qmaPatchLength e := by fin_cases e <;> decide + +theorem qmaPatchLength_le (e : Fin 9) : qmaPatchLength e ≤ 12 := by fin_cases e <;> decide + +theorem qmaPatchPoint_get (e : Fin 9) {k : ℕ} (hk : k ≤ qmaPatchLength e) : + qmaPatchPoint e k = (qmaCrossingPatchPath e)[k]'(by have := qmaPatchLength_pos e; dsimp [qmaPatchLength] at *; omega) := + List.getD_eq_getElem _ _ _ + +@[simp] theorem qmaPatchPoint_first (e : Fin 9) : + qmaPatchPoint e 0 = qmaCrossingPatchVertex (qmaCrossingPatchLeft e) := by fin_cases e <;> rfl + +@[simp] theorem qmaPatchPoint_last (e : Fin 9) : + qmaPatchPoint e (qmaPatchLength e) = qmaCrossingPatchVertex (qmaCrossingPatchRight e) := by fin_cases e <;> rfl + +theorem qmaPatchPoint_simple (e : Fin 9) {i j : ℕ} (hi : i ≤ qmaPatchLength e) (hj : j ≤ qmaPatchLength e) + (h : qmaPatchPoint e i = qmaPatchPoint e j) : i = j := by + rw [qmaPatchPoint_get e hi,qmaPatchPoint_get e hj] at h + exact (qmaCrossingPatch_simple e).getElem_inj_iff.mp h + +theorem qmaPatchPoint_step (e : Fin 9) {k : ℕ} (hk : k < qmaPatchLength e) : + Nat.dist (qmaPatchPoint e k).1 (qmaPatchPoint e (k+1)).1+ + Nat.dist (qmaPatchPoint e k).2 (qmaPatchPoint e (k+1)).2 = 1 := by + rw [qmaPatchPoint_get e (Nat.le_of_lt hk),qmaPatchPoint_get e (by omega)] + exact List.isChain_iff_getElem.mp (qmaCrossingPatch_chain e) k (by dsimp [qmaPatchLength] at hk; omega) + +theorem qmaPatchPoint_mem (e : Fin 9) {k : ℕ} (hk : k ≤ qmaPatchLength e) : + qmaPatchPoint e k ∈ qmaCrossingPatchPath e := by + rw [qmaPatchPoint_get e hk] + exact List.getElem_mem _ + +theorem qmaPatchPoint_interior_mem (e : Fin 9) {k : ℕ} (hk0 : 0 < k) (hk : k < qmaPatchLength e) : + qmaPatchPoint e k ∈ ((qmaCrossingPatchPath e).drop 1).dropLast := by + have hi : k-1 < ((qmaCrossingPatchPath e).drop 1).dropLast.length := by + simp only [List.length_dropLast,List.length_drop] + dsimp [qmaPatchLength] at hk + omega + have hm := List.getElem_mem (l := ((qmaCrossingPatchPath e).drop 1).dropLast) hi + rw [List.getElem_dropLast,List.getElem_drop] at hm + have he : 1+(k-1) = k := by omega + simpa only [he,← qmaPatchPoint_get e hk.le] using hm + +theorem qmaPatchPoint_avoids (e : Fin 9) {k : ℕ} (hk0 : 0 < k) (hk : k < qmaPatchLength e) (v : Fin 6) : + qmaPatchPoint e k ≠ qmaCrossingPatchVertex v := by + intro h + have hm := qmaPatchPoint_interior_mem e hk0 hk + rw [h] at hm + exact Finset.disjoint_left.mp (qmaCrossingPatch_interior_fresh e) (List.mem_toFinset.mpr hm) + (Finset.mem_image.mpr ⟨v,Finset.mem_univ _,rfl⟩) + +theorem qmaPatchPoint_disjoint (e f : Fin 9) (hef : e ≠ f) {i j : ℕ} + (hi0 : 0 < i) (hi : i < qmaPatchLength e) (hj : j ≤ qmaPatchLength f) : + qmaPatchPoint e i ≠ qmaPatchPoint f j := by + intro h + have hm := qmaPatchPoint_interior_mem e hi0 hi + rw [h] at hm + exact Finset.disjoint_left.mp (qmaCrossingPatch_disjoint e f hef) (List.mem_toFinset.mpr hm) + (List.mem_toFinset.mpr (qmaPatchPoint_mem f hj)) + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPatchSeparation.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPatchSeparation.lean new file mode 100644 index 0000000000000000000000000000000000000000..442af0f0c4028207cd3b3c262523f5d4a2ab1a55 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPatchSeparation.lean @@ -0,0 +1,50 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRouteLanes + +namespace OAI + +/-! Disjoint twelve-wide crossing patches after a fixed integer expansion. -/ + +namespace ContinuumCoulomb + +def qmaExpandedPoint (p : ℕ × ℕ) : ℕ × ℕ := (32*p.1+16,32*p.2+16) +def qmaPatchBox (p : ℕ × ℕ) : Set (ℕ × ℕ) := + {z | Nat.dist z.1 (qmaExpandedPoint p).1 ≤ 6 ∧ Nat.dist z.2 (qmaExpandedPoint p).2 ≤ 6} + +theorem qmaExpandedPoint_dist_row (p q : ℕ × ℕ) : + Nat.dist (qmaExpandedPoint p).1 (qmaExpandedPoint q).1 = 32*Nat.dist p.1 q.1 := by + simp only [qmaExpandedPoint,Nat.dist_add_add_right,Nat.dist_mul_left] + +theorem qmaExpandedPoint_dist_col (p q : ℕ × ℕ) : + Nat.dist (qmaExpandedPoint p).2 (qmaExpandedPoint q).2 = 32*Nat.dist p.2 q.2 := by + simp only [qmaExpandedPoint,Nat.dist_add_add_right,Nat.dist_mul_left] + +theorem qmaPatchBox_disjoint {p q : ℕ × ℕ} (hpq : p ≠ q) : + Disjoint (qmaPatchBox p) (qmaPatchBox q) := by + apply Set.disjoint_left.mpr + intro z hz hq + obtain ⟨hpx,hpy⟩ := hz + obtain ⟨hqx,hqy⟩ := hq + have hx := Nat.dist.triangle_inequality (qmaExpandedPoint p).1 z.1 (qmaExpandedPoint q).1 + have hy := Nat.dist.triangle_inequality (qmaExpandedPoint p).2 z.2 (qmaExpandedPoint q).2 + rw [Nat.dist_comm (qmaExpandedPoint p).1 z.1,qmaExpandedPoint_dist_row] at hx + rw [Nat.dist_comm (qmaExpandedPoint p).2 z.2,qmaExpandedPoint_dist_col] at hy + have heqx : Nat.dist p.1 q.1 = 0 := by omega + have heqy : Nat.dist p.2 q.2 = 0 := by omega + exact hpq (Prod.ext (Nat.eq_of_dist_eq_zero heqx) (Nat.eq_of_dist_eq_zero heqy)) + +theorem qmaExpandedPoint_mem_own (p : ℕ × ℕ) : qmaExpandedPoint p ∈ qmaPatchBox p := by + simp [qmaPatchBox] + +theorem qmaExpandedPoint_not_mem {p q : ℕ × ℕ} (hpq : p ≠ q) : + qmaExpandedPoint p ∉ qmaPatchBox q := by + intro h + exact Set.disjoint_left.mp (qmaPatchBox_disjoint hpq) (qmaExpandedPoint_mem_own p) h + +theorem qmaExpandedCrossing_not_vertex {C : ℕ} {c d : Fin C} (hcd : c ≠ d) + {x y : ℕ} {p : ℕ × ℕ} (hh : qmaHorizontalLane c y p) (hv : qmaVerticalLane d x p) + (e : Fin C) (q : ℕ × ℕ) : qmaExpandedPoint (qmaLanePoint e q) ∉ qmaPatchBox p := + qmaExpandedPoint_not_mem (qmaLane_crossing_not_vertex hcd hh hv e q).symm + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathCoverage.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathCoverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..3b0bdef2d68608d8d0fd3c541352ad45fe2c4c9c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathCoverage.lean @@ -0,0 +1,86 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutedSubdivision + +namespace OAI + +/-! Every prescribed path point becomes an actual spin when subdivision finishes. -/ + +noncomputable section +namespace ContinuumCoulomb +open MediatorGraph +open scoped Classical +namespace QMAPathEmbedding +variable {W : QMAPathSchedule} {Γ : SimpleGraph (ℕ × ℕ)} (P : QMAPathEmbedding W Γ) + +theorem next_covers_point (N : ℚ) (e : W.graph.Edge) (k : ℕ) (hk : k ≤ 2*W.work e+1) : + ∃ (f : (W.next N).graph.Edge) (l : ℕ), l ≤ 2*(W.next N).work f+1 ∧ + (P.next N).point f l = P.point e k := by + by_cases he : e ∈ W.active + · let i : Fin W.active.card := W.active.equivFin ⟨e,he⟩ + have hi : qmaSelectedIndex W.active i = e := by simp [qmaSelectedIndex,i] + have hw : 0 < W.work e := (W.mem_active e).mp he + by_cases hk1 : k ≤ 1 + · refine ⟨Sum.inr (Sum.inr (i,0)),k,?_,?_⟩ + · exact hk1 + · change P.point (qmaSelectedIndex W.active i) k = _ + rw [hi] + by_cases hk2 : k = 2 + · subst k + refine ⟨Sum.inr (Sum.inl i),1,by exact Nat.le_refl 1,?_⟩ + change P.point (qmaSelectedIndex W.active i) (1+1) = _ + rw [hi] + · refine ⟨Sum.inr (Sum.inr (i,1)),2*W.work e+1-k,?_,?_⟩ + · change 2*W.work e+1-k ≤ 2*(W.work (qmaSelectedIndex W.active i)-1)+1 + rw [hi] + omega + · change P.point (qmaSelectedIndex W.active i) + (2*W.work (qmaSelectedIndex W.active i)+1-(2*W.work e+1-k)) = _ + rw [hi] + congr 1 + omega + · refine ⟨Sum.inl ⟨e,he⟩,k,?_,rfl⟩ + have hle : W.work e ≤ 0 := by simpa only [W.mem_active,not_lt] using he + have hw : W.work e = 0 := Nat.eq_zero_of_le_zero hle + change k ≤ 1 + simpa only [hw,Nat.mul_zero,Nat.zero_add] using hk + +def Occupied (z : ℕ × ℕ) : Prop := + (∃ v, P.position v = z) ∨ ∃ e k, k ≤ 2*W.work e+1 ∧ P.point e k = z + +theorem next_occupied (N : ℚ) {z : ℕ × ℕ} (hz : P.Occupied z) : (P.next N).Occupied z := by + rcases hz with ⟨v,hv⟩ | ⟨e,k,hk,hz⟩ + · exact Or.inl ⟨old W.graph.n W.active.card v,(P.nextPosition_old v).trans hv⟩ + · obtain ⟨f,l,hl,he⟩ := P.next_covers_point N e k hk + exact Or.inr ⟨f,l,hl,he.trans hz⟩ + +theorem iterate_occupied (N : ℚ) {z : ℕ × ℕ} (hz : P.Occupied z) (k : ℕ) : + (P.iterate N k).Occupied z := by + induction k with + | zero => exact hz + | succ k ih => exact (P.iterate N k).next_occupied N ih + +theorem occupied_complete (h : ∀ e, W.work e = 0) {z : ℕ × ℕ} (hz : P.Occupied z) : + ∃ v, P.position v = z := by + rcases hz with hv | ⟨e,k,hk,hz⟩ + · exact hv + have hk1 : k ≤ 1 := by simpa only [h e,Nat.mul_zero,Nat.zero_add] using hk + by_cases hk0 : k = 0 + · subst k + exact ⟨W.graph.left e,(P.first e).symm.trans hz⟩ + · have hk' : k = 1 := by omega + have hl := P.last e + simp only [h e,Nat.mul_zero,Nat.zero_add] at hl + subst k + exact ⟨W.graph.right e,hl.symm.trans hz⟩ + +theorem iterate_covers_point (N : ℚ) {D : ℕ} (hD : ∀ e, W.work e ≤ D) + (e : W.graph.Edge) (k : ℕ) (hk : k ≤ 2*W.work e+1) : + ∃ v, (P.iterate N D).position v = P.point e k := + (P.iterate N D).occupied_complete (W.iterate_complete N hD) + (P.iterate_occupied N (Or.inr ⟨e,k,hk,rfl⟩) D) + +end QMAPathEmbedding +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathCoverageReverse.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathCoverageReverse.lean new file mode 100644 index 0000000000000000000000000000000000000000..5f12f20005b90ef4702439c35f53654edae8a3b7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathCoverageReverse.lean @@ -0,0 +1,40 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathCoverage + +namespace OAI + +/-! Subdivision only introduces spins at prescribed route points. -/ + +noncomputable section +namespace ContinuumCoulomb +open MediatorGraph +open scoped Classical +namespace QMAPathEmbedding +variable {W : QMAPathSchedule} {Γ : SimpleGraph (ℕ × ℕ)} (P : QMAPathEmbedding W Γ) + +theorem next_occupied_source (N : ℚ) {z : ℕ × ℕ} (hz : (P.next N).Occupied z) : P.Occupied z := by + rcases hz with ⟨v,hv⟩ | ⟨e,k,hk,hz⟩ + · obtain ⟨v,rfl⟩ := (vertexEquiv W.graph.n W.active.card).surjective v + rcases v with v | ⟨i,b⟩ + · change P.nextPosition (old _ _ v) = z at hv + rw [P.nextPosition_old] at hv + exact Or.inl ⟨v,hv⟩ + · change P.nextPosition (fresh _ _ i b) = z at hv + rw [P.nextPosition_fresh] at hv + have hw := W.selected_work_pos i + have hb := b.isLt + exact Or.inr ⟨qmaSelectedIndex W.active i,b.val+1,by omega,hv⟩ + · change P.point (W.nextParent e) (W.nextIndex e k) = z at hz + exact Or.inr ⟨W.nextParent e,W.nextIndex e k,W.nextIndex_bounds e hk,hz⟩ + +theorem iterate_occupied_source (N : ℚ) (k : ℕ) {z : ℕ × ℕ} + (hz : (P.iterate N k).Occupied z) : P.Occupied z := by + induction k with + | zero => exact hz + | succ k ih => exact ih ((P.iterate N k).next_occupied_source N hz) + +end QMAPathEmbedding +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathDegrees.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathDegrees.lean new file mode 100644 index 0000000000000000000000000000000000000000..9278d1c4e625772cb01f67a5abc46463a733b895 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathDegrees.lean @@ -0,0 +1,48 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGraphDegree +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathsGraph + +namespace OAI + +/-! Path subdivision preserves every old degree and adds only bounded-degree vertices. -/ + +noncomputable section +namespace ContinuumCoulomb +open MediatorGraph +open scoped BigOperators Classical +variable {ν : Type*} [Fintype ν] + +theorem qmaPaths_new_degree {n r : ℕ} (left right : ν → Fin n) + (site : Fin r → Fin 2 → Fin n) (even : Fin r → Bool) (e : Fin r) (b : Fin 2) : + qmaGraphDegree (qmaParallelGraphLeft left site) + (qmaParallelGraphRight right (fun f => qmaPathMember (even f))) (fresh n r e b) ≤ 3 := by + rw [qmaParallelGraph_new_degree] + simp only [Fin.sum_univ_two] + cases even e <;> fin_cases b <;> norm_num [qmaPathMember] + +theorem qmaPaths_old_degree {n r : ℕ} (left right : ν → Fin n) + (site : Fin r → Fin 2 → Fin n) (hsite : ∀ e, Function.Injective (site e)) + (even : Fin r → Bool) (v : Fin n) : + qmaGraphDegree (qmaParallelGraphLeft left site) + (qmaParallelGraphRight right (fun e => qmaPathMember (even e))) (old n r v) = + qmaGraphDegree (Sum.elim left (fun e => site e 0)) (Sum.elim right (fun e => site e 1)) v := by + rw [qmaParallelGraph_old_degree] + simp only [qmaGraphDegree,Fintype.sum_sum_type,Sum.elim_inl,Sum.elim_inr,Fin.sum_univ_two] + apply congrArg (fun x => (∑ a, if left a = v ∨ right a = v then 1 else 0)+x) + apply Finset.sum_congr rfl + intro e _ + have hne : site e 0 ≠ site e 1 := fun h => (by decide : (0:Fin 2) ≠ 1) (hsite e h) + by_cases h0 : site e 0 = v <;> by_cases h1 : site e 1 = v <;> simp_all + +theorem qmaCrossings_new_degree {n r : ℕ} (left right : ν → Fin n) + (site : Fin r → Fin 4 → Fin n) (e : Fin r) (b : Fin 2) : + qmaGraphDegree (qmaParallelGraphLeft left site) + (qmaParallelGraphRight right (fun _ => qmaCrossingMember)) (fresh n r e b) = 3 := by + rw [qmaParallelGraph_new_degree] + simp only [Fin.sum_univ_four] + fin_cases b <;> norm_num [qmaCrossingMember] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathEmbedding.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathEmbedding.lean new file mode 100644 index 0000000000000000000000000000000000000000..805918eceda3373096654dc08596a8c8b6bbc50a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathEmbedding.lean @@ -0,0 +1,101 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathSchedule +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOddPathGeometry + +namespace OAI + +/-! Geometric invariants for the variable-length path-subdivision schedule. -/ + +noncomputable section +namespace ContinuumCoulomb +open MediatorGraph +open scoped Classical + +structure QMAPathEmbedding (W : QMAPathSchedule) + (Γ : SimpleGraph (ℕ × ℕ) := qmaSquareGrid) where + position : Fin W.graph.n → ℕ × ℕ + position_injective : Function.Injective position + point : W.graph.Edge → ℕ → ℕ × ℕ + first : ∀ e, point e 0 = position (W.graph.left e) + last : ∀ e, point e (2*W.work e+1) = position (W.graph.right e) + simple : ∀ e i j, i ≤ 2*W.work e+1 → j ≤ 2*W.work e+1 → point e i = point e j → i = j + step : ∀ e i, i < 2*W.work e+1 → Γ.Adj (point e i) (point e (i+1)) + avoids : ∀ e i v, 0 < i → i < 2*W.work e+1 → point e i ≠ position v + disjoint : ∀ e f i j, e ≠ f → 0 < i → i < 2*W.work e+1 → j ≤ 2*W.work f+1 → + point e i ≠ point f j + +namespace QMAPathEmbedding +variable {W : QMAPathSchedule} {Γ : SimpleGraph (ℕ × ℕ)} (P : QMAPathEmbedding W Γ) + +theorem selected_work_pos (i : Fin W.active.card) : 0 < W.work (qmaSelectedIndex W.active i) := + (W.mem_active _).mp (qmaSelectedIndex_mem W.active i) + +def freshPosition (i : Fin W.active.card) (b : Fin 2) : ℕ × ℕ := + P.point (qmaSelectedIndex W.active i) (b.val+1) + +theorem freshPosition_ne_old (i : Fin W.active.card) (b : Fin 2) (v : Fin W.graph.n) : + P.freshPosition i b ≠ P.position v := by + apply P.avoids + · omega + · have h := selected_work_pos (W := W) i + have hb := b.isLt + omega + +theorem freshPosition_injective : Function.Injective (fun x : Fin W.active.card × Fin 2 => + P.freshPosition x.1 x.2) := by + rintro ⟨i,a⟩ ⟨j,b⟩ h + change P.point (qmaSelectedIndex W.active i) (a.val+1) = + P.point (qmaSelectedIndex W.active j) (b.val+1) at h + have hi := selected_work_pos (W := W) i + have hj := selected_work_pos (W := W) j + have ha := a.isLt + have hb := b.isLt + have he : qmaSelectedIndex W.active i = qmaSelectedIndex W.active j := by + by_contra hn + exact P.disjoint _ _ (a.val+1) (b.val+1) hn (by omega) (by omega) (by omega) h + have hij : i = j := by + apply W.active.equivFin.symm.injective + exact Subtype.ext he + subst j + have hab := P.simple (qmaSelectedIndex W.active i) (a.val+1) (b.val+1) (by omega) (by omega) h + have : a = b := Fin.ext (by omega) + subst b + rfl + +def nextPosition (v : Fin (W.graph.n+W.active.card*2)) : ℕ × ℕ := + Sum.elim P.position (fun p => P.freshPosition p.1 p.2) ((vertexEquiv _ _).symm v) + +@[simp] theorem nextPosition_old (v : Fin W.graph.n) : + P.nextPosition (old _ _ v) = P.position v := by simp [nextPosition,old] + +@[simp] theorem nextPosition_fresh (e : Fin W.active.card) (b : Fin 2) : + P.nextPosition (fresh _ _ e b) = P.freshPosition e b := by simp [nextPosition,fresh] + +theorem nextPosition_injective : Function.Injective P.nextPosition := by + intro x y h + obtain ⟨x,rfl⟩ := (vertexEquiv W.graph.n W.active.card).surjective x + obtain ⟨y,rfl⟩ := (vertexEquiv W.graph.n W.active.card).surjective y + simp only [nextPosition,Equiv.symm_apply_apply] at h + apply (vertexEquiv _ _).congr_arg + cases x with + | inl x => + cases y with + | inl y => exact congrArg Sum.inl (P.position_injective h) + | inr y => exact (P.freshPosition_ne_old y.1 y.2 x h.symm).elim + | inr x => + cases y with + | inl y => exact (P.freshPosition_ne_old x.1 x.2 y h).elim + | inr y => exact congrArg Sum.inr (P.freshPosition_injective h) + +theorem adjacent_of_complete (h : ∀ e, W.work e = 0) (e : W.graph.Edge) : + Γ.Adj (P.position (W.graph.left e)) (P.position (W.graph.right e)) := by + have hs := P.step e 0 (by omega) + have hl := P.last e + simp only [h e,Nat.mul_zero,Nat.zero_add] at hl + simpa only [P.first e,hl] using hs + +end QMAPathEmbedding +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathIteratedBound.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathIteratedBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f3ccee5fe1813589e1e9d40a52aa3e5d8046a7a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathIteratedBound.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathPolynomialBound + +namespace OAI + +/-! A fixed number of routed subdivisions has an explicit polynomial envelope, +with edge counts tracked separately from coefficient magnitudes. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +def qmaPathIteratedBound (m L T : ℝ) : ℕ → ℝ + | 0 => L + | k+1 => qmaPathCoefficientBound (3^k*m) (qmaPathIteratedBound m L T k) T + +theorem qmaPathCoefficientBound_one {m L T : ℝ} (hm : 0 ≤ m) (hL : 1 ≤ L) : + 1 ≤ qmaPathCoefficientBound m L T := by + unfold qmaPathCoefficientBound + have h : 0 ≤ (7*m+2)*(qmaPathRadiusBound m L T)^2 := by positivity + linarith + +theorem qmaPathIteratedBound_one {m L T : ℝ} (hm : 0 ≤ m) (hL : 1 ≤ L) (k : ℕ) : + 1 ≤ qmaPathIteratedBound m L T k := by + induction k with + | zero => exact hL + | succ k ih => exact qmaPathCoefficientBound_one (by positivity) ih + +namespace QMAPathSchedule +variable (W : QMAPathSchedule) + +theorem iterate_coefficientBound {N : ℚ} (hN : 0 ≤ N) {m L T : ℝ} + (hm : (Fintype.card W.graph.Edge:ℝ) ≤ m) (hL : 1 ≤ L) + (hT : |(N:ℝ)| ≤ T) (hc : W.graph.CoefficientBound L) (k : ℕ) : + (W.iterate N k).graph.CoefficientBound (qmaPathIteratedBound m L T k) := by + have hm0 : 0 ≤ m := (Nat.cast_nonneg _).trans hm + induction k with + | zero => exact hc + | succ k ih => + have hcount : (Fintype.card (W.iterate N k).graph.Edge:ℝ) ≤ 3^k*m := by + have hcast : (Fintype.card (W.iterate N k).graph.Edge:ℝ) ≤ + 3^k*(Fintype.card W.graph.Edge:ℝ) := by + exact_mod_cast W.iterate_edge_count N k + exact hcast.trans (mul_le_mul_of_nonneg_left hm (by positivity)) + exact (W.iterate N k).graph.subdivide_coefficientBound _ _ hN hcount + (qmaPathIteratedBound_one hm0 hL k) hT ih + +end QMAPathSchedule +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathPatch.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathPatch.lean new file mode 100644 index 0000000000000000000000000000000000000000..f137b0532af8ff3c59bf22c5993708b355e1ebec --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathPatch.lean @@ -0,0 +1,31 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumManhattanRoute + +namespace OAI + +/-! Square-lattice placements for the even and odd singlet subdivision gadgets. -/ + +namespace ContinuumCoulomb +open scoped Classical + +def qmaPathPatchVertex (even : Bool) : Fin 4 → ℕ × ℕ := + if even then ![(0,0),(2,0),(1,0),(1,1)] else ![(0,0),(3,0),(1,0),(2,0)] +def qmaPathPatchLeft : Fin 3 → Fin 4 := ![2,0,1] +def qmaPathPatchRight (even : Bool) : Fin 3 → Fin 4 := ![3,2,if even then 2 else 3] + +theorem qmaPathPatch_vertices (even : Bool) : Function.Injective (qmaPathPatchVertex even) := by + cases even <;> decide + +theorem qmaPathPatch_adjacent (even : Bool) (e : Fin 3) : + Nat.dist (qmaPathPatchVertex even (qmaPathPatchLeft e)).1 + (qmaPathPatchVertex even (qmaPathPatchRight even e)).1+ + Nat.dist (qmaPathPatchVertex even (qmaPathPatchLeft e)).2 + (qmaPathPatchVertex even (qmaPathPatchRight even e)).2 = 1 := by + cases even <;> fin_cases e <;> decide + +theorem qmaPathPatch_degree (even : Bool) (v : Fin 4) : + (Finset.univ.filter (fun e => qmaPathPatchLeft e = v ∨ qmaPathPatchRight even e = v)).card ≤ 3 := by + cases even <;> fin_cases v <;> decide + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathPieces.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathPieces.lean new file mode 100644 index 0000000000000000000000000000000000000000..de6c8231d2b83aff5b20c2d3066ddd653490068c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathPieces.lean @@ -0,0 +1,123 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathSchedule +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOddPathGeometry + +namespace OAI + +/-! Each edge of an odd-subdivision round is an explicitly indexed piece of +one previous route. Interior points of distinct pieces cannot coincide. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical +namespace QMAPathSchedule + +def nextParent (W : QMAPathSchedule) : QMAPartialPathsEdge W.active → W.graph.Edge + | .inl e => e.val + | .inr (.inl i) => qmaSelectedIndex W.active i + | .inr (.inr (i,_)) => qmaSelectedIndex W.active i + +def nextIndex (W : QMAPathSchedule) (e : QMAPartialPathsEdge W.active) (k : ℕ) : ℕ := + match e with + | .inl _ => k + | .inr (.inl _) => k+1 + | .inr (.inr (i,a)) => if a = 0 then k else 2*W.work (qmaSelectedIndex W.active i)+1-k + +theorem retained_work_zero (W : QMAPathSchedule) (e : {e // e ∉ W.active}) : + W.work e.val = 0 := by + have h := e.property + simp only [mem_active] at h + omega + +theorem selected_work_pos (W : QMAPathSchedule) (i : Fin W.active.card) : + 0 < W.work (qmaSelectedIndex W.active i) := + (W.mem_active _).mp (qmaSelectedIndex_mem W.active i) + +theorem nextIndex_bounds (W : QMAPathSchedule) (e : QMAPartialPathsEdge W.active) {k : ℕ} + (hk : k ≤ 2*W.nextWork e+1) : W.nextIndex e k ≤ 2*W.work (W.nextParent e)+1 := by + rcases e with e | (i | ⟨i,a⟩) + · simpa only [nextIndex,nextParent,nextWork,W.retained_work_zero e,Nat.mul_zero, + Nat.zero_add] using hk + · have hp := W.selected_work_pos i + simp only [nextIndex,nextParent,nextWork,Nat.mul_zero,Nat.zero_add] at * + omega + · have hp := W.selected_work_pos i + fin_cases a <;> simp [nextIndex,nextParent,nextWork] at * + omega + +theorem nextIndex_injective (W : QMAPathSchedule) (e : QMAPartialPathsEdge W.active) {i j : ℕ} + (hi : i ≤ 2*W.nextWork e+1) (hj : j ≤ 2*W.nextWork e+1) + (h : W.nextIndex e i = W.nextIndex e j) : i = j := by + rcases e with e | (a | ⟨a,b⟩) + · exact h + · simpa only [nextIndex,Nat.add_right_cancel_iff] using h + · have hp := W.selected_work_pos a + fin_cases b <;> simp [nextIndex,nextWork] at * <;> omega + +theorem nextIndex_interior (W : QMAPathSchedule) (e : QMAPartialPathsEdge W.active) {i : ℕ} + (hi0 : 0 < i) (hi : i < 2*W.nextWork e+1) : + 2 < W.nextIndex e i ∧ W.nextIndex e i < 2*W.work (W.nextParent e)+1 := by + rcases e with e | (a | ⟨a,b⟩) + · simp only [nextWork,Nat.mul_zero,Nat.zero_add] at hi + omega + · simp only [nextWork,Nat.mul_zero,Nat.zero_add] at hi + omega + · have hp := W.selected_work_pos a + fin_cases b <;> simp [nextIndex,nextParent,nextWork] at * <;> omega + +theorem nextIndex_step (W : QMAPathSchedule) (e : QMAPartialPathsEdge W.active) {i : ℕ} + (hi : i < 2*W.nextWork e+1) : + W.nextIndex e (i+1) = W.nextIndex e i+1 ∨ + W.nextIndex e i = W.nextIndex e (i+1)+1 := by + rcases e with e | (a | ⟨a,b⟩) + · exact Or.inl rfl + · exact Or.inl rfl + · have hp := W.selected_work_pos a + fin_cases b <;> simp [nextIndex,nextWork] at * + omega + +theorem selectedIndex_injective (W : QMAPathSchedule) : + Function.Injective (qmaSelectedIndex W.active) := by + intro i j h + apply W.active.equivFin.symm.injective + exact Subtype.ext h + +theorem nextIndex_separated (W : QMAPathSchedule) (e f : QMAPartialPathsEdge W.active) + {i j : ℕ} (hi0 : 0 < i) (hi : i < 2*W.nextWork e+1) + (hj : j ≤ 2*W.nextWork f+1) (he : W.nextParent e = W.nextParent f) + (hp : W.nextIndex e i = W.nextIndex f j) : e = f := by + have hinner := W.nextIndex_interior e hi0 hi + rcases e with e | (a | ⟨a,b⟩) + · simp only [nextWork,Nat.mul_zero,Nat.zero_add] at hi + omega + · simp only [nextWork,Nat.mul_zero,Nat.zero_add] at hi + omega + · fin_cases b + · simp [nextWork] at hi + omega + rcases f with f | (c | ⟨c,d⟩) + · have hret := W.retained_work_zero f + have hpos := W.selected_work_pos a + change qmaSelectedIndex W.active a = f.val at he + rw [he,hret] at hpos + omega + · change qmaSelectedIndex W.active a = qmaSelectedIndex W.active c at he + have hac := W.selectedIndex_injective he + subst c + simp [nextIndex,nextWork] at hj hp + simp [nextIndex] at hinner + omega + · change qmaSelectedIndex W.active a = qmaSelectedIndex W.active c at he + have hac := W.selectedIndex_injective he + subst c + fin_cases d + · simp [nextIndex,nextWork] at hj hp + simp [nextIndex] at hinner + omega + · rfl + +end QMAPathSchedule +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathPlacement.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathPlacement.lean new file mode 100644 index 0000000000000000000000000000000000000000..6ee0424d6e4bbd018d4229c0187d180926c3d3fb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathPlacement.lean @@ -0,0 +1,121 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathEmbedding +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathPieces + +namespace OAI + +/-! Physical placements are preserved by every scheduled odd subdivision. -/ + +noncomputable section +namespace ContinuumCoulomb +open MediatorGraph +open scoped Classical +namespace QMAPathEmbedding +variable {W : QMAPathSchedule} {Γ : SimpleGraph (ℕ × ℕ)} (P : QMAPathEmbedding W Γ) + +def nextPoint (e : QMAPartialPathsEdge W.active) (k : ℕ) : ℕ × ℕ := + P.point (W.nextParent e) (W.nextIndex e k) + +theorem nextPoint_first (e : QMAPartialPathsEdge W.active) : + P.nextPoint e 0 = P.nextPosition (qmaPartialPathsLeft W.graph.left W.graph.right W.active e) := by + rcases e with e | (i | ⟨i,a⟩) + · simpa [nextPoint,QMAPathSchedule.nextParent,QMAPathSchedule.nextIndex,qmaPartialPathsLeft, + qmaParallelGraphLeft] using P.first e.val + · simp [nextPoint,QMAPathSchedule.nextParent,QMAPathSchedule.nextIndex,qmaPartialPathsLeft, + qmaParallelGraphLeft,freshPosition] + · fin_cases a + · simpa [nextPoint,QMAPathSchedule.nextParent,QMAPathSchedule.nextIndex,qmaPartialPathsLeft, + qmaParallelGraphLeft,qmaSelectedSite] using P.first (qmaSelectedIndex W.active i) + · simpa [nextPoint,QMAPathSchedule.nextParent,QMAPathSchedule.nextIndex,qmaPartialPathsLeft, + qmaParallelGraphLeft,qmaSelectedSite] using P.last (qmaSelectedIndex W.active i) + +theorem nextPoint_last (e : QMAPartialPathsEdge W.active) : + P.nextPoint e (2*W.nextWork e+1) = + P.nextPosition (qmaPartialPathsRight W.graph.right W.active (fun _ => false) e) := by + rcases e with e | (i | ⟨i,a⟩) + · have hz := W.retained_work_zero e + simpa [nextPoint,QMAPathSchedule.nextParent,QMAPathSchedule.nextIndex,QMAPathSchedule.nextWork, + qmaPartialPathsRight,qmaParallelGraphRight,hz] using P.last e.val + · simp [nextPoint,QMAPathSchedule.nextParent,QMAPathSchedule.nextIndex,QMAPathSchedule.nextWork, + qmaPartialPathsRight,qmaParallelGraphRight,freshPosition] + · have hw := W.selected_work_pos i + fin_cases a + · simp [nextPoint,QMAPathSchedule.nextParent,QMAPathSchedule.nextIndex,QMAPathSchedule.nextWork, + qmaPartialPathsRight,qmaParallelGraphRight,qmaPathMember,freshPosition] + · have hi : 2*W.work (qmaSelectedIndex W.active i)+1 - + (2*(W.work (qmaSelectedIndex W.active i)-1)+1) = 2 := by omega + simp [nextPoint,QMAPathSchedule.nextParent,QMAPathSchedule.nextIndex,QMAPathSchedule.nextWork, + qmaPartialPathsRight,qmaParallelGraphRight,qmaPathMember,freshPosition,hi] + +theorem nextPoint_simple (e : QMAPartialPathsEdge W.active) (i j : ℕ) + (hi : i ≤ 2*W.nextWork e+1) (hj : j ≤ 2*W.nextWork e+1) + (h : P.nextPoint e i = P.nextPoint e j) : i = j := by + have he := P.simple _ _ _ (W.nextIndex_bounds e hi) (W.nextIndex_bounds e hj) h + exact W.nextIndex_injective e hi hj he + +theorem nextPoint_step (e : QMAPartialPathsEdge W.active) (i : ℕ) + (hi : i < 2*W.nextWork e+1) : Γ.Adj (P.nextPoint e i) (P.nextPoint e (i+1)) := by + have hb := W.nextIndex_bounds e (Nat.le_of_lt hi) + have hn := W.nextIndex_bounds e (k := i+1) (Nat.succ_le_iff.mpr hi) + rcases W.nextIndex_step e hi with h | h + · have hk : W.nextIndex e i < 2*W.work (W.nextParent e)+1 := by omega + simpa only [nextPoint,h] using P.step (W.nextParent e) (W.nextIndex e i) hk + · have hk : W.nextIndex e (i+1) < 2*W.work (W.nextParent e)+1 := by omega + simpa only [nextPoint,h] using (P.step (W.nextParent e) (W.nextIndex e (i+1)) hk).symm + +theorem nextPoint_avoids (e : QMAPartialPathsEdge W.active) (i : ℕ) + (v : Fin (W.graph.n+W.active.card*2)) (hi0 : 0 < i) (hi : i < 2*W.nextWork e+1) : + P.nextPoint e i ≠ P.nextPosition v := by + obtain ⟨v,rfl⟩ := (vertexEquiv W.graph.n W.active.card).surjective v + obtain ⟨hlo,hhi⟩ := W.nextIndex_interior e hi0 hi + rcases v with v | ⟨a,b⟩ + · change P.point (W.nextParent e) (W.nextIndex e i) ≠ P.nextPosition (old _ _ v) + rw [nextPosition_old] + exact P.avoids _ _ v (by omega) hhi + · simp only [show vertexEquiv W.graph.n W.active.card (Sum.inr (a,b)) = fresh _ _ a b from rfl, + nextPosition_fresh,freshPosition,nextPoint] + intro h + have hp := W.selected_work_pos a + have hb := b.isLt + by_cases he : W.nextParent e = qmaSelectedIndex W.active a + · have hi' : W.nextIndex e i ≤ 2*W.work (qmaSelectedIndex W.active a)+1 := by + rw [← he] + omega + have hj' : b.val+1 ≤ 2*W.work (qmaSelectedIndex W.active a)+1 := by omega + rw [he] at h + have hx := P.simple _ _ _ hi' hj' h + omega + · exact P.disjoint _ _ _ _ he (by omega) hhi (by omega) h + +theorem nextPoint_disjoint (e f : QMAPartialPathsEdge W.active) (i j : ℕ) + (hef : e ≠ f) (hi0 : 0 < i) (hi : i < 2*W.nextWork e+1) (hj : j ≤ 2*W.nextWork f+1) : + P.nextPoint e i ≠ P.nextPoint f j := by + intro h + obtain ⟨hlo,hhi⟩ := W.nextIndex_interior e hi0 hi + have hbj := W.nextIndex_bounds f hj + have he : W.nextParent e = W.nextParent f := by + by_contra hn + exact P.disjoint _ _ _ _ hn (by omega) hhi hbj h + have hbi := W.nextIndex_bounds e (Nat.le_of_lt hi) + change P.point (W.nextParent e) (W.nextIndex e i) = + P.point (W.nextParent f) (W.nextIndex f j) at h + rw [← he] at h hbj + have hx := P.simple _ _ _ hbi hbj h + exact hef (W.nextIndex_separated e f hi0 hi hj he hx) + +def next (N : ℚ) : QMAPathEmbedding (W.next N) Γ where + position := P.nextPosition + position_injective := P.nextPosition_injective + point := P.nextPoint + first := P.nextPoint_first + last := P.nextPoint_last + simple := P.nextPoint_simple + step := P.nextPoint_step + avoids := P.nextPoint_avoids + disjoint := P.nextPoint_disjoint + +end QMAPathEmbedding +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathPolynomialBound.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathPolynomialBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..81dbcb7eef2486db86b96bde2b74136783565409 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathPolynomialBound.lean @@ -0,0 +1,106 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathWeightBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathSchedule + +namespace OAI + +/-! Explicit polynomial coefficient envelopes for the actual selected path +subdivision, uniform in the selected set and its parity choices. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators Classical + +def qmaPathBudget (m L : ℝ) : ℝ := + 3*m*L+L+3*m*(1+2*L)+4*m*(1+L)^2+1 + +def qmaPathRadiusBound (m L T : ℝ) : ℝ := + L+16*(qmaPathBudget m L)^3*T+4*qmaPathBudget m L+1 + +def qmaPathCoefficientBound (m L T : ℝ) : ℝ := + 1+L+(7*m+2)*(qmaPathRadiusBound m L T)^2 + +namespace QMARationalExchangeGraph +variable (G : QMARationalExchangeGraph) + +def CoefficientBound (L : ℝ) : Prop := + |(G.constant:ℝ)| ≤ L ∧ ∀ e, |(G.weight e:ℝ)| ≤ L + +theorem pathScale_abs_bound (s : Finset G.Edge) {N : ℚ} (hN : 0 ≤ N) + {m L T : ℝ} (hm : (Fintype.card G.Edge:ℝ) ≤ m) (hL : 1 ≤ L) + (hT : |(N:ℝ)| ≤ T) (hc : G.CoefficientBound L) : + |(G.pathScale s N:ℝ)| ≤ qmaPathRadiusBound m L T := by + have hm0 : 0 ≤ m := (Nat.cast_nonneg _).trans hm + have hL0 : 0 ≤ L := by linarith + have hn0 : 0 ≤ (N:ℝ) := by exact_mod_cast hN + have hT0 : 0 ≤ T := (abs_nonneg _).trans hT + have hs0 : (s.card:ℝ) ≤ (Fintype.card G.Edge:ℝ) := by exact_mod_cast Finset.card_le_univ s + have hs : (s.card:ℝ) ≤ m := hs0.trans hm + have hr0 : (Fintype.card {e : G.Edge // e ∉ s}:ℝ) ≤ (Fintype.card G.Edge:ℝ) := by + exact_mod_cast Fintype.card_subtype_le (fun e : G.Edge => e ∉ s) + have hr : (Fintype.card {e : G.Edge // e ∉ s}:ℝ) ≤ m := hr0.trans hm + have hret : (∑ e : {e : G.Edge // e ∉ s}, |(G.weight e.val:ℝ)|) ≤ m*L := by + calc + _ ≤ ∑ _e : {e : G.Edge // e ∉ s}, L := Finset.sum_le_sum (fun e _ => hc.2 e.val) + _ = (Fintype.card {e : G.Edge // e ∉ s}:ℝ)*L := by simp + _ ≤ m*L := mul_le_mul_of_nonneg_right hr hL0 + have ha : (∑ i : Fin s.card, (1+2*|(G.weight (qmaSelectedIndex s i):ℝ)|)) ≤ m*(1+2*L) := by + calc + _ ≤ ∑ _i : Fin s.card, (1+2*L) := Finset.sum_le_sum (fun i _ => by linarith [hc.2 (qmaSelectedIndex s i)]) + _ = (s.card:ℝ)*(1+2*L) := by simp [mul_add] + _ ≤ m*(1+2*L) := mul_le_mul_of_nonneg_right hs (by positivity) + have hd : (∑ i : Fin s.card, (1+|(G.weight (qmaSelectedIndex s i):ℝ)|)^2) ≤ m*(1+L)^2 := by + calc + _ ≤ ∑ _i : Fin s.card, (1+L)^2 := Finset.sum_le_sum (fun i _ => + pow_le_pow_left₀ (by positivity) (by linarith [hc.2 (qmaSelectedIndex s i)]) 2) + _ = (s.card:ℝ)*(1+L)^2 := by simp + _ ≤ m*(1+L)^2 := mul_le_mul_of_nonneg_right hs (sq_nonneg _) + let A : ℝ := 3*∑ i : Fin s.card, (1+2*|(G.weight (qmaSelectedIndex s i):ℝ)|) + let D : ℝ := 3*(∑ e : {e : G.Edge // e ∉ s}, |(G.weight e.val:ℝ)|)+ + |(G.constant:ℝ)|+4*∑ i : Fin s.card, (1+|(G.weight (qmaSelectedIndex s i):ℝ)|)^2 + have hAD0 : 0 ≤ A+D+1 := by dsimp [A,D]; positivity + have hAD : A+D+1 ≤ qmaPathBudget m L := by dsimp [A,D,qmaPathBudget]; linarith [hc.1] + have hcube := pow_le_pow_left₀ hAD0 hAD 3 + rw [G.pathScale_cast] + change |16*(A+D+1)^3*(N:ℝ)+4*(A+D+1)+1| ≤ _ + rw [abs_of_nonneg (by positivity)] + have hnT : (N:ℝ) ≤ T := by simpa only [abs_of_nonneg hn0] using hT + have hprod := mul_le_mul hcube hnT + hn0 (pow_nonneg (hAD0.trans hAD) 3) + dsimp [qmaPathRadiusBound] + nlinarith + +theorem subdivide_coefficientBound (s : Finset G.Edge) (even : Fin s.card → Bool) + {N : ℚ} (hN : 0 ≤ N) {m L T : ℝ} (hm : (Fintype.card G.Edge:ℝ) ≤ m) + (hL : 1 ≤ L) (hT : |(N:ℝ)| ≤ T) (hc : G.CoefficientBound L) : + (G.subdivide s even N).CoefficientBound (qmaPathCoefficientBound m L T) := by + have hm0 : 0 ≤ m := (Nat.cast_nonneg _).trans hm + have hL0 : 0 ≤ L := by linarith + have hT0 : 0 ≤ T := (abs_nonneg _).trans hT + have hb0 : 0 ≤ qmaPathBudget m L := by unfold qmaPathBudget; positivity + have hrad : L ≤ qmaPathRadiusBound m L T := by + unfold qmaPathRadiusBound + have h : 0 ≤ 16*(qmaPathBudget m L)^3*T := by positivity + linarith + have hr1 : 1 ≤ qmaPathRadiusBound m L T := hL.trans hrad + have hr := G.pathScale_abs_bound s hN hm hL hT hc + have hw : ∀ e, |(G.weight e:ℝ)| ≤ qmaPathRadiusBound m L T := + fun e => (hc.2 e).trans hrad + have hs0 : (s.card:ℝ) ≤ (Fintype.card G.Edge:ℝ) := by exact_mod_cast Finset.card_le_univ s + have hs : (s.card:ℝ) ≤ m := hs0.trans hm + constructor + · have h := G.subdivide_constant_abs_le s even N hr1 hr hw + have hm' := mul_le_mul_of_nonneg_right hs (sq_nonneg (qmaPathRadiusBound m L T)) + unfold qmaPathCoefficientBound + nlinarith [hc.1] + · intro e + have h := G.subdivide_weight_abs_le s even N hr1 hr hw e + unfold qmaPathCoefficientBound + nlinarith [sq_nonneg (qmaPathRadiusBound m L T), + mul_nonneg hm0 (sq_nonneg (qmaPathRadiusBound m L T))] + +end QMARationalExchangeGraph +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..0bb35c848674067cd135c01d46ffb6b36df0902b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathProgram.lean @@ -0,0 +1,70 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathsGraph +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingProgram + +namespace OAI + +/-! Literal polynomial coefficient program for both parities of a path gadget. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPathCode +open ExactQuantumFactoring.BitStackProgram QuantumRoutingCode + +abbrev Input := Bool × (ℚ × ℚ) +def inputCode : Input → List Bool := prodCode Procedure.boolCode (prodCode ratCode ratCode) +noncomputable opaque evenProgram : Procedure inputCode Procedure.boolCode Prod.fst := Procedure.first _ _ +noncomputable opaque tailProgram : Procedure inputCode (prodCode ratCode ratCode) Prod.snd := Procedure.second _ _ +noncomputable opaque radiusProgram : Procedure inputCode ratCode (fun x => x.2.1) := + (Procedure.first _ _).comp tailProgram +noncomputable opaque weightProgram : Procedure inputCode ratCode (fun x => x.2.2) := + (Procedure.second _ _).comp tailProgram +noncomputable opaque spokeProgram : Procedure inputCode ratCode + (fun x => if x.1 then -2*x.2.1*x.2.2 else 2*x.2.1*x.2.2) := by + let p := twiceProductProgram radiusProgram weightProgram + exact (Procedure.conditional evenProgram (Procedure.ratNeg.comp p) p).congrFun + (by rintro ⟨b,r,j⟩; cases b <;> simp [neg_mul]) +noncomputable opaque offsetProgram : Procedure inputCode ratCode + (fun x => 3/4+3*x.2.2^2+3*x.2.1^2) := by + let j := Procedure.ratMul.comp ((Procedure.constant inputCode ratCode 3).pair (squareProgram weightProgram)) + let r := Procedure.ratMul.comp ((Procedure.constant inputCode ratCode 3).pair (squareProgram radiusProgram)) + exact Procedure.ratAdd.comp ((Procedure.ratAdd.comp + ((Procedure.constant inputCode ratCode (3/4)).pair j)).pair r) + +def coefficients (x : Input) : Fin 4 → ℚ := + ![x.2.1^2,x.2.1,if x.1 then -2*x.2.1*x.2.2 else 2*x.2.1*x.2.2, + 3/4+3*x.2.2^2+3*x.2.1^2] + +noncomputable opaque coefficientProgram (k : Fin 4) : Procedure inputCode ratCode (fun x => coefficients x k) := by + by_cases h0 : k = 0 + · subst k + exact (squareProgram radiusProgram).congrFun (by intro x; rfl) + by_cases h1 : k = 1 + · subst k + exact radiusProgram.congrFun (by intro x; rfl) + by_cases h2 : k = 2 + · subst k + exact spokeProgram.congrFun (by intro x; rfl) + have h3 : k = 3 := by omega + subst k + exact offsetProgram.congrFun (by intro x; rfl) + +noncomputable opaque coefficientListProgram : Procedure inputCode (listCode ratCode) + (fun x => List.ofFn (coefficients x)) := + QuantumRawExchange.fixedListProgram inputCode ratCode 4 (fun k x => coefficients x k) coefficientProgram + +noncomputable def coefficientListCertificate : Turing.TM2ComputableInPolyTime + inputCode (listCode ratCode) (fun x => List.ofFn (coefficients x)) := coefficientListProgram.toTM2 + +theorem coefficients_spoke (x : Input) (a : Fin 2) : + (coefficients x ⟨a.val+1,by omega⟩ : ℝ) = qmaPathAmplitude x.1 (x.2.1:ℝ) (x.2.2:ℝ) a := by + rcases x with ⟨b,r,j⟩ + cases b <;> fin_cases a <;> simp [coefficients,qmaPathAmplitude] + +theorem coefficients_offset (x : Input) : + (coefficients x 3 : ℝ) = qmaPathOffset (x.2.2:ℝ)+3*(x.2.1:ℝ)^2 := by + simp [coefficients,qmaPathOffset] + +end ContinuumCoulomb.QuantumPathCode + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathRelabeling.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathRelabeling.lean new file mode 100644 index 0000000000000000000000000000000000000000..04313cb5acc896a5df0471009e604effc6a64e2f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathRelabeling.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutedSubdivision + +namespace OAI + +/-! Transport of the route invariant between different finite edge orders. +This is used when the emitted list order differs from a set's chosen order. -/ + +noncomputable section +namespace ContinuumCoulomb + +structure QMAPathRelabeling (S T : QMAPathSchedule) where + vertex : Fin S.graph.n ≃ Fin T.graph.n + edge : S.graph.Edge ≃ T.graph.Edge + left : ∀ e, vertex (S.graph.left e)=T.graph.left (edge e) + right : ∀ e, vertex (S.graph.right e)=T.graph.right (edge e) + work : ∀ e, S.work e=T.work (edge e) + +namespace QMAPathRelabeling +variable {S T : QMAPathSchedule} (E : QMAPathRelabeling S T) + +theorem inverse_left (f : T.graph.Edge) : + E.vertex.symm (T.graph.left f)=S.graph.left (E.edge.symm f) := by + have h := congrArg E.vertex.symm (E.left (E.edge.symm f)) + simpa only [Equiv.symm_apply_apply,Equiv.apply_symm_apply] using h.symm + +theorem inverse_right (f : T.graph.Edge) : + E.vertex.symm (T.graph.right f)=S.graph.right (E.edge.symm f) := by + have h := congrArg E.vertex.symm (E.right (E.edge.symm f)) + simpa only [Equiv.symm_apply_apply,Equiv.apply_symm_apply] using h.symm + +theorem inverse_work (f : T.graph.Edge) : S.work (E.edge.symm f)=T.work f := by + simpa only [Equiv.apply_symm_apply] using E.work (E.edge.symm f) + +def transport {Γ : SimpleGraph (ℕ × ℕ)} (P : QMAPathEmbedding S Γ) : QMAPathEmbedding T Γ where + position v := P.position (E.vertex.symm v) + position_injective := P.position_injective.comp E.vertex.symm.injective + point e k := P.point (E.edge.symm e) k + first e := by rw [E.inverse_left]; exact P.first _ + last e := by rw [← E.inverse_work,E.inverse_right]; exact P.last _ + simple e i j hi hj h := by + rw [← E.inverse_work] at hi hj + exact P.simple _ i j hi hj h + step e i hi := by + rw [← E.inverse_work] at hi + exact P.step _ i hi + avoids e i v hi0 hi := by + rw [← E.inverse_work] at hi + exact P.avoids _ i _ hi0 hi + disjoint e f i j hef hi0 hi hj := by + rw [← E.inverse_work] at hi hj + exact P.disjoint _ _ i j (fun h => hef (E.edge.symm.injective h)) hi0 hi hj + +theorem transport_bounded {Γ : SimpleGraph (ℕ × ℕ)} (P : QMAPathEmbedding S Γ) + {X Y : ℕ} (h : P.Bounded X Y) : (E.transport P).Bounded X Y := by + constructor + · intro v + exact h.1 (E.vertex.symm v) + · intro e k hk + rw [← E.inverse_work] at hk + exact h.2 (E.edge.symm e) k hk + +end QMAPathRelabeling +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathRelabelingIteration.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathRelabelingIteration.lean new file mode 100644 index 0000000000000000000000000000000000000000..9c3071a270d252996aeaa417ee95a28f61a0cae3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathRelabelingIteration.lean @@ -0,0 +1,93 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathRelabelingNext + +namespace OAI + +/-! Finite route relabeling preserves the actual coordinates at every +scheduled subdivision round. -/ + +noncomputable section +namespace ContinuumCoulomb.QMAPathRelabeling +open MediatorGraph +open scoped Classical +variable {S T U : QMAPathSchedule} + +def refl (S : QMAPathSchedule) : QMAPathRelabeling S S where + vertex := Equiv.refl _ + edge := Equiv.refl _ + left _ := rfl + right _ := rfl + work _ := rfl + +def trans (E : QMAPathRelabeling S T) (F : QMAPathRelabeling T U) : + QMAPathRelabeling S U where + vertex := E.vertex.trans F.vertex + edge := E.edge.trans F.edge + left e := by simp only [Equiv.trans_apply,E.left,F.left] + right e := by simp only [Equiv.trans_apply,E.right,F.right] + work e := (E.work e).trans (F.work _) + +variable (E : QMAPathRelabeling S T) +variable {Γ : SimpleGraph (ℕ × ℕ)} + (P : QMAPathEmbedding S Γ) (Q : QMAPathEmbedding T Γ) + (hpos : ∀ v, Q.position (E.vertex v)=P.position v) + (hpoint : ∀ e k, Q.point (E.edge e) k=P.point e k) + +include hpos hpoint in +theorem next_position (N : ℚ) (v : Fin (S.next N).graph.n) : + (Q.next N).position ((E.next N).vertex v)=(P.next N).position v := by + obtain ⟨v,rfl⟩ := (vertexEquiv S.graph.n S.active.card).surjective v + rcases v with v | ⟨i,a⟩ + · change Q.nextPosition (E.nextVertex (old _ _ v))=P.nextPosition (old _ _ v) + rw [E.nextVertex_old,QMAPathEmbedding.nextPosition_old, + QMAPathEmbedding.nextPosition_old] + exact hpos v + · change Q.nextPosition (E.nextVertex (fresh _ _ i a))=P.nextPosition (fresh _ _ i a) + rw [E.nextVertex_fresh,QMAPathEmbedding.nextPosition_fresh, + QMAPathEmbedding.nextPosition_fresh] + change Q.point (qmaSelectedIndex T.active (E.activeIndex i)) (a.val+1)= + P.point (qmaSelectedIndex S.active i) (a.val+1) + rw [← E.selected_index] + exact hpoint _ _ + +include hpoint in +theorem next_point (N : ℚ) (e : (S.next N).graph.Edge) (k : ℕ) : + (Q.next N).point ((E.next N).edge e) k=(P.next N).point e k := by + rcases e with e | (i | ⟨i,a⟩) + · exact hpoint e.val k + · change Q.point (qmaSelectedIndex T.active (E.activeIndex i)) (k+1)= + P.point (qmaSelectedIndex S.active i) (k+1) + rw [← E.selected_index] + exact hpoint _ _ + · change Q.point (qmaSelectedIndex T.active (E.activeIndex i)) + (if a=0 then k else 2*T.work (qmaSelectedIndex T.active (E.activeIndex i))+1-k)= + P.point (qmaSelectedIndex S.active i) + (if a=0 then k else 2*S.work (qmaSelectedIndex S.active i)+1-k) + rw [← E.selected_index,← E.work] + exact hpoint _ _ + +def iterate (N : ℚ) : (k : ℕ) → QMAPathRelabeling (S.iterate N k) (T.iterate N k) + | 0 => E + | k+1 => (iterate N k).next N + +include hpoint in +theorem iterate_point (N : ℚ) (k : ℕ) : + ∀ e j, (Q.iterate N k).point ((E.iterate N k).edge e) j=(P.iterate N k).point e j := by + induction k with + | zero => exact hpoint + | succ k ih => exact (E.iterate N k).next_point (P.iterate N k) (Q.iterate N k) ih N + +include hpos hpoint in +theorem iterate_position (N : ℚ) (k : ℕ) : + ∀ v, (Q.iterate N k).position ((E.iterate N k).vertex v)=(P.iterate N k).position v := by + induction k with + | zero => exact hpos + | succ k ih => + exact (E.iterate N k).next_position (P.iterate N k) (Q.iterate N k) ih + (E.iterate_point P Q hpoint N k) N + + +end ContinuumCoulomb.QMAPathRelabeling + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathRelabelingNext.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathRelabelingNext.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d4ce1f7a1bf2f97fa18485386517095815d6820 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathRelabelingNext.lean @@ -0,0 +1,83 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathRelabelingProperties + +namespace OAI + +/-! Relabeling commutes with a scheduled subdivision. This identifies the +literal list order with the physical port graph through every round. -/ + +noncomputable section +namespace ContinuumCoulomb.QMAPathRelabeling +open MediatorGraph +open scoped Classical +variable {S T : QMAPathSchedule} (E : QMAPathRelabeling S T) + +def activeEquiv : {e // e ∈ S.active} ≃ {e // e ∈ T.active} := + Equiv.subtypeEquiv E.edge (by intro e; simp only [QMAPathSchedule.mem_active,E.work]) +def retainedEquiv : {e // e ∉ S.active} ≃ {e // e ∉ T.active} := + Equiv.subtypeEquiv E.edge (by intro e; simp only [QMAPathSchedule.mem_active,E.work]) +def activeIndex : Fin S.active.card ≃ Fin T.active.card := + (S.active.equivFin.symm.trans E.activeEquiv).trans T.active.equivFin + +theorem selected_index (i : Fin S.active.card) : + E.edge (qmaSelectedIndex S.active i)=qmaSelectedIndex T.active (E.activeIndex i) := by + simp only [activeIndex,qmaSelectedIndex,Equiv.trans_apply,Equiv.symm_apply_apply] + rfl + +def nextVertex : Fin (S.graph.n+S.active.card*2) ≃ Fin (T.graph.n+T.active.card*2) := + ((vertexEquiv _ _).symm.trans (Equiv.sumCongr E.vertex + (Equiv.prodCongr E.activeIndex (Equiv.refl (Fin 2))))).trans (vertexEquiv _ _) +def nextEdge : QMAPartialPathsEdge S.active ≃ QMAPartialPathsEdge T.active := + Equiv.sumCongr E.retainedEquiv + (Equiv.sumCongr E.activeIndex (Equiv.prodCongr E.activeIndex (Equiv.refl (Fin 2)))) + +theorem nextVertex_old (v : Fin S.graph.n) : + E.nextVertex (old _ _ v)=old _ _ (E.vertex v) := by simp [nextVertex,old] +theorem nextVertex_fresh (i : Fin S.active.card) (a : Fin 2) : + E.nextVertex (fresh _ _ i a)=fresh _ _ (E.activeIndex i) a := by + simp [nextVertex,fresh] + +theorem next_left (N : ℚ) (e : (S.next N).graph.Edge) : + E.nextVertex ((S.next N).graph.left e)=(T.next N).graph.left (E.nextEdge e) := by + rcases e with e | (i | ⟨i,a⟩) + · change E.nextVertex (old _ _ (S.graph.left e.val))=old _ _ (T.graph.left (E.edge e.val)) + rw [E.nextVertex_old,E.left] + · exact E.nextVertex_fresh i 0 + · fin_cases a + · change E.nextVertex (old _ _ (S.graph.left (qmaSelectedIndex S.active i)))= + old _ _ (T.graph.left (qmaSelectedIndex T.active (E.activeIndex i))) + rw [E.nextVertex_old,E.left,E.selected_index] + · change E.nextVertex (old _ _ (S.graph.right (qmaSelectedIndex S.active i)))= + old _ _ (T.graph.right (qmaSelectedIndex T.active (E.activeIndex i))) + rw [E.nextVertex_old,E.right,E.selected_index] + +theorem next_right (N : ℚ) (e : (S.next N).graph.Edge) : + E.nextVertex ((S.next N).graph.right e)=(T.next N).graph.right (E.nextEdge e) := by + rcases e with e | (i | ⟨i,a⟩) + · change E.nextVertex (old _ _ (S.graph.right e.val))=old _ _ (T.graph.right (E.edge e.val)) + rw [E.nextVertex_old,E.right] + · exact E.nextVertex_fresh i 1 + · fin_cases a + · exact E.nextVertex_fresh i 0 + · exact E.nextVertex_fresh i 1 + +theorem next_work (N : ℚ) (e : (S.next N).graph.Edge) : + (S.next N).work e=(T.next N).work (E.nextEdge e) := by + rcases e with e | (i | ⟨i,a⟩) + · rfl + · rfl + · change (if a=1 then S.work (qmaSelectedIndex S.active i)-1 else 0)= + (if a=1 then T.work (qmaSelectedIndex T.active (E.activeIndex i))-1 else 0) + rw [E.work,E.selected_index] + +def next (N : ℚ) : QMAPathRelabeling (S.next N) (T.next N) where + vertex := E.nextVertex + edge := E.nextEdge + left := E.next_left N + right := E.next_right N + work := E.next_work N + +end ContinuumCoulomb.QMAPathRelabeling + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathRelabelingProperties.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathRelabelingProperties.lean new file mode 100644 index 0000000000000000000000000000000000000000..6696f0664fb5ce0d5da8406ec25dbdc8722e839d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathRelabelingProperties.lean @@ -0,0 +1,36 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathRelabeling + +namespace OAI + +/-! Degree and inverse transport for finite relabelings of scheduled graphs. -/ + +noncomputable section +namespace ContinuumCoulomb.QMAPathRelabeling +open scoped BigOperators Classical + +variable {S T : QMAPathSchedule} (E : QMAPathRelabeling S T) + +def symm : QMAPathRelabeling T S where + vertex := E.vertex.symm + edge := E.edge.symm + left := E.inverse_left + right := E.inverse_right + work f := (E.inverse_work f).symm + +theorem degree (v : Fin S.graph.n) : + qmaGraphDegree T.graph.left T.graph.right (E.vertex v) = + qmaGraphDegree S.graph.left S.graph.right v := by + unfold qmaGraphDegree + have h := E.edge.sum_comp (fun f => + if T.graph.left f=E.vertex v ∨ T.graph.right f=E.vertex v then (1 : ℕ) else 0) + rw [← h] + apply Finset.sum_congr rfl + intro e _ + rw [← E.left,← E.right] + simp only [Equiv.apply_eq_iff_eq] + +end ContinuumCoulomb.QMAPathRelabeling + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathScaleProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathScaleProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..7242d03f297982c52dc893e7a33d67cbdbf08aeb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathScaleProgram.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRationalPathStep +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.RationalSumProgram + +namespace OAI + +/-! Exact rational calibration from the retained and selected edge weights. +The sums are computed by the proved polynomial rational-list accumulator. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPathScaleProgram +open ExactQuantumFactoring.BitStackProgram +open scoped BigOperators Classical + +abbrev Input := (ℚ × ℚ) × (List ℚ × List ℚ) +def inputCode : Input → List Bool := + prodCode (prodCode ratCode ratCode) (prodCode (listCode ratCode) (listCode ratCode)) + +def linearCost (w : ℚ) : ℚ := 1+2*|w| +def squareCost (w : ℚ) : ℚ := (1+|w|)^2 +def base (x : Input) : ℚ := 3*(x.2.1.map abs).sum+|x.1.2| +def active (x : Input) : ℚ := 3*(x.2.2.map linearCost).sum +def correction (x : Input) : ℚ := base x+4*(x.2.2.map squareCost).sum +def value (x : Input) : ℚ := + 16*(active x+correction x+1)^3*x.1.1+4*(active x+correction x+1)+1 + +noncomputable def linearProgram : Procedure ratCode ratCode linearCost := + Procedure.ratAdd.comp ((Procedure.constant ratCode ratCode 1).pair + (Procedure.ratMul.comp ((Procedure.constant ratCode ratCode 2).pair + MediatorProgram.absoluteProgram))) + +noncomputable def squareProgram : Procedure ratCode ratCode squareCost := + QuantumRoutingCode.squareProgram (Procedure.ratAdd.comp + ((Procedure.constant ratCode ratCode 1).pair MediatorProgram.absoluteProgram)) + +noncomputable def sumMapProgram {f : ℚ → ℚ} (p : Procedure ratCode ratCode f) : + Procedure (listCode ratCode) ratCode (fun xs => (xs.map f).sum) := + RationalSumProgram.sumProgram.comp (Procedure.listMap 0 0 p) + +noncomputable def program : Procedure inputCode ratCode value := by + let params := Procedure.first (prodCode ratCode ratCode) + (prodCode (listCode ratCode) (listCode ratCode)) + let lists := Procedure.second (prodCode ratCode ratCode) + (prodCode (listCode ratCode) (listCode ratCode)) + let n := (Procedure.first ratCode ratCode).comp params + let c := (Procedure.second ratCode ratCode).comp params + let retained := (Procedure.first (listCode ratCode) (listCode ratCode)).comp lists + let selected := (Procedure.second (listCode ratCode) (listCode ratCode)).comp lists + let b := Procedure.ratAdd.comp + ((Procedure.ratMul.comp ((Procedure.constant inputCode ratCode 3).pair + ((sumMapProgram MediatorProgram.absoluteProgram).comp retained))).pair + (MediatorProgram.absoluteProgram.comp c)) + let a := Procedure.ratMul.comp ((Procedure.constant inputCode ratCode 3).pair + ((sumMapProgram linearProgram).comp selected)) + let d := Procedure.ratAdd.comp (b.pair + (Procedure.ratMul.comp ((Procedure.constant inputCode ratCode 4).pair + ((sumMapProgram squareProgram).comp selected)))) + exact QuantumRoutingCode.scaleProgram.comp (a.pair (d.pair n)) + +def actualInput (G : QMARationalExchangeGraph) (s : Finset G.Edge) (N : ℚ) {r : ℕ} + (retained : {e // e ∉ s} ≃ Fin r) : Input := + ((N,G.constant),(List.ofFn (fun i => G.weight (retained.symm i).val), + List.ofFn (fun i => G.weight (qmaSelectedIndex s i)))) + +theorem value_actual (G : QMARationalExchangeGraph) (s : Finset G.Edge) (N : ℚ) {r : ℕ} + (retained : {e // e ∉ s} ≃ Fin r) : + value (actualInput G s N retained) = G.pathScale s N := by + simp only [value,base,active,correction,actualInput,List.map_ofFn,List.sum_ofFn, + Function.comp_apply,linearCost,squareCost,QMARationalExchangeGraph.pathScale] + rw [retained.symm.sum_comp (fun e => |G.weight e.val|)] + +end ContinuumCoulomb.QuantumPathScaleProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathSchedule.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathSchedule.lean new file mode 100644 index 0000000000000000000000000000000000000000..d60e93bf7cd27ce9e8b4d0ad754ff2e50f997d41 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathSchedule.lean @@ -0,0 +1,124 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRationalPathStep + +namespace OAI + +/-! A bounded number of selected odd subdivisions realizes independently prescribed +path lengths. Only edges with remaining work receive a new mediator pair. -/ + +noncomputable section +namespace ContinuumCoulomb +open MediatorGraph +open scoped BigOperators Classical + +structure QMAPathSchedule where + graph : QMARationalExchangeGraph + work : graph.Edge → ℕ + +namespace QMAPathSchedule + +def active (W : QMAPathSchedule) : Finset W.graph.Edge := + Finset.univ.filter (fun e => 0 < W.work e) + +@[simp] theorem mem_active (W : QMAPathSchedule) (e : W.graph.Edge) : + e ∈ W.active ↔ 0 < W.work e := by simp [active] + +def nextWork (W : QMAPathSchedule) : QMAPartialPathsEdge W.active → ℕ + | .inl _ => 0 + | .inr (.inl _) => 0 + | .inr (.inr (i,a)) => if a = 1 then W.work (qmaSelectedIndex W.active i)-1 else 0 + +def next (W : QMAPathSchedule) (N : ℚ) : QMAPathSchedule where + graph := W.graph.subdivide W.active (fun _ => false) N + work := W.nextWork + +theorem next_work_le (W : QMAPathSchedule) (N : ℚ) {D : ℕ} + (hD : ∀ e, W.work e ≤ D) : ∀ e, (W.next N).work e ≤ D-1 := by + intro e + rcases e with e | e + · exact Nat.zero_le _ + rcases e with e | ⟨i,a⟩ + · exact Nat.zero_le _ + change (if a = 1 then W.work (qmaSelectedIndex W.active i)-1 else 0) ≤ D-1 + split + · exact Nat.sub_le_sub_right (hD _) 1 + · exact Nat.zero_le _ + +theorem next_degree (W : QMAPathSchedule) (N : ℚ) {d : ℕ} (h3 : 3 ≤ d) + (hd : ∀ v, qmaGraphDegree W.graph.left W.graph.right v ≤ d) : + ∀ v, qmaGraphDegree (W.next N).graph.left (W.next N).graph.right v ≤ d := by + intro v + obtain ⟨v,rfl⟩ := (vertexEquiv W.graph.n W.active.card).surjective v + rcases v with v | ⟨e,b⟩ + · change qmaGraphDegree (qmaPartialPathsLeft W.graph.left W.graph.right W.active) + (qmaPartialPathsRight W.graph.right W.active (fun _ => false)) (old _ _ v) ≤ d + rw [qmaPartialPaths_old_degree _ _ W.graph.distinct] + exact hd v + · change qmaGraphDegree (qmaPartialPathsLeft W.graph.left W.graph.right W.active) + (qmaPartialPathsRight W.graph.right W.active (fun _ => false)) (fresh _ _ e b) ≤ d + exact (qmaPartialPaths_fresh_degree _ _ _ _ e b).trans h3 + +def iterate (W : QMAPathSchedule) (N : ℚ) : ℕ → QMAPathSchedule + | 0 => W + | k+1 => (W.iterate N k).next N + +theorem iterate_work_le (W : QMAPathSchedule) (N : ℚ) {D : ℕ} + (hD : ∀ e, W.work e ≤ D) (k : ℕ) : ∀ e, (W.iterate N k).work e ≤ D-k := by + induction k with + | zero => exact hD + | succ k ih => + change ∀ e, ((W.iterate N k).next N).work e ≤ D-(k+1) + intro e + have h := (W.iterate N k).next_work_le N ih e + simpa only [Nat.sub_sub,Nat.add_comm 1 k] using h + +theorem iterate_complete (W : QMAPathSchedule) (N : ℚ) {D : ℕ} + (hD : ∀ e, W.work e ≤ D) : ∀ e, (W.iterate N D).work e = 0 := by + intro e + have h := W.iterate_work_le N hD D e + omega + +theorem iterate_degree (W : QMAPathSchedule) (N : ℚ) {d : ℕ} (h3 : 3 ≤ d) + (hd : ∀ v, qmaGraphDegree W.graph.left W.graph.right v ≤ d) (k : ℕ) : + ∀ v, qmaGraphDegree (W.iterate N k).graph.left (W.iterate N k).graph.right v ≤ d := by + induction k with + | zero => exact hd + | succ k ih => exact (W.iterate N k).next_degree N h3 ih + +theorem iterate_energy_error (W : QMAPathSchedule) {N : ℚ} (hN : 0 < N) (k : ℕ) : + |(W.iterate N k).graph.energy-W.graph.energy| ≤ (k:ℝ)/(N:ℝ) := by + induction k with + | zero => simp [iterate] + | succ k ih => + have h := (W.iterate N k).graph.subdivide_energy_error (W.iterate N k).active + (fun _ => false) hN + change |((W.iterate N k).next N).graph.energy-W.graph.energy| ≤ _ + calc + _ ≤ |((W.iterate N k).next N).graph.energy-(W.iterate N k).graph.energy| + + |(W.iterate N k).graph.energy-W.graph.energy| := abs_sub_le _ _ _ + _ ≤ 1/(N:ℝ)+(k:ℝ)/(N:ℝ) := add_le_add h ih + _ = ((k+1:ℕ):ℝ)/(N:ℝ) := by push_cast; ring + +theorem next_edge_count (W : QMAPathSchedule) (N : ℚ) : + Fintype.card (W.next N).graph.Edge ≤ 3*Fintype.card W.graph.Edge := by + change Fintype.card (W.graph.subdivide W.active (fun _ => false) N).Edge ≤ _ + rw [QMARationalExchangeGraph.subdivide_edge_count] + have h := Finset.card_le_univ W.active + omega + +theorem iterate_edge_count (W : QMAPathSchedule) (N : ℚ) (k : ℕ) : + Fintype.card (W.iterate N k).graph.Edge ≤ 3^k*Fintype.card W.graph.Edge := by + induction k with + | zero => + change Fintype.card W.graph.Edge ≤ 3^0*Fintype.card W.graph.Edge + simp only [pow_zero,one_mul,le_refl] + | succ k ih => + change Fintype.card ((W.iterate N k).next N).graph.Edge ≤ _ + exact ((W.iterate N k).next_edge_count N).trans (by simpa [pow_succ,mul_assoc,mul_comm, + mul_left_comm] using (Nat.mul_le_mul_left 3 ih)) + +end QMAPathSchedule +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathScheduleSize.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathScheduleSize.lean new file mode 100644 index 0000000000000000000000000000000000000000..71ec3199ac4e57d7c524f86347cc03fc9d3fd368 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathScheduleSize.lean @@ -0,0 +1,35 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathSchedule + +namespace OAI + +/-! Fixed-round routed subdivisions retain linear graph size. -/ + +noncomputable section +namespace ContinuumCoulomb.QMAPathSchedule + + theorem next_size (W : QMAPathSchedule) (N : ℚ) : + (W.next N).graph.n + Fintype.card (W.next N).graph.Edge ≤ + 5*(W.graph.n+Fintype.card W.graph.Edge) := by + change W.graph.n+W.active.card*2+ + Fintype.card (W.graph.subdivide W.active (fun _ => false) N).Edge ≤ _ + rw [QMARationalExchangeGraph.subdivide_edge_count] + have h := Finset.card_le_univ W.active + omega + +theorem iterate_size (W : QMAPathSchedule) (N : ℚ) (k : ℕ) : + (W.iterate N k).graph.n + Fintype.card (W.iterate N k).graph.Edge ≤ + 5^k*(W.graph.n+Fintype.card W.graph.Edge) := by + induction k with + | zero => + change W.graph.n+Fintype.card W.graph.Edge ≤ 5^0*(W.graph.n+Fintype.card W.graph.Edge) + simp + | succ k ih => + change ((W.iterate N k).next N).graph.n + Fintype.card ((W.iterate N k).next N).graph.Edge ≤ _ + exact ((W.iterate N k).next_size N).trans (by simpa [pow_succ,mul_assoc,mul_comm, + mul_left_comm] using (Nat.mul_le_mul_left 5 ih)) + +end ContinuumCoulomb.QMAPathSchedule + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathSpectrum.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathSpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..32ab9b9d719315a416afb9c4e0ca11043dd5ad5a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathSpectrum.lean @@ -0,0 +1,36 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathSubdivision + +namespace OAI + +/-! The even and odd rational subdivision gadgets on the full spin space. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker + +theorem qmaPathSubdivision_bottom {n r : ℕ} (e : Fin r) (site : Fin 2 → Fin n) + (hsite : Function.Injective site) (even : Bool) (R J : ℝ) (hR : 0 < R) + (C : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) (hC : C.conjTranspose = C) + {epsilon : ℝ} (hepsilon : 0 ≤ epsilon) (hsmall : epsilon ≤ 1/4) + (hbound : ‖spinMatrixOperator ((C + qmaPathCorrection (n := n) R J) ⊗ₖ + (1 : Matrix (MediatorBasis r) (MediatorBasis r) ℂ))‖ + + 3*∑ a, |qmaPathAmplitude even R J a| ≤ epsilon*(4*R^2)) : + |mediatorFullBottom n r (routingHamiltonian n r (R^2) + (C + qmaPathCorrection (n := n) R J) + (qmaSingletStar n r e site (qmaPathMember even) (qmaPathAmplitude even R J))) - + sourceMatrixBottom n (C + (J:ℂ) • sourceHeisenbergMatrix n (site 0) (site 1))| ≤ + 16*R^2*epsilon^3 := by + have hCC : (C + qmaPathCorrection (n := n) R J).conjTranspose = C + qmaPathCorrection (n := n) R J := by + simp only [qmaPathCorrection,Matrix.conjTranspose_add,Matrix.conjTranspose_smul, + Matrix.conjTranspose_one,hC,Complex.star_def,Complex.conj_ofReal] + have h := qmaSingletStar_bottom n r (sq_pos_of_pos hR) _ hCC e site + (qmaPathMember even) (qmaPathAmplitude even R J) hepsilon hsmall hbound + rw [add_sub_assoc,qmaPathSubdivision_effective e site hsite even R J hR.ne'] at h + exact h + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathSubdivision.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathSubdivision.lean new file mode 100644 index 0000000000000000000000000000000000000000..936850a7ec91cf33c8ea1935dccfbeb1f19b3192 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathSubdivision.lean @@ -0,0 +1,47 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSingletStarSpectrum + +namespace OAI + +/-! Rational two-edge and three-edge exchange subdivision, including the +pendant singlet partner needed by an even-length lattice path. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +def qmaPathMember (even : Bool) : Fin 2 → Fin 2 := if even then ![0,0] else ![0,1] +def qmaPathAmplitude (even : Bool) (R J : ℝ) : Fin 2 → ℝ := ![R,if even then -2*R*J else 2*R*J] +def qmaPathCorrection (_R J : ℝ) {n : ℕ} : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ := + ((3/4+3*J^2:ℝ):ℂ) • 1 + +theorem qmaPathSubdivision_effective {n r : ℕ} (e : Fin r) (site : Fin 2 → Fin n) + (hsite : Function.Injective site) (even : Bool) (R J : ℝ) (hR : R ≠ 0) : + qmaPathCorrection R J - mediatorCompression n r + (qmaSingletStar n r e site (qmaPathMember even) (qmaPathAmplitude even R J) * + liftedMediatorInverse n r (R^2) * + qmaSingletStar n r e site (qmaPathMember even) (qmaPathAmplitude even R J)) = + (J:ℂ) • sourceHeisenbergMatrix n (site 0) (site 1) := by + have hk (a b : Fin 2) : qmaPauliKernel n (site a) (site b) = + if a = b then (3:ℂ) • 1 else sourceHeisenbergMatrix n (site a) (site b) := by + by_cases hab : a = b + · subst b + simp only [ite_true,qmaPauliKernel_self] + · rw [ite_eq_right hab] + exact qmaPauliKernel_eq n _ _ (fun h => hab (hsite h)) + rw [qmaSingletStar_compression] + simp only [hk,qmaPathCorrection] + cases even <;> + simp [qmaPathMember,qmaPathAmplitude,Fin.sum_univ_succ] <;> + rw [qmaHeisenberg_symm n (site 1) (site 0)] <;> + ext s t <;> + simp only [Matrix.add_apply,Matrix.sub_apply,Matrix.neg_apply,Matrix.smul_apply, + smul_eq_mul,RCLike.real_smul_eq_coe_smul (K := ℂ),RCLike.ofReal_eq_complex_ofReal] <;> + have hRC : (R:ℂ) ≠ 0 := by exact_mod_cast hR + all_goals field_simp [hRC]; ring + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathTable.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathTable.lean new file mode 100644 index 0000000000000000000000000000000000000000..7a83cb8e4799aaa6bccf3cdba018ae788446d330 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathTable.lean @@ -0,0 +1,90 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathVisitCorrectness + +namespace OAI + +/-! The finite lists of actual routes produce a routing table with exactly +the permissions of the physical graph proof. Lists may use any complete edge +order; this does not change a routing decision. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical +open ExactQuantumFactoring.BitStackProgram QuantumRouteCode QuantumRoutingTable QuantumPathVisitProgram +namespace QMAPortRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + +def listedVisits (es : List G.Edge) : List Visit := + es.flatMap (fun e => visits (P.routeList e)) + + theorem listedVisits_mem (es : List G.Edge) (hcover : ∀ e, e ∈ es) (v : Visit) : + v ∈ P.listedVisits es ↔ v ∈ P.routingTable.2.1 := by + change v ∈ P.listedVisits es ↔ v ∈ P.routingVisits + simp only [listedVisits,List.mem_flatMap,P.routeList_visits_general,routingVisits, + Finset.mem_toList,Finset.mem_univ,true_and] + constructor + · rintro ⟨e,_,j,hj⟩ + exact ⟨⟨e,j⟩,hj⟩ + · rintro ⟨i,hi⟩ + exact ⟨i.1,hcover i.1,i.2,hi⟩ + +end QMAPortRouteData +namespace QuantumPathTable + +abbrev Input := List Pair × List (List Pair) +def inputCode : Input → List Bool := + prodCode (listCode pairCode) (listCode (listCode pairCode)) + +def inputVisits (x : Input) : List Visit := (x.2.map visits).flatten + +def beforeCrossings (x : Input) : Table := (x.1,inputVisits x,[]) + +def compile (x : Input) : Table := computedTable (beforeCrossings x) + +noncomputable def compileProgram : Procedure inputCode tableCode compile := by + let sources := Procedure.first (listCode pairCode) (listCode (listCode pairCode)) + let paths := Procedure.second (listCode pairCode) (listCode (listCode pairCode)) + let vs := (QuantumRawExchange.flattenProgram visitCode ((0,0),(0,0))).comp + ((Procedure.listMap [] [] visitsProgram).comp paths) + let base := sources.pair (vs.pair (Procedure.constant inputCode (listCode pairCode) [])) + exact computedTableProgram.comp base + + theorem beforeCrossings_visits {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + (es : List G.Edge) (hcover : ∀ e, e ∈ es) (v : Visit) : + v ∈ (beforeCrossings (List.ofFn P.position,es.map P.routeList)).2.1 ↔ + v ∈ P.routingTable.2.1 := by + change v ∈ ((es.map P.routeList).map visits).flatten ↔ _ + rw [List.map_map] + exact P.listedVisits_mem es hcover v + + theorem compile_crossings {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + (es : List G.Edge) (hcover : ∀ e, e ∈ es) (p : Pair) : + p ∈ (compile (List.ofFn P.position,es.map P.routeList)).2.2 ↔ P.IsCrossing p := by + change p ∈ computedCrossings (beforeCrossings (List.ofFn P.position,es.map P.routeList)) ↔ _ + rw [mem_computedCrossings] + simp only [crossingTest,Bool.and_eq_true,decide_eq_true_eq, + beforeCrossings_visits P es hcover] + exact (P.crossing_iff_opposite_visits p).symm + + theorem compile_allowed {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + (es : List G.Edge) (hcover : ∀ e, e ∈ es) (R : QMACellRouteBody) : + allowed (compile (List.ofFn P.position,es.map P.routeList)) R = allowed P.routingTable R := by + let x := (List.ofFn P.position,es.map P.routeList) + have hc (p : Pair) : decide (p ∈ (compile x).2.2) = decide (p ∈ P.routingTable.2.2) := by + apply Bool.eq_iff_iff.mpr + simp only [decide_eq_true_eq,compile_crossings P es hcover,P.routingTable_crossing,x] + have hv (v : Visit) : decide (v ∈ (compile x).2.1) = decide (v ∈ P.routingTable.2.1) := by + apply Bool.eq_iff_iff.mpr + have hh := beforeCrossings_visits P es hcover v + constructor + · intro h; exact decide_eq_true (hh.mp (of_decide_eq_true h)) + · intro h; exact decide_eq_true (hh.mpr (of_decide_eq_true h)) + have hs (p : Pair) : decide (p ∈ (compile x).1) = decide (p ∈ P.routingTable.1) := rfl + change allowed (compile x) R = _ + cases R <;> simp only [allowed,hc,hv,hs] + +end QuantumPathTable +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathVisitCorrectness.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathVisitCorrectness.lean new file mode 100644 index 0000000000000000000000000000000000000000..d98f91103df40ac41c7956f1f806f573ccdded5c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathVisitCorrectness.lean @@ -0,0 +1,90 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathVisitProgram + +namespace OAI + +/-! The encoded consecutive-point rule recovers the actual directional ports +of every interior visit in the proved port-route geometry. -/ + +noncomputable section +namespace ContinuumCoulomb +open QuantumRouteCode QuantumRoutingTable QuantumPathVisitProgram + +namespace QuantumPathVisitProgram + theorem lookup_range (f : ℕ → Pair) (n i : ℕ) (hi : i < n) : + lookup ((List.range n).map f) i = f i := by + simp only [lookup,List.headD_eq_head?_getD,List.head?_drop,List.getElem?_map, + List.getElem?_range hi,Option.map_some,Option.getD_some] + + theorem both_member (p c : Pair) (a b u v : Fin 4) : + (p,(a.val,b.val)) ∈ both (c,(u.val,v.val)) ↔ c=p ∧ s(u,v)=s(a,b) := by + simp only [both,List.mem_cons,List.not_mem_nil,or_false,Prod.mk.injEq, + Prod.swap_prod_mk,Sym2.eq_iff] + constructor + · rintro (⟨hc,ha,hb⟩ | ⟨hc,ha,hb⟩) + · exact ⟨hc.symm,Or.inl ⟨(Fin.ext ha).symm,(Fin.ext hb).symm⟩⟩ + · exact ⟨hc.symm,Or.inr ⟨(Fin.ext hb).symm,(Fin.ext ha).symm⟩⟩ + · rintro ⟨hc,⟨ha,hb⟩ | ⟨ha,hb⟩⟩ + · exact Or.inl ⟨hc.symm,congrArg Fin.val ha.symm,congrArg Fin.val hb.symm⟩ + · exact Or.inr ⟨hc.symm,congrArg Fin.val hb.symm,congrArg Fin.val ha.symm⟩ +end QuantumPathVisitProgram + +namespace QMAPortRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + +def routeList (e : G.Edge) : List Pair := + (List.range (P.length e+1)).map (P.point e) + + theorem routeList_lookup (e : G.Edge) (i : ℕ) (hi : i ≤ P.length e) : + lookup (P.routeList e) i = P.point e i := + QuantumPathVisitProgram.lookup_range _ _ _ (by omega) + + theorem routeList_visit (e : G.Edge) (j : Fin (P.length e-1)) : + visit (P.routeList e) j.val = + (P.cell ⟨e,j⟩,((P.port ⟨e,j⟩ 0).val,(P.port ⟨e,j⟩ 1).val)) := by + have hj := j.isLt + simp only [visit,P.routeList_lookup e j.val (by omega), + P.routeList_lookup e (j.val+1) (by omega),P.routeList_lookup e (j.val+2) (by omega), + cell,port,arm,armIndex,Fin.val_zero,Fin.val_one,mul_zero,mul_one,Nat.add_zero] + + theorem routeList_visits (e : G.Edge) (p : Pair) (a b : Fin 4) : + (p,(a.val,b.val)) ∈ visits (P.routeList e) ↔ + ∃ j : Fin (P.length e-1), P.cell ⟨e,j⟩ = p ∧ + s(P.port ⟨e,j⟩ 0,P.port ⟨e,j⟩ 1) = s(a,b) := by + have hlen : (P.routeList e).length-2 = P.length e-1 := by + simp only [routeList,List.length_map,List.length_range] + omega + rw [visits,← List.flatMap_def,hlen,List.mem_flatMap] + constructor + · rintro ⟨j,hj,hv⟩ + have hj' : j < P.length e-1 := List.mem_range.mp hj + rw [P.routeList_visit e ⟨j,hj'⟩] at hv + exact ⟨⟨j,hj'⟩,(QuantumPathVisitProgram.both_member _ _ _ _ _ _).mp hv⟩ + · rintro ⟨j,hj⟩ + refine ⟨j.val,List.mem_range.mpr j.isLt,?_⟩ + rw [P.routeList_visit e j] + exact (QuantumPathVisitProgram.both_member _ _ _ _ _ _).mpr hj + + theorem routeList_visits_general (e : G.Edge) (v : Visit) : + v ∈ visits (P.routeList e) ↔ + ∃ j : Fin (P.length e-1), + v ∈ both (P.cell ⟨e,j⟩,((P.port ⟨e,j⟩ 0).val,(P.port ⟨e,j⟩ 1).val)) := by + have hlen : (P.routeList e).length-2 = P.length e-1 := by + simp only [routeList,List.length_map,List.length_range] + omega + rw [visits,← List.flatMap_def,hlen,List.mem_flatMap] + constructor + · rintro ⟨j,hj,hv⟩ + have hj' : j < P.length e-1 := List.mem_range.mp hj + rw [P.routeList_visit e ⟨j,hj'⟩] at hv + exact ⟨⟨j,hj'⟩,hv⟩ + · rintro ⟨j,hj⟩ + refine ⟨j.val,List.mem_range.mpr j.isLt,?_⟩ + rw [P.routeList_visit e j] + exact hj + +end QMAPortRouteData +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathVisitProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathVisitProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..f23dbe83e98aca267f4d1b345c496fdd6d0864d3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathVisitProgram.lean @@ -0,0 +1,85 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumComputedRoutingTable +import OAI.Computability.QuantumFactoring.BitStackListIndex + +namespace OAI + +/-! Encoded path lists determine the two directional ports of every internal +cell. The output contains both orientations, as required by the route table. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPathVisitProgram +open ExactQuantumFactoring.BitStackProgram QuantumRouteCode QuantumRoutingTable + +def lookup (xs : List Pair) (i : ℕ) : Pair := (xs.drop i).headD (0,0) + +def visit (xs : List Pair) (i : ℕ) : Visit := + let p := lookup xs (i+1) + (p,((qmaGridNeighborIndex p (lookup xs i)).val, + (qmaGridNeighborIndex p (lookup xs (i+2))).val)) + +def both (v : Visit) : List Visit := [v,(v.1,v.2.swap)] + +def visits (xs : List Pair) : List Visit := + ((List.range (xs.length-2)).map (fun i => both (visit xs i))).flatten + +noncomputable def neighborIndexProgram : + Procedure (prodCode pairCode pairCode) Nat.bits + (fun x => (qmaGridNeighborIndex x.1 x.2).val) := by + let p := Procedure.first pairCode pairCode + let q := Procedure.second pairCode pairCode + let px := (Procedure.first Nat.bits Nat.bits).comp p + let py := (Procedure.second Nat.bits Nat.bits).comp p + let qx := (Procedure.first Nat.bits Nat.bits).comp q + let qy := (Procedure.second Nat.bits Nat.bits).comp q + let plus (v : Procedure (prodCode pairCode pairCode) Nat.bits (fun x => x.1.1)) := + Procedure.binaryAdd.comp (v.pair (Procedure.constant _ Nat.bits 1)) + let px1 := plus px + let py1 := Procedure.binaryAdd.comp (py.pair (Procedure.constant _ Nat.bits 1)) + let qx1 := Procedure.binaryAdd.comp (qx.pair (Procedure.constant _ Nat.bits 1)) + exact (Procedure.conditional (Procedure.binaryEq.comp (qx.pair px1)) + (Procedure.constant _ Nat.bits 0) + (Procedure.conditional (Procedure.binaryEq.comp (qy.pair py1)) + (Procedure.constant _ Nat.bits 1) + (Procedure.conditional (Procedure.binaryEq.comp (qx1.pair px)) + (Procedure.constant _ Nat.bits 2) (Procedure.constant _ Nat.bits 3)))).congrFun (by + intro x + simp only [Function.comp_apply,qmaGridNeighborIndex,decide_eq_true_eq] + split_ifs <;> rfl) + +abbrev Input := ℕ × List Pair +def inputCode : Input → List Bool := prodCode unaryCode (listCode pairCode) + +noncomputable def visitProgram : Procedure inputCode visitCode (fun x => visit x.2 x.1) := by + let i := Procedure.unaryToBits.comp (Procedure.first unaryCode (listCode pairCode)) + let xs := Procedure.second unaryCode (listCode pairCode) + let get (j : ℕ) := (Procedure.listGet pairCode (0,0)).comp + ((Procedure.binaryAdd.comp (i.pair (Procedure.constant inputCode Nat.bits j))).pair xs) + let center := get 1 + let left := neighborIndexProgram.comp (center.pair (get 0)) + let right := neighborIndexProgram.comp (center.pair (get 2)) + exact (center.pair (left.pair right)).congrFun (by + intro x + simp only [Function.comp_apply,id_eq,Nat.add_zero,visit,lookup]) + +noncomputable def bothProgram : Procedure visitCode (listCode visitCode) both := by + let v := Procedure.identity visitCode + let rev := (Procedure.first pairCode pairCode).pair + ((Procedure.swap Nat.bits Nat.bits).comp (Procedure.second pairCode pairCode)) + exact (Procedure.listCons visitCode).comp (v.pair + ((Procedure.listCons visitCode).comp + (rev.pair (Procedure.constant visitCode (listCode visitCode) [])))) + +noncomputable def visitsProgram : Procedure (listCode pairCode) (listCode visitCode) visits := by + let count := Procedure.unarySub.comp + ((ExactQuantumFactoring.NativeAIG.Emission.listUnaryLength pairCode (0,0)).pair + (Procedure.constant (listCode pairCode) unaryCode 2)) + let tab := (Procedure.tabulate (f := fun xs i => both (visit xs i)) [] + (bothProgram.comp visitProgram)).comp + (count.pair (Procedure.identity (listCode pairCode))) + exact (QuantumRawExchange.flattenProgram visitCode ((0,0),(0,0))).comp tab + +end ContinuumCoulomb.QuantumPathVisitProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathWeightBounds.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathWeightBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..13a29e417faa517bcc436963816c9344d788ad87 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathWeightBounds.lean @@ -0,0 +1,74 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRationalPathStep + +namespace OAI + +/-! Uniform polynomial coefficient bounds for one physical path-subdivision layer. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators Classical + +theorem qmaPathOffset_abs_le {J L : ℝ} (hL : 1 ≤ L) (hJ : |J| ≤ L) : + |qmaPathOffset J| ≤ 4*L^2 := by + have hJ2 : J^2 ≤ L^2 := by nlinarith [sq_abs J,mul_self_le_mul_self (abs_nonneg J) hJ] + have hL2 : 1 ≤ L^2 := one_le_pow₀ hL + rw [abs_of_nonneg (by unfold qmaPathOffset; positivity)] + unfold qmaPathOffset + nlinarith + +theorem qmaPathAmplitude_abs_le {R J L : ℝ} (hL : 1 ≤ L) (hR : |R| ≤ L) (hJ : |J| ≤ L) + (even : Bool) (a : Fin 2) : |qmaPathAmplitude even R J a| ≤ 2*L^2 := by + have hL0 : 0 ≤ L := by linarith + have hL2 : L ≤ L^2 := by nlinarith + have hp := mul_le_mul hR hJ (abs_nonneg J) hL0 + cases even <;> fin_cases a <;> simp [qmaPathAmplitude,abs_mul] <;> nlinarith + +namespace QMARationalExchangeGraph + +theorem subdivide_weight_abs_le (G : QMARationalExchangeGraph) (s : Finset G.Edge) + (even : Fin s.card → Bool) (N : ℚ) {L : ℝ} (hL : 1 ≤ L) + (hR : |(G.pathScale s N:ℝ)| ≤ L) (hw : ∀ e, |(G.weight e:ℝ)| ≤ L) + (e : (G.subdivide s even N).Edge) : |((G.subdivide s even N).weight e:ℝ)| ≤ 2*L^2 := by + have hL0 : 0 ≤ L := by linarith + have hL2 : L ≤ L^2 := by nlinarith + rcases e with e | (i | ⟨i,a⟩) + · exact (hw e.val).trans (by nlinarith) + · change |(((G.pathScale s N)^2:ℚ):ℝ)| ≤ _ + push_cast + rw [abs_of_nonneg (sq_nonneg _)] + nlinarith [sq_abs (G.pathScale s N:ℝ),mul_self_le_mul_self (abs_nonneg _) hR] + · change |(QuantumPathCode.coefficients (even i,G.pathScale s N,G.weight (qmaSelectedIndex s i)) + ⟨a.val+1,by omega⟩:ℝ)| ≤ _ + rw [QuantumPathCode.coefficients_spoke] + exact qmaPathAmplitude_abs_le hL hR (hw _) _ _ + +theorem subdivide_constant_abs_le (G : QMARationalExchangeGraph) (s : Finset G.Edge) + (even : Fin s.card → Bool) (N : ℚ) {L : ℝ} (hL : 1 ≤ L) + (hR : |(G.pathScale s N:ℝ)| ≤ L) (hw : ∀ e, |(G.weight e:ℝ)| ≤ L) : + |((G.subdivide s even N).constant:ℝ)| ≤ |(G.constant:ℝ)|+7*(s.card:ℝ)*L^2 := by + have hL0 : 0 ≤ L := by linarith + have hR2 : (G.pathScale s N:ℝ)^2 ≤ L^2 := by + nlinarith [sq_abs (G.pathScale s N:ℝ),mul_self_le_mul_self (abs_nonneg _) hR] + have hs : |∑ i : Fin s.card, qmaPathOffset (G.weight (qmaSelectedIndex s i):ℝ)| ≤ + (s.card:ℝ)*(4*L^2) := by + refine (Finset.abs_sum_le_sum_abs _ _).trans ?_ + calc + _ ≤ ∑ _i : Fin s.card, 4*L^2 := Finset.sum_le_sum (fun i _ => qmaPathOffset_abs_le hL (hw _)) + _ = _ := by simp + have hc := abs_add_le (G.constant:ℝ) (∑ i : Fin s.card, qmaPathOffset (G.weight (qmaSelectedIndex s i):ℝ)) + have hd := abs_add_le ((G.constant:ℝ)+∑ i : Fin s.card, qmaPathOffset (G.weight (qmaSelectedIndex s i):ℝ)) + (3*(s.card:ℝ)*(G.pathScale s N:ℝ)^2) + rw [abs_of_nonneg (by positivity : 0 ≤ 3*(s.card:ℝ)*(G.pathScale s N:ℝ)^2)] at hd + change |((((G.constant+∑ i : Fin s.card, (3/4+3*(G.weight (qmaSelectedIndex s i))^2))+ + 3*(s.card:ℚ)*(G.pathScale s N)^2):ℚ):ℝ)| ≤ _ + push_cast + change |((G.constant:ℝ)+∑ i : Fin s.card, qmaPathOffset (G.weight (qmaSelectedIndex s i):ℝ))+ + 3*(s.card:ℝ)*(G.pathScale s N:ℝ)^2| ≤ _ + nlinarith [mul_le_mul_of_nonneg_left hR2 (by positivity : 0 ≤ (s.card:ℝ))] + +end QMARationalExchangeGraph +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathsCalibration.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathsCalibration.lean new file mode 100644 index 0000000000000000000000000000000000000000..4357cf1bf90e608a599d6068c9f2813c543a810f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathsCalibration.lean @@ -0,0 +1,63 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathsParallel + +namespace OAI + +/-! Polynomial penalty for a simultaneous layer of arbitrary parity subdivisions. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical + +theorem qmaPaths_correction_norm (n r : ℕ) (R : ℝ) (J : Fin r → ℝ) : + ‖spinMatrixOperator ((∑ e, qmaPathCorrection (n := n) R (J e)) ⊗ₖ + (1 : Matrix (MediatorBasis r) (MediatorBasis r) ℂ))‖ ≤ + 4*∑ e, (1+|J e|)^2 := by + rw [MediatorGraph.sum_kronecker,spinMatrixOperator_sum,Finset.mul_sum] + exact (norm_sum_le _ _).trans (Finset.sum_le_sum (fun e _ => + qmaPathCorrection_lift_norm n r R (J e))) + +theorem qmaPaths_amplitude (r : ℕ) (even : Fin r → Bool) (R : ℝ) (hR : 0 ≤ R) (J : Fin r → ℝ) : + 3*(∑ e, ∑ a, |qmaPathAmplitude (even e) R (J e) a|) = + (3*∑ e, (1+2*|J e|))*R := by + rw [Finset.mul_sum] + simp_rw [qmaPathAmplitude_norm _ R _ hR] + rw [← Finset.mul_sum] + ring + +theorem qmaPaths_accuracy {n r : ℕ} (site : Fin r → Fin 2 → Fin n) + (hsite : ∀ e, Function.Injective (site e)) (even : Fin r → Bool) (J : Fin r → ℝ) + {B N : ℝ} (hB : 0 ≤ B) (hN : 0 < N) + (C : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) (hC : C.conjTranspose = C) + (hCn : ‖spinMatrixOperator (C ⊗ₖ (1 : Matrix (MediatorBasis r) (MediatorBasis r) ℂ))‖ ≤ B) : + let A := 3*∑ e, (1+2*|J e|) + let D := B+4*∑ e, (1+|J e|)^2 + let R := qmaRoutingScale A D N + |mediatorFullBottom n r (routingHamiltonian n r (R^2) + (C + ∑ e, qmaPathCorrection (n := n) R (J e)) + (qmaRoutingStars n r site (fun e => qmaPathMember (even e)) + (fun e => qmaPathAmplitude (even e) R (J e)))) - + sourceMatrixBottom n (C + ∑ e, + (J e:ℂ) • sourceHeisenbergMatrix n (site e 0) (site e 1))| ≤ 1/N := by + let A := 3*∑ e, (1+2*|J e|) + let D := B+4*∑ e, (1+|J e|)^2 + let R := qmaRoutingScale A D N + have hA : 0 ≤ A := by dsimp [A]; positivity + have hD : 0 ≤ D := by dsimp [D]; positivity + obtain ⟨hR,he,hes,hbound,herr⟩ := qmaRoutingScale_bounds hA hD hN + have hCC : ‖spinMatrixOperator ((C + ∑ e, qmaPathCorrection (n := n) R (J e)) ⊗ₖ + (1 : Matrix (MediatorBasis r) (MediatorBasis r) ℂ))‖ ≤ D := by + rw [Matrix.add_kronecker,spinMatrixOperator_add] + exact (norm_add_le _ _).trans (add_le_add hCn (qmaPaths_correction_norm n r R J)) + have hb : ‖spinMatrixOperator ((C + ∑ e, qmaPathCorrection (n := n) R (J e)) ⊗ₖ + (1 : Matrix (MediatorBasis r) (MediatorBasis r) ℂ))‖ + + 3*∑ e, ∑ a, |qmaPathAmplitude (even e) R (J e) a| ≤ ((A+D+1)/R)*(4*R^2) := by + rw [qmaPaths_amplitude r even R hR.le J] + exact (add_le_add hCC (le_refl (A*R))).trans hbound + exact (qmaPaths_bottom site hsite even R hR J C hC he hes hb).trans herr + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathsGraph.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathsGraph.lean new file mode 100644 index 0000000000000000000000000000000000000000..6a55eb34e8f8165cfff8671f792bd5b20cc571d2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathsGraph.lean @@ -0,0 +1,74 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathsCalibration + +namespace OAI + +/-! Explicit ordinary-spin edges for simultaneous path subdivisions. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix MediatorGraph +open scoped BigOperators Kronecker Classical +variable {ν : Type*} [Fintype ν] + +def qmaPathOffset (J : ℝ) : ℝ := 3/4+3*J^2 + +theorem qmaPathsBase_matrix {n r : ℕ} (left right : ν → Fin n) (weight : ν → ℝ) + (constant R : ℝ) (J : Fin r → ℝ) : + qmaExchangeMatrix left right weight (constant+∑ e, qmaPathOffset (J e)) = + qmaExchangeMatrix left right weight constant + + ∑ e, qmaPathCorrection (n := n) R (J e) := by + simp only [qmaExchangeMatrix,qmaPathCorrection,qmaPathOffset, + Complex.ofReal_add,Complex.ofReal_sum,add_smul,Finset.sum_smul] + abel + +def qmaPathsGraph {n r : ℕ} (left right : ν → Fin n) (weight : ν → ℝ) + (constant R : ℝ) (site : Fin r → Fin 2 → Fin n) (even : Fin r → Bool) (J : Fin r → ℝ) : + Matrix (SourceSpinBasis (n+r*2)) (SourceSpinBasis (n+r*2)) ℂ := + qmaExchangeMatrix + (qmaParallelGraphLeft left site) + (qmaParallelGraphRight right (fun e => qmaPathMember (even e))) + (qmaParallelGraphWeight weight (R^2) (fun e => qmaPathAmplitude (even e) R (J e))) + ((constant+∑ e, qmaPathOffset (J e))+3*r*(R^2)) + +theorem qmaPathsGraph_matrix {n r : ℕ} (left right : ν → Fin n) + (hneq : ∀ a, left a ≠ right a) (weight : ν → ℝ) (constant R : ℝ) + (site : Fin r → Fin 2 → Fin n) (even : Fin r → Bool) (J : Fin r → ℝ) : + (qmaPathsGraph left right weight constant R site even J).submatrix + (basisEquiv n r) (basisEquiv n r) = + qmaPhysicalParallelHamiltonian n r (R^2) + (qmaExchangeMatrix left right weight constant+∑ e, qmaPathCorrection (n := n) R (J e)) + site (fun e => qmaPathMember (even e)) (fun e => qmaPathAmplitude (even e) R (J e)) := by + unfold qmaPathsGraph + have h := qmaParallelGraph_matrix left right hneq weight + (constant+∑ e, qmaPathOffset (J e)) (R^2) + site (fun e => qmaPathMember (even e)) (fun e => qmaPathAmplitude (even e) R (J e)) + rw [qmaPathsBase_matrix left right weight constant R J] at h + exact h + +theorem qmaPathsGraph_accuracy {n r : ℕ} (left right : ν → Fin n) + (hneq : ∀ a, left a ≠ right a) (weight : ν → ℝ) (constant : ℝ) + (site : Fin r → Fin 2 → Fin n) (hsite : ∀ e, Function.Injective (site e)) + (even : Fin r → Bool) (J : Fin r → ℝ) {N : ℝ} (hN : 0 < N) : + let B := 3*(∑ a, |weight a|)+|constant| + let A := 3*∑ e, (1+2*|J e|) + let D := B+4*∑ e, (1+|J e|)^2 + let R := qmaRoutingScale A D N + |sourceMatrixBottom (n+r*2) (qmaPathsGraph left right weight constant R site even J) - + sourceMatrixBottom n (qmaExchangeMatrix left right weight constant + ∑ e, + (J e:ℂ) • sourceHeisenbergMatrix n (site e 0) (site e 1))| ≤ 1/N := by + dsimp only + rw [sourceMatrixBottom_eq_mediator n r,qmaPathsGraph_matrix left right hneq weight constant, + qmaPhysicalParallel_bottom] + have hC : (qmaExchangeMatrix left right weight constant).conjTranspose = + qmaExchangeMatrix left right weight constant := by + simp only [qmaExchangeMatrix,Matrix.conjTranspose_add,Matrix.conjTranspose_sum, + Matrix.conjTranspose_smul,sourceHeisenbergMatrix_star n _ _ (hneq _), + Complex.star_def,Complex.conj_ofReal,Matrix.conjTranspose_one] + exact qmaPaths_accuracy site hsite even J (by positivity) hN _ hC + (qmaExchangeMatrix_lift_norm left right hneq weight constant) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathsParallel.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathsParallel.lean new file mode 100644 index 0000000000000000000000000000000000000000..e3b92b645514fd503ddb6f79cc619e358e1e981d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPathsParallel.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathSpectrum +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumParallelGraph + +namespace OAI + +/-! A whole layer of independently even or odd path subdivisions. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical + +theorem qmaPaths_effective {n r : ℕ} (site : Fin r → Fin 2 → Fin n) + (hsite : ∀ e, Function.Injective (site e)) (even : Fin r → Bool) + (R : ℝ) (hR : R ≠ 0) (J : Fin r → ℝ) + (C : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) : + (C + ∑ e, qmaPathCorrection (n := n) R (J e)) - + mediatorCompression n r (qmaRoutingStars n r site (fun e => qmaPathMember (even e)) + (fun e => qmaPathAmplitude (even e) R (J e)) * liftedMediatorInverse n r (R^2) * + qmaRoutingStars n r site (fun e => qmaPathMember (even e)) + (fun e => qmaPathAmplitude (even e) R (J e))) = + C + ∑ e, (J e:ℂ) • sourceHeisenbergMatrix n (site e 0) (site e 1) := by + rw [qmaRoutingStars_compression,add_sub_assoc,← Finset.sum_sub_distrib] + congr 1 + apply Finset.sum_congr rfl + intro e _ + exact qmaPathSubdivision_effective e (site e) (hsite e) (even e) R (J e) hR + +theorem qmaPaths_bottom {n r : ℕ} (site : Fin r → Fin 2 → Fin n) + (hsite : ∀ e, Function.Injective (site e)) (even : Fin r → Bool) + (R : ℝ) (hR : 0 < R) (J : Fin r → ℝ) + (C : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) (hC : C.conjTranspose = C) + {epsilon : ℝ} (hepsilon : 0 ≤ epsilon) (hsmall : epsilon ≤ 1/4) + (hbound : ‖spinMatrixOperator ((C + ∑ e, qmaPathCorrection (n := n) R (J e)) ⊗ₖ + (1 : Matrix (MediatorBasis r) (MediatorBasis r) ℂ))‖ + + 3*∑ e, ∑ a, |qmaPathAmplitude (even e) R (J e) a| ≤ epsilon*(4*R^2)) : + |mediatorFullBottom n r (routingHamiltonian n r (R^2) + (C + ∑ e, qmaPathCorrection (n := n) R (J e)) + (qmaRoutingStars n r site (fun e => qmaPathMember (even e)) + (fun e => qmaPathAmplitude (even e) R (J e)))) - + sourceMatrixBottom n (C + ∑ e, + (J e:ℂ) • sourceHeisenbergMatrix n (site e 0) (site e 1))| ≤ 16*R^2*epsilon^3 := by + have hCW : (C + ∑ e, qmaPathCorrection (n := n) R (J e)).conjTranspose = + C + ∑ e, qmaPathCorrection (n := n) R (J e) := by + simp only [qmaPathCorrection,Matrix.conjTranspose_add,Matrix.conjTranspose_sum,hC, + Matrix.conjTranspose_smul,Matrix.conjTranspose_one,Complex.star_def,Complex.conj_ofReal] + have h := qmaRoutingStars_bottom n r (sq_pos_of_pos hR) _ hCW site + (fun e => qmaPathMember (even e)) (fun e => qmaPathAmplitude (even e) R (J e)) + hepsilon hsmall hbound + rw [qmaPaths_effective site hsite even R hR.ne' J C] at h + exact h + +theorem qmaPathAmplitude_norm (even : Bool) (R J : ℝ) (hR : 0 ≤ R) : + 3*(∑ a, |qmaPathAmplitude even R J a|) = 3*R*(1+2*|J|) := by + cases even <;> simp [qmaPathAmplitude,Fin.sum_univ_succ,abs_mul,abs_of_nonneg hR] <;> ring + +theorem qmaPathCorrection_lift_norm (n r : ℕ) (R J : ℝ) : + ‖spinMatrixOperator (qmaPathCorrection (n := n) R J ⊗ₖ + (1 : Matrix (MediatorBasis r) (MediatorBasis r) ℂ))‖ ≤ 4*(1+|J|)^2 := by + have hI : ‖spinMatrixOperator (1 : Matrix (MediatedSpinBasis n r) (MediatedSpinBasis n r) ℂ)‖ ≤ 1 := by + apply spinMatrixOperator_unitary_norm + simp + rw [qmaPathCorrection,Matrix.smul_kronecker,Matrix.one_kronecker_one,spinMatrixOperator_smul, + norm_smul,Complex.norm_real,Real.norm_eq_abs] + have hoff : 0 ≤ 3/4+3*J^2 := by positivity + rw [abs_of_nonneg hoff] + calc + _ ≤ (3/4+3*J^2)*1 := mul_le_mul_of_nonneg_left hI hoff + _ ≤ _ := by nlinarith [sq_abs J,abs_nonneg J] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliAlgebra.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..bef566b477a550598a4b571683c4bf3a192f880c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliAlgebra.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCircuitPauli + +namespace OAI + +/-! The Pauli factors used by the mediator gadgets are Hermitian +involutions, and disjoint factors commute exactly. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +theorem qmaPauli_zero : qmaPauli 0 = 1 := rfl + +theorem qmaPauli_square (i : Fin 4) : qmaPauli i*qmaPauli i = 1 := by + fin_cases i <;> ext a b <;> fin_cases a <;> fin_cases b <;> + norm_num [qmaPauli,pauliX,pauliY,pauliZ,Matrix.mul_apply,Fin.sum_univ_two] + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +theorem qmaPauliWord_mul_apply (w v : ι → Fin 4) (s t : ι → Fin 2) : + (qmaPauliWord w*qmaPauliWord v) s t = + ∏ i, (qmaPauli (w i)*qmaPauli (v i)) (s i) (t i) := by + change (∑ r : ι → Fin 2, (∏ i, qmaPauli (w i) (s i) (r i))*(∏ i, qmaPauli (v i) (r i) (t i))) = _ + simp only [←Finset.prod_mul_distrib] + exact (Fintype.prod_sum (fun i a => qmaPauli (w i) (s i) a*qmaPauli (v i) a (t i))).symm + +theorem qmaPauliWord_square (w : ι → Fin 4) : qmaPauliWord w*qmaPauliWord w = 1 := by + ext s t + rw [qmaPauliWord_mul_apply] + simp only [qmaPauli_square,Matrix.one_apply] + by_cases h : s = t + · subst t + simp + · rw [ite_eq_right h] + obtain ⟨i,hi⟩ := Function.ne_iff.mp h + exact Finset.prod_eq_zero (Finset.mem_univ i) (ite_eq_right hi) + +theorem qmaPauliWord_gram (w : ι → Fin 4) : + (qmaPauliWord w).conjTranspose*qmaPauliWord w = 1 := by + rw [qmaPauliWord_hermitian w,qmaPauliWord_square] + +theorem qmaPauliWord_disjoint_commute (w v : ι → Fin 4) + (h : ∀ i, w i = 0 ∨ v i = 0) : qmaPauliWord w*qmaPauliWord v = qmaPauliWord v*qmaPauliWord w := by + ext s t + rw [qmaPauliWord_mul_apply,qmaPauliWord_mul_apply] + apply Finset.prod_congr rfl + intro i _ + rcases h i with hi | hi <;> simp [hi,qmaPauli_zero] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliBasis.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliBasis.lean new file mode 100644 index 0000000000000000000000000000000000000000..e90927717535994fff38feca57addbf1b47eab1c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliBasis.lean @@ -0,0 +1,65 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRealLocalFamily + +namespace OAI + +/-! Exact Pauli expansion on the bounded supports of the circuit terms. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +def qmaPauli (i : Fin 4) : Matrix (Fin 2) (Fin 2) ℂ := ![1,pauliX,pauliY,pauliZ] i + +theorem qmaPauli_hermitian (i : Fin 4) : (qmaPauli i).IsHermitian := by + apply Matrix.IsHermitian.ext + intro a b + fin_cases i <;> fin_cases a <;> fin_cases b <;> + norm_num [qmaPauli,pauli,pauliX,pauliY,pauliZ] + +theorem qmaPauli_kernel (a b c d : Fin 2) : + (∑ i : Fin 4, qmaPauli i a b*qmaPauli i c d) = + 2*(if a = d ∧ c = b then (1:ℂ) else 0) := by + fin_cases a <;> fin_cases b <;> fin_cases c <;> fin_cases d <;> + norm_num [qmaPauli,pauli,pauliX,pauliY,pauliZ,Fin.sum_univ_succ] + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +def qmaPauliWord (w : ι → Fin 4) : Matrix (ι → Fin 2) (ι → Fin 2) ℂ := + fun s t => ∏ i, qmaPauli (w i) (s i) (t i) + +omit [DecidableEq ι] in +theorem qmaPauliWord_hermitian (w : ι → Fin 4) : (qmaPauliWord w).IsHermitian := by + apply Matrix.IsHermitian.ext + intro s t + change star (∏ i, qmaPauli (w i) (t i) (s i)) = ∏ i, qmaPauli (w i) (s i) (t i) + rw [star_prod] + apply Finset.prod_congr rfl + intro i _ + exact (qmaPauli_hermitian (w i)).apply _ _ + +theorem qmaPauliWord_kernel (s t u v : ι → Fin 2) : + (∑ w : ι → Fin 4, qmaPauliWord w s t*qmaPauliWord w u v) = + (2:ℂ)^Fintype.card ι*(if s = v ∧ u = t then 1 else 0) := by + simp only [qmaPauliWord,←Finset.prod_mul_distrib] + rw [←Fintype.prod_sum (fun (i : ι) (a : Fin 4) => + qmaPauli a (s i) (t i)*qmaPauli a (u i) (v i))] + simp only [qmaPauli_kernel,Finset.prod_mul_distrib,Finset.prod_const,Finset.card_univ] + congr 1 + by_cases hs : s = v + · subst v + by_cases hu : u = t + · subst u + simp + · rw [ite_eq_right (by simp [hu])] + obtain ⟨i,hi⟩ := Function.ne_iff.mp hu + exact Finset.prod_eq_zero (Finset.mem_univ i) (by simp [hi]) + · rw [ite_eq_right (by simp [hs])] + obtain ⟨i,hi⟩ := Function.ne_iff.mp hs + exact Finset.prod_eq_zero (Finset.mem_univ i) (by simp [hi]) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliCongestion.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliCongestion.lean new file mode 100644 index 0000000000000000000000000000000000000000..c125bd52b686a604a0f6428389c69762de5b4d34 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliCongestion.lean @@ -0,0 +1,45 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalSupported + +namespace OAI + +/-! A local Pauli expansion multiplies each source-region occupancy by a fixed constant. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators Classical +variable {ι α : Type*} [Fintype ι] [DecidableEq ι] [Fintype α] + +omit [Fintype ι] in +theorem qmaLocalPauli_filter_card (S : α → Finset ι) (p : α → Prop) [DecidablePred p] : + (Finset.univ.filter (fun w : QMALocalPauliTerm S => p w.1)).card = + ∑ a : {a : α // p a}, 4^(S a.val).card := by + rw [←Fintype.card_subtype] + rw [Fintype.card_congr (Equiv.subtypeSigmaEquiv (fun a => {i // i ∈ S a} → Fin 4) p)] + simp only [Fintype.card_sigma,Fintype.card_fun,Fintype.card_fin,Fintype.card_coe] + +omit [Fintype ι] in +theorem qmaLocalEvenPauli_filter_card (S : α → Finset ι) {d : ℕ} + (hS : ∀ a, (S a).card ≤ d) (p : α → Prop) [DecidablePred p] : + (Finset.univ.filter (fun w : QMALocalEvenPauliTerm S => p w.val.1)).card ≤ + 4^d*(Finset.univ.filter p).card := by + have hinj : (Finset.univ.filter (fun w : QMALocalEvenPauliTerm S => p w.val.1)).card ≤ + (Finset.univ.filter (fun w : QMALocalPauliTerm S => p w.1)).card := by + apply Finset.card_le_card_of_injOn Subtype.val + · intro w hw + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,(Finset.mem_filter.mp hw).2⟩ + · intro w _ v _ h + exact Subtype.ext h + calc + _ ≤ _ := hinj + _ = ∑ a : {a : α // p a}, 4^(S a.val).card := qmaLocalPauli_filter_card S p + _ ≤ ∑ _a : {a : α // p a}, 4^d := Finset.sum_le_sum (fun a _ => + pow_le_pow_right₀ (by norm_num : (1:ℕ) ≤ 4) (hS a.val)) + _ = 4^d*(Finset.univ.filter p).card := by + simp only [Finset.sum_const,Finset.card_univ,smul_eq_mul,Fintype.card_subtype] + exact Nat.mul_comm _ _ + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliExpansion.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliExpansion.lean new file mode 100644 index 0000000000000000000000000000000000000000..452dd577b73ef04c255cba3e769a14b9aa63ee50 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliExpansion.lean @@ -0,0 +1,59 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliBasis + +namespace OAI + +/-! Coefficients of the actual small local matrices in the Pauli basis. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +def qmaPauliCoefficient (A : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (w : ι → Fin 4) : ℂ := + ((2:ℂ)^Fintype.card ι)⁻¹ * ∑ s, ∑ t, A s t*qmaPauliWord w t s + +theorem qmaPauli_expansion (A : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) : + (∑ w : ι → Fin 4, qmaPauliCoefficient A w • qmaPauliWord w) = A := by + ext i j + have hswap : + (∑ w : ι → Fin 4, ∑ s : ι → Fin 2, ∑ t : ι → Fin 2, + A s t*(qmaPauliWord w i j*qmaPauliWord w t s)) = + ∑ s : ι → Fin 2, ∑ t : ι → Fin 2, ∑ w : ι → Fin 4, + A s t*(qmaPauliWord w i j*qmaPauliWord w t s) := by + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro s _ + rw [Finset.sum_comm] + calc + _ = ((2:ℂ)^Fintype.card ι)⁻¹ * + ∑ w : ι → Fin 4, ∑ s : ι → Fin 2, ∑ t : ι → Fin 2, + A s t*(qmaPauliWord w i j*qmaPauliWord w t s) := by + simp only [Matrix.sum_apply,Matrix.smul_apply,smul_eq_mul,qmaPauliCoefficient, + Finset.sum_mul,Finset.mul_sum] + apply Finset.sum_congr rfl + intro w _ + apply Finset.sum_congr rfl + intro s _ + apply Finset.sum_congr rfl + intro t _ + ring + _ = ((2:ℂ)^Fintype.card ι)⁻¹ * + ∑ s : ι → Fin 2, ∑ t : ι → Fin 2, + A s t*(∑ w : ι → Fin 4, qmaPauliWord w i j*qmaPauliWord w t s) := by + rw [hswap] + simp only [Finset.mul_sum] + _ = A i j := by + simp_rw [qmaPauliWord_kernel] + simp only [mul_ite,ite_and,mul_one,mul_zero,Finset.sum_ite_irrel, + Finset.sum_const_zero,Finset.sum_ite_eq,Finset.mem_univ,ite_true] + have hp : (2:ℂ)^Fintype.card ι ≠ 0 := pow_ne_zero _ (by norm_num) + field_simp + simp + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliExtend.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliExtend.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd16ac01f2133660825449d60580434e60d50b86 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliExtend.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEntryParity + +namespace OAI + +/-! Extending a Pauli word by identities is exactly the local tensor lift. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +def qmaPauliExtend (S : Finset ι) (w : {i // i ∈ S} → Fin 4) : ι → Fin 4 := + fun i => if hi : i ∈ S then w ⟨i,hi⟩ else 0 + +theorem qmaPauliExtend_support (S : Finset ι) (w : {i // i ∈ S} → Fin 4) : + qmaPauliSupport (qmaPauliExtend S w) ⊆ S := by + intro i hi + by_contra h + simp [qmaPauliSupport,qmaPauliExtend,h] at hi + +theorem qmaPauliExtend_lift (S : Finset ι) (w : {i // i ∈ S} → Fin 4) : + qmaPauliWord (qmaPauliExtend S w) = qmaLocalLift S (qmaPauliWord w) := by + ext s t + rw [qmaLocalLift_apply] + change (∏ i, qmaPauli (qmaPauliExtend S w i) (s i) (t i)) = + (∏ i : {i // i ∈ S}, qmaPauli (w i) (s i.val) (t i.val))* + (if (fun i : {i // i ∉ S} => s i.val) = (fun i : {i // i ∉ S} => t i.val) then 1 else 0) + by_cases hr : (fun i : {i // i ∉ S} => s i.val) = (fun i : {i // i ∉ S} => t i.val) + · rw [ite_eq_left hr,mul_one] + have he (i : ι) (_hi : i ∈ Finset.univ) (hi : i ∉ S) : + qmaPauli (qmaPauliExtend S w i) (s i) (t i) = 1 := by + simp only [qmaPauliExtend,hi,dite_false,qmaPauli_zero,Matrix.one_apply] + exact ite_eq_left (congrFun hr ⟨i,hi⟩) + have hp := Finset.prod_subset (Finset.subset_univ S) he + have hs := Finset.prod_subtype (F := inferInstance) S + (by simp : ∀ i, i ∈ S ↔ i ∈ S) (fun i => qmaPauli (qmaPauliExtend S w i) (s i) (t i)) + have hex := hp.symm.trans hs + have hw (i : {i // i ∈ S}) : qmaPauliExtend S w i.val = w i := by + simp [qmaPauliExtend,i.property] + simpa only [hw] using hex + · rw [ite_eq_right hr,mul_zero] + obtain ⟨i,hi⟩ := Function.ne_iff.mp hr + apply Finset.prod_eq_zero (Finset.mem_univ i.val) + simp only [qmaPauliExtend,i.property,dite_false,qmaPauli_zero,Matrix.one_apply] + exact ite_eq_right hi + +theorem qmaPauliExtend_yCount (S : Finset ι) (w : {i // i ∈ S} → Fin 4) : + qmaPauliYCount (qmaPauliExtend S w) = qmaPauliYCount w := by + unfold qmaPauliYCount + have he : Finset.univ.filter (fun i => qmaPauliExtend S w i = 2) = + (Finset.univ.filter (fun i : {i // i ∈ S} => w i = 2)).map + ⟨Subtype.val,Subtype.val_injective⟩ := by + ext i + constructor + · intro hi + have he := (Finset.mem_filter.mp hi).2 + by_cases hS : i ∈ S + · exact Finset.mem_map.mpr ⟨⟨i,hS⟩,by simpa [qmaPauliExtend,hS] using he,rfl⟩ + · simp [qmaPauliExtend,hS] at he + · intro hi + obtain ⟨j,hj,rfl⟩ := Finset.mem_map.mp hi + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _,?_⟩ + change qmaPauliExtend S w j.val = 2 + simpa [qmaPauliExtend,j.property] using (Finset.mem_filter.mp hj).2 + rw [he,Finset.card_map] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliLocal.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliLocal.lean new file mode 100644 index 0000000000000000000000000000000000000000..4b03f3173611fce52cc29f9d2f91fc00d98dee42 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliLocal.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliAlgebra + +namespace OAI + +/-! Exact supports and tensor joins of the Pauli words used in the reduction. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +def qmaPauliSupport (w : ι → Fin 4) : Finset ι := Finset.univ.filter (fun i => w i ≠ 0) + +theorem qmaPauliWord_local (S : Finset ι) (w : ι → Fin 4) + (hw : ∀ i, i ∉ S → w i = 0) : QMALocalOn S (qmaPauliWord w) := by + refine ⟨qmaPauliWord (fun i : {i // i ∈ S} => w i.val),?_⟩ + ext s t + rw [qmaLocalLift_apply] + change (∏ i, qmaPauli (w i) (s i) (t i)) = + (∏ i : {i // i ∈ S}, qmaPauli (w i.val) (s i.val) (t i.val))* + (if (fun i : {i // i ∉ S} => s i.val) = (fun i : {i // i ∉ S} => t i.val) then 1 else 0) + by_cases hr : (fun i : {i // i ∉ S} => s i.val) = (fun i : {i // i ∉ S} => t i.val) + · rw [ite_eq_left hr,mul_one] + have he (i : ι) (_hi : i ∈ Finset.univ) (hi : i ∉ S) : qmaPauli (w i) (s i) (t i) = 1 := by + rw [hw i hi,qmaPauli_zero,Matrix.one_apply] + exact ite_eq_left (congrFun hr ⟨i,hi⟩) + have hp := Finset.prod_subset (Finset.subset_univ S) he + have hs := Finset.prod_subtype (F := inferInstance) S + (by simp : ∀ i, i ∈ S ↔ i ∈ S) (fun i => qmaPauli (w i) (s i) (t i)) + exact hp.symm.trans hs + · rw [ite_eq_right hr,mul_zero] + obtain ⟨i,hi⟩ := Function.ne_iff.mp hr + apply Finset.prod_eq_zero (Finset.mem_univ i.val) + rw [hw i.val i.property,qmaPauli_zero,Matrix.one_apply] + exact ite_eq_right hi + +theorem qmaPauliWord_support (w : ι → Fin 4) : QMALocalOn (qmaPauliSupport w) (qmaPauliWord w) := by + apply qmaPauliWord_local + intro i hi + simpa [qmaPauliSupport] using hi + +omit [DecidableEq ι] in +theorem qmaPauliWord_join (w : ι → Fin 4) (v : κ → Fin 4) : + qmaJoinMatrix (qmaPauliWord w) (qmaPauliWord v) = qmaPauliWord (Sum.elim w v) := by + ext s t + change (∏ i, qmaPauli (w i) (s (Sum.inl i)) (t (Sum.inl i)))* + (∏ k, qmaPauli (v k) (s (Sum.inr k)) (t (Sum.inr k))) = + ∏ a : ι ⊕ κ, qmaPauli (Sum.elim w v a) (s a) (t a) + rw [Fintype.prod_sum_type] + rfl + +theorem qmaPauliSupport_join (w : ι → Fin 4) (v : κ → Fin 4) : + qmaPauliSupport (Sum.elim w v) = + (qmaPauliSupport w).map Function.Embedding.inl ∪ + (qmaPauliSupport v).map Function.Embedding.inr := by + ext a + cases a <;> simp [qmaPauliSupport] + +theorem qmaPauliSupport_join_card (w : ι → Fin 4) (v : κ → Fin 4) : + (qmaPauliSupport (Sum.elim w v)).card = (qmaPauliSupport w).card+(qmaPauliSupport v).card := by + rw [qmaPauliSupport_join,Finset.card_union_of_disjoint,Finset.card_map,Finset.card_map] + apply Finset.disjoint_left.mpr + intro a ha hb + obtain ⟨i,_,hi⟩ := Finset.mem_map.mp ha + obtain ⟨k,_,hk⟩ := Finset.mem_map.mp hb + exact Sum.inl_ne_inr (hi.trans hk.symm) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliMonomial.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliMonomial.lean new file mode 100644 index 0000000000000000000000000000000000000000..37262b5aa38a2c4a2499506453ce97aec6ad156d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliMonomial.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourcePauli + +namespace OAI + +/-! Sparse actions of the physical Pauli matrices, retaining a rational part. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +def qmaPauliBit (μ : Fin 3) (a : Fin 2) : Fin 2 := + if μ = 2 then a else Equiv.swap 0 1 a + +def qmaPhysicalPauliSign (μ : Fin 3) (a : Fin 2) : ℚ := + if μ = 0 then 1 else if a = 0 then (if μ = 1 then -1 else 1) + else (if μ = 1 then 1 else -1) + +def qmaPauliPhase (μ : Fin 3) : ℂ := if μ = 1 then Complex.I else 1 + +theorem qmaPauli_monomial (μ : Fin 3) (a b : Fin 2) : + pauli μ a b = qmaPauliPhase μ*(qmaPhysicalPauliSign μ a:ℂ)* + (if qmaPauliBit μ a = b then 1 else 0) := by + fin_cases μ <;> fin_cases a <;> fin_cases b <;> + norm_num [pauli,pauliX,pauliY,pauliZ,qmaPauliBit,qmaPhysicalPauliSign,qmaPauliPhase, + Equiv.swap_apply_def] + +theorem qmaLocalPauli_monomial (n : ℕ) (i : Fin n) (μ : Fin 3) + (s t : SourceSpinBasis n) : + sourceLocalPauli n i μ s t = qmaPauliPhase μ*(qmaPhysicalPauliSign μ (s i):ℂ)* + (if Function.update s i (qmaPauliBit μ (s i)) = t then 1 else 0) := by + unfold sourceLocalPauli sourceTensor + rw [← Finset.mul_prod_erase _ _ (Finset.mem_univ i)] + simp only [ite_true,qmaPauli_monomial] + have hrest (k : Fin n) (hk : k ∈ Finset.univ.erase i) : + (if k = i then pauli μ else 1) (s k) (t k) = if s k = t k then 1 else 0 := by + simp [(Finset.mem_erase.mp hk).1,Matrix.one_apply] + rw [Finset.prod_congr rfl hrest] + by_cases h : Function.update s i (qmaPauliBit μ (s i)) = t + · have hi := congrFun h i + have hk (k : Fin n) (hki : k ≠ i) : s k = t k := by + simpa only [Function.update_of_ne hki] using congrFun h k + simp only [Function.update_self] at hi + rw [ite_eq_left h,ite_eq_left hi,Finset.prod_eq_one (fun k hk' => + ite_eq_left (hk k (Finset.mem_erase.mp hk').1))] + simp + · rw [ite_eq_right h] + by_cases hi : qmaPauliBit μ (s i) = t i + · have hbad : ∃ k ∈ Finset.univ.erase i, s k ≠ t k := by + by_contra hn + push Not at hn + apply h + funext k + by_cases hki : k = i + · subst k + simpa only [Function.update_self] using hi + · simpa only [Function.update_of_ne hki] using + hn k (Finset.mem_erase.mpr ⟨hki,Finset.mem_univ _⟩) + obtain ⟨k,hk,hne⟩ := hbad + rw [ite_eq_left hi,Finset.prod_eq_zero hk (ite_eq_right hne)] + simp + · simp [hi] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliParity.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliParity.lean new file mode 100644 index 0000000000000000000000000000000000000000..caca11a69f4327f6a425ae616474cd9471650d11 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliParity.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliReal + +namespace OAI + +/-! A real Hermitian matrix contains only Pauli words with an even number +of imaginary Y factors. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +def qmaPauliSign (i : Fin 4) : ℂ := if i = 2 then -1 else 1 + +theorem qmaPauli_conjugate (i : Fin 4) (a b : Fin 2) : + star (qmaPauli i a b) = qmaPauliSign i*qmaPauli i a b := by + fin_cases i <;> fin_cases a <;> fin_cases b <;> + norm_num [qmaPauli,qmaPauliSign,pauliX,pauliY,pauliZ] + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +def qmaPauliYCount (w : ι → Fin 4) : ℕ := (Finset.univ.filter (fun i => w i = 2)).card + +omit [DecidableEq ι] in +theorem qmaPauliWord_conjugate (w : ι → Fin 4) (s t : ι → Fin 2) : + star (qmaPauliWord w s t) = (-1:ℂ)^qmaPauliYCount w*qmaPauliWord w s t := by + simp only [qmaPauliWord,star_prod,qmaPauli_conjugate,Finset.prod_mul_distrib] + congr 1 + simp [qmaPauliSign,qmaPauliYCount,Finset.prod_ite] + +theorem qmaPauliCoefficient_conjugate_of_real + (A : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (hA : ∀ s t, (A s t).im = 0) + (w : ι → Fin 4) : + star (qmaPauliCoefficient A w) = (-1:ℂ)^qmaPauliYCount w*qmaPauliCoefficient A w := by + have ha (s t : ι → Fin 2) : star (A s t) = A s t := by + apply Complex.ext + · rfl + · simp [hA] + have hs : star (∑ s : ι → Fin 2, ∑ t : ι → Fin 2, A s t*qmaPauliWord w t s) = + (-1:ℂ)^qmaPauliYCount w*(∑ s : ι → Fin 2, ∑ t : ι → Fin 2, A s t*qmaPauliWord w t s) := by + simp only [star_sum,star_mul,ha,qmaPauliWord_conjugate,Finset.mul_sum] + apply Finset.sum_congr rfl + intro s _ + apply Finset.sum_congr rfl + intro t _ + ring + have hi : star (((2:ℂ)^Fintype.card ι)⁻¹) = ((2:ℂ)^Fintype.card ι)⁻¹ := by + change (starRingEnd ℂ) (((2:ℂ)^Fintype.card ι)⁻¹) = _ + rw [map_inv₀,map_pow] + have h2 : (starRingEnd ℂ) (2:ℂ) = 2 := by simp only [starRingEnd_apply]; norm_num + rw [h2] + unfold qmaPauliCoefficient + calc + _ = star (∑ s : ι → Fin 2, ∑ t : ι → Fin 2, A s t*qmaPauliWord w t s)* + star (((2:ℂ)^Fintype.card ι)⁻¹) := star_mul _ _ + _ = ((-1:ℂ)^qmaPauliYCount w*(∑ s : ι → Fin 2, ∑ t : ι → Fin 2, + A s t*qmaPauliWord w t s))*((2:ℂ)^Fintype.card ι)⁻¹ := congrArg₂ (· * ·) hs hi + _ = _ := by ring + +theorem qmaPauliCoefficient_odd_zero (A : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (hH : A.IsHermitian) (hR : ∀ s t, (A s t).im = 0) + (w : ι → Fin 4) (hw : Odd (qmaPauliYCount w)) : qmaPauliCoefficient A w = 0 := by + have hs := qmaPauliCoefficient_conjugate_of_real A hR w + rw [qmaPauliCoefficient_star A hH w,hw.neg_one_pow] at hs + have he : (2:ℂ)*qmaPauliCoefficient A w = 0 := by + linear_combination hs + exact (mul_eq_zero.mp he).resolve_left (by norm_num) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliProduct.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliProduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..49686931653eb92c5526d37827ce64ed4acdb8a1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliProduct.lean @@ -0,0 +1,39 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliAlgebra + +namespace OAI + +/-! Exact Pauli multiplication, including the scalar phases needed to +replace a YY interaction by commuting real X/Z factors. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +def qmaPauliProductIndex (a b : Fin 4) : Fin 4 := + ![![0,1,2,3],![1,0,3,2],![2,3,0,1],![3,2,1,0]] a b + +def qmaPauliProductPhase (a b : Fin 4) : ℂ := + ![![1,1,1,1],![1,1,Complex.I,-Complex.I], + ![1,-Complex.I,1,Complex.I],![1,Complex.I,-Complex.I,1]] a b + +theorem qmaPauli_product (a b : Fin 4) : + qmaPauli a*qmaPauli b = qmaPauliProductPhase a b • qmaPauli (qmaPauliProductIndex a b) := by + fin_cases a <;> fin_cases b <;> ext s t <;> fin_cases s <;> fin_cases t <;> + norm_num [qmaPauliProductIndex,qmaPauliProductPhase,qmaPauli,pauliX,pauliY,pauliZ, + Matrix.mul_apply,Fin.sum_univ_two,Matrix.smul_apply,smul_eq_mul,Matrix.one_apply] + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +theorem qmaPauliWord_product (a b : ι → Fin 4) : + qmaPauliWord a*qmaPauliWord b = (∏ i, qmaPauliProductPhase (a i) (b i)) • + qmaPauliWord (fun i => qmaPauliProductIndex (a i) (b i)) := by + ext s t + rw [qmaPauliWord_mul_apply] + simp only [qmaPauli_product,Matrix.smul_apply,smul_eq_mul,Finset.prod_mul_distrib,qmaPauliWord] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliReal.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliReal.lean new file mode 100644 index 0000000000000000000000000000000000000000..de102fd3c38d9d45710e71ffe30009d3338aa2b6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliReal.lean @@ -0,0 +1,48 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliExpansion + +namespace OAI + +/-! Hermitian local matrices have real Pauli coefficients. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +theorem qmaPauliCoefficient_star (A : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (hA : A.IsHermitian) (w : ι → Fin 4) : + star (qmaPauliCoefficient A w) = qmaPauliCoefficient A w := by + have hs : star (∑ s : ι → Fin 2, ∑ t : ι → Fin 2, A s t*qmaPauliWord w t s) = + ∑ s : ι → Fin 2, ∑ t : ι → Fin 2, A s t*qmaPauliWord w t s := by + calc + _ = ∑ s : ι → Fin 2, ∑ t : ι → Fin 2, A t s*qmaPauliWord w s t := by + simp only [star_sum,star_mul,hA.apply,(qmaPauliWord_hermitian w).apply] + apply Finset.sum_congr rfl + intro s _ + apply Finset.sum_congr rfl + intro t _ + ring + _ = _ := Finset.sum_comm + simp [qmaPauliCoefficient,hs] + +theorem qmaPauliCoefficient_real (A : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (hA : A.IsHermitian) (w : ι → Fin 4) : (qmaPauliCoefficient A w).im = 0 := by + have h := congrArg Complex.im (qmaPauliCoefficient_star A hA w) + simp only [Complex.star_def,Complex.conj_im] at h + linarith + +theorem qmaPauli_real_expansion (A : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (hA : A.IsHermitian) : + (∑ w : ι → Fin 4, ((qmaPauliCoefficient A w).re : ℂ) • qmaPauliWord w) = A := by + have he (w : ι → Fin 4) : ((qmaPauliCoefficient A w).re : ℂ) = qmaPauliCoefficient A w := by + apply Complex.ext + · rfl + · simpa only [Complex.ofReal_im] using (qmaPauliCoefficient_real A hA w).symm + simp only [he,qmaPauli_expansion] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliRounding.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliRounding.lean new file mode 100644 index 0000000000000000000000000000000000000000..dc7dce3f4838f71a1f2390b5d32baccd6bf79e6c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliRounding.lean @@ -0,0 +1,71 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumExchangeRounding +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliAlgebra + +namespace OAI + +/-! Rounding a finite Pauli family controls its actual full-space ground energy. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] + +def qmaPauliFamily (w : κ → ι → Fin 4) (J : κ → ℝ) : Matrix (ι → Fin 2) (ι → Fin 2) ℂ := + ∑ e, (J e:ℂ) • qmaPauliWord (w e) + +theorem qmaPauliFamily_norm (w : κ → ι → Fin 4) (J : κ → ℝ) : + ‖spinMatrixOperator (qmaPauliFamily w J)‖ ≤ ∑ e, |J e| := by + rw [qmaPauliFamily,spinMatrixOperator_sum] + apply (norm_sum_le _ _).trans + apply Finset.sum_le_sum + intro e _ + rw [spinMatrixOperator_smul,norm_smul,Complex.norm_real,Real.norm_eq_abs] + exact (mul_le_mul_of_nonneg_left + (spinMatrixOperator_unitary_norm _ (qmaPauliWord_gram _)) (abs_nonneg _)).trans_eq (mul_one _) + +omit [DecidableEq ι] in +theorem qmaPauliFamily_sub (w : κ → ι → Fin 4) (J K : κ → ℝ) : + qmaPauliFamily w J-qmaPauliFamily w K = qmaPauliFamily w (fun e => J e-K e) := by + simp only [qmaPauliFamily,Complex.ofReal_sub,sub_smul,Finset.sum_sub_distrib] + +theorem qmaPauliFamily_ground_error (w : κ → ι → Fin 4) (J K : κ → ℝ) : + |MediatorGraph.normalizedBottom (qmaPauliFamily w J)- + MediatorGraph.normalizedBottom (qmaPauliFamily w K)| ≤ ∑ e, |J e-K e| := by + apply qmaNormalizedBottom_norm_error _ _ + (EuclideanSpace.single (fun _ => (0:Fin 2)) 1) (by simp [PiLp.norm_single]) + rw [qmaPauliFamily_sub] + exact qmaPauliFamily_norm w _ + +theorem qmaPauliFamily_round_error (w : κ → ι → Fin 4) (J : κ → ℝ) + (m : ℕ) (hm : 0 < m) : + |MediatorGraph.normalizedBottom (qmaPauliFamily w J)- + MediatorGraph.normalizedBottom (qmaPauliFamily w (fun e => (qmaRationalRound m (J e):ℝ)))| ≤ + (Fintype.card κ:ℝ)/(m:ℝ) := by + apply (qmaPauliFamily_ground_error w J _).trans + calc + _ ≤ ∑ _e : κ, 1/(m:ℝ) := + Finset.sum_le_sum (fun e _ => qmaRationalRound_error m hm (J e)) + _ = _ := by simp [div_eq_mul_inv] + +theorem qmaPauliFamily_round_accuracy (w : κ → ι → Fin 4) (J : κ → ℝ) + (N : ℕ) (hN : 0 < N) : + let m := (Fintype.card κ+1)*N + |MediatorGraph.normalizedBottom (qmaPauliFamily w J)- + MediatorGraph.normalizedBottom (qmaPauliFamily w (fun e => (qmaRationalRound m (J e):ℝ)))| ≤ + 1/(N:ℝ) := by + dsimp only + have hm : 0 < (Fintype.card κ+1)*N := Nat.mul_pos (by omega) hN + apply (qmaPauliFamily_round_error w J _ hm).trans + have hNR : (0:ℝ) < N := by exact_mod_cast hN + have hcard : (0:ℝ) < Fintype.card κ+1 := by positivity + rw [Nat.cast_mul,Nat.cast_add,Nat.cast_one] + apply (div_le_iff₀ (mul_pos hcard hNR)).mpr + field_simp + linarith + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliSingle.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliSingle.lean new file mode 100644 index 0000000000000000000000000000000000000000..ad463e1e937e2b70d4065dfef3961ebf0adb6904 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliSingle.lean @@ -0,0 +1,93 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumYYElimination +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorAncilla + +namespace OAI + +/-! Exact Pauli words for the mediator flip and occupation matrices. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +def qmaSinglePauliWord (i : ι) (a : Fin 4) : ι → Fin 4 := fun k => if k = i then a else 0 + +theorem qmaSinglePauliWord_apply (i : ι) (a : Fin 4) (s t : ι → Fin 2) : + qmaPauliWord (qmaSinglePauliWord i a) s t = + qmaPauli a (s i) (t i)*(∏ k ∈ Finset.univ.erase i, if s k = t k then (1:ℂ) else 0) := by + rw [qmaPauliWord,← Finset.mul_prod_erase _ _ (Finset.mem_univ i)] + simp only [qmaSinglePauliWord,ite_true] + congr 1 + apply Finset.prod_congr rfl + intro k hk + simp [(Finset.mem_erase.mp hk).1,qmaPauli_zero,Matrix.one_apply] + +theorem qmaSinglePauliWord_support (i : ι) (a : Fin 4) : + qmaPauliSupport (qmaSinglePauliWord i a) ⊆ {i} := by + intro k hk + by_contra hn + have hki : k ≠ i := by simpa using hn + have ha := (Finset.mem_filter.mp hk).2 + simp [qmaSinglePauliWord,hki] at ha + +theorem qmaSinglePauliWord_X (i : ι) : + qmaPauliWord (qmaSinglePauliWord i 1) = qmaBitFlipMatrix i := by + have hX (u v : Fin 2) : qmaPauli 1 u v = + if u = Equiv.swap (0:Fin 2) 1 v then (1:ℂ) else 0 := by + fin_cases u <;> fin_cases v <;> norm_num [qmaPauli,pauliX,Equiv.swap_apply_def] + ext s t + rw [qmaSinglePauliWord_apply,hX] + change _ = if s = qmaBitFlip i t then (1:ℂ) else 0 + by_cases h : s = qmaBitFlip i t + · subst s + simp only [ite_true] + have he : qmaBitFlip i t i = Equiv.swap (0:Fin 2) 1 (t i) := by simp [qmaBitFlip] + rw [ite_eq_left he,one_mul] + apply Finset.prod_eq_one + intro k hk + simp [qmaBitFlip,(Finset.mem_erase.mp hk).1] + · rw [ite_eq_right h] + obtain ⟨k,hk⟩ := Function.ne_iff.mp h + by_cases hki : k = i + · subst k + have he : s i ≠ Equiv.swap (0:Fin 2) 1 (t i) := by simpa [qmaBitFlip] using hk + rw [ite_eq_right he,zero_mul] + · have he : s k ≠ t k := by simpa [qmaBitFlip,hki] using hk + rw [Finset.prod_eq_zero (Finset.mem_erase.mpr ⟨hki,Finset.mem_univ _⟩) + (ite_eq_right he),mul_zero] + +theorem qmaSinglePauliWord_Z (i : ι) : + qmaPauliWord (qmaSinglePauliWord i 3) = + Matrix.diagonal (fun s => if s i = 1 then (-1:ℂ) else 1) := by + have hZ (u v : Fin 2) : qmaPauli 3 u v = + if u = v then (if u = 1 then (-1:ℂ) else 1) else 0 := by + fin_cases u <;> fin_cases v <;> norm_num [qmaPauli,pauliZ] + ext s t + rw [qmaSinglePauliWord_apply,hZ,Matrix.diagonal_apply] + by_cases h : s = t + · subst t + simp + · rw [ite_eq_right h] + obtain ⟨k,hk⟩ := Function.ne_iff.mp h + by_cases hki : k = i + · subst k + rw [ite_eq_right hk,zero_mul] + · rw [Finset.prod_eq_zero (Finset.mem_erase.mpr ⟨hki,Finset.mem_univ _⟩) + (ite_eq_right hk),mul_zero] + +theorem qmaAncillaOccupation_pauli (i : ι) : qmaAncillaOccupation i = + (1/2:ℂ) • (1-qmaPauliWord (qmaSinglePauliWord i 3)) := by + rw [qmaSinglePauliWord_Z] + ext s t + by_cases h : s = t + · subst t + generalize hs : s i = v + fin_cases v <;> norm_num [qmaAncillaOccupation,Matrix.diagonal_apply,Matrix.one_apply,hs] + · simp [qmaAncillaOccupation,h] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliSplit.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliSplit.lean new file mode 100644 index 0000000000000000000000000000000000000000..1a39098d5b934c2ffb4a3e25907de83fc0b87ac0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliSplit.lean @@ -0,0 +1,90 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliLocal + +namespace OAI + +/-! Balanced disjoint factorizations for the two subdivision stages. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +def qmaPauliRestrict (S : Finset ι) (w : ι → Fin 4) : ι → Fin 4 := + fun i => if i ∈ S then w i else 0 + +theorem qmaPauliRestrict_support (S : Finset ι) (w : ι → Fin 4) : + qmaPauliSupport (qmaPauliRestrict S w) ⊆ S := by + intro i hi + by_contra h + simp [qmaPauliSupport,qmaPauliRestrict,h] at hi + +theorem qmaPauliRestrict_commute (S T : Finset ι) (w : ι → Fin 4) (hST : Disjoint S T) : + qmaPauliWord (qmaPauliRestrict S w)*qmaPauliWord (qmaPauliRestrict T w) = + qmaPauliWord (qmaPauliRestrict T w)*qmaPauliWord (qmaPauliRestrict S w) := by + apply qmaPauliWord_disjoint_commute + intro i + by_cases hi : i ∈ S + · right + have ht : i ∉ T := fun ht => Finset.disjoint_left.mp hST hi ht + simp [qmaPauliRestrict,ht] + · left + simp [qmaPauliRestrict,hi] + +theorem qmaPauliRestrict_factor (S T : Finset ι) (w : ι → Fin 4) + (hST : Disjoint S T) (hcover : qmaPauliSupport w ⊆ S ∪ T) : + qmaPauliWord (qmaPauliRestrict S w)*qmaPauliWord (qmaPauliRestrict T w) = qmaPauliWord w := by + ext s t + rw [qmaPauliWord_mul_apply] + apply Finset.prod_congr rfl + intro i _ + by_cases hs : i ∈ S + · have ht : i ∉ T := fun ht => Finset.disjoint_left.mp hST hs ht + simp [qmaPauliRestrict,hs,ht,qmaPauli_zero] + · by_cases ht : i ∈ T + · simp [qmaPauliRestrict,hs,ht,qmaPauli_zero] + · have hw : w i = 0 := by + by_contra h + have hm := hcover (show i ∈ qmaPauliSupport w by simp [qmaPauliSupport,h]) + simp [hs,ht] at hm + simp [qmaPauliRestrict,hs,ht,hw,qmaPauli_zero] + +omit [Fintype ι] in +theorem qmaBalancedSupport (S : Finset ι) (k : ℕ) (hS : S.card ≤ 2*k) : + ∃ L R : Finset ι, L.card ≤ k ∧ R.card ≤ k ∧ Disjoint L R ∧ L ∪ R = S := by + obtain ⟨L,hLS,hL⟩ := Finset.exists_subset_card_eq (s := S) (Nat.min_le_right k S.card) + refine ⟨L,S \ L,?_,?_,?_,?_⟩ + · rw [hL] + exact Nat.min_le_left _ _ + · rw [Finset.card_sdiff_of_subset hLS,hL] + omega + · exact Finset.disjoint_left.mpr (fun i hi hR => (Finset.mem_sdiff.mp hR).2 hi) + · ext i + constructor + · intro hi + rcases Finset.mem_union.mp hi with h | h + · exact hLS h + · exact (Finset.mem_sdiff.mp h).1 + · intro hi + by_cases hL : i ∈ L + · exact Finset.mem_union_left _ hL + · exact Finset.mem_union_right _ (Finset.mem_sdiff.mpr ⟨hi,hL⟩) + +theorem qmaPauliWord_balanced_factor (w : ι → Fin 4) (k : ℕ) + (hw : (qmaPauliSupport w).card ≤ 2*k) : + ∃ a b : ι → Fin 4, (qmaPauliSupport a).card ≤ k ∧ (qmaPauliSupport b).card ≤ k ∧ + qmaPauliWord a*qmaPauliWord b = qmaPauliWord w ∧ + qmaPauliWord a*qmaPauliWord b = qmaPauliWord b*qmaPauliWord a := by + obtain ⟨L,R,hL,hR,hLR,hcover⟩ := qmaBalancedSupport (qmaPauliSupport w) k hw + refine ⟨qmaPauliRestrict L w,qmaPauliRestrict R w, + (Finset.card_le_card (qmaPauliRestrict_support L w)).trans hL, + (Finset.card_le_card (qmaPauliRestrict_support R w)).trans hR,?_, + qmaPauliRestrict_commute L R w hLR⟩ + apply qmaPauliRestrict_factor L R w hLR + rw [hcover] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliSubdivision.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliSubdivision.lean new file mode 100644 index 0000000000000000000000000000000000000000..27db15e3f54e59cb1032556c81d5c08d0e2dc1c2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliSubdivision.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionHermitian + +namespace OAI + +/-! A simultaneous real subdivision step for bounded-support even-Y words. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +theorem qmaPauliSubdivision_exists (w : κ → ι → Fin 4) (J : κ → ℝ) {d : ℕ} + (hw : ∀ e, (qmaPauliSupport (w e)).card ≤ 2*d) + (hEven : ∀ e, Even (qmaPauliYCount (w e))) {N : ℝ} (hN : 1 ≤ N) : + ∃ G : (κ × Fin 4) → Matrix (ι ⊕ κ → Fin 2) (ι ⊕ κ → Fin 2) ℂ, + (∀ p, (G p).IsHermitian) ∧ (∀ p, QMAEntryParity false (G p)) ∧ + (∀ p, ∃ S : Finset (ι ⊕ κ), S.card ≤ d+1 ∧ QMALocalOn S (G p)) ∧ + |MediatorGraph.normalizedBottom (∑ p, G p)- + MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • qmaPauliWord (w e))| ≤ 1/N := by + choose L T hL hT hdis hcover using fun e => qmaBalancedSupport (qmaPauliSupport (w e)) d (hw e) + let A := fun e => qmaPauliWord (qmaPauliRestrict (L e) (w e)) + let B := fun e => qmaPauliWord (qmaPauliRestrict (T e) (w e)) + let m := fun e => decide (Odd (qmaPauliYCount (qmaPauliRestrict (L e) (w e)))) + let R := 8*(qmaThirdBudget 0 J)^4*N + let G := fun p : κ × Fin 4 => qmaSubdivisionLocalPiece (A p.1) (B p.1) p.1 R (J p.1) m p.2 + have hcover' (e : κ) : qmaPauliSupport (w e) ⊆ L e ∪ T e := by rw [hcover e] + have hAst (e : κ) : (A e).conjTranspose = A e := qmaPauliWord_hermitian _ + have hBst (e : κ) : (B e).conjTranspose = B e := qmaPauliWord_hermitian _ + have hAr (e : κ) : QMAEntryParity (m e) (A e) := qmaPauliWord_entryParity _ + have hBr (e : κ) : QMAEntryParity (m e) (B e) := by + dsimp only [m,B] + rw [qmaPauliRestrict_same_parity (L e) (T e) (w e) (hdis e) (hcover' e) (hEven e)] + exact qmaPauliWord_entryParity _ + have hAB (e : κ) : A e*B e = B e*A e := qmaPauliRestrict_commute _ _ _ (hdis e) + have hfactor (e : κ) : A e*B e = qmaPauliWord (w e) := + qmaPauliRestrict_factor _ _ _ (hdis e) (hcover' e) + have hAl (e : κ) : QMALocalOn (L e) (A e) := + (qmaPauliWord_support _).mono (qmaPauliRestrict_support _ _) + have hBl (e : κ) : QMALocalOn (T e) (B e) := + (qmaPauliWord_support _).mono (qmaPauliRestrict_support _ _) + refine ⟨G,?_,?_,?_,?_⟩ + · intro p + exact qmaSubdivisionLocalPiece_star _ _ _ _ _ _ (hAst p.1) (hBst p.1) p.2 + · intro p + exact qmaSubdivisionLocalPiece_real _ _ _ _ _ _ (hAr p.1) (hBr p.1) p.2 + · intro p + exact qmaSubdivisionLocalPiece_local _ _ _ _ _ _ (hAl p.1) (hBl p.1) (hL p.1) (hT p.1) p.2 + · have hsum : (∑ p, G p) = qmaSubdivisionOnQubits 0 A B R J m := by + unfold qmaSubdivisionOnQubits + rw [qmaSubdivisionPolarized_decomposition] + simp only [Matrix.zero_kronecker,zero_add,MediatorGraph.submatrix_sum, + qmaSubdivisionPiece_reindex,Fintype.sum_prod_type,G] + have htarget : qmaSubdivisionTarget 0 A B (fun e => (J e:ℂ)) = + ∑ e, (J e:ℂ) • qmaPauliWord (w e) := by + simp only [qmaSubdivisionTarget,zero_add,hfactor] + rw [hsum,qmaSubdivisionOnQubits_bottom,← htarget] + apply qmaSubdivision_polynomial_accuracy 0 A B J (by norm_num) hN + Matrix.conjTranspose_zero (by simp) hAst hBst + (fun e => qmaPauliWord_square _) (fun e => qmaPauliWord_square _) hAB + (EuclideanSpace.single (fun _ : ι => (0 : Fin 2)) (1:ℂ)) + simp [PiLp.norm_single] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliThird.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliThird.lean new file mode 100644 index 0000000000000000000000000000000000000000..d30b024ceabe4ce2ed3129ad7fc16e68668d49c1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliThird.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliTripleSplit +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdPhasedLocal + +namespace OAI + +/-! The actual phase-corrected third-order gadget reduces real three-local +Pauli families to real two-local families with inverse-polynomial error. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +theorem qmaPauliThird_exists (w : κ → ι → Fin 4) (J : κ → ℝ) + (hw : ∀ e, (qmaPauliSupport (w e)).card ≤ 3) + (hEven : ∀ e, Even (qmaPauliYCount (w e))) {N : ℝ} (hN : 1 ≤ N) : + ∃ G : (κ × Fin 7) → Matrix (ι ⊕ κ → Fin 2) (ι ⊕ κ → Fin 2) ℂ, + (∀ p, (G p).IsHermitian) ∧ (∀ p, QMAEntryParity false (G p)) ∧ + (∀ p, ∃ S : Finset (ι ⊕ κ), S.card ≤ 2 ∧ QMALocalOn S (G p)) ∧ + |MediatorGraph.normalizedBottom (∑ p, G p)- + MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • qmaPauliWord (w e))| ≤ 1/N := by + choose a b c ha hb hc habc hab hac hbc hpar hce using + fun e => qmaPauliWord_triple_factor (w e) (hw e) (hEven e) + let A := fun e => qmaPauliWord (a e) + let B := fun e => qmaPauliWord (b e) + let C := fun e => qmaPauliWord (c e) + let m := fun e => decide (Odd (qmaPauliYCount (a e))) + let R := 8*(qmaThirdBudget 0 J)^4*N + let G := fun p : κ × Fin 7 => qmaThirdPhasedLocalPiece (A p.1) (B p.1) (C p.1) p.1 R (J p.1) m p.2 + have hAst (e : κ) : (A e).conjTranspose = A e := qmaPauliWord_hermitian _ + have hBst (e : κ) : (B e).conjTranspose = B e := qmaPauliWord_hermitian _ + have hCst (e : κ) : (C e).conjTranspose = C e := qmaPauliWord_hermitian _ + have hAr (e : κ) : QMAEntryParity (m e) (A e) := qmaPauliWord_entryParity _ + have hBr (e : κ) : QMAEntryParity (m e) (B e) := by + dsimp only [m,B] + rw [hpar e] + exact qmaPauliWord_entryParity _ + have hCr (e : κ) : QMAEntryParity false (C e) := qmaPauliWord_real_of_even _ (hce e) + refine ⟨G,?_,?_,?_,?_⟩ + · intro p + exact qmaThirdPhasedLocalPiece_star _ _ _ _ _ _ _ (hAst p.1) (hBst p.1) (hCst p.1) (hab p.1) p.2 + · intro p + exact qmaThirdPhasedLocalPiece_real _ _ _ _ _ _ _ (hAr p.1) (hBr p.1) (hCr p.1) p.2 + · intro p + exact qmaThirdPhasedLocalPiece_two_local _ _ _ _ _ _ _ + (qmaPauliWord_support (a p.1)) (qmaPauliWord_support (b p.1)) (qmaPauliWord_support (c p.1)) + (ha p.1) (hb p.1) (hc p.1) p.2 + · have hsum : (∑ p, G p) = (qmaThirdPhased 0 A B C R J m).submatrix + (Equiv.sumArrowEquivProdArrow ι κ (Fin 2)) (Equiv.sumArrowEquivProdArrow ι κ (Fin 2)) := by + rw [qmaThirdPhased_decomposition] + simp only [Matrix.zero_kronecker,zero_add,MediatorGraph.submatrix_sum, + Fintype.sum_prod_type,G,qmaThirdPhasedLocalPiece] + have htarget : qmaThirdSeriesTarget 0 A B C (fun e => (J e:ℂ)) = + ∑ e, (J e:ℂ) • qmaPauliWord (w e) := by + simp only [qmaThirdSeriesTarget,zero_add,A,B,C,habc] + rw [hsum,MediatorGraph.normalizedBottom_reindex,qmaThirdPhased_bottom,← htarget] + apply qmaThirdGadget_polynomial_accuracy 0 A B C J (by norm_num) hN + Matrix.conjTranspose_zero (by simp) hAst hBst hCst + (fun e => qmaPauliWord_square _) (fun e => qmaPauliWord_square _) (fun e => qmaPauliWord_square _) + hab hac hbc (EuclideanSpace.single (fun _ : ι => (0 : Fin 2)) (1:ℂ)) + simp [PiLp.norm_single] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliTripleSplit.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliTripleSplit.lean new file mode 100644 index 0000000000000000000000000000000000000000..b6c45ac82ccbc72286c12fb0afc69a896da9bc99 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPauliTripleSplit.lean @@ -0,0 +1,108 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEntryParity + +namespace OAI + +/-! Every real three-local Pauli word splits into one real factor and two +single-site factors of the same entry parity. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +omit [Fintype ι] in +theorem qmaPauliRestrict_restrict (L S : Finset ι) (w : ι → Fin 4) (hL : L ⊆ S) : + qmaPauliRestrict L (qmaPauliRestrict S w) = qmaPauliRestrict L w := by + funext i + by_cases hi : i ∈ L + · simp [qmaPauliRestrict,hi,hL hi] + · simp [qmaPauliRestrict,hi] + +omit [DecidableEq ι] in +theorem qmaPauliYCount_zero (w : ι → Fin 4) (h : ∀ i, w i ≠ 2) : qmaPauliYCount w = 0 := by + simp [qmaPauliYCount,h] + +theorem qmaThreeSupport_split (w : ι → Fin 4) (hw : (qmaPauliSupport w).card ≤ 3) + (he : Even (qmaPauliYCount w)) : + ∃ P C : Finset ι, P.card ≤ 2 ∧ C.card ≤ 1 ∧ Disjoint P C ∧ + P ∪ C = qmaPauliSupport w ∧ ∀ i ∈ C, w i ≠ 2 := by + let S := qmaPauliSupport w + by_cases hS : S.card ≤ 2 + · exact ⟨S,∅,hS,by simp,by simp,by simp [S],by simp⟩ + · have hcard : S.card = 3 := by change S.card ≤ 3 at hw; omega + have hreal : ∃ i ∈ S, w i ≠ 2 := by + by_contra hn + have hall : ∀ i ∈ S, w i = 2 := by simpa using hn + have hf : Finset.univ.filter (fun i => w i = 2) = S := by + ext i + constructor + · intro hi + have hi2 := (Finset.mem_filter.mp hi).2 + simp [S,qmaPauliSupport,hi2] + · intro hi + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,hall i hi⟩ + have hc : qmaPauliYCount w = 3 := by rw [qmaPauliYCount,hf,hcard] + rw [hc] at he + norm_num at he + obtain ⟨i,hi,hi2⟩ := hreal + refine ⟨S \ {i},{i},?_,by simp,?_,?_,?_⟩ + · rw [Finset.card_sdiff_of_subset (by simpa using hi),Finset.card_singleton,hcard] + · exact Finset.disjoint_left.mpr (fun j hj hc => (Finset.mem_sdiff.mp hj).2 hc) + · exact Finset.sdiff_union_of_subset (by simpa using hi) + · intro j hj + simpa only [Finset.mem_singleton.mp hj] using hi2 + +theorem qmaPauliWord_triple_factor (w : ι → Fin 4) (hw : (qmaPauliSupport w).card ≤ 3) + (he : Even (qmaPauliYCount w)) : + ∃ a b c : ι → Fin 4, + (qmaPauliSupport a).card ≤ 1 ∧ (qmaPauliSupport b).card ≤ 1 ∧ (qmaPauliSupport c).card ≤ 1 ∧ + qmaPauliWord a*qmaPauliWord b*qmaPauliWord c = qmaPauliWord w ∧ + qmaPauliWord a*qmaPauliWord b = qmaPauliWord b*qmaPauliWord a ∧ + qmaPauliWord a*qmaPauliWord c = qmaPauliWord c*qmaPauliWord a ∧ + qmaPauliWord b*qmaPauliWord c = qmaPauliWord c*qmaPauliWord b ∧ + decide (Odd (qmaPauliYCount a)) = decide (Odd (qmaPauliYCount b)) ∧ + Even (qmaPauliYCount c) := by + obtain ⟨P,C,hP,hC,hPC,hcover,hnoY⟩ := qmaThreeSupport_split w hw he + obtain ⟨L,T,hL,hT,hLT,hunion⟩ := qmaBalancedSupport P 1 (by omega) + have hLP : L ⊆ P := by rw [← hunion]; exact Finset.subset_union_left + have hTP : T ⊆ P := by rw [← hunion]; exact Finset.subset_union_right + let a := qmaPauliRestrict L w + let b := qmaPauliRestrict T w + let c := qmaPauliRestrict C w + let v := qmaPauliRestrict P w + have hc : qmaPauliYCount c = 0 := by + apply qmaPauliYCount_zero + intro i + by_cases hi : i ∈ C + · simpa only [c,qmaPauliRestrict,hi,ite_true] using hnoY i hi + · simp [c,qmaPauliRestrict,hi] + have hvcover : qmaPauliSupport v ⊆ L ∪ T := by + rw [hunion] + exact qmaPauliRestrict_support P w + have hv : Even (qmaPauliYCount v) := by + have hs := qmaPauliYCount_split P C w hPC (by rw [hcover]) + change qmaPauliYCount v+qmaPauliYCount c = qmaPauliYCount w at hs + rw [hc,add_zero] at hs + rwa [hs] + have hab : qmaPauliWord a*qmaPauliWord b = qmaPauliWord v := by + have h := qmaPauliRestrict_factor L T v hLT hvcover + simpa only [v,qmaPauliRestrict_restrict L P w hLP,qmaPauliRestrict_restrict T P w hTP] using h + refine ⟨a,b,c,(Finset.card_le_card (qmaPauliRestrict_support L w)).trans hL, + (Finset.card_le_card (qmaPauliRestrict_support T w)).trans hT, + (Finset.card_le_card (qmaPauliRestrict_support C w)).trans hC,?_, + qmaPauliRestrict_commute L T w hLT, + qmaPauliRestrict_commute L C w (hPC.mono_left hLP), + qmaPauliRestrict_commute T C w (hPC.mono_left hTP),?_,?_⟩ + · rw [hab] + exact qmaPauliRestrict_factor P C w hPC (by rw [hcover]) + · have h := qmaPauliRestrict_same_parity L T v hLT hvcover hv + simpa only [v,qmaPauliRestrict_restrict L P w hLP,qmaPauliRestrict_restrict T P w hTP] using h + · rw [hc] + norm_num + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPermittedEndpointAvoidance.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPermittedEndpointAvoidance.lean new file mode 100644 index 0000000000000000000000000000000000000000..4b37c6180db2011ceaf9efcf45b9d08476ba471d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPermittedEndpointAvoidance.lean @@ -0,0 +1,36 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPermittedRouteSeparation + +namespace OAI + +/-! An interior point of a permitted path cannot be an endpoint of any other +permitted path, including catalog paths not present in the Hamiltonian. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical +namespace QMAPortRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + +theorem permitted_avoids_source + (havoid : ∀ i : P.Interior, ∀ v, P.cell i ≠ P.position v) + (R S : QMACellRoute) (hR : P.RoutingAllowed R.body) (hS : P.RoutingAllowed S.body) + (hvR : R.Valid) (hvS : S.Valid) : S.source ∉ (R.path.drop 1).dropLast := by + intro hz + have hne : R.endpointPair ≠ S.endpointPair := by + intro h + rcases Sym2.eq_iff.mp h with ⟨ha,_⟩ | ⟨_,ha⟩ + · exact qmaListInterior_ne_head (R.simple hvR) R.endpoints.1 hz ha.symm + · exact qmaListInterior_ne_last (R.simple hvR) R.endpoints.2 hz ha.symm + have hSpath : S.source ∈ S.path := by + obtain ⟨t,ht⟩ := List.head?_eq_some_iff.mp S.endpoints.1 + rw [ht] + exact List.mem_cons_self + exact Finset.disjoint_left.mp (P.permitted_routes_disjoint havoid R S hR hS hvR hvS hne) + (List.mem_toFinset.mpr hz) (List.mem_toFinset.mpr hSpath) + +end QMAPortRouteData +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPermittedRouteSeparation.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPermittedRouteSeparation.lean new file mode 100644 index 0000000000000000000000000000000000000000..01da571b6913c5780bf91f85884919dad4184dee --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPermittedRouteSeparation.lean @@ -0,0 +1,74 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCorridorSeparation +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumMergedEndpointPairs + +namespace OAI + +/-! The complete permitted catalog is planar: different unordered physical +endpoint pairs have disjoint path interiors. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +theorem qmaCellBody_cases (R : QMACellRouteBody) : + (∃ p e, R = qmaInternalBody p e) ∨ ∃ p a b c, R = .corridor p a b c := by + cases R with + | ray p a => exact Or.inl ⟨p,.inl a,rfl⟩ + | pair p e => exact Or.inl ⟨p,.inr (.inl e),rfl⟩ + | patch p e => exact Or.inl ⟨p,.inr (.inr e),rfl⟩ + | corridor p a b c => exact Or.inr ⟨p,a,b,c,rfl⟩ + +namespace QMAPortRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + +theorem permitted_bodies_disjoint + (havoid : ∀ i : P.Interior, ∀ v, P.cell i ≠ P.position v) + (R S : QMACellRouteBody) (hR : P.RoutingAllowed R) (hS : P.RoutingAllowed S) + (hvR : R.Valid) (hvS : S.Valid) + (hne : s(R.source,R.target) ≠ s(S.source,S.target)) : + Disjoint ((R.path.drop 1).dropLast).toFinset S.path.toFinset := by + rcases qmaCellBody_cases R with ⟨p,e,rfl⟩ | ⟨p,a,b,c,rfl⟩ + · rcases qmaCellBody_cases S with ⟨q,f,rfl⟩ | ⟨q,d,f,g,rfl⟩ + · have hneq : p ≠ q ∨ e ≠ f := by + by_cases hp : p = q + · right + intro he + apply hne + rw [hp,he] + · exact Or.inl hp + exact P.internal_bodies_disjoint havoid p q e f hneq hR hS + · exact P.internal_corridor_disjoint p q e d f g hR hS + · rcases qmaCellBody_cases S with ⟨q,e,rfl⟩ | ⟨q,d,f,g,rfl⟩ + · exact P.corridor_internal_disjoint p q a b c e hvR hR hS + · have hd := P.corridors_disjoint p q a d b c f g hvR hvS hR hS hne + apply Finset.disjoint_left.mpr + intro z hz hw + apply Finset.disjoint_left.mp hd _ hw + exact List.mem_toFinset.mpr + (List.mem_of_mem_drop (List.mem_of_mem_dropLast (List.mem_toFinset.mp hz))) + +theorem permitted_routes_disjoint + (havoid : ∀ i : P.Interior, ∀ v, P.cell i ≠ P.position v) + (R S : QMACellRoute) (hR : P.RoutingAllowed R.body) (hS : P.RoutingAllowed S.body) + (hvR : R.Valid) (hvS : S.Valid) (hne : R.endpointPair ≠ S.endpointPair) : + Disjoint ((R.path.drop 1).dropLast).toFinset S.path.toFinset := by + rw [qmaRoute_interior_finset,qmaRoute_path_finset] + apply P.permitted_bodies_disjoint havoid R.body S.body hR hS hvR hvS + simpa only [QMACellRoute.endpointPair_body] using hne + +theorem mergedOutputRoute_disjoint (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) + (havoid : ∀ i : P.Interior, ∀ v, P.cell i ≠ P.position v) + (e f : (P.crossingOutput N hD).merge.Edge) (hef : e ≠ f) : + Disjoint (((P.mergedOutputRoute N hD havoid e).path.drop 1).dropLast).toFinset + (P.mergedOutputRoute N hD havoid f).path.toFinset := by + have he := P.mergedOutputRoute_spec N hD havoid e + have hf := P.mergedOutputRoute_spec N hD havoid f + exact P.permitted_routes_disjoint havoid _ _ he.1 hf.1 he.2.1 hf.2.1 + ((P.mergedOutputRoute_pairs_injective N hD havoid).ne hef) + +end QMAPortRouteData +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPhysicalCells.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPhysicalCells.lean new file mode 100644 index 0000000000000000000000000000000000000000..6f2308aaf307407fcfbc510da20224162aae7263 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPhysicalCells.lean @@ -0,0 +1,98 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPhysicalEndpointCover +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCellRouteSupport + +namespace OAI + +/-! Every physical spin retains the coarse cell of an original route point. +This transfers the original positive-coordinate and rectangle bounds. -/ + +noncomputable section +namespace ContinuumCoulomb +open MediatorGraph +open scoped Classical + +@[simp] theorem qmaPointCell_inner (p : ℕ × ℕ) (a : Fin 4) : + qmaPointCell (qmaInnerPort p a) = p := qmaInnerPort_cell p a + +@[simp] theorem qmaPointCell_ancilla (p : ℕ × ℕ) (a : Fin 2) : + qmaPointCell (qmaGadgetAncilla p a) = p := qmaGadgetAncilla_cell p a + +theorem qmaCrossingMove_cell (cross : (ℕ × ℕ) → Prop) [DecidablePred cross] + {z : ℕ × ℕ} (hz : QMAPortPoint z) : qmaPointCell (qmaCrossingMove cross z) = qmaPointCell z := by + rcases hz with ⟨p,rfl⟩ | ⟨p,a,rfl⟩ + · rw [qmaCrossingMove_center] + · rw [qmaCrossingMove_port,qmaPointCell_port] + split_ifs <;> simp only [qmaPointCell_inner,qmaPointCell_port] + +namespace QMAPortRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + +theorem chain_cell_property (Q : (ℕ × ℕ) → Prop) + (hQ : ∀ e k, k ≤ P.length e → Q (P.point e k)) + (e : G.Edge) (k : ℕ) (hk : k ≤ 2*P.length e+1) : + Q (qmaPointCell (qmaPortChain (P.point e) (P.length e) k)) := by + by_cases h0 : k = 0 + · subst k + simpa only [qmaPortChain_zero,qmaPointCell_center] using hQ e 0 (Nat.zero_le _) + by_cases hlast : k = 2*P.length e+1 + · subst k + simpa only [qmaPortChain_last,qmaPointCell_center] using hQ e (P.length e) le_rfl + rw [qmaPortChain_inner (P.point e) (by omega) (by omega)] + change Q (qmaPointCell (qmaGridPort (P.point e (k/2)) _)) + rw [qmaPointCell_port] + exact hQ e (k/2) (by omega) + +theorem finished_cell_property (Q : (ℕ × ℕ) → Prop) + (hsource : ∀ v, Q (P.position v)) (hpath : ∀ e k, k ≤ P.length e → Q (P.point e k)) + (N : ℚ) (D : ℕ) (v : Fin (P.finishedGraph N D).n) : Q (qmaPointCell (P.finishedPosition N D v)) := by + have h := P.toEmbedding.iterate_occupied_source N D (Or.inl ⟨v,rfl⟩) + rcases h with ⟨w,hw⟩ | ⟨e,k,hk,he⟩ + · change qmaExpandedPoint (P.position w) = P.finishedPosition N D v at hw + rw [← hw,qmaPointCell_center] + exact hsource w + · change qmaPortChain (P.point e) (P.length e) k = P.finishedPosition N D v at he + rw [← he] + exact P.chain_cell_property Q hpath e k hk + +theorem crossingPosition_cell_property (Q : (ℕ × ℕ) → Prop) + (hsource : ∀ v, Q (P.position v)) (hpath : ∀ e k, k ≤ P.length e → Q (P.point e k)) + (N : ℚ) (D : ℕ) (v : Fin ((P.finishedGraph N D).n+P.crossingCells.card*2)) : + Q (qmaPointCell (P.crossingPosition N D v)) := by + obtain ⟨v,rfl⟩ := (vertexEquiv (P.finishedGraph N D).n P.crossingCells.card).surjective v + rcases v with v | ⟨i,a⟩ + · change Q (qmaPointCell (P.crossingPosition N D (old _ _ v))) + rw [P.crossingPosition_old] + change Q (qmaPointCell (qmaCrossingMove P.IsCrossing (P.finishedPosition N D v))) + have hv : QMAPortPoint (P.finishedPosition N D v) := P.iterate_position_kind N D v + rw [qmaCrossingMove_cell P.IsCrossing hv] + exact P.finished_cell_property Q hsource hpath N D v + · change Q (qmaPointCell (P.crossingPosition N D (fresh _ _ i a))) + rw [P.crossingPosition_fresh] + change Q (qmaPointCell (qmaGadgetAncilla (P.crossingCell i).val a)) + rw [qmaPointCell_ancilla] + obtain ⟨j,k,hjk,hj,hk,hpair⟩ := P.mem_crossingCells.mp (P.crossingCell i).property + rw [← hj] + exact hpath j.1 (j.2.val+1) (P.cell_index_lt j).le + +theorem crossingPosition_positive + (hsource : ∀ v, 0 < (P.position v).1 ∧ 0 < (P.position v).2) + (N : ℚ) (D : ℕ) (v : Fin ((P.finishedGraph N D).n+P.crossingCells.card*2)) : + 0 < (qmaPointCell (P.crossingPosition N D v)).1 ∧ + 0 < (qmaPointCell (P.crossingPosition N D v)).2 := + P.crossingPosition_cell_property (fun p => 0 < p.1 ∧ 0 < p.2) hsource P.positive N D v + +theorem crossingPosition_bounded {X Y : ℕ} + (hsource : ∀ v, (P.position v).1 < X ∧ (P.position v).2 < Y) + (hpath : ∀ e k, k ≤ P.length e → (P.point e k).1 < X ∧ (P.point e k).2 < Y) + (N : ℚ) (D : ℕ) (v : Fin ((P.finishedGraph N D).n+P.crossingCells.card*2)) : + (P.crossingPosition N D v).1 < 32*X ∧ (P.crossingPosition N D v).2 < 32*Y := by + have h := P.crossingPosition_cell_property (fun p => p.1 < X ∧ p.2 < Y) hsource hpath N D v + change (P.crossingPosition N D v).1/32 < X ∧ (P.crossingPosition N D v).2/32 < Y at h + omega + +end QMAPortRouteData +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPhysicalEndpointCover.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPhysicalEndpointCover.lean new file mode 100644 index 0000000000000000000000000000000000000000..9965005b54c925c78deedec56c8cc33cc8f8ea42 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPhysicalEndpointCover.lean @@ -0,0 +1,78 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPermittedEndpointAvoidance + +namespace OAI + +/-! Every physical spin is an endpoint of a permitted catalog path. This also +covers isolated source spins and supplies the no-interior-spin condition. -/ + +noncomputable section +namespace ContinuumCoulomb +open MediatorGraph +open scoped Classical + +theorem qmaPatchRoute_source_ancilla (p : ℕ × ℕ) : + (qmaPatchRoute p 0).source = qmaGadgetAncilla p 0 := by + change (32*p.1+10+4,32*p.2+10+8) = (32*p.1+14,32*p.2+18) + apply Prod.ext <;> omega + +theorem qmaPatchRoute_target_ancilla (p : ℕ × ℕ) : + (qmaPatchRoute p 0).target = qmaGadgetAncilla p 1 := by + change (32*p.1+10+8,32*p.2+10+4) = (32*p.1+18,32*p.2+14) + apply Prod.ext <;> omega + +namespace QMAPortRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + +theorem physical_endpoint_cover (N : ℚ) (D : ℕ) + (havoid : ∀ i : P.Interior, ∀ v, P.cell i ≠ P.position v) + (v : Fin ((P.finishedGraph N D).n+P.crossingCells.card*2)) : + ∃ R : QMACellRoute, P.RoutingAllowed R.body ∧ R.Valid ∧ R.source = P.crossingPosition N D v := by + obtain ⟨v,rfl⟩ := (vertexEquiv (P.finishedGraph N D).n P.crossingCells.card).surjective v + rcases v with v | ⟨i,a⟩ + · change ∃ R : QMACellRoute, P.RoutingAllowed R.body ∧ R.Valid ∧ + R.source = P.crossingPosition N D (old _ _ v) + rw [P.crossingPosition_old] + rcases P.iterate_position_kind N D v with ⟨p,hp⟩ | ⟨p,a,hp⟩ + · change P.finishedPosition N D v = qmaExpandedPoint p at hp + have hs := P.finished_center_source N D v hp + have hn : ¬P.IsCrossing p := by + obtain ⟨w,rfl⟩ := hs + exact P.source_not_crossing havoid w + refine ⟨⟨.ray p 0,false⟩,⟨hs,hn⟩,trivial,?_⟩ + change qmaExpandedPoint p = qmaCrossingMove P.IsCrossing (P.finishedPosition N D v) + rw [hp,qmaCrossingMove_center] + · change P.finishedPosition N D v = qmaGridPort p a at hp + have hpos := P.finished_port_cell_positive N D v hp + let b := decide (P.IsCrossing p) + let c := decide (P.IsCrossing (qmaGridNeighbor p a)) + refine ⟨⟨.corridor p a b c,false⟩,⟨rfl,rfl⟩,hpos,?_⟩ + change qmaCellTranslate p (qmaLocalPort b a) = + qmaCrossingMove P.IsCrossing (P.finishedPosition N D v) + rw [hp,qmaCrossingMove_port] + exact (qmaMovedPort_local P.IsCrossing p a).symm + · change ∃ R : QMACellRoute, P.RoutingAllowed R.body ∧ R.Valid ∧ + R.source = P.crossingPosition N D (fresh _ _ i a) + rw [P.crossingPosition_fresh] + have hc : P.IsCrossing (P.crossingCell i).val := + P.mem_crossingCells.mp (P.crossingCell i).property + fin_cases a + · exact ⟨qmaPatchRoute (P.crossingCell i).val 0,hc,trivial,qmaPatchRoute_source_ancilla _⟩ + · refine ⟨(qmaPatchRoute (P.crossingCell i).val 0).reverse,hc,trivial,?_⟩ + rw [QMACellRoute.reverse_source] + exact qmaPatchRoute_target_ancilla _ + +theorem mergedOutputRoute_avoids (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) + (havoid : ∀ i : P.Interior, ∀ v, P.cell i ≠ P.position v) + (e : (P.crossingOutput N hD).merge.Edge) (v : Fin (P.crossingOutput N hD).n) : + P.crossingPosition N D v ∉ ((P.mergedOutputRoute N hD havoid e).path.drop 1).dropLast := by + obtain ⟨R,hR,hv,hpos⟩ := P.physical_endpoint_cover N D havoid v + rw [← hpos] + have he := P.mergedOutputRoute_spec N hD havoid e + exact P.permitted_avoids_source havoid _ R he.1 hR he.2.1 hv + +end QMAPortRouteData +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPinnedClock.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPinnedClock.lean new file mode 100644 index 0000000000000000000000000000000000000000..04862dd7503684285f596ab9092fdbc10d030716 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPinnedClock.lean @@ -0,0 +1,88 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnaryPenalty + +namespace OAI + +/-! Two fixed end bits make all clock transitions uniform, including the +empty circuit. Only adjacent-pair and endpoint penalties are used. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +def qmaHistoryClock (T : ℕ) (t : Fin (T+1)) : SourceSpinBasis (T+2) := + qmaUnaryClock (T+2) ⟨t.val+1,by omega⟩ + +def QMALegalClock (T : ℕ) (s : SourceSpinBasis (T+2)) : Prop := + Antitone s ∧ s 0 = 1 ∧ s (Fin.last (T+1)) = 0 + +theorem qmaHistoryClock_injective (T : ℕ) : Function.Injective (qmaHistoryClock T) := by + intro s t h + have he := qmaUnaryClock_injective (T+2) h + apply Fin.ext + have hv := congrArg Fin.val he + simpa using hv + +theorem qmaHistoryClock_legal (T : ℕ) (t : Fin (T+1)) : + QMALegalClock T (qmaHistoryClock T t) := by + refine ⟨qmaUnaryClock_antitone _ _,?_,?_⟩ + · simp [qmaHistoryClock,qmaUnaryClock] + · have ht : ¬T+1 < t.val+1 := by omega + simpa [qmaHistoryClock,qmaUnaryClock] using ht + +theorem qmaHistoryClock_of_legal (T : ℕ) (s : SourceSpinBasis (T+2)) + (hs : QMALegalClock T s) : ∃ t : Fin (T+1), qmaHistoryClock T t = s := by + obtain ⟨k,hk⟩ := qmaUnaryClock_of_antitone (T+2) s hs.1 + have hl := hs.2.1 + have hr := hs.2.2 + rw [←hk] at hl hr + have hk0 : 0 < k.val := by + by_contra hn + have hz : k.val = 0 := by omega + simp [qmaUnaryClock,hz] at hl + have hk1 : k.val ≤ T+1 := by + by_contra hn + have ht : T+1 < k.val := by omega + simp [qmaUnaryClock,ht] at hr + refine ⟨⟨k.val-1,by omega⟩,?_⟩ + unfold qmaHistoryClock + have he : (⟨k.val-1+1,by omega⟩ : Fin (T+2+1)) = k := by + apply Fin.ext + change k.val-1+1 = k.val + omega + rw [he] + exact hk + +def qmaPinnedClockPenalty (T : ℕ) (s : SourceSpinBasis (T+2)) : ℝ := + qmaClockFaultCount (T+2) s+ + (if s 0 = 1 then 0 else 1)+(if s (Fin.last (T+1)) = 0 then 0 else 1) + +theorem qmaPinnedClockPenalty_nonneg (T : ℕ) (s : SourceSpinBasis (T+2)) : + 0 ≤ qmaPinnedClockPenalty T s := by + unfold qmaPinnedClockPenalty + have h := qmaClockFaultCount_nonneg (T+2) s + positivity + +theorem qmaPinnedClockPenalty_zero (T : ℕ) (s : SourceSpinBasis (T+2)) + (hs : QMALegalClock T s) : qmaPinnedClockPenalty T s = 0 := by + simp [qmaPinnedClockPenalty,qmaClockFaultCount_zero _ _ hs.1,hs.2.1,hs.2.2] + +theorem qmaPinnedClockPenalty_one_le (T : ℕ) (s : SourceSpinBasis (T+2)) + (hs : ¬QMALegalClock T s) : 1 ≤ qmaPinnedClockPenalty T s := by + have hn := qmaClockFaultCount_nonneg (T+2) s + by_cases ha : Antitone s + · by_cases hl : s 0 = 1 + · have hr : s (Fin.last (T+1)) ≠ 0 := fun h => hs ⟨ha,hl,h⟩ + simp only [qmaPinnedClockPenalty,ite_eq_left hl,ite_eq_right hr,add_zero] + linarith + · unfold qmaPinnedClockPenalty + rw [ite_eq_right hl] + split <;> linarith + · have h := qmaClockFaultCount_one_le (T+2) s ha + unfold qmaPinnedClockPenalty + split <;> split <;> linarith + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarDegree.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarDegree.lean new file mode 100644 index 0000000000000000000000000000000000000000..6a51f14418dc27460eb92ea1094f53b8b2f33d7b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarDegree.lean @@ -0,0 +1,86 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPlanarRouteData +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingSelection + +namespace OAI + +/-! Disjoint lattice routes bound the actual edge-incidence degree by the four +available lattice directions, including edges whose orientation points inward. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators Classical +namespace QMAPlanarRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPlanarRouteData G) + +abbrev Incident (_P : QMAPlanarRouteData G) (v : Fin G.n) := {e : G.Edge // G.left e = v ∨ G.right e = v} + +def incidentNear (v : Fin G.n) (e : P.Incident v) : ℕ × ℕ := + if G.left e.val = v then P.point e.val 1 else P.point e.val (P.length e.val-1) + +theorem incident_segment (v : Fin G.n) (e : P.Incident v) : + ∃ k, k < P.length e.val ∧ + ((P.point e.val k = P.position v ∧ P.point e.val (k+1) = P.incidentNear v e) ∨ + (P.point e.val k = P.incidentNear v e ∧ P.point e.val (k+1) = P.position v)) := by + by_cases h : G.left e.val = v + · refine ⟨0,P.length_pos e.val,Or.inl ⟨?_,?_⟩⟩ + · rw [P.first,h] + · simp only [incidentNear,h,ite_true] + · have hr := e.property.resolve_left h + have hpos := P.length_pos e.val + have hlast : P.length e.val-1+1 = P.length e.val := by omega + refine ⟨P.length e.val-1,by omega,Or.inr ⟨?_,?_⟩⟩ + · simp only [incidentNear,h,ite_false] + · rw [hlast,P.last,hr] + +theorem incident_position_positive (v : Fin G.n) (e : P.Incident v) : + 0 < (P.position v).1 ∧ 0 < (P.position v).2 := by + rcases e.property with h | h + · simpa only [P.first,h] using P.positive e.val 0 (Nat.zero_le _) + · simpa only [P.last,h] using P.positive e.val (P.length e.val) le_rfl + +theorem incident_adjacent (v : Fin G.n) (e : P.Incident v) : + qmaSquareGrid.Adj (P.position v) (P.incidentNear v e) := by + obtain ⟨k,hk,h⟩ := P.incident_segment v e + have hs := P.step e.val k hk + rcases h with ⟨h0,h1⟩ | ⟨h0,h1⟩ + · simpa only [h0,h1] using hs + · simpa only [h0,h1] using hs.symm + +theorem incidentNear_injective (v : Fin G.n) : Function.Injective (P.incidentNear v) := by + intro e f heq + by_contra hef + have hef' : e.val ≠ f.val := fun h => hef (Subtype.ext h) + obtain ⟨i,hi,hei⟩ := P.incident_segment v e + obtain ⟨j,hj,hfj⟩ := P.incident_segment v f + have hd := P.edges_disjoint e.val f.val hef' i j hi hj + rcases hei with ⟨h0,h1⟩ | ⟨h0,h1⟩ <;> rcases hfj with ⟨g0,g1⟩ | ⟨g0,g1⟩ + · exact hd.1 ⟨h0.trans g0.symm,h1.trans (heq.trans g1.symm)⟩ + · exact hd.2 ⟨h0.trans g1.symm,h1.trans (heq.trans g0.symm)⟩ + · exact hd.2 ⟨h0.trans (heq.trans g1.symm),h1.trans g0.symm⟩ + · exact hd.1 ⟨h0.trans (heq.trans g0.symm),h1.trans g1.symm⟩ + +def incidentDirection (v : Fin G.n) (e : P.Incident v) : Fin 4 := + qmaGridNeighborIndex (P.position v) (P.incidentNear v e) + +theorem incidentDirection_injective (v : Fin G.n) : Function.Injective (P.incidentDirection v) := by + intro e f h + apply P.incidentNear_injective v + have hp := P.incident_position_positive v e + have hh := congrArg (qmaGridNeighbor (P.position v)) h + exact (qmaGridNeighborIndex_spec hp.1 hp.2 (P.incident_adjacent v e)).symm.trans + (hh.trans (qmaGridNeighborIndex_spec hp.1 hp.2 (P.incident_adjacent v f))) + +include P in +theorem degree_le_four (v : Fin G.n) : qmaGraphDegree G.left G.right v ≤ 4 := by + have hcard := Fintype.card_le_of_injective (P.incidentDirection v) (P.incidentDirection_injective v) + have heq : Fintype.card (P.Incident v) = qmaGraphDegree G.left G.right v := by + rw [Fintype.card_eq_sum_ones] + exact qmaSumSubtypePredicate (fun e => G.left e = v ∨ G.right e = v) (fun _ => (1 : ℕ)) + simpa only [heq,Fintype.card_fin] using hcard + +end QMAPlanarRouteData +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarListData.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarListData.lean new file mode 100644 index 0000000000000000000000000000000000000000..a2d87d420911dfdca649ec8fde235d2397332ec0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarListData.lean @@ -0,0 +1,106 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPlanarRouteData +import Mathlib.Data.List.GetD + +namespace OAI + +/-! Convert the concrete finite cell paths to the coordinate-array interface used +by the fixed-round physical subdivision theorem. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +structure QMAPlanarListData (G : QMARationalExchangeGraph) where + position : Fin G.n → ℕ × ℕ + position_injective : Function.Injective position + path : G.Edge → List (ℕ × ℕ) + length : ∀ e, 3 ≤ (path e).length + first : ∀ e, (path e).head? = some (position (G.left e)) + last : ∀ e, (path e).getLast? = some (position (G.right e)) + simple : ∀ e, (path e).Nodup + step : ∀ e, (path e).IsChain (fun p q => qmaSquareGrid.Adj p q) + positive : ∀ e p, p ∈ path e → 0 < p.1 ∧ 0 < p.2 + avoids : ∀ e v, position v ∉ ((path e).drop 1).dropLast + disjoint : ∀ e f, e ≠ f → + Disjoint (((path e).drop 1).dropLast).toFinset (path f).toFinset + +namespace QMAPlanarListData +variable {G : QMARationalExchangeGraph} (P : QMAPlanarListData G) + +def point (e : G.Edge) (k : ℕ) : ℕ × ℕ := (P.path e).getD k (0,0) + +theorem point_get (e : G.Edge) {k : ℕ} (hk : k < (P.path e).length) : + P.point e k = (P.path e)[k] := List.getD_eq_getElem _ _ hk + +theorem point_mem (e : G.Edge) {k : ℕ} (hk : k < (P.path e).length) : + P.point e k ∈ P.path e := by + rw [P.point_get e hk] + exact List.getElem_mem _ + +theorem point_interior (e : G.Edge) {k : ℕ} (hk0 : 0 < k) (hk : k < (P.path e).length-1) : + P.point e k ∈ ((P.path e).drop 1).dropLast := by + have hi : k-1 < (((P.path e).drop 1).dropLast).length := by + simp only [List.length_dropLast,List.length_drop] + omega + have hm := List.getElem_mem (l := ((P.path e).drop 1).dropLast) hi + rw [List.getElem_dropLast,List.getElem_drop] at hm + simpa only [show 1+(k-1) = k from by omega,← P.point_get e (k := k) (by omega)] using hm + +theorem point_disjoint (e f : G.Edge) (hef : e ≠ f) {i j : ℕ} + (hi0 : 0 < i) (hi : i < (P.path e).length-1) (hj : j < (P.path f).length) : + P.point e i ≠ P.point f j := by + intro h + have he := P.point_interior e hi0 hi + rw [h] at he + exact Finset.disjoint_left.mp (P.disjoint e f hef) (List.mem_toFinset.mpr he) + (List.mem_toFinset.mpr (P.point_mem f hj)) + +def toRoute : QMAPlanarRouteData G where + length e := (P.path e).length-1 + length_pos e := by have := P.length e; omega + position := P.position + position_injective := P.position_injective + point := P.point + positive e k hk := P.positive e _ (P.point_mem e (by have := P.length e; omega)) + first e := by + have h := P.first e + rw [List.head?_eq_getElem?,List.getElem?_eq_getElem (by have := P.length e; omega)] at h + exact (P.point_get e (by have := P.length e; omega)).trans (Option.some.inj h) + last e := by + have h := P.last e + rw [List.getLast?_eq_getElem?,List.getElem?_eq_getElem (by have := P.length e; omega)] at h + exact (P.point_get e (by have := P.length e; omega)).trans (Option.some.inj h) + simple e i j hi hj h := by + have hi' : i < (P.path e).length := by have := P.length e; omega + have hj' : j < (P.path e).length := by have := P.length e; omega + rw [P.point_get e hi',P.point_get e hj'] at h + exact (P.simple e).getElem_inj_iff.mp h + step e i hi := by + rw [P.point_get e (by omega),P.point_get e (by omega)] + exact List.isChain_iff_getElem.mp (P.step e) i (by omega) + avoids e i v hi0 hi := by + intro h + exact P.avoids e v (h ▸ P.point_interior e hi0 hi) + disjoint e f i j hef hi0 hi hj := + P.point_disjoint e f hef hi0 hi (by have := P.length f; omega) + edges_disjoint e f hef i j hi hj := by + have hi' : i+1 < (P.path e).length := by omega + have hj' : j+1 < (P.path f).length := by omega + constructor + · rintro ⟨h0,h1⟩ + by_cases h : i = 0 + · subst i + exact P.point_disjoint e f hef (by omega) (by have := P.length e; omega) hj' h1 + · exact P.point_disjoint e f hef (by omega) hi (by omega) h0 + · rintro ⟨h0,h1⟩ + by_cases h : i = 0 + · subst i + exact P.point_disjoint e f hef (by omega) (by have := P.length e; omega) (by omega) h1 + · exact P.point_disjoint e f hef (by omega) hi hj' h0 + +end QMAPlanarListData +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarRelabel.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarRelabel.lean new file mode 100644 index 0000000000000000000000000000000000000000..02301725bed9396778d08aa63d8c8f4ac035ad09 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarRelabel.lean @@ -0,0 +1,133 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPlanarRouteRealization + +namespace OAI + +/-! Transport a planar route family through vertex and edge permutations. +Each edge may independently reverse its orientation. -/ + +noncomputable section +namespace ContinuumCoulomb.QMAPlanarRouteData +open scoped Classical + +def relabelIndex (L : ℕ) (flip : Bool) (i : ℕ) : ℕ := + if flip then L-i else i + +private theorem relabelIndex_le {L i : ℕ} (flip : Bool) (hi : i ≤ L) : + relabelIndex L flip i ≤ L := by + cases flip + · exact hi + · exact Nat.sub_le _ _ + +private theorem relabelIndex_interior {L i : ℕ} (flip : Bool) + (hi0 : 0 < i) (hi : i < L) : + 0 < relabelIndex L flip i ∧ relabelIndex L flip i < L := by + cases flip <;> simp only [relabelIndex,Bool.false_eq_true,ite_false,ite_true] <;> omega + +private theorem relabelIndex_injective {L i j : ℕ} (flip : Bool) + (hi : i ≤ L) (hj : j ≤ L) + (h : relabelIndex L flip i=relabelIndex L flip j) : i=j := by + cases flip <;> simp only [relabelIndex,Bool.false_eq_true,ite_false,ite_true] at h <;> omega + +def relabelStepIndex (L : ℕ) (flip : Bool) (i : ℕ) : ℕ := + if flip then L-(i+1) else i + +private theorem relabelStepIndex_lt {L i : ℕ} (flip : Bool) (hi : i < L) : + relabelStepIndex L flip i < L := by + cases flip <;> simp [relabelStepIndex] <;> omega + +private theorem relabelIndex_left {L i : ℕ} (flip : Bool) (hi : i < L) : + relabelIndex L flip i= + if flip then relabelStepIndex L flip i+1 else relabelStepIndex L flip i := by + cases flip + · rfl + · change L-i=L-(i+1)+1 + omega + +private theorem relabelIndex_right (L i : ℕ) (flip : Bool) : + relabelIndex L flip (i+1)= + if flip then relabelStepIndex L flip i else relabelStepIndex L flip i+1 := by + cases flip <;> simp [relabelIndex,relabelStepIndex] + +private theorem flip_pairs_disjoint {α : Type} (a b c d : α) (s t : Bool) + (h : ¬(a=c ∧ b=d) ∧ ¬(a=d ∧ b=c)) : + ¬((if s then b else a)=(if t then d else c) ∧ + (if s then a else b)=(if t then c else d)) ∧ + ¬((if s then b else a)=(if t then c else d) ∧ + (if s then a else b)=(if t then d else c)) := by + cases s <;> cases t <;> simp_all only [Bool.false_eq_true,ite_false,ite_true] <;> tauto + +variable {G H : QMARationalExchangeGraph} (P : QMAPlanarRouteData G) + (vertex : Fin H.n ≃ Fin G.n) (edge : H.Edge ≃ G.Edge) (flip : H.Edge → Bool) + (left : ∀ e, vertex (H.left e)=if flip e then G.right (edge e) else G.left (edge e)) + (right : ∀ e, vertex (H.right e)=if flip e then G.left (edge e) else G.right (edge e)) + +def relabel : QMAPlanarRouteData H where + length e := P.length (edge e) + length_pos e := P.length_pos (edge e) + position v := P.position (vertex v) + position_injective := P.position_injective.comp vertex.injective + point e i := P.point (edge e) (relabelIndex (P.length (edge e)) (flip e) i) + positive e i hi := P.positive (edge e) _ (relabelIndex_le (flip e) hi) + first e := by + rw [left e] + cases hf : flip e + · simpa [relabelIndex,hf] using P.first (edge e) + · simpa [relabelIndex,hf] using P.last (edge e) + last e := by + rw [right e] + cases hf : flip e + · simpa [relabelIndex,hf] using P.last (edge e) + · simpa [relabelIndex,hf] using P.first (edge e) + simple e i j hi hj h := + relabelIndex_injective (flip e) hi hj + (P.simple (edge e) _ _ (relabelIndex_le (flip e) hi) + (relabelIndex_le (flip e) hj) h) + step e i hi := by + rw [relabelIndex_left (flip e) hi,relabelIndex_right _ _ (flip e)] + have h := P.step (edge e) _ (relabelStepIndex_lt (flip e) hi) + cases hf : flip e + · simpa [hf] using h + · simpa [hf] using h.symm + avoids e i v hi0 hi := by + obtain ⟨ha,hb⟩ := relabelIndex_interior (flip e) hi0 hi + exact P.avoids (edge e) _ (vertex v) ha hb + disjoint e f i j hef hi0 hi hj := by + obtain ⟨ha,hb⟩ := relabelIndex_interior (flip e) hi0 hi + exact P.disjoint (edge e) (edge f) _ _ + (fun h => hef (edge.injective h)) ha hb (relabelIndex_le (flip f) hj) + edges_disjoint e f hef i j hi hj := by + have h := P.edges_disjoint (edge e) (edge f) + (fun h => hef (edge.injective h)) + (relabelStepIndex (P.length (edge e)) (flip e) i) + (relabelStepIndex (P.length (edge f)) (flip f) j) + (relabelStepIndex_lt (flip e) hi) (relabelStepIndex_lt (flip f) hj) + rw [relabelIndex_left (flip e) hi,relabelIndex_right _ _ (flip e), + relabelIndex_left (flip f) hj,relabelIndex_right _ _ (flip f)] + simpa only [apply_ite] using flip_pairs_disjoint + (P.point (edge e) (relabelStepIndex (P.length (edge e)) (flip e) i)) + (P.point (edge e) (relabelStepIndex (P.length (edge e)) (flip e) i+1)) + (P.point (edge f) (relabelStepIndex (P.length (edge f)) (flip f) j)) + (P.point (edge f) (relabelStepIndex (P.length (edge f)) (flip f) j+1)) + (flip e) (flip f) h + +theorem relabel_position (v : Fin H.n) : + (P.relabel vertex edge flip left right).position v=P.position (vertex v) := rfl + +theorem relabel_point (e : H.Edge) (i : ℕ) : + (P.relabel vertex edge flip left right).point e i= + P.point (edge e) (if flip e then P.length (edge e)-i else i) := rfl + +theorem relabel_length_le {K : ℕ} (hK : ∀ e, P.length e≤K) (e : H.Edge) : + (P.relabel vertex edge flip left right).length e≤K := hK (edge e) + +theorem relabel_bounded {X Y : ℕ} (h : P.Bounded X Y) : + (P.relabel vertex edge flip left right).Bounded X Y := by + refine ⟨fun v => h.1 (vertex v),?_⟩ + intro e i hi + exact h.2 (edge e) _ (relabelIndex_le (flip e) hi) + +end ContinuumCoulomb.QMAPlanarRouteData + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarRouteData.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarRouteData.lean new file mode 100644 index 0000000000000000000000000000000000000000..5944973f27673c3e09c35cea1052ee3a283e2cfe --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarRouteData.lean @@ -0,0 +1,100 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEvenRouteRealization +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumInflatedSeparation + +namespace OAI + +/-! A planar route family supplies the even physical subdivision data explicitly, +including its four-direction reserved leaf sites. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +structure QMAPlanarRouteData (G : QMARationalExchangeGraph) where + length : G.Edge → ℕ + length_pos : ∀ e, 0 < length e + position : Fin G.n → ℕ × ℕ + position_injective : Function.Injective position + point : G.Edge → ℕ → ℕ × ℕ + positive : ∀ e i, i ≤ length e → 0 < (point e i).1 ∧ 0 < (point e i).2 + first : ∀ e, point e 0 = position (G.left e) + last : ∀ e, point e (length e) = position (G.right e) + simple : ∀ e i j, i ≤ length e → j ≤ length e → point e i = point e j → i = j + step : ∀ e i, i < length e → qmaSquareGrid.Adj (point e i) (point e (i+1)) + avoids : ∀ e i v, 0 < i → i < length e → point e i ≠ position v + disjoint : ∀ e f i j, e ≠ f → 0 < i → i < length e → j ≤ length f → point e i ≠ point f j + edges_disjoint : ∀ e f, e ≠ f → ∀ i j, i < length e → j < length f → + ¬(point e i = point f j ∧ point e (i+1) = point f (j+1)) ∧ + ¬(point e i = point f (j+1) ∧ point e (i+1) = point f j) + +namespace QMAPlanarRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPlanarRouteData G) + +def direction (e : G.Edge) : Fin 4 := qmaGridNeighborIndex (P.point e 0) (P.point e 1) + +theorem direction_spec (e : G.Edge) : + qmaGridNeighbor (P.point e 0) (P.direction e) = P.point e 1 := + qmaGridNeighborIndex_spec (P.positive e 0 (Nat.zero_le _)).1 + (P.positive e 0 (Nat.zero_le _)).2 (P.step e 0 (P.length_pos e)) + +def leaf (e : G.Edge) : ℕ × ℕ := qmaRouteLeaf (P.point e 0) (P.direction e) + +theorem leaf_injective : Function.Injective P.leaf := by + intro e f h + by_contra hef + have hp : (P.point e 0,P.direction e) = (P.point f 0,P.direction f) := + qmaRouteLeaf_injective h + have h0 := congrArg Prod.fst hp + have h1 := congrArg (fun z : (ℕ × ℕ) × Fin 4 => qmaGridNeighbor z.1 z.2) hp + rw [P.direction_spec e,P.direction_spec f] at h1 + exact (P.edges_disjoint e f hef 0 0 (P.length_pos e) (P.length_pos f)).1 ⟨h0,h1⟩ + +theorem even_length (e : G.Edge) : 2*(4*P.length e-1)+2 = 8*P.length e := by + have h := P.length_pos e + omega + +def toEven : QMAEvenRouteData G where + work e := 4*P.length e-1 + position v := qmaLeafCenter (P.position v) + position_injective := qmaLeafCenter_injective.comp P.position_injective + point e := qmaInflatedPoint (P.point e) + first e := by rw [qmaInflatedPoint_zero,P.first] + last e := by rw [P.even_length,qmaInflatedPoint_last,P.last] + simple e i j hi hj h := by + rw [P.even_length] at hi hj + exact qmaInflatedPoint_injective (P.point e) (P.positive e) (P.step e) (P.simple e) hi hj h + step e i hi := by + rw [P.even_length] at hi + exact qmaInflatedPoint_step (P.point e) (P.step e) hi + avoids e i v hi0 hi := by + rw [P.even_length] at hi + exact qmaInflatedPoint_avoids_vertex (P.point e) (P.positive e) (P.step e) (P.position v) + (fun j hj0 hj => P.avoids e j v hj0 hj) hi0 hi + disjoint e f i j hef hi0 hi hj := by + rw [P.even_length] at hi + rw [P.even_length] at hj + exact qmaInflatedPoint_disjoint (P.point e) (P.point f) (P.positive e) (P.positive f) + (P.step e) (P.step f) (fun a b ha0 ha hb => P.disjoint e f a b hef ha0 ha hb) + (P.edges_disjoint e f hef) hi0 hi hj + leaf := P.leaf + leaf_injective := P.leaf_injective + leaf_step e := by + change qmaSquareGrid.Adj + (qmaManhattanPoint (qmaLeafCenter (P.point e 0)) (qmaLeafCenter (P.point e 1)) 1) (P.leaf e) + rw [qmaLeafCenter_point_first (P.positive e 0 (Nat.zero_le _)).1 + (P.positive e 0 (Nat.zero_le _)).2 (P.step e 0 (P.length_pos e))] + exact qmaRouteLeaf_step _ _ + leaf_avoids e f k hk := by + rw [P.even_length] at hk + exact qmaRouteLeaf_avoids _ _ _ (qmaInflatedPoint_gridline (P.point f) (P.step f) hk) + leaf_old e v := by + apply qmaRouteLeaf_avoids + left + simp [qmaLeafCenter,Nat.add_mod] + +end QMAPlanarRouteData +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarRouteRealization.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarRouteRealization.lean new file mode 100644 index 0000000000000000000000000000000000000000..f80ece746b74a8fafc1926b1c27c72340c2751b1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarRouteRealization.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPlanarRouteData + +namespace OAI + +/-! A bounded planar route family produces the actual nearest-neighbor rational +Hamiltonian with a fixed number of perturbative layers. -/ + +namespace ContinuumCoulomb + +theorem qmaInflatedPoint_bounded (p : ℕ → ℕ × ℕ) {L X Y : ℕ} + (hp : ∀ i < L, qmaSquareGrid.Adj (p i) (p (i+1))) + (hb : ∀ i ≤ L, (p i).1 < X ∧ (p i).2 < Y) {k : ℕ} (hk : k ≤ 8*L) : + (qmaInflatedPoint p k).1 < 8*X ∧ (qmaInflatedPoint p k).2 < 8*Y := by + by_cases hz : k%8 = 0 + · rw [qmaInflatedPoint_boundary p hz] + obtain ⟨hx,hy⟩ := hb (k/8) (by omega) + simp only [qmaLeafCenter] + omega + · have hd : k/8 < L := by omega + have hl := qmaLeafCenter_adj_length (hp _ hd) + have hi : k%8 ≤ qmaManhattanLength (qmaLeafCenter (p (k/8))) + (qmaLeafCenter (p (k/8+1))) := by omega + have hh := qmaManhattanPoint_bounds _ _ _ hi + obtain ⟨hx,hy⟩ := hb (k/8) hd.le + obtain ⟨hx',hy'⟩ := hb (k/8+1) (by omega) + change (qmaManhattanPoint _ _ _).1 < _ ∧ (qmaManhattanPoint _ _ _).2 < _ + simp only [qmaLeafCenter] at hh + constructor + · exact hh.2.1.trans_lt (max_lt (by omega) (by omega)) + · exact hh.2.2.2.trans_lt (max_lt (by omega) (by omega)) + +noncomputable section +open scoped Classical +namespace QMAPlanarRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPlanarRouteData G) + +def Bounded (X Y : ℕ) : Prop := + (∀ v, (P.position v).1 < X ∧ (P.position v).2 < Y) ∧ + ∀ e i, i ≤ P.length e → (P.point e i).1 < X ∧ (P.point e i).2 < Y + +theorem toEven_bounded {X Y : ℕ} (hb : P.Bounded X Y) : P.toEven.Bounded (8*X) (8*Y) := by + refine ⟨?_,?_,?_⟩ + · intro v + obtain ⟨hx,hy⟩ := hb.1 v + change 8*(P.position v).1+4 < 8*X ∧ 8*(P.position v).2+4 < 8*Y + omega + · intro e k hk + change k ≤ 2*(4*P.length e-1)+2 at hk + rw [P.even_length] at hk + exact qmaInflatedPoint_bounded (P.point e) (P.step e) (hb.2 e) hk + · intro e + exact qmaRouteLeaf_bounds (hb.2 e 0 (Nat.zero_le _)).1 (hb.2 e 0 (Nat.zero_le _)).2 _ + +theorem realize {N : ℚ} (hN : 0 < N) {K X Y d : ℕ} (h3 : 3 ≤ d) + (hK : ∀ e, P.length e ≤ K) (hb : P.Bounded X Y) + (hd : ∀ v, qmaGraphDegree G.left G.right v ≤ d) : + ∃ (H : QMARationalExchangeGraph) (position : Fin H.n → ℕ × ℕ), + Function.Injective position ∧ + (∀ v, (position v).1 < 8*X ∧ (position v).2 < 8*Y) ∧ + (∀ e, qmaSquareGrid.Adj (position (H.left e)) (position (H.right e))) ∧ + (∀ v, qmaGraphDegree H.left H.right v ≤ d) ∧ + H.n+Fintype.card H.Edge ≤ 5^(4*K+1)*(G.n+Fintype.card G.Edge) ∧ + |H.energy-G.energy| ≤ ((4*K+1:ℕ):ℝ)/(N:ℝ) := by + have hw : ∀ e, P.toEven.work e ≤ 4*K := by + intro e + change 4*P.length e-1 ≤ 4*K + have h := hK e + omega + exact P.toEven.realize hN h3 hw (P.toEven_bounded hb) hd + +end QMAPlanarRouteData +end +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarSelectorTransport.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarSelectorTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce9226219b6db91493e6ae5b419e8d3b81b45455 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarSelectorTransport.lean @@ -0,0 +1,198 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSelectedRoute +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingPlanarRoutes + +namespace OAI + +/-! The actual finite selector gives a planar family after arbitrary vertex +and edge permutations, including independent edge orientation changes. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +namespace QMAPlanarListData + +theorem range_toRoute_point {G : QMARationalExchangeGraph} (L : QMAPlanarListData G) + (e : G.Edge) : + (List.range (L.toRoute.length e+1)).map (L.toRoute.point e) = L.path e := by + have hn : L.toRoute.length e+1 = (L.path e).length := by + change (L.path e).length-1+1 = (L.path e).length + have h := L.length e + omega + rw [hn] + apply List.ext_getElem + · simp only [List.length_map,List.length_range] + · intro i hi hj + rw [List.getElem_map,List.getElem_range] + exact L.point_get e hj + +end QMAPlanarListData + +namespace QMAPortRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + +theorem crossing_hasAllowedRoute (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) + (havoid : ∀ i : P.Interior, ∀ v, P.cell i ≠ P.position v) + (x y : Fin (P.crossingOutput N hD).merge.n) + (e : (P.crossingOutput N hD).merge.Edge) + (he : s(x,y) = s((P.crossingOutput N hD).merge.left e, + (P.crossingOutput N hD).merge.right e)) : + P.HasAllowedRoute (P.crossingPosition N D x) (P.crossingPosition N D y) := by + have h : P.HasAllowedRoute + (P.crossingPosition N D ((P.crossingOutput N hD).merge.left e)) + (P.crossingPosition N D ((P.crossingOutput N hD).merge.right e)) := + P.mergedOutput_route_exists N hD havoid e + rcases Sym2.eq_iff.mp he with ⟨hl,hr⟩ | ⟨hl,hr⟩ + · simpa only [hl,hr] using h + · simpa only [hl,hr] using P.hasAllowedRoute_reverse h + +section Transport +variable (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) + (havoid : ∀ i : P.Interior, ∀ v, P.cell i ≠ P.position v) + {H : QMARationalExchangeGraph} + (vertex : Fin H.n ≃ Fin (P.crossingOutput N hD).merge.n) + (edge : H.Edge ≃ (P.crossingOutput N hD).merge.Edge) + (ends : ∀ e, s(vertex (H.left e),vertex (H.right e)) = + s((P.crossingOutput N hD).merge.left (edge e), + (P.crossingOutput N hD).merge.right (edge e))) + +def selectorTransportRoute (e : H.Edge) : QMACellRoute := + P.selectedAllowedRoute (P.crossingPosition N D (vertex (H.left e))) + (P.crossingPosition N D (vertex (H.right e))) + (P.crossing_hasAllowedRoute N hD havoid _ _ (edge e) (ends e)) + +theorem selectorTransportRoute_spec (e : H.Edge) : + P.RoutingAllowed (P.selectorTransportRoute N hD havoid vertex edge ends e).body ∧ + (P.selectorTransportRoute N hD havoid vertex edge ends e).Valid ∧ + (P.selectorTransportRoute N hD havoid vertex edge ends e).source = + P.crossingPosition N D (vertex (H.left e)) ∧ + (P.selectorTransportRoute N hD havoid vertex edge ends e).target = + P.crossingPosition N D (vertex (H.right e)) := + P.selectedAllowedRoute_spec _ _ _ + +theorem selectorTransportRoute_path (e : H.Edge) : + (P.selectorTransportRoute N hD havoid vertex edge ends e).path = + QuantumRouteSelectorProgram.value (P.routingTable, + P.crossingPosition N D (vertex (H.left e)), + P.crossingPosition N D (vertex (H.right e))) := + (P.selectedAllowedRoute_path _ _ _).symm + +theorem selectorTransportRoute_endpointPair (e : H.Edge) : + (P.selectorTransportRoute N hD havoid vertex edge ends e).endpointPair = + s(P.crossingPosition N D ((P.crossingOutput N hD).merge.left (edge e)), + P.crossingPosition N D ((P.crossingOutput N hD).merge.right (edge e))) := by + have hs := P.selectorTransportRoute_spec N hD havoid vertex edge ends e + rw [QMACellRoute.endpointPair,hs.2.2.1,hs.2.2.2] + rcases Sym2.eq_iff.mp (ends e) with ⟨hl,hr⟩ | ⟨hl,hr⟩ + · rw [hl,hr] + · rw [hl,hr] + exact Sym2.eq_swap + +theorem selectorTransportRoute_pairs_injective : + Function.Injective (fun e => + (P.selectorTransportRoute N hD havoid vertex edge ends e).endpointPair) := by + intro e f hef + apply edge.injective + apply qmaMergedEndpointPairs_injective (P.crossingOutput N hD) + (P.crossingPosition N D) (P.crossingPosition_injective N D) + exact (P.selectorTransportRoute_endpointPair N hD havoid vertex edge ends e).symm.trans + (hef.trans (P.selectorTransportRoute_endpointPair N hD havoid vertex edge ends f)) + +def selectorPlanarList + (hpositive : ∀ v, 0 < (P.position v).1 ∧ 0 < (P.position v).2) : + QMAPlanarListData H where + position v := P.crossingPosition N D (vertex v) + position_injective := (P.crossingPosition_injective N D).comp vertex.injective + path e := (P.selectorTransportRoute N hD havoid vertex edge ends e).path + length e := (P.selectorTransportRoute N hD havoid vertex edge ends e).length_bounds.1 + first e := (P.selectorTransportRoute N hD havoid vertex edge ends e).endpoints.1.trans + (congrArg some (P.selectorTransportRoute_spec N hD havoid vertex edge ends e).2.2.1) + last e := (P.selectorTransportRoute N hD havoid vertex edge ends e).endpoints.2.trans + (congrArg some (P.selectorTransportRoute_spec N hD havoid vertex edge ends e).2.2.2) + simple e := (P.selectorTransportRoute N hD havoid vertex edge ends e).simple + (P.selectorTransportRoute_spec N hD havoid vertex edge ends e).2.1 + step e := (P.selectorTransportRoute N hD havoid vertex edge ends e).chain + (P.selectorTransportRoute_spec N hD havoid vertex edge ends e).2.1 + positive e z hz := by + have hs := P.selectorTransportRoute_spec N hD havoid vertex edge ends e + apply (P.selectorTransportRoute N hD havoid vertex edge ends e).path_positive ?_ ?_ hz + · rw [hs.2.2.1] + exact P.crossingPosition_positive hpositive N D _ + · rw [hs.2.2.2] + exact P.crossingPosition_positive hpositive N D _ + avoids e v := by + obtain ⟨R,ha,hv,hs⟩ := P.physical_endpoint_cover N D havoid (vertex v) + rw [← hs] + have he := P.selectorTransportRoute_spec N hD havoid vertex edge ends e + exact P.permitted_avoids_source havoid _ R he.1 ha he.2.1 hv + disjoint e f hef := by + have he := P.selectorTransportRoute_spec N hD havoid vertex edge ends e + have hf := P.selectorTransportRoute_spec N hD havoid vertex edge ends f + exact P.permitted_routes_disjoint havoid _ _ he.1 hf.1 he.2.1 hf.2.1 + ((P.selectorTransportRoute_pairs_injective N hD havoid vertex edge ends).ne hef) + +theorem selectorPlanarList_path + (hpositive : ∀ v, 0 < (P.position v).1 ∧ 0 < (P.position v).2) (e : H.Edge) : + (P.selectorPlanarList N hD havoid vertex edge ends hpositive).path e = + QuantumRouteSelectorProgram.value (P.routingTable, + P.crossingPosition N D (vertex (H.left e)), + P.crossingPosition N D (vertex (H.right e))) := + P.selectorTransportRoute_path N hD havoid vertex edge ends e + +def selectorPlanarRoute + (hpositive : ∀ v, 0 < (P.position v).1 ∧ 0 < (P.position v).2) : + QMAPlanarRouteData H := + (P.selectorPlanarList N hD havoid vertex edge ends hpositive).toRoute + +theorem selectorPlanarRoute_path + (hpositive : ∀ v, 0 < (P.position v).1 ∧ 0 < (P.position v).2) (e : H.Edge) : + (List.range ((P.selectorPlanarRoute N hD havoid vertex edge ends hpositive).length e+1)).map + ((P.selectorPlanarRoute N hD havoid vertex edge ends hpositive).point e) = + QuantumRouteSelectorProgram.value (P.routingTable, + P.crossingPosition N D (vertex (H.left e)), + P.crossingPosition N D (vertex (H.right e))) := + ((P.selectorPlanarList N hD havoid vertex edge ends hpositive).range_toRoute_point e).trans + (P.selectorPlanarList_path N hD havoid vertex edge ends hpositive e) + +theorem selectorPlanarRoute_length + (hpositive : ∀ v, 0 < (P.position v).1 ∧ 0 < (P.position v).2) (e : H.Edge) : + (P.selectorPlanarRoute N hD havoid vertex edge ends hpositive).length e ≤ 20 := by + change (P.selectorTransportRoute N hD havoid vertex edge ends e).path.length-1 ≤ 20 + have h := (P.selectorTransportRoute N hD havoid vertex edge ends e).length_bounds.2 + omega + +theorem selectorTransportRoute_path_bounded {X Y : ℕ} + (hsource : ∀ v, (P.position v).1 < X ∧ (P.position v).2 < Y) + (hpath : ∀ e k, k ≤ P.length e → (P.point e k).1 < X ∧ (P.point e k).2 < Y) + (e : H.Edge) {z : ℕ × ℕ} + (hz : z ∈ (P.selectorTransportRoute N hD havoid vertex edge ends e).path) : + z.1 < 32*X ∧ z.2 < 32*Y := by + have hs := P.selectorTransportRoute_spec N hD havoid vertex edge ends e + apply (P.selectorTransportRoute N hD havoid vertex edge ends e).path_bounded ?_ ?_ hz + · rw [hs.2.2.1] + exact P.crossingPosition_bounded hsource hpath N D _ + · rw [hs.2.2.2] + exact P.crossingPosition_bounded hsource hpath N D _ + +theorem selectorPlanarRoute_bounded {X Y : ℕ} + (hpositive : ∀ v, 0 < (P.position v).1 ∧ 0 < (P.position v).2) + (hsource : ∀ v, (P.position v).1 < X ∧ (P.position v).2 < Y) + (hpath : ∀ e k, k ≤ P.length e → (P.point e k).1 < X ∧ (P.point e k).2 < Y) : + (P.selectorPlanarRoute N hD havoid vertex edge ends hpositive).Bounded (32*X) (32*Y) := by + refine ⟨fun v => P.crossingPosition_bounded hsource hpath N D (vertex v),?_⟩ + intro e k hk + let L := P.selectorPlanarList N hD havoid vertex edge ends hpositive + change (L.point e k).1 < 32*X ∧ (L.point e k).2 < 32*Y + apply P.selectorTransportRoute_path_bounded N hD havoid vertex edge ends hsource hpath e + exact L.point_mem e (by + have hlen := L.length e + change k ≤ (L.path e).length-1 at hk + omega) + +end Transport +end QMAPortRouteData +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarTapeGeometry.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarTapeGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..e3d863d45a72b5636ab17a637cf37c4112557c4a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarTapeGeometry.lean @@ -0,0 +1,152 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPlanarTapeSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPlanarSelectorTransport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEvenTapeGeometry + +namespace OAI + +/-! The emitted planar tape is the exact coordinate and path array of a +bounded planar family, in its literal merged-edge order. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +namespace QuantumRouteSelectorProgram + +theorem value_eq_of_allowed (t u : QuantumRoutingTable.Table) + (h : ∀ B, QuantumRoutingTable.allowed t B = QuantumRoutingTable.allowed u B) + (ends : Ends) : value (t,ends) = value (u,ends) := by + have ht : QuantumTaggedRouteProgram.tagged t = QuantumTaggedRouteProgram.tagged u := by + funext R + simp only [QuantumTaggedRouteProgram.tagged,QuantumTaggedRouteProgram.bodyPermitted,h] + simp only [value,candidates,ht] + +end QuantumRouteSelectorProgram + +namespace QuantumPlanarTapeGeometry +open QuantumPlanarTapeProgram QuantumRouteCode + +private theorem map_eq_ofFn {α β : Type*} (xs : List α) (f : α → β) : + xs.map f = List.ofFn (fun i => f (xs.get i)) := by + have h := congrArg (List.map f) (List.ofFn_get xs) + rw [List.map_ofFn] at h + exact h.symm + +theorem graph_packed (x : Input) (hn : ∀ e ∈ x.1.1.2.1, e.1 ≠ e.2.1) : + QuantumListGraph.packed (graph x hn) (Equiv.refl _) = merged x := by + change List.ofFn (fun i : Fin (merged x).length => (merged x).get i) = merged x + exact List.ofFn_get _ + +section Geometry +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) (x : Input) + (hb : SourceBondLists.bounded x.1.1.1 x.1.1.2.1) + (hn : ∀ e ∈ x.1.1.2.1, e.1 ≠ e.2.1) + (vertex : Fin x.1.1.1 ≃ Fin (P.crossingOutput N hD).n) + (forward : ∀ e : (rawGraph x hb hn).Edge, ∃ f : (P.crossingOutput N hD).Edge, + s(vertex ((rawGraph x hb hn).left e),vertex ((rawGraph x hb hn).right e)) = + s((P.crossingOutput N hD).left f,(P.crossingOutput N hD).right f)) + (backward : ∀ f : (P.crossingOutput N hD).Edge, ∃ e : (rawGraph x hb hn).Edge, + s(vertex ((rawGraph x hb hn).left e),vertex ((rawGraph x hb hn).right e)) = + s((P.crossingOutput N hD).left f,(P.crossingOutput N hD).right f)) + (havoid : ∀ i : P.Interior, ∀ v, P.cell i ≠ P.position v) + (hpositive : ∀ v, 0 < (P.position v).1 ∧ 0 < (P.position v).2) + +def route : QMAPlanarRouteData (graph x hn) := + P.selectorPlanarRoute (H := graph x hn) N hD havoid vertex (edge P N hD x hb hn vertex forward backward) + (edge_endpoints P N hD x hb hn vertex forward backward) hpositive + +theorem route_length (e : (graph x hn).Edge) : + (route P N hD x hb hn vertex forward backward havoid hpositive).length e ≤ 20 := + P.selectorPlanarRoute_length (H := graph x hn) N hD havoid vertex (edge P N hD x hb hn vertex forward backward) + (edge_endpoints P N hD x hb hn vertex forward backward) hpositive e + +theorem route_bounded {X Y : ℕ} + (hsource : ∀ v, (P.position v).1 < X ∧ (P.position v).2 < Y) + (hpath : ∀ e k, k ≤ P.length e → (P.point e k).1 < X ∧ (P.point e k).2 < Y) : + (route P N hD x hb hn vertex forward backward havoid hpositive).Bounded (32*X) (32*Y) := + P.selectorPlanarRoute_bounded (H := graph x hn) N hD havoid vertex (edge P N hD x hb hn vertex forward backward) + (edge_endpoints P N hD x hb hn vertex forward backward) hpositive hsource hpath + +variable + (hpositions : x.1.2 = List.ofFn (fun v => P.crossingPosition N D (vertex v))) + (hallowed : ∀ B, QuantumRoutingTable.allowed x.2 B = + QuantumRoutingTable.allowed P.routingTable B) + +include hpositions in +theorem lookup_position (v : Fin x.1.1.1) : + QuantumForkGridProgram.lookup x.1.2 v.val = P.crossingPosition N D (vertex v) := by + rw [hpositions] + unfold QuantumForkGridProgram.lookup + rw [List.headD_eq_head?_getD,List.head?_drop,List.getElem?_ofFn] + simp only [dite_eq_left v.isLt,Option.getD_some] + +include hpositions hallowed in +theorem selected_path (e : (graph x hn).Edge) : + QuantumRouteSelectorProgram.value (routeInput x ((merged x).get e)) = + QuantumRouteSelectorProgram.value (P.routingTable, + P.crossingPosition N D (vertex ((graph x hn).left e)), + P.crossingPosition N D (vertex ((graph x hn).right e))) := by + let a : Fin x.1.1.1 := (graph x hn).left e + let b : Fin x.1.1.1 := (graph x hn).right e + change QuantumRouteSelectorProgram.value (x.2, + QuantumForkGridProgram.lookup x.1.2 a.val, + QuantumForkGridProgram.lookup x.1.2 b.val) = + QuantumRouteSelectorProgram.value (P.routingTable, + P.crossingPosition N D (vertex a),P.crossingPosition N D (vertex b)) + rw [lookup_position P N hD x vertex hpositions a,lookup_position P N hD x vertex hpositions b] + exact QuantumRouteSelectorProgram.value_eq_of_allowed x.2 P.routingTable hallowed _ + +include hpositions hallowed in +theorem path_eq (e : (graph x hn).Edge) : + QuantumRouteSelectorProgram.value (routeInput x ((merged x).get e)) = + (List.range ((route P N hD x hb hn vertex forward backward havoid hpositive).length e+1)).map + ((route P N hD x hb hn vertex forward backward havoid hpositive).point e) := by + exact (selected_path P N hD x hn vertex hpositions hallowed e).trans + (P.selectorPlanarRoute_path (H := graph x hn) N hD havoid vertex (edge P N hD x hb hn vertex forward backward) + (edge_endpoints P N hD x hb hn vertex forward backward) hpositive e).symm + +include hpositions in +theorem positions_eq : (value x).2.1 = + List.ofFn (route P N hD x hb hn vertex forward backward havoid hpositive).position := + hpositions + +include hpositions hallowed in +theorem paths_eq : (value x).2.2 = + List.ofFn (fun e => + (List.range ((route P N hD x hb hn vertex forward backward havoid hpositive).length e+1)).map + ((route P N hD x hb hn vertex forward backward havoid hpositive).point e)) := by + change (merged x).map (fun e => QuantumRouteSelectorProgram.value (routeInput x e)) = _ + rw [map_eq_ofFn] + apply congrArg List.ofFn + funext e + exact path_eq P N hD x hb hn vertex forward backward havoid hpositive hpositions hallowed e + +include hpositions hallowed in +theorem value_eq : value x = + (((graph x hn).n,QuantumListGraph.packed (graph x hn) (Equiv.refl _),(graph x hn).constant), + List.ofFn (route P N hD x hb hn vertex forward backward havoid hpositive).position, + List.ofFn (fun e => + (List.range ((route P N hD x hb hn vertex forward backward havoid hpositive).length e+1)).map + ((route P N hD x hb hn vertex forward backward havoid hpositive).point e))) := by + apply Prod.ext + · rw [graph_packed] + rfl + · exact Prod.ext + (positions_eq P N hD x hb hn vertex forward backward havoid hpositive hpositions) + (paths_eq P N hD x hb hn vertex forward backward havoid hpositive hpositions hallowed) + +include hpositions hallowed in +theorem even_input_eq (M : ℚ) : + (M,value x) = QuantumEvenTapeGeometry.input + (route P N hD x hb hn vertex forward backward havoid hpositive) (Equiv.refl _) M := by + exact congrArg (fun t : Output => (M,t)) + (value_eq P N hD x hb hn vertex forward backward havoid hpositive hpositions hallowed) + +end Geometry +end QuantumPlanarTapeGeometry +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarTapeProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarTapeProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..1395ea5261c5937dbc7b1506ec37f0ec835b3ef3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarTapeProgram.lean @@ -0,0 +1,84 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialCrossingProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListMergeProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRouteSelectorCorrectness + +namespace OAI + +/-! Merge the physical crossing bonds and compute the short planar route +for every remaining pair of endpoints from the finite permission table. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPlanarTapeProgram +open ExactQuantumFactoring.BitStackProgram QuantumRouteCode MediatorListProgram + +abbrev Input := QuantumSpatialCrossingProgram.Output +def inputCode : Input → List Bool := QuantumSpatialCrossingProgram.outputCode +abbrev Output := QuantumListPathStep.Output × (List Pair × List (List Pair)) +def outputCode : Output → List Bool := prodCode QuantumListPathStep.outputCode + (prodCode (listCode pairCode) (listCode (listCode pairCode))) + +def merged (x : Input) : List Bond := QuantumListMerge.value x.1.1.1 x.1.1.2.1 +def routeInput (x : Input) (e : Bond) : QuantumRouteSelectorProgram.Input := + (x.2,QuantumForkGridProgram.lookup x.1.2 e.1,QuantumForkGridProgram.lookup x.1.2 e.2.1) +def paths (x : Input) : List (List Pair) := + (merged x).map (fun e => QuantumRouteSelectorProgram.value (routeInput x e)) +def value (x : Input) : Output := ((x.1.1.1,merged x,x.1.1.2.2),x.1.2,paths x) + +noncomputable opaque packetProgram : Procedure inputCode QuantumListPathStep.outputCode + (fun x => x.1.1) := + (Procedure.first QuantumListPathStep.outputCode (listCode pairCode)).comp + (Procedure.first (prodCode QuantumListPathStep.outputCode (listCode pairCode)) + QuantumRoutingTable.tableCode) +noncomputable opaque positionsProgram : Procedure inputCode (listCode pairCode) + (fun x => x.1.2) := + (Procedure.second QuantumListPathStep.outputCode (listCode pairCode)).comp + (Procedure.first (prodCode QuantumListPathStep.outputCode (listCode pairCode)) + QuantumRoutingTable.tableCode) +noncomputable opaque tableProgram : Procedure inputCode QuantumRoutingTable.tableCode + Prod.snd := Procedure.second _ _ +noncomputable opaque nProgram : Procedure inputCode unaryCode (fun x => x.1.1.1) := + (Procedure.first unaryCode (prodCode (listCode bondCode) ratCode)).comp packetProgram +noncomputable opaque bondsProgram : Procedure inputCode (listCode bondCode) + (fun x => x.1.1.2.1) := + ((Procedure.first (listCode bondCode) ratCode).comp + (Procedure.second unaryCode (prodCode (listCode bondCode) ratCode))).comp packetProgram +noncomputable opaque constantProgram : Procedure inputCode ratCode (fun x => x.1.1.2.2) := + ((Procedure.second (listCode bondCode) ratCode).comp + (Procedure.second unaryCode (prodCode (listCode bondCode) ratCode))).comp packetProgram +noncomputable opaque mergedProgram : Procedure inputCode (listCode bondCode) merged := + QuantumListMerge.valueProgram.comp (nProgram.pair bondsProgram) + +noncomputable opaque routeInputProgram : + Procedure (prodCode inputCode bondCode) QuantumRouteSelectorProgram.inputCode + (fun x => routeInput x.1 x.2) := by + let env := Procedure.first inputCode bondCode + let e := Procedure.second inputCode bondCode + let ps := positionsProgram.comp env + let a := (Procedure.first Nat.bits (prodCode Nat.bits ratCode)).comp e + let b := ((Procedure.first Nat.bits ratCode).comp + (Procedure.second Nat.bits (prodCode Nat.bits ratCode))).comp e + let get := Procedure.listGet pairCode (0,0) + exact (tableProgram.comp env).pair ((get.comp (a.pair ps)).pair (get.comp (b.pair ps))) + +noncomputable opaque routeProgram : Procedure (prodCode inputCode bondCode) + (listCode pairCode) (fun x => QuantumRouteSelectorProgram.value (routeInput x.1 x.2)) := + QuantumRouteSelectorProgram.program.comp routeInputProgram + +noncomputable opaque mapPathsProgram : Procedure (prodCode inputCode (listCode bondCode)) + (listCode (listCode pairCode)) + (fun x => x.2.map (fun e => QuantumRouteSelectorProgram.value (routeInput x.1 e))) := + Procedure.listMapWith (f := fun x e => QuantumRouteSelectorProgram.value (routeInput x e)) + zeroBond [] routeProgram + +noncomputable opaque pathsProgram : Procedure inputCode (listCode (listCode pairCode)) paths := + (mapPathsProgram.comp ((Procedure.identity inputCode).pair mergedProgram)).congrFun + (by intro x; rfl) + +noncomputable opaque program : Procedure inputCode outputCode value := + (nProgram.pair (mergedProgram.pair constantProgram)).pair (positionsProgram.pair pathsProgram) + +end ContinuumCoulomb.QuantumPlanarTapeProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarTapeSupport.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarTapeSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..8956b45fcc8c886c2b5b994b667d281c234ce25a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPlanarTapeSupport.lean @@ -0,0 +1,116 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPlanarTapeProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumMergedSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEndpointRelabel + +namespace OAI + +/-! The actual merged planar tape and the canonical crossing graph have +the same unordered edges, with an explicit finite edge equivalence. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPlanarTapeGeometry +open QuantumPlanarTapeProgram +open scoped Classical + +def rawGraph (x : Input) (hb : SourceBondLists.bounded x.1.1.1 x.1.1.2.1) + (hn : ∀ e ∈ x.1.1.2.1, e.1 ≠ e.2.1) : QMARationalExchangeGraph := + QuantumListGraph.ofBonds x.1.1.1 x.1.1.2.1 x.1.1.2.2 hb hn + +def graph (x : Input) (hn : ∀ e ∈ x.1.1.2.1, e.1 ≠ e.2.1) : QMARationalExchangeGraph := + QuantumListGraph.ofBonds x.1.1.1 (merged x) x.1.1.2.2 + (QuantumListMerge.bounded _ _) (QuantumListMerge.noLoops hn) + +private theorem fin_pair_eq {n : ℕ} {a b c d : Fin n} + (h : s(a.val,b.val) = s(c.val,d.val)) : s(a,b) = s(c,d) := by + rcases Sym2.eq_iff.mp h with ⟨ha,hb⟩ | ⟨ha,hb⟩ + · exact Sym2.eq_iff.mpr (Or.inl ⟨Fin.ext ha,Fin.ext hb⟩) + · exact Sym2.eq_iff.mpr (Or.inr ⟨Fin.ext ha,Fin.ext hb⟩) + +theorem graph_source (x : Input) (hb : SourceBondLists.bounded x.1.1.1 x.1.1.2.1) + (hn : ∀ e ∈ x.1.1.2.1, e.1 ≠ e.2.1) (e : (graph x hn).Edge) : + ∃ f : (rawGraph x hb hn).Edge, + s((graph x hn).left e,(graph x hn).right e) = + s((rawGraph x hb hn).left f,(rawGraph x hb hn).right f) := by + obtain ⟨b,hb',hpair⟩ := QuantumListMerge.value_edge_source x.1.1.1 x.1.1.2.1 + (List.get_mem (merged x) e) + obtain ⟨f,hf⟩ := List.mem_iff_get.mp hb' + refine ⟨f,fin_pair_eq ?_⟩ + change s(((merged x).get e).1,((merged x).get e).2.1) = + s((x.1.1.2.1.get f).1,(x.1.1.2.1.get f).2.1) + rwa [hf] + +theorem graph_target (x : Input) (hb : SourceBondLists.bounded x.1.1.1 x.1.1.2.1) + (hn : ∀ e ∈ x.1.1.2.1, e.1 ≠ e.2.1) (f : (rawGraph x hb hn).Edge) : + ∃ e : (graph x hn).Edge, + s((graph x hn).left e,(graph x hn).right e) = + s((rawGraph x hb hn).left f,(rawGraph x hb hn).right f) := by + obtain ⟨b,hb',hpair⟩ := QuantumListMerge.value_edge_target hb (List.get_mem x.1.1.2.1 f) + obtain ⟨e,he⟩ := List.mem_iff_get.mp hb' + refine ⟨e,fin_pair_eq ?_⟩ + change s(((QuantumListMerge.value x.1.1.1 x.1.1.2.1).get e).1, + ((QuantumListMerge.value x.1.1.1 x.1.1.2.1).get e).2.1) = + s((x.1.1.2.1.get f).1,(x.1.1.2.1.get f).2.1) + rwa [he] + +theorem graph_simple (x : Input) (hn : ∀ e ∈ x.1.1.2.1, e.1 ≠ e.2.1) : + (graph x hn).Simple := by + intro e f hef + have h := QuantumListMerge.value_simple hn e f hef + constructor + · rintro ⟨hl,hr⟩ + exact h.1 ⟨congrArg Fin.val hl,congrArg Fin.val hr⟩ + · rintro ⟨hl,hr⟩ + exact h.2 ⟨congrArg Fin.val hl,congrArg Fin.val hr⟩ + +section Canonical +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) (x : Input) + (hb : SourceBondLists.bounded x.1.1.1 x.1.1.2.1) + (hn : ∀ e ∈ x.1.1.2.1, e.1 ≠ e.2.1) + (vertex : Fin x.1.1.1 ≃ Fin (P.crossingOutput N hD).n) + (forward : ∀ e : (rawGraph x hb hn).Edge, ∃ f : (P.crossingOutput N hD).Edge, + s(vertex ((rawGraph x hb hn).left e),vertex ((rawGraph x hb hn).right e)) = + s((P.crossingOutput N hD).left f,(P.crossingOutput N hD).right f)) + (backward : ∀ f : (P.crossingOutput N hD).Edge, ∃ e : (rawGraph x hb hn).Edge, + s(vertex ((rawGraph x hb hn).left e),vertex ((rawGraph x hb hn).right e)) = + s((P.crossingOutput N hD).left f,(P.crossingOutput N hD).right f)) + +include forward in +theorem canonical_source (e : (graph x hn).Edge) : + ∃ f : (P.crossingOutput N hD).merge.Edge, + s(vertex ((graph x hn).left e),vertex ((graph x hn).right e)) = + s((P.crossingOutput N hD).merge.left f,(P.crossingOutput N hD).merge.right f) := by + obtain ⟨a,ha⟩ := graph_source x hb hn e + obtain ⟨b,hb'⟩ := forward a + obtain ⟨f,hf⟩ := (P.crossingOutput N hD).merge_unordered_target b + exact ⟨f,(qmaUnorderedPair_map vertex ha).trans (hb'.trans hf.symm)⟩ + +include backward in +theorem canonical_target (f : (P.crossingOutput N hD).merge.Edge) : + ∃ e : (graph x hn).Edge, + s(vertex ((graph x hn).left e),vertex ((graph x hn).right e)) = + s((P.crossingOutput N hD).merge.left f,(P.crossingOutput N hD).merge.right f) := by + obtain ⟨b,hb'⟩ := (P.crossingOutput N hD).merge_unordered_source f + obtain ⟨a,ha⟩ := backward b + obtain ⟨e,he⟩ := graph_target x hb hn a + exact ⟨e,(qmaUnorderedPair_map vertex he).trans (ha.trans hb'.symm)⟩ + +def edge : (graph x hn).Edge ≃ (P.crossingOutput N hD).merge.Edge := + QuantumEndpointRelabel.edge vertex (graph_simple x hn) (P.crossingOutput N hD).merge_simple + (canonical_source P N hD x hb hn vertex forward) + (canonical_target P N hD x hb hn vertex backward) + +theorem edge_endpoints (e : (graph x hn).Edge) : + s(vertex ((graph x hn).left e),vertex ((graph x hn).right e)) = + s((P.crossingOutput N hD).merge.left (edge P N hD x hb hn vertex forward backward e), + (P.crossingOutput N hD).merge.right (edge P N hD x hb hn vertex forward backward e)) := + QuantumEndpointRelabel.chooseEdge_spec + (G := (P.crossingOutput N hD).merge) (H := graph x hn) vertex + (canonical_source P N hD x hb hn vertex forward) e + +end Canonical +end ContinuumCoulomb.QuantumPlanarTapeGeometry + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPolarizedSubdivision.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPolarizedSubdivision.lean new file mode 100644 index 0000000000000000000000000000000000000000..d76323b7c67bbede205d1ce77be95d9b7598bcd1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPolarizedSubdivision.lean @@ -0,0 +1,149 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZSubdivision +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedSplit + +namespace OAI + +/-! Literal four-word subdivision for even-Y interactions. The mediator +letter is Y precisely when each input factor has odd Y parity. All output +coefficients are rational when the input coefficient and scale are rational. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPolarizedSubdivision +open Matrix +open scoped BigOperators Classical +variable {ι κ : Type} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +def axis (p : Bool) : Fin 4 := if p then 2 else 1 + +theorem single_flip (m : κ → Bool) (e : κ) : + qmaPauliWord (qmaSinglePauliWord e (axis (m e))) = qmaPolarizedFlip m e := by + cases hm : m e + · simpa only [axis,hm,Bool.false_eq_true,ite_false,qmaPolarizedFlip_eq] using + qmaSinglePauliWord_X e + · have hY (u v : Fin 2) : qmaPauli 2 u v = + if u = Equiv.swap (0:Fin 2) 1 v then + (if v = 1 then -Complex.I else Complex.I) else 0 := by + fin_cases u <;> fin_cases v <;> + norm_num [qmaPauli,pauliY,Equiv.swap_apply_def] + ext s t + simp only [axis,hm,ite_true,qmaSinglePauliWord_apply,hY,qmaPolarizedFlip] + by_cases h : s = qmaBitFlip e t + · subst s + have he : qmaBitFlip e t e = Equiv.swap (0:Fin 2) 1 (t e) := by simp [qmaBitFlip] + rw [ite_eq_left he,ite_eq_left rfl] + have hp : (∏ k ∈ Finset.univ.erase e, + if qmaBitFlip e t k = t k then (1:ℂ) else 0) = 1 := by + apply Finset.prod_eq_one + intro k hk + simp [qmaBitFlip,(Finset.mem_erase.mp hk).1] + rw [hp,mul_one] + · rw [ite_eq_right h] + obtain ⟨k,hk⟩ := Function.ne_iff.mp h + by_cases hke : k = e + · subst k + have he : s e ≠ Equiv.swap (0:Fin 2) 1 (t e) := by simpa [qmaBitFlip] using hk + rw [ite_eq_right he,zero_mul] + · have he : s k ≠ t k := by simpa [qmaBitFlip,hke] using hk + rw [Finset.prod_eq_zero (Finset.mem_erase.mpr ⟨hke,Finset.mem_univ _⟩) + (ite_eq_right he),mul_zero] + +def word (a b : ι → Fin 4) (e : κ) (m : κ → Bool) : + Fin 4 → (ι ⊕ κ → Fin 4) := + ![fun _ => 0,Sum.elim (fun _ => 0) (qmaSinglePauliWord e 3), + Sum.elim a (qmaSinglePauliWord e (axis (m e))), + Sum.elim b (qmaSinglePauliWord e (axis (m e)))] + +def weight (R j : ℚ) : Fin 4 → ℚ := + ![R^2/2+1+(j/2)^2,-R^2/2,R,-R*j/2] + +theorem weight_cast (R j : ℚ) (k : Fin 4) : + (weight R j k : ℝ) = qmaXZSubdivisionWeight (R:ℝ) (j:ℝ) k := by + fin_cases k <;> simp [weight,qmaXZSubdivisionWeight] + +omit [DecidableEq ι] in +theorem sum_eq (a b : ι → Fin 4) (e : κ) (m : κ → Bool) (R j : ℚ) : + (∑ k, (weight R j k:ℂ) • qmaPauliWord (word a b e m k)) = + ∑ k, qmaSubdivisionLocalPiece (qmaPauliWord a) (qmaPauliWord b) + e (R:ℝ) (j:ℝ) m k := by + have hc (k : Fin 4) : (weight R j k:ℂ) = + ((qmaXZSubdivisionWeight (R:ℝ) (j:ℝ) k:ℝ):ℂ) := by + rw [← weight_cast] + norm_cast + simp only [hc,word,qmaXZSubdivisionWeight,qmaSubdivisionLocalPiece, + Fin.sum_univ_succ,Fin.sum_univ_zero,Matrix.cons_val_zero,Matrix.cons_val_succ,add_zero, + qmaPauliWord_zero,← qmaPauliWord_join,single_flip,qmaJoinOccupation_pauli] + have hr (r : ℝ) (M : Matrix (ι ⊕ κ → Fin 2) (ι ⊕ κ → Fin 2) ℂ) : + r • M = (r:ℂ) • M := rfl + simp only [hr] + push_cast + module + +theorem support (a b : ι → Fin 4) (e : κ) (m : κ → Bool) {d : ℕ} + (ha : (qmaPauliSupport a).card ≤ d) (hb : (qmaPauliSupport b).card ≤ d) + (k : Fin 4) : (qmaPauliSupport (word a b e m k)).card ≤ d+1 := by + have hs (i : Fin 4) : (qmaPauliSupport (qmaSinglePauliWord e i)).card ≤ 1 := + (Finset.card_le_card (qmaSinglePauliWord_support e i)).trans (by simp) + fin_cases k + · change (qmaPauliSupport (fun _ : ι ⊕ κ => 0)).card ≤ d+1 + simp [qmaPauliSupport] + · change (qmaPauliSupport (Sum.elim (fun _ : ι => 0) (qmaSinglePauliWord e 3))).card ≤ d+1 + rw [qmaPauliSupport_join_card] + have hz : (qmaPauliSupport (fun _ : ι => 0)).card = 0 := by simp [qmaPauliSupport] + rw [hz] + have := hs 3 + omega + · change (qmaPauliSupport (Sum.elim a (qmaSinglePauliWord e (axis (m e))))).card ≤ d+1 + rw [qmaPauliSupport_join_card] + have := hs (axis (m e)) + omega + · change (qmaPauliSupport (Sum.elim b (qmaSinglePauliWord e (axis (m e))))).card ≤ d+1 + rw [qmaPauliSupport_join_card] + have := hs (axis (m e)) + omega + +omit [DecidableEq ι] [DecidableEq κ] in +theorem yCount_join (a : ι → Fin 4) (b : κ → Fin 4) : + qmaPauliYCount (Sum.elim a b) = qmaPauliYCount a+qmaPauliYCount b := by + simp only [qmaPauliYCount,Finset.card_filter,Fintype.sum_sum_type,Sum.elim_inl,Sum.elim_inr] + rfl + +theorem yCount_single (e : κ) (μ : Fin 4) : + qmaPauliYCount (qmaSinglePauliWord e μ) = if μ = 2 then 1 else 0 := by + have hset : Finset.univ.filter (fun i => qmaSinglePauliWord e μ i = 2) = + if μ = 2 then {e} else ∅ := by + ext i + simp only [Finset.mem_filter,Finset.mem_univ,true_and] + by_cases hm : μ = 2 <;> by_cases hi : i = e <;> + simp [qmaSinglePauliWord,hi,hm] + rw [qmaPauliYCount,hset] + split_ifs <;> simp + +omit [DecidableEq ι] in +private theorem parity_padding (v : ι → Fin 4) : + Even (qmaPauliYCount v+if axis (decide (Odd (qmaPauliYCount v))) = 2 then 1 else 0) := by + by_cases h : Odd (qmaPauliYCount v) + · simp [axis,h] + · simpa [axis,h] using (Nat.even_or_odd (qmaPauliYCount v)).resolve_right h + +omit [DecidableEq ι] in +theorem even (a b : ι → Fin 4) (e : κ) (m : κ → Bool) + (ha : m e = decide (Odd (qmaPauliYCount a))) + (hb : m e = decide (Odd (qmaPauliYCount b))) (k : Fin 4) : + Even (qmaPauliYCount (word a b e m k)) := by + fin_cases k + · simp [word,qmaPauliYCount] + · change Even (qmaPauliYCount (Sum.elim (fun _ : ι => 0) (qmaSinglePauliWord e 3))) + rw [yCount_join,yCount_single] + simp [qmaPauliYCount] + · change Even (qmaPauliYCount (Sum.elim a (qmaSinglePauliWord e (axis (m e))))) + rw [yCount_join,yCount_single,ha] + exact parity_padding a + · change Even (qmaPauliYCount (Sum.elim b (qmaSinglePauliWord e (axis (m e))))) + rw [yCount_join,yCount_single,hb] + exact parity_padding b + +end ContinuumCoulomb.QuantumPolarizedSubdivision + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPolarizedThird.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPolarizedThird.lean new file mode 100644 index 0000000000000000000000000000000000000000..e8c90b6e95b277d491033128c0360163d2aa3b10 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPolarizedThird.lean @@ -0,0 +1,104 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPolarizedSubdivision +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZThird +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdPhased + +namespace OAI + +/-! Seven literal rational Pauli words for the real-preserving third-order +gadget. The two possibly imaginary factors use the same mediator phase. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPolarizedThird +open Matrix +open scoped BigOperators Classical +variable {ι κ : Type} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +def word (a b c v : ι → Fin 4) (e : κ) (m : κ → Bool) : + Fin 7 → (ι ⊕ κ → Fin 4) := + ![fun _ => 0, Sum.elim (fun _ => 0) (qmaSinglePauliWord e 3), + Sum.elim v (fun _ => 0), Sum.elim c (fun _ => 0), + Sum.elim c (qmaSinglePauliWord e 3), + Sum.elim a (qmaSinglePauliWord e (QuantumPolarizedSubdivision.axis (m e))), + Sum.elim b (qmaSinglePauliWord e (QuantumPolarizedSubdivision.axis (m e)))] + +def weight (R j : ℚ) : Fin 7 → ℚ := + ![R^3/2+R*(1+(j/2)^2), -R^3/2, R*j, R^2/2-(1+(j/2)^2), + -R^2/2, R^2, R^2*j/2] + +theorem weight_cast (R j : ℚ) (k : Fin 7) : + (weight R j k : ℝ) = qmaXZThirdWeight (R:ℝ) (j:ℝ) k := by + fin_cases k <;> simp [weight,qmaXZThirdWeight] + +theorem sum_eq (a b c v : ι → Fin 4) (e : κ) (m : κ → Bool) (R j : ℚ) + (hab : qmaPauliWord a*qmaPauliWord b = qmaPauliWord v) : + (∑ k, (weight R j k : ℂ) • qmaPauliWord (word a b c v e m k)) = + ∑ k, qmaThirdPhasedLocalPiece (qmaPauliWord a) (qmaPauliWord b) + (qmaPauliWord c) e (R:ℝ) (j:ℝ) m k := by + have hI : qmaJoinMatrix (1 : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ) = 1 := by + simp [qmaJoinMatrix,Matrix.submatrix_one_equiv] + simp only [word,weight,qmaThirdPhasedLocalPiece_eq, + Fin.sum_univ_succ,Fin.sum_univ_zero,Matrix.cons_val_zero,Matrix.cons_val_succ,add_zero, + qmaPauliWord_zero,← qmaPauliWord_join,QuantumPolarizedSubdivision.single_flip, + qmaJoinOccupation_expand,hI,hab] + have hr (r : ℝ) (M : Matrix (ι ⊕ κ → Fin 2) (ι ⊕ κ → Fin 2) ℂ) : + r • M = (r:ℂ) • M := rfl + simp only [hr] + push_cast + module + +theorem support (a b c v : ι → Fin 4) (e : κ) (m : κ → Bool) + (ha : (qmaPauliSupport a).card ≤ 1) (hb : (qmaPauliSupport b).card ≤ 1) + (hc : (qmaPauliSupport c).card ≤ 1) (hv : (qmaPauliSupport v).card ≤ 2) (k : Fin 7) : + (qmaPauliSupport (word a b c v e m k)).card ≤ 2 := by + have hzι : (qmaPauliSupport (fun _ : ι => 0)).card = 0 := by simp [qmaPauliSupport] + have hzκ : (qmaPauliSupport (fun _ : κ => 0)).card = 0 := by simp [qmaPauliSupport] + have hs (i : Fin 4) : (qmaPauliSupport (qmaSinglePauliWord e i)).card ≤ 1 := + (Finset.card_le_card (qmaSinglePauliWord_support e i)).trans (by simp) + fin_cases k + · change (qmaPauliSupport (fun _ : ι ⊕ κ => 0)).card ≤ 2 + simp [qmaPauliSupport] + · change (qmaPauliSupport (Sum.elim (fun _ : ι => 0) (qmaSinglePauliWord e 3))).card ≤ 2 + rw [qmaPauliSupport_join_card,hzι] + simpa using (hs 3).trans (by norm_num : 1 ≤ 2) + · change (qmaPauliSupport (Sum.elim v (fun _ : κ => 0))).card ≤ 2 + simpa only [qmaPauliSupport_join_card,hzκ,add_zero] using hv + · change (qmaPauliSupport (Sum.elim c (fun _ : κ => 0))).card ≤ 2 + simpa only [qmaPauliSupport_join_card,hzκ,add_zero] using hc.trans (by norm_num : 1 ≤ 2) + · change (qmaPauliSupport (Sum.elim c (qmaSinglePauliWord e 3))).card ≤ 2 + rw [qmaPauliSupport_join_card] + exact (Nat.add_le_add hc (hs 3)).trans (by norm_num) + · change (qmaPauliSupport (Sum.elim a _)).card ≤ 2 + rw [qmaPauliSupport_join_card] + exact (Nat.add_le_add ha (hs _)).trans (by norm_num) + · change (qmaPauliSupport (Sum.elim b _)).card ≤ 2 + rw [qmaPauliSupport_join_card] + exact (Nat.add_le_add hb (hs _)).trans (by norm_num) + +omit [DecidableEq ι] in +theorem even (a b c v : ι → Fin 4) (e : κ) (m : κ → Bool) + (ha : m e = decide (Odd (qmaPauliYCount a))) + (hb : m e = decide (Odd (qmaPauliYCount b))) + (hc : Even (qmaPauliYCount c)) (hv : Even (qmaPauliYCount v)) (k : Fin 7) : + Even (qmaPauliYCount (word a b c v e m k)) := by + have hsub := QuantumPolarizedSubdivision.even a b e m ha hb + have hz : qmaPauliYCount (fun _ : κ => (0:Fin 4)) = 0 := by simp [qmaPauliYCount] + fin_cases k + · simp [word,qmaPauliYCount] + · exact hsub 1 + · change Even (qmaPauliYCount (Sum.elim v (fun _ : κ => 0))) + simpa only [QuantumPolarizedSubdivision.yCount_join,hz,add_zero] using hv + · change Even (qmaPauliYCount (Sum.elim c (fun _ : κ => 0))) + simpa only [QuantumPolarizedSubdivision.yCount_join,hz,add_zero] using hc + · change Even (qmaPauliYCount (Sum.elim c (qmaSinglePauliWord e 3))) + simpa only [QuantumPolarizedSubdivision.yCount_join, + QuantumPolarizedSubdivision.yCount_single,show (3:Fin 4) ≠ 2 by decide, + ite_false,add_zero] using hc + · exact hsub 2 + · exact hsub 3 + +end ContinuumCoulomb.QuantumPolarizedThird + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPolynomialUnary.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPolynomialUnary.lean new file mode 100644 index 0000000000000000000000000000000000000000..cf5153c51ca28808ae8d420452e82a9fa485af1e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPolynomialUnary.lean @@ -0,0 +1,30 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCircuitCode + +namespace OAI + +/-! A fixed natural polynomial has a literal unary evaluation program. The +polynomial is compiled by Horner recursion, using unary addition and multiplication. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPolynomialUnary +open ExactQuantumFactoring.BitStackProgram + +noncomputable def program (p : Polynomial ℕ) : + Procedure unaryCode unaryCode p.eval := by + refine Polynomial.recOnHorner p ?_ ?_ ?_ + · exact (Procedure.constant unaryCode unaryCode 0).congrFun (by intro n; simp) + · intro q a _ _ hq + exact (Procedure.unaryAdd.comp + (hq.pair (Procedure.constant unaryCode unaryCode a))).congrFun (by + intro n + simp only [Function.comp_apply,Polynomial.eval_add,Polynomial.eval_C]) + · intro q _ hq + exact (Procedure.unaryMul.comp (hq.pair (Procedure.identity unaryCode))).congrFun (by + intro n + simp only [Function.comp_apply,id_eq,Polynomial.eval_mul,Polynomial.eval_X]) + +end ContinuumCoulomb.QuantumPolynomialUnary + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortCellPositive.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortCellPositive.lean new file mode 100644 index 0000000000000000000000000000000000000000..a887a7e6fb784d7e122ba871140aed0937f4e34f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortCellPositive.lean @@ -0,0 +1,61 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRetainedCrossing +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumInnerPorts + +namespace OAI + +/-! Every cell touched by an actual port-graph edge lies in the positive quadrant. -/ + +namespace ContinuumCoulomb + +def qmaPointCell (z : ℕ × ℕ) : ℕ × ℕ := (z.1/32,z.2/32) + +@[simp] theorem qmaPointCell_center (p : ℕ × ℕ) : qmaPointCell (qmaExpandedPoint p) = p := + qmaExpandedPoint_cell p + +@[simp] theorem qmaPointCell_port (p : ℕ × ℕ) (a : Fin 4) : qmaPointCell (qmaGridPort p a) = p := + qmaGridPort_cell p a + +noncomputable section +namespace QMAPortRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + +theorem chain_cell_positive (e : G.Edge) (k : ℕ) (hk : k ≤ 2*P.length e+1) : + 0 < (qmaPointCell (qmaPortChain (P.point e) (P.length e) k)).1 ∧ + 0 < (qmaPointCell (qmaPortChain (P.point e) (P.length e) k)).2 := by + by_cases h0 : k = 0 + · subst k + simpa only [qmaPortChain_zero,qmaPointCell_center] using P.positive e 0 (Nat.zero_le _) + by_cases hlast : k = 2*P.length e+1 + · subst k + simpa only [qmaPortChain_last,qmaPointCell_center] using P.positive e (P.length e) le_rfl + rw [qmaPortChain_inner (P.point e) (by omega) (by omega)] + change 0 < (qmaPointCell (qmaGridPort (P.point e (k/2)) _)).1 ∧ + 0 < (qmaPointCell (qmaGridPort (P.point e (k/2)) _)).2 + rw [qmaPointCell_port] + exact P.positive e (k/2) (by omega) + +theorem graph_cell_positive {x y : ℕ × ℕ} (h : P.graph.Adj x y) : + (0 < (qmaPointCell x).1 ∧ 0 < (qmaPointCell x).2) ∧ + (0 < (qmaPointCell y).1 ∧ 0 < (qmaPointCell y).2) := by + change _ ≠ _ ∧ _ at h + rcases h.2 with ⟨e,k,hk,hl,hr⟩ | ⟨e,k,hk,hl,hr⟩ + · rw [← hl,← hr] + exact ⟨P.chain_cell_positive e k hk.le,P.chain_cell_positive e (k+1) (by omega)⟩ + · rw [← hl,← hr] + exact ⟨P.chain_cell_positive e (k+1) (by omega),P.chain_cell_positive e k hk.le⟩ + +theorem finished_port_cell_positive (N : ℚ) (D : ℕ) (v : Fin (P.finishedGraph N D).n) + {p : ℕ × ℕ} {a : Fin 4} (hv : P.finishedPosition N D v = qmaGridPort p a) : + 0 < p.1 ∧ 0 < p.2 := by + have h := P.toEmbedding.iterate_occupied_source N D (Or.inl ⟨v,hv⟩) + rcases h with ⟨w,hw⟩ | ⟨e,k,hk,he⟩ + · exact (qmaGridPort_ne_center p (P.position w) a hw.symm).elim + · have hp := P.chain_cell_positive e k hk + change qmaPortChain (P.point e) (P.length e) k = qmaGridPort p a at he + simpa only [he,qmaPointCell_port] using hp + +end QMAPortRouteData +end +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortChain.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortChain.lean new file mode 100644 index 0000000000000000000000000000000000000000..03fe2a405bea2253c0ee36a0f37eebb33c0af27b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortChain.lean @@ -0,0 +1,71 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridPorts + +namespace OAI + +/-! Each coarse route is replaced by its ordered incoming and outgoing cell ports. -/ + +namespace ContinuumCoulomb + +def qmaPortNeighborIndex (k : ℕ) : ℕ := if k%2 = 1 then k/2+1 else k/2-1 + +def qmaRoutePort (p : ℕ → ℕ × ℕ) (k : ℕ) : ℕ × ℕ := + qmaDirectedPort (p (k/2)) (p (qmaPortNeighborIndex k)) + +def qmaPortChain (p : ℕ → ℕ × ℕ) (L k : ℕ) : ℕ × ℕ := + if k = 0 then qmaExpandedPoint (p 0) else + if k = 2*L+1 then qmaExpandedPoint (p L) else qmaRoutePort p k + +@[simp] theorem qmaPortChain_zero (p : ℕ → ℕ × ℕ) (L : ℕ) : + qmaPortChain p L 0 = qmaExpandedPoint (p 0) := by simp [qmaPortChain] + +@[simp] theorem qmaPortChain_last (p : ℕ → ℕ × ℕ) (L : ℕ) : + qmaPortChain p L (2*L+1) = qmaExpandedPoint (p L) := by simp [qmaPortChain] + +theorem qmaPortChain_inner (p : ℕ → ℕ × ℕ) {L k : ℕ} (hk0 : 0 < k) (hk : k < 2*L+1) : + qmaPortChain p L k = qmaRoutePort p k := by + simp [qmaPortChain,show k ≠ 0 from by omega,show k ≠ 2*L+1 from by omega] + +theorem qmaPortNeighborIndex_bounds {L k : ℕ} (_hk0 : 0 < k) (hk : k < 2*L+1) : + k/2 ≤ L ∧ qmaPortNeighborIndex k ≤ L := by + unfold qmaPortNeighborIndex + split_ifs <;> omega + +theorem qmaPortNeighborIndex_injective {L i j : ℕ} (hi0 : 0 < i) (_hi : i < 2*L+1) + (hj0 : 0 < j) (_hj : j < 2*L+1) (hd : i/2 = j/2) + (hn : qmaPortNeighborIndex i = qmaPortNeighborIndex j) : i = j := by + unfold qmaPortNeighborIndex at hn + split_ifs at hn <;> omega + +theorem qmaRoutePort_adjacent (p : ℕ → ℕ × ℕ) {L k : ℕ} + (hp : ∀ i < L, qmaSquareGrid.Adj (p i) (p (i+1))) (hk0 : 0 < k) (hk : k < 2*L+1) : + qmaSquareGrid.Adj (p (k/2)) (p (qmaPortNeighborIndex k)) := by + by_cases h : k%2 = 1 + · simp only [qmaPortNeighborIndex,h,ite_true] + exact hp (k/2) (by omega) + · simp only [qmaPortNeighborIndex,h,ite_false] + have he : k/2-1+1 = k/2 := by omega + have ha := hp (k/2-1) (by omega) + rw [he] at ha + exact ha.symm + +theorem qmaPortChain_inner_not_center (p : ℕ → ℕ × ℕ) {L k : ℕ} + (hk0 : 0 < k) (hk : k < 2*L+1) (q : ℕ × ℕ) : qmaPortChain p L k ≠ qmaExpandedPoint q := by + rw [qmaPortChain_inner p hk0 hk] + exact qmaGridPort_ne_center _ _ _ + +theorem qmaPortChain_inner_injective (p : ℕ → ℕ × ℕ) {L : ℕ} + (hp : ∀ i < L, qmaSquareGrid.Adj (p i) (p (i+1))) + (hpos : ∀ i ≤ L, 0 < (p i).1 ∧ 0 < (p i).2) + (hs : ∀ i j, i ≤ L → j ≤ L → p i = p j → i = j) + {i j : ℕ} (hi0 : 0 < i) (hi : i < 2*L+1) (hj0 : 0 < j) (hj : j < 2*L+1) + (h : qmaPortChain p L i = qmaPortChain p L j) : i = j := by + rw [qmaPortChain_inner p hi0 hi,qmaPortChain_inner p hj0 hj] at h + obtain ⟨hiB,hiN⟩ := qmaPortNeighborIndex_bounds hi0 hi + obtain ⟨hjB,hjN⟩ := qmaPortNeighborIndex_bounds hj0 hj + have he := qmaDirectedPort_injective (hpos _ hiB) (hpos _ hjB) + (qmaRoutePort_adjacent p hp hi0 hi) (qmaRoutePort_adjacent p hp hj0 hj) h + exact qmaPortNeighborIndex_injective hi0 hi hj0 hj (hs _ _ hiB hjB he.1) (hs _ _ hiN hjN he.2) + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortChainActual.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortChainActual.lean new file mode 100644 index 0000000000000000000000000000000000000000..115670c9cffde3a05b5593d9bea07c740c6e4ce7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortChainActual.lean @@ -0,0 +1,102 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortChainProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingInputActual +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedPortChain + +namespace OAI + +/-! The literal port-chain program returns precisely the sites used by the +physical subdivision construction, including its two endpoint centers. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPortChainProgram +open ExactQuantumFactoring.BitStackProgram QuantumRouteCode + +theorem lookup_support {u v : Pair} (p : qmaSquareGrid.Walk u v) (k : ℕ) + (hk : k ≤ p.length) : QuantumPathVisitProgram.lookup p.support k = p.getVert k := by + unfold QuantumPathVisitProgram.lookup + rw [List.headD_eq_head?_getD,List.head?_drop,← p.getVert_eq_support_getElem? hk] + rfl + +theorem point_eq (xs : List Pair) (p : ℕ → Pair) (L : ℕ) + (hlen : xs.length = L+1) (hp : ∀ i ≤ L, QuantumPathVisitProgram.lookup xs i = p i) + (k : ℕ) (hk : k ≤ 2*L+1) : point xs k = qmaPortChain p L k := by + have hlen' : xs.length-1 = L := by omega + unfold point + rw [hlen'] + unfold qmaPortChain + split_ifs with hzero hlast + · rw [hp 0 (by omega)] + · rw [hp L le_rfl] + · have hi := qmaPortNeighborIndex_bounds (L := L) (by omega : 0 < k) + (by omega : k < 2*L+1) + unfold qmaRoutePort + rw [hp _ hi.1,hp _ hi.2] + +theorem value_support {u v : Pair} (p : qmaSquareGrid.Walk u v) : + value p.support = (List.range (2*p.length+2)).map (qmaPortChain p.getVert p.length) := by + unfold value + rw [p.length_support] + simp only [Nat.add_sub_cancel] + apply List.map_congr_left + intro k hk + have hk' : k < 2*p.length+2 := List.mem_range.mp hk + exact point_eq p.support p.getVert p.length p.length_support + (lookup_support p) k (by omega) + +def routed (A B : ℕ) (x : QuantumRoutingInputProgram.Input) : List Pair := + value (QuantumBufferedListProgram.path A B (QuantumRoutingInputProgram.value A B x)) + +noncomputable opaque routedProgram (A B : ℕ) : + Procedure QuantumRoutingInputProgram.inputCode (listCode pairCode) (routed A B) := + program.comp (QuantumRoutingInputProgram.pathProgram A B) + +def allRouted (A B : ℕ) (d : QuantumRoutingInputProgram.Data) : List (List Pair) := + (List.range d.2.length).map (fun i => routed A B (i,d)) + +noncomputable opaque allRoutedProgram (A B : ℕ) : + Procedure QuantumRoutingInputProgram.dataCode (listCode (listCode pairCode)) + (allRouted A B) := by + let edges : Procedure QuantumRoutingInputProgram.dataCode (listCode pairCode) + (fun d => d.2) := Procedure.second + (prodCode (listCode pairCode) (listCode pairCode)) (listCode pairCode) + let n : Procedure QuantumRoutingInputProgram.dataCode unaryCode (fun d => d.2.length) := + (ExactQuantumFactoring.NativeAIG.Emission.listUnaryLength pairCode (0,0)).comp edges + let tab : Procedure (prodCode unaryCode QuantumRoutingInputProgram.dataCode) + (listCode (listCode pairCode)) + (fun x => (List.range x.1).map (fun i => routed A B (i,x.2))) := + Procedure.tabulate (f := fun d i => routed A B (i,d)) [] (routedProgram A B) + exact (tab.comp (n.pair (Procedure.identity QuantumRoutingInputProgram.dataCode))).congrFun + (by intro d; rfl) + +@[simp] theorem allRouted_length (A B : ℕ) (d : QuantumRoutingInputProgram.Data) : + (allRouted A B d).length = d.2.length := by + simp only [allRouted,List.length_map,List.length_range] + +theorem allRouted_get (A B : ℕ) (d : QuantumRoutingInputProgram.Data) (i : Fin d.2.length) : + (allRouted A B d)[i.val]'(by simpa only [allRouted_length] using i.isLt) = + routed A B (i.val,d) := by + simp only [allRouted,List.getElem_map,List.getElem_range] + +theorem routed_actual {A B : ℕ} (M : QMASpatialExchangeModel A B) {m : ℕ} + (labels : M.Term ≃ Fin m) (hA : 0 < A) + (hd : ∀ v, qmaGraphDegree M.left M.right v ≤ 3) (e : M.Term) : + routed A B ((labels e).val,QuantumRoutingInputProgram.actualData M labels) = + (List.range (2*(M.withOrdinalSlots labels).coarseLength hd e+2)).map + (qmaPortChain ((M.withOrdinalSlots labels).coarseRoute hd e) + ((M.withOrdinalSlots labels).coarseLength hd e)) := by + exact (congrArg value (QuantumRoutingInputProgram.path_actual M labels hA hd e)).trans + (value_support ((M.withOrdinalSlots labels).bufferedPath hd e).val) + +theorem routed_actual_length {A B : ℕ} (M : QMASpatialExchangeModel A B) {m : ℕ} + (labels : M.Term ≃ Fin m) (hA : 0 < A) + (hd : ∀ v, qmaGraphDegree M.left M.right v ≤ 3) (e : M.Term) : + (routed A B ((labels e).val,QuantumRoutingInputProgram.actualData M labels)).length = + 2*(M.withOrdinalSlots labels).coarseLength hd e+2 := by + exact (congrArg List.length (routed_actual M labels hA hd e)).trans + (by simp only [List.length_map,List.length_range]) + +end ContinuumCoulomb.QuantumPortChainProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortChainBounds.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortChainBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..c7d7a2a059b5197e23a19138e2352c49cd04f64b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortChainBounds.lean @@ -0,0 +1,32 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortChain + +namespace OAI + +/-! Uniform rectangular bounds for the complete port-chain construction. -/ + +namespace ContinuumCoulomb + +theorem qmaExpandedPoint_bounds {p : ℕ × ℕ} {X Y : ℕ} + (hx : p.1 < X) (hy : p.2 < Y) : + (qmaExpandedPoint p).1 < 32*X ∧ (qmaExpandedPoint p).2 < 32*Y := by + dsimp [qmaExpandedPoint] + omega + +theorem qmaPortChain_bounds (p : ℕ → ℕ × ℕ) {L X Y : ℕ} + (hp : ∀ i ≤ L, (p i).1 < X ∧ (p i).2 < Y) + (k : ℕ) (hk : k ≤ 2*L+1) : + (qmaPortChain p L k).1 < 32*X ∧ (qmaPortChain p L k).2 < 32*Y := by + by_cases hk0 : k = 0 + · subst k + rw [qmaPortChain_zero] + exact qmaExpandedPoint_bounds (hp 0 (Nat.zero_le _)).1 (hp 0 (Nat.zero_le _)).2 + by_cases hkL : k = 2*L+1 + · subst k + rw [qmaPortChain_last] + exact qmaExpandedPoint_bounds (hp L le_rfl).1 (hp L le_rfl).2 + rw [qmaPortChain_inner p (by omega) (by omega)] + exact qmaGridPort_bounds (hp (k/2) (by omega)).1 (hp (k/2) (by omega)).2 _ + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortChainProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortChainProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..c33ffa5486f718868df9af8c1b925f48ec72c106 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortChainProgram.lean @@ -0,0 +1,119 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortChain +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathVisitProgram +import OAI.Computability.QuantumFactoring.BitStackDivision + +namespace OAI + +/-! Literal evaluation of the physical port chain on a computed coarse path. +The output enumerates both endpoint centers and every incoming/outgoing port. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPortChainProgram +open ExactQuantumFactoring.BitStackProgram QuantumRouteCode + +def offset (p : Pair) (x y : ℕ) : Pair := (32*p.1+x,32*p.2+y) + +noncomputable def offsetProgram (x y : ℕ) : Procedure pairCode pairCode + (fun p => offset p x y) := by + let coord (p : Procedure pairCode Nat.bits Prod.fst) (c : ℕ) := + Procedure.binaryAdd.comp + ((Procedure.binaryMul.comp ((Procedure.constant pairCode Nat.bits 32).pair p)).pair + (Procedure.constant pairCode Nat.bits c)) + let py := Procedure.second Nat.bits Nat.bits + let vy := Procedure.binaryAdd.comp + ((Procedure.binaryMul.comp ((Procedure.constant pairCode Nat.bits 32).pair py)).pair + (Procedure.constant pairCode Nat.bits y)) + exact (coord (Procedure.first Nat.bits Nat.bits) x).pair vy + +def port (p : Pair) (a : ℕ) : Pair := + if a=0 then offset p 23 16 else if a=1 then offset p 16 23 + else if a=2 then offset p 9 16 else offset p 16 9 + +theorem port_fin (p : Pair) (a : Fin 4) : port p a.val = qmaGridPort p a := by + fin_cases a <;> rfl + +noncomputable def portProgram : Procedure (prodCode pairCode Nat.bits) pairCode + (fun x => port x.1 x.2) := by + let p := Procedure.first pairCode Nat.bits + let a := Procedure.second pairCode Nat.bits + let is (i : ℕ) := Procedure.binaryEq.comp (a.pair (Procedure.constant _ Nat.bits i)) + exact (Procedure.conditional (is 0) ((offsetProgram 23 16).comp p) + (Procedure.conditional (is 1) ((offsetProgram 16 23).comp p) + (Procedure.conditional (is 2) ((offsetProgram 9 16).comp p) + ((offsetProgram 16 9).comp p)))).congrFun (by + intro x + simp only [Function.comp_apply,decide_eq_true_eq,port]) + +noncomputable def directedProgram : Procedure (prodCode pairCode pairCode) pairCode + (fun x => qmaDirectedPort x.1 x.2) := + (portProgram.comp ((Procedure.first pairCode pairCode).pair + QuantumPathVisitProgram.neighborIndexProgram)).congrFun (by + intro x + exact port_fin x.1 (qmaGridNeighborIndex x.1 x.2)) + +noncomputable def centerProgram : Procedure pairCode pairCode qmaExpandedPoint := + offsetProgram 16 16 + +noncomputable def neighborProgram : Procedure Nat.bits Nat.bits qmaPortNeighborIndex := by + let half := Procedure.binaryDiv.comp + ((Procedure.identity Nat.bits).pair (Procedure.constant Nat.bits Nat.bits 2)) + let parity := Procedure.binaryMod.comp + ((Procedure.identity Nat.bits).pair (Procedure.constant Nat.bits Nat.bits 2)) + let isOdd := Procedure.binaryEq.comp (parity.pair (Procedure.constant Nat.bits Nat.bits 1)) + let up := Procedure.binaryAdd.comp (half.pair (Procedure.constant Nat.bits Nat.bits 1)) + let down := Procedure.binarySub.comp (half.pair (Procedure.constant Nat.bits Nat.bits 1)) + exact (Procedure.conditional isOdd up down).congrFun (by + intro k + simp only [Function.comp_apply,id_eq,decide_eq_true_eq,qmaPortNeighborIndex]) + +abbrev Input := ℕ × List Pair +def inputCode : Input → List Bool := prodCode unaryCode (listCode pairCode) + +def point (xs : List Pair) (k : ℕ) : Pair := + qmaPortChain (QuantumPathVisitProgram.lookup xs) (xs.length-1) k + +noncomputable def lengthProgram : Procedure (listCode pairCode) unaryCode + (fun xs => xs.length-1) := + Procedure.unarySub.comp + ((ExactQuantumFactoring.NativeAIG.Emission.listUnaryLength pairCode (0,0)).pair + (Procedure.constant (listCode pairCode) unaryCode 1)) + +noncomputable def pointProgram : Procedure inputCode pairCode (fun x => point x.2 x.1) := by + let k := Procedure.unaryToBits.comp (Procedure.first unaryCode (listCode pairCode)) + let xs := Procedure.second unaryCode (listCode pairCode) + let len := Procedure.unaryToBits.comp (lengthProgram.comp xs) + let last := Procedure.binaryAdd.comp + ((Procedure.binaryMul.comp ((Procedure.constant inputCode Nat.bits 2).pair len)).pair + (Procedure.constant inputCode Nat.bits 1)) + let first := (Procedure.listGet pairCode (0,0)).comp + ((Procedure.constant inputCode Nat.bits 0).pair xs) + let final := (Procedure.listGet pairCode (0,0)).comp (len.pair xs) + let half := Procedure.binaryDiv.comp (k.pair (Procedure.constant inputCode Nat.bits 2)) + let here := (Procedure.listGet pairCode (0,0)).comp (half.pair xs) + let there := (Procedure.listGet pairCode (0,0)).comp ((neighborProgram.comp k).pair xs) + let inner := directedProgram.comp (here.pair there) + exact (Procedure.conditional (Procedure.binaryZero.comp k) (centerProgram.comp first) + (Procedure.conditional (Procedure.binaryEq.comp (k.pair last)) + (centerProgram.comp final) inner)).congrFun (by + intro x + simp only [Function.comp_apply,id_eq,decide_eq_true_eq,point,qmaPortChain, + qmaRoutePort,QuantumPathVisitProgram.lookup]) + +def value (xs : List Pair) : List Pair := + (List.range (2*(xs.length-1)+2)).map (point xs) + +@[simp] theorem value_length (xs : List Pair) : (value xs).length = 2*(xs.length-1)+2 := by + simp only [value,List.length_map,List.length_range] + +noncomputable def program : Procedure (listCode pairCode) (listCode pairCode) value := by + let n := Procedure.unaryAdd.comp + ((Procedure.unaryMul.comp ((Procedure.constant (listCode pairCode) unaryCode 2).pair + lengthProgram)).pair (Procedure.constant (listCode pairCode) unaryCode 2)) + exact (Procedure.tabulate (f := point) (0,0) pointProgram).comp + (n.pair (Procedure.identity (listCode pairCode))) + +end ContinuumCoulomb.QuantumPortChainProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortChainSeparation.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortChainSeparation.lean new file mode 100644 index 0000000000000000000000000000000000000000..c508057c2c42e9ea24042055e41dfe9579d0c776 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortChainSeparation.lean @@ -0,0 +1,90 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortChain + +namespace OAI + +/-! Port chains are simple and remain disjoint even where coarse routes meet. -/ + +namespace ContinuumCoulomb + +theorem qmaPortChain_injective (p : ℕ → ℕ × ℕ) {L : ℕ} (hL : 0 < L) + (hp : ∀ i < L, qmaSquareGrid.Adj (p i) (p (i+1))) + (hpos : ∀ i ≤ L, 0 < (p i).1 ∧ 0 < (p i).2) + (hs : ∀ i j, i ≤ L → j ≤ L → p i = p j → i = j) + {i j : ℕ} (hi : i ≤ 2*L+1) (hj : j ≤ 2*L+1) + (h : qmaPortChain p L i = qmaPortChain p L j) : i = j := by + by_cases hi0 : i = 0 + · subst i + by_cases hj0 : j = 0 + · exact hj0.symm + by_cases hjL : j = 2*L+1 + · subst j + rw [qmaPortChain_zero,qmaPortChain_last] at h + have hz := hs 0 L (Nat.zero_le _) le_rfl (qmaExpandedPoint_injective h) + omega + · simp only [qmaPortChain_zero] at h + exact (qmaPortChain_inner_not_center p (L := L) (by omega) (by omega) _ h.symm).elim + by_cases hiL : i = 2*L+1 + · subst i + by_cases hj0 : j = 0 + · subst j + rw [qmaPortChain_zero,qmaPortChain_last] at h + have hz := hs L 0 le_rfl (Nat.zero_le _) (qmaExpandedPoint_injective h) + omega + by_cases hjL : j = 2*L+1 + · exact hjL.symm + · simp only [qmaPortChain_last] at h + exact (qmaPortChain_inner_not_center p (L := L) (by omega) (by omega) _ h.symm).elim + by_cases hj0 : j = 0 + · subst j + simp only [qmaPortChain_zero] at h + exact (qmaPortChain_inner_not_center p (L := L) (by omega) (by omega) _ h).elim + by_cases hjL : j = 2*L+1 + · subst j + simp only [qmaPortChain_last] at h + exact (qmaPortChain_inner_not_center p (L := L) (by omega) (by omega) _ h).elim + exact qmaPortChain_inner_injective p hp hpos hs (by omega) (by omega) (by omega) (by omega) h + +theorem qmaPortChain_interiors_disjoint (p q : ℕ → ℕ × ℕ) {L M : ℕ} + (hp : ∀ i < L, qmaSquareGrid.Adj (p i) (p (i+1))) + (hq : ∀ i < M, qmaSquareGrid.Adj (q i) (q (i+1))) + (hp0 : ∀ i ≤ L, 0 < (p i).1 ∧ 0 < (p i).2) + (hq0 : ∀ j ≤ M, 0 < (q j).1 ∧ 0 < (q j).2) + (he : ∀ i j, i < L → j < M → + ¬(p i = q j ∧ p (i+1) = q (j+1)) ∧ ¬(p i = q (j+1) ∧ p (i+1) = q j)) + {i j : ℕ} (hi0 : 0 < i) (hi : i < 2*L+1) (hj : j ≤ 2*M+1) : + qmaPortChain p L i ≠ qmaPortChain q M j := by + intro h + by_cases hj0 : j = 0 + · subst j + simp only [qmaPortChain_zero] at h + exact (qmaPortChain_inner_not_center p hi0 hi _ h).elim + by_cases hjM : j = 2*M+1 + · subst j + simp only [qmaPortChain_last] at h + exact (qmaPortChain_inner_not_center p hi0 hi _ h).elim + have hj' : j < 2*M+1 := by omega + rw [qmaPortChain_inner p hi0 hi,qmaPortChain_inner q (by omega) hj'] at h + obtain ⟨hib,_⟩ := qmaPortNeighborIndex_bounds hi0 hi + obtain ⟨hjb,_⟩ := qmaPortNeighborIndex_bounds (by omega : 0 < j) hj' + have hc := qmaDirectedPort_injective (hp0 _ hib) (hq0 _ hjb) + (qmaRoutePort_adjacent p hp hi0 hi) (qmaRoutePort_adjacent q hq (by omega) hj') h + by_cases hie : i%2 = 1 <;> by_cases hje : j%2 = 1 + · simp only [qmaPortNeighborIndex,hie,hje,ite_true] at hc + exact (he (i/2) (j/2) (by omega) (by omega)).1 hc + · simp only [qmaPortNeighborIndex,hie,hje,ite_true,ite_false] at hc + have hjp : j/2-1+1 = j/2 := by omega + apply (he (i/2) (j/2-1) (by omega) (by omega)).2 + simpa only [hjp] using hc + · simp only [qmaPortNeighborIndex,hie,hje,ite_true,ite_false] at hc + have hip : i/2-1+1 = i/2 := by omega + apply (he (i/2-1) (j/2) (by omega) (by omega)).2 + simpa only [hip] using And.intro hc.2 hc.1 + · simp only [qmaPortNeighborIndex,hie,hje,ite_false] at hc + have hip : i/2-1+1 = i/2 := by omega + have hjp : j/2-1+1 = j/2 := by omega + apply (he (i/2-1) (j/2-1) (by omega) (by omega)).1 + simpa only [hip,hjp] using And.intro hc.2 hc.1 + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortCrossingSelection.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortCrossingSelection.lean new file mode 100644 index 0000000000000000000000000000000000000000..308c11f630e3e613d0b8ce2ef7d7b2d0cfa6e6e4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortCrossingSelection.lean @@ -0,0 +1,59 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingSelectFromSites +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingSites + +namespace OAI + +/-! Select and remove the actual finite crossing cells in a completed rational +port graph. The gadget terminals are existing physical spins. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators Classical + +def qmaPatchDirection : Fin 4 → Fin 4 := ![2,1,0,3] + +theorem qmaPatchDirection_injective : Function.Injective qmaPatchDirection := by decide + +namespace QMAPortRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + +def crossingCell (i : Fin P.crossingCells.card) : P.Crossing := P.crossingCells.equivFin.symm i + +def crossingSiteFin (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) + (i : Fin P.crossingCells.card) (a : Fin 4) : Fin (P.finishedGraph N D).n := + P.crossingSite N hD (P.crossingCell i) (qmaPatchDirection a) + +theorem crossingSiteFin_injective (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) + (i : Fin P.crossingCells.card) : Function.Injective (P.crossingSiteFin N hD i) := by + intro a b h + have he : (P.crossingCell i,qmaPatchDirection a) = (P.crossingCell i,qmaPatchDirection b) := + P.crossingSite_injective N hD h + exact qmaPatchDirection_injective (congrArg (fun z : P.Crossing × Fin 4 => z.2) he) + +def portCrossingSelection (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) : + QMARationalCrossingSelection (P.finishedGraph N D) P.crossingCells.card := + (P.finishedGraph N D).crossingSelection (P.crossingSiteFin N hD) (P.crossingSiteFin_injective N hD) + +theorem portCrossing_energy_error {N : ℚ} (hN : 0 < N) {D : ℕ} (hD : ∀ e, P.length e ≤ D) : + |((P.portCrossingSelection N hD).layer.output N).energy-G.energy| ≤ ((D+1:ℕ):ℝ)/(N:ℝ) := by + have h1 := (P.portCrossingSelection N hD).output_energy_error hN + have h2 := P.schedule.iterate_energy_error hN D + calc + _ ≤ |((P.portCrossingSelection N hD).layer.output N).energy-(P.finishedGraph N D).energy| + + |(P.finishedGraph N D).energy-G.energy| := abs_sub_le _ _ _ + _ ≤ 1/(N:ℝ)+(D:ℝ)/(N:ℝ) := add_le_add h1 h2 + _ = _ := by push_cast; ring + +theorem crossingCells_card_le {D : ℕ} (hD : ∀ e, P.length e ≤ D) : + P.crossingCells.card ≤ Fintype.card G.Edge*D := by + calc + _ ≤ ∑ e, (P.length e-1) := P.crossingCells_card + _ ≤ ∑ _e : G.Edge, D := Finset.sum_le_sum (fun e _ => (Nat.sub_le _ _).trans (hD e)) + _ = _ := by simp + +end QMAPortRouteData +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortGraphPairs.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortGraphPairs.lean new file mode 100644 index 0000000000000000000000000000000000000000..a8ea52db0720e480585efb713693a8cf701fb005 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortGraphPairs.lean @@ -0,0 +1,44 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortInnerPair +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCellCrossings + +namespace OAI + +/-! Edges wholly inside one port cell are exactly the two ports of a route visit. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical +namespace QMAPortRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + +theorem visit_of_forward_pair (e : G.Edge) (k : ℕ) (hk : k < 2*P.length e+1) + (p : ℕ × ℕ) (a b : Fin 4) + (hl : qmaPortChain (P.point e) (P.length e) k = qmaGridPort p a) + (hr : qmaPortChain (P.point e) (P.length e) (k+1) = qmaGridPort p b) : + ∃ i : P.Interior, P.cell i = p ∧ P.port i 0 = a ∧ P.port i 1 = b := by + obtain ⟨t,ht0,ht,hp,ha,hb⟩ := qmaPortChain_inner_pair (P.point e) (P.step e) hk p a b hl hr + let i : P.Interior := ⟨e,⟨t-1,by omega⟩⟩ + have h1 : t-1+1 = t := by omega + have h2 : t-1+2*1 = t+1 := by omega + refine ⟨i,?_,?_,?_⟩ + · simpa only [cell,i,h1] using hp + · simpa only [port,cell,arm,armIndex,i,Fin.val_zero,Nat.mul_zero,Nat.add_zero,h1] using ha + · simpa only [port,cell,arm,armIndex,i,Fin.val_one,h1,h2] using hb + +theorem graph_inner_pair {p : ℕ × ℕ} {a b : Fin 4} + (h : P.graph.Adj (qmaGridPort p a) (qmaGridPort p b)) : + ∃ i : P.Interior, P.cell i = p ∧ + ((P.port i 0 = a ∧ P.port i 1 = b) ∨ (P.port i 0 = b ∧ P.port i 1 = a)) := by + change _ ≠ _ ∧ _ at h + rcases h.2 with ⟨e,k,hk,hl,hr⟩ | ⟨e,k,hk,hl,hr⟩ + · obtain ⟨i,hi,ha,hb⟩ := P.visit_of_forward_pair e k hk p a b hl hr + exact ⟨i,hi,Or.inl ⟨ha,hb⟩⟩ + · obtain ⟨i,hi,hb,ha⟩ := P.visit_of_forward_pair e k hk p b a hl hr + exact ⟨i,hi,Or.inr ⟨hb,ha⟩⟩ + +end QMAPortRouteData +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortInnerPair.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortInnerPair.lean new file mode 100644 index 0000000000000000000000000000000000000000..129ae6622f6edfdd8e198cc02855228485c9a983 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortInnerPair.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortLinks + +namespace OAI + +/-! A port-chain edge with both ends in the same cell is precisely one internal +route visit, with the incoming and outgoing directions in order. -/ + +namespace ContinuumCoulomb + +theorem qmaPortChain_inner_pair (p : ℕ → ℕ × ℕ) {L k : ℕ} + (hp : ∀ i < L, qmaSquareGrid.Adj (p i) (p (i+1))) + (hk : k < 2*L+1) (q : ℕ × ℕ) (a b : Fin 4) + (hl : qmaPortChain p L k = qmaGridPort q a) + (hr : qmaPortChain p L (k+1) = qmaGridPort q b) : + ∃ t, 0 < t ∧ t < L ∧ p t = q ∧ + qmaGridNeighborIndex (p t) (p (t-1)) = a ∧ qmaGridNeighborIndex (p t) (p (t+1)) = b := by + have hk0 : 0 < k := by + by_contra hn + have he : k = 0 := by omega + subst k + rw [qmaPortChain_zero] at hl + exact qmaGridPort_ne_center q (p 0) a hl.symm + have hkl : k+1 < 2*L+1 := by + by_contra hn + have he : k+1 = 2*L+1 := by omega + rw [he,qmaPortChain_last] at hr + exact qmaGridPort_ne_center q (p L) b hr.symm + rw [qmaPortChain_inner p hk0 hk] at hl + rw [qmaPortChain_inner p (by omega) hkl] at hr + by_cases ho : k%2 = 1 + · have he : k = 2*(k/2)+1 := by omega + rw [he,qmaRoutePort_odd] at hl + have he' : k+1 = 2*(k/2+1) := by omega + rw [he',qmaRoutePort_even,Nat.add_sub_cancel] at hr + have h1 : (p (k/2),qmaGridNeighborIndex (p (k/2)) (p (k/2+1))) = (q,a) := + qmaGridPort_injective hl + have h2 : (p (k/2+1),qmaGridNeighborIndex (p (k/2+1)) (p (k/2))) = (q,b) := + qmaGridPort_injective hr + have heq : p (k/2) = p (k/2+1) := (congrArg Prod.fst h1).trans (congrArg Prod.fst h2).symm + exact ((hp (k/2) (by omega)).ne heq).elim + · have he : k = 2*(k/2) := by omega + rw [he,qmaRoutePort_even] at hl + rw [he,qmaRoutePort_odd] at hr + have h1 : (p (k/2),qmaGridNeighborIndex (p (k/2)) (p (k/2-1))) = (q,a) := + qmaGridPort_injective hl + have h2 : (p (k/2),qmaGridNeighborIndex (p (k/2)) (p (k/2+1))) = (q,b) := + qmaGridPort_injective hr + exact ⟨k/2,by omega,by omega,congrArg Prod.fst h1,congrArg Prod.snd h1,congrArg Prod.snd h2⟩ + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortLinks.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortLinks.lean new file mode 100644 index 0000000000000000000000000000000000000000..3e27bcfa10bb6208c47e6434c6530c5c6e9bcb55 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortLinks.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortChain + +namespace OAI + +/-! Every port-chain interaction is a vertex ray, a pairing inside one cell, +or the single corridor joining opposite ports of adjacent cells. -/ + +namespace ContinuumCoulomb + +def QMAPortLink (x y : ℕ × ℕ) : Prop := + (∃ p a, (x = qmaExpandedPoint p ∧ y = qmaGridPort p a) ∨ + (x = qmaGridPort p a ∧ y = qmaExpandedPoint p)) ∨ + (∃ p a b, x = qmaGridPort p a ∧ y = qmaGridPort p b) ∨ + (∃ p q, qmaSquareGrid.Adj p q ∧ x = qmaDirectedPort p q ∧ y = qmaDirectedPort q p) + +theorem QMAPortLink.symm {x y : ℕ × ℕ} (h : QMAPortLink x y) : QMAPortLink y x := by + rcases h with ⟨p,a,h | h⟩ | ⟨p,a,b,hx,hy⟩ | ⟨p,q,ha,hx,hy⟩ + · exact Or.inl ⟨p,a,Or.inr ⟨h.2,h.1⟩⟩ + · exact Or.inl ⟨p,a,Or.inl ⟨h.2,h.1⟩⟩ + · exact Or.inr (Or.inl ⟨p,b,a,hy,hx⟩) + · exact Or.inr (Or.inr ⟨q,p,ha.symm,hy,hx⟩) + +theorem qmaRoutePort_even (p : ℕ → ℕ × ℕ) (k : ℕ) : + qmaRoutePort p (2*k) = qmaDirectedPort (p k) (p (k-1)) := by + simp [qmaRoutePort,qmaPortNeighborIndex] + +theorem qmaRoutePort_odd (p : ℕ → ℕ × ℕ) (k : ℕ) : + qmaRoutePort p (2*k+1) = qmaDirectedPort (p k) (p (k+1)) := by + simp [qmaRoutePort,qmaPortNeighborIndex,Nat.add_div] + +theorem qmaPortChain_link (p : ℕ → ℕ × ℕ) {L : ℕ} (hL : 0 < L) + (hp : ∀ i < L, qmaSquareGrid.Adj (p i) (p (i+1))) + (i : ℕ) (hi : i < 2*L+1) : QMAPortLink (qmaPortChain p L i) (qmaPortChain p L (i+1)) := by + by_cases hi0 : i = 0 + · subst i + rw [qmaPortChain_zero,qmaPortChain_inner p (by omega : 0 < 0+1) (by omega : 0+1 < 2*L+1)] + have he := qmaRoutePort_odd p 0 + simp only [Nat.mul_zero,Nat.zero_add] at he + rw [he] + exact Or.inl ⟨p 0,qmaGridNeighborIndex (p 0) (p 1),Or.inl ⟨rfl,rfl⟩⟩ + by_cases hil : i = 2*L + · subst i + rw [qmaPortChain_last,qmaPortChain_inner p (by omega : 0 < 2*L) (by omega : 2*L < 2*L+1), + qmaRoutePort_even] + exact Or.inl ⟨p L,qmaGridNeighborIndex (p L) (p (L-1)),Or.inr ⟨rfl,rfl⟩⟩ + rw [qmaPortChain_inner p (by omega) hi,qmaPortChain_inner p (by omega : 0 < i+1) (by omega)] + by_cases ho : i%2 = 1 + · have he : i = 2*(i/2)+1 := by omega + rw [he,qmaRoutePort_odd] + have hn : 2*(i/2)+1+1 = 2*(i/2+1) := by omega + rw [hn,qmaRoutePort_even,Nat.add_sub_cancel] + exact Or.inr (Or.inr ⟨p (i/2),p (i/2+1),hp _ (by omega),rfl,rfl⟩) + · have he : i = 2*(i/2) := by omega + rw [he,qmaRoutePort_even,qmaRoutePort_odd] + exact Or.inr (Or.inl ⟨p (i/2),qmaGridNeighborIndex (p (i/2)) (p (i/2-1)), + qmaGridNeighborIndex (p (i/2)) (p (i/2+1)),rfl,rfl⟩) + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortPairing.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortPairing.lean new file mode 100644 index 0000000000000000000000000000000000000000..ad3e61c668ee2b8c59f6f2ec03f78b98fef98d9d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortPairing.lean @@ -0,0 +1,39 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridNeighborsFour +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCornerPatch + +namespace OAI + +/-! Four distinct ports have the crossing pairing or one of the two corner pairings. -/ + +namespace ContinuumCoulomb + +def qmaPortPairing (f : Fin 4 → Fin 4) : Finset (Sym2 (Fin 4)) := + {s(f 0,f 1),s(f 2,f 3)} + +def qmaCrossPortPairing : Finset (Sym2 (Fin 4)) := {s(0,2),s(1,3)} +def qmaCornerPortPairing (mode : Bool) : Finset (Sym2 (Fin 4)) := + {s(qmaCornerPatchLeft mode 0,qmaCornerPatchRight mode 0), + s(qmaCornerPatchLeft mode 1,qmaCornerPatchRight mode 1)} + +theorem qmaPortPairing_classify (f : Fin 4 → Fin 4) (hf : Function.Injective f) : + qmaPortPairing f = qmaCrossPortPairing ∨ + qmaPortPairing f = qmaCornerPortPairing false ∨ + qmaPortPairing f = qmaCornerPortPairing true := by + have h01 : f 0 ≠ f 1 := fun h => (by decide : (0 : Fin 4) ≠ 1) (hf h) + have h02 : f 0 ≠ f 2 := fun h => (by decide : (0 : Fin 4) ≠ 2) (hf h) + have h03 : f 0 ≠ f 3 := fun h => (by decide : (0 : Fin 4) ≠ 3) (hf h) + have h12 : f 1 ≠ f 2 := fun h => (by decide : (1 : Fin 4) ≠ 2) (hf h) + have h13 : f 1 ≠ f 3 := fun h => (by decide : (1 : Fin 4) ≠ 3) (hf h) + have h23 : f 2 ≠ f 3 := fun h => (by decide : (2 : Fin 4) ≠ 3) (hf h) + unfold qmaPortPairing + generalize ha : f 0 = a at * + generalize hb : f 1 = b at * + generalize hc : f 2 = c at * + generalize hd : f 3 = d at * + fin_cases a <;> fin_cases b <;> try contradiction + all_goals (fin_cases c <;> try contradiction) + all_goals (fin_cases d <;> first | contradiction | decide) + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortPlanarRealization.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortPlanarRealization.lean new file mode 100644 index 0000000000000000000000000000000000000000..f2823f0e6b290149e34f9d7e0c6b158ada75edac --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortPlanarRealization.lean @@ -0,0 +1,48 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingPlanarRoutes +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPlanarDegree + +namespace OAI + +/-! Actual planarization and nearest-neighbor realization of the completed port +graph, using eighty-one fixed subdivision layers after the crossing layer. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical +namespace QMAPortRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + +theorem planar_realize {N : ℚ} (hN : 0 < N) {D X Y : ℕ} (hD : ∀ e, P.length e ≤ D) + (havoid : ∀ i : P.Interior, ∀ v, P.cell i ≠ P.position v) + (hpositive : ∀ v, 0 < (P.position v).1 ∧ 0 < (P.position v).2) + (hsource : ∀ v, (P.position v).1 < X ∧ (P.position v).2 < Y) + (hpath : ∀ e k, k ≤ P.length e → (P.point e k).1 < X ∧ (P.point e k).2 < Y) : + ∃ (H : QMARationalExchangeGraph) (position : Fin H.n → ℕ × ℕ), + Function.Injective position ∧ + (∀ v, (position v).1 < 256*X ∧ (position v).2 < 256*Y) ∧ + (∀ e, qmaSquareGrid.Adj (position (H.left e)) (position (H.right e))) ∧ + (∀ v, qmaGraphDegree H.left H.right v ≤ 4) ∧ + H.n+Fintype.card H.Edge ≤ 5^81*((P.crossingOutput N hD).merge.n+ + Fintype.card (P.crossingOutput N hD).merge.Edge) ∧ + |H.energy-G.energy| ≤ ((D+82:ℕ):ℝ)/(N:ℝ) := by + let R := P.crossingPlanarRoute N hD havoid hpositive + have hlen : ∀ e, R.length e ≤ 20 := P.crossingPlanarRoute_length N hD havoid hpositive + have hbox : R.Bounded (32*X) (32*Y) := + P.crossingPlanarRoute_bounded N hD havoid hpositive hsource hpath + obtain ⟨H,pos,hinj,hbounds,hgrid,hdegree,hsize,herr⟩ := + R.realize hN (by decide : 3 ≤ 4) hlen hbox R.degree_le_four + refine ⟨H,pos,hinj,?_,hgrid,hdegree,hsize,?_⟩ + · simpa only [← Nat.mul_assoc] using hbounds + · have hcross := P.mergedOutput_energy_error hN hD + calc + _ ≤ |H.energy-(P.crossingOutput N hD).merge.energy|+ + |(P.crossingOutput N hD).merge.energy-G.energy| := abs_sub_le _ _ _ + _ ≤ ((4*20+1:ℕ):ℝ)/(N:ℝ)+((D+1:ℕ):ℝ)/(N:ℝ) := add_le_add herr hcross + _ = _ := by push_cast; ring + +end QMAPortRouteData +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortRank.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortRank.lean new file mode 100644 index 0000000000000000000000000000000000000000..3cb2fbbcf12d46151d3fde8b465353ae13fce07d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortRank.lean @@ -0,0 +1,66 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEndpointPorts + +namespace OAI + +/-! The endpoint arm assigned to an incident interaction is the number of +incident lane colors below it. This exposes the finite count used by the +literal route evaluator. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +theorem qmaPort_orderRank {C : ℕ} (s : Finset (Fin C)) (x : s) : + ((s.orderIsoOfFin rfl).symm x).val = (s.filter (fun y => y < x.val)).card := by + let E := s.orderIsoOfFin rfl + have h : (Finset.Iio (E.symm x)).card = (s.filter (fun y => y < x.val)).card := by + apply Finset.card_bij (fun i _ => (E i).val) + · intro i hi + refine Finset.mem_filter.mpr ⟨(E i).property,?_⟩ + have hh := E.strictMono (Finset.mem_Iio.mp hi) + change (E i).val < (E (E.symm x)).val at hh + simpa only [E.apply_symm_apply] using hh + · intro i hi j hj hij + exact E.injective (Subtype.ext hij) + · intro y hy + obtain ⟨hys,hyx⟩ := Finset.mem_filter.mp hy + refine ⟨E.symm ⟨y,hys⟩,Finset.mem_Iio.mpr ?_,?_⟩ + · exact E.symm.strictMono hyx + · exact congrArg Subtype.val (E.apply_symm_apply ⟨y,hys⟩) + simpa only [Fin.card_Iio] using h + +theorem qmaCanonicalSortedPorts_assign_rank {κ : Type} [Fintype κ] {C : ℕ} + (color : κ → Fin C) (hc : Fintype.card κ ≤ 3) (hi : Function.Injective color) (e : κ) : + ((qmaCanonicalSortedPorts color hc).assign e).val = + (Finset.univ.filter (fun f => color f < color e)).card := by + let s := Finset.univ.image color + have he : color e ∈ s := Finset.mem_image.mpr ⟨e,Finset.mem_univ _,rfl⟩ + change ((s.orderIsoOfFin rfl).symm ⟨color e,he⟩).val = _ + rw [qmaPort_orderRank] + symm + apply Finset.card_bij (fun f _ => color f) + · intro f hf + exact Finset.mem_filter.mpr + ⟨Finset.mem_image.mpr ⟨f,Finset.mem_univ _,rfl⟩,(Finset.mem_filter.mp hf).2⟩ + · intro f hf g hg h + exact hi h + · intro y hy + obtain ⟨hys,hy⟩ := Finset.mem_filter.mp hy + obtain ⟨f,_,rfl⟩ := Finset.mem_image.mp hys + exact ⟨f,Finset.mem_filter.mpr ⟨Finset.mem_univ _,hy⟩,rfl⟩ + +namespace QMASpatialExchangeModel +variable {A B : ℕ} (M : QMASpatialExchangeModel A B) + +theorem endpointPorts_assign_rank (hA : 0 < A) + (hd : ∀ v, qmaGraphDegree M.left M.right v ≤ 3) (v : Fin M.n) (e : M.Incident v) : + ((M.endpointPorts hd v).assign e).val = + (Finset.univ.filter (fun f : M.Incident v => M.laneColor f.val < M.laneColor e.val)).card := + qmaCanonicalSortedPorts_assign_rank _ _ (M.incident_color_injective hA v) e + +end QMASpatialExchangeModel +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortRankActual.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortRankActual.lean new file mode 100644 index 0000000000000000000000000000000000000000..43f3ab4fac3edf70398cbcf0dc4bfa03c91daa7d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortRankActual.lean @@ -0,0 +1,49 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortRankProgram + +namespace OAI + +/-! The literal incidence count computes the very arm assignment used by the +spatial routing proof, for any explicit enumeration of the interaction labels. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPortRankProgram +open scoped Classical + +def entries {A B : ℕ} (M : QMASpatialExchangeModel A B) {m : ℕ} + (labels : M.Term ≃ Fin m) (i : Fin m) : Entry := + ((M.left (labels.symm i)).val, + (M.right (labels.symm i)).val,(M.laneColor (labels.symm i)).val) + +theorem value_actual {A B : ℕ} (M : QMASpatialExchangeModel A B) {m : ℕ} + (labels : M.Term ≃ Fin m) (hA : 0 < A) + (hd : ∀ v, qmaGraphDegree M.left M.right v ≤ 3) + (v : Fin M.n) (e : M.Incident v) : + value ((v.val,(M.laneColor e.val).val),List.ofFn (entries M labels)) = + ((M.endpointPorts hd v).assign e).val := by + rw [count_ofFn,M.endpointPorts_assign_rank hA] + symm + apply Finset.card_bij (fun f _ => labels f.val) + · intro f hf + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _,?_⟩ + simp only [entries,labels.symm_apply_apply] + refine ⟨?_,(Finset.mem_filter.mp hf).2⟩ + rcases f.property with hl | hr + · exact Or.inl (congrArg Fin.val hl) + · exact Or.inr (congrArg Fin.val hr) + · intro f hf g hg h + exact Subtype.ext (labels.injective h) + · intro i hi + obtain ⟨_,hinc,hlt⟩ := Finset.mem_filter.mp hi + dsimp only [entries] at hinc hlt + have hmember : M.left (labels.symm i)=v ∨ M.right (labels.symm i)=v := + hinc.imp Fin.ext Fin.ext + let f : M.Incident v := ⟨labels.symm i,hmember⟩ + refine ⟨f,Finset.mem_filter.mpr ⟨Finset.mem_univ _,hlt⟩,?_⟩ + exact labels.apply_symm_apply i + +end ContinuumCoulomb.QuantumPortRankProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortRankProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortRankProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..c87a865348c53c736b3ecb2de217b23a300fa230 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortRankProgram.lean @@ -0,0 +1,62 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortRank +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrdinalProgram + +namespace OAI + +/-! The sorted endpoint port is evaluated by counting incident edges whose +lane color is smaller. Each record contains the two endpoints and lane color. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPortRankProgram +open ExactQuantumFactoring.BitStackProgram QuantumRouteCode + +abbrev Entry := ℕ × (ℕ × ℕ) +def entryCode : Entry → List Bool := prodCode Nat.bits pairCode + +def below (vc : Pair) (e : Entry) : Bool := + decide ((e.1=vc.1 ∨ e.2.1=vc.1) ∧ e.2.2 below x.1 x.2) := by + let vc := Procedure.first pairCode entryCode + let e := Procedure.second pairCode entryCode + let v := (Procedure.first Nat.bits Nat.bits).comp vc + let c := (Procedure.second Nat.bits Nat.bits).comp vc + let left := (Procedure.first Nat.bits pairCode).comp e + let rest := (Procedure.second Nat.bits pairCode).comp e + let right := (Procedure.first Nat.bits Nat.bits).comp rest + let lane := (Procedure.second Nat.bits Nat.bits).comp rest + let incident := Procedure.boolOr.comp + ((Procedure.binaryEq.comp (left.pair v)).pair (Procedure.binaryEq.comp (right.pair v))) + let smaller := Procedure.binaryLe.comp + ((Procedure.binaryAdd.comp (lane.pair (Procedure.constant _ Nat.bits 1))).pair c) + exact (Procedure.boolAnd.comp (incident.pair smaller)).congrFun (by + intro x + apply Bool.eq_iff_iff.mpr + simp only [Function.comp_apply,Bool.and_eq_true,Bool.or_eq_true,decide_eq_true_eq,below] + omega) + +noncomputable def program : Procedure inputCode unaryCode value := + QuantumOrdinalProgram.countProgram.comp + (Procedure.listMapWith (f := below) (0,(0,0)) false belowProgram) + +theorem count_ofFn {n : ℕ} (entries : Fin n → Entry) (vc : Pair) : + value (vc,List.ofFn entries) = + (Finset.univ.filter (fun i => + ((entries i).1=vc.1 ∨ (entries i).2.1=vc.1) ∧ (entries i).2.2 ((entries i).1=vc.1 ∨ (entries i).2.1=vc.1) ∧ (entries i).2.2 ∃ (e : G.Edge) (k : ℕ), + k < 2*P.length e+1 ∧ qmaPortChain (P.point e) (P.length e) k = x ∧ + qmaPortChain (P.point e) (P.length e) (k+1) = y) + +def toEmbedding : QMAPathEmbedding P.schedule P.graph where + position := fun v => qmaExpandedPoint (P.position v) + position_injective := qmaExpandedPoint_injective.comp P.position_injective + point := fun e => qmaPortChain (P.point e) (P.length e) + first := by intro e; rw [qmaPortChain_zero,P.first] + last := by intro e; change qmaPortChain (P.point e) (P.length e) (2*P.length e+1) = _ + rw [qmaPortChain_last,P.last] + simple := by + intro e i j hi hj h + exact qmaPortChain_injective _ (P.length_pos e) (P.step e) (P.positive e) (P.simple e) hi hj h + step := by + intro e i hi + change i < 2*P.length e+1 at hi + apply (SimpleGraph.fromRel_adj _ _ _).mpr + refine ⟨?_,Or.inl ⟨e,i,hi,rfl,rfl⟩⟩ + intro h + have he := qmaPortChain_injective _ (P.length_pos e) (P.step e) (P.positive e) (P.simple e) + (Nat.le_of_lt hi) (by omega) h + omega + avoids := by + intro e i v hi0 hi + exact qmaPortChain_inner_not_center _ hi0 hi _ + disjoint := by + intro e f i j hef hi0 hi hj + exact qmaPortChain_interiors_disjoint _ _ (P.step e) (P.step f) (P.positive e) (P.positive f) + (P.edges_disjoint e f hef) hi0 hi hj + +end QMAPortRouteData +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortScheduleActual.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortScheduleActual.lean new file mode 100644 index 0000000000000000000000000000000000000000..d421f1526575170233c4919ed080cc57a6ad6863 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortScheduleActual.lean @@ -0,0 +1,84 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortScheduleTape + +namespace OAI + +/-! The computed schedule has precisely the coefficients, work counts and +physical port paths of the proved spatial construction. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPortScheduleActual +open QuantumForkList QuantumRouteCode QuantumPortScheduleTape + +variable {rows width A D : ℕ} (I : SpatialInput rows width A D) +variable (hA : 0 < spatialDensity A D) + +abbrev tape := QuantumForkGridProgram.output D (QuantumSpatialInputTape.input I) + +theorem bonds_ofFn : fullList I.state = List.ofFn (fun e : I.model.Term => + ((I.model.left e).val,(I.model.right e).val,I.model.weight e)) := by + change fullList I.state = List.ofFn (fun i => (fullList I.state).get i) + exact (List.ofFn_get (fullList I.state)).symm + +include hA in +theorem entries_actual : + (value (spatialDensity A D) (27*spatialDensity A D) (tape I)).1.2.2 = + List.ofFn (fun e : I.model.Term => + (I.model.coarseLength I.model_degree e, + (I.model.left e).val,(I.model.right e).val,I.model.weight e)) := by + change entries (fullList (tape I).1, + QuantumRoutingFamily.coarse (spatialDensity A D) (27*spatialDensity A D) + (QuantumForkRoutingData.value (tape I))) = _ + rw [QuantumSpatialInputTape.state_eq,QuantumSpatialInputTape.routing_eq] + have hp : QuantumRoutingFamily.coarse (spatialDensity A D) (27*spatialDensity A D) + (QuantumRoutingInputProgram.actualData I.model (Equiv.refl _)) = + List.ofFn (fun e : I.model.Term => (I.model.bufferedPath I.model_degree e).val.support) := + QuantumRoutingFamily.coarse_actual I.model (Equiv.refl _) hA I.model_degree + rw [hp] + calc + _ = entries (List.ofFn (fun e : I.model.Term => + ((I.model.left e).val,(I.model.right e).val,I.model.weight e)), + List.ofFn (fun e : I.model.Term => (I.model.bufferedPath I.model_degree e).val.support)) := + congrArg (fun bs => entries (bs, + List.ofFn (fun e : I.model.Term => (I.model.bufferedPath I.model_degree e).val.support))) + (bonds_ofFn I) + _ = _ := by + refine (entries_ofFn (m := (fullList I.state).length) + (fun e => ((I.model.left e).val,(I.model.right e).val,I.model.weight e)) + (fun e => (I.model.bufferedPath I.model_degree e).val.support)).trans ?_ + apply congrArg List.ofFn + funext e + apply Prod.ext + · simp only [SimpleGraph.Walk.length_support,Nat.add_sub_cancel] + rfl + · rfl + +theorem positions_actual : + (value (spatialDensity A D) (27*spatialDensity A D) (tape I)).2.1 = + List.ofFn (fun v : Fin I.model.n => qmaExpandedPoint (I.model.placedVertex v)) := by + change (QuantumRoutingFamily.positions (spatialDensity A D) (27*spatialDensity A D) + (QuantumForkRoutingData.value (tape I))).map qmaExpandedPoint = _ + rw [QuantumSpatialInputTape.routing_eq] + have hp : QuantumRoutingFamily.positions (spatialDensity A D) (27*spatialDensity A D) + (QuantumRoutingInputProgram.actualData I.model (Equiv.refl _)) = + List.ofFn I.model.placedVertex := + QuantumRoutingFamily.positions_actual I.model (Equiv.refl _) + rw [hp,List.map_ofFn] + rfl + +include hA in +theorem paths_actual : + (value (spatialDensity A D) (27*spatialDensity A D) (tape I)).2.2 = + List.ofFn (fun e : I.model.Term => + (List.range (2*I.model.coarseLength I.model_degree e+2)).map + (qmaPortChain (I.model.coarseRoute I.model_degree e) + (I.model.coarseLength I.model_degree e))) := by + change QuantumPortChainProgram.allRouted (spatialDensity A D) (27*spatialDensity A D) + (QuantumForkRoutingData.value (tape I)) = _ + rw [QuantumSpatialInputTape.routing_eq] + exact allRouted_actual I.model (Equiv.refl _) hA I.model_degree + +end ContinuumCoulomb.QuantumPortScheduleActual + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortSchedulePacking.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortSchedulePacking.lean new file mode 100644 index 0000000000000000000000000000000000000000..644b90dca088a041336dd858feb6f8591da4d22a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortSchedulePacking.lean @@ -0,0 +1,109 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPackedSchedule +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortScheduleActual +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedPortRealization + +namespace OAI + +/-! The actual computed scheduler begins with the exact spatial exchange +graph, with one work counter for each of its enumerated interactions. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPackedSchedule + +theorem port_layout {A B : ℕ} (M : QMASpatialExchangeModel A B) {m : ℕ} + (labels : M.Term ≃ Fin m) (hA : 0 < A) + (hd : ∀ v, qmaGraphDegree M.left M.right v ≤ 3) : + layout M.exchangeGraph labels (M.coarseLength hd) (M.portEmbedding hA hd) = + (state M.exchangeGraph labels (M.coarseLength hd), + List.ofFn (fun v => qmaExpandedPoint (M.placedVertex v)), + List.ofFn (fun i : Fin m => (List.range (2*M.coarseLength hd (labels.symm i)+2)).map + (qmaPortChain (M.coarseRoute hd (labels.symm i)) (M.coarseLength hd (labels.symm i))))) := by + simp only [layout,QMASpatialExchangeModel.portEmbedding, + QMASpatialExchangeModel.portRouteData,QMAPortRouteData.toEmbedding] + +end ContinuumCoulomb.QuantumPackedSchedule + +namespace ContinuumCoulomb.QuantumListRouteProgram + +theorem bounded_of_lists {Γ : SimpleGraph (ℕ × ℕ)} (s : State) + (hs : QuantumListSchedule.Valid s.1) + (P : QMAPathEmbedding (QuantumListSchedule.schedule s.1 hs) Γ) + (hP : Represents s hs P) {X Y : ℕ} + (hv : ∀ p ∈ s.2.1, p.1 < X ∧ p.2 < Y) + (he : ∀ ps ∈ s.2.2, ∀ p ∈ ps, p.1 < X ∧ p.2 < Y) : P.Bounded X Y := by + constructor + · intro v + apply hv + rw [hP.1] + exact List.mem_ofFn.mpr ⟨v,rfl⟩ + · intro e k hk + apply he ((List.range (2*(QuantumListSchedule.schedule s.1 hs).work e+2)).map (P.point e)) + · rw [hP.2] + exact List.mem_ofFn.mpr ⟨e,rfl⟩ + · exact List.mem_map.mpr ⟨k,List.mem_range.mpr (by omega),rfl⟩ + +end ContinuumCoulomb.QuantumListRouteProgram + +namespace ContinuumCoulomb.QuantumPortSchedulePacking +open QuantumForkList QuantumPortScheduleTape QuantumPortScheduleActual + +variable {rows width A D : ℕ} (I : SpatialInput rows width A D) +variable (hA : 0 < spatialDensity A D) +include hA + +theorem state_eq : + (value (spatialDensity A D) (27*spatialDensity A D) (tape I)).1 = + QuantumPackedSchedule.state I.model.exchangeGraph (Equiv.refl _) + (I.model.coarseLength I.model_degree) := by + apply Prod.ext + · change (tape I).1.1=I.model.n + rw [QuantumSpatialInputTape.state_eq] + rfl + · apply Prod.ext + · change (tape I).1.2.2.1=I.model.constant + rw [QuantumSpatialInputTape.state_eq] + rfl + · exact entries_actual I hA + +theorem valid : QuantumListSchedule.Valid + (value (spatialDensity A D) (27*spatialDensity A D) (tape I)).1 := by + rw [state_eq I hA] + exact QuantumPackedSchedule.valid I.model.exchangeGraph (Equiv.refl _) + (I.model.coarseLength I.model_degree) + +theorem energy : QuantumListSchedule.energy + (value (spatialDensity A D) (27*spatialDensity A D) (tape I)).1 = I.model.energy := by + rw [state_eq I hA] + exact QuantumPackedSchedule.energy I.model.exchangeGraph (Equiv.refl _) + (I.model.coarseLength I.model_degree) + +theorem layout_eq : + value (spatialDensity A D) (27*spatialDensity A D) (tape I) = + QuantumPackedSchedule.layout I.model.exchangeGraph (Equiv.refl _) + (I.model.coarseLength I.model_degree) (I.model.portEmbedding hA I.model_degree) := by + refine Eq.trans ?_ (QuantumPackedSchedule.port_layout I.model + (m := (fullList I.state).length) (Equiv.refl _) hA I.model_degree).symm + apply Prod.ext + · exact state_eq I hA + · apply Prod.ext + · exact positions_actual I + · exact paths_actual I hA + +theorem has_representation : + ∃ (hs : QuantumListSchedule.Valid + (value (spatialDensity A D) (27*spatialDensity A D) (tape I)).1) + (P : QMAPathEmbedding + (QuantumListSchedule.schedule + (value (spatialDensity A D) (27*spatialDensity A D) (tape I)).1 hs) + (I.model.portGraph I.model_degree)), + QuantumListRouteProgram.Represents + (value (spatialDensity A D) (27*spatialDensity A D) (tape I)) hs P := by + rw [layout_eq I hA] + exact ⟨QuantumPackedSchedule.valid _ _ _,_, + QuantumPackedSchedule.layout_represents _ _ _ _⟩ + +end ContinuumCoulomb.QuantumPortSchedulePacking + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortScheduleTape.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortScheduleTape.lean new file mode 100644 index 0000000000000000000000000000000000000000..4d29ca45bab5daaf3c9674fd776fecf4474548a2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortScheduleTape.lean @@ -0,0 +1,132 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialRoutingTape +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListRouteRepresentation + +namespace OAI + +/-! The computed port paths decorate the actual full bond list with its +remaining subdivision work. Erasing that work leaves the same Hamiltonian. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPortScheduleTape +open ExactQuantumFactoring.BitStackProgram MediatorListProgram QuantumRouteCode + +abbrev Environment := List Bond × List (List Pair) +def environmentCode : Environment → List Bool := + prodCode (listCode bondCode) (listCode (listCode pairCode)) +def queryCode : (ℕ × Environment) → List Bool := prodCode unaryCode environmentCode + +def entry (x : ℕ × Environment) : QuantumListSchedule.Entry := + ((((x.2.2.drop x.1).headD []).length-1),(x.2.1.drop x.1).headD zeroBond) + +noncomputable opaque entryProgram : Procedure queryCode QuantumListSchedule.entryCode entry := by + let i := Procedure.unaryToBits.comp (Procedure.first unaryCode environmentCode) + let env := Procedure.second unaryCode environmentCode + let bs := (Procedure.first (listCode bondCode) (listCode (listCode pairCode))).comp env + let ps := (Procedure.second (listCode bondCode) (listCode (listCode pairCode))).comp env + let p := (Procedure.listGet (listCode pairCode) []).comp (i.pair ps) + let len := (ExactQuantumFactoring.NativeAIG.Emission.listUnaryLength pairCode (0,0)).comp p + let work := Procedure.unarySub.comp + (len.pair (Procedure.constant queryCode unaryCode 1)) + let b := (Procedure.listGet bondCode zeroBond).comp (i.pair bs) + exact work.pair b + +def entries (x : Environment) : List QuantumListSchedule.Entry := + (List.range x.1.length).map (fun i => entry (i,x)) + +noncomputable opaque entriesProgram : Procedure environmentCode + (listCode QuantumListSchedule.entryCode) entries := by + let bs := Procedure.first (listCode bondCode) (listCode (listCode pairCode)) + let n := (ExactQuantumFactoring.NativeAIG.Emission.listUnaryLength bondCode zeroBond).comp bs + let tab : Procedure queryCode (listCode QuantumListSchedule.entryCode) + (fun x => (List.range x.1).map (fun i => entry (i,x.2))) := + Procedure.tabulate (f := fun x i => entry (i,x)) QuantumListSchedule.zeroEntry entryProgram + exact (tab.comp (n.pair (Procedure.identity environmentCode))).congrFun (by intro x; rfl) + +theorem erase_entries (x : Environment) : QuantumListSchedule.erase (entries x) = x.1 := by + apply List.ext_getElem + · simp only [QuantumListSchedule.erase,entries,List.length_map,List.length_range] + · intro i hi hj + simp only [QuantumListSchedule.erase,entries,List.getElem_map,List.getElem_range, + entry,List.headD_eq_head?_getD,List.head?_drop,List.getElem?_eq_getElem hj,Option.getD_some] + +theorem entries_ofFn {m : ℕ} (bs : Fin m → Bond) (ps : Fin m → List Pair) : + entries (List.ofFn bs,List.ofFn ps) = List.ofFn (fun i => ((ps i).length-1,bs i)) := by + apply List.ext_getElem + · simp only [entries,List.length_map,List.length_range,List.length_ofFn] + · intro i hi hj + have hi' : i < m := by simpa only [List.length_ofFn] using hj + simp only [entries,List.length_ofFn,List.getElem_map,List.getElem_range,List.getElem_ofFn, + entry,List.headD_eq_head?_getD,List.head?_drop,List.getElem?_ofFn, + dite_eq_left hi',Option.getD_some] + +theorem allRouted_actual {A B : ℕ} (M : QMASpatialExchangeModel A B) {m : ℕ} + (labels : M.Term ≃ Fin m) (hA : 0 < A) + (hd : ∀ v, qmaGraphDegree M.left M.right v ≤ 3) : + QuantumPortChainProgram.allRouted A B (QuantumRoutingInputProgram.actualData M labels) = + List.ofFn (fun i : Fin m => + (List.range (2*(M.withOrdinalSlots labels).coarseLength hd (labels.symm i)+2)).map + (qmaPortChain ((M.withOrdinalSlots labels).coarseRoute hd (labels.symm i)) + ((M.withOrdinalSlots labels).coarseLength hd (labels.symm i)))) := by + apply List.ext_getElem + · simp only [QuantumPortChainProgram.allRouted,QuantumRoutingInputProgram.actualData, + List.length_map,List.length_range,List.length_ofFn] + · intro i hi hj + have hi' : i < m := by simpa only [List.length_ofFn] using hj + have h := QuantumPortChainProgram.routed_actual M labels hA hd (labels.symm ⟨i,hi'⟩) + simpa only [QuantumPortChainProgram.allRouted,List.getElem_map,List.getElem_range, + List.getElem_ofFn,Equiv.apply_symm_apply] using h + +def value (A B : ℕ) (x : QuantumForkGridProgram.Cells) : QuantumListRouteProgram.State := + let d := QuantumForkRoutingData.value x + ((x.1.1,x.1.2.2.1,entries (QuantumForkList.fullList x.1,QuantumRoutingFamily.coarse A B d)), + (QuantumRoutingFamily.positions A B d).map qmaExpandedPoint, + QuantumPortChainProgram.allRouted A B d) + +noncomputable opaque program (A B : ℕ) : Procedure QuantumForkGridProgram.cellsCode + QuantumListRouteProgram.stateCode (value A B) := by + let s := Procedure.first QuantumForkList.stateCode (listCode pairCode) + let n := QuantumForkList.countProgram.comp s + let c := (Procedure.first ratCode QuantumForkList.groupsCode).comp + ((Procedure.second (listCode bondCode) (prodCode ratCode QuantumForkList.groupsCode)).comp + ((Procedure.second unaryCode + (prodCode (listCode bondCode) (prodCode ratCode QuantumForkList.groupsCode))).comp s)) + let bs := QuantumForkRoutingData.fullProgram.comp s + let d := QuantumForkRoutingData.program + let ps := (QuantumRoutingFamily.coarseProgram A B).comp d + let es := entriesProgram.comp (bs.pair ps) + let positions := (Procedure.listMap (0,0) (0,0) QuantumPortChainProgram.centerProgram).comp + ((QuantumRoutingFamily.positionsProgram A B).comp d) + let paths := (QuantumPortChainProgram.allRoutedProgram A B).comp d + exact (n.pair (c.pair es)).pair (positions.pair paths) + +theorem value_erase (A B : ℕ) (x : QuantumForkGridProgram.Cells) : + QuantumListSchedule.erase (value A B x).1.2.2 = QuantumForkList.fullList x.1 := + erase_entries _ + +theorem value_valid (A B : ℕ) (x : QuantumForkGridProgram.Cells) + (hs : QuantumForkList.ValidPorts x.1.1 x.1.2.2.2) + (hb : SourceBondLists.bounded x.1.1 x.1.2.1) + (hn : ∀ b ∈ x.1.2.1, b.1≠b.2.1) : QuantumListSchedule.Valid (value A B x).1 := by + constructor + · rw [value_erase] + exact QuantumForkList.fullList_bounded x.1 hs hb + · rw [value_erase] + exact QuantumForkList.fullList_noLoops x.1 hs hn + +theorem value_energy (A B : ℕ) (x : QuantumForkGridProgram.Cells) + (hs : QuantumForkList.ValidPorts x.1.1 x.1.2.2.2) + (hb : SourceBondLists.bounded x.1.1 x.1.2.1) + (hn : ∀ b ∈ x.1.2.1, b.1≠b.2.1) : + QuantumListSchedule.energy (value A B x).1 = + (QuantumForkList.fullGraph x.1 hs hb hn).energy := by + unfold QuantumListSchedule.energy + rw [value_erase] + exact (QuantumListGraph.ofBonds_energy x.1.1 (QuantumForkList.fullList x.1) x.1.2.2.1 + (QuantumForkList.fullList_bounded x.1 hs hb) + (QuantumForkList.fullList_noLoops x.1 hs hn)).symm + +end ContinuumCoulomb.QuantumPortScheduleTape + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortSelectionProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortSelectionProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..a2da0ef5525deeb95cee1132fafa458336796575 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortSelectionProgram.lean @@ -0,0 +1,48 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingSelectCorrectness +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortCrossingSelection + +namespace OAI + +/-! The endpoint scan uses the exact canonical crossing couplings of the +completed physical port graph. Disjoint terminal sets discharge uniqueness. -/ + +noncomputable section +namespace ContinuumCoulomb.QMAPortRouteData +open scoped Classical + +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + +theorem crossingSiteFin_global (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) : + Function.Injective (fun p : Fin P.crossingCells.card × Fin 4 => + P.crossingSiteFin N hD p.1 p.2) := by + rintro ⟨i,a⟩ ⟨j,b⟩ h + have hp : (P.crossingCell i,qmaPatchDirection a)=(P.crossingCell j,qmaPatchDirection b) := + P.crossingSite_injective N hD h + have hi : P.crossingCell i=P.crossingCell j := + congrArg (fun x : P.Crossing × Fin 4 => x.1) hp + have hij : i=j := P.crossingCells.equivFin.symm.injective hi + have hab : a=b := qmaPatchDirection_injective + (congrArg (fun x : P.Crossing × Fin 4 => x.2) hp) + exact Prod.ext hij hab + +theorem portCrossing_tag_iff (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) + (e : (P.finishedGraph N D).Edge) (i : Fin P.crossingCells.card) (a : Fin 2) : + (P.portCrossingSelection N hD).tag e=some (i,a) ↔ + (P.finishedGraph N D).CrossingMatch (P.crossingSiteFin N hD) e (i,a) := + (P.finishedGraph N D).crossingTag_some_iff (P.crossingSiteFin N hD) + (P.crossingSiteFin_global N hD) e (i,a) + +theorem scanned_crossings (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) + {m : ℕ} (labels : (P.finishedGraph N D).Edge ≃ Fin m) : + QuantumCrossingSelectProgram.crossings + (QuantumListGraph.packed (P.finishedGraph N D) labels, + List.ofFn (QuantumCrossingSelectProgram.encodedSites (P.crossingSiteFin N hD))) = + List.ofFn (QuantumCrossingListLayer.actualCrossing (P.portCrossingSelection N hD).layer) := + QuantumCrossingSelectProgram.crossings_selected (P.portCrossingSelection N hD) + (P.portCrossing_tag_iff N hD) labels + +end ContinuumCoulomb.QMAPortRouteData + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortSpinCoverage.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortSpinCoverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..c4fb2319f52edf698c12fedbb0edda8a8f8838a4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPortSpinCoverage.lean @@ -0,0 +1,63 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCellPassages +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortLinks +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathCoverageReverse + +namespace OAI + +/-! Final physical spins lie at original centers or ports, and every occupied +internal port is represented by an actual physical spin. -/ + +noncomputable section +namespace ContinuumCoulomb + +theorem qmaPortChain_kind (p : ℕ → ℕ × ℕ) (L k : ℕ) : + (∃ q, qmaPortChain p L k = qmaExpandedPoint q) ∨ + ∃ q a, qmaPortChain p L k = qmaGridPort q a := by + by_cases h0 : k = 0 + · subst k + exact Or.inl ⟨p 0,qmaPortChain_zero p L⟩ + by_cases hL : k = 2*L+1 + · subst k + exact Or.inl ⟨p L,qmaPortChain_last p L⟩ + · exact Or.inr ⟨p (k/2),qmaGridNeighborIndex (p (k/2)) (p (qmaPortNeighborIndex k)), + by simp [qmaPortChain,h0,hL,qmaRoutePort,qmaDirectedPort]⟩ + +namespace QMAPortRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + +theorem cell_port_chain (i : P.Interior) (a : Fin 2) : + qmaPortChain (P.point i.1) (P.length i.1) (2*(i.2.val+1)+a.val) = + qmaGridPort (P.cell i) (P.port i a) := by + have hi := P.cell_index_lt i + have ha := a.isLt + rw [qmaPortChain_inner _ (by omega) (by omega)] + fin_cases a + · simp only [Nat.add_zero,qmaRoutePort_even,Nat.add_sub_cancel] + rfl + · rw [qmaRoutePort_odd] + rfl + +theorem iterate_covers_port (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) + (i : P.Interior) (a : Fin 2) : + ∃ v, (P.toEmbedding.iterate N D).position v = qmaGridPort (P.cell i) (P.port i a) := by + have hi := P.cell_index_lt i + have ha := a.isLt + have hb : 2*(i.2.val+1)+a.val ≤ 2*P.length i.1+1 := by omega + obtain ⟨v,hv⟩ := P.toEmbedding.iterate_covers_point N hD i.1 (2*(i.2.val+1)+a.val) hb + exact ⟨v,hv.trans (P.cell_port_chain i a)⟩ + +theorem iterate_position_kind (N : ℚ) (D : ℕ) (v : Fin (P.schedule.iterate N D).graph.n) : + (∃ p, (P.toEmbedding.iterate N D).position v = qmaExpandedPoint p) ∨ + ∃ p a, (P.toEmbedding.iterate N D).position v = qmaGridPort p a := by + have h := P.toEmbedding.iterate_occupied_source N D (Or.inl ⟨v,rfl⟩) + rcases h with ⟨w,hw⟩ | ⟨e,k,_,hk⟩ + · exact Or.inl ⟨P.position w,hw.symm⟩ + · rw [← hk] + exact qmaPortChain_kind (P.point e) (P.length e) k + +end QMAPortRouteData +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrefix.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrefix.lean new file mode 100644 index 0000000000000000000000000000000000000000..7e871982946d8aaffb4ce847095739f2a829180b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrefix.lean @@ -0,0 +1,76 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEvolution +import Mathlib.Data.List.TakeDrop + +namespace OAI + +/-! Exact circuit prefixes and their unitary changes of coordinates. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix + +@[simp] theorem qmaApplyMatrix_one {n : ℕ} (u : EuclideanSpace ℂ (SourceSpinBasis n)) : + qmaApplyMatrix 1 u = u := by + ext s + simp [qmaApplyMatrix] + +theorem qmaApplyMatrix_mul {n : ℕ} + (M N : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) + (u : EuclideanSpace ℂ (SourceSpinBasis n)) : + qmaApplyMatrix (M*N) u = qmaApplyMatrix M (qmaApplyMatrix N u) := by + ext s + simp [qmaApplyMatrix,Matrix.mulVec_mulVec] + +theorem qmaApplyMatrix_sub {n : ℕ} + (M : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) + (u w : EuclideanSpace ℂ (SourceSpinBasis n)) : + qmaApplyMatrix M (u-w) = qmaApplyMatrix M u-qmaApplyMatrix M w := by + ext s + change (M.mulVec ((fun s => u s)-(fun s => w s))) s = _ + rw [Matrix.mulVec_sub] + rfl + +def qmaPrefixMatrix (c : QMACircuit) (t : ℕ) : + Matrix (SourceSpinBasis (c.work+1)) (SourceSpinBasis (c.work+1)) ℂ := + (c.gates.take t).foldl (fun M g => qmaGateMatrix c.work g*M) 1 + +@[simp] theorem qmaPrefixMatrix_zero (c : QMACircuit) : qmaPrefixMatrix c 0 = 1 := rfl + +@[simp] theorem qmaPrefixMatrix_length (c : QMACircuit) : + qmaPrefixMatrix c c.gates.length = qmaCircuitMatrix c := by + simp [qmaPrefixMatrix,qmaCircuitMatrix] + +theorem qmaPrefixMatrix_gram (c : QMACircuit) (hc : c.WellFormed) (t : ℕ) : + (qmaPrefixMatrix c t).conjTranspose*qmaPrefixMatrix c t = 1 := by + let d : QMACircuit := { c with gates := c.gates.take t } + have hd : d.WellFormed := ⟨hc.1,fun g hg => hc.2 g (List.mem_of_mem_take hg)⟩ + exact qmaCircuitMatrix_gram d hd + +theorem qmaPrefixMatrix_cogram (c : QMACircuit) (hc : c.WellFormed) (t : ℕ) : + qmaPrefixMatrix c t*(qmaPrefixMatrix c t).conjTranspose = 1 := + mul_eq_one_comm.mp (qmaPrefixMatrix_gram c hc t) + +def qmaStepMatrix (c : QMACircuit) (t : ℕ) : + Matrix (SourceSpinBasis (c.work+1)) (SourceSpinBasis (c.work+1)) ℂ := + qmaGateMatrix c.work (c.gates.getD t (.hadamard 0)) + +theorem qmaPrefixMatrix_succ (c : QMACircuit) (t : ℕ) (ht : t < c.gates.length) : + qmaPrefixMatrix c (t+1) = qmaStepMatrix c t*qmaPrefixMatrix c t := by + unfold qmaPrefixMatrix qmaStepMatrix + rw [←List.take_concat_get' c.gates t ht,List.foldl_append] + simp only [List.foldl_cons,List.foldl_nil] + rw [List.getD_eq_get c.gates (.hadamard 0) ⟨t,ht⟩] + rfl + +theorem qmaStepMatrix_gram (c : QMACircuit) (hc : c.WellFormed) + (t : ℕ) (ht : t < c.gates.length) : + (qmaStepMatrix c t).conjTranspose*qmaStepMatrix c t = 1 := by + apply qmaGateMatrix_gram + rw [List.getD_eq_get c.gates (.hadamard 0) ⟨t,ht⟩] + exact hc.2 _ (List.get_mem _ _) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPreparedCircuit.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPreparedCircuit.lean new file mode 100644 index 0000000000000000000000000000000000000000..efa8b2c7f86388c4b027dbc2e188d8586d1f98a5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPreparedCircuit.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSweepListProgram + +namespace OAI + +/-! The particular sparse, nonempty circuit used by the history reduction, +with its literal program and unchanged verifier acceptance probability. -/ + +noncomputable section +namespace ContinuumCoulomb +open ExactQuantumFactoring.BitStackProgram +open BinaryEncoding + +def qmaPreparedCircuit (c : QMACircuit) : QMACircuit := + qmaSparseCircuit (qmaNonemptyCircuit c) + +theorem qmaPreparedCircuit_witness (c : QMACircuit) : + (qmaPreparedCircuit c).witness=c.witness := rfl + +theorem qmaPreparedCircuit_wellFormed (c : QMACircuit) (hc : c.WellFormed) : + (qmaPreparedCircuit c).WellFormed := + qmaSparseCircuit_wellFormed _ (qmaNonemptyCircuit_wellFormed c hc) + +theorem qmaPreparedCircuit_positive (c : QMACircuit) : + 0 < (qmaPreparedCircuit c).gates.length := qmaNonemptyCircuit_sparse_pos c + +theorem qmaPreparedCircuit_acceptance (c : QMACircuit) (hc : c.WellFormed) + (psi : EuclideanSpace ℂ (SourceSpinBasis c.witness)) : + qmaAcceptance (qmaPreparedCircuit c) (qmaPreparedCircuit_wellFormed c hc) psi= + qmaAcceptance c hc psi := by + exact (qmaSparseCircuit_acceptance (qmaNonemptyCircuit c) + (qmaNonemptyCircuit_wellFormed c hc) psi).trans + (qmaNonemptyCircuit_acceptance c hc psi) + +theorem qmaPreparedCircuit_size (c : QMACircuit) {B : ℕ} + (hB : c.work+c.gates.length ≤ B) : + (qmaPreparedCircuit c).work+(qmaPreparedCircuit c).gates.length ≤ + B+(4*B+5)*(6*B+7)*(B+2) := by + have hw : c.work ≤ B := by omega + have hg : c.gates.length ≤ B := by omega + have h := qmaSparseCircuit_size (qmaNonemptyCircuit c) + change (qmaPreparedCircuit c).work+(qmaPreparedCircuit c).gates.length ≤ _ at h + have hs : (qmaPreparedCircuit c).work+(qmaPreparedCircuit c).gates.length ≤ + c.work+(4*c.work+5)*(6*c.work+7)*(c.gates.length+2) := by + simpa only [qmaNonemptyCircuit,List.length_append,List.length_cons,List.length_nil, + Nat.add_zero] using h + exact hs.trans (by gcongr) + +namespace QuantumCircuitCode + +noncomputable def preparedCircuitProgram : Procedure circuitCode circuitCode qmaPreparedCircuit := + sparseCircuitProgram.comp nonemptyProgram + +end QuantumCircuitCode + +def QuantumVerifier.prepared (V : QuantumVerifier) (x : BitString) : QMACircuit := + qmaPreparedCircuit (V.generate x) + +theorem QuantumVerifier.prepared_wellFormed (V : QuantumVerifier) (x : BitString) : + (V.prepared x).WellFormed := qmaPreparedCircuit_wellFormed _ (V.wellFormed x) + +theorem QuantumVerifier.prepared_positive (V : QuantumVerifier) (x : BitString) : + 0 < (V.prepared x).gates.length := qmaPreparedCircuit_positive _ + +def QuantumVerifier.preparedSize (V : QuantumVerifier) : Polynomial ℕ := + V.size+(4*V.size+5)*(6*V.size+7)*(V.size+2) + +theorem QuantumVerifier.prepared_size (V : QuantumVerifier) (x : BitString) : + (V.prepared x).work+(V.prepared x).gates.length ≤ V.preparedSize.eval x.length := by + simpa only [prepared,preparedSize,Polynomial.eval_add,Polynomial.eval_mul, + Polynomial.eval_natCast,Polynomial.eval_ofNat] using + qmaPreparedCircuit_size (V.generate x) (V.size_bound x) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPreparedLattice.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPreparedLattice.lean new file mode 100644 index 0000000000000000000000000000000000000000..a659aef3af911a9a95d99682cd078b702115f2be --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPreparedLattice.lean @@ -0,0 +1,51 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryLattice +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPreparedCircuit + +namespace OAI + +/-! The specified physical source for every well-formed verifier circuit, +including the empty circuit. Padding preserves the original witness register +and acceptance probability. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumHistorySpatial + +def preparedSource (c : QMACircuit) (hc : c.WellFormed) : SquareLatticeHeisenberg := + source (qmaNonemptyCircuit c) (qmaNonemptyCircuit_wellFormed c hc) + (qmaNonemptyCircuit_sparse_pos c) (qmaNonemptyCircuit_nearest c) + +theorem preparedSource_accepting (c : QMACircuit) (hc : c.WellFormed) + (psi : EuclideanSpace ℂ (SourceSpinBasis c.witness)) (hpsi : ‖psi‖=1) + (hacc : 2/3 ≤ qmaAcceptance c hc psi) : + realSourceGroundEnergy (preparedSource c hc) ≤ ((preparedSource c hc).lower:ℝ) := + source_accepting (qmaNonemptyCircuit c) (qmaNonemptyCircuit_wellFormed c hc) + (qmaNonemptyCircuit_sparse_pos c) (qmaNonemptyCircuit_nearest c) psi hpsi + ((qmaNonemptyCircuit_acceptance c hc psi) ▸ hacc) + +theorem preparedSource_rejecting (c : QMACircuit) (hc : c.WellFormed) + (hsound : ∀ psi : EuclideanSpace ℂ (SourceSpinBasis c.witness), + ‖psi‖=1 → qmaAcceptance c hc psi ≤ 1/3) : + ((preparedSource c hc).upper:ℝ) ≤ realSourceGroundEnergy (preparedSource c hc) := + source_rejecting (qmaNonemptyCircuit c) (qmaNonemptyCircuit_wellFormed c hc) + (qmaNonemptyCircuit_sparse_pos c) (qmaNonemptyCircuit_nearest c) + (by intro psi hpsi; rw [qmaNonemptyCircuit_acceptance c hc psi]; exact hsound psi hpsi) + +theorem preparedSource_binary_yes (c : QMACircuit) (hc : c.WellFormed) {k : ℕ} + (hp : (preparedSource c hc).binary.PolynomialPromise k) + (psi : EuclideanSpace ℂ (SourceSpinBasis c.witness)) (hpsi : ‖psi‖=1) + (hacc : 2/3 ≤ qmaAcceptance c hc psi) : + (preparedSource c hc).binary ∈ (sourceHeisenbergPromise k).yes := + (preparedSource c hc).binary_mem_yes hp (preparedSource_accepting c hc psi hpsi hacc) + +theorem preparedSource_binary_no (c : QMACircuit) (hc : c.WellFormed) {k : ℕ} + (hp : (preparedSource c hc).binary.PolynomialPromise k) + (hsound : ∀ psi : EuclideanSpace ℂ (SourceSpinBasis c.witness), + ‖psi‖=1 → qmaAcceptance c hc psi ≤ 1/3) : + (preparedSource c hc).binary ∈ (sourceHeisenbergPromise k).no := + (preparedSource c hc).binary_mem_no hp (preparedSource_rejecting c hc hsound) + +end ContinuumCoulomb.QuantumHistorySpatial + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPreparedVerifier.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPreparedVerifier.lean new file mode 100644 index 0000000000000000000000000000000000000000..9d1cc284b49834eb02d0d31326a1eb3b3c74d4ed --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPreparedVerifier.lean @@ -0,0 +1,72 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnaryPrefixCertificate +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPolynomialUnary +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPreparedCircuit + +namespace OAI + +/-! The actual verifier generator followed by the sparse-circuit compiler. +The unary size certificate is computed from the original input and retained +through the arbitrary given generator before its binary registers are parsed. -/ + +noncomputable section +namespace ContinuumCoulomb +open Turing ExactQuantumFactoring.BitStackProgram BinaryEncoding + +namespace QuantumVerifier + +noncomputable def prefixProgram (V : QuantumVerifier) : + Procedure (id : BitString → List Bool) (prodCode unaryCode id) + (fun x => (V.size.eval x.length,x)) := + ((QuantumPolynomialUnary.program V.size).comp Procedure.length).pair + (Procedure.identity id) + +noncomputable def generateUnary (V : QuantumVerifier) : + TM2ComputableInPolyTime (id : BitString → List Bool) + QuantumCircuitCode.circuitCode V.generate := by + let prefixed := TM2Composition.computable (prefixProgram V).toTM2 + (QuantumUnaryPrefix.computable V.uniform) + let parsed := TM2Composition.computable prefixed QuantumCircuitCode.boundedInput.toTM2 + have he : QuantumCircuitCode.cap ∘ + ((fun x : ℕ × BitString => (x.1,V.generate x.2)) ∘ + (fun x : BitString => (V.size.eval x.length,x))) = V.generate := by + funext x + exact QuantumCircuitCode.cap_eq_of_wellFormed _ _ (V.wellFormed x) + (by + change (V.generate x).work ≤ V.size.eval x.length + have hh := V.size_bound x + omega) + change TM2ComputableInPolyTime id QuantumCircuitCode.circuitCode + (QuantumCircuitCode.cap ∘ + ((fun x : ℕ × BitString => (x.1,V.generate x.2)) ∘ + (fun x : BitString => (V.size.eval x.length,x)))) at parsed + rw [he] at parsed + exact parsed + +noncomputable def preparedUniform (V : QuantumVerifier) : + TM2ComputableInPolyTime (id : BitString → List Bool) + QuantumCircuitCode.circuitCode V.prepared := + TM2Composition.computable V.generateUnary QuantumCircuitCode.preparedCircuitProgram.toTM2 + +theorem prepared_complete (V : QuantumVerifier) (x : BitString) + (hc : ∃ psi : EuclideanSpace ℂ (SourceSpinBasis (V.generate x).witness), + ‖psi‖=1 ∧ 2/3 ≤ qmaAcceptance (V.generate x) (V.wellFormed x) psi) : + ∃ psi : EuclideanSpace ℂ (SourceSpinBasis (V.prepared x).witness), + ‖psi‖=1 ∧ 2/3 ≤ qmaAcceptance (V.prepared x) (V.prepared_wellFormed x) psi := by + rcases hc with ⟨psi,hpsi,haccept⟩ + refine ⟨psi,hpsi,?_⟩ + exact (qmaPreparedCircuit_acceptance (V.generate x) (V.wellFormed x) psi).symm ▸ haccept + +theorem prepared_sound (V : QuantumVerifier) (x : BitString) + (hc : ∀ psi : EuclideanSpace ℂ (SourceSpinBasis (V.generate x).witness), + ‖psi‖=1 → qmaAcceptance (V.generate x) (V.wellFormed x) psi ≤ 1/3) : + ∀ psi : EuclideanSpace ℂ (SourceSpinBasis (V.prepared x).witness), + ‖psi‖=1 → qmaAcceptance (V.prepared x) (V.prepared_wellFormed x) psi ≤ 1/3 := by + intro psi hpsi + exact (qmaPreparedCircuit_acceptance (V.generate x) (V.wellFormed x) psi).symm ▸ hc psi hpsi + +end QuantumVerifier +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrivateAccuracy.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrivateAccuracy.lean new file mode 100644 index 0000000000000000000000000000000000000000..9146feb91d90e53256ca723889f93b6a941a165e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrivateAccuracy.lean @@ -0,0 +1,87 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPrivateTerms + +namespace OAI + +/-! Full-space rational private subdivision with distinct physical pairs. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPrivate +open Matrix +open scoped BigOperators Classical +variable {n m : ℕ} + +def basis : (Fin (n+m) → Fin 2) ≃ ((Fin n ⊕ Fin m) → Fin 2) := + Equiv.arrowCongr finSumFinEquiv.symm (Equiv.refl (Fin 2)) + +theorem term_matrix (e : Fin m) (t : QMAXZTerm n) (k : Fin 4) : + (term e t k).matrix = + (qmaPauliWord (qmaXZSubdivisionWord (left t).word (right t).word e k)).submatrix basis basis := by + rw [← QMAXZTerm.word_matrix] + ext s u + change (∏ i, qmaPauli ((term e t k).word i) (s i) (u i)) = + ∏ j, qmaPauli (qmaXZSubdivisionWord (left t).word (right t).word e k j) + (s (finSumFinEquiv j)) (u (finSumFinEquiv j)) + exact (Fintype.prod_equiv finSumFinEquiv _ _ (by intro i; rw [term_word])).symm + +theorem term_support (e : Fin m) (t : QMAXZTerm n) (k : Fin 4) : + qmaPauliSupport (term e t k).word = + (qmaPauliSupport (qmaXZSubdivisionWord (left t).word (right t).word e k)).map + finSumFinEquiv.toEmbedding := by + ext i + simp only [Finset.mem_map_equiv,qmaPauliSupport,Finset.mem_filter,Finset.mem_univ,true_and] + have h := term_word e t k (finSumFinEquiv.symm i) + simpa only [Equiv.apply_symm_apply] using not_congr (congrArg (fun a => a = 0) h).to_iff + +theorem term_private (t : Fin m → QMAXZTerm n) (p q : Fin m × Fin 4) + (hp : (qmaPauliSupport (term p.1 (t p.1) p.2).word).card = 2) + (he : qmaPauliSupport (term p.1 (t p.1) p.2).word = + qmaPauliSupport (term q.1 (t q.1) q.2).word) : p = q := by + rw [term_support,Finset.card_map] at hp + rw [term_support,term_support] at he + have he' := Finset.map_injective finSumFinEquiv.toEmbedding he + obtain ⟨h₁,h₂⟩ := qmaXZSubdivision_private_pair + (fun e => (left (t e)).word) (fun e => (right (t e)).word) + (fun e => disjoint (t e)) p.1 q.1 p.2 q.2 hp he' + exact Prod.ext h₁ h₂ + +theorem accuracy (N : ℕ) (hN : 0 < N) (t : Fin m → QMAXZTerm n) (J : Fin m → ℚ) : + |MediatorGraph.normalizedBottom (∑ p : Fin m × Fin 4, + (weight (scale N J) (J p.1) p.2:ℂ) • (term p.1 (t p.1) p.2).matrix)- + MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • (t e).matrix)| ≤ 1/(N:ℝ) := by + have hN' : (1:ℝ) ≤ N := by exact_mod_cast hN + have hc (e : Fin m) : qmaPauliWord (left (t e)).word*qmaPauliWord (right (t e)).word = + qmaPauliWord (right (t e)).word*qmaPauliWord (left (t e)).word := + qmaPauliWord_disjoint_commute _ _ (by + intro i + by_cases hi : (left (t e)).word i = 0 + · exact Or.inl hi + · right + by_contra hj + have hi' : i ∈ qmaPauliSupport (left (t e)).word := by simp [qmaPauliSupport,hi] + have hj' : i ∈ qmaPauliSupport (right (t e)).word := by simp [qmaPauliSupport,hj] + exact Finset.disjoint_left.mp (disjoint (t e)) hi' hj') + have h := qmaXZSubdivision_accuracy (fun e => (left (t e)).word) (fun e => (right (t e)).word) + (fun e => (J e:ℝ)) hc hN' + dsimp only at h + rw [← scale_cast] at h + simp only [factor] at h + have hs : (∑ p : Fin m × Fin 4, + (weight (scale N J) (J p.1) p.2:ℂ) • (term p.1 (t p.1) p.2).matrix) = + (∑ p : Fin m × Fin 4, (qmaXZSubdivisionWeight (scale N J:ℝ) (J p.1:ℝ) p.2:ℂ) • + qmaPauliWord (qmaXZSubdivisionWord (left (t p.1)).word (right (t p.1)).word p.1 p.2)).submatrix + basis basis := by + rw [MediatorGraph.submatrix_sum] + apply Finset.sum_congr rfl + intro p _ + rw [term_matrix,MediatorGraph.submatrix_smul_apply] + congr 1 + exact (show (weight (scale N J) (J p.1) p.2:ℂ) = _ from by + rw [← weight_cast]; rfl) + rw [hs,MediatorGraph.normalizedBottom_reindex] + exact_mod_cast h + +end ContinuumCoulomb.QuantumPrivate + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrivateCompiler.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrivateCompiler.lean new file mode 100644 index 0000000000000000000000000000000000000000..ed0a140120999856a4e3de8f017cb9eb48172d0b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrivateCompiler.lean @@ -0,0 +1,72 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPrivateList + +namespace OAI + +/-! The complete rational X/Z-to-Heisenberg compiler, without a private-pair input assumption. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPrivate +open QuantumRawExchange Matrix +open scoped BigOperators Classical +variable {n m : ℕ} + +theorem rawBudget_packed (t : Fin m → QMAXZTerm n) (J : Fin m → ℚ) : + rawBudget (packed t J) = budget J := by + simp only [rawBudget,packed,List.map_ofFn,List.sum_ofFn,Function.comp_apply,pack_weight,budget] + +theorem rawScale_packed (N : ℕ) (t : Fin m → QMAXZTerm n) (J : Fin m → ℚ) : + rawScale N (packed t J) = scale N J := by + simp only [rawScale,rawBudget_packed,scale] + +private theorem map_range_eq_ofFn {α : Type} (f : ℕ → α) : + (List.range m).map f = List.ofFn (fun i : Fin m => f i.val) := by + simpa only [List.length_range,List.getElem_range,Fin.val_cast] using + (List.ofFn_getElem_eq_map (List.range m) f).symm + +theorem subdivide_packed (N : ℕ) (t : Fin m → QMAXZTerm n) (J : Fin m → ℚ) : + subdivide (n,N,packed t J) = packed (familyTerm t) (familyWeight N J) := by + change ((List.range (packed t J).length).map (fun e => + rawBlock n e (rawScale N (packed t J)) (((packed t J).drop e).headD zeroRaw))).flatten = _ + rw [rawScale_packed] + have hlen : (packed t J).length = m := List.length_ofFn + rw [hlen,map_range_eq_ofFn] + have hget (e : Fin m) : ((packed t J).drop e.val).headD zeroRaw = pack (t e) (J e) := by + simp only [List.headD_eq_head?_getD,List.head?_drop,packed, + List.getElem?_ofFn,show e.val < m from e.isLt,↓reduceDIte,Option.getD_some] + simp only [hget,rawBlock] + unfold packed + rw [List.ofFn_mul] + apply congrArg List.flatten + apply congrArg List.ofFn + funext i + apply congrArg List.ofFn + funext j + have he : (⟨i.val*4+j.val,by omega⟩ : Fin (m*4)) = finProdFinEquiv (i,j) := by + apply Fin.ext + change i.val*4+j.val = j.val+4*i.val + omega + simp only [familyTerm,familyWeight,he,Equiv.symm_apply_apply] + exact rawTerm_pack i (t i) (scale N J) (J i) j + +theorem output_packed (N : ℕ) (t : Fin m → QMAXZTerm n) (J : Fin m → ℚ) : + output (n,N,packed t J) = (n+m,N,packed (familyTerm t) (familyWeight N J)) := by + rw [output,subdivide_packed] + simp only [packed,List.length_ofFn] + +theorem compile_accuracy (N : ℕ) (hN : 0 < N) (t : Fin m → QMAXZTerm n) (J : Fin m → ℚ) : + |MediatorGraph.normalizedBottom (rawMatrix ((n+m)*4) (compile (n,N,packed t J)))- + MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • (t e).matrix)| ≤ 3/(N:ℝ) := by + rw [compile,output_packed] + exact compiled_accuracy N hN t J + +theorem compile_valid (N : ℕ) (t : Fin m → QMAXZTerm n) (J : Fin m → ℚ) + (b : MediatorListProgram.Bond) (hb : b ∈ (compile (n,N,packed t J)).1) : + b.1 < (n+m)*4 ∧ b.2.1 < (n+m)*4 ∧ b.1 ≠ b.2.1 := by + rw [compile,output_packed] at hb + exact QuantumRawExchange.compile_valid N (familyTerm t) (familyWeight N J) b hb + +end ContinuumCoulomb.QuantumPrivate + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrivateFamily.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrivateFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d1a29e68132375f96e138dad980b78fa4fb82ec --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrivateFamily.lean @@ -0,0 +1,50 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPrivateAccuracy +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPrivateRaw + +namespace OAI + +/-! The private subdivision has ordinary finite indices and feeds the checked compiler. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPrivate +open Matrix +open scoped BigOperators Classical +variable {n m : ℕ} + +def familyTerm (t : Fin m → QMAXZTerm n) (p : Fin (m*4)) : QMAXZTerm (n+m) := + let e := (finProdFinEquiv : Fin m × Fin 4 ≃ Fin (m*4)).symm p + term e.1 (t e.1) e.2 + +def familyWeight (N : ℕ) (J : Fin m → ℚ) (p : Fin (m*4)) : ℚ := + let e := (finProdFinEquiv : Fin m × Fin 4 ≃ Fin (m*4)).symm p + weight (scale N J) (J e.1) e.2 + +theorem family_private (t : Fin m → QMAXZTerm n) (p q : Fin (m*4)) + (hp : (qmaPauliSupport (familyTerm t p).word).card = 2) + (he : qmaPauliSupport (familyTerm t p).word = qmaPauliSupport (familyTerm t q).word) : p = q := by + apply (finProdFinEquiv : Fin m × Fin 4 ≃ Fin (m*4)).symm.injective + exact term_private t _ _ hp he + +theorem family_accuracy (N : ℕ) (hN : 0 < N) (t : Fin m → QMAXZTerm n) (J : Fin m → ℚ) : + |MediatorGraph.normalizedBottom (∑ p : Fin (m*4), (familyWeight N J p:ℂ) • (familyTerm t p).matrix)- + MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • (t e).matrix)| ≤ 1/(N:ℝ) := by + have hs : (∑ p : Fin (m*4), (familyWeight N J p:ℂ) • (familyTerm t p).matrix) = + ∑ p : Fin m × Fin 4, (weight (scale N J) (J p.1) p.2:ℂ) • (term p.1 (t p.1) p.2).matrix := + Fintype.sum_equiv (finProdFinEquiv : Fin m × Fin 4 ≃ Fin (m*4)).symm _ _ (by intro p; rfl) + rw [hs] + exact accuracy N hN t J + +theorem compiled_accuracy (N : ℕ) (hN : 0 < N) (t : Fin m → QMAXZTerm n) (J : Fin m → ℚ) : + |MediatorGraph.normalizedBottom (QuantumRawExchange.rawMatrix ((n+m)*4) + (QuantumRawExchange.compile (n+m,N,QuantumRawExchange.packed (familyTerm t) (familyWeight N J))))- + MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • (t e).matrix)| ≤ 3/(N:ℝ) := by + have h₁ := QuantumRawExchange.compile_accuracy N hN (familyTerm t) (familyWeight N J) (family_private t) + have h₂ := family_accuracy N hN t J + apply (abs_sub_le _ _ _).trans (add_le_add h₁ h₂ |>.trans _) + exact le_of_eq (by ring) + +end ContinuumCoulomb.QuantumPrivate + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrivateList.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrivateList.lean new file mode 100644 index 0000000000000000000000000000000000000000..30ca100a3f5885eddacb6e0b3942cfdfada150a7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrivateList.lean @@ -0,0 +1,92 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPrivateProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPrivateFamily + +namespace OAI + +/-! Polynomial enumeration of the complete private subdivision and its scale. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPrivate +open QuantumRawExchange ExactQuantumFactoring.BitStackProgram + +def rawBudget (xs : List Raw) : ℚ := 4*(1+(xs.map (fun x => (1+|x.2.2.2|)^2)).sum) +def rawScale (N : ℕ) (xs : List Raw) : ℚ := 8*(rawBudget xs)^4*N + +def subdivide (x : ScheduleInput) : List Raw := + ((List.range x.2.2.length).map (fun e => rawBlock x.1 e (rawScale x.2.1 x.2.2) + ((x.2.2.drop e).headD zeroRaw))).flatten + +def output (x : ScheduleInput) : ScheduleInput := (x.1+x.2.2.length,x.2.1,subdivide x) +def compile (x : ScheduleInput) : List MediatorListProgram.Bond × ℚ := QuantumRawExchange.compile (output x) + +noncomputable opaque rawWeightMagnitudeProgram : Procedure rawCode ratCode (fun x => 1+|x.2.2.2|) := + Procedure.ratAdd.comp ((Procedure.constant rawCode ratCode 1).pair rawAbsoluteProgram) +noncomputable opaque rawWeightSquareProgram : Procedure rawCode ratCode (fun x => (1+|x.2.2.2|)^2) := + (Procedure.ratMul.comp (rawWeightMagnitudeProgram.pair rawWeightMagnitudeProgram)).congrFun + (by intro x; change _*_ = _^2; ring) +noncomputable opaque rawSumProgram : Procedure (listCode rawCode) ratCode + (fun xs => (xs.map (fun x => (1+|x.2.2.2|)^2)).sum) := + RationalSumProgram.sumProgram.comp (Procedure.listMap zeroRaw 0 rawWeightSquareProgram) +noncomputable opaque budgetProgram : Procedure scheduleCode ratCode (fun x => rawBudget x.2.2) := + Procedure.ratMul.comp ((Procedure.constant scheduleCode ratCode 4).pair + (Procedure.ratAdd.comp ((Procedure.constant scheduleCode ratCode 1).pair + (rawSumProgram.comp scheduleTermsProgram)))) +noncomputable opaque budgetSquareProgram : Procedure scheduleCode ratCode (fun x => (rawBudget x.2.2)^2) := + (Procedure.ratMul.comp (budgetProgram.pair budgetProgram)).congrFun + (by intro x; change _*_ = _^2; ring) +noncomputable opaque budgetFourthProgram : Procedure scheduleCode ratCode (fun x => (rawBudget x.2.2)^4) := + (Procedure.ratMul.comp (budgetSquareProgram.pair budgetSquareProgram)).congrFun + (by intro x; change _^2*_^2 = _^4; ring) +noncomputable opaque scaleProgram : Procedure scheduleCode ratCode (fun x => rawScale x.2.1 x.2.2) := + Procedure.ratMul.comp ((Procedure.ratMul.comp + ((Procedure.constant scheduleCode ratCode 8).pair budgetFourthProgram)).pair accuracyRatProgram) +noncomputable opaque newCountProgram : Procedure scheduleCode unaryCode (fun x => x.1+x.2.2.length) := + Procedure.unaryAdd.comp (scheduleCountProgram.pair scheduleLengthProgram) +noncomputable opaque blockEnvironmentProgram : Procedure scheduleCode (prodCode Nat.bits ratCode) + (fun x => (x.1,rawScale x.2.1 x.2.2)) := + (Procedure.unaryToBits.comp scheduleCountProgram).pair scaleProgram + +def iterationCode : (ℕ × ScheduleInput) → List Bool := prodCode unaryCode scheduleCode +noncomputable opaque iterationIndexProgram : Procedure iterationCode Nat.bits Prod.fst := + Procedure.unaryToBits.comp (Procedure.first _ _) +noncomputable opaque iterationInputProgram : Procedure iterationCode scheduleCode Prod.snd := Procedure.second _ _ +noncomputable opaque iterationRawProgram : Procedure iterationCode rawCode + (fun x => ((x.2.2.2.drop x.1).headD zeroRaw)) := + (Procedure.listGet rawCode zeroRaw).comp + (iterationIndexProgram.pair (scheduleTermsProgram.comp iterationInputProgram)) +noncomputable opaque iterationBlockInputProgram : Procedure iterationCode blockCode + (fun x => ((x.2.1,rawScale x.2.2.1 x.2.2.2),(x.1,(x.2.2.2.drop x.1).headD zeroRaw))) := + (blockEnvironmentProgram.comp iterationInputProgram).pair (iterationIndexProgram.pair iterationRawProgram) +noncomputable opaque iterationProgram : Procedure iterationCode (listCode rawCode) + (fun x => rawBlock x.2.1 x.1 (rawScale x.2.2.1 x.2.2.2) ((x.2.2.2.drop x.1).headD zeroRaw)) := + (blockProgram.comp iterationBlockInputProgram).congrFun (by intro x; rfl) +noncomputable opaque tabulatedProgram : Procedure iterationCode (listCode (listCode rawCode)) + (fun x => (List.range x.1).map (fun e => + rawBlock x.2.1 e (rawScale x.2.2.1 x.2.2.2) ((x.2.2.2.drop e).headD zeroRaw))) := + Procedure.tabulate + (ea := scheduleCode) (eb := listCode rawCode) + (f := fun x e => rawBlock x.1 e (rawScale x.2.1 x.2.2) ((x.2.2.drop e).headD zeroRaw)) [] + iterationProgram +noncomputable opaque rowsInputProgram : Procedure scheduleCode iterationCode + (fun x => (x.2.2.length,x)) := scheduleLengthProgram.pair (Procedure.identity scheduleCode) +noncomputable opaque rowsProgram : Procedure scheduleCode (listCode (listCode rawCode)) + (fun x => (List.range x.2.2.length).map (fun e => + rawBlock x.1 e (rawScale x.2.1 x.2.2) ((x.2.2.drop e).headD zeroRaw))) := by + let p := tabulatedProgram.comp rowsInputProgram + exact p.congrFun (by intro x; rfl) +noncomputable opaque subdivideProgram : Procedure scheduleCode (listCode rawCode) subdivide := by + let p := (flattenProgram rawCode zeroRaw).comp rowsProgram + exact p.congrFun (by intro x; rfl) +noncomputable opaque outputProgram : Procedure scheduleCode scheduleCode output := + newCountProgram.pair (accuracyProgram.pair subdivideProgram) +noncomputable opaque compileProgram : Procedure scheduleCode + (prodCode (listCode MediatorListProgram.bondCode) ratCode) compile := + QuantumRawExchange.compileProgram.comp outputProgram +noncomputable def compileCertificate : Turing.TM2ComputableInPolyTime scheduleCode + (prodCode (listCode MediatorListProgram.bondCode) ratCode) compile := compileProgram.toTM2 + +end ContinuumCoulomb.QuantumPrivate + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrivateProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrivateProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..fb3f64da030d2330909cead8e6b0239b0d1f7aa7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrivateProgram.lean @@ -0,0 +1,133 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPrivateRaw + +namespace OAI + +/-! Polynomial machine instructions for rational private-pair subdivision. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPrivate +open QuantumRawExchange ExactQuantumFactoring.BitStackProgram + +noncomputable def scalarConstructor {α : Type} {ea : α → List Bool} {J : α → ℚ} + (p : Procedure ea ratCode J) : Procedure ea rawCode (fun x => rawScalar (J x)) := + (Procedure.constant ea (prodCode Procedure.boolCode Procedure.boolCode) (false,false)).pair + ((Procedure.constant ea (prodCode Nat.bits Nat.bits) (0,0)).pair + ((Procedure.constant ea (prodCode Procedure.boolCode Procedure.boolCode) (false,false)).pair p)) + +noncomputable def fieldConstructor {α : Type} {ea : α → List Bool} + {i : α → ℕ} {a : α → Bool} {J : α → ℚ} + (pi : Procedure ea Nat.bits i) (pa : Procedure ea Procedure.boolCode a) (pJ : Procedure ea ratCode J) : + Procedure ea rawCode (fun x => rawField (i x) (a x) (J x)) := + (Procedure.constant ea (prodCode Procedure.boolCode Procedure.boolCode) (false,true)).pair + ((pi.pair (Procedure.constant ea Nat.bits 0)).pair + ((pa.pair (Procedure.constant ea Procedure.boolCode false)).pair pJ)) + +noncomputable def pairConstructor {α : Type} {ea : α → List Bool} + {i j : α → ℕ} {a b : α → Bool} {J : α → ℚ} + (pi : Procedure ea Nat.bits i) (pj : Procedure ea Nat.bits j) + (pa : Procedure ea Procedure.boolCode a) (pb : Procedure ea Procedure.boolCode b) + (pJ : Procedure ea ratCode J) : Procedure ea rawCode (fun x => rawPair (i x) (j x) (a x) (b x) (J x)) := + (Procedure.constant ea (prodCode Procedure.boolCode Procedure.boolCode) (true,false)).pair + ((pi.pair pj).pair ((pa.pair pb).pair pJ)) + +abbrev BlockInput := (ℕ × ℚ) × (ℕ × Raw) +def blockCode : BlockInput → List Bool := + prodCode (prodCode Nat.bits ratCode) (prodCode Nat.bits rawCode) + +noncomputable opaque envProgram : Procedure blockCode (prodCode Nat.bits ratCode) Prod.fst := Procedure.first _ _ +noncomputable opaque indexRawProgram : Procedure blockCode (prodCode Nat.bits rawCode) Prod.snd := Procedure.second _ _ +noncomputable opaque countProgram : Procedure blockCode Nat.bits (fun x => x.1.1) := + (Procedure.first _ _).comp envProgram +noncomputable opaque radiusProgram : Procedure blockCode ratCode (fun x => x.1.2) := + (Procedure.second _ _).comp envProgram +noncomputable opaque indexProgram : Procedure blockCode Nat.bits (fun x => x.2.1) := + (Procedure.first _ _).comp indexRawProgram +noncomputable opaque rawProgram : Procedure blockCode rawCode (fun x => x.2.2) := + (Procedure.second _ _).comp indexRawProgram +noncomputable opaque viewProgram : Procedure blockCode QuantumRawExchange.inputCode + (fun x => ((0,x.1.2),x.2.2)) := + ((Procedure.constant blockCode unaryCode 0).pair radiusProgram).pair rawProgram +noncomputable opaque freshProgram : Procedure blockCode Nat.bits (fun x => x.1.1+x.2.1) := + Procedure.binaryAdd.comp (countProgram.pair indexProgram) +noncomputable opaque coefficientProgram : Procedure blockCode ratCode (fun x => x.2.2.2.2.2) := + QuantumRawExchange.weightProgram.comp viewProgram +noncomputable opaque pairFlagProgram : Procedure blockCode Procedure.boolCode (fun x => x.2.2.1.1) := + QuantumRawExchange.pairFlagProgram.comp viewProgram +noncomputable opaque leftFlagProgram : Procedure blockCode Procedure.boolCode + (fun x => x.2.2.1.1 || x.2.2.1.2) := + (Procedure.conditional pairFlagProgram (Procedure.constant blockCode Procedure.boolCode true) + (QuantumRawExchange.fieldFlagProgram.comp viewProgram)).congrFun + (by intro x; cases x.2.2.1.1 <;> rfl) +noncomputable opaque oldLeftProgram : Procedure blockCode Nat.bits (fun x => x.2.2.2.1.1) := + QuantumRawExchange.leftProgram.comp viewProgram +noncomputable opaque oldRightProgram : Procedure blockCode Nat.bits (fun x => x.2.2.2.1.2) := + QuantumRawExchange.rightProgram.comp viewProgram +noncomputable opaque axisLeftProgram : Procedure blockCode Procedure.boolCode (fun x => x.2.2.2.2.1.1) := + QuantumRawExchange.axisLeftProgram.comp viewProgram +noncomputable opaque axisRightProgram : Procedure blockCode Procedure.boolCode (fun x => x.2.2.2.2.1.2) := + QuantumRawExchange.axisRightProgram.comp viewProgram +noncomputable opaque radiusSquareProgram : Procedure blockCode ratCode (fun x => x.1.2^2) := + (Procedure.ratMul.comp (radiusProgram.pair radiusProgram)).congrFun + (by intro x; change _*_ = _^2; ring) +noncomputable opaque radiusHalfProgram : Procedure blockCode ratCode (fun x => x.1.2^2/2) := + Procedure.ratDiv.comp (radiusSquareProgram.pair (Procedure.constant blockCode ratCode 2)) +noncomputable opaque coefficientHalfProgram : Procedure blockCode ratCode (fun x => x.2.2.2.2.2/2) := + Procedure.ratDiv.comp (coefficientProgram.pair (Procedure.constant blockCode ratCode 2)) +noncomputable opaque coefficientSquareProgram : Procedure blockCode ratCode (fun x => (x.2.2.2.2.2/2)^2) := + (Procedure.ratMul.comp (coefficientHalfProgram.pair coefficientHalfProgram)).congrFun + (by intro x; change _*_ = _^2; ring) +noncomputable opaque zeroWeightProgram : Procedure blockCode ratCode + (fun x => x.1.2^2/2+1+(x.2.2.2.2.2/2)^2) := + Procedure.ratAdd.comp ((Procedure.ratAdd.comp + (radiusHalfProgram.pair (Procedure.constant blockCode ratCode 1))).pair coefficientSquareProgram) +noncomputable opaque lastWeightProgram : Procedure blockCode ratCode (fun x => -x.1.2*x.2.2.2.2.2/2) := + Procedure.ratDiv.comp ((Procedure.ratMul.comp + ((Procedure.ratNeg.comp radiusProgram).pair coefficientProgram)).pair (Procedure.constant blockCode ratCode 2)) + +noncomputable opaque weightProgram (k : Fin 4) : Procedure blockCode ratCode + (fun x => weight x.1.2 x.2.2.2.2.2 k) := by + by_cases h0 : k = 0 + · subst k + exact zeroWeightProgram.congrFun (by intro x; rfl) + by_cases h1 : k = 1 + · subst k + exact (Procedure.ratNeg.comp radiusHalfProgram).congrFun (by + intro x + change -(x.1.2^2/2) = -x.1.2^2/2 + ring) + by_cases h2 : k = 2 + · subst k + exact radiusProgram.congrFun (by intro x; rfl) + have h3 : k = 3 := by omega + subst k + exact lastWeightProgram.congrFun (by intro x; rfl) + +noncomputable opaque termProgram (k : Fin 4) : Procedure blockCode rawCode + (fun x => rawTerm x.1.1 x.2.1 x.1.2 x.2.2 k) := by + let p := weightProgram k + let yes := Procedure.constant blockCode Procedure.boolCode true + let no := Procedure.constant blockCode Procedure.boolCode false + by_cases h0 : k = 0 + · exact (scalarConstructor p).congrFun (by intro x; simp [rawTerm,h0]) + by_cases h1 : k = 1 + · exact (fieldConstructor freshProgram no p).congrFun (by intro x; simp [rawTerm,h1]) + by_cases h2 : k = 2 + · exact (Procedure.conditional leftFlagProgram + (pairConstructor oldLeftProgram freshProgram axisLeftProgram yes p) + (fieldConstructor freshProgram yes p)).congrFun (by intro x; simp [rawTerm,h2]) + · exact (Procedure.conditional pairFlagProgram + (pairConstructor oldRightProgram freshProgram axisRightProgram yes p) + (fieldConstructor freshProgram yes p)).congrFun (by intro x; simp [rawTerm,h0,h1,h2]) + +noncomputable opaque blockProgram : Procedure blockCode (listCode rawCode) + (fun x => rawBlock x.1.1 x.2.1 x.1.2 x.2.2) := + fixedListProgram blockCode rawCode 4 _ termProgram + +noncomputable def blockCertificate : Turing.TM2ComputableInPolyTime blockCode (listCode rawCode) + (fun x => rawBlock x.1.1 x.2.1 x.1.2 x.2.2) := blockProgram.toTM2 + +end ContinuumCoulomb.QuantumPrivate + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrivateRaw.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrivateRaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..d0fb8449c208ad4e0b11ec3f64c77fa96161ac5a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrivateRaw.lean @@ -0,0 +1,36 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPrivateTerms + +namespace OAI + +/-! Concrete raw instructions for private-pair subdivision. -/ + +namespace ContinuumCoulomb.QuantumPrivate +open QuantumRawExchange + +def rawScalar (J : ℚ) : Raw := ((false,false),((0,0),((false,false),J))) +def rawField (i : ℕ) (a : Bool) (J : ℚ) : Raw := ((false,true),((i,0),((a,false),J))) +def rawPair (i j : ℕ) (a b : Bool) (J : ℚ) : Raw := ((true,false),((i,j),((a,b),J))) + +def rawTerm (n e : ℕ) (R : ℚ) (x : Raw) (k : Fin 4) : Raw := + if k = 0 then rawScalar (weight R x.2.2.2 k) + else if k = 1 then rawField (n+e) false (weight R x.2.2.2 k) + else if k = 2 then + if x.1.1 || x.1.2 then rawPair x.2.1.1 (n+e) x.2.2.1.1 true (weight R x.2.2.2 k) + else rawField (n+e) true (weight R x.2.2.2 k) + else if x.1.1 then rawPair x.2.1.2 (n+e) x.2.2.1.2 true (weight R x.2.2.2 k) + else rawField (n+e) true (weight R x.2.2.2 k) + +def rawBlock (n e : ℕ) (R : ℚ) (x : Raw) : List Raw := List.ofFn (rawTerm n e R x) + +theorem rawTerm_pack {n m : ℕ} (e : Fin m) (t : QMAXZTerm n) (R J : ℚ) (k : Fin 4) : + rawTerm n e.val R (pack t J) k = pack (term e t k) (weight R J k) := by + fin_cases k <;> cases t <;> + simp [rawTerm,rawScalar,rawField,rawPair,pack,term,old,fresh, + finSumFinEquiv_apply_left,finSumFinEquiv_apply_right] + +theorem rawBlock_length (n e : ℕ) (R : ℚ) (x : Raw) : (rawBlock n e R x).length = 4 := by + simp [rawBlock] + +end ContinuumCoulomb.QuantumPrivate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrivateSupported.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrivateSupported.lean new file mode 100644 index 0000000000000000000000000000000000000000..7af3bbc0569b4c46d5f947444b15de0d58923244 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrivateSupported.lean @@ -0,0 +1,63 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZPrivate +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZEnvelopes + +namespace OAI + +/-! Private-pair subdivision retains its source support envelope. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +theorem qmaXZPrivate_supported (w : κ → ι → Fin 4) (J : κ → ℝ) + (hw : ∀ e, (qmaPauliSupport (w e)).card ≤ 2) + (hy : ∀ e i, w e i ≠ 2) {N : ℝ} (hN : 1 ≤ N) : + ∃ (v : (κ × Fin 4) → (ι ⊕ κ → Fin 4)) (K : (κ × Fin 4) → ℝ), + (∀ p i, v p i ≠ 2) ∧ (∀ p, (qmaPauliSupport (v p)).card ≤ 2) ∧ + (∀ p q, (qmaPauliSupport (v p)).card = 2 → + qmaPauliSupport (v p) = qmaPauliSupport (v q) → p = q) ∧ + (∀ p, qmaPauliSupport (v p) ⊆ qmaMediatorSupport (qmaPauliSupport (w p.1)) p.1) ∧ + |MediatorGraph.normalizedBottom (∑ p, (K p:ℂ) • qmaPauliWord (v p)) - + MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • qmaPauliWord (w e))| ≤ 1/N := by + choose L T hL hT hdis hcover using fun e => + qmaBalancedSupport (qmaPauliSupport (w e)) 1 (hw e) + let a := fun e => qmaPauliRestrict (L e) (w e) + let b := fun e => qmaPauliRestrict (T e) (w e) + have ha (e : κ) : (qmaPauliSupport (a e)).card ≤ 1 := + (Finset.card_le_card (qmaPauliRestrict_support _ _)).trans (hL e) + have hb (e : κ) : (qmaPauliSupport (b e)).card ≤ 1 := + (Finset.card_le_card (qmaPauliRestrict_support _ _)).trans (hT e) + have hab (e : κ) : qmaPauliWord (a e)*qmaPauliWord (b e) = qmaPauliWord (w e) := + qmaPauliRestrict_factor _ _ _ (hdis e) (by rw [hcover e]) + have hcomm (e : κ) : qmaPauliWord (a e)*qmaPauliWord (b e) = + qmaPauliWord (b e)*qmaPauliWord (a e) := qmaPauliRestrict_commute _ _ _ (hdis e) + have hd (e : κ) : Disjoint (qmaPauliSupport (a e)) (qmaPauliSupport (b e)) := + (hdis e).mono (qmaPauliRestrict_support _ _) (qmaPauliRestrict_support _ _) + let R := 8*(qmaThirdBudget 0 J)^4*N + refine ⟨fun p => qmaXZSubdivisionWord (a p.1) (b p.1) p.1 p.2, + fun p => qmaXZSubdivisionWeight R (J p.1) p.2,?_,?_,?_,?_,?_⟩ + · intro p i + exact qmaXZSubdivision_noY _ _ _ (qmaPauliRestrict_noY _ _ (hy p.1)) + (qmaPauliRestrict_noY _ _ (hy p.1)) _ _ + · intro p + exact qmaXZSubdivision_support _ _ _ (ha p.1) (hb p.1) _ + · intro p q hp hpq + obtain ⟨he,hk⟩ := qmaXZSubdivision_private_pair a b hd p.1 q.1 p.2 q.2 hp hpq + exact Prod.ext he hk + · intro p + apply qmaXZSubdivisionWord_envelope + · exact (qmaPauliRestrict_support _ _).trans + (by intro i hi; rw [← hcover p.1]; exact Finset.mem_union_left _ hi) + · exact (qmaPauliRestrict_support _ _).trans + (by intro i hi; rw [← hcover p.1]; exact Finset.mem_union_right _ hi) + · have h := qmaXZSubdivision_accuracy a b J hcomm hN + simpa only [hab] using h + + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrivateTerms.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrivateTerms.lean new file mode 100644 index 0000000000000000000000000000000000000000..36f784e3a94bc1437acfbe49cb52397bcb216a28 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPrivateTerms.lean @@ -0,0 +1,94 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawCompiler + +namespace OAI + +/-! Explicit private mediator terms; no support-selection oracle is needed. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPrivate +open Matrix +open scoped BigOperators Classical + +variable {n m : ℕ} + +def left (t : QMAXZTerm n) : QMAXZTerm n := + match t with + | .scalar => .scalar + | .field i a => .field i a + | .pair i _ _ a _ => .field i a + +def right (t : QMAXZTerm n) : QMAXZTerm n := + match t with + | .pair _ j _ _ b => .field j b + | _ => .scalar + +theorem factor (t : QMAXZTerm n) : + qmaPauliWord (left t).word*qmaPauliWord (right t).word = t.matrix := by + rw [QMAXZTerm.word_matrix,QMAXZTerm.word_matrix] + cases t with + | scalar => simp [left,right,QMAXZTerm.matrix] + | field i a => simp [left,right,QMAXZTerm.matrix] + | pair i j hij a b => + exact (qmaPairMatrix_eq_mul i j hij (qmaFourAxis a) (qmaFourAxis b)).symm + +theorem disjoint (t : QMAXZTerm n) : + Disjoint (qmaPauliSupport (left t).word) (qmaPauliSupport (right t).word) := by + cases t with + | scalar => simp [left,right,QMAXZTerm.word,qmaPauliSupport] + | field i a => simp [left,right,QMAXZTerm.word,qmaPauliSupport] + | pair i j hij a b => + change Disjoint (qmaPauliSupport (qmaSinglePauliWord i (qmaXZLabel a))) + (qmaPauliSupport (qmaSinglePauliWord j (qmaXZLabel b))) + exact (Finset.disjoint_singleton.mpr hij).mono + (qmaSinglePauliWord_support _ _) (qmaSinglePauliWord_support _ _) + +def old (i : Fin n) : Fin (n+m) := finSumFinEquiv (Sum.inl i) +def fresh (e : Fin m) : Fin (n+m) := finSumFinEquiv (Sum.inr e) + +theorem old_ne_fresh (i : Fin n) (e : Fin m) : old i ≠ fresh e := by + intro h + have h' := finSumFinEquiv.injective h + cases h' + +def term (e : Fin m) (t : QMAXZTerm n) (k : Fin 4) : QMAXZTerm (n+m) := + if k = 0 then .scalar else if k = 1 then .field (fresh e) 1 else if k = 2 then + match t with + | .scalar => .field (fresh e) 0 + | .field i a => .pair (old i) (fresh e) (old_ne_fresh i e) a 0 + | .pair i _ _ a _ => .pair (old i) (fresh e) (old_ne_fresh i e) a 0 + else + match t with + | .pair _ j _ _ b => .pair (old j) (fresh e) (old_ne_fresh j e) b 0 + | _ => .field (fresh e) 0 + +theorem term_word (e : Fin m) (t : QMAXZTerm n) (k : Fin 4) (i : Fin n ⊕ Fin m) : + (term e t k).word (finSumFinEquiv i) = + qmaXZSubdivisionWord (left t).word (right t).word e k i := by + have hl (i : Fin n) (j : Fin m) : Fin.castAdd m i ≠ Fin.natAdd n j := old_ne_fresh i j + have hr (j : Fin m) (i : Fin n) : Fin.natAdd n j ≠ Fin.castAdd m i := (hl i j).symm + fin_cases k <;> cases t <;> cases i <;> + simp [term,left,right,old,fresh,QMAXZTerm.word,qmaXZSubdivisionWord,qmaSinglePauliWord, + qmaXZLabel,hl,hr] + +def weight (R J : ℚ) (k : Fin 4) : ℚ := ![R^2/2+1+(J/2)^2,-R^2/2,R,-R*J/2] k + +theorem weight_cast (R J : ℚ) (k : Fin 4) : + (weight R J k:ℝ) = qmaXZSubdivisionWeight (R:ℝ) (J:ℝ) k := by + fin_cases k <;> simp [weight,qmaXZSubdivisionWeight] + +def budget {κ : Type*} [Fintype κ] (J : κ → ℚ) : ℚ := 4*(1+∑ e, (1+|J e|)^2) +def scale {κ : Type*} [Fintype κ] (N : ℕ) (J : κ → ℚ) : ℚ := 8*(budget J)^4*N + +theorem budget_cast {κ : Type*} [Fintype κ] (J : κ → ℚ) : + (budget J:ℝ) = qmaThirdBudget 0 (fun e => (J e:ℝ)) := by + simp [budget,qmaThirdBudget,qmaThirdWeight] + +theorem scale_cast {κ : Type*} [Fintype κ] (N : ℕ) (J : κ → ℚ) : + (scale N J:ℝ) = 8*(qmaThirdBudget 0 (fun e => (J e:ℝ)))^4*N := by + simp only [scale,Rat.cast_mul,Rat.cast_pow,Rat.cast_natCast,Rat.cast_ofNat,budget_cast] + +end ContinuumCoulomb.QuantumPrivate + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPromisePowers.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPromisePowers.lean new file mode 100644 index 0000000000000000000000000000000000000000..b6b4dbe5619bf30443350d13eee73c8a23d76dd2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPromisePowers.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLatticeEnvelope + +namespace OAI + +/-! Small power bounds for the unary tuples used by the actual coefficient +programs. The exponent is independent of the particular verifier. -/ + +namespace ContinuumCoulomb.QuantumCoefficientPrograms +open ExactQuantumFactoring.BitStackProgram + +private theorem tuple_power (n k : ℕ) : + 16*(n+2)^k ≤ (n+2)^(k+4) := by + have h : 16 ≤ (n+2)^4 := by + simpa using (Nat.pow_le_pow_left (show 2 ≤ n+2 by omega) 4) + rw [pow_add] + simpa only [Nat.mul_comm] using Nat.mul_le_mul_left ((n+2)^k) h + +theorem inputCode_power {n k m L T : ℕ} + (hm : m ≤ (n+2)^k) (hL : L ≤ (n+2)^k) (hT : T ≤ (n+2)^k) : + (inputCode (m,L,T)).length+2 ≤ (n+2)^(k+4) := by + have hp : 1 ≤ (n+2)^k := Nat.one_le_pow k (n+2) (by omega) + calc + _ ≤ 16*(n+2)^k := by + simp only [inputCode,prodCode,pairBits_length,unaryCode,List.length_replicate] + omega + _ ≤ _ := tuple_power n k + +theorem latticeInputCode_power {n k m r L T : ℕ} + (hm : m ≤ (n+2)^k) (hr : r ≤ (n+2)^k) + (hL : L ≤ (n+2)^k) (hT : T ≤ (n+2)^k) : + (latticeInputCode (m,r,L,T)).length+2 ≤ (n+2)^(k+4) := by + have hp : 1 ≤ (n+2)^k := Nat.one_le_pow k (n+2) (by omega) + calc + _ ≤ 16*(n+2)^k := by + simp only [latticeInputCode,prodCode,pairBits_length,unaryCode,List.length_replicate] + omega + _ ≤ _ := tuple_power n k + +theorem input_function_power {f : Input → ℕ} {a : ℕ} + (hf : ∀ x, f x ≤ ((inputCode x).length+2)^a) + {n k m L T : ℕ} (hm : m ≤ (n+2)^k) + (hL : L ≤ (n+2)^k) (hT : T ≤ (n+2)^k) : + f (m,L,T) ≤ (n+2)^((k+4)*a) := by + calc + _ ≤ ((inputCode (m,L,T)).length+2)^a := hf _ + _ ≤ ((n+2)^(k+4))^a := Nat.pow_le_pow_left (inputCode_power hm hL hT) a + _ = _ := (pow_mul _ _ _).symm + +theorem lattice_function_power {f : LatticeInput → ℕ} {a : ℕ} + (hf : ∀ x, f x ≤ ((latticeInputCode x).length+2)^a) + {n k m r L T : ℕ} (hm : m ≤ (n+2)^k) (hr : r ≤ (n+2)^k) + (hL : L ≤ (n+2)^k) (hT : T ≤ (n+2)^k) : + f (m,r,L,T) ≤ (n+2)^((k+4)*a) := by + calc + _ ≤ ((latticeInputCode (m,r,L,T)).length+2)^a := hf _ + _ ≤ ((n+2)^(k+4))^a := Nat.pow_le_pow_left (latticeInputCode_power hm hr hL hT) a + _ = _ := (pow_mul _ _ _).symm + +theorem power_base_change {n k : ℕ} (hn : 0 < n) : (n+2)^k ≤ (n+1)^(2*k) := by + have h : n+2 ≤ (n+1)^2 := by nlinarith + calc + _ ≤ ((n+1)^2)^k := Nat.pow_le_pow_left h k + _ = _ := (pow_mul _ _ _).symm + +end ContinuumCoulomb.QuantumCoefficientPrograms + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPropagationAction.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPropagationAction.lean new file mode 100644 index 0000000000000000000000000000000000000000..919e2047b477f6c1185e7a76895fe360fed440a4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPropagationAction.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalPropagation + +namespace OAI + +/-! Exact agreement of the local propagation operator with the full +unary-clock Hamiltonian. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +theorem qmaLocalPropagationDelta_action (c : QMACircuit) (t : Fin c.gates.length) + (u : QMAUnaryBasis c → ℂ) (s : QMACircuitQubit c → Fin 2) : + (qmaLocalPropagationDelta c t).mulVec (u ∘ qmaCircuitQubitSplit c) s = + qmaUnaryPropagationMap c u (t,qmaCircuitQubitSplit c s) := by + rw [qmaLocalPropagationDelta,←Matrix.mulVec_mulVec,qmaGuardProjection,Matrix.mulVec_diagonal] + by_cases h : QMAClockGuard c.gates.length t (s ∘ Sum.inl) ∧ + s (Sum.inl (qmaClockMiddle c.gates.length t)) = 0 + · rw [ite_eq_left h,one_mul,Matrix.sub_mulVec] + change (qmaBitFlipMatrix (Sum.inl (qmaClockMiddle c.gates.length t))).mulVec + (u ∘ qmaCircuitQubitSplit c) s- + (qmaJoinMatrix 1 (qmaStepMatrix c t.val)).mulVec (u ∘ qmaCircuitQubitSplit c) s = _ + rw [qmaBitFlipMatrix_mulVec,qmaJoinMatrix_one_left_mulVec] + have he : qmaCircuitQubitSplit c (qmaBitFlip (Sum.inl (qmaClockMiddle c.gates.length t)) s) = + (Function.update (s ∘ Sum.inl) (qmaClockMiddle c.gates.length t) 1,s ∘ Sum.inr) := by + apply Prod.ext + · funext i + by_cases hi : i = qmaClockMiddle c.gates.length t + · subst i + simp [qmaCircuitQubitSplit,qmaBitFlip,h.2] + · simp [qmaCircuitQubitSplit,qmaBitFlip,hi] + · funext i + simp [qmaCircuitQubitSplit,qmaBitFlip] + change u (qmaCircuitQubitSplit c (qmaBitFlip _ s))- + (qmaStepMatrix c t.val).mulVec + (fun b => u (qmaCircuitQubitSplit c (Sum.elim (s ∘ Sum.inl) b))) (s ∘ Sum.inr) = _ + rw [he] + change _ = if QMAClockGuard c.gates.length t (s ∘ Sum.inl) ∧ + s (Sum.inl (qmaClockMiddle c.gates.length t)) = 0 then _ else _ + rw [ite_eq_left h] + rfl + · rw [ite_eq_right h,zero_mul] + exact (ite_eq_right h).symm + +def qmaPropagationSlice (c : QMACircuit) (t : Fin c.gates.length) : + Matrix (QMAUnaryBasis c) (QMAUnaryBasis c) ℂ := + (qmaUnaryPropagationMatrix c).submatrix (fun p => (t,p)) id + +theorem qmaPropagationSlice_eq (c : QMACircuit) (t : Fin c.gates.length) : + qmaPropagationSlice c t = (qmaLocalPropagationDelta c t).submatrix + (qmaCircuitQubitSplit c).symm (qmaCircuitQubitSplit c).symm := by + apply Matrix.ext_iff_mulVec.mpr + intro u + funext p + have h := qmaLocalPropagationDelta_action c t u ((qmaCircuitQubitSplit c).symm p) + rw [Matrix.submatrix_mulVec_equiv] + have he : u ∘ ((qmaCircuitQubitSplit c).symm).symm = u ∘ qmaCircuitQubitSplit c := rfl + rw [he] + change ((qmaUnaryPropagationMatrix c).mulVec u) (t,p) = _ + rw [qmaUnaryPropagationMatrix,LinearMap.toMatrix'_mulVec] + simpa only [Equiv.apply_symm_apply,Function.comp_apply] using h.symm + +theorem qmaUnaryPropagationGram_sum (c : QMACircuit) : + (qmaUnaryPropagationMatrix c).conjTranspose*qmaUnaryPropagationMatrix c = + ∑ t : Fin c.gates.length, (qmaPropagationSlice c t).conjTranspose*qmaPropagationSlice c t := by + ext p q + simp only [Matrix.sum_apply,Matrix.mul_apply,Matrix.conjTranspose_apply, + Fintype.sum_prod_type,qmaPropagationSlice,Matrix.submatrix_apply,id_eq] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPropagationOrder.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPropagationOrder.lean new file mode 100644 index 0000000000000000000000000000000000000000..aa9cdc8084c69f44460307c0db6e52a2ee4d8ee1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPropagationOrder.lean @@ -0,0 +1,205 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPropagationSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRebitDiagonal +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRebitLocal +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPropagationTable + +namespace OAI + +/-! The actual ordered support has its reference bit first, followed by +the duplicate-free propagation support in its literal source order. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPropagationOrder +open QuantumOrderedSupport +open scoped Classical + +def term (c : QMACircuit) (t : Fin c.gates.length) : QMACircuitTerm c := + .inr (.inr (.inr (.inr t))) + +theorem sites_eq (c : QMACircuit) (hT : 0 s (nextIndex c hT i t ht j) + +theorem extend_reference (c : QMACircuit) (hT : 0 localBits c hT i t ht s ((QuantumPropagationSupport.supportEquiv c t).symm q)) := by + funext q + by_cases hq : q∈qmaPropagationSites c t + · let j := (QuantumPropagationSupport.supportEquiv c t).symm ⟨q,hq⟩ + have hj : (QuantumPropagationSupport.supportEquiv c t j).val=q := + congrArg Subtype.val ((QuantumPropagationSupport.supportEquiv c t).apply_symm_apply ⟨q,hq⟩) + have he := QuantumHistoryDiagonal.orderedExtend_at c hT (.inl i) s + (nextIndex c hT i t ht j) + rw [nextIndex_site c hT i t ht,hj] at he + exact he.trans (show qmaSupportExtend (qmaPropagationSites c t) + (fun q => localBits c hT i t ht s ((QuantumPropagationSupport.supportEquiv c t).symm q)) q= + s (nextIndex c hT i t ht j) from dite_eq_left hq).symm + · have hn : Sum.inr q ∉ (qmaOrderedHistoryModel c hT).sites (.inl i) := by + intro hm + have hl : Sum.inr q ∈ (sites c hT (.inl i)).toFinset := by + rw [sites_finset] + exact hm + have hx := List.mem_toFinset.mp hl + rw [sites_eq c hT i t ht] at hx + rcases List.mem_cons.mp hx with he | he + · cases he + · obtain ⟨r,hr,he⟩ := List.mem_map.mp he + have hrq : r=q := Sum.inr_injective he + subst r + apply hq + rw [← QuantumPropagationSupport.sites_finset] + exact List.mem_toFinset.mpr hr + have hz : qmaSupportExtend (qmaPropagationSites c t) + (fun q => localBits c hT i t ht s ((QuantumPropagationSupport.supportEquiv c t).symm q)) q=0 := + dite_eq_right hq + exact (show QuantumHistoryDiagonal.orderedExtend c hT (.inl i) s (.inr q)=0 from + dite_eq_right hn).trans hz.symm + +theorem ordered_entry (c : QMACircuit) (hT : 0 localBits c hT i t ht s ((QuantumPropagationSupport.supportEquiv c t).symm q)) + (fun q => localBits c hT i t ht r ((QuantumPropagationSupport.supportEquiv c t).symm q)))) := by + let S := QuantumHistoryDiagonal.orderedExtend c hT (.inl i) s + let R := QuantumHistoryDiagonal.orderedExtend c hT (.inl i) r + change QuantumAlgebraicHistory.rebit (qmaHistoryReferenceWork c+1) i + (QuantumAlgebraicHistory.distributed c (qmaFirstUseTime c) + (qmaOrderedTermEquiv c hT (qmaFirstUseTime c) i)) S R=_ + rw [QuantumAlgebraicHistory.rebit_entry_of_references _ _ _ _ _ _ _ + (extend_reference c hT i t ht s) (extend_reference c hT i t ht r)] + rw [ht] + change QuantumAlgebraicHistory.oneReference _ _ + (QuantumAlgebraicScalar.mul _ (QuantumAlgebraicHistory.lift _ _ + (S ∘ Sum.inr) (R ∘ Sum.inr)))=_ + have hs := extend_data c hT i t ht s + have hr := extend_data c hT i t ht r + change S ∘ Sum.inr=_ at hs + change R ∘ Sum.inr=_ at hr + rw [hs,hr,QuantumAlgebraicHistory.lift_extend] + +theorem ordered_gram_entry (c : QMACircuit) (hT : 0 QuantumAlgebraicHistory.oneReference + (referenceBit c hT i t ht s) (referenceBit c hT i t ht r) + (QuantumAlgebraicScalar.mul + (QuantumAlgebraicScalar.rat ((14*(c.work+1)+8)*c.gates.length : ℚ)) z)) hg.symm + +end ContinuumCoulomb.QuantumPropagationOrder + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPropagationSampler.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPropagationSampler.lean new file mode 100644 index 0000000000000000000000000000000000000000..6264ea9e6188dd9ddaa66925dcf9a2023f740535 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPropagationSampler.lean @@ -0,0 +1,132 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPropagationOrder + +namespace OAI + +/-! Literal local propagation tables after adding the single reference bit. +The arity is fixed in each program; no ambient spin configurations are scanned. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPropagationSampler +open QuantumAlgebraicScalar QuantumAlgebraicHistory QuantumFixedPauli +open ExactQuantumFactoring.BitStackProgram QuantumCircuitCode +open scoped Classical + +abbrev Input := QuantumPropagationTable.Input +abbrev inputCode := QuantumPropagationTable.inputCode + +def coefficient (c : QMACircuit) : ℚ := (14*(c.work+1)+8)*c.gates.length + +def table (m : ℕ) (x : Input) : Matrix (Fin (m+1) → Fin 2) (Fin (m+1) → Fin 2) Scalar := + fun s t => oneReference (s 0) (t 0) (mul (rat (coefficient x.1)) + (matMul (adjoint (QuantumPropagationTable.table m x)) + (QuantumPropagationTable.table m x) (fun j => s j.succ) (fun j => t j.succ))) + +noncomputable opaque coefficientProgram : Procedure inputCode scalarCode + (fun x => rat (coefficient x.1)) := by + let c := Procedure.first circuitCode (prodCode Nat.bits (listCode Nat.bits)) + let work := Procedure.unaryToBits.comp (workProgram.comp c) + let time := Procedure.unaryToBits.comp (QuantumHistoryDescriptors.timeProgram.comp c) + let const (n : ℕ) := Procedure.constant inputCode Nat.bits n + let inner := Procedure.binaryAdd.comp + ((Procedure.binaryMul.comp ((const 14).pair (Procedure.successor.comp work))).pair (const 8)) + let n := Procedure.binaryMul.comp (inner.pair time) + exact (ratProgram.comp (Procedure.natToRat.comp n)).congrFun (by + intro x + simp only [coefficient,Function.comp_apply,id_eq,Nat.cast_mul,Nat.cast_add,Nat.cast_ofNat,Nat.cast_one, + Nat.succ_eq_add_one]) + +noncomputable opaque oneReferenceProgram (a b : Fin 2) : + Procedure scalarCode scalarCode (oneReference a b) := by + let cr := Procedure.constant scalarCode scalarCode (identity a b) + let ci := Procedure.constant scalarCode scalarCode (QuantumFixedPauli.pauli 2 a b) + let minusI := Procedure.constant scalarCode scalarCode (neg imaginary) + exact (addProgram.comp + ((mulProgram.comp (cr.pair realPartProgram)).pair + (mulProgram.comp (minusI.pair (mulProgram.comp (ci.pair imagPartProgram)))))).congrFun + (by intro x; rfl) + +noncomputable opaque entryProgram (m : ℕ) (s t : Fin (m+1) → Fin 2) : + Procedure inputCode scalarCode (fun x => table m x s t) := by + let core := (QuantumFixedPauli.entryProgram (fun j : Fin m => s j.succ) + (fun j : Fin m => t j.succ)).comp (QuantumPropagationTable.gramProgram m) + let scaled := mulProgram.comp (coefficientProgram.pair core) + exact ((oneReferenceProgram (s 0) (t 0)).comp scaled).congrFun (by + intro x + simp only [Function.comp_apply,table,entry_matrixData]) + +noncomputable def tableProgram (m : ℕ) : Procedure inputCode matrixCode + (fun x => matrixData (table m x)) := + QuantumFixedMatrix.dataProgram (β := Fin (m+1) → Fin 2) inputCode (table m) + (QuantumPropagationSampler.entryProgram m) + +def tableList : ℕ → Input → List Scalar + | 0 => fun _ => matrixData (fun _ _ : Fin 0 → Fin 2 => rat 0) + | m+1 => fun x => matrixData (table m x) + +noncomputable def tableListProgram (n : ℕ) : Procedure inputCode matrixCode (tableList n) := by + cases n with + | zero => + exact Procedure.constant inputCode matrixCode + (matrixData (fun _ _ : Fin 0 → Fin 2 => rat 0)) + | succ m => exact QuantumPropagationSampler.tableProgram m + +theorem matrixData_cast {n m : ℕ} (h : n=m) + (A : Matrix (Fin m → Fin 2) (Fin m → Fin 2) Scalar) : + matrixData (reindex ((finCongr h).arrowCongr (Equiv.refl (Fin 2))) A)=matrixData A := by + subst m + rfl + +def basisEquiv (c : QMACircuit) (hT : 0 basisEquiv c hT i t ht s j.succ)= + QuantumPropagationOrder.localBits c hT i t ht s := by + rfl + +theorem table_actual (c : QMACircuit) (hT : 0 tableList n (c,t.val,QuantumPropagationSupport.labels c t)) + (QuantumPropagationOrder.length_eq c hT i t ht) + _ = matrixData (table (QuantumPropagationSupport.sites c t).length + (c,t.val,QuantumPropagationSupport.labels c t)) := rfl + _ = _ := (matrixData_cast (QuantumPropagationOrder.length_eq c hT i t ht) _).symm.trans + (congrArg matrixData (table_actual c hT i t ht).symm) + +end ContinuumCoulomb.QuantumPropagationSampler + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPropagationSupport.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPropagationSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..08c30b2a72f1f6e34fa1077670b311733a09dc86 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPropagationSupport.lean @@ -0,0 +1,105 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryDelta +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumScalarReindex + +namespace OAI + +/-! The literal, duplicate-free five-site propagation support. Lookup in its +encoded labels agrees with the zero extension used by the actual local core. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPropagationSupport +open QuantumHistoryBitProgram QuantumHistoryDiagonal QuantumOrderedSupport +open scoped Classical + +def sites (c : QMACircuit) (t : Fin c.gates.length) : List (QMACircuitQubit c) := + (propagationSites c t).dedup + +theorem sites_nodup (c : QMACircuit) (t : Fin c.gates.length) : + (sites c t).Nodup := List.nodup_dedup _ + +theorem sites_finset (c : QMACircuit) (t : Fin c.gates.length) : + (sites c t).toFinset=qmaPropagationSites c t := by + simpa only [sites,List.toFinset_dedup] using propagationSites_finset c t + +theorem sites_length (c : QMACircuit) (t : Fin c.gates.length) : + (sites c t).length≤5 := + (List.dedup_sublist _).length_le.trans (propagationSites_length c t) + +def supportEquiv (c : QMACircuit) (t : Fin c.gates.length) : + Fin (sites c t).length ≃ {q // q∈qmaPropagationSites c t} := + (List.Nodup.getEquiv (sites c t) (sites_nodup c t)).trans + (Equiv.subtypeEquivRight (fun q => by + have he := congrArg (fun S : Finset (QMACircuitQubit c) => q∈S) (sites_finset c t) + exact List.mem_toFinset.symm.trans (Iff.of_eq he))) + +theorem supportEquiv_apply (c : QMACircuit) (t : Fin c.gates.length) + (i : Fin (sites c t).length) : (supportEquiv c t i).val=(sites c t).get i := rfl + +def labels (c : QMACircuit) (t : Fin c.gates.length) : List ℕ := + (sites c t).map (fun q => siteNumber c (.inr q)) + +def data (c : QMACircuit) (t : Fin c.gates.length) + (s r : Fin (sites c t).length → Fin 2) : Data := + (labels c t,List.ofFn (fun i => (s i).val),List.ofFn (fun i => (r i).val)) + +theorem lookup_actual (c : QMACircuit) (t : Fin c.gates.length) + (s : Fin (sites c t).length → Fin 2) (q : QMACircuitQubit c) : + QuantumSupportLookup.value (siteNumber c (.inr q),labels c t, + List.ofFn (fun i => (s i).val))= + (qmaSupportExtend (qmaPropagationSites c t) + (fun j => s ((supportEquiv c t).symm j)) q).val := by + have hf : Function.Injective (fun q : QMACircuitQubit c => siteNumber c (.inr q)) := by + intro a b h + exact Sum.inr_injective (siteNumber_injective c h) + by_cases hq : q∈qmaPropagationSites c t + · let i := (supportEquiv c t).symm ⟨q,hq⟩ + have hi : (sites c t).get i=q := + congrArg Subtype.val ((supportEquiv c t).apply_symm_apply ⟨q,hq⟩) + have he := QuantumSupportLookup.value_map_get (sites c t) (sites_nodup c t) + (fun q => siteNumber c (.inr q)) hf (fun j => (s j).val) i + have hv : QuantumSupportLookup.value (siteNumber c (.inr q),labels c t, + List.ofFn (fun j => (s j).val))=(s i).val := by + simpa only [hi,labels] using he + exact hv.trans (congrArg Fin.val (show + qmaSupportExtend (qmaPropagationSites c t) + (fun j => s ((supportEquiv c t).symm j)) q=s i from dite_eq_left hq)).symm + · have hn : siteNumber c (.inr q)∉labels c t := by + intro h + obtain ⟨p,hp,he⟩ := List.mem_map.mp h + have hpq := hf he + subst p + exact hq (by rw [← sites_finset]; exact List.mem_toFinset.mpr hp) + have he := QuantumSupportLookup.value_not_mem (labels c t) + (List.ofFn (fun i => (s i).val)) (siteNumber c (.inr q)) hn + (by simp only [List.length_ofFn,labels,List.length_map,le_refl]) + exact he.trans (congrArg Fin.val (show + qmaSupportExtend (qmaPropagationSites c t) + (fun j => s ((supportEquiv c t).symm j)) q=0 from dite_eq_right hq)).symm + +theorem readRow_actual (c : QMACircuit) (t : Fin c.gates.length) + (s r : Fin (sites c t).length → Fin 2) : + readRow c (data c t s r)=qmaSupportExtend (qmaPropagationSites c t) + (fun j => s ((supportEquiv c t).symm j)) := by + funext q + apply Fin.ext + change QuantumSupportLookup.value _ % 2 = _ + dsimp only [data] + rw [lookup_actual] + exact Nat.mod_eq_of_lt (Fin.isLt _) + +theorem readColumn_actual (c : QMACircuit) (t : Fin c.gates.length) + (s r : Fin (sites c t).length → Fin 2) : + readColumn c (data c t s r)=qmaSupportExtend (qmaPropagationSites c t) + (fun j => r ((supportEquiv c t).symm j)) := by + funext q + apply Fin.ext + change QuantumSupportLookup.value _ % 2 = _ + dsimp only [data] + rw [lookup_actual] + exact Nat.mod_eq_of_lt (Fin.isLt _) + +end ContinuumCoulomb.QuantumPropagationSupport + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPropagationTable.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPropagationTable.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd9191015912fa6bc00c0faf76f1ddbb0d20e9a2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumPropagationTable.lean @@ -0,0 +1,89 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPropagationSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryDeltaProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFixedMatrixProgram + +namespace OAI + +/-! Exact fixed-size propagation tables and their adjoint-product. The +largest table has five qubits, independently of the circuit work register. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPropagationTable +open ExactQuantumFactoring.BitStackProgram QuantumAlgebraicScalar QuantumFixedPauli +open QuantumAlgebraicHistory QuantumCircuitCode +open scoped Classical + +abbrev Input := QMACircuit × (ℕ × List ℕ) +def inputCode : Input → List Bool := + prodCode circuitCode (prodCode Nat.bits (listCode Nat.bits)) + +def data (n : ℕ) (s t : Fin n → Fin 2) (x : Input) : QuantumHistoryBitProgram.Data := + (x.2.2,List.ofFn (fun i => (s i).val),List.ofFn (fun i => (t i).val)) + +def table (n : ℕ) (x : Input) : Matrix (Fin n → Fin 2) (Fin n → Fin 2) Scalar := + fun s t => QuantumHistoryDelta.entry x.1 x.2.1 (data n s t x) + +noncomputable opaque entryInputProgram (n : ℕ) (s t : Fin n → Fin 2) : + Procedure inputCode QuantumHistoryDiagonal.inputCode + (fun x => (x.1,(4,x.2.1),data n s t x)) := by + let c := Procedure.first circuitCode (prodCode Nat.bits (listCode Nat.bits)) + let tail := Procedure.second circuitCode (prodCode Nat.bits (listCode Nat.bits)) + let time := (Procedure.first Nat.bits (listCode Nat.bits)).comp tail + let labels := (Procedure.second Nat.bits (listCode Nat.bits)).comp tail + let a := (Procedure.constant inputCode Nat.bits 4).pair time + let rows := Procedure.constant inputCode (listCode Nat.bits) (List.ofFn (fun i => (s i).val)) + let columns := Procedure.constant inputCode (listCode Nat.bits) (List.ofFn (fun i => (t i).val)) + exact c.pair (a.pair (labels.pair (rows.pair columns))) + +noncomputable opaque entryProgram (n : ℕ) (s t : Fin n → Fin 2) : + Procedure inputCode scalarCode (fun x => table n x s t) := + (QuantumHistoryDelta.program.comp (entryInputProgram n s t)).congrFun + (by intro x; rfl) + +noncomputable def tableProgram (n : ℕ) : + Procedure inputCode matrixCode (fun x => matrixData (table n x)) := + QuantumFixedMatrix.dataProgram (β := Fin n → Fin 2) inputCode (table n) + (QuantumPropagationTable.entryProgram n) + +noncomputable def gramProgram (n : ℕ) : Procedure inputCode matrixCode + (fun x => matrixData (matMul (adjoint (table n x)) (table n x))) := + ((QuantumFixedMatrix.gramProgram (Fin n → Fin 2)).comp + (QuantumPropagationTable.tableProgram n)).congrFun + (by intro x; exact QuantumFixedMatrix.gramData_matrixData (table n x)) + +def supportBasisEquiv (c : QMACircuit) (t : Fin c.gates.length) : + (Fin (QuantumPropagationSupport.sites c t).length → Fin 2) ≃ + QMASupportBasis (qmaPropagationSites c t) := + (QuantumPropagationSupport.supportEquiv c t).arrowCongr (Equiv.refl (Fin 2)) + +theorem table_actual (c : QMACircuit) (t : Fin c.gates.length) : + table (QuantumPropagationSupport.sites c t).length + (c,t.val,QuantumPropagationSupport.labels c t)= + reindex (supportBasisEquiv c t) (deltaCore c t) := by + funext s r + change QuantumHistoryDelta.entry c t.val (QuantumPropagationSupport.data c t s r)=_ + rw [QuantumHistoryDelta.entry_actual,QuantumPropagationSupport.readRow_actual, + QuantumPropagationSupport.readColumn_actual] + rfl + +theorem gram_actual (c : QMACircuit) (t : Fin c.gates.length) : + matMul (adjoint (table (QuantumPropagationSupport.sites c t).length + (c,t.val,QuantumPropagationSupport.labels c t))) + (table (QuantumPropagationSupport.sites c t).length + (c,t.val,QuantumPropagationSupport.labels c t))= + reindex (supportBasisEquiv c t) (propagationCore c t) := by + rw [table_actual,gram_reindex] + rfl + +theorem gramData_actual (c : QMACircuit) (t : Fin c.gates.length) : + QuantumFixedMatrix.gramData (β := Fin (QuantumPropagationSupport.sites c t).length → Fin 2) + (matrixData (table (QuantumPropagationSupport.sites c t).length + (c,t.val,QuantumPropagationSupport.labels c t)))= + matrixData (reindex (supportBasisEquiv c t) (propagationCore c t)) := by + rw [QuantumFixedMatrix.gramData_matrixData,gram_actual] + +end ContinuumCoulomb.QuantumPropagationTable + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumQuadratic.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumQuadratic.lean new file mode 100644 index 0000000000000000000000000000000000000000..b03785a3865799d0baa15bc2f8c8d26950be7926 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumQuadratic.lean @@ -0,0 +1,54 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryWitness +import Mathlib.LinearAlgebra.Matrix.ToLin + +namespace OAI + +/-! Finite matrix quadratic forms used by the explicit history Hamiltonian. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +def qmaQuadratic {ι : Type*} [Fintype ι] (M : Matrix ι ι ℂ) (u : ι → ℂ) : ℝ := + (star u ⬝ᵥ M.mulVec u).re + +theorem qmaQuadratic_add {ι : Type*} [Fintype ι] + (M N : Matrix ι ι ℂ) (u : ι → ℂ) : + qmaQuadratic (M+N) u = qmaQuadratic M u+qmaQuadratic N u := by + simp [qmaQuadratic,Matrix.add_mulVec,dotProduct_add] + +theorem qmaQuadratic_smul {ι : Type*} [Fintype ι] + (M : Matrix ι ι ℂ) (a : ℝ) (u : ι → ℂ) : + qmaQuadratic ((a:ℂ) • M) u = a*qmaQuadratic M u := by + simp [qmaQuadratic,Matrix.smul_mulVec,dotProduct_smul,Complex.mul_re] + +theorem qmaQuadratic_gram {ι κ : Type*} [Fintype ι] [Fintype κ] + (D : Matrix κ ι ℂ) (u : ι → ℂ) : + qmaQuadratic (D.conjTranspose*D) u = ∑ r, Complex.normSq (D.mulVec u r) := by + have he : star u ⬝ᵥ (D.conjTranspose*D).mulVec u = + star (D.mulVec u) ⬝ᵥ D.mulVec u := by + rw [Matrix.star_mulVec,←Matrix.dotProduct_mulVec,Matrix.mulVec_mulVec] + rw [qmaQuadratic,he] + simp only [dotProduct,Complex.re_sum,Pi.star_apply] + apply Finset.sum_congr rfl + intro r _ + simp [Complex.mul_re,Complex.normSq_apply] + +theorem qmaQuadratic_diagonal_mask {ι : Type*} [Fintype ι] [DecidableEq ι] + (p : ι → Prop) (u : ι → ℂ) : + qmaQuadratic (Matrix.diagonal (fun i => if p i then (1:ℂ) else 0)) u = + ∑ i, if p i then Complex.normSq (u i) else 0 := by + classical + simp only [qmaQuadratic,dotProduct,Matrix.mulVec_diagonal,Complex.re_sum,Pi.star_apply] + apply Finset.sum_congr rfl + intro i _ + by_cases hi : p i + · simp [hi,Complex.mul_re,Complex.normSq_apply] + · simp [hi] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumQuadraticReindex.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumQuadraticReindex.lean new file mode 100644 index 0000000000000000000000000000000000000000..07a2995a8d31f62dcbfa26b30bffbd4b563bff64 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumQuadraticReindex.lean @@ -0,0 +1,31 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryEnumeration + +namespace OAI + +/-! Exact transport of finite quadratic forms and masses under a basis equivalence. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +theorem qmaQuadratic_reindex_equiv {α β : Type*} [Fintype α] [Fintype β] + (e : α ≃ β) (M : Matrix β β ℂ) (u : α → ℂ) : + qmaQuadratic (M.submatrix e e) u = qmaQuadratic M (u ∘ e.symm) := by + have hm := Matrix.submatrix_mulVec_equiv M u e e + unfold qmaQuadratic + rw [hm] + have he := e.sum_comp (fun j => star (u (e.symm j))*M.mulVec (u ∘ e.symm) j) + simp only [Equiv.symm_apply_apply] at he + exact congrArg Complex.re he + +theorem qmaMass_reindex {α β : Type*} [Fintype α] [Fintype β] + (e : α ≃ β) (u : α → ℂ) : + (∑ i, Complex.normSq (u (e.symm i))) = ∑ i, Complex.normSq (u i) := + e.symm.sum_comp (fun i => Complex.normSq (u i)) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRationalCrossing.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRationalCrossing.lean new file mode 100644 index 0000000000000000000000000000000000000000..4c048c3560d2ee668323bd80804848d2fdcd489e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRationalCrossing.lean @@ -0,0 +1,121 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRationalPathStep +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingProgram + +namespace OAI + +/-! A simultaneous crossing-removal layer as exact rational ordinary-spin data. -/ + +noncomputable section +namespace ContinuumCoulomb +open MediatorGraph Matrix +open scoped BigOperators Classical + +structure QMARationalCrossingLayer (r : ℕ) where + base : QMARationalExchangeGraph + site : Fin r → Fin 4 → Fin base.n + injective : ∀ i, Function.Injective (site i) + J : Fin r → ℚ + K : Fin r → ℚ + +namespace QMARationalCrossingLayer +variable {r : ℕ} + +def source (C : QMARationalCrossingLayer r) : QMARationalExchangeGraph where + n := C.base.n + Edge := C.base.Edge ⊕ (Fin r × Fin 2) + left := Sum.elim C.base.left (fun p => C.site p.1 (if p.2 = 0 then 0 else 1)) + right := Sum.elim C.base.right (fun p => C.site p.1 (if p.2 = 0 then 2 else 3)) + distinct := by + intro e + rcases e with e | ⟨i,a⟩ + · exact C.base.distinct e + · intro h + have h' := C.injective i h + fin_cases a <;> norm_num at h' + weight := Sum.elim C.base.weight (fun p => if p.2 = 0 then C.J p.1 else C.K p.1) + constant := C.base.constant + +theorem source_matrix (C : QMARationalCrossingLayer r) : + qmaExchangeMatrix C.source.left C.source.right (fun e => (C.source.weight e:ℝ)) C.source.constant = + qmaExchangeMatrix C.base.left C.base.right (fun e => (C.base.weight e:ℝ)) C.base.constant + + ∑ i, ((C.J i:ℂ) • sourceHeisenbergMatrix C.base.n (C.site i 0) (C.site i 2) + + (C.K i:ℂ) • sourceHeisenbergMatrix C.base.n (C.site i 1) (C.site i 3)) := by + let f : C.source.Edge → Matrix (SourceSpinBasis C.base.n) (SourceSpinBasis C.base.n) ℂ := + fun e => (C.source.weight e:ℂ) • sourceHeisenbergMatrix C.base.n (C.source.left e) (C.source.right e) + let g : C.base.Edge ⊕ (Fin r × Fin 2) → + Matrix (SourceSpinBasis C.base.n) (SourceSpinBasis C.base.n) ℂ := fun e => + ((Sum.elim C.base.weight (fun p => if p.2 = 0 then C.J p.1 else C.K p.1)) e:ℂ) • + sourceHeisenbergMatrix C.base.n + ((Sum.elim C.base.left (fun p => C.site p.1 (if p.2 = 0 then 0 else 1))) e) + ((Sum.elim C.base.right (fun p => C.site p.1 (if p.2 = 0 then 2 else 3))) e) + let E : C.source.Edge ≃ C.base.Edge ⊕ (Fin r × Fin 2) := Equiv.refl _ + have hs : (∑ e, f e) = ∑ e, g e := Fintype.sum_equiv E f g (by intro e; rfl) + simp only [qmaExchangeMatrix] + change (∑ e, f e)+(C.base.constant:ℂ) • 1 = _ + rw [hs] + simp only [g,Fintype.sum_sum_type,Fintype.sum_prod_type,Sum.elim_inl,Sum.elim_inr,Fin.sum_univ_two] + simp + ac_rfl + +def scale (C : QMARationalCrossingLayer r) (N : ℚ) : ℚ := + let B := 3*(∑ e, |C.base.weight e|)+|C.base.constant| + let A := 6*∑ i, (1+|C.J i|+|C.K i|) + let D := B+12*∑ i, (1+|C.J i|+|C.K i|)^2 + 16*(A+D+1)^3*N+4*(A+D+1)+1 + +theorem scale_cast (C : QMARationalCrossingLayer r) (N : ℚ) : + (C.scale N:ℝ) = + qmaRoutingScale (6*∑ i, (1+|(C.J i:ℝ)|+|(C.K i:ℝ)|)) + (3*(∑ e, |(C.base.weight e:ℝ)|)+|(C.base.constant:ℝ)|+ + 12*∑ i, (1+|(C.J i:ℝ)|+|(C.K i:ℝ)|)^2) N := by + simp only [scale,qmaRoutingScale] + push_cast + rfl + +def output (C : QMARationalCrossingLayer r) (N : ℚ) : QMARationalExchangeGraph where + n := C.base.n+r*2 + Edge := QMACrossingsGraphEdge C.base.Edge r + left := qmaParallelGraphLeft (qmaCrossingsBaseLeft C.base.left C.site) C.site + right := qmaParallelGraphRight (qmaCrossingsBaseRight C.base.right C.site) (fun _ => qmaCrossingMember) + distinct := qmaParallelGraph_distinct _ _ + (qmaCrossingsBase_distinct _ _ C.base.distinct C.site C.injective) _ _ + weight := fun e => match e with + | .inl (.inl e) => C.base.weight e + | .inl (.inr (i,a)) => QuantumRoutingCode.coefficients (C.scale N,C.J i,C.K i) ⟨a.val+5,by omega⟩ + | .inr (.inl _) => (C.scale N)^2 + | .inr (.inr (i,a)) => QuantumRoutingCode.coefficients (C.scale N,C.J i,C.K i) ⟨a.val+1,by omega⟩ + constant := (C.base.constant+∑ i, (3/2+3*(C.J i)^2+3*(C.K i)^2))+3*(r:ℚ)*(C.scale N)^2 + +theorem output_matrix (C : QMARationalCrossingLayer r) (N : ℚ) : + qmaExchangeMatrix (C.output N).left (C.output N).right (fun e => ((C.output N).weight e:ℝ)) + (C.output N).constant = + qmaCrossingsGraph C.base.left C.base.right (fun e => (C.base.weight e:ℝ)) C.base.constant + (C.scale N) C.site (fun i => (C.J i:ℝ)) (fun i => (C.K i:ℝ)) := by + dsimp only [output,qmaCrossingsGraph] + congr 1 + · funext e + rcases e with (e | ⟨i,a⟩) | (i | ⟨i,a⟩) + · rfl + · exact QuantumRoutingCode.coefficients_perimeter (C.scale N,C.J i,C.K i) a + · simp [qmaParallelGraphWeight] + · exact QuantumRoutingCode.coefficients_spoke (C.scale N,C.J i,C.K i) a + · simp [qmaCrossingOffset] + +theorem output_energy_error (C : QMARationalCrossingLayer r) {N : ℚ} (hN : 0 < N) : + |(C.output N).energy-C.source.energy| ≤ 1/(N:ℝ) := by + unfold QMARationalExchangeGraph.energy + rw [C.output_matrix,C.source_matrix,C.scale_cast] + exact qmaCrossingsGraph_accuracy C.base.left C.base.right C.base.distinct + (fun e => (C.base.weight e:ℝ)) C.base.constant C.site C.injective + (fun i => (C.J i:ℝ)) (fun i => (C.K i:ℝ)) (by exact_mod_cast hN) + +theorem output_edge_count (C : QMARationalCrossingLayer r) (N : ℚ) : + Fintype.card (C.output N).Edge = Fintype.card C.base.Edge+9*r := + qmaCrossingsGraphEdge_card C.base.Edge r + +end QMARationalCrossingLayer +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRationalDegreeReduction.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRationalDegreeReduction.lean new file mode 100644 index 0000000000000000000000000000000000000000..87f0ceea3212bc7ee515c393f5a0dd278e986385 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRationalDegreeReduction.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRationalFork +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumDegreeReduction + +namespace OAI + +/-! The full degree-three reduction has exact rational output coefficients. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators Classical + +def qmaRationalSubdivision {n m : ℕ} (left right : Fin m → Fin n) + (J : Fin m → ℚ) (constant R : ℚ) : QMARationalForkNetwork n where + graph := qmaSubdivisionNetwork left right + weight := fun _ => R^2 + active := fun p => ![R,2*R*J (qmaOriginalPortEquiv left right p).1] + (qmaOriginalPortEquiv left right p).2 + constant := (constant+∑ e, (3/4+3*(J e)^2))+3*(m:ℚ)*R^2 + +theorem qmaRationalSubdivision_real {n m : ℕ} (left right : Fin m → Fin n) + (J : Fin m → ℚ) (constant R : ℚ) : + (qmaRationalSubdivision left right J constant R).real = + qmaSubdivisionWeighted left right (fun e => (J e:ℝ)) constant R := by + unfold qmaRationalSubdivision QMARationalForkNetwork.real qmaSubdivisionWeighted + congr 1 + · funext e + push_cast + rfl + · funext p + generalize h : (qmaOriginalPortEquiv left right p).2 = b + fin_cases b <;> simp_all [qmaPathAmplitude] + · simp [qmaPathOffset] + +def qmaRationalInitialScale {m : ℕ} (J : Fin m → ℚ) (constant N : ℚ) : ℚ := + let A := 3*∑ e, (1+2*|J e|) + let B := |constant|+4*∑ e, (1+|J e|)^2 + 16*(A+B+1)^3*N+4*(A+B+1)+1 + +theorem qmaRationalInitialScale_cast {m : ℕ} (J : Fin m → ℚ) (constant N : ℚ) : + (qmaRationalInitialScale J constant N:ℝ) = + qmaRoutingScale (3*∑ e, (1+2*|(J e:ℝ)|)) + (|(constant:ℝ)|+4*∑ e, (1+|(J e:ℝ)|)^2) N := by + simp [qmaRationalInitialScale,qmaRoutingScale] + +def qmaRationalDegreeReduction {n m : ℕ} (left right : Fin m → Fin n) + (J : Fin m → ℚ) (constant N : ℚ) (D : ℕ) : QMARationalForkNetwork n := + (qmaRationalSubdivision left right J constant (qmaRationalInitialScale J constant N)).iterate N D + +theorem qmaRationalDegreeReduction_real {n m : ℕ} (left right : Fin m → Fin n) + (J : Fin m → ℚ) (constant N : ℚ) (D : ℕ) : + (qmaRationalDegreeReduction left right J constant N D).real = + qmaDegreeReduction left right (fun e => (J e:ℝ)) constant N D := by + unfold qmaRationalDegreeReduction qmaDegreeReduction + rw [QMARationalForkNetwork.iterate_real,qmaRationalSubdivision_real,qmaRationalInitialScale_cast] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRationalFork.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRationalFork.lean new file mode 100644 index 0000000000000000000000000000000000000000..7004a1db2f3602adeea2e04412c1850b1848bc16 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRationalFork.lean @@ -0,0 +1,95 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkIteration + +namespace OAI + +/-! Exact rational coefficients for every stage of the global fork reduction. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators Classical + +structure QMARationalForkNetwork (c : ℕ) where + graph : QMAForkNetwork c + weight : graph.Edge → ℚ + active : (Σ i, Fin (graph.degree i)) → ℚ + constant : ℚ + +namespace QMARationalForkNetwork +variable {c : ℕ} + +def real (G : QMARationalForkNetwork c) : QMAWeightedForkNetwork c where + graph := G.graph + weight := fun e => G.weight e + active := fun p => G.active p + constant := G.constant + +def pairWeight (G : QMARationalForkNetwork c) (b : Fin 2) (e : Fin G.graph.state.ports.pairCount) : ℚ := + G.active (qmaForkPairedPort G.graph.degree (G.graph.state.ports.pairEquiv.symm e,b)) + +def retainedWeight (G : QMARationalForkNetwork c) : + G.graph.Edge ⊕ QMAForkRemainder G.graph.degree → ℚ := + Sum.elim G.weight (fun p => G.active (qmaForkRemainingPort G.graph.degree p)) + +def scale (G : QMARationalForkNetwork c) (N : ℚ) : ℚ := + let B := 3*(∑ a, |G.retainedWeight a|)+|G.constant| + let A := 3*∑ e, (1+2*|G.pairWeight 0 e|+2*|G.pairWeight 1 e|) + let D := B+12*∑ e, (1+|G.pairWeight 0 e|+|G.pairWeight 1 e|)^2 + 16*(A+D+1)^3*N+4*(A+D+1)+1 + +theorem scale_cast (G : QMARationalForkNetwork c) (N : ℚ) : + (G.scale N : ℝ) = G.real.scale N := by + dsimp only [real] + simp only [scale,QMAWeightedForkNetwork.scale,retainedWeight,pairWeight, + QMAForkState.retainedWeight,QMAForkState.pairWeight,Fintype.sum_sum_type, + Sum.elim_inl,Sum.elim_inr,qmaRoutingScale] + push_cast + rfl + +def next (G : QMARationalForkNetwork c) (N : ℚ) : QMARationalForkNetwork c where + graph := G.graph.next + weight := fun e => match e with + | .inl (.inl a) => G.weight a + | .inl (.inr a) => 2*G.pairWeight 0 a*G.pairWeight 1 a + | .inr (.inl _) => (G.scale N)^2 + | .inr (.inr (a,b)) => 2*G.scale N*G.pairWeight b a + active := fun p => match G.graph.state.ports.nextPortEquiv p with + | .inl _ => G.scale N + | .inr p => G.active (qmaForkRemainingPort G.graph.degree p) + constant := (G.constant+∑ e, (3/4+3*(G.pairWeight 0 e)^2+3*(G.pairWeight 1 e)^2))+ + 3*(G.graph.state.ports.pairCount:ℚ)*(G.scale N)^2 + +theorem next_real (G : QMARationalForkNetwork c) (N : ℚ) : + (G.next N).real = G.real.next N := by + dsimp only [next,real,QMAWeightedForkNetwork.next] + congr 1 + · funext e + rcases e with (e | e) | (e | ⟨e,b⟩) <;> + simp [QMAForkState.nextWeight,pairWeight,QMAForkState.pairWeight,scale_cast,real] + · funext p + dsimp only [QMAForkState.nextActive] + split <;> simp_all only [scale_cast,real] + · simp [QMAForkState.nextConstant,qmaForkOffset,pairWeight,QMAForkState.pairWeight,scale_cast,real] + +def iterate (G : QMARationalForkNetwork c) (N : ℚ) : ℕ → QMARationalForkNetwork c + | 0 => G + | k+1 => (G.iterate N k).next N + +theorem iterate_real (G : QMARationalForkNetwork c) (N : ℚ) (k : ℕ) : + (G.iterate N k).real = G.real.iterate N k := by + induction k with + | zero => rfl + | succ k ih => + rw [iterate,next_real,ih] + rfl + +theorem iterate_energy_error (G : QMARationalForkNetwork c) {N : ℚ} (hN : 0 < N) (k : ℕ) : + |(G.iterate N k).real.energy-G.real.energy| ≤ (k:ℝ)/(N:ℝ) := by + rw [G.iterate_real] + exact G.real.iterate_energy_error (by exact_mod_cast hN) k + +end QMARationalForkNetwork +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRationalPathStep.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRationalPathStep.lean new file mode 100644 index 0000000000000000000000000000000000000000..d99563bf0350df0db79b8a289c8cc0443107bdf3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRationalPathStep.lean @@ -0,0 +1,91 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPartialPaths +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathProgram + +namespace OAI + +/-! Exact rational graph data for a selected path-subdivision layer. -/ + +noncomputable section +namespace ContinuumCoulomb +open MediatorGraph +open scoped BigOperators Classical + +structure QMARationalExchangeGraph where + n : ℕ + Edge : Type + [edgeFinite : Fintype Edge] + left : Edge → Fin n + right : Edge → Fin n + distinct : ∀ e, left e ≠ right e + weight : Edge → ℚ + constant : ℚ + +attribute [instance] QMARationalExchangeGraph.edgeFinite + +namespace QMARationalExchangeGraph + +def energy (G : QMARationalExchangeGraph) : ℝ := + sourceMatrixBottom G.n (qmaExchangeMatrix G.left G.right (fun e => G.weight e) G.constant) + +def pathScale (G : QMARationalExchangeGraph) (s : Finset G.Edge) (N : ℚ) : ℚ := + let B := 3*(∑ e : {e // e ∉ s}, |G.weight e.val|)+|G.constant| + let A := 3*∑ i : Fin s.card, (1+2*|G.weight (qmaSelectedIndex s i)|) + let D := B+4*∑ i : Fin s.card, (1+|G.weight (qmaSelectedIndex s i)|)^2 + 16*(A+D+1)^3*N+4*(A+D+1)+1 + +theorem pathScale_cast (G : QMARationalExchangeGraph) (s : Finset G.Edge) (N : ℚ) : + (G.pathScale s N : ℝ) = qmaPartialPathsScale (fun e => (G.weight e:ℝ)) G.constant s N := by + simp only [pathScale,qmaPartialPathsScale,qmaRoutingScale] + push_cast + rfl + +def subdivide (G : QMARationalExchangeGraph) (s : Finset G.Edge) + (even : Fin s.card → Bool) (N : ℚ) : QMARationalExchangeGraph where + n := G.n+s.card*2 + Edge := QMAPartialPathsEdge s + left := qmaPartialPathsLeft G.left G.right s + right := qmaPartialPathsRight G.right s even + distinct := qmaPartialPaths_distinct G.left G.right G.distinct s even + weight := fun e => match e with + | .inl e => G.weight e.val + | .inr (.inl _) => (G.pathScale s N)^2 + | .inr (.inr (i,a)) => QuantumPathCode.coefficients + (even i,G.pathScale s N,G.weight (qmaSelectedIndex s i)) ⟨a.val+1,by omega⟩ + constant := (G.constant+∑ i : Fin s.card, (3/4+3*(G.weight (qmaSelectedIndex s i))^2))+ + 3*(s.card:ℚ)*(G.pathScale s N)^2 + +theorem subdivide_matrix (G : QMARationalExchangeGraph) (s : Finset G.Edge) + (even : Fin s.card → Bool) (N : ℚ) : + qmaExchangeMatrix (G.subdivide s even N).left (G.subdivide s even N).right + (fun e => ((G.subdivide s even N).weight e:ℝ)) (G.subdivide s even N).constant = + qmaPartialPaths G.left G.right (fun e => (G.weight e:ℝ)) G.constant N s even := by + dsimp only [subdivide,qmaPartialPaths,qmaPathsGraph] + congr 1 + · funext e + rcases e with e | e + · rfl + rcases e with i | ⟨i,a⟩ + · simp [qmaParallelGraphWeight,pathScale_cast] + · simpa only [qmaParallelGraphWeight,pathScale_cast] using + QuantumPathCode.coefficients_spoke (even i,G.pathScale s N,G.weight (qmaSelectedIndex s i)) a + · simp [qmaPathOffset,pathScale_cast] + +theorem subdivide_energy_error (G : QMARationalExchangeGraph) (s : Finset G.Edge) + (even : Fin s.card → Bool) {N : ℚ} (hN : 0 < N) : + |(G.subdivide s even N).energy-G.energy| ≤ 1/(N:ℝ) := by + unfold energy + rw [G.subdivide_matrix] + exact qmaPartialPaths_accuracy G.left G.right G.distinct (fun e => (G.weight e:ℝ)) + G.constant s even (by exact_mod_cast hN) + +theorem subdivide_edge_count (G : QMARationalExchangeGraph) (s : Finset G.Edge) + (even : Fin s.card → Bool) (N : ℚ) : + Fintype.card (G.subdivide s even N).Edge = Fintype.card G.Edge+2*s.card := + qmaPartialPaths_edge_count s + +end QMARationalExchangeGraph +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRationalSpatialPackage.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRationalSpatialPackage.lean new file mode 100644 index 0000000000000000000000000000000000000000..af0e81061425f844c34e3cb4f2182a822bcc6f81 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRationalSpatialPackage.lean @@ -0,0 +1,84 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRationalFork +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialPlaced +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumAnchorDensity + +namespace OAI + +/-! Package the rational degree-three graph with its proved coarse-grid placement. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators Classical + +def qmaDegreeThreeSpatialModel {ν : Type} [Fintype ν] {n rows width A : ℕ} + (left right : ν → Fin n) (distinct : ∀ e, left e ≠ right e) + (weight : ν → ℚ) (constant : ℚ) + (cell : Fin n → QMAGridCell rows width) (anchor : ν → QMAGridCell rows width) + (hc : ∀ p, (Finset.univ.filter (fun v => cell v = p)).card ≤ A) + (hd : ∀ v, qmaGraphDegree left right v ≤ 3) + (hl : ∀ e, QMAGridCellsNear (cell (left e)) (anchor e) ∧ + QMAGridCellsNear (cell (right e)) (anchor e)) : QMASpatialExchangeModel A (27*A) where + n := n + Term := ν + left := left + right := right + distinct := distinct + weight := weight + constant := constant + rows := rows + width := width + cell := cell + anchor := anchor + geometry := hl + qubitDensity := hc + termDensity := by + intro p + have h := qmaAnchor_density left right cell anchor (fun e => (hl e).1) hc hd p + simpa only [show 9*A*3 = 27*A by omega] using h + +theorem qmaRationalSpatialPackage {c rows width A : ℕ} (G : QMARationalForkNetwork c) + (cell : Fin G.graph.n → QMAGridCell rows width) + (hc : ∀ p, qmaCellMass cell p ≤ A) + (hd : ∀ v, qmaGraphDegree G.graph.state.fullLeft G.graph.state.fullRight v ≤ 3) + (hl : ∀ e, ∃ a : QMAGridCell rows width, + QMAGridCellsNear (cell (G.graph.state.fullLeft e)) a ∧ + QMAGridCellsNear (cell (G.graph.state.fullRight e)) a) : + ∃ M : QMASpatialExchangeModel A (27*A), + M.rows = rows ∧ M.width = width ∧ M.n = G.graph.n ∧ M.energy = G.real.energy ∧ + ∀ v, qmaGraphDegree M.left M.right v ≤ 3 := by + let anchor := fun e => Classical.choose (hl e) + have hg (e) := Classical.choose_spec (hl e) + have hc' : ∀ p, (Finset.univ.filter (fun v => cell v = p)).card ≤ A := by + intro p + simpa [qmaCellMass] using hc p + let M := qmaDegreeThreeSpatialModel G.graph.state.fullLeft G.graph.state.fullRight + G.graph.state.full_distinct (Sum.elim G.weight G.active) G.constant cell anchor hc' hd hg + refine ⟨M,rfl,rfl,rfl,?_,hd⟩ + change MediatorGraph.normalizedBottom + (qmaExchangeMatrix G.graph.state.fullLeft G.graph.state.fullRight + (fun e => ((Sum.elim G.weight G.active e : ℚ):ℝ)) (G.constant:ℝ)) = _ + congr 2 + funext e + cases e <;> rfl + +theorem qmaRationalPlacedPackage {c rows width A : ℕ} (G : QMARationalForkNetwork c) + (P : QMAPlacedForkNetwork (QMAGridCell rows width) c) (heq : G.graph = P.graph) + (hc : ∀ p, qmaCellMass P.cell p ≤ A) + (hd : ∀ v, qmaGraphDegree P.graph.state.fullLeft P.graph.state.fullRight v ≤ 3) + (hl : ∀ e, ∃ a : QMAGridCell rows width, + QMAGridCellsNear (P.cell (P.graph.state.fullLeft e)) a ∧ + QMAGridCellsNear (P.cell (P.graph.state.fullRight e)) a) : + ∃ M : QMASpatialExchangeModel A (27*A), + M.rows = rows ∧ M.width = width ∧ M.n = G.graph.n ∧ M.energy = G.real.energy ∧ + ∀ v, qmaGraphDegree M.left M.right v ≤ 3 := by + rcases G with ⟨gg,w,J,t⟩ + rcases P with ⟨pg,cell,aligned⟩ + dsimp only at heq hc hd hl ⊢ + subst pg + exact qmaRationalSpatialPackage ⟨gg,w,J,t⟩ cell hc hd hl + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawCellDensity.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawCellDensity.lean new file mode 100644 index 0000000000000000000000000000000000000000..7f9f6d72d0b0af198d60bba75a376aa1ab21b4ed --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawCellDensity.lean @@ -0,0 +1,43 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawCellLocality +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourSpatial + +namespace OAI + +/-! The literal four-spin vertex numbers have exactly four copies of each +logical cell. This connects the emitted numeric list to bounded cell density. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumRawCellLocality +open QuantumForkList +open scoped Classical + +def extendCell {n rows width : ℕ} (cell : Fin n → QMAGridCell rows width) + (v : ℕ) : QMAGridCell rows width := + if h : v cell i=p)).card ≤ A) + (p : QMAGridCell rows width) : + qmaCellMass (fun i : Fin (n*4) => blockCell (extendCell cell) i.val) p ≤ 4*A := by + have he : (fun i : Fin (n*4) => blockCell (extendCell cell) i.val)=qmaFourBlockCell cell := + funext (blockCell_fin cell) + rw [he] + simpa only [qmaCellMass,Finset.card_filter] using qmaFourBlockCell_density cell hc p + +end ContinuumCoulomb.QuantumRawCellLocality + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawCellLocality.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawCellLocality.lean new file mode 100644 index 0000000000000000000000000000000000000000..608c24626f2ef0b228b8e0714a7e434a98d326bf --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawCellLocality.lean @@ -0,0 +1,65 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawIncidence +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListSpatialPackage + +namespace OAI + +/-! The actual four-spin output list has a common neighboring coarse cell +for both endpoints of every bond, including all zero-weight terms. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumRawCellLocality +open QuantumRawExchange QuantumRawIncidence QuantumForkList MediatorListProgram +open scoped Classical + +def blockCell {rows width : ℕ} (cell : ℕ → QMAGridCell rows width) (v : ℕ) := cell (v/4) + +theorem penalty_local {rows width : ℕ} (n : ℕ) (r : ℚ) + (cell : ℕ → QMAGridCell rows width) : + BondLocal (penalty n r) (blockCell cell) CommonCell := by + intro b hb + obtain ⟨bs,hbs,hb⟩ := List.mem_flatten.mp hb + obtain ⟨i,_,rfl⟩ := List.mem_map.mp hbs + obtain ⟨e,rfl⟩ := List.mem_ofFn.mp hb + change CommonCell (cell ((4*i+(qmaFourEdgeLeft e).val)/4)) + (cell ((4*i+(qmaFourEdgeRight e).val)/4)) + rw [slot_div,slot_div] + exact commonCell_refl _ + +theorem term_local {n rows width : ℕ} (k : ℕ) (r : ℚ) (xs : List (Fin n)) + (w : Fin n → Fin 4) (J : ℚ) (cell : ℕ → QMAGridCell rows width) + (anchor : QMAGridCell rows width) + (hx : ∀ i ∈ xs, QMAGridCellsNear (cell i.val) anchor) : + BondLocal (bonds ((k,r),pack (QuantumOrderedXZTerm.ofSites xs w) J)) + (blockCell cell) CommonCell := by + intro b hb + obtain ⟨i,hi,he⟩ := packed_origin k r _ J b hb b.1 (Or.inl rfl) + obtain ⟨j,hj,hf⟩ := packed_origin k r _ J b hb b.2.1 (Or.inr rfl) + refine ⟨anchor,?_,?_⟩ + · have h := hx i (ofSites_subset xs w i hi) + simpa only [blockCell,he] using h + · have h := hx j (ofSites_subset xs w j hj) + simpa only [blockCell,hf] using h + +theorem output_local {n m rows width : ℕ} (N : ℕ) + (xs : Fin m → List (Fin n)) (w : Fin m → Fin n → Fin 4) (J : Fin m → ℚ) + (cell : ℕ → QMAGridCell rows width) (anchor : Fin m → QMAGridCell rows width) + (hx : ∀ e i, i ∈ xs e → QMAGridCellsNear (cell i.val) (anchor e)) : + BondLocal (QuantumOrderedRawBlock.output N xs w J).1 (blockCell cell) CommonCell := by + let env : Environment := + (bits (n,N,packed (QuantumOrderedRawBlock.terms xs w) J), + scale N (packed (QuantumOrderedRawBlock.terms xs w) J)) + change BondLocal (penalty n env.2 ++ termBondsList + (env,packed (QuantumOrderedRawBlock.terms xs w) J)) (blockCell cell) CommonCell + intro b hb + rcases List.mem_append.mp hb with hp | ht + · exact penalty_local n env.2 cell b hp + · obtain ⟨bs,hbs,hb⟩ := List.mem_flatten.mp ht + obtain ⟨raw,hraw,rfl⟩ := List.mem_map.mp hbs + obtain ⟨e,rfl⟩ := List.mem_ofFn.mp hraw + exact term_local env.1 env.2 (xs e) (w e) (J e) cell (anchor e) (hx e) b hb + +end ContinuumCoulomb.QuantumRawCellLocality + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawCoefficientBounds.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawCoefficientBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..a184d35ca33fd5a60a340a3cd7fbf2744551c81a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawCoefficientBounds.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawCompiler + +namespace OAI + +/-! Uniform bounds for the actual rational four-spin coefficients. The +sampling precision does not enter these bounds. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumAxisSample + +theorem fieldValue_abs (k : ℕ) (a : Fin 2) (t : ℚ) (e : Fin 3) : + |(fieldValue k a t e:ℝ)| ≤ 65*|(t:ℝ)| := by + have h := (abs_sub_abs_le_abs_sub (fieldValue k a t e:ℝ) + (qmaFieldEdgeWeight a (t:ℝ) e)).trans (fieldValue_error k a t e) + have hw := qmaFieldEdgeWeight_bound a (t:ℝ) e + have hp : (2:ℝ)⁻¹^k ≤ 1 := pow_le_one₀ (by norm_num) (by norm_num) + have hm := mul_le_mul_of_nonneg_left hp (by positivity : 0 ≤ 64*|(t:ℝ)|) + linarith + +theorem crossValue_abs (k : ℕ) (r : ℚ) (a b : Fin 2) (t : ℚ) (p q : Fin 4) : + |(crossValue k r a b t p q:ℝ)| ≤ 3920*|(r:ℝ)| *(1+|(t:ℝ)|) := by + have hs : |(stencil a true p:ℝ)| * |(stencil b (decide (t≤0)) q:ℝ)| ≤ 784 := by + rw [stencil_cast,stencil_cast] + exact (mul_le_mul (qmaFourAxisWeights_pointwise a true p) + (qmaFourAxisWeights_pointwise b _ q) (abs_nonneg _) (by norm_num)).trans_eq (by norm_num) + simp only [crossValue,Rat.cast_mul,abs_mul] + calc + _ ≤ (|(r:ℝ)| *(5*(1+|(t:ℝ)|)))*784 := + mul_le_mul (mul_le_mul_of_nonneg_left (calibrated_bound a b k t) (abs_nonneg _)) hs + (by positivity) (by positivity) + _ = _ := by ring + +theorem shiftValue_abs (a : Fin 2) (t : ℚ) : |(shiftValue a t:ℝ)| ≤ |(t:ℝ)| := by + by_cases h : a=0 + · simp [shiftValue,h] + · simp only [shiftValue,h,ite_false,Rat.cast_div,Rat.cast_ofNat,abs_div] + norm_num + +theorem offset_abs (k : ℕ) (a b : Fin 2) (t : ℚ) : + |(offset k a b t:ℝ)| ≤ 685600*|(t:ℝ)| := by + have h := (abs_sub_abs_le_abs_sub (offset k a b t:ℝ) + (qmaFourEnergyOffset a b (t:ℝ))).trans (offset_error k a b t) + have hw := qmaFourEnergyOffset_bound a b (t:ℝ) + have hp : (2:ℝ)⁻¹^k ≤ 1 := pow_le_one₀ (by norm_num) (by norm_num) + have hm := mul_le_mul_of_nonneg_left hp (by positivity : 0 ≤ 320800*|(t:ℝ)|) + linarith + +end ContinuumCoulomb.QuantumAxisSample + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawCompiler.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawCompiler.lean new file mode 100644 index 0000000000000000000000000000000000000000..391162a73bb1f391ae77a562ce3f1177ecc3c90a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawCompiler.lean @@ -0,0 +1,85 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawSchedule +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawFamilyCorrectness + +namespace OAI + +/-! Polynomial raw four-spin compiler with its full-space spectral guarantee. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumRawExchange +open QuantumAxisSample MediatorListProgram +open Matrix +open scoped BigOperators Classical + +theorem pack_weight {n : ℕ} (t : QMAXZTerm n) (J : ℚ) : (pack t J).2.2.2 = J := by + cases t <;> rfl + +theorem mass_packed {n m : ℕ} (t : Fin m → QMAXZTerm n) (J : Fin m → ℚ) : + mass (packed t J) = ∑ e, |J e| := by + simp only [mass,packed,List.map_ofFn,List.sum_ofFn,Function.comp_apply,pack_weight] + +theorem size_packed {n m : ℕ} (t : Fin m → QMAXZTerm n) (J : Fin m → ℚ) : + size (packed t J) = rationalInputSize J := by + simp only [size,packed,List.length_ofFn] + rw [← packed,mass_packed] + simp only [rationalInputSize,Fintype.card_fin] + +theorem budget_packed {n m : ℕ} (t : Fin m → QMAXZTerm n) (J : Fin m → ℚ) : + budget (packed t J) = rationalBudget J := by + simp only [budget,size_packed,rationalBudget] + +theorem scale_packed {n m : ℕ} (N : ℕ) (t : Fin m → QMAXZTerm n) (J : Fin m → ℚ) : + scale N (packed t J) = rationalPenalty N J := by + simp only [scale,budget_packed,rationalPenalty] + +theorem bits_packed {n m : ℕ} (N : ℕ) (t : Fin m → QMAXZTerm n) (J : Fin m → ℚ) : + bits (n,N,packed t J) = boundedPrecision N t J := by + change QuantumAxisSample.precision + (universalErrorBudget n (packed t J).length (scale N (packed t J)) (mass (packed t J))) N = _ + rw [scale_packed,mass_packed] + simp only [packed,List.length_ofFn,boundedPrecision,Fintype.card_fin] + +def rawBondMatrix (n : ℕ) (b : Bond) : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ := + if hi : b.1 < n then if hj : b.2.1 < n then + (b.2.2:ℂ) • sourceHeisenbergMatrix n ⟨b.1,hi⟩ ⟨b.2.1,hj⟩ else 0 else 0 + +def rawMatrix (n : ℕ) (out : List Bond × ℚ) : + Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ := + (out.1.map (rawBondMatrix n)).sum+out.2 • 1 + +theorem rawBondMatrix_erase {n : ℕ} (b : TypedBond n) : + rawBondMatrix n (erase b) = typedBondMatrix b := by + simp only [rawBondMatrix,erase,b.1.isLt,b.2.1.isLt,↓reduceDIte,typedBondMatrix] + +theorem fullMatrix_packed {n m : ℕ} (k : ℕ) (r : ℚ) (t : Fin m → QMAXZTerm n) (J : Fin m → ℚ) : + rawMatrix (n*4) (fullBonds (n,(k,r),packed t J),fullScalar (n,(k,r),packed t J)) = + matrixValue k r t J := by + rw [rawMatrix,fullBonds_packed,fullScalar_packed,List.map_map] + simp only [Function.comp_def,rawBondMatrix_erase] + rw [← family_matrix] + rw [termScalar_sum] + +theorem compile_matrix {n m : ℕ} (N : ℕ) (t : Fin m → QMAXZTerm n) (J : Fin m → ℚ) : + rawMatrix (n*4) (compile (n,N,packed t J)) = boundedMatrix N t J := by + unfold compile scheduled + rw [bits_packed,scale_packed,fullMatrix_packed] + rfl + +theorem compile_accuracy {n m : ℕ} (N : ℕ) (hN : 0 < N) (t : Fin m → QMAXZTerm n) (J : Fin m → ℚ) + (hprivate : ∀ e f, (qmaPauliSupport (t e).word).card = 2 → + qmaPauliSupport (t e).word = qmaPauliSupport (t f).word → e = f) : + |MediatorGraph.normalizedBottom (rawMatrix (n*4) (compile (n,N,packed t J)))- + MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • (t e).matrix)| ≤ 2/(N:ℝ) := by + rw [compile_matrix] + exact boundedMatrix_accuracy N hN t J hprivate + +theorem compile_valid {n m : ℕ} (N : ℕ) (t : Fin m → QMAXZTerm n) (J : Fin m → ℚ) + (b : Bond) (hb : b ∈ (compile (n,N,packed t J)).1) : + b.1 < n*4 ∧ b.2.1 < n*4 ∧ b.1 ≠ b.2.1 := + fullBonds_valid (bits (n,N,packed t J)) (scale N (packed t J)) t J b hb + +end ContinuumCoulomb.QuantumRawExchange + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawCorrectness.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawCorrectness.lean new file mode 100644 index 0000000000000000000000000000000000000000..33544127da598a53fe0d6f43646713c1f235b975 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawCorrectness.lean @@ -0,0 +1,89 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSampleAssembly +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawTermProgram + +namespace OAI + +/-! The literal raw edge instructions encode the proved physical matrix. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumRawExchange +open QuantumAxisSample MediatorListProgram +open scoped BigOperators Classical + +def erase {m : ℕ} (b : TypedBond m) : Bond := (b.1.val,b.2.1.val,b.2.2) + +theorem field_erase {n : ℕ} (k : ℕ) (i : Fin n) (a : Fin 2) (J : ℚ) : + (fieldBonds k i a J).map erase = field k i.val a J := by + simp [fieldBonds,field,erase,finProdFinEquiv,Nat.add_comm] + +theorem cross_erase {n : ℕ} (k : ℕ) (r : ℚ) (i j : Fin n) (a b : Fin 2) (J : ℚ) : + (crossBonds k r i j a b J).map erase = cross k r i.val j.val a b J := by + simp only [crossBonds,cross,List.map_ofFn] + apply congrArg List.ofFn + funext e + dsimp only [Function.comp_apply] + generalize (finProdFinEquiv : Fin 4 × Fin 4 ≃ Fin 16).symm e = pq + change (pq.1.val+4*i.val,pq.2.val+4*j.val,crossValue k r a b J pq.1 pq.2) = _ + simp only [Nat.add_comm] + +theorem bonds_pack {n : ℕ} (k : ℕ) (r : ℚ) (t : QMAXZTerm n) (J : ℚ) : + bonds ((k,r),pack t J) = (termBonds k r t J).map erase := by + cases t <;> simp [bonds,pack,axis_pack,termBonds,List.map_append,field_erase,cross_erase] + +theorem scalar_pack {n : ℕ} (k : ℕ) (r : ℚ) (t : QMAXZTerm n) (J : ℚ) : + scalar ((k,r),pack t J) = termScalar k t J := by + cases t <;> simp [scalar,pack,axis_pack,termScalar] + +theorem fieldBonds_distinct {n : ℕ} (k : ℕ) (i : Fin n) (a : Fin 2) (J : ℚ) + (b : TypedBond (n*4)) (hb : b ∈ fieldBonds k i a J) : b.1 ≠ b.2.1 := by + obtain ⟨e,he⟩ := List.mem_ofFn.mp hb + subst b + intro h + exact qmaFieldEdgeRight_ne e (congrArg Prod.snd (finProdFinEquiv.injective h)) + +theorem crossBonds_distinct {n : ℕ} (k : ℕ) (r : ℚ) (i j : Fin n) (hij : i ≠ j) + (a b : Fin 2) (J : ℚ) (e : TypedBond (n*4)) + (he : e ∈ crossBonds k r i j a b J) : e.1 ≠ e.2.1 := by + obtain ⟨p,hp⟩ := List.mem_ofFn.mp he + subst e + intro h + exact hij (congrArg Prod.fst (finProdFinEquiv.injective h)) + +theorem termBonds_distinct {n : ℕ} (k : ℕ) (r : ℚ) (t : QMAXZTerm n) (J : ℚ) + (b : TypedBond (n*4)) (hb : b ∈ termBonds k r t J) : b.1 ≠ b.2.1 := by + cases t with + | scalar => simp [termBonds] at hb + | field i a => exact fieldBonds_distinct k i a J b hb + | pair i j hij a c => + simp only [termBonds,List.mem_append] at hb + rcases hb with (hb|hb)|hb + · exact crossBonds_distinct k r i j hij a c J b hb + · exact fieldBonds_distinct _ _ _ _ b hb + · exact fieldBonds_distinct _ _ _ _ b hb + +theorem penaltyBonds_distinct (n : ℕ) (r : ℚ) (b : TypedBond (n*4)) + (hb : b ∈ penaltyBonds n r) : b.1 ≠ b.2.1 := by + obtain ⟨e,he⟩ := List.mem_ofFn.mp hb + subst b + intro h + exact qmaFourEdge_distinct _ (congrArg Prod.snd (finProdFinEquiv.injective h)) + +def family {n m : ℕ} (k : ℕ) (r : ℚ) (t : Fin m → QMAXZTerm n) (J : Fin m → ℚ) : + List (TypedBond (n*4)) := + penaltyBonds n r ++ (List.ofFn (fun e => termBonds k r (t e) (J e))).flatten + +theorem family_matrix {n m : ℕ} (k : ℕ) (r : ℚ) (t : Fin m → QMAXZTerm n) (J : Fin m → ℚ) : + ((family k r t J).map typedBondMatrix).sum+ + (r^2*(n*6)+∑ e, termScalar k (t e) (J e):ℚ) • + (1 : Matrix (SourceSpinBasis (n*4)) (SourceSpinBasis (n*4)) ℂ) = matrixValue k r t J := by + rw [termScalar_sum] + rw [matrixValue_assembly] + simp only [family,List.map_append,List.sum_append,List.map_flatten,List.map_ofFn, + List.sum_flatten,List.sum_ofFn,Function.comp_apply] + rfl + +end ContinuumCoulomb.QuantumRawExchange + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawEnvelope.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawEnvelope.lean new file mode 100644 index 0000000000000000000000000000000000000000..890b35a2ba6f7fe144afa28745a76b957c0434fc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawEnvelope.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawOutputBounds + +namespace OAI + +/-! A natural polynomial envelope for the actual rational raw compiler. +Only the raw term count, coefficient magnitude and unary precision enter it. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumRawExchange + +def budgetNat (m B : ℕ) : ℕ := 1+2000000*(m+m*B)+(7056*(m+m*B))^2 +def scaleNat (m B N : ℕ) : ℕ := 9*(budgetNat m B)^3*N +def outputNat (n m B N : ℕ) : ℕ := + let R := scaleNat m B N + (6*n+1)*R^2+3920*R*(1+B)+(685600*m+26000)*B+1 + +theorem mass_nonneg (xs : List Raw) : 0 ≤ mass xs := by + exact List.sum_nonneg (by intro q hq; obtain ⟨t,ht,rfl⟩ := List.mem_map.mp hq; exact abs_nonneg _) + +theorem mass_bound (xs : List Raw) {B : ℝ} (hw : ∀ t ∈ xs, |(t.2.2.2:ℝ)| ≤ B) : + (mass xs:ℝ) ≤ xs.length*B := by + induction xs with + | nil => simp [mass] + | cons t xs ih => + have ht := hw t (by simp) + have hs := ih (by intro u hu; exact hw u (by simp [hu])) + simp only [mass,List.map_cons,List.sum_cons,Rat.cast_add,Rat.cast_abs, + List.length_cons,Nat.cast_add,Nat.cast_one] + change |(t.2.2.2:ℝ)|+(mass xs:ℝ) ≤ _ + nlinarith + +theorem scale_nat_bound (N : ℕ) (xs : List Raw) (B : ℕ) + (hw : ∀ t ∈ xs, |(t.2.2.2:ℝ)| ≤ B) : + |(scale N xs:ℝ)| ≤ scaleNat xs.length B N := by + have hm := mass_bound xs hw + have hm0 : (0:ℝ) ≤ mass xs := by exact_mod_cast mass_nonneg xs + have hb0 : (0:ℝ) ≤ budget xs := by + simp only [budget,size,Rat.cast_add,Rat.cast_mul,Rat.cast_pow,Rat.cast_natCast,Rat.cast_ofNat] + positivity + have hb : (budget xs:ℝ) ≤ budgetNat xs.length B := by + simp only [budget,size,budgetNat,Rat.cast_add,Rat.cast_mul,Rat.cast_pow,Rat.cast_natCast, + Rat.cast_ofNat,Rat.cast_one,Nat.cast_add,Nat.cast_mul,Nat.cast_pow,Nat.cast_ofNat,Nat.cast_one] + gcongr + simp only [scale,scaleNat,Rat.cast_mul,Rat.cast_pow,Rat.cast_natCast,Rat.cast_ofNat, + Nat.cast_mul,Nat.cast_pow,Nat.cast_ofNat] + rw [abs_of_nonneg (by positivity)] + gcongr + +theorem outputNat_cast (n m B N : ℕ) : + (outputNat n m B N:ℝ)=outputBound n m (scaleNat m B N) B := by + simp only [outputNat,outputBound,Nat.cast_add,Nat.cast_mul,Nat.cast_pow, + Nat.cast_ofNat,Nat.cast_one] + +theorem compile_bond_bound (n N B : ℕ) (xs : List Raw) + (hw : ∀ t ∈ xs, |(t.2.2.2:ℝ)| ≤ B) + (e : MediatorListProgram.Bond) (he : e ∈ (compile (n,N,xs)).1) : + |(e.2.2:ℝ)| ≤ outputNat n xs.length B N := by + rw [outputNat_cast] + exact fullBonds_abs n (bits (n,N,xs)) (scale N xs) xs + (scale_nat_bound N xs B hw) (Nat.cast_nonneg B) hw e he + +theorem compile_scalar_bound (n N B : ℕ) (xs : List Raw) + (hw : ∀ t ∈ xs, |(t.2.2.2:ℝ)| ≤ B) : + |((compile (n,N,xs)).2:ℝ)| ≤ outputNat n xs.length B N := by + rw [outputNat_cast] + exact fullScalar_abs n (bits (n,N,xs)) (scale N xs) xs + (scale_nat_bound N xs B hw) (Nat.cast_nonneg B) hw + +end ContinuumCoulomb.QuantumRawExchange + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawExchange.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawExchange.lean new file mode 100644 index 0000000000000000000000000000000000000000..dd98fffa7c3a70de6164e674635f41acb42d0713 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawExchange.lean @@ -0,0 +1,71 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumExchangeSampleProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.MediatorListProgram + +namespace OAI + +/-! Raw, rational finite-list instructions for the four-spin compiler. -/ + +namespace ContinuumCoulomb.QuantumRawExchange +open QuantumAxisSample MediatorListProgram ExactQuantumFactoring.BitStackProgram + +abbrev Raw := (Bool × Bool) × ((ℕ × ℕ) × ((Bool × Bool) × ℚ)) +def rawCode : Raw → List Bool := + prodCode (prodCode Procedure.boolCode Procedure.boolCode) + (prodCode (prodCode Nat.bits Nat.bits) (prodCode (prodCode Procedure.boolCode Procedure.boolCode) ratCode)) + +def axis (a : Bool) : Fin 2 := if a then 0 else 1 + +def pack {n : ℕ} (t : QMAXZTerm n) (J : ℚ) : Raw := + match t with + | .scalar => ((false,false),((0,0),((false,false),J))) + | .field i a => ((false,true),((i,0),((decide (a = 0),false),J))) + | .pair i j _ a b => ((true,false),((i,j),((decide (a = 0),decide (b = 0)),J))) + +theorem axis_pack (a : Fin 2) : axis (decide (a = 0)) = a := by + fin_cases a <;> rfl + +abbrev Environment := ℕ × ℚ +def environmentCode : Environment → List Bool := prodCode unaryCode ratCode +abbrev Input := Environment × Raw +def inputCode : Input → List Bool := prodCode environmentCode rawCode + +def field (k : ℕ) (i : ℕ) (a : Fin 2) (J : ℚ) : List Bond := + List.ofFn fun e : Fin 3 => (4*i,4*i+(qmaFieldEdgeRight e).val,fieldValue k a J e) + +def cross (k : ℕ) (r : ℚ) (i j : ℕ) (a b : Fin 2) (J : ℚ) : List Bond := + List.ofFn fun e : Fin 16 => + let pq := (finProdFinEquiv : Fin 4 × Fin 4 ≃ Fin 16).symm e + (4*i+pq.1.val,4*j+pq.2.val,crossValue k r a b J pq.1 pq.2) + +def bonds (x : Input) : List Bond := + let k := x.1.1 + let r := x.1.2 + let t := x.2 + let i := t.2.1.1 + let j := t.2.1.2 + let a := axis t.2.2.1.1 + let b := axis t.2.2.1.2 + let J := t.2.2.2 + if t.1.1 then cross k r i j a b J ++ + field k i a (counterA k a b J) ++ field k j b (counterB k a b J) + else if t.1.2 then field k i a J else [] + +def scalar (x : Input) : ℚ := + let t := x.2 + if t.1.1 then -offset x.1.1 (axis t.2.2.1.1) (axis t.2.2.1.2) t.2.2.2 + else if t.1.2 then -shiftValue (axis t.2.2.1.1) t.2.2.2 else t.2.2.2 + +theorem bonds_length (x : Input) : (bonds x).length ≤ 22 := by + simp only [bonds] + split <;> rename_i h + · simp [cross,field] + · split <;> simp [field] + +theorem bonds_pack_length {n : ℕ} (k : ℕ) (r : ℚ) (t : QMAXZTerm n) (J : ℚ) : + (bonds ((k,r),pack t J)).length = + match t with | .scalar => 0 | .field .. => 3 | .pair .. => 22 := by + cases t <;> simp [bonds,pack,field,cross] + +end ContinuumCoulomb.QuantumRawExchange + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawFamilyCorrectness.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawFamilyCorrectness.lean new file mode 100644 index 0000000000000000000000000000000000000000..a16526771fbb865861f0228cc52da920a987cc05 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawFamilyCorrectness.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawCorrectness +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawFamilyProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSampleBudget + +namespace OAI + +/-! Exact correspondence between the emitted raw family and its certified finite Hamiltonian. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumRawExchange +open QuantumAxisSample MediatorListProgram +open scoped BigOperators Classical + +theorem penalty_erase (n : ℕ) (r : ℚ) : + (penaltyBonds n r).map erase = penalty n r := by + have hrange : (List.range n).map (penaltyBlock r) = + List.ofFn (fun i : Fin n => penaltyBlock r i.val) := by + simpa only [List.length_range,List.getElem_range,Fin.val_cast] using + (List.ofFn_getElem_eq_map (List.range n) (penaltyBlock r)).symm + rw [penalty,hrange,penaltyBonds,List.map_ofFn,List.ofFn_mul] + apply congrArg List.flatten + apply congrArg List.ofFn + funext i + apply congrArg List.ofFn + funext j + have he : (⟨i.val*6+j.val,by omega⟩ : Fin (n*6)) = finProdFinEquiv (i,j) := by + apply Fin.ext + change i.val*6+j.val = j.val+6*i.val + omega + simp only [he,Equiv.symm_apply_apply,Function.comp_apply,erase] + change ((qmaFourEdgeLeft j).val+4*i.val,(qmaFourEdgeRight j).val+4*i.val,r^2) = _ + simp only [Nat.add_comm] + +def packed {n m : ℕ} (t : Fin m → QMAXZTerm n) (J : Fin m → ℚ) : List Raw := + List.ofFn (fun e => pack (t e) (J e)) + +theorem fullBonds_packed {n m : ℕ} (k : ℕ) (r : ℚ) (t : Fin m → QMAXZTerm n) (J : Fin m → ℚ) : + fullBonds (n,(k,r),packed t J) = (family k r t J).map erase := by + simp only [fullBonds,family,List.map_append,penalty_erase,termBondsList,packed, + List.map_flatten,List.map_ofFn,Function.comp_def,bonds_pack] + +theorem fullScalar_packed {n m : ℕ} (k : ℕ) (r : ℚ) (t : Fin m → QMAXZTerm n) (J : Fin m → ℚ) : + fullScalar (n,(k,r),packed t J) = scalarValue k r t J := by + simp only [fullScalar,termScalarList,packed,List.map_ofFn,List.sum_ofFn, + Function.comp_apply,scalar_pack,termScalar_sum] + +theorem family_distinct {n m : ℕ} (k : ℕ) (r : ℚ) (t : Fin m → QMAXZTerm n) (J : Fin m → ℚ) + (b : TypedBond (n*4)) (hb : b ∈ family k r t J) : b.1 ≠ b.2.1 := by + rcases List.mem_append.mp hb with h | h + · exact penaltyBonds_distinct n r b h + · obtain ⟨xs,hxs,hb⟩ := List.mem_flatten.mp h + obtain ⟨e,he⟩ := List.mem_ofFn.mp hxs + subst xs + exact termBonds_distinct k r (t e) (J e) b hb + +theorem fullBonds_valid {n m : ℕ} (k : ℕ) (r : ℚ) (t : Fin m → QMAXZTerm n) (J : Fin m → ℚ) + (b : Bond) (hb : b ∈ fullBonds (n,(k,r),packed t J)) : + b.1 < n*4 ∧ b.2.1 < n*4 ∧ b.1 ≠ b.2.1 := by + rw [fullBonds_packed] at hb + obtain ⟨a,ha,rfl⟩ := List.mem_map.mp hb + refine ⟨a.1.isLt,a.2.1.isLt,?_⟩ + exact fun h => family_distinct k r t J a ha (Fin.ext h) + +end ContinuumCoulomb.QuantumRawExchange + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawFamilyProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawFamilyProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..3cbe5f81b7185fd9e89097758d4e7aa28fd85cc4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawFamilyProgram.lean @@ -0,0 +1,123 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawTermProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.RationalSumProgram + +namespace OAI + +/-! The complete finite rational edge list and offset are computed in polynomial time. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumRawExchange +open QuantumAxisSample MediatorListProgram ExactQuantumFactoring.BitStackProgram + +private theorem flatten_code_bound {α : Type} (ea : α → List Bool) (xs : List (List α)) : + (listCode ea xs.flatten).length ≤ (listCode (listCode ea) xs).length := by + induction xs with + | nil => exact le_rfl + | cons x xs ih => + have h := listCode_length_append ea x xs.flatten + simp only [List.flatten_cons,listCode_length_cons] + omega + +private theorem fold_append {α : Type} (xs : List (List α)) (ys : List α) : + xs.foldl (fun ys x => ys++x) ys = ys++xs.flatten := by + induction xs generalizing ys with + | nil => simp + | cons x xs ih => simp only [List.foldl_cons,ih,List.flatten_cons,List.append_assoc] + +noncomputable def flattenProgram {α : Type} (ea : α → List Bool) (d : α) : + Procedure (listCode (listCode ea)) (listCode ea) List.flatten := by + let step := (Procedure.listAppend ea d).comp (Procedure.swap (listCode ea) (listCode ea)) + let p := Procedure.foldList [] step Polynomial.X (by + intro xs ys i + change (listCode ea ((xs.take i).foldl (fun ys x => ys++x) ys)).length ≤ _ + rw [fold_append] + have h := listCode_length_append ea ys (xs.take i).flatten + have hf := flatten_code_bound ea (xs.take i) + have ht := listCode_length_take_le (listCode ea) i xs + simp only [Polynomial.eval_X] + omega) + exact (p.comp ((Procedure.identity (listCode (listCode ea))).pair + (Procedure.constant (listCode (listCode ea)) (listCode ea) []))).congrFun (by + intro xs + change xs.foldl (fun ys x => ys++x) [] = xs.flatten + simpa only [List.nil_append] using fold_append xs []) + +abbrev FamilyInput := Environment × List Raw +def familyCode : FamilyInput → List Bool := prodCode environmentCode (listCode rawCode) + +def termBondsList (x : FamilyInput) : List Bond := (x.2.map (fun t => bonds (x.1,t))).flatten +def termScalarList (x : FamilyInput) : ℚ := (x.2.map (fun t => scalar (x.1,t))).sum + +def zeroRaw : Raw := ((false,false),((0,0),((false,false),0))) + +noncomputable opaque termBondsProgram : Procedure familyCode (listCode bondCode) termBondsList := + (flattenProgram bondCode zeroBond).comp + (Procedure.listMapWith (ea := environmentCode) (eb := rawCode) (ec := listCode bondCode) + (f := fun env t => bonds (env,t)) zeroRaw [] bondsProgram) + +noncomputable opaque termScalarProgram : Procedure familyCode ratCode termScalarList := + RationalSumProgram.sumProgram.comp + (Procedure.listMapWith (ea := environmentCode) (eb := rawCode) (ec := ratCode) + (f := fun env t => scalar (env,t)) zeroRaw 0 scalarProgram) + +abbrev PenaltyInput := ℕ × ℚ +def penaltyCode : PenaltyInput → List Bool := prodCode unaryCode ratCode + +def penaltyBlock (r : ℚ) (i : ℕ) : List Bond := + List.ofFn fun e : Fin 6 => (4*i+(qmaFourEdgeLeft e).val, + 4*i+(qmaFourEdgeRight e).val,r^2) + +def penalty (n : ℕ) (r : ℚ) : List Bond := ((List.range n).map (penaltyBlock r)).flatten + +noncomputable opaque penaltyIndexProgram : Procedure penaltyCode Nat.bits Prod.fst := + Procedure.unaryToBits.comp (Procedure.first _ _) +noncomputable opaque penaltyScaleProgram : Procedure penaltyCode ratCode Prod.snd := Procedure.second _ _ +noncomputable opaque penaltyBaseProgram : Procedure penaltyCode Nat.bits (fun x => 4*x.1) := + Procedure.binaryMul.comp ((Procedure.constant penaltyCode Nat.bits 4).pair penaltyIndexProgram) +noncomputable opaque penaltyShiftProgram (i : ℕ) : Procedure penaltyCode Nat.bits (fun x => 4*x.1+i) := + Procedure.binaryAdd.comp (penaltyBaseProgram.pair (Procedure.constant penaltyCode Nat.bits i)) +noncomputable opaque penaltySquareProgram : Procedure penaltyCode ratCode (fun x => x.2^2) := + (Procedure.ratMul.comp (penaltyScaleProgram.pair penaltyScaleProgram)).congrFun + (by intro x; change x.2*x.2 = x.2^2; ring) +noncomputable opaque penaltyBondProgram (e : Fin 6) : Procedure penaltyCode bondCode + (fun x => (4*x.1+(qmaFourEdgeLeft e).val,4*x.1+(qmaFourEdgeRight e).val,x.2^2)) := + (penaltyShiftProgram _).pair ((penaltyShiftProgram _).pair penaltySquareProgram) +noncomputable opaque penaltyBlockProgram : Procedure penaltyCode (listCode bondCode) + (fun x => penaltyBlock x.2 x.1) := fixedListProgram penaltyCode bondCode 6 _ penaltyBondProgram +noncomputable opaque penaltyProgram : Procedure penaltyCode (listCode bondCode) + (fun x => penalty x.1 x.2) := + (flattenProgram bondCode zeroBond).comp (Procedure.tabulate [] penaltyBlockProgram) + +abbrev FullInput := ℕ × FamilyInput +def fullCode : FullInput → List Bool := prodCode unaryCode familyCode + +def fullBonds (x : FullInput) : List Bond := penalty x.1 x.2.1.2 ++ termBondsList x.2 +def fullScalar (x : FullInput) : ℚ := x.2.1.2^2*(x.1*6)+termScalarList x.2 + +noncomputable opaque fullCountProgram : Procedure fullCode unaryCode Prod.fst := Procedure.first _ _ +noncomputable opaque fullFamilyProgram : Procedure fullCode familyCode Prod.snd := Procedure.second _ _ +noncomputable opaque fullScaleProgram : Procedure fullCode ratCode (fun x => x.2.1.2) := + (Procedure.second unaryCode ratCode).comp ((Procedure.first _ _).comp fullFamilyProgram) +noncomputable opaque fullPenaltyInputProgram : Procedure fullCode penaltyCode (fun x => (x.1,x.2.1.2)) := + fullCountProgram.pair fullScaleProgram +noncomputable opaque fullBondsProgram : Procedure fullCode (listCode bondCode) fullBonds := + (Procedure.listAppend bondCode zeroBond).comp ((penaltyProgram.comp fullPenaltyInputProgram).pair + (termBondsProgram.comp fullFamilyProgram)) +noncomputable opaque fullCountRatProgram : Procedure fullCode ratCode (fun x => (x.1:ℚ)) := + Procedure.natToRat.comp (Procedure.unaryToBits.comp fullCountProgram) +noncomputable opaque fullSixCountProgram : Procedure fullCode ratCode (fun x => (x.1:ℚ)*6) := + Procedure.ratMul.comp (fullCountRatProgram.pair (Procedure.constant fullCode ratCode 6)) +noncomputable opaque fullPenaltyScalarProgram : Procedure fullCode ratCode (fun x => x.2.1.2^2*(x.1*6)) := + Procedure.ratMul.comp ((penaltySquareProgram.comp fullPenaltyInputProgram).pair fullSixCountProgram) +noncomputable opaque fullScalarProgram : Procedure fullCode ratCode fullScalar := + Procedure.ratAdd.comp (fullPenaltyScalarProgram.pair (termScalarProgram.comp fullFamilyProgram)) + +noncomputable def fullCertificate : Turing.TM2ComputableInPolyTime fullCode + (prodCode (listCode bondCode) ratCode) (fun x => (fullBonds x,fullScalar x)) := + (fullBondsProgram.pair fullScalarProgram).toTM2 + +end ContinuumCoulomb.QuantumRawExchange + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawIncidence.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawIncidence.lean new file mode 100644 index 0000000000000000000000000000000000000000..1ec45f4a73aa48fddcf0f10c4086bf51cdbc2a83 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawIncidence.lean @@ -0,0 +1,197 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryIncidence +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedRawBlock +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedLabelPacking +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListDegree + +namespace OAI + +/-! The literal four-spin exchange list preserves a uniform incidence bound. +All bonds are counted, including bonds with zero weight. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumRawIncidence +open QuantumForkList QuantumOrderedIncidence QuantumRawExchange MediatorListProgram +open scoped BigOperators Classical + +theorem degree_le_length (bs : List Bond) (v : ℕ) : degree bs v ≤ bs.length := by + induction bs with + | nil => simp [degree] + | cons b bs ih => + simp only [degree,List.map_cons,List.sum_cons,List.length_cons,incident] at ih ⊢ + split_ifs <;> omega + +theorem degree_zero (bs : List Bond) (v : ℕ) + (h : ∀ b ∈ bs, b.1 ≠ v ∧ b.2.1 ≠ v) : degree bs v = 0 := by + unfold degree + apply List.sum_eq_zero + intro k hk + obtain ⟨b,hb,rfl⟩ := List.mem_map.mp hk + simp [incident,(h b hb).1,(h b hb).2] + +theorem degree_flatten (bss : List (List Bond)) (v : ℕ) : + degree bss.flatten v = (bss.map (fun bs => degree bs v)).sum := by + simp only [degree,List.map_flatten,List.sum_flatten,List.map_map,Function.comp_def] + +def sites {n : ℕ} : QMAXZTerm n → List (Fin n) + | .scalar => [] + | .field i _ => [i] + | .pair i j _ _ _ => [i,j] + +theorem slot_div (i : ℕ) (j : Fin 4) : (4*i+j.val)/4=i := by omega + +theorem field_origin (k i : ℕ) (a : Fin 2) (J : ℚ) (b : Bond) + (hb : b ∈ field k i a J) (v : ℕ) (hv : b.1=v ∨ b.2.1=v) : v/4=i := by + obtain ⟨e,rfl⟩ := List.mem_ofFn.mp hb + rcases hv with hv | hv + · change 4*i=v at hv + omega + · change 4*i+(qmaFieldEdgeRight e).val=v at hv + rw [← hv] + exact slot_div i _ + +theorem cross_origin (k : ℕ) (r : ℚ) (i j : ℕ) (a b : Fin 2) (J : ℚ) + (e : Bond) (he : e ∈ cross k r i j a b J) (v : ℕ) + (hv : e.1=v ∨ e.2.1=v) : v/4=i ∨ v/4=j := by + obtain ⟨p,rfl⟩ := List.mem_ofFn.mp he + rcases hv with hv | hv + · left + change 4*i+((finProdFinEquiv : Fin 4 × Fin 4 ≃ Fin 16).symm p).1.val=v at hv + rw [← hv] + exact slot_div i _ + · right + change 4*j+((finProdFinEquiv : Fin 4 × Fin 4 ≃ Fin 16).symm p).2.val=v at hv + rw [← hv] + exact slot_div j _ + +theorem packed_origin {n : ℕ} (k : ℕ) (r : ℚ) (t : QMAXZTerm n) (J : ℚ) + (b : Bond) (hb : b ∈ bonds ((k,r),pack t J)) (v : ℕ) + (hv : b.1=v ∨ b.2.1=v) : ∃ i ∈ sites t, i.val=v/4 := by + cases t with + | scalar => simp [bonds,pack] at hb + | field i a => + have hi := field_origin k i.val (axis (decide (a=0))) J b hb v hv + exact ⟨i,by simp [sites],hi.symm⟩ + | pair i j hij a b' => + change b ∈ cross k r i.val j.val _ _ J ++ field k i.val _ _ ++ field k j.val _ _ at hb + simp only [List.mem_append] at hb + rcases hb with (hb | hb) | hb + · rcases cross_origin k r i.val j.val _ _ J b hb v hv with hi | hj + · exact ⟨i,by simp [sites],hi.symm⟩ + · exact ⟨j,by simp [sites],hj.symm⟩ + · exact ⟨i,by simp [sites],(field_origin _ _ _ _ b hb v hv).symm⟩ + · exact ⟨j,by simp [sites],(field_origin _ _ _ _ b hb v hv).symm⟩ + +theorem ofSites_subset {n : ℕ} (xs : List (Fin n)) (w : Fin n → Fin 4) : + ∀ i ∈ sites (QuantumOrderedXZTerm.ofSites xs w), i ∈ xs := by + cases xs with + | nil => simp [QuantumOrderedXZTerm.ofSites,sites] + | cons i xs => + cases xs with + | nil => + by_cases h : w i=0 <;> + simp [QuantumOrderedXZTerm.ofSites,QuantumOrderedXZTerm.field,sites,h] + | cons j xs => + by_cases hij : i=j <;> by_cases hi : w i=0 <;> by_cases hj : w j=0 <;> + simp [QuantumOrderedXZTerm.ofSites,QuantumOrderedXZTerm.field,sites,hij,hi,hj] + +theorem term_degree {n : ℕ} (k : ℕ) (r : ℚ) (xs : List (Fin n)) + (w : Fin n → Fin 4) (J : ℚ) (v : ℕ) (q : Fin n) (hq : q.val=v/4) : + degree (bonds ((k,r),pack (QuantumOrderedXZTerm.ofSites xs w) J)) v ≤ + 22*(if q ∈ xs then 1 else 0) := by + by_cases h : q ∈ xs + · simpa only [h,ite_true,Nat.mul_one] using + (degree_le_length _ v).trans (bonds_length _) + · have hz : degree (bonds ((k,r),pack (QuantumOrderedXZTerm.ofSites xs w) J)) v=0 := by + apply degree_zero + intro b hb + have hn : ¬(b.1=v ∨ b.2.1=v) := by + intro hv + obtain ⟨i,hi,he⟩ := packed_origin k r _ J b hb v hv + have hiq : i=q := Fin.ext (he.trans hq.symm) + exact h (hiq ▸ ofSites_subset xs w i hi) + exact not_or.mp hn + simp only [h,ite_false,Nat.mul_zero,hz,le_refl] + +theorem penalty_degree (n : ℕ) (r : ℚ) (v : ℕ) : degree (penalty n r) v ≤ 6 := by + have hb (i : ℕ) : degree (penaltyBlock r i) v ≤ 6*(if v/4=i then 1 else 0) := by + by_cases hi : v/4=i + · simpa only [hi,ite_true,Nat.mul_one,penaltyBlock,List.length_ofFn] using + degree_le_length (penaltyBlock r i) v + · have hz : degree (penaltyBlock r i) v=0 := by + apply degree_zero + intro b hb + obtain ⟨e,rfl⟩ := List.mem_ofFn.mp hb + have hl : 4*i+(qmaFourEdgeLeft e).val ≠ v := by + intro he + exact hi (by rw [← he]; exact slot_div i _) + have hr : 4*i+(qmaFourEdgeRight e).val ≠ v := by + intro he + exact hi (by rw [← he]; exact slot_div i _) + exact ⟨hl,hr⟩ + simp [hz,hi] + unfold penalty + rw [degree_flatten,List.map_map,range_sum] + calc + _ ≤ ∑ i : Fin n, 6*(if v/4=i.val then 1 else 0) := + Finset.sum_le_sum (fun i _ => hb i.val) + _ = 6*∑ i : Fin n, if v/4=i.val then 1 else 0 := (Finset.mul_sum _ _ _).symm + _ ≤ 6*1 := by + apply Nat.mul_le_mul_left + simpa only [eq_comm] using qmaCount_eq_le_one Fin.val Fin.val_injective (v/4) + _ = 6 := by omega + +theorem raw_degree {n m : ℕ} (N : ℕ) (xs : Fin m → List (Fin n)) + (w : Fin m → Fin n → Fin 4) (J : Fin m → ℚ) {D : ℕ} + (hx : Bounded xs D) (v : ℕ) (hv : v simp only [h,ite_true,ite_false] + _ ≤ 22*D := Nat.mul_le_mul_left 22 (hx q) + omega + +theorem numbered_bound {ι κ : Type} [Fintype κ] {n m D : ℕ} + (q : Fin n ≃ ι) (e : Fin m ≃ κ) (xs : κ → List ι) (hx : Bounded xs D) : + Bounded (QuantumOrderedLabelTable.numberedSites q e xs) D := by + intro i + have hm (a : Fin m) : + i ∈ QuantumOrderedLabelTable.numberedSites q e xs a ↔ q i ∈ xs (e a) := by + simp only [QuantumOrderedLabelTable.numberedSites,List.mem_map] + constructor + · rintro ⟨j,hj,hji⟩ + have hj' : j=q i := by simpa using congrArg q hji + simpa only [hj'] using hj + · intro hi + exact ⟨q i,hi,q.symm_apply_apply i⟩ + calc + count (QuantumOrderedLabelTable.numberedSites q e xs) i = + ∑ a : Fin m, if q i ∈ xs (e a) then 1 else 0 := by simp only [count,hm] + _ = count xs (q i) := by + rw [count] + exact e.sum_comp (fun a => if q i ∈ xs a then (1:ℕ) else 0) + _ ≤ D := hx (q i) + +end ContinuumCoulomb.QuantumRawIncidence + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawOutputBounds.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawOutputBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..9ac5d9737f9e53ab1d6a1f1490ea5b020115bad0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawOutputBounds.lean @@ -0,0 +1,116 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawCoefficientBounds + +namespace OAI + +/-! Polynomial magnitude envelopes for every actual physical edge and scalar +offset in the rational four-spin output. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumRawExchange +open QuantumAxisSample MediatorListProgram + +theorem field_bond_abs (k : ℕ) (i : ℕ) (a : Fin 2) (J : ℚ) + (b : Bond) (hb : b ∈ field k i a J) : |(b.2.2:ℝ)| ≤ 65*|(J:ℝ)| := by + obtain ⟨e,rfl⟩ := List.mem_ofFn.mp hb + exact fieldValue_abs k a J e + +theorem cross_bond_abs (k : ℕ) (r : ℚ) (i j : ℕ) (a b : Fin 2) (J : ℚ) + (e : Bond) (he : e ∈ cross k r i j a b J) : + |(e.2.2:ℝ)| ≤ 3920*|(r:ℝ)| *(1+|(J:ℝ)|) := by + obtain ⟨p,rfl⟩ := List.mem_ofFn.mp he + exact crossValue_abs k r a b J _ _ + +theorem bonds_abs (x : Input) (e : Bond) (he : e ∈ bonds x) : + |(e.2.2:ℝ)| ≤ 3920*|(x.1.2:ℝ)| *(1+|(x.2.2.2.2:ℝ)|)+26000*|(x.2.2.2.2:ℝ)| := by + dsimp only [bonds] at he + split_ifs at he with hp hf + · rcases List.mem_append.mp he with he | he + · rcases List.mem_append.mp he with he | he + · exact (cross_bond_abs _ _ _ _ _ _ _ e he).trans + (le_add_of_nonneg_right (by positivity)) + · have h := (field_bond_abs _ _ _ _ e he).trans + (mul_le_mul_of_nonneg_left (counterA_abs _ _ _ _) (by norm_num : (0:ℝ) ≤ 65)) + nlinarith [abs_nonneg (x.1.2:ℝ),abs_nonneg (x.2.2.2.2:ℝ)] + · have h := (field_bond_abs _ _ _ _ e he).trans + (mul_le_mul_of_nonneg_left (counterB_abs _ _ _ _) (by norm_num : (0:ℝ) ≤ 65)) + nlinarith [abs_nonneg (x.1.2:ℝ),abs_nonneg (x.2.2.2.2:ℝ)] + · have h := field_bond_abs _ _ _ _ e he + nlinarith [abs_nonneg (x.1.2:ℝ),abs_nonneg (x.2.2.2.2:ℝ)] + · simp only [List.not_mem_nil] at he + +theorem scalar_abs (x : Input) : |(scalar x:ℝ)| ≤ 685600*|(x.2.2.2.2:ℝ)| := by + dsimp only [scalar] + split_ifs + · simpa only [Rat.cast_neg,abs_neg] using offset_abs x.1.1 _ _ x.2.2.2.2 + · simp only [Rat.cast_neg,abs_neg] + exact (shiftValue_abs _ _).trans (by nlinarith [abs_nonneg (x.2.2.2.2:ℝ)]) + · nlinarith [abs_nonneg (x.2.2.2.2:ℝ)] + +theorem termBondsList_abs (k : ℕ) (r : ℚ) (xs : List Raw) {B : ℝ} + (_hB : 0 ≤ B) (hw : ∀ t ∈ xs, |(t.2.2.2:ℝ)| ≤ B) + (e : Bond) (he : e ∈ termBondsList ((k,r),xs)) : + |(e.2.2:ℝ)| ≤ 3920*|(r:ℝ)| *(1+B)+26000*B := by + obtain ⟨ys,hys,he⟩ := List.mem_flatten.mp he + obtain ⟨t,ht,rfl⟩ := List.mem_map.mp hys + exact (bonds_abs ((k,r),t) e he).trans (by gcongr <;> exact hw t ht) + +theorem termScalarList_abs (k : ℕ) (r : ℚ) (xs : List Raw) {B : ℝ} + (_hB : 0 ≤ B) (hw : ∀ t ∈ xs, |(t.2.2.2:ℝ)| ≤ B) : + |(termScalarList ((k,r),xs):ℝ)| ≤ 685600*xs.length*B := by + induction xs with + | nil => simp [termScalarList] + | cons t xs ih => + have ht := hw t (by simp) + have hs := ih (by intro u hu; exact hw u (by simp [hu])) + simp only [termScalarList,List.map_cons,List.sum_cons,Rat.cast_add] + change |(scalar ((k,r),t):ℝ)+(termScalarList ((k,r),xs):ℝ)| ≤ _ + apply (abs_add_le _ _).trans + have h := (scalar_abs ((k,r),t)).trans + (mul_le_mul_of_nonneg_left ht (by norm_num : (0:ℝ) ≤ 685600)) + simpa only [List.length_cons,Nat.cast_add,Nat.cast_one] using + (show |(scalar ((k,r),t):ℝ)|+|(termScalarList ((k,r),xs):ℝ)| ≤ + 685600*((xs.length:ℝ)+1)*B by nlinarith) + +def outputBound (n m : ℕ) (R B : ℝ) : ℝ := + (6*n+1)*R^2+3920*R*(1+B)+(685600*m+26000)*B+1 + +theorem fullBonds_abs (n k : ℕ) (r : ℚ) (xs : List Raw) {R B : ℝ} + (hR : |(r:ℝ)| ≤ R) (hB : 0 ≤ B) (hw : ∀ t ∈ xs, |(t.2.2.2:ℝ)| ≤ B) + (e : Bond) (he : e ∈ fullBonds (n,(k,r),xs)) : + |(e.2.2:ℝ)| ≤ outputBound n xs.length R B := by + have hR0 : 0 ≤ R := (abs_nonneg _).trans hR + rcases List.mem_append.mp he with hp | ht + · obtain ⟨ys,hys,he⟩ := List.mem_flatten.mp hp + obtain ⟨i,hi,rfl⟩ := List.mem_map.mp hys + obtain ⟨j,rfl⟩ := List.mem_ofFn.mp he + change |((r^2:ℚ):ℝ)| ≤ _ + rw [Rat.cast_pow,abs_of_nonneg (sq_nonneg (r:ℝ))] + have hr2 : (r:ℝ)^2 ≤ R^2 := by nlinarith [abs_le.mp hR] + unfold outputBound + nlinarith [sq_nonneg R,(Nat.cast_nonneg n : (0:ℝ) ≤ n), + (Nat.cast_nonneg xs.length : (0:ℝ) ≤ xs.length)] + · have h := (termBondsList_abs k r xs hB hw e ht).trans + (show 3920*|(r:ℝ)| *(1+B)+26000*B ≤ 3920*R*(1+B)+26000*B by gcongr) + unfold outputBound + nlinarith [sq_nonneg R,(Nat.cast_nonneg n : (0:ℝ) ≤ n), + (Nat.cast_nonneg xs.length : (0:ℝ) ≤ xs.length)] + +theorem fullScalar_abs (n k : ℕ) (r : ℚ) (xs : List Raw) {R B : ℝ} + (hR : |(r:ℝ)| ≤ R) (hB : 0 ≤ B) (hw : ∀ t ∈ xs, |(t.2.2.2:ℝ)| ≤ B) : + |(fullScalar (n,(k,r),xs):ℝ)| ≤ outputBound n xs.length R B := by + have hR0 : 0 ≤ R := (abs_nonneg _).trans hR + have hr2 : (r:ℝ)^2 ≤ R^2 := by nlinarith [abs_le.mp hR] + have hs := termScalarList_abs k r xs hB hw + simp only [fullScalar,Rat.cast_add,Rat.cast_mul,Rat.cast_pow,Rat.cast_natCast,Rat.cast_ofNat] + apply (abs_add_le _ _).trans + rw [abs_of_nonneg (by positivity : 0 ≤ (r:ℝ)^2*((n:ℝ)*6))] + unfold outputBound + have hn : (0:ℝ) ≤ n := Nat.cast_nonneg n + have hm := mul_le_mul_of_nonneg_right hr2 (show 0 ≤ (n:ℝ)*6 by positivity) + nlinarith [sq_nonneg R] + +end ContinuumCoulomb.QuantumRawExchange + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawOutputSize.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawOutputSize.lean new file mode 100644 index 0000000000000000000000000000000000000000..aa7374822a4f200811c120741a1b3d0bb6a87b63 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawOutputSize.lean @@ -0,0 +1,70 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawCompiler +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedLabelEnergy + +namespace OAI + +/-! Linear size bounds for the actual emitted four-spin bond list, before +fixed-round degree reduction. All zero-weight entries are counted. -/ + +noncomputable section +namespace ContinuumCoulomb + +private theorem flatten_map_length_bound {α β : Type} (xs : List α) (f : α → List β) + (K : ℕ) (h : ∀ x ∈ xs, (f x).length ≤ K) : + (xs.map f).flatten.length ≤ K*xs.length := by + induction xs with + | nil => simp + | cons x xs ih => + have hx := h x (by simp) + have ht := ih (by intro y hy; exact h y (by simp [hy])) + simp only [List.map_cons,List.flatten_cons,List.length_append,List.length_cons] + nlinarith + +namespace QuantumRawExchange + +theorem fullBonds_length (n k : ℕ) (r : ℚ) (xs : List Raw) : + (fullBonds (n,(k,r),xs)).length ≤ 6*n+22*xs.length := by + have hp : (penalty n r).length ≤ 6*n := by + simpa only [penalty,List.length_range] using + flatten_map_length_bound (List.range n) (penaltyBlock r) 6 + (by intro i hi; simp only [penaltyBlock,List.length_ofFn]; exact le_rfl) + have ht : (termBondsList ((k,r),xs)).length ≤ 22*xs.length := + flatten_map_length_bound xs (fun t => bonds ((k,r),t)) 22 (fun _ _ => bonds_length _) + simpa only [fullBonds,List.length_append] using Nat.add_le_add hp ht + +theorem compile_length (n N : ℕ) (xs : List Raw) : + (compile (n,N,xs)).1.length ≤ 6*n+22*xs.length := + fullBonds_length n (bits (n,N,xs)) (scale N xs) xs + +end QuantumRawExchange + +namespace QuantumOrderedLabelCompile + +theorem rawEntries_length (x : Input) : (rawEntries x).length = 12544*x.2.2.length := by + simp only [rawEntries,Function.comp_apply,classify,List.length_map,labelEntries] + exact QuantumOrderedLabelPipeline.output_length x + +theorem output_length (x : Input) : + (output x).1.length ≤ 6*(x.2.1+3717*x.2.2.length)+22*(12544*x.2.2.length) := by + have h := QuantumRawExchange.compile_length (outputCount x) x.1 (rawEntries x) + rw [rawEntries_length] at h + simpa only [output,Function.comp_apply,rawInput,outputCount, + QuantumOrderedLabelPipeline.output_qubits] using h + +end QuantumOrderedLabelCompile + +namespace QuantumPaddedLabelProgram +open QuantumOrderedSourceIndex + +theorem historyOutput_length (c : QMACircuit) (hT : 0 < c.gates.length) (N : ℕ) : + (historyOutput c hT N).1.length ≤ + 6*(qubitCount c+3717*termCount c)+22*(12544*termCount c) := by + have h := QuantumOrderedLabelCompile.output_length (historyInput c hT N) + simpa only [historyOutput,historyInput,sourceEntries_length] using h + +end QuantumPaddedLabelProgram +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..3754ade4fb28b800896d3ea8db5d6035fc8f8d6d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawProgram.lean @@ -0,0 +1,111 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawExchange + +namespace OAI + +/-! Literal polynomial programs for fixed-size physical exchange instructions. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumRawExchange +open QuantumAxisSample MediatorListProgram ExactQuantumFactoring.BitStackProgram + +noncomputable def fixedListProgram {α β : Type} (ea : α → List Bool) (eb : β → List Bool) + (m : ℕ) (f : Fin m → α → β) (p : ∀ i, Procedure ea eb (f i)) : + Procedure ea (listCode eb) (fun x => List.ofFn (fun i => f i x)) := by + induction m with + | zero => exact (Procedure.constant ea (listCode eb) []).congrFun (by intro x; simp) + | succ m ih => + exact ((Procedure.listCons eb).comp ((p 0).pair + (ih (fun i => f i.succ) (fun i => p i.succ)))).congrFun (by + intro x + simp only [Function.comp_apply,List.ofFn_succ]) + +noncomputable def selectAxis {α β : Type} {ea : α → List Bool} {eb : β → List Bool} + {flag : α → Bool} {f : Fin 2 → α → β} (test : Procedure ea Procedure.boolCode flag) + (p : ∀ a, Procedure ea eb (f a)) : + Procedure ea eb (fun x => f (axis (flag x)) x) := + (Procedure.conditional test (p 0) (p 1)).congrFun (by + intro x + cases flag x <;> simp [axis]) + +noncomputable opaque envProgram : Procedure inputCode environmentCode Prod.fst := Procedure.first _ _ +noncomputable opaque rawProgram : Procedure inputCode rawCode Prod.snd := Procedure.second _ _ +noncomputable opaque precisionProgram : Procedure inputCode unaryCode (fun x => x.1.1) := + (Procedure.first _ _).comp envProgram +noncomputable opaque scaleProgram : Procedure inputCode ratCode (fun x => x.1.2) := + (Procedure.second _ _).comp envProgram +noncomputable opaque flagsProgram : Procedure inputCode (prodCode Procedure.boolCode Procedure.boolCode) + (fun x => x.2.1) := (Procedure.first _ _).comp rawProgram +noncomputable opaque pairFlagProgram : Procedure inputCode Procedure.boolCode (fun x => x.2.1.1) := + (Procedure.first _ _).comp flagsProgram +noncomputable opaque fieldFlagProgram : Procedure inputCode Procedure.boolCode (fun x => x.2.1.2) := + (Procedure.second _ _).comp flagsProgram +noncomputable opaque dataProgram : Procedure inputCode + (prodCode (prodCode Nat.bits Nat.bits) (prodCode (prodCode Procedure.boolCode Procedure.boolCode) ratCode)) + (fun x => x.2.2) := (Procedure.second _ _).comp rawProgram +noncomputable opaque sitesProgram : Procedure inputCode (prodCode Nat.bits Nat.bits) + (fun x => x.2.2.1) := (Procedure.first _ _).comp dataProgram +noncomputable opaque leftProgram : Procedure inputCode Nat.bits (fun x => x.2.2.1.1) := + (Procedure.first _ _).comp sitesProgram +noncomputable opaque rightProgram : Procedure inputCode Nat.bits (fun x => x.2.2.1.2) := + (Procedure.second _ _).comp sitesProgram +noncomputable opaque axesWeightProgram : Procedure inputCode + (prodCode (prodCode Procedure.boolCode Procedure.boolCode) ratCode) (fun x => x.2.2.2) := + (Procedure.second _ _).comp dataProgram +noncomputable opaque axesProgram : Procedure inputCode (prodCode Procedure.boolCode Procedure.boolCode) + (fun x => x.2.2.2.1) := (Procedure.first _ _).comp axesWeightProgram +noncomputable opaque axisLeftProgram : Procedure inputCode Procedure.boolCode (fun x => x.2.2.2.1.1) := + (Procedure.first _ _).comp axesProgram +noncomputable opaque axisRightProgram : Procedure inputCode Procedure.boolCode (fun x => x.2.2.2.1.2) := + (Procedure.second _ _).comp axesProgram +noncomputable opaque weightProgram : Procedure inputCode ratCode (fun x => x.2.2.2.2) := + (Procedure.second _ _).comp axesWeightProgram +noncomputable opaque radialProgram : Procedure inputCode radialCode (fun x => (x.1.1,x.2.2.2.2)) := + precisionProgram.pair weightProgram +noncomputable opaque crossInputProgram : Procedure inputCode crossCode (fun x => (x.1,x.2.2.2.2)) := + envProgram.pair weightProgram + +noncomputable opaque baseLeftProgram : Procedure inputCode Nat.bits (fun x => 4*x.2.2.1.1) := + Procedure.binaryMul.comp ((Procedure.constant inputCode Nat.bits 4).pair leftProgram) +noncomputable opaque baseRightProgram : Procedure inputCode Nat.bits (fun x => 4*x.2.2.1.2) := + Procedure.binaryMul.comp ((Procedure.constant inputCode Nat.bits 4).pair rightProgram) + +noncomputable opaque shiftedLeftProgram (p : ℕ) : Procedure inputCode Nat.bits (fun x => 4*x.2.2.1.1+p) := + Procedure.binaryAdd.comp (baseLeftProgram.pair (Procedure.constant inputCode Nat.bits p)) +noncomputable opaque shiftedRightProgram (p : ℕ) : Procedure inputCode Nat.bits (fun x => 4*x.2.2.1.2+p) := + Procedure.binaryAdd.comp (baseRightProgram.pair (Procedure.constant inputCode Nat.bits p)) + +noncomputable opaque fieldCoefficientProgram (e : Fin 3) : Procedure inputCode ratCode + (fun x => fieldValue x.1.1 (axis x.2.2.2.1.1) x.2.2.2.2 e) := + selectAxis axisLeftProgram (fun a => (fieldValueProgram a e).comp radialProgram) + +noncomputable opaque fieldBondProgram (e : Fin 3) : Procedure inputCode bondCode + (fun x => (4*x.2.2.1.1,4*x.2.2.1.1+(qmaFieldEdgeRight e).val, + fieldValue x.1.1 (axis x.2.2.2.1.1) x.2.2.2.2 e)) := + baseLeftProgram.pair ((shiftedLeftProgram _).pair (fieldCoefficientProgram e)) + +noncomputable opaque fieldProgram : Procedure inputCode (listCode bondCode) + (fun x => field x.1.1 x.2.2.1.1 (axis x.2.2.2.1.1) x.2.2.2.2) := + fixedListProgram inputCode bondCode 3 _ fieldBondProgram + +noncomputable opaque crossCoefficientProgram (p q : Fin 4) : Procedure inputCode ratCode + (fun x => crossValue x.1.1 x.1.2 (axis x.2.2.2.1.1) (axis x.2.2.2.1.2) x.2.2.2.2 p q) := + selectAxis axisLeftProgram (fun a => selectAxis axisRightProgram + (fun b => (crossValueProgram a b p q).comp crossInputProgram)) + +noncomputable opaque crossBondProgram (p q : Fin 4) : Procedure inputCode bondCode + (fun x => (4*x.2.2.1.1+p.val,4*x.2.2.1.2+q.val, + crossValue x.1.1 x.1.2 (axis x.2.2.2.1.1) (axis x.2.2.2.1.2) x.2.2.2.2 p q)) := + (shiftedLeftProgram p).pair ((shiftedRightProgram q).pair (crossCoefficientProgram p q)) + +noncomputable opaque crossProgram : Procedure inputCode (listCode bondCode) + (fun x => cross x.1.1 x.1.2 x.2.2.1.1 x.2.2.1.2 + (axis x.2.2.2.1.1) (axis x.2.2.2.1.2) x.2.2.2.2) := + fixedListProgram inputCode bondCode 16 _ (fun e => + crossBondProgram ((finProdFinEquiv : Fin 4 × Fin 4 ≃ Fin 16).symm e).1 + ((finProdFinEquiv : Fin 4 × Fin 4 ≃ Fin 16).symm e).2) + +end ContinuumCoulomb.QuantumRawExchange + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawSchedule.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawSchedule.lean new file mode 100644 index 0000000000000000000000000000000000000000..98610af674026da5fe0707010f060fc345ee1f97 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawSchedule.lean @@ -0,0 +1,111 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawFamilyProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSampleBudget + +namespace OAI + +/-! All four-spin scales and precisions are computed from the raw finite input. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumRawExchange +open QuantumAxisSample MediatorListProgram ExactQuantumFactoring.BitStackProgram + +def mass (xs : List Raw) : ℚ := (xs.map (fun t => |t.2.2.2|)).sum +def size (xs : List Raw) : ℚ := xs.length+mass xs +def budget (xs : List Raw) : ℚ := 1+2000000*size xs+(7056*size xs)^2 +def scale (N : ℕ) (xs : List Raw) : ℚ := 9*(budget xs)^3*N + +abbrev ScheduleInput := ℕ × (ℕ × List Raw) +def scheduleCode : ScheduleInput → List Bool := + prodCode unaryCode (prodCode Nat.bits (listCode rawCode)) + +def errorBound (x : ScheduleInput) : ℚ := + universalErrorBudget x.1 x.2.2.length (scale x.2.1 x.2.2) (mass x.2.2) +def bits (x : ScheduleInput) : ℕ := QuantumAxisSample.precision (errorBound x) x.2.1 +def scheduled (x : ScheduleInput) : FullInput := (x.1,(bits x,scale x.2.1 x.2.2),x.2.2) +def compile (x : ScheduleInput) : List Bond × ℚ := (fullBonds (scheduled x),fullScalar (scheduled x)) + +noncomputable opaque rawWeightProgram : Procedure rawCode ratCode (fun t => t.2.2.2) := + (Procedure.second _ _).comp ((Procedure.second _ _).comp (Procedure.second _ _)) +noncomputable opaque rawAbsoluteProgram : Procedure rawCode ratCode (fun t => |t.2.2.2|) := + MediatorProgram.absoluteProgram.comp rawWeightProgram +noncomputable opaque massProgram : Procedure (listCode rawCode) ratCode mass := + RationalSumProgram.sumProgram.comp (Procedure.listMap zeroRaw 0 rawAbsoluteProgram) + +noncomputable opaque scheduleCountProgram : Procedure scheduleCode unaryCode Prod.fst := Procedure.first _ _ +noncomputable opaque scheduleTailProgram : Procedure scheduleCode + (prodCode Nat.bits (listCode rawCode)) Prod.snd := Procedure.second _ _ +noncomputable opaque accuracyProgram : Procedure scheduleCode Nat.bits (fun x => x.2.1) := + (Procedure.first _ _).comp scheduleTailProgram +noncomputable opaque scheduleTermsProgram : Procedure scheduleCode (listCode rawCode) (fun x => x.2.2) := + (Procedure.second _ _).comp scheduleTailProgram +noncomputable opaque scheduleLengthProgram : Procedure scheduleCode unaryCode (fun x => x.2.2.length) := + (ExactQuantumFactoring.NativeAIG.Emission.listUnaryLength rawCode zeroRaw).comp scheduleTermsProgram +noncomputable opaque scheduleLengthRatProgram : Procedure scheduleCode ratCode (fun x => (x.2.2.length:ℚ)) := + Procedure.natToRat.comp (Procedure.unaryToBits.comp scheduleLengthProgram) +noncomputable opaque scheduleMassProgram : Procedure scheduleCode ratCode (fun x => mass x.2.2) := + massProgram.comp scheduleTermsProgram +noncomputable opaque sizeProgram : Procedure scheduleCode ratCode (fun x => size x.2.2) := + Procedure.ratAdd.comp (scheduleLengthRatProgram.pair scheduleMassProgram) +noncomputable opaque linearBudgetProgram : Procedure scheduleCode ratCode (fun x => 2000000*size x.2.2) := + Procedure.ratMul.comp ((Procedure.constant scheduleCode ratCode 2000000).pair sizeProgram) +noncomputable opaque quadraticBaseProgram : Procedure scheduleCode ratCode (fun x => 7056*size x.2.2) := + Procedure.ratMul.comp ((Procedure.constant scheduleCode ratCode 7056).pair sizeProgram) +noncomputable opaque quadraticBudgetProgram : Procedure scheduleCode ratCode (fun x => (7056*size x.2.2)^2) := + (Procedure.ratMul.comp (quadraticBaseProgram.pair quadraticBaseProgram)).congrFun + (by intro x; change _*_ = _^2; ring) +noncomputable opaque budgetProgram : Procedure scheduleCode ratCode (fun x => budget x.2.2) := + Procedure.ratAdd.comp ((Procedure.ratAdd.comp + ((Procedure.constant scheduleCode ratCode 1).pair linearBudgetProgram)).pair quadraticBudgetProgram) +noncomputable opaque squareBudgetProgram : Procedure scheduleCode ratCode (fun x => (budget x.2.2)^2) := + (Procedure.ratMul.comp (budgetProgram.pair budgetProgram)).congrFun + (by intro x; change _*_ = _^2; ring) +noncomputable opaque cubeBudgetProgram : Procedure scheduleCode ratCode (fun x => (budget x.2.2)^3) := + (Procedure.ratMul.comp (squareBudgetProgram.pair budgetProgram)).congrFun + (by intro x; change _^2*_ = _^3; ring) +noncomputable opaque accuracyRatProgram : Procedure scheduleCode ratCode (fun x => (x.2.1:ℚ)) := + Procedure.natToRat.comp accuracyProgram +noncomputable opaque scheduleScaleProgram : Procedure scheduleCode ratCode (fun x => scale x.2.1 x.2.2) := + Procedure.ratMul.comp ((Procedure.ratMul.comp + ((Procedure.constant scheduleCode ratCode 9).pair cubeBudgetProgram)).pair accuracyRatProgram) +noncomputable opaque absoluteScaleProgram : Procedure scheduleCode ratCode (fun x => |scale x.2.1 x.2.2|) := + MediatorProgram.absoluteProgram.comp scheduleScaleProgram +noncomputable opaque countRatProgram : Procedure scheduleCode ratCode (fun x => (x.1:ℚ)) := + Procedure.natToRat.comp (Procedure.unaryToBits.comp scheduleCountProgram) +noncomputable opaque sixCountProgram : Procedure scheduleCode ratCode (fun x => 6*(x.1:ℚ)) := + Procedure.ratMul.comp ((Procedure.constant scheduleCode ratCode 6).pair countRatProgram) +noncomputable opaque termCountProgram : Procedure scheduleCode ratCode (fun x => 25*(x.2.2.length:ℚ)) := + Procedure.ratMul.comp ((Procedure.constant scheduleCode ratCode 25).pair scheduleLengthRatProgram) +noncomputable opaque edgeCountProgram : Procedure scheduleCode ratCode + (fun x => 6*(x.1:ℚ)+25*(x.2.2.length:ℚ)) := + Procedure.ratAdd.comp (sixCountProgram.pair termCountProgram) +noncomputable opaque crossBudgetProgram : Procedure scheduleCode ratCode + (fun x => 1568*|scale x.2.1 x.2.2| *(1+size x.2.2)) := + Procedure.ratMul.comp ((Procedure.ratMul.comp + ((Procedure.constant scheduleCode ratCode 1568).pair absoluteScaleProgram)).pair + (Procedure.ratAdd.comp ((Procedure.constant scheduleCode ratCode 1).pair sizeProgram))) +noncomputable opaque fieldBudgetProgram : Procedure scheduleCode ratCode (fun x => 26064*size x.2.2) := + Procedure.ratMul.comp ((Procedure.constant scheduleCode ratCode 26064).pair sizeProgram) +noncomputable opaque matrixBudgetProgram : Procedure scheduleCode ratCode + (fun x => 3*(6*(x.1:ℚ)+25*(x.2.2.length:ℚ))* + (1568*|scale x.2.1 x.2.2| *(1+size x.2.2)+26064*size x.2.2)) := + Procedure.ratMul.comp ((Procedure.ratMul.comp + ((Procedure.constant scheduleCode ratCode 3).pair edgeCountProgram)).pair + (Procedure.ratAdd.comp (crossBudgetProgram.pair fieldBudgetProgram))) +noncomputable opaque scalarBudgetProgram : Procedure scheduleCode ratCode (fun x => 320800*mass x.2.2) := + Procedure.ratMul.comp ((Procedure.constant scheduleCode ratCode 320800).pair scheduleMassProgram) +noncomputable opaque errorBoundProgram : Procedure scheduleCode ratCode errorBound := + Procedure.ratAdd.comp (matrixBudgetProgram.pair scalarBudgetProgram) +noncomputable opaque bitsProgram : Procedure scheduleCode unaryCode bits := + QuantumAxisSample.precisionProgram.comp (errorBoundProgram.pair accuracyProgram) +noncomputable opaque scheduledProgram : Procedure scheduleCode fullCode scheduled := + scheduleCountProgram.pair ((bitsProgram.pair scheduleScaleProgram).pair scheduleTermsProgram) +noncomputable opaque compileProgram : Procedure scheduleCode (prodCode (listCode bondCode) ratCode) compile := + (fullBondsProgram.pair fullScalarProgram).comp scheduledProgram +noncomputable def compileCertificate : Turing.TM2ComputableInPolyTime scheduleCode + (prodCode (listCode bondCode) ratCode) compile := compileProgram.toTM2 + +end ContinuumCoulomb.QuantumRawExchange + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawTermProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawTermProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..6e0aa98d6633e2360bd707b1d8d0aef83bf63669 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRawTermProgram.lean @@ -0,0 +1,83 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawProgram + +namespace OAI + +/-! Complete polynomial evaluation of each rational X/Z instruction. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumRawExchange +open QuantumAxisSample MediatorListProgram ExactQuantumFactoring.BitStackProgram + +noncomputable opaque counterLeftCoefficientProgram (e : Fin 3) : Procedure inputCode ratCode + (fun x => fieldValue x.1.1 (axis x.2.2.2.1.1) + (counterA x.1.1 (axis x.2.2.2.1.1) (axis x.2.2.2.1.2) x.2.2.2.2) e) := + selectAxis axisLeftProgram (fun a => selectAxis axisRightProgram + (fun b => (counterFieldAProgram a b e).comp radialProgram)) + +noncomputable opaque counterRightCoefficientProgram (e : Fin 3) : Procedure inputCode ratCode + (fun x => fieldValue x.1.1 (axis x.2.2.2.1.2) + (counterB x.1.1 (axis x.2.2.2.1.1) (axis x.2.2.2.1.2) x.2.2.2.2) e) := + selectAxis axisLeftProgram (fun a => selectAxis axisRightProgram + (fun b => (counterFieldBProgram a b e).comp radialProgram)) + +noncomputable opaque counterLeftBondProgram (e : Fin 3) : Procedure inputCode bondCode + (fun x => (4*x.2.2.1.1,4*x.2.2.1.1+(qmaFieldEdgeRight e).val, + fieldValue x.1.1 (axis x.2.2.2.1.1) + (counterA x.1.1 (axis x.2.2.2.1.1) (axis x.2.2.2.1.2) x.2.2.2.2) e)) := + baseLeftProgram.pair ((shiftedLeftProgram _).pair (counterLeftCoefficientProgram e)) + +noncomputable opaque counterRightBondProgram (e : Fin 3) : Procedure inputCode bondCode + (fun x => (4*x.2.2.1.2,4*x.2.2.1.2+(qmaFieldEdgeRight e).val, + fieldValue x.1.1 (axis x.2.2.2.1.2) + (counterB x.1.1 (axis x.2.2.2.1.1) (axis x.2.2.2.1.2) x.2.2.2.2) e)) := + baseRightProgram.pair ((shiftedRightProgram _).pair (counterRightCoefficientProgram e)) + +noncomputable opaque counterLeftProgram : Procedure inputCode (listCode bondCode) + (fun x => field x.1.1 x.2.2.1.1 (axis x.2.2.2.1.1) + (counterA x.1.1 (axis x.2.2.2.1.1) (axis x.2.2.2.1.2) x.2.2.2.2)) := + fixedListProgram inputCode bondCode 3 _ counterLeftBondProgram + +noncomputable opaque counterRightProgram : Procedure inputCode (listCode bondCode) + (fun x => field x.1.1 x.2.2.1.2 (axis x.2.2.2.1.2) + (counterB x.1.1 (axis x.2.2.2.1.1) (axis x.2.2.2.1.2) x.2.2.2.2)) := + fixedListProgram inputCode bondCode 3 _ counterRightBondProgram + +noncomputable opaque pairProgram : Procedure inputCode (listCode bondCode) + (fun x => cross x.1.1 x.1.2 x.2.2.1.1 x.2.2.1.2 + (axis x.2.2.2.1.1) (axis x.2.2.2.1.2) x.2.2.2.2 ++ + field x.1.1 x.2.2.1.1 (axis x.2.2.2.1.1) + (counterA x.1.1 (axis x.2.2.2.1.1) (axis x.2.2.2.1.2) x.2.2.2.2) ++ + field x.1.1 x.2.2.1.2 (axis x.2.2.2.1.2) + (counterB x.1.1 (axis x.2.2.2.1.1) (axis x.2.2.2.1.2) x.2.2.2.2)) := + (Procedure.listAppend bondCode zeroBond).comp + (((Procedure.listAppend bondCode zeroBond).comp (crossProgram.pair counterLeftProgram)).pair + counterRightProgram) + +noncomputable opaque bondsProgram : Procedure inputCode (listCode bondCode) bonds := + (Procedure.conditional pairFlagProgram pairProgram + (Procedure.conditional fieldFlagProgram fieldProgram (Procedure.constant inputCode (listCode bondCode) []))).congrFun + (by intro x; rfl) + +noncomputable opaque offsetProgram : Procedure inputCode ratCode + (fun x => offset x.1.1 (axis x.2.2.2.1.1) (axis x.2.2.2.1.2) x.2.2.2.2) := + selectAxis axisLeftProgram (fun a => selectAxis axisRightProgram + (fun b => (QuantumAxisSample.offsetProgram a b).comp radialProgram)) + +noncomputable opaque fieldShiftProgram : Procedure inputCode ratCode + (fun x => shiftValue (axis x.2.2.2.1.1) x.2.2.2.2) := + selectAxis axisLeftProgram (fun a => (shiftValueProgram a).comp weightProgram) + +noncomputable opaque scalarProgram : Procedure inputCode ratCode scalar := + (Procedure.conditional pairFlagProgram (Procedure.ratNeg.comp offsetProgram) + (Procedure.conditional fieldFlagProgram (Procedure.ratNeg.comp fieldShiftProgram) weightProgram)).congrFun + (by intro x; rfl) + +noncomputable def termCertificate : Turing.TM2ComputableInPolyTime inputCode + (prodCode (listCode bondCode) ratCode) (fun x => (bonds x,scalar x)) := + (bondsProgram.pair scalarProgram).toTM2 + +end ContinuumCoulomb.QuantumRawExchange + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRealCircuit.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRealCircuit.lean new file mode 100644 index 0000000000000000000000000000000000000000..06d8eb9ca1067158e12ce133da1a51c3406c7d21 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRealCircuit.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRebitSoundness + +namespace OAI + +/-! An entirely real circuit Hamiltonian with the same verified promise gap. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators + +abbrev QMARealBasis (c : QMACircuit) := Fin 2 × QMAUnaryBasis c + +def qmaRealHamiltonian (c : QMACircuit) : Matrix (QMARealBasis c) (QMARealBasis c) ℂ := + qmaRebitMatrix (qmaUnaryHamiltonian c) + +theorem qmaRealHamiltonian_hermitian (c : QMACircuit) : (qmaRealHamiltonian c).IsHermitian := + qmaRebitMatrix_hermitian _ (qmaUnaryHamiltonian_hermitian c) + +theorem qmaRealHamiltonian_real (c : QMACircuit) (p q : QMARealBasis c) : + (qmaRealHamiltonian c p q).im = 0 := qmaRebitMatrix_real _ p q + +theorem qmaRealHamiltonian_sound (c : QMACircuit) (hc : c.WellFormed) + (hsound : ∀ psi : EuclideanSpace ℂ (SourceSpinBasis c.witness), + ‖psi‖ = 1 → qmaAcceptance c hc psi ≤ 1/3) + (u : EuclideanSpace ℂ (QMARealBasis c)) : + 2*‖u‖^2 ≤ 5*(c.gates.length+1:ℝ)* + qmaQuadratic (qmaRealHamiltonian c) (fun p => u p) := by + have hA (v : QMAUnaryBasis c → ℂ) : + 2*(∑ p, Complex.normSq (v p)) ≤ 5*(c.gates.length+1:ℝ)* + qmaQuadratic (qmaUnaryHamiltonian c) v := by + have h := qmaUnaryHamiltonian_sound c hc hsound (WithLp.toLp 2 v) + simpa only [EuclideanSpace.norm_sq_eq,Complex.sq_norm,PiLp.toLp_apply] using h + have h := qmaRebitMatrix_lower (qmaUnaryHamiltonian c) 2 + (5*(c.gates.length+1:ℝ)) hA (fun p => u p) + simpa only [EuclideanSpace.norm_sq_eq,Complex.sq_norm,qmaRealHamiltonian] using h + +theorem qmaRealHamiltonian_accepting (c : QMACircuit) (hc : c.WellFormed) + (psi : EuclideanSpace ℂ (SourceSpinBasis c.witness)) (hpsi : ‖psi‖ = 1) + (hacc : 2/3 ≤ qmaAcceptance c hc psi) : + ∃ u : EuclideanSpace ℂ (QMARealBasis c), ‖u‖ = 1 ∧ + 3*(c.gates.length+1:ℝ)*qmaQuadratic (qmaRealHamiltonian c) (fun p => u p) ≤ 1 := by + obtain ⟨v,hv,he⟩ := qmaUnaryHamiltonian_accepting c hc psi hpsi hacc + let u : EuclideanSpace ℂ (QMARealBasis c) := WithLp.toLp 2 (qmaRebitVector (fun p => v p)) + have hu : ‖u‖ = 1 := by + apply (sq_eq_sq₀ (norm_nonneg _) (by norm_num : (0:ℝ) ≤ 1)).mp + rw [EuclideanSpace.norm_sq_eq] + change (∑ p, ‖qmaRebitVector (fun p => v p) p‖^2) = 1^2 + simp only [Complex.sq_norm] + rw [qmaRebitVector_mass] + have hv2 : ‖v‖^2 = (1:ℝ)^2 := by rw [hv] + rw [EuclideanSpace.norm_sq_eq] at hv2 + simpa only [Complex.sq_norm] using hv2 + refine ⟨u,hu,?_⟩ + change 3*(c.gates.length+1:ℝ)*qmaQuadratic (qmaRebitMatrix (qmaUnaryHamiltonian c)) + (qmaRebitVector (fun p => v p)) ≤ 1 + rw [qmaRebitMatrix_quadratic] + exact he + +theorem qmaRealBasis_card (c : QMACircuit) : + Fintype.card (QMARealBasis c) = 2^(c.gates.length+c.work+4) := by + calc + Fintype.card (QMARealBasis c) = 2*Fintype.card (QMAUnaryBasis c) := by + rw [Fintype.card_prod,Fintype.card_fin] + _ = 2*2^(c.gates.length+c.work+3) := by rw [qmaUnaryBasis_card] + _ = 2^(c.gates.length+c.work+3)*2 := mul_comm _ _ + _ = 2^((c.gates.length+c.work+3)+1) := (pow_succ _ _).symm + _ = 2^(c.gates.length+c.work+4) := by congr 1 + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRealLocalFamily.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRealLocalFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..1a32ef89834fa2cf464ddb86aed88c20d4f14cf4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRealLocalFamily.lean @@ -0,0 +1,91 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCoordinateSpectrum + +namespace OAI + +/-! A real Hermitian six-local circuit Hamiltonian, with explicit linear +term count and the proved complete Hilbert-space promise gap. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +theorem qmaRebitOnQubits_zero {ι : Type*} : + qmaRebitOnQubits (0 : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) = 0 := by + ext s t + simp [qmaRebitOnQubits,qmaRebitMatrix] + +theorem qmaRebitOnQubits_sum {ι κ : Type*} [Fintype κ] + (A : κ → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) : + qmaRebitOnQubits (∑ i, A i) = ∑ i, qmaRebitOnQubits (A i) := by + have hs (s : Finset κ) : qmaRebitOnQubits (∑ i ∈ s, A i) = + ∑ i ∈ s, qmaRebitOnQubits (A i) := by + induction s using Finset.induction_on with + | empty => simp [qmaRebitOnQubits_zero] + | @insert a s ha ih => simp only [Finset.sum_insert ha,qmaRebitOnQubits_add,ih] + exact hs Finset.univ + +theorem qmaRebitOnQubits_hermitian {ι : Type*} + (A : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (hA : A.IsHermitian) : + (qmaRebitOnQubits A).IsHermitian := + (qmaRebitMatrix_hermitian A hA).submatrix (fun s : Unit ⊕ ι → Fin 2 => (s (Sum.inl ()),s ∘ Sum.inr)) + +def qmaRealCircuitTermSites (c : QMACircuit) (i : QMACircuitTerm c) := + qmaRebitSites (qmaCircuitTermSites c i) + +def qmaRealCircuitTermMatrix (c : QMACircuit) (i : QMACircuitTerm c) := + qmaRebitOnQubits (qmaCircuitTermMatrix c i) + +theorem qmaRealCircuitTerm_local (c : QMACircuit) (i : QMACircuitTerm c) : + QMALocalOn (qmaRealCircuitTermSites c i) (qmaRealCircuitTermMatrix c i) := + qmaRebitOnQubits_local (qmaCircuitTerm_local c i) + +theorem qmaRealCircuitTerm_support_card (c : QMACircuit) (i : QMACircuitTerm c) : + (qmaRealCircuitTermSites c i).card ≤ 6 := by + have h := qmaCircuitTerm_support_card c i + change (qmaRebitSites (qmaCircuitTermSites c i)).card ≤ 6 + rw [qmaRebitSites_card] + omega + +theorem qmaRealCircuitTerm_hermitian (c : QMACircuit) (i : QMACircuitTerm c) : + (qmaRealCircuitTermMatrix c i).IsHermitian := + qmaRebitOnQubits_hermitian _ (qmaCircuitTerm_hermitian c i) + +theorem qmaRealCircuitTerm_real (c : QMACircuit) (i : QMACircuitTerm c) + (s t : Unit ⊕ QMACircuitQubit c → Fin 2) : + (qmaRealCircuitTermMatrix c i s t).im = 0 := qmaRebitMatrix_real _ _ _ + +theorem qmaRealCircuitTerm_sum (c : QMACircuit) : + (∑ i : QMACircuitTerm c, qmaRealCircuitTermMatrix c i) = qmaRealQubitHamiltonian c := by + change (∑ i, qmaRebitOnQubits (qmaCircuitTermMatrix c i)) = _ + rw [←qmaRebitOnQubits_sum,qmaCircuitTerm_sum] + rfl + +theorem qmaRealCircuitTerm_sound (c : QMACircuit) (hc : c.WellFormed) + (hsound : ∀ psi : EuclideanSpace ℂ (SourceSpinBasis c.witness), + ‖psi‖ = 1 → qmaAcceptance c hc psi ≤ 1/3) + (u : EuclideanSpace ℂ (Unit ⊕ QMACircuitQubit c → Fin 2)) : + 2*‖u‖^2 ≤ 5*(c.gates.length+1:ℝ)* + qmaQuadratic (∑ i, qmaRealCircuitTermMatrix c i) (fun p => u p) := by + rw [qmaRealCircuitTerm_sum] + exact qmaRealQubitHamiltonian_sound c hc hsound u + +theorem qmaRealCircuitQubit_card (c : QMACircuit) : + Fintype.card (Unit ⊕ QMACircuitQubit c) = c.gates.length+c.work+4 := by + simp only [QMACircuitQubit,Fintype.card_sum,Fintype.card_unit,Fintype.card_fin] + omega + +theorem qmaRealCircuitTerm_accepting (c : QMACircuit) (hc : c.WellFormed) + (psi : EuclideanSpace ℂ (SourceSpinBasis c.witness)) (hpsi : ‖psi‖ = 1) + (hacc : 2/3 ≤ qmaAcceptance c hc psi) : + ∃ u : EuclideanSpace ℂ (Unit ⊕ QMACircuitQubit c → Fin 2), ‖u‖ = 1 ∧ + 3*(c.gates.length+1:ℝ)*qmaQuadratic (∑ i, qmaRealCircuitTermMatrix c i) + (fun p => u p) ≤ 1 := by + rw [qmaRealCircuitTerm_sum] + exact qmaRealQubitHamiltonian_accepting c hc psi hpsi hacc + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRealification.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRealification.lean new file mode 100644 index 0000000000000000000000000000000000000000..abdc1dd27b69152cdbafe7533958eb9a6c0a8bde --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRealification.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnarySpectrum + +namespace OAI + +/-! One extra real qubit represents the real and imaginary coordinates of +an arbitrary complex Hamiltonian without changing its quadratic energy. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators + +def qmaRebitMatrix {ι : Type*} (A : Matrix ι ι ℂ) : Matrix (Fin 2 × ι) (Fin 2 × ι) ℂ := + fun p q => if p.1 = q.1 then (A p.2 q.2).re else + if p.1 = 0 then -(A p.2 q.2).im else (A p.2 q.2).im + +def qmaRebitVector {ι : Type*} (u : ι → ℂ) : Fin 2 × ι → ℂ := + fun p => if p.1 = 0 then (u p.2).re else (u p.2).im + +theorem qmaRebitMatrix_real {ι : Type*} (A : Matrix ι ι ℂ) (p q : Fin 2 × ι) : + (qmaRebitMatrix A p q).im = 0 := by + simp only [qmaRebitMatrix] + split + · rfl + · split <;> simp + +theorem qmaRebitMatrix_hermitian {ι : Type*} (A : Matrix ι ι ℂ) (hA : A.IsHermitian) : + (qmaRebitMatrix A).IsHermitian := by + apply Matrix.IsHermitian.ext + rintro ⟨a,i⟩ ⟨b,j⟩ + have h := hA.apply i j + have hr : (A j i).re = (A i j).re := by simpa using congrArg Complex.re h + have hi : -(A j i).im = (A i j).im := by simpa using congrArg Complex.im h + fin_cases a <;> fin_cases b <;> simp [qmaRebitMatrix,hr] + · exact_mod_cast (show (A j i).im = -(A i j).im by linarith) + · exact_mod_cast hi + +theorem qmaRebitVector_mass {ι : Type*} [Fintype ι] (u : ι → ℂ) : + (∑ p : Fin 2 × ι, Complex.normSq (qmaRebitVector u p)) = ∑ i, Complex.normSq (u i) := by + simp [qmaRebitVector,Fintype.sum_prod_type,Fin.sum_univ_two,Complex.normSq_apply, + Finset.sum_add_distrib] + +theorem qmaRebitVector_inner {ι : Type*} [Fintype ι] (u v : ι → ℂ) : + (star (qmaRebitVector u) ⬝ᵥ qmaRebitVector v).re = (star u ⬝ᵥ v).re := by + simp [qmaRebitVector,dotProduct,Fintype.sum_prod_type,Fin.sum_univ_two, + Complex.re_sum,Complex.mul_re,Finset.sum_add_distrib] + +theorem qmaRebitMatrix_mulVec {ι : Type*} [Fintype ι] (A : Matrix ι ι ℂ) (u : ι → ℂ) : + (qmaRebitMatrix A).mulVec (qmaRebitVector u) = qmaRebitVector (A.mulVec u) := by + funext p + rcases p with ⟨b,i⟩ + fin_cases b <;> apply Complex.ext <;> + simp [qmaRebitMatrix,qmaRebitVector,Matrix.mulVec,dotProduct,Fintype.sum_prod_type, + Fin.sum_univ_two,Complex.re_sum,Complex.im_sum,Complex.mul_re,Complex.mul_im, + Finset.sum_add_distrib,Finset.sum_sub_distrib] + all_goals ring + +theorem qmaRebitMatrix_quadratic {ι : Type*} [Fintype ι] (A : Matrix ι ι ℂ) (u : ι → ℂ) : + qmaQuadratic (qmaRebitMatrix A) (qmaRebitVector u) = qmaQuadratic A u := by + rw [qmaQuadratic,qmaRebitMatrix_mulVec,qmaRebitVector_inner] + rfl + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRebitDiagonal.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRebitDiagonal.lean new file mode 100644 index 0000000000000000000000000000000000000000..581a035b9431129dd0b8147ec9dcca06e2451fbc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRebitDiagonal.lean @@ -0,0 +1,101 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryDiagonal + +namespace OAI + +/-! A real diagonal term remains diagonal under the reference-spin rebit +construction. These entry identities avoid any sum over spectators. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumHistoryDiagonal +open QuantumAlgebraicHistory QuantumAlgebraicScalar +open scoped Classical + +theorem rebit_rat_entry {ι : Type} [Fintype ι] [DecidableEq ι] + (n : ℕ) (i : Fin n) (A : Matrix (ι → Fin 2) (ι → Fin 2) Scalar) + (s t : Fin n ⊕ ι → Fin 2) (q : ℚ) + (hA : A (s ∘ Sum.inr) (t ∘ Sum.inr)=rat q) : + rebit n i A s t = if s ∘ Sum.inl=t ∘ Sum.inl then rat q else rat 0 := by + by_cases h : s ∘ Sum.inl=t ∘ Sum.inl + · simp [rebit,hA,identity,h,rat,realRat,QuantumAlgebraicScalar.realPart,imagPart,mul,add,neg, + realAdd,realSub,realNeg,realMul,imaginary] + · simp [rebit,hA,identity,h,rat,realRat,QuantumAlgebraicScalar.realPart,imagPart,mul,add,neg, + realAdd,realSub,realNeg,realMul,imaginary] + +theorem rebit_diagonal_entry {ι : Type} [Fintype ι] [DecidableEq ι] + (n : ℕ) (i : Fin n) (A : Matrix (ι → Fin 2) (ι → Fin 2) Scalar) + (s t : Fin n ⊕ ι → Fin 2) (q : ℚ) + (hA : A (s ∘ Sum.inr) (t ∘ Sum.inr)= + if s ∘ Sum.inr=t ∘ Sum.inr then rat q else rat 0) : + rebit n i A s t = if s=t then rat q else rat 0 := by + by_cases hb : s ∘ Sum.inr=t ∘ Sum.inr + · rw [ite_eq_left hb] at hA + rw [rebit_rat_entry n i A s t q hA] + have he : (s ∘ Sum.inl=t ∘ Sum.inl) ↔ s=t := by + constructor + · intro hr + funext a + cases a with + | inl a => exact congrFun hr a + | inr a => exact congrFun hb a + · intro h + exact congrArg (fun f => f ∘ Sum.inl) h + simp only [he] + · rw [ite_eq_right hb] at hA + rw [rebit_rat_entry n i A s t 0 hA] + have hne : s≠t := fun h => hb (congrArg (fun f => f ∘ Sum.inr) h) + simp [hne] + +def orderedExtend (c : QMACircuit) (hT : 0 s ((QuantumOrderedSupport.supportEquiv c hT a).symm j)) + +theorem orderedExtend_at (c : QMACircuit) (hT : 0 if j=i then a else 0 + +theorem referenceState_eq_iff (n : ℕ) (i : Fin n) (a b : Fin 2) : + referenceState n i a=referenceState n i b ↔ a=b := by + constructor + · intro h + simpa only [referenceState,ite_true] using congrFun h i + · rintro rfl + rfl + +theorem reference_identity (n : ℕ) (i : Fin n) (a b : Fin 2) : + identity (referenceState n i a) (referenceState n i b)=identity a b := by + simp only [identity,referenceState_eq_iff] + +theorem localY_referenceState (n : ℕ) (i : Fin n) (a b : Fin 2) : + localY n i (referenceState n i a) (referenceState n i b)= + QuantumFixedPauli.pauli 2 a b := by + apply value_injective + rw [value_localY,value_pauli] + change sourceLocalPauli n i 1 (referenceState n i a) (referenceState n i b)= + ContinuumCoulomb.pauli 1 a b + unfold sourceLocalPauli sourceTensor + rw [Finset.prod_eq_single i] + · simp only [ite_true,referenceState,ite_true] + · intro j _ hji + simp only [hji,ite_false,referenceState,Matrix.one_apply,ite_true] + · simp + +theorem lift_extend {ι : Type} [Fintype ι] [DecidableEq ι] (S : Finset ι) + (A : Matrix (QMASupportBasis S) (QMASupportBasis S) Scalar) + (u v : QMASupportBasis S) : + lift S A (qmaSupportExtend S u) (qmaSupportExtend S v)=A u v := by + have hu : (fun j : {j // j∈S} => qmaSupportExtend S u j.val)=u := by + funext j + exact dite_eq_left j.property + have hv : (fun j : {j // j∈S} => qmaSupportExtend S v j.val)=v := by + funext j + exact dite_eq_left j.property + have he : (fun j : {j // j∉S} => qmaSupportExtend S u j.val)= + (fun j : {j // j∉S} => qmaSupportExtend S v j.val) := by + funext j + have hu0 : qmaSupportExtend S u j.val=0 := dite_eq_right j.property + have hv0 : qmaSupportExtend S v j.val=0 := dite_eq_right j.property + exact hu0.trans hv0.symm + simp only [lift,hu,hv,identity,ite_eq_left he] + apply value_injective + simp only [value_mul,value_rat,Rat.cast_one,mul_one] + +def oneReference (a b : Fin 2) (z : Scalar) : Scalar := + add (mul (identity a b) (QuantumAlgebraicScalar.realPart z)) + (mul (neg imaginary) (mul (QuantumFixedPauli.pauli 2 a b) (imagPart z))) + +theorem rebit_entry_of_references {ι : Type} [Fintype ι] [DecidableEq ι] + (n : ℕ) (i : Fin n) (A : Matrix (ι → Fin 2) (ι → Fin 2) Scalar) + (s t : Fin n ⊕ ι → Fin 2) (a b : Fin 2) + (hs : s ∘ Sum.inl=referenceState n i a) + (ht : t ∘ Sum.inl=referenceState n i b) : + rebit n i A s t=oneReference a b (A (s ∘ Sum.inr) (t ∘ Sum.inr)) := by + simp only [rebit,hs,ht,reference_identity,localY_referenceState,oneReference] + +theorem rebit_lift_entry {ι : Type} [Fintype ι] [DecidableEq ι] + (n : ℕ) (i : Fin n) (S : Finset ι) + (A : Matrix (QMASupportBasis S) (QMASupportBasis S) Scalar) + (a b : Fin 2) (u v : QMASupportBasis S) : + rebit n i (lift S A) + (Sum.elim (referenceState n i a) (qmaSupportExtend S u)) + (Sum.elim (referenceState n i b) (qmaSupportExtend S v))= + oneReference a b (A u v) := by + change add (mul (identity (referenceState n i a) (referenceState n i b)) + (QuantumAlgebraicScalar.realPart (lift S A (qmaSupportExtend S u) (qmaSupportExtend S v)))) + (mul (neg imaginary) (mul (localY n i (referenceState n i a) (referenceState n i b)) + (imagPart (lift S A (qmaSupportExtend S u) (qmaSupportExtend S v)))))=_ + rw [lift_extend,reference_identity,localY_referenceState] + rfl + +end ContinuumCoulomb.QuantumAlgebraicHistory + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRebitSoundness.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRebitSoundness.lean new file mode 100644 index 0000000000000000000000000000000000000000..f00ea88b85fa49a1a970f8318b4f50f2789b7756 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRebitSoundness.lean @@ -0,0 +1,70 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRealification + +namespace OAI + +/-! Realification preserves lower quadratic bounds on all complex vectors, +not only on the real-coordinate encoding of a witness. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators + +def qmaRealVector {ι : Type*} (u : ι → ℂ) : ι → ℂ := fun i => (u i).re + +def qmaImagVector {ι : Type*} (u : ι → ℂ) : ι → ℂ := fun i => (u i).im + +theorem qmaQuadratic_real_split {ι : Type*} [Fintype ι] (M : Matrix ι ι ℂ) + (hM : ∀ i j, (M i j).im = 0) (u : ι → ℂ) : + qmaQuadratic M u = qmaQuadratic M (qmaRealVector u)+qmaQuadratic M (qmaImagVector u) := by + simp [qmaQuadratic,qmaRealVector,qmaImagVector,Matrix.mulVec,dotProduct, + Complex.re_sum,Complex.mul_re,Complex.mul_im,hM, + Finset.sum_add_distrib,Finset.mul_sum] + +def qmaUnrebitReal {ι : Type*} (v : Fin 2 × ι → ℂ) : ι → ℂ := + fun i => ⟨(v (0,i)).re,(v (1,i)).re⟩ + +def qmaUnrebitImag {ι : Type*} (v : Fin 2 × ι → ℂ) : ι → ℂ := + fun i => ⟨(v (0,i)).im,(v (1,i)).im⟩ + +theorem qmaRebitVector_unrebitReal {ι : Type*} (v : Fin 2 × ι → ℂ) : + qmaRebitVector (qmaUnrebitReal v) = qmaRealVector v := by + funext p + rcases p with ⟨b,i⟩ + fin_cases b <;> simp [qmaRebitVector,qmaUnrebitReal,qmaRealVector] + +theorem qmaRebitVector_unrebitImag {ι : Type*} (v : Fin 2 × ι → ℂ) : + qmaRebitVector (qmaUnrebitImag v) = qmaImagVector v := by + funext p + rcases p with ⟨b,i⟩ + fin_cases b <;> simp [qmaRebitVector,qmaUnrebitImag,qmaImagVector] + +theorem qmaRebitMatrix_quadratic_split {ι : Type*} [Fintype ι] (A : Matrix ι ι ℂ) + (v : Fin 2 × ι → ℂ) : + qmaQuadratic (qmaRebitMatrix A) v = + qmaQuadratic A (qmaUnrebitReal v)+qmaQuadratic A (qmaUnrebitImag v) := by + rw [qmaQuadratic_real_split _ (qmaRebitMatrix_real A), + ←qmaRebitVector_unrebitReal,←qmaRebitVector_unrebitImag, + qmaRebitMatrix_quadratic,qmaRebitMatrix_quadratic] + +theorem qmaRebitVector_mass_split {ι : Type*} [Fintype ι] (v : Fin 2 × ι → ℂ) : + (∑ p, Complex.normSq (v p)) = + (∑ i, Complex.normSq (qmaUnrebitReal v i))+ + ∑ i, Complex.normSq (qmaUnrebitImag v i) := by + simp [qmaUnrebitReal,qmaUnrebitImag,Fintype.sum_prod_type,Fin.sum_univ_two, + Complex.normSq_apply,Finset.sum_add_distrib] + +theorem qmaRebitMatrix_lower {ι : Type*} [Fintype ι] (A : Matrix ι ι ℂ) (C D : ℝ) + (hA : ∀ u : ι → ℂ, C*(∑ i, Complex.normSq (u i)) ≤ D*qmaQuadratic A u) + (v : Fin 2 × ι → ℂ) : + C*(∑ p, Complex.normSq (v p)) ≤ D*qmaQuadratic (qmaRebitMatrix A) v := by + rw [qmaRebitVector_mass_split,qmaRebitMatrix_quadratic_split] + have hr := hA (qmaUnrebitReal v) + have hi := hA (qmaUnrebitImag v) + nlinarith + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRectangularOperator.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRectangularOperator.lean new file mode 100644 index 0000000000000000000000000000000000000000..3000255f097d80e16b7d180352c1deb2d98cc5ec --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRectangularOperator.lean @@ -0,0 +1,98 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorNorm + +namespace OAI + +/-! Rectangular Euclidean operators for the actual mediator columns. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker InnerProductSpace Classical + +variable {α β γ : Type*} [Fintype α] [Fintype β] [Fintype γ] + +def qmaMatrixOperator (M : Matrix α β ℂ) : EuclideanSpace ℂ β →L[ℂ] EuclideanSpace ℂ α := + LinearMap.toContinuousLinearMap M.toEuclideanLin + +@[simp] theorem qmaMatrixOperator_apply (M : Matrix α β ℂ) (x : EuclideanSpace ℂ β) (a : α) : + qmaMatrixOperator M x a = ∑ b, M a b*x b := rfl + +theorem qmaMatrixOperator_add (M N : Matrix α β ℂ) : + qmaMatrixOperator (M+N) = qmaMatrixOperator M+qmaMatrixOperator N := by + unfold qmaMatrixOperator + rw [map_add,map_add] + +theorem qmaMatrixOperator_smul (c : ℂ) (M : Matrix α β ℂ) : + qmaMatrixOperator (c • M) = c • qmaMatrixOperator M := by + unfold qmaMatrixOperator + rw [map_smul,map_smul] + +theorem qmaMatrixOperator_sum {δ : Type*} (s : Finset δ) (M : δ → Matrix α β ℂ) : + qmaMatrixOperator (∑ a ∈ s, M a) = ∑ a ∈ s, qmaMatrixOperator (M a) := by + unfold qmaMatrixOperator + rw [map_sum,map_sum] + +theorem qmaMatrixOperator_mul [DecidableEq γ] (M : Matrix α β ℂ) (N : Matrix β γ ℂ) : + qmaMatrixOperator (M*N) = (qmaMatrixOperator M).comp (qmaMatrixOperator N) := by + ext x a + change Matrix.toLpLin 2 2 (M*N) x a = Matrix.toLpLin 2 2 M (Matrix.toLpLin 2 2 N x) a + rw [Matrix.toLpLin_mul_same,LinearMap.comp_apply] + +theorem qmaMatrixOperator_star (M : Matrix α β ℂ) : + qmaMatrixOperator M.conjTranspose = (qmaMatrixOperator M).adjoint := by + unfold qmaMatrixOperator + rw [Matrix.toEuclideanLin_conjTranspose_eq_adjoint,LinearMap.adjoint_toContinuousLinearMap] + +theorem qmaMatrixOperator_square [DecidableEq α] (M : Matrix α α ℂ) : + qmaMatrixOperator M = spinMatrixOperator M := rfl + +theorem qmaEuclidean_real_inner (x y : EuclideanSpace ℂ α) : + ⟪x,y⟫_ℝ = (⟪x,y⟫_ℂ).re := by + simp only [PiLp.inner_apply,Complex.re_sum] + apply Finset.sum_congr rfl + intro a _ + rfl + +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] +variable [DecidableEq α] + +theorem qmaSliceColumn_operator_norm_map (a : α) (M : Matrix σ σ ℂ) + (x : EuclideanSpace ℂ σ) : + ‖qmaMatrixOperator (qmaSliceColumn a M) x‖ = ‖spinMatrixOperator M x‖ := by + apply (sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)).mp + simp only [EuclideanSpace.norm_sq_eq,Fintype.sum_prod_type,qmaMatrixOperator_apply,qmaSliceColumn] + have hentry (s : σ) (b : α) : + (∑ t, (if b = a then M s t else 0)*x t) = + if b = a then spinMatrixOperator M x s else 0 := by + by_cases hb : b = a <;> simp [hb,spinMatrixOperator_apply] + simp only [hentry] + simp [apply_ite] + +theorem qmaSliceColumn_operator_norm (a : α) (M : Matrix σ σ ℂ) : + ‖qmaMatrixOperator (qmaSliceColumn a M)‖ ≤ ‖spinMatrixOperator M‖ := by + apply ContinuousLinearMap.opNorm_le_bound _ (norm_nonneg _) + intro x + rw [qmaSliceColumn_operator_norm_map] + exact (spinMatrixOperator M).le_opNorm x + +omit [DecidableEq κ] in +theorem qmaSliceFamily_operator_norm (a : κ → α) (V : κ → Matrix σ σ ℂ) : + ‖qmaMatrixOperator (∑ e, qmaSliceColumn (a e) (V e))‖ ≤ + ∑ e, ‖spinMatrixOperator (V e)‖ := by + rw [qmaMatrixOperator_sum] + calc + _ ≤ ∑ e, ‖qmaMatrixOperator (qmaSliceColumn (a e) (V e))‖ := norm_sum_le _ _ + _ ≤ _ := by + apply Finset.sum_le_sum + intro e _ + exact qmaSliceColumn_operator_norm (a e) (V e) + +theorem qmaAncillaColumn_operator_norm (V : κ → Matrix σ σ ℂ) : + ‖qmaMatrixOperator (qmaAncillaColumn V)‖ ≤ ∑ e, ‖spinMatrixOperator (V e)‖ := + qmaSliceFamily_operator_norm qmaAncillaSingle V + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceBasis.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceBasis.lean new file mode 100644 index 0000000000000000000000000000000000000000..e2a35a1b86c0311067fe741dfe4555fd94e38dd5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceBasis.lean @@ -0,0 +1,79 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridLocality +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRealification + +namespace OAI + +/-! A local Y-eigenbasis for distributing the realification reference qubit. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped Kronecker Classical + +def qmaReferencePhase : Matrix (Fin 2) (Fin 2) ℂ := !![1,0;0,Complex.I] + +def qmaReferenceBasis : Matrix (Fin 2) (Fin 2) ℂ := qmaReferencePhase*qmaHadamard + +def qmaImaginaryRotation : Matrix (Fin 2) (Fin 2) ℂ := !![0,-1;1,0] + +theorem qmaReferencePhase_gram : qmaReferencePhase.conjTranspose*qmaReferencePhase = 1 := by + ext i j + fin_cases i <;> fin_cases j <;> + norm_num [qmaReferencePhase,Matrix.mul_apply,Matrix.conjTranspose_apply,Fin.sum_univ_two] + +theorem qmaReferenceBasis_gram : qmaReferenceBasis.conjTranspose*qmaReferenceBasis = 1 := by + simp only [qmaReferenceBasis,Matrix.conjTranspose_mul,mul_assoc] + rw [←mul_assoc qmaReferencePhase.conjTranspose,qmaReferencePhase_gram,one_mul,qmaHadamard_gram] + +theorem qmaReferenceBasis_y : + qmaReferenceBasis.conjTranspose*pauliY*qmaReferenceBasis = pauliZ := by + have hphase : qmaReferencePhase.conjTranspose*pauliY*qmaReferencePhase = pauliX := by + ext i j + fin_cases i <;> fin_cases j <;> + norm_num [qmaReferencePhase,pauliY,pauliX,Matrix.mul_apply, + Matrix.conjTranspose_apply,Fin.sum_univ_two] + have hhad : qmaHadamard.conjTranspose*pauliX*qmaHadamard = pauliZ := by + have hraw : (!![1,1;1,-1] : Matrix (Fin 2) (Fin 2) ℂ).conjTranspose* + pauliX*!![1,1;1,-1] = (2:ℂ) • pauliZ := by + ext i j + fin_cases i <;> fin_cases j <;> + norm_num [pauliX,pauliZ,Matrix.mul_apply,Matrix.conjTranspose_apply,Fin.sum_univ_two] + unfold qmaHadamard + rw [Matrix.conjTranspose_smul,bellScale_star,smul_mul_assoc,smul_mul_assoc, + mul_smul_comm,hraw,smul_smul,smul_smul] + rw [show bellScale*bellScale*2 = (1:ℂ) by rw [←pow_two,bellScale_sq]; norm_num] + exact one_smul _ _ + calc + _ = qmaHadamard.conjTranspose* + (qmaReferencePhase.conjTranspose*pauliY*qmaReferencePhase)*qmaHadamard := by + simp only [qmaReferenceBasis,Matrix.conjTranspose_mul,mul_assoc] + _ = _ := by rw [hphase,hhad] + +theorem qmaImaginaryRotation_eq : qmaImaginaryRotation = (-Complex.I) • pauliY := by + ext i j + fin_cases i <;> fin_cases j <;> norm_num [qmaImaginaryRotation,pauliY] + +theorem qmaReferenceBasis_rotation : + qmaReferenceBasis.conjTranspose*qmaImaginaryRotation*qmaReferenceBasis = + (-Complex.I) • pauliZ := by + rw [qmaImaginaryRotation_eq,mul_smul_comm,smul_mul_assoc,qmaReferenceBasis_y] + +def qmaEntryReal {ι : Type*} (A : Matrix ι ι ℂ) : Matrix ι ι ℂ := + fun i j => (A i j).re + +def qmaEntryImag {ι : Type*} (A : Matrix ι ι ℂ) : Matrix ι ι ℂ := + fun i j => (A i j).im + +theorem qmaRebitMatrix_tensor {ι : Type*} (A : Matrix ι ι ℂ) : + qmaRebitMatrix A = + (1 : Matrix (Fin 2) (Fin 2) ℂ) ⊗ₖ qmaEntryReal A + + qmaImaginaryRotation ⊗ₖ qmaEntryImag A := by + ext ⟨b,i⟩ ⟨c,j⟩ + fin_cases b <;> fin_cases c <;> + simp [qmaRebitMatrix,qmaEntryReal,qmaEntryImag,qmaImaginaryRotation] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceBlocks.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceBlocks.lean new file mode 100644 index 0000000000000000000000000000000000000000..4d27f219f4e49ac0d80d7802520ae06241447268 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceBlocks.lean @@ -0,0 +1,74 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumDistributedRebit + +namespace OAI + +/-! Exact sector decomposition for distributed realification. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical +variable {α : Type*} [Fintype α] [DecidableEq α] + +def qmaReferenceBlocks (n : ℕ) (B : SourceSpinBasis n → Matrix α α ℂ) : + Matrix (SourceSpinBasis n × α) (SourceSpinBasis n × α) ℂ := + fun p q => if p.1 = q.1 then B p.1 p.2 q.2 else 0 + +omit [DecidableEq α] in +theorem qmaReferenceBlocks_quadratic (n : ℕ) (B : SourceSpinBasis n → Matrix α α ℂ) + (u : SourceSpinBasis n × α → ℂ) : + qmaQuadratic (qmaReferenceBlocks n B) u = + ∑ s, qmaQuadratic (B s) (fun a => u (s,a)) := by + simp [qmaQuadratic,qmaReferenceBlocks,Matrix.mulVec,dotProduct,Fintype.sum_prod_type, + Complex.re_sum] + +omit [Fintype α] [DecidableEq α] in +theorem qmaReferenceBlocks_sum {κ : Type*} [Fintype κ] (n : ℕ) + (B : κ → SourceSpinBasis n → Matrix α α ℂ) : + qmaReferenceBlocks n (fun s => ∑ j, B j s) = ∑ j, qmaReferenceBlocks n (B j) := by + ext ⟨s,a⟩ ⟨t,b⟩ + by_cases h : s = t <;> simp [qmaReferenceBlocks,Matrix.sum_apply,h] + +omit [Fintype α] [DecidableEq α] in +theorem qmaReferenceBlocks_add (n : ℕ) (B C : SourceSpinBasis n → Matrix α α ℂ) : + qmaReferenceBlocks n (fun s => B s+C s) = qmaReferenceBlocks n B+qmaReferenceBlocks n C := by + ext ⟨s,a⟩ ⟨t,b⟩ + by_cases h : s = t <;> simp [qmaReferenceBlocks,h] + +def qmaConjugateMatrix (A : Matrix α α ℂ) : Matrix α α ℂ := + fun a b => star (A a b) + +def qmaReferenceSectorTerm (n : ℕ) (i : Fin n) (A : Matrix α α ℂ) + (s : SourceSpinBasis n) : Matrix α α ℂ := + if s i = 0 then qmaConjugateMatrix A else A + +theorem qmaDistributedRebitTerm_blocks (n : ℕ) (i : Fin n) (A : Matrix α α ℂ) : + (qmaReferenceExtension (α := α) n).conjTranspose*qmaDistributedRebitTerm n i A* + qmaReferenceExtension (α := α) n = + qmaReferenceBlocks n (qmaReferenceSectorTerm n i A) := by + ext ⟨s,a⟩ ⟨t,b⟩ + rw [qmaDistributedRebitTerm_block] + by_cases hs : s = t + · subst t + by_cases hz : s i = 0 <;> simp [qmaReferenceBlocks,qmaReferenceSectorTerm,qmaConjugateMatrix,hz] + · simp [qmaReferenceBlocks,hs] + +theorem qmaReferencePenalty_blocks (n : ℕ) : + (qmaReferenceExtension (α := α) (n+1)).conjTranspose* + (qmaReferenceYPenalty n ⊗ₖ (1 : Matrix α α ℂ))* + qmaReferenceExtension (α := α) (n+1) = + qmaReferenceBlocks (n+1) (fun s => (qmaReferenceWalls n s : ℂ) • (1 : Matrix α α ℂ)) := by + unfold qmaReferenceExtension + rw [Matrix.conjTranspose_kronecker,Matrix.conjTranspose_one] + simp only [←Matrix.mul_kronecker_mul,one_mul,qmaReferenceYPenalty_diagonalized] + ext ⟨s,a⟩ ⟨t,b⟩ + by_cases hs : s = t + · subst t + simp [qmaReferenceWallMatrix,qmaReferenceBlocks] + · simp [qmaReferenceWallMatrix,qmaReferenceBlocks,hs] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceComparison.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..944bcdadb921775b952385bc14878c9a0aefefff --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceComparison.lean @@ -0,0 +1,82 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceLower + +namespace OAI + +/-! Full-space variational comparison for the actual distributed reference family. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical +variable {α : Type*} [Fintype α] [DecidableEq α] + +theorem qmaReferenceExtension_gram (n : ℕ) : + (qmaReferenceExtension (α := α) n).conjTranspose*qmaReferenceExtension (α := α) n = 1 := by + unfold qmaReferenceExtension + rw [Matrix.conjTranspose_kronecker,Matrix.conjTranspose_one,←Matrix.mul_kronecker_mul, + qmaReferenceTensor_gram,one_mul,Matrix.one_kronecker_one] + +theorem qmaReferenceExtension_cogram (n : ℕ) : + qmaReferenceExtension (α := α) n*(qmaReferenceExtension (α := α) n).conjTranspose = 1 := + mul_eq_one_comm.mp (qmaReferenceExtension_gram n) + +theorem qmaReferenceExtension_mass (n : ℕ) (u : SourceSpinBasis n × α → ℂ) : + (∑ p, Complex.normSq ((qmaReferenceExtension (α := α) n).mulVec u p)) = + ∑ p, Complex.normSq (u p) := by + rw [←qmaQuadratic_gram,qmaReferenceExtension_gram,qmaQuadratic_identity] + +theorem qmaReferenceFamily_lower (n : ℕ) (A : Fin (n+1) → Matrix α α ℂ) + (hpos : ∀ i u, 0 ≤ qmaQuadratic (A i) u) (a Δ : ℝ) (ha : 0 ≤ a) (hΔ : a ≤ Δ) + (hA : ∀ u, a*(∑ i, Complex.normSq (u i)) ≤ qmaQuadratic (∑ i, A i) u) + (u : SourceSpinBasis (n+1) × α → ℂ) : + a*(∑ p, Complex.normSq (u p)) ≤ qmaQuadratic (qmaReferenceFamily n A Δ) u := by + let B := qmaReferenceExtension (α := α) (n+1) + let v := B.conjTranspose.mulVec u + have hv : B.mulVec v = u := by + change B.mulVec (B.conjTranspose.mulVec u) = u + rw [Matrix.mulVec_mulVec,qmaReferenceExtension_cogram,Matrix.one_mulVec] + have hm : (∑ p, Complex.normSq (v p)) = ∑ p, Complex.normSq (u p) := by + rw [←hv,qmaReferenceExtension_mass] + calc + _ = ∑ s, a*(∑ i, Complex.normSq (v (s,i))) := by + rw [←hm,Fintype.sum_prod_type,Finset.mul_sum] + _ ≤ ∑ s, qmaQuadratic (qmaReferenceSector n A Δ s) (fun i => v (s,i)) := + Finset.sum_le_sum (fun s _ => qmaReferenceSector_lower n A hpos a Δ ha hΔ hA s _) + _ = qmaQuadratic (qmaReferenceBlocks (n+1) (qmaReferenceSector n A Δ)) v := + (qmaReferenceBlocks_quadratic _ _ _).symm + _ = qmaQuadratic (qmaReferenceFamily n A Δ) (B.mulVec v) := by + rw [←qmaReferenceFamily_diagonalized,qmaQuadratic_change_basis] + _ = _ := by rw [hv] + +def qmaReferenceTrial (n : ℕ) (u : α → ℂ) : SourceSpinBasis (n+1) × α → ℂ := + (qmaReferenceExtension (α := α) (n+1)).mulVec + (fun p => if p.1 = (fun _ => 1) then u p.2 else 0) + +theorem qmaReferenceTrial_energy (n : ℕ) (A : Fin (n+1) → Matrix α α ℂ) + (Δ : ℝ) (u : α → ℂ) : + qmaQuadratic (qmaReferenceFamily n A Δ) (qmaReferenceTrial n u) = + qmaQuadratic (∑ i, A i) u := by + unfold qmaReferenceTrial + rw [←qmaQuadratic_change_basis,qmaReferenceFamily_diagonalized,qmaReferenceBlocks_quadratic] + rw [Finset.sum_eq_single (fun _ => (1:Fin 2))] + · simp only [ite_true,qmaReferenceSector_one] + · intro s _ hs + simp only [hs,ite_false] + simp [qmaQuadratic,Matrix.mulVec,dotProduct] + · simp + +theorem qmaReferenceTrial_mass (n : ℕ) (u : α → ℂ) : + (∑ p, Complex.normSq (qmaReferenceTrial n u p)) = ∑ i, Complex.normSq (u i) := by + unfold qmaReferenceTrial + rw [qmaReferenceExtension_mass,Fintype.sum_prod_type] + rw [Finset.sum_eq_single (fun _ => (1:Fin 2))] + · simp + · intro s _ hs + simp [hs] + · simp + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceCongestion.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceCongestion.lean new file mode 100644 index 0000000000000000000000000000000000000000..5179e20fdfe88e7969d218d7f19488ba9a056db8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceCongestion.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTimeCongestion + +namespace OAI + +/-! Time ordering gives a constant number of reference qubits per spatial cell. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators Classical + +theorem qmaOrderedReferenceTime_fiber_card (c : QMACircuit) (hT : 0 < c.gates.length) + (hi : ∀ i, qmaFirstUse c i < c.gates.length) (t : Fin c.gates.length) : + (Finset.univ.filter (fun i => qmaOrderedReferenceTime c hT (qmaFirstUseTime c) i = t)).card ≤ 8 := by + calc + _ = (Finset.univ.filter (fun a : QMACircuitTerm c => + qmaHistoryTermTime c hT (qmaFirstUseTime c) a = t)).card := by + apply Finset.card_equiv (qmaOrderedTermEquiv c hT (qmaFirstUseTime c)) + intro i + constructor + · intro hm + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,(Finset.mem_filter.mp hm).2⟩ + · intro hm + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,(Finset.mem_filter.mp hm).2⟩ + _ ≤ 8 := qmaHistoryTimeFiber_card c hT hi t + +def qmaSparseReferenceCellIndices (c : QMACircuit) + (hT : 0 < (qmaSparseCircuit c).gates.length) + (p : QMAGridCell (qmaNearestCircuit c).gates.length c.work) : + Finset (Fin (qmaHistoryReferenceWork (qmaSparseCircuit c)+1)) := + (qmaSparseCellTimes c p).biUnion (fun t => Finset.univ.filter + (fun i => qmaOrderedReferenceTime (qmaSparseCircuit c) hT + (qmaFirstUseTime (qmaSparseCircuit c)) i = qmaSparseTime c t)) + +theorem qmaSparseReferenceCellIndices_card (c : QMACircuit) + (hT : 0 < (qmaSparseCircuit c).gates.length) + (hne : (qmaNearestCircuit c).gates ≠ []) + (p : QMAGridCell (qmaNearestCircuit c).gates.length c.work) : + (qmaSparseReferenceCellIndices c hT p).card ≤ 32 := by + calc + _ ≤ ∑ t ∈ qmaSparseCellTimes c p, (Finset.univ.filter + (fun i => qmaOrderedReferenceTime (qmaSparseCircuit c) hT + (qmaFirstUseTime (qmaSparseCircuit c)) i = qmaSparseTime c t)).card := Finset.card_biUnion_le + _ ≤ ∑ _t ∈ qmaSparseCellTimes c p, 8 := by + apply Finset.sum_le_sum + intro t _ + exact qmaOrderedReferenceTime_fiber_card _ hT (qmaSweepFirstUse_lt _ hne) _ + _ = (qmaSparseCellTimes c p).card*8 := by simp + _ ≤ 32 := by have := qmaSparseCellTimes_card c p; omega + +theorem qmaSparseReferenceCellIndices_mem (c : QMACircuit) + (hT : 0 < (qmaSparseCircuit c).gates.length) + (i : Fin (qmaHistoryReferenceWork (qmaSparseCircuit c)+1)) : + i ∈ qmaSparseReferenceCellIndices c hT (qmaOrderedSparseReferenceCell c hT i) := by + let t := (qmaOrderedReferenceTime (qmaSparseCircuit c) hT + (qmaFirstUseTime (qmaSparseCircuit c)) i).cast (qmaSparseTags_length c).symm + apply Finset.mem_biUnion.mpr + refine ⟨t,?_,?_⟩ + · simp only [qmaSparseCellTimes,Finset.mem_filter,Finset.mem_univ,true_and] + rfl + · simp only [Finset.mem_filter,Finset.mem_univ,true_and] + apply Fin.ext + rfl + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceEdgeTable.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceEdgeTable.lean new file mode 100644 index 0000000000000000000000000000000000000000..009aa999674bd192e661308b6fe8c296ddcfd679 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceEdgeTable.lean @@ -0,0 +1,137 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRebitLocal +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRebitDiagonal +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFixedMatrixProgram + +namespace OAI + +/-! Exact local tables for the reference-chain edges. Their only nontrivial +entry is the fixed two-spin expression (I-Y tensor Y)/2. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumReferenceEdgeTable +open QuantumAlgebraicScalar QuantumAlgebraicHistory QuantumHistoryDiagonal +open QuantumHistoryBitProgram QuantumFixedPauli +open ExactQuantumFactoring.BitStackProgram +open scoped Classical + +abbrev Input := ℕ × List ℕ +def inputCode : Input → List Bool := prodCode Nat.bits (listCode Nat.bits) + +def data (n : ℕ) (s t : Fin n → Fin 2) (x : Input) : Data := + (x.2,List.ofFn (fun j => (s j).val),List.ofFn (fun j => (t j).val)) + +def table (n : ℕ) (x : Input) : Matrix (Fin n → Fin 2) (Fin n → Fin 2) Scalar := + fun s t => mul (rat (1/2)) (sub (identity s t) + (mul (QuantumFixedPauli.pauli 2 (row (data n s t x) x.1) (column (data n s t x) x.1)) + (QuantumFixedPauli.pauli 2 (row (data n s t x) (x.1+1)) + (column (data n s t x) (x.1+1))))) + +noncomputable opaque dataProgram (n : ℕ) (s t : Fin n → Fin 2) : + Procedure inputCode dataCode (data n s t) := + (Procedure.second Nat.bits (listCode Nat.bits)).pair + ((Procedure.constant inputCode (listCode Nat.bits) (List.ofFn (fun j => (s j).val))).pair + (Procedure.constant inputCode (listCode Nat.bits) (List.ofFn (fun j => (t j).val)))) + +private theorem bit_val (b : Fin 2) : QuantumHistoryBitProgram.bit b.val=b := by + apply Fin.ext + exact Nat.mod_eq_of_lt b.isLt + +noncomputable opaque entryProgram (n : ℕ) (s t : Fin n → Fin 2) : + Procedure inputCode scalarCode (fun x => table n x s t) := by + let index := Procedure.first Nat.bits (listCode Nat.bits) + let evaluate (p : Procedure inputCode Nat.bits (fun x => x.1)) := + (matrixEntryProgram (QuantumFixedPauli.pauli 2)).comp + (readPairProgram.comp (p.pair (dataProgram n s t))) + let left := evaluate index + let right := (matrixEntryProgram (QuantumFixedPauli.pauli 2)).comp + (readPairProgram.comp ((Procedure.successor.comp index).pair (dataProgram n s t))) + exact (mulProgram.comp ((Procedure.constant inputCode scalarCode (rat (1/2))).pair + (subProgram.comp ((Procedure.constant inputCode scalarCode (identity s t)).pair + (mulProgram.comp (left.pair right)))))).congrFun (by + intro x + simp only [table,Function.comp_apply,readPair,matrixEntry,Nat.succ_eq_add_one,bit_val]) + +noncomputable def tableProgram (n : ℕ) : Procedure inputCode matrixCode + (fun x => matrixData (table n x)) := + QuantumFixedMatrix.dataProgram (β := Fin n → Fin 2) inputCode (table n) + (QuantumReferenceEdgeTable.entryProgram n) + +theorem inactive (c : QMACircuit) (hT : 0 exact congrFun h j + | inr j => exact congrFun hd j + · rintro rfl + rfl + have hs : ∀ k, k≠i.castSucc → k≠i.succ → S (.inl k)=T (.inl k) := by + intro k hk hl + exact (inactive c hT i s (.inl k) (by simpa only [ne_eq,Sum.inl.injEq] using And.intro hk hl)).trans + (inactive c hT i t (.inl k) (by simpa only [ne_eq,Sum.inl.injEq] using And.intro hk hl)).symm + have hb (u : Fin (QuantumOrderedSupport.sites c hT (.inr i)).length → Fin 2) + (v : Fin (QuantumOrderedSupport.sites c hT (.inr i)).length → Fin 2) + (j : Fin (qmaHistoryReferenceWork c+1)) : + row (data _ u v (i.val,QuantumOrderedSupport.encodedSites c hT (.inr i))) j.val= + orderedExtend c hT (.inr i) u (.inl j) := + QuantumHistoryBitProgram.row_actual c hT (.inr i) u v (.inl j) + have hc (j : Fin (qmaHistoryReferenceWork c+1)) : + column (data _ s t (i.val,QuantumOrderedSupport.encodedSites c hT (.inr i))) j.val= + T (.inl j) := + QuantumHistoryBitProgram.column_actual c hT (.inr i) s t (.inl j) + change referenceEdge (qmaHistoryReferenceWork c) i S T=_ + unfold referenceEdge pairY + simp only [identity,hd,hr,Function.comp_apply,ite_true] + rw [ite_eq_left hs] + unfold table + have hbl := hb s t i.castSucc + have hbr := hb s t i.succ + have hcl := hc i.castSucc + have hcr := hc i.succ + simp only [Fin.val_castSucc,Fin.val_succ] at hbl hbr hcl hcr + dsimp only [Prod.fst] + rw [hbl,hcl,hbr,hcr] + apply value_injective + simp only [identity,value_mul,value_sub,value_rat,Rat.cast_one,mul_one] + rfl + +theorem table_actual (c : QMACircuit) (hT : 0 norm_num + +theorem qmaReferenceYEdge_hermitian (n : ℕ) (i : Fin n) : + (qmaReferenceYEdge n i).IsHermitian := by + apply qmaHermitian_of_conjugated (qmaReferenceTensor (n+1)) _ + (qmaReferenceTensor_cogram _) + rw [qmaReferenceYEdge,qmaReferenceYEdge_diagonalized,sourceLocalPauli_z_diagonal, + sourceLocalPauli_z_diagonal,Matrix.diagonal_mul_diagonal] + apply Matrix.IsHermitian.ext + intro s t + by_cases h : s = t + · subst t + simp [Matrix.smul_apply,smul_eq_mul,qmaZSign] + split_ifs <;> norm_num + · simp [Matrix.smul_apply,smul_eq_mul,h,Ne.symm h] + +def qmaReferenceEdgeOnQubits (n : ℕ) (i : Fin n) : + Matrix (Fin (n+1) ⊕ ι → Fin 2) (Fin (n+1) ⊕ ι → Fin 2) ℂ := + qmaJoinMatrix (qmaReferenceYEdge n i) (ι := Fin (n+1)) (κ := ι) 1 + +def qmaReferenceEdgeSites (n : ℕ) (i : Fin n) : Finset (Fin (n+1) ⊕ ι) := + {Sum.inl i.castSucc,Sum.inl i.succ} + +theorem qmaReferenceEdgeOnQubits_local (n : ℕ) (i : Fin n) : + QMALocalOn (qmaReferenceEdgeSites (ι := ι) n i) (qmaReferenceEdgeOnQubits (ι := ι) n i) := by + have h := (qmaReferenceYEdge_local n i).joinLeft (κ := ι) + simpa only [qmaReferenceEdgeSites,qmaReferenceEdgeOnQubits, + Finset.map_insert,Finset.map_singleton,Function.Embedding.inl_apply] using h + +theorem qmaReferenceEdgeOnQubits_real (n : ℕ) (i : Fin n) + (s t : Fin (n+1) ⊕ ι → Fin 2) : (qmaReferenceEdgeOnQubits n i s t).im = 0 := by + change (qmaReferenceYEdge n i (s ∘ Sum.inl) (t ∘ Sum.inl)* + (1 : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (s ∘ Sum.inr) (t ∘ Sum.inr)).im = 0 + simp only [Complex.mul_im,qmaReferenceYEdge_real,zero_mul,add_zero,Matrix.one_apply] + split_ifs <;> simp + +theorem qmaReferenceEdgeOnQubits_hermitian (n : ℕ) (i : Fin n) : + (qmaReferenceEdgeOnQubits (ι := ι) n i).IsHermitian := by + apply Matrix.IsHermitian.submatrix + simp only [Matrix.IsHermitian,Matrix.conjTranspose_kronecker, + (qmaReferenceYEdge_hermitian n i).eq,Matrix.conjTranspose_one] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceFamily.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..f7bea1458654f0f3a5cf345f0a2ac6148524fa8a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceFamily.lean @@ -0,0 +1,62 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceBlocks + +namespace OAI + +/-! The complete distributed reference Hamiltonian and its exact sector matrices. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical +variable {α : Type*} [Fintype α] [DecidableEq α] + +def qmaReferenceFamily (n : ℕ) (A : Fin (n+1) → Matrix α α ℂ) (Δ : ℝ) : + Matrix (SourceSpinBasis (n+1) × α) (SourceSpinBasis (n+1) × α) ℂ := + (∑ i, qmaDistributedRebitTerm (n+1) i (A i))+ + (Δ:ℂ) • (qmaReferenceYPenalty n ⊗ₖ (1 : Matrix α α ℂ)) + +def qmaReferenceSector (n : ℕ) (A : Fin (n+1) → Matrix α α ℂ) + (Δ : ℝ) (s : SourceSpinBasis (n+1)) : Matrix α α ℂ := + (∑ i, qmaReferenceSectorTerm (n+1) i (A i) s)+ + ((Δ:ℂ)*(qmaReferenceWalls n s:ℂ)) • 1 + +theorem qmaReferenceFamily_diagonalized (n : ℕ) (A : Fin (n+1) → Matrix α α ℂ) (Δ : ℝ) : + (qmaReferenceExtension (α := α) (n+1)).conjTranspose*qmaReferenceFamily n A Δ* + qmaReferenceExtension (α := α) (n+1) = + qmaReferenceBlocks (n+1) (qmaReferenceSector n A Δ) := by + unfold qmaReferenceFamily + rw [Matrix.mul_add,Matrix.add_mul,Matrix.mul_sum,Matrix.sum_mul,mul_smul_comm,smul_mul_assoc] + simp_rw [qmaDistributedRebitTerm_blocks] + rw [qmaReferencePenalty_blocks] + rw [←qmaReferenceBlocks_sum] + ext ⟨s,a⟩ ⟨t,b⟩ + by_cases hs : s = t <;> + simp [qmaReferenceBlocks,qmaReferenceSector,hs,mul_assoc] + +omit [Fintype α] in +theorem qmaReferenceSector_one (n : ℕ) (A : Fin (n+1) → Matrix α α ℂ) (Δ : ℝ) : + qmaReferenceSector n A Δ (fun _ => 1) = ∑ i, A i := by + simp [qmaReferenceSector,qmaReferenceWalls_constant,qmaReferenceSectorTerm] + +omit [Fintype α] in +theorem qmaReferenceSector_zero (n : ℕ) (A : Fin (n+1) → Matrix α α ℂ) (Δ : ℝ) : + qmaReferenceSector n A Δ (fun _ => 0) = qmaConjugateMatrix (∑ i, A i) := by + ext a b + simp [qmaReferenceSector,qmaReferenceWalls_constant,qmaReferenceSectorTerm,qmaConjugateMatrix,Matrix.sum_apply] + +omit [DecidableEq α] in +theorem qmaConjugate_quadratic (A : Matrix α α ℂ) (u : α → ℂ) : + qmaQuadratic (qmaConjugateMatrix A) u = qmaQuadratic A (fun a => star (u a)) := by + unfold qmaConjugateMatrix + have he : star u ⬝ᵥ Matrix.mulVec (fun a b => star (A a b)) u = + star (star (fun a => star (u a)) ⬝ᵥ A.mulVec (fun a => star (u a))) := by + simp [dotProduct,Matrix.mulVec] + unfold qmaQuadratic + rw [he] + simp + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceHistory.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceHistory.lean new file mode 100644 index 0000000000000000000000000000000000000000..eb648f5ed411ac862dda31495de1332dc1eeba89 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceHistory.lean @@ -0,0 +1,58 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumDistributedGap + +namespace OAI + +/-! The actual distributed-reference history retains the verifier promise gap. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +abbrev QMAHistoryReferenceBasis (c : QMACircuit) := + SourceSpinBasis (qmaHistoryReferenceWork c+1) × (QMACircuitQubit c → Fin 2) + +def qmaReferenceHistory (c : QMACircuit) + (τ : Fin (c.work+1) → Fin (c.gates.length+1)) : + Matrix (QMAHistoryReferenceBasis c) (QMAHistoryReferenceBasis c) ℂ := + qmaReferenceFamily (qmaHistoryReferenceWork c) (qmaHistoryReferenceTerms c τ) 1 + +theorem qmaReferenceHistory_lower (c : QMACircuit) (hc : c.WellFormed) + (τ : Fin (c.work+1) → Fin (c.gates.length+1)) + (hi : ∀ i, ∀ g ∈ c.gates.take (τ i).val, i ∉ qmaGateSites c.work g) + (hsound : ∀ psi : EuclideanSpace ℂ (SourceSpinBasis c.witness), + ‖psi‖ = 1 → qmaAcceptance c hc psi ≤ 1/3) + (u : QMAHistoryReferenceBasis c → ℂ) : + (2/(5*(c.gates.length+1:ℝ)))*(∑ p, Complex.normSq (u p)) ≤ + qmaQuadratic (qmaReferenceHistory c τ) u := by + have hd : 0 < 5*(c.gates.length+1:ℝ) := by positivity + have ha : (2:ℝ)/(5*(c.gates.length+1:ℝ)) ≤ 1 := by + apply (div_le_one hd).mpr + have : (0:ℝ) ≤ c.gates.length := Nat.cast_nonneg _ + linarith + apply qmaReferenceFamily_lower _ _ (qmaHistoryReferenceTerms_nonnegative c τ) _ _ + (by positivity) ha + intro v + rw [qmaHistoryReferenceTerms_sum] + exact qmaDistributedQubit_lower c hc τ hi hsound v + +theorem qmaReferenceHistory_accepting (c : QMACircuit) (hc : c.WellFormed) + (τ : Fin (c.work+1) → Fin (c.gates.length+1)) + (hi : ∀ i, ∀ g ∈ c.gates.take (τ i).val, i ∉ qmaGateSites c.work g) + (psi : EuclideanSpace ℂ (SourceSpinBasis c.witness)) (hpsi : ‖psi‖ = 1) + (hacc : 2/3 ≤ qmaAcceptance c hc psi) : + ∃ u : QMAHistoryReferenceBasis c → ℂ, (∑ p, Complex.normSq (u p)) = 1 ∧ + 3*(c.gates.length+1:ℝ)*qmaQuadratic (qmaReferenceHistory c τ) u ≤ 1 := by + obtain ⟨v,hv,he⟩ := qmaDistributedQubit_accepting c hc τ hi psi hpsi hacc + refine ⟨qmaReferenceTrial (qmaHistoryReferenceWork c) v,?_,?_⟩ + · rw [qmaReferenceTrial_mass] + exact hv + · unfold qmaReferenceHistory + rw [qmaReferenceTrial_energy,qmaHistoryReferenceTerms_sum] + exact he + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceLocal.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceLocal.lean new file mode 100644 index 0000000000000000000000000000000000000000..b56f97586f256cfe6cfbb82b52b3cfc8499cb67b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceLocal.lean @@ -0,0 +1,90 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceReal +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalJoin + +namespace OAI + +/-! A separate reference qubit adds exactly one site to each original support. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +theorem QMALocalOn.entryReal {S : Finset ι} + {A : Matrix (ι → Fin 2) (ι → Fin 2) ℂ} (hA : QMALocalOn S A) : + QMALocalOn S (qmaEntryReal A) := by + obtain ⟨B,rfl⟩ := hA + refine ⟨qmaEntryReal B,?_⟩ + ext s t + simp only [qmaEntryReal,qmaLocalLift_apply] + split_ifs <;> simp + +theorem QMALocalOn.entryImag {S : Finset ι} + {A : Matrix (ι → Fin 2) (ι → Fin 2) ℂ} (hA : QMALocalOn S A) : + QMALocalOn S (qmaEntryImag A) := by + obtain ⟨B,rfl⟩ := hA + refine ⟨qmaEntryImag B,?_⟩ + ext s t + simp only [qmaEntryImag,qmaLocalLift_apply] + split_ifs <;> simp + +theorem qmaLocalY_local (n : ℕ) (i : Fin n) : + QMALocalOn {i} (sourceLocalPauli n i 1) := by + apply qmaLocalOn_sourceTensor + intro k hk + simp only [Finset.mem_singleton] at hk + simp [hk] + +def qmaDistributedRebitSites (n : ℕ) (i : Fin n) (S : Finset ι) : Finset (Fin n ⊕ ι) := + insert (Sum.inl i) (S.map Function.Embedding.inr) + +def qmaDistributedRebitOnQubits (n : ℕ) (i : Fin n) + (A : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) : + Matrix (Fin n ⊕ ι → Fin 2) (Fin n ⊕ ι → Fin 2) ℂ := + (qmaDistributedRebitTerm n i A).submatrix + (Equiv.sumArrowEquivProdArrow (Fin n) ι (Fin 2)) + (Equiv.sumArrowEquivProdArrow (Fin n) ι (Fin 2)) + +theorem qmaDistributedRebitOnQubits_eq (n : ℕ) (i : Fin n) + (A : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) : + qmaDistributedRebitOnQubits n i A = + qmaJoinMatrix (ι := Fin n) 1 (qmaEntryReal A)+ + (-Complex.I) • qmaJoinMatrix (sourceLocalPauli n i 1) (qmaEntryImag A) := by + ext s t + rfl + +theorem qmaDistributedRebitOnQubits_local (n : ℕ) (i : Fin n) {S : Finset ι} + {A : Matrix (ι → Fin 2) (ι → Fin 2) ℂ} (hA : QMALocalOn S A) : + QMALocalOn (qmaDistributedRebitSites n i S) (qmaDistributedRebitOnQubits n i A) := by + rw [qmaDistributedRebitOnQubits_eq] + apply QMALocalOn.add + · exact hA.entryReal.joinRight.mono (Finset.subset_insert _ _) + · have h := (qmaLocalY_local n i).join hA.entryImag + have he : (({i} : Finset (Fin n)).map (Function.Embedding.inl : Fin n ↪ Fin n ⊕ ι) ∪ + S.map Function.Embedding.inr) = qmaDistributedRebitSites n i S := by + simp [qmaDistributedRebitSites] + rw [he] at h + exact h.smul _ + +omit [Fintype ι] in +theorem qmaDistributedRebitSites_card (n : ℕ) (i : Fin n) (S : Finset ι) : + (qmaDistributedRebitSites n i S).card = S.card+1 := by + simp [qmaDistributedRebitSites] + +omit [Fintype ι] [DecidableEq ι] in +theorem qmaDistributedRebitOnQubits_real (n : ℕ) (i : Fin n) + (A : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (s t : Fin n ⊕ ι → Fin 2) : + (qmaDistributedRebitOnQubits n i A s t).im = 0 := + qmaDistributedRebitTerm_real _ _ _ _ _ + +theorem qmaDistributedRebitOnQubits_hermitian (n : ℕ) (i : Fin n) + (A : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (hA : A.IsHermitian) : + (qmaDistributedRebitOnQubits n i A).IsHermitian := + (qmaDistributedRebitTerm_hermitian n i A hA).submatrix _ + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceLower.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..91bfd1457ca7cbbeb83a3a3c6e31d08fc6a43217 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceLower.lean @@ -0,0 +1,74 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceFamily + +namespace OAI + +/-! Positive local history terms make a constant-strength reference penalty sufficient. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {α : Type*} [Fintype α] [DecidableEq α] + +omit [DecidableEq α] in +theorem qmaQuadratic_sum {κ : Type*} [Fintype κ] (A : κ → Matrix α α ℂ) (u : α → ℂ) : + qmaQuadratic (∑ i, A i) u = ∑ i, qmaQuadratic (A i) u := by + have h (s : Finset κ) : qmaQuadratic (∑ i ∈ s, A i) u = ∑ i ∈ s, qmaQuadratic (A i) u := by + classical + induction s using Finset.induction with + | empty => simp [qmaQuadratic] + | @insert i s hi ih => simp only [Finset.sum_insert hi,qmaQuadratic_add,ih] + exact h Finset.univ + +theorem qmaQuadratic_identity (u : α → ℂ) : + qmaQuadratic (1 : Matrix α α ℂ) u = ∑ i, Complex.normSq (u i) := by + simp [qmaQuadratic,dotProduct,Complex.mul_re,Complex.normSq_apply] + +omit [DecidableEq α] in +theorem qmaReferenceSector_nonnegative (n : ℕ) (A : Fin (n+1) → Matrix α α ℂ) + (hpos : ∀ i u, 0 ≤ qmaQuadratic (A i) u) (s : SourceSpinBasis (n+1)) (u : α → ℂ) : + 0 ≤ qmaQuadratic (∑ i, qmaReferenceSectorTerm (n+1) i (A i) s) u := by + rw [qmaQuadratic_sum] + apply Finset.sum_nonneg + intro i _ + by_cases hs : s i = 0 + · rw [qmaReferenceSectorTerm,ite_eq_left hs,qmaConjugate_quadratic] + exact hpos i _ + · rw [qmaReferenceSectorTerm,ite_eq_right hs] + exact hpos i u + +theorem qmaReferenceSector_lower (n : ℕ) (A : Fin (n+1) → Matrix α α ℂ) + (hpos : ∀ i u, 0 ≤ qmaQuadratic (A i) u) (a Δ : ℝ) (ha : 0 ≤ a) (hΔ : a ≤ Δ) + (hA : ∀ u, a*(∑ i, Complex.normSq (u i)) ≤ qmaQuadratic (∑ i, A i) u) + (s : SourceSpinBasis (n+1)) (u : α → ℂ) : + a*(∑ i, Complex.normSq (u i)) ≤ qmaQuadratic (qmaReferenceSector n A Δ s) u := by + have hm : 0 ≤ ∑ i, Complex.normSq (u i) := Finset.sum_nonneg (fun i _ => Complex.normSq_nonneg _) + by_cases hs : ∀ i, s i = s 0 + · have he : s = fun _ => s 0 := funext hs + rw [he] + generalize hb : s 0 = b + fin_cases b + · change a*(∑ i, Complex.normSq (u i)) ≤ qmaQuadratic (qmaReferenceSector n A Δ (fun _ => 0)) u + rw [qmaReferenceSector_zero,qmaConjugate_quadratic] + simpa using hA (fun i => star (u i)) + · change a*(∑ i, Complex.normSq (u i)) ≤ qmaQuadratic (qmaReferenceSector n A Δ (fun _ => 1)) u + rw [qmaReferenceSector_one] + exact hA u + · have hw : (1:ℝ) ≤ qmaReferenceWalls n s := by exact_mod_cast qmaReferenceWalls_pos n s hs + have hp := qmaReferenceSector_nonnegative n A hpos s u + have he : qmaQuadratic (qmaReferenceSector n A Δ s) u = + qmaQuadratic (∑ i, qmaReferenceSectorTerm (n+1) i (A i) s) u+ + Δ*(qmaReferenceWalls n s:ℝ)*(∑ i, Complex.normSq (u i)) := by + rw [qmaReferenceSector,qmaQuadratic_add] + have hc : (Δ:ℂ)*(qmaReferenceWalls n s:ℂ) = ((Δ*(qmaReferenceWalls n s:ℝ):ℝ):ℂ) := by simp + rw [hc,qmaQuadratic_smul,qmaQuadratic_identity] + rw [he] + have hΔ0 : 0 ≤ Δ := ha.trans hΔ + have hg : a ≤ Δ*(qmaReferenceWalls n s:ℝ) := by nlinarith + exact (mul_le_mul_of_nonneg_right hg hm).trans (le_add_of_nonneg_left hp) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceModel.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..eaee28ab5bf4f70a0a2301551586222137a120f9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceModel.lean @@ -0,0 +1,108 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceTerms +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalModel + +namespace OAI + +/-! A real six-local history model with separate references and a linear term count. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +abbrev qmaFirstUseTime (c : QMACircuit) (i : Fin (c.work+1)) : Fin (c.gates.length+1) := + ⟨qmaFirstUse c i,Nat.lt_succ_of_le (qmaFirstUse_le c i)⟩ + +def qmaReferenceHistorySites (c : QMACircuit) (i : Fin (qmaHistoryReferenceWork c+1)) : + Finset (QMACircuitQubit c) := + qmaDistributedTermSites c (qmaFirstUseTime c) ((qmaHistoryTermIndex c).symm i) + +def qmaReferenceHistoryModel (c : QMACircuit) : QMARealLocalModel 6 where + Q := Fin (qmaHistoryReferenceWork c+1) ⊕ QMACircuitQubit c + Term := QMAReferenceTerm (qmaHistoryReferenceWork c) + qFinite := inferInstance + qDecidable := inferInstance + termFinite := inferInstance + matrix := qmaReferenceTermMatrix (qmaHistoryReferenceWork c) + (qmaHistoryReferenceTerms c (qmaFirstUseTime c)) + sites := qmaReferenceTermSites (qmaHistoryReferenceWork c) (qmaReferenceHistorySites c) + localOn := qmaReferenceTerm_local _ _ _ (fun _ => qmaDistributedTerm_local c _ _) + card := qmaReferenceTerm_card _ _ (fun _ => qmaDistributedTerm_support_card c _ _) + hermitian := qmaReferenceTerm_hermitian _ _ (fun _ => qmaDistributedTerm_hermitian c _ _) + real := qmaReferenceTerm_real _ _ + +theorem qmaReferenceHistoryModel_sum (c : QMACircuit) : + (∑ t, (qmaReferenceHistoryModel c).matrix t) = + qmaReferenceOnQubits (qmaHistoryReferenceWork c) + (qmaHistoryReferenceTerms c (qmaFirstUseTime c)) := + qmaReferenceTerm_sum _ _ + +theorem qmaReferenceHistoryModel_size (c : QMACircuit) : + (qmaReferenceHistoryModel c).qubits = 3*c.gates.length+2*c.work+8 ∧ + (qmaReferenceHistoryModel c).terms = 4*c.gates.length+2*c.work+9 := by + constructor + · change Fintype.card (Fin (2*c.gates.length+c.work+4+1) ⊕ + (Fin (c.gates.length+2) ⊕ Fin (c.work+1))) = _ + simp only [Fintype.card_sum,Fintype.card_fin] + omega + · change Fintype.card (Fin (2*c.gates.length+c.work+4+1) ⊕ + Fin (2*c.gates.length+c.work+4)) = _ + simp only [Fintype.card_sum,Fintype.card_fin] + omega + +theorem qmaReferenceHistoryModel_yes (c : QMACircuit) (hc : c.WellFormed) + (psi : EuclideanSpace ℂ (SourceSpinBasis c.witness)) (hpsi : ‖psi‖ = 1) + (hacc : 2/3 ≤ qmaAcceptance c hc psi) : + (qmaReferenceHistoryModel c).energy ≤ 1/(3*(c.gates.length+1:ℝ)) := by + obtain ⟨v,hv,he⟩ := qmaReferenceHistory_accepting c hc (qmaFirstUseTime c) + (qmaFirstUse_untouched c) psi hpsi hacc + let e := Equiv.sumArrowEquivProdArrow (Fin (qmaHistoryReferenceWork c+1)) + (QMACircuitQubit c) (Fin 2) + let u : EuclideanSpace ℂ ((Fin (qmaHistoryReferenceWork c+1) ⊕ QMACircuitQubit c) → Fin 2) := + WithLp.toLp 2 (v ∘ e) + have hu : ‖u‖ = 1 := by + apply (sq_eq_sq₀ (norm_nonneg _) (by norm_num : (0:ℝ) ≤ 1)).mp + simp only [u,EuclideanSpace.norm_sq_eq,Complex.sq_norm,one_pow] + exact (e.sum_comp (fun p => Complex.normSq (v p))).trans hv + unfold QMARealLocalModel.energy + rw [qmaReferenceHistoryModel_sum] + apply (qmaNormalizedBottom_le _ u hu).trans + have hq : qmaQuadratic (qmaReferenceOnQubits (qmaHistoryReferenceWork c) + (qmaHistoryReferenceTerms c (qmaFirstUseTime c))) (fun p => u p) = + qmaQuadratic (qmaReferenceHistory c (qmaFirstUseTime c)) v := + qmaQuadratic_reindex e _ v + rw [hq] + exact (le_div_iff₀ (by positivity : 0 < 3*(c.gates.length+1:ℝ))).mpr (by linarith) + +theorem qmaReferenceHistoryModel_no (c : QMACircuit) (hc : c.WellFormed) + (hsound : ∀ psi : EuclideanSpace ℂ (SourceSpinBasis c.witness), + ‖psi‖ = 1 → qmaAcceptance c hc psi ≤ 1/3) : + 2/(5*(c.gates.length+1:ℝ)) ≤ (qmaReferenceHistoryModel c).energy := by + unfold QMARealLocalModel.energy + rw [qmaReferenceHistoryModel_sum] + apply le_qmaNormalizedBottom _ (EuclideanSpace.single (fun _ => (0:Fin 2)) (1:ℂ)) + (by simp [PiLp.norm_single]) + intro u hu + change EuclideanSpace ℂ ((Fin (qmaHistoryReferenceWork c+1) ⊕ QMACircuitQubit c) → Fin 2) at u + have hu1 : ‖u‖ = 1 := hu + let e := Equiv.sumArrowEquivProdArrow (Fin (qmaHistoryReferenceWork c+1)) + (QMACircuitQubit c) (Fin 2) + have h := qmaReferenceHistory_lower c hc (qmaFirstUseTime c) (qmaFirstUse_untouched c) + hsound ((fun p => u p) ∘ e.symm) + have hm : (∑ p, Complex.normSq (((fun q => u q) ∘ e.symm) p)) = 1 := by + change (∑ p, Complex.normSq (u (e.symm p))) = 1 + rw [qmaMass_reindex e (fun p => u p)] + calc + _ = ‖u‖^2 := by + simpa only [Complex.sq_norm] using (EuclideanSpace.norm_sq_eq u).symm + _ = 1 := by rw [hu1]; norm_num + rw [hm,mul_one] at h + change _ ≤ qmaQuadratic ((qmaReferenceHistory c (qmaFirstUseTime c)).submatrix e e) (fun p => u p) + rw [qmaQuadratic_reindex_equiv] + exact h + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferencePenalty.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferencePenalty.lean new file mode 100644 index 0000000000000000000000000000000000000000..dfb19ccfcba07fd5125d86ebdd0317938d993297 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferencePenalty.lean @@ -0,0 +1,74 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumDiagonalTensor + +namespace OAI + +/-! The actual nearest-neighbor real YY penalty has a unit complement gap. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +def qmaReferenceYPenalty (n : ℕ) : + Matrix (SourceSpinBasis (n+1)) (SourceSpinBasis (n+1)) ℂ := + ∑ i : Fin n, (1/2 : ℂ) • (1-sourceLocalPauli (n+1) i.castSucc 1* + sourceLocalPauli (n+1) i.succ 1) + +theorem qmaReferenceYEdge_diagonalized (n : ℕ) (i j : Fin n) : + (qmaReferenceTensor n).conjTranspose* + ((1/2 : ℂ) • (1-sourceLocalPauli n i 1*sourceLocalPauli n j 1))* + qmaReferenceTensor n = + (1/2 : ℂ) • (1-sourceLocalPauli n i 2*sourceLocalPauli n j 2) := by + rw [mul_smul_comm,smul_mul_assoc,Matrix.mul_sub,Matrix.sub_mul,mul_one, + qmaReferenceTensor_gram,qmaReferenceTensor_yy] + +theorem qmaReferenceYPenalty_diagonalized (n : ℕ) : + (qmaReferenceTensor (n+1)).conjTranspose*qmaReferenceYPenalty n* + qmaReferenceTensor (n+1) = qmaReferenceWallMatrix n := by + unfold qmaReferenceYPenalty + rw [Matrix.mul_sum,Matrix.sum_mul] + simp_rw [qmaReferenceYEdge_diagonalized] + exact qmaReferenceZPenalty_diagonal n + +theorem qmaQuadratic_change_basis {α β : Type*} [Fintype α] [Fintype β] + (B : Matrix α β ℂ) (M : Matrix α α ℂ) (u : β → ℂ) : + qmaQuadratic (B.conjTranspose*M*B) u = qmaQuadratic M (B.mulVec u) := by + unfold qmaQuadratic + rw [Matrix.star_mulVec,←Matrix.dotProduct_mulVec,Matrix.mulVec_mulVec,Matrix.mulVec_mulVec] + +theorem qmaReferenceYPenalty_gap (n : ℕ) (u : SourceSpinBasis (n+1) → ℂ) : + (∑ s, if ∀ i, s i = s 0 then 0 else Complex.normSq (u s)) ≤ + qmaQuadratic (qmaReferenceYPenalty n) ((qmaReferenceTensor (n+1)).mulVec u) := by + rw [←qmaQuadratic_change_basis,qmaReferenceYPenalty_diagonalized] + exact qmaReferenceWallMatrix_gap n u + +theorem sourcePauli_yy_real (n : ℕ) (i j : Fin n) (hij : i ≠ j) + (s t : SourceSpinBasis n) : ((sourceLocalPauli n i 1*sourceLocalPauli n j 1) s t).im = 0 := by + have hY (a b c d : Fin 2) : (pauli 1 a b*pauli 1 c d).im = 0 := by + fin_cases a <;> fin_cases b <;> fin_cases c <;> fin_cases d <;> + norm_num [pauli,pauliY] + rw [sourceLocalPauli_product_entry n i j hij] + by_cases hs : ∀ k, k ≠ i → k ≠ j → s k = t k + · rw [sourceSpectatorDelta_eq_one n i j s t hs,mul_one] + exact hY _ _ _ _ + · rw [sourceSpectatorDelta_eq_zero n i j s t hs,mul_zero] + rfl + +theorem qmaReferenceYPenalty_real (n : ℕ) (s t : SourceSpinBasis (n+1)) : + (qmaReferenceYPenalty n s t).im = 0 := by + have hne (i : Fin n) : i.castSucc ≠ i.succ := by + intro he + have hv := congrArg Fin.val he + simp at hv + simp only [qmaReferenceYPenalty,Matrix.sum_apply,Complex.im_sum] + apply Finset.sum_eq_zero + intro i _ + simp only [Matrix.smul_apply,smul_eq_mul,Complex.mul_im,Matrix.sub_apply,Complex.sub_im, + sourcePauli_yy_real _ _ _ (hne i),Matrix.one_apply] + split_ifs <;> norm_num + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceReal.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceReal.lean new file mode 100644 index 0000000000000000000000000000000000000000..f5f15f144604e0b301353e8b2bf25e70d3f4bd7b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceReal.lean @@ -0,0 +1,110 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceHistory +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliMonomial + +namespace OAI + +/-! Distributed reference terms are actual real Hermitian matrices. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical + +variable {α : Type*} [Fintype α] [DecidableEq α] + +theorem qmaLocalY_real_zero (n : ℕ) (i : Fin n) (s t : SourceSpinBasis n) : + (sourceLocalPauli n i 1 s t).re = 0 := by + rw [qmaLocalPauli_monomial] + simp only [qmaPauliPhase,Fin.isValue,ite_true] + split_ifs <;> simp + +omit [Fintype α] [DecidableEq α] in +theorem qmaDistributedRebitTerm_real (n : ℕ) (i : Fin n) (A : Matrix α α ℂ) + (p q : SourceSpinBasis n × α) : (qmaDistributedRebitTerm n i A p q).im = 0 := by + rcases p with ⟨s,a⟩ + rcases q with ⟨t,b⟩ + simp only [qmaDistributedRebitTerm,Matrix.add_apply,Matrix.kronecker_apply, + Matrix.smul_apply,smul_eq_mul,qmaEntryReal,qmaEntryImag,Complex.add_im, + Complex.mul_im,Complex.mul_re,Complex.ofReal_im,Complex.ofReal_re, + qmaLocalY_real_zero,zero_mul,mul_zero,add_zero,sub_zero] + simp only [Matrix.one_apply] + split_ifs <;> simp + +theorem qmaHermitian_of_conjugated {β : Type*} [Fintype β] [DecidableEq β] + (B M : Matrix β β ℂ) (hB : B*B.conjTranspose = 1) + (hM : (B.conjTranspose*M*B).IsHermitian) : M.IsHermitian := by + have he : B*(B.conjTranspose*M*B)*B.conjTranspose = M := by + calc + _ = (B*B.conjTranspose)*M*(B*B.conjTranspose) := by simp only [mul_assoc] + _ = M := by rw [hB]; simp + rw [←he] + exact Matrix.isHermitian_mul_mul_conjTranspose B hM + +omit [Fintype α] [DecidableEq α] in +theorem qmaConjugateMatrix_hermitian (A : Matrix α α ℂ) (hA : A.IsHermitian) : + (qmaConjugateMatrix A).IsHermitian := by + apply Matrix.IsHermitian.ext + intro a b + exact congrArg star (hA.apply a b) + +omit [Fintype α] [DecidableEq α] in +theorem qmaReferenceBlocks_hermitian (n : ℕ) (A : SourceSpinBasis n → Matrix α α ℂ) + (hA : ∀ s, (A s).IsHermitian) : (qmaReferenceBlocks n A).IsHermitian := by + apply Matrix.IsHermitian.ext + rintro ⟨s,a⟩ ⟨t,b⟩ + by_cases hs : s = t + · subst t + simpa only [qmaReferenceBlocks,ite_true] using (hA s).apply a b + · simp [qmaReferenceBlocks,hs,Ne.symm hs] + +theorem qmaDistributedRebitTerm_hermitian (n : ℕ) (i : Fin n) (A : Matrix α α ℂ) + (hA : A.IsHermitian) : (qmaDistributedRebitTerm n i A).IsHermitian := by + apply qmaHermitian_of_conjugated (qmaReferenceExtension (α := α) n) _ + (qmaReferenceExtension_cogram n) + rw [qmaDistributedRebitTerm_blocks] + apply qmaReferenceBlocks_hermitian + intro s + unfold qmaReferenceSectorTerm + split_ifs + · exact qmaConjugateMatrix_hermitian A hA + · exact hA + +theorem qmaReferenceYPenalty_hermitian (n : ℕ) : (qmaReferenceYPenalty n).IsHermitian := by + apply qmaHermitian_of_conjugated (qmaReferenceTensor (n+1)) _ + (qmaReferenceTensor_cogram _) + rw [qmaReferenceYPenalty_diagonalized] + apply Matrix.isHermitian_diagonal_iff.mpr + intro s + simp [isSelfAdjoint_iff] + +omit [Fintype α] in +theorem qmaReferenceFamily_real (n : ℕ) (A : Fin (n+1) → Matrix α α ℂ) (Δ : ℝ) + (p q : SourceSpinBasis (n+1) × α) : (qmaReferenceFamily n A Δ p q).im = 0 := by + rcases p with ⟨s,a⟩ + rcases q with ⟨t,b⟩ + simp only [qmaReferenceFamily,Matrix.add_apply,Matrix.sum_apply,Complex.add_im, + Complex.im_sum,qmaDistributedRebitTerm_real,Finset.sum_const_zero,zero_add, + Matrix.smul_apply,smul_eq_mul,Matrix.kronecker_apply,Complex.mul_im, + Complex.ofReal_im,Complex.ofReal_re,zero_mul,add_zero,qmaReferenceYPenalty_real] + simp only [Matrix.one_apply] + split_ifs <;> simp + +theorem qmaReferenceFamily_hermitian (n : ℕ) (A : Fin (n+1) → Matrix α α ℂ) (Δ : ℝ) + (hA : ∀ i, (A i).IsHermitian) : (qmaReferenceFamily n A Δ).IsHermitian := by + unfold qmaReferenceFamily + apply Matrix.IsHermitian.add + · apply Matrix.IsHermitian.ext + intro p q + simp only [Matrix.sum_apply,star_sum] + exact Finset.sum_congr rfl (fun i _ => + (qmaDistributedRebitTerm_hermitian _ _ _ (hA i)).apply p q) + · have hp : (qmaReferenceYPenalty n ⊗ₖ (1 : Matrix α α ℂ)).IsHermitian := by + simp only [Matrix.IsHermitian,Matrix.conjTranspose_kronecker, + (qmaReferenceYPenalty_hermitian n).eq,Matrix.conjTranspose_one] + exact hp.smul (by simp [isSelfAdjoint_iff]) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceTensor.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..660f954b0a350d78fa7181696a432507f199121c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceTensor.lean @@ -0,0 +1,50 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceWalls + +namespace OAI + +/-! The full reference-register basis diagonalizes every local Y operator. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped Classical + +def qmaReferenceTensor (n : ℕ) : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ := + sourceTensor n (fun _ => qmaReferenceBasis) + +theorem qmaReferenceTensor_gram (n : ℕ) : + (qmaReferenceTensor n).conjTranspose*qmaReferenceTensor n = 1 := by + unfold qmaReferenceTensor + rw [sourceTensor_conjTranspose,sourceTensor_mul] + simp only [qmaReferenceBasis_gram] + exact sourceTensor_one n + +theorem qmaReferenceTensor_cogram (n : ℕ) : + qmaReferenceTensor n*(qmaReferenceTensor n).conjTranspose = 1 := by + exact mul_eq_one_comm.mp (qmaReferenceTensor_gram n) + +theorem qmaReferenceTensor_y (n : ℕ) (i : Fin n) : + (qmaReferenceTensor n).conjTranspose*sourceLocalPauli n i 1*qmaReferenceTensor n = + sourceLocalPauli n i 2 := by + unfold qmaReferenceTensor sourceLocalPauli + rw [sourceTensor_conjTranspose,sourceTensor_mul,sourceTensor_mul] + congr 1 + funext k + by_cases hk : k = i + · simp only [hk,ite_true] + exact qmaReferenceBasis_y + · simp only [hk,ite_false,mul_one,qmaReferenceBasis_gram] + +theorem qmaReferenceTensor_yy (n : ℕ) (i j : Fin n) : + (qmaReferenceTensor n).conjTranspose* + (sourceLocalPauli n i 1*sourceLocalPauli n j 1)*qmaReferenceTensor n = + sourceLocalPauli n i 2*sourceLocalPauli n j 2 := by + rw [←qmaReferenceTensor_y n i,←qmaReferenceTensor_y n j] + simp only [mul_assoc] + rw [←mul_assoc (qmaReferenceTensor n),qmaReferenceTensor_cogram,one_mul] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceTerms.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceTerms.lean new file mode 100644 index 0000000000000000000000000000000000000000..43896428286cd0f8edbaefd89b5fcae55ef35d87 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceTerms.lean @@ -0,0 +1,92 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceEdges + +namespace OAI + +/-! The full reference Hamiltonian as explicit bounded-support real terms. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +abbrev QMAReferenceTerm (n : ℕ) := Fin (n+1) ⊕ Fin n + +def qmaReferenceTermMatrix (n : ℕ) + (A : Fin (n+1) → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) : + QMAReferenceTerm n → Matrix (Fin (n+1) ⊕ ι → Fin 2) (Fin (n+1) ⊕ ι → Fin 2) ℂ + | .inl i => qmaDistributedRebitOnQubits (n+1) i (A i) + | .inr i => qmaReferenceEdgeOnQubits n i + +def qmaReferenceTermSites (n : ℕ) (S : Fin (n+1) → Finset ι) : + QMAReferenceTerm n → Finset (Fin (n+1) ⊕ ι) + | .inl i => qmaDistributedRebitSites (n+1) i (S i) + | .inr i => qmaReferenceEdgeSites n i + +def qmaReferenceOnQubits (n : ℕ) + (A : Fin (n+1) → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) := + (qmaReferenceFamily n A 1).submatrix + (Equiv.sumArrowEquivProdArrow (Fin (n+1)) ι (Fin 2)) + (Equiv.sumArrowEquivProdArrow (Fin (n+1)) ι (Fin 2)) + +theorem qmaReferenceTerm_sum (n : ℕ) + (A : Fin (n+1) → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) : + (∑ t, qmaReferenceTermMatrix n A t) = qmaReferenceOnQubits n A := by + ext s t + simp only [Fintype.sum_sum_type,Matrix.add_apply,Matrix.sum_apply,qmaReferenceTermMatrix, + qmaReferenceOnQubits,qmaReferenceFamily,Matrix.submatrix_apply,Complex.ofReal_one,one_smul,qmaReferenceYPenalty] + change (∑ i, qmaDistributedRebitOnQubits (n+1) i (A i) s t)+ + (∑ i, qmaReferenceEdgeOnQubits n i s t) = + (∑ i, qmaDistributedRebitOnQubits (n+1) i (A i) s t)+ + ((∑ i, qmaReferenceYEdge n i) (s ∘ Sum.inl) (t ∘ Sum.inl))* + (1 : Matrix (ι → Fin 2) _ ℂ) (s ∘ Sum.inr) (t ∘ Sum.inr) + simp only [Matrix.sum_apply,Finset.sum_mul] + rfl + +theorem qmaReferenceTerm_local (n : ℕ) + (A : Fin (n+1) → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (S : Fin (n+1) → Finset ι) (hA : ∀ i, QMALocalOn (S i) (A i)) + (t : QMAReferenceTerm n) : + QMALocalOn (qmaReferenceTermSites n S t) (qmaReferenceTermMatrix n A t) := by + cases t with + | inl i => exact qmaDistributedRebitOnQubits_local _ _ (hA i) + | inr i => exact qmaReferenceEdgeOnQubits_local _ _ + +omit [Fintype ι] in +theorem qmaReferenceTerm_card (n : ℕ) (S : Fin (n+1) → Finset ι) + (hS : ∀ i, (S i).card ≤ 5) (t : QMAReferenceTerm n) : + (qmaReferenceTermSites n S t).card ≤ 6 := by + cases t with + | inl i => + change (qmaDistributedRebitSites (n+1) i (S i)).card ≤ 6 + rw [qmaDistributedRebitSites_card] + have := hS i + omega + | inr i => + change ({Sum.inl i.castSucc,Sum.inl i.succ} : Finset (Fin (n+1) ⊕ ι)).card ≤ 6 + have h := Finset.card_insert_le (Sum.inl i.castSucc) + ({Sum.inl i.succ} : Finset (Fin (n+1) ⊕ ι)) + simp only [Finset.card_singleton] at h + omega + +theorem qmaReferenceTerm_hermitian (n : ℕ) + (A : Fin (n+1) → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (hA : ∀ i, (A i).IsHermitian) (t : QMAReferenceTerm n) : + (qmaReferenceTermMatrix n A t).IsHermitian := by + cases t with + | inl i => exact qmaDistributedRebitOnQubits_hermitian _ _ _ (hA i) + | inr i => exact qmaReferenceEdgeOnQubits_hermitian _ _ + +theorem qmaReferenceTerm_real (n : ℕ) + (A : Fin (n+1) → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (t : QMAReferenceTerm n) (s u : Fin (n+1) ⊕ ι → Fin 2) : + (qmaReferenceTermMatrix n A t s u).im = 0 := by + cases t with + | inl i => exact qmaDistributedRebitOnQubits_real _ _ _ _ _ + | inr i => exact qmaReferenceEdgeOnQubits_real _ _ _ _ + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceWalls.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceWalls.lean new file mode 100644 index 0000000000000000000000000000000000000000..cbb798bb89fda93b178750a894c9dd691d46d14d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumReferenceWalls.lean @@ -0,0 +1,80 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceBasis + +namespace OAI + +/-! The nearest-neighbor reference chain has only two zero-wall sectors. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +def qmaReferenceWalls (n : ℕ) (s : SourceSpinBasis (n+1)) : ℕ := + (Finset.univ.filter (fun i : Fin n => s i.castSucc ≠ s i.succ)).card + +theorem qmaReferenceWalls_zero_iff (n : ℕ) (s : SourceSpinBasis (n+1)) : + qmaReferenceWalls n s = 0 ↔ ∀ i, s i = s 0 := by + constructor + · intro h + have he : Finset.univ.filter (fun i : Fin n => s i.castSucc ≠ s i.succ) = ∅ := + Finset.card_eq_zero.mp h + have hadj (i : Fin n) : s i.castSucc = s i.succ := by + by_contra hn + have hm : i ∈ Finset.univ.filter (fun i : Fin n => s i.castSucc ≠ s i.succ) := by + simp [hn] + rw [he] at hm + exact Finset.notMem_empty i hm + intro i + induction i using Fin.induction with + | zero => rfl + | succ i ih => exact (hadj i).symm.trans ih + · intro h + unfold qmaReferenceWalls + have he : Finset.univ.filter (fun i : Fin n => s i.castSucc ≠ s i.succ) = ∅ := by + apply Finset.filter_eq_empty_iff.mpr + intro i _ hn + exact hn ((h i.castSucc).trans (h i.succ).symm) + rw [he] + rfl + +theorem qmaReferenceWalls_constant (n : ℕ) (b : Fin 2) : + qmaReferenceWalls n (fun _ => b) = 0 := + (qmaReferenceWalls_zero_iff n _).mpr (by intro i; rfl) + +theorem qmaReferenceWalls_pos (n : ℕ) (s : SourceSpinBasis (n+1)) + (hs : ¬∀ i, s i = s 0) : 1 ≤ qmaReferenceWalls n s := by + have hn : qmaReferenceWalls n s ≠ 0 := fun h => hs ((qmaReferenceWalls_zero_iff n s).mp h) + omega + +def qmaReferenceWallMatrix (n : ℕ) : + Matrix (SourceSpinBasis (n+1)) (SourceSpinBasis (n+1)) ℂ := + Matrix.diagonal (fun s => (qmaReferenceWalls n s : ℂ)) + +theorem qmaReferenceWallMatrix_quadratic (n : ℕ) (u : SourceSpinBasis (n+1) → ℂ) : + qmaQuadratic (qmaReferenceWallMatrix n) u = + ∑ s, (qmaReferenceWalls n s : ℝ)*Complex.normSq (u s) := by + simp only [qmaQuadratic,qmaReferenceWallMatrix,Matrix.mulVec_diagonal,dotProduct, + Pi.star_apply,Complex.re_sum] + apply Finset.sum_congr rfl + intro s _ + simp [Complex.mul_re,Complex.normSq_apply] + ring + +theorem qmaReferenceWallMatrix_gap (n : ℕ) (u : SourceSpinBasis (n+1) → ℂ) : + (∑ s, if ∀ i, s i = s 0 then 0 else Complex.normSq (u s)) ≤ + qmaQuadratic (qmaReferenceWallMatrix n) u := by + rw [qmaReferenceWallMatrix_quadratic] + apply Finset.sum_le_sum + intro s _ + by_cases hs : ∀ i, s i = s 0 + · simp [hs,(qmaReferenceWalls_zero_iff n s).mpr hs] + · simp only [hs,ite_false] + have h : (1 : ℝ) ≤ qmaReferenceWalls n s := by + exact_mod_cast qmaReferenceWalls_pos n s hs + nlinarith [Complex.normSq_nonneg (u s)] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRetainedCrossing.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRetainedCrossing.lean new file mode 100644 index 0000000000000000000000000000000000000000..cbc23ddb1ec993c9b7cc2feb9608ede8ea156b71 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRetainedCrossing.lean @@ -0,0 +1,82 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingPairSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortCrossingSelection +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortLinks + +namespace OAI + +/-! Every edge internal to a selected crossing is removed from the retained +graph. The assertion concerns the actual completed subdivision graph. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +theorem qmaCrossPair_direction (a b : Fin 4) (h : s(a,b) ∈ qmaCrossPortPairing) : + ∃ t : Fin 2, + (a = qmaPatchDirection (if t = 0 then 0 else 1) ∧ + b = qmaPatchDirection (if t = 0 then 2 else 3)) ∨ + (a = qmaPatchDirection (if t = 0 then 2 else 3) ∧ + b = qmaPatchDirection (if t = 0 then 0 else 1)) := by + have hfinite : ∀ a b : Fin 4, s(a,b) ∈ qmaCrossPortPairing → + ∃ t : Fin 2, + (a = qmaPatchDirection (if t = 0 then 0 else 1) ∧ + b = qmaPatchDirection (if t = 0 then 2 else 3)) ∨ + (a = qmaPatchDirection (if t = 0 then 2 else 3) ∧ + b = qmaPatchDirection (if t = 0 then 0 else 1)) := by decide + exact hfinite a b h + +namespace QMAPortRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + +theorem finished_edge_adjacent (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) + (e : (P.finishedGraph N D).Edge) : + P.graph.Adj (P.finishedPosition N D ((P.finishedGraph N D).left e)) + (P.finishedPosition N D ((P.finishedGraph N D).right e)) := + (P.toEmbedding.iterate N D).adjacent_of_complete (P.schedule.iterate_complete N hD) e + +theorem graph_link {x y : ℕ × ℕ} (h : P.graph.Adj x y) : QMAPortLink x y := by + change _ ≠ _ ∧ _ at h + rcases h.2 with ⟨e,k,hk,hl,hr⟩ | ⟨e,k,hk,hl,hr⟩ + · rw [← hl,← hr] + exact qmaPortChain_link (P.point e) (P.length_pos e) (P.step e) k hk + · rw [← hl,← hr] + exact (qmaPortChain_link (P.point e) (P.length_pos e) (P.step e) k hk).symm + +theorem finished_edge_link (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) + (e : (P.finishedGraph N D).Edge) : + QMAPortLink (P.finishedPosition N D ((P.finishedGraph N D).left e)) + (P.finishedPosition N D ((P.finishedGraph N D).right e)) := + P.graph_link (P.finished_edge_adjacent N hD e) + +theorem retained_no_internal_crossing (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) + (e : (P.portCrossingSelection N hD).retained.Edge) (c : P.Crossing) (a b : Fin 4) + (hl : P.finishedPosition N D ((P.finishedGraph N D).left e.val) = qmaGridPort c.val a) + (hr : P.finishedPosition N D ((P.finishedGraph N D).right e.val) = qmaGridPort c.val b) : False := by + have ha := P.finished_edge_adjacent N hD e.val + rw [hl,hr] at ha + obtain ⟨t,hab⟩ := qmaCrossPair_direction a b + (P.crossing_graph_pair (P.mem_crossingCells.mp c.property) ha) + let i : Fin P.crossingCells.card := P.crossingCells.equivFin c + have hi : P.crossingCell i = c := P.crossingCells.equivFin.symm_apply_apply c + have hsite (u : Fin 4) : P.finishedPosition N D (P.crossingSiteFin N hD i u) = + qmaGridPort c.val (qmaPatchDirection u) := by + change P.finishedPosition N D (P.crossingSite N hD (P.crossingCell i) _) = _ + rw [hi,P.crossingSite_spec] + have hinj := (P.toEmbedding.iterate N D).position_injective + have hvertex (v : Fin (P.finishedGraph N D).n) (u : Fin 4) + (hv : P.finishedPosition N D v = qmaGridPort c.val (qmaPatchDirection u)) : + v = P.crossingSiteFin N hD i u := hinj (hv.trans (hsite u).symm) + apply (P.finishedGraph N D).retained_no_crossing (P.crossingSiteFin N hD) + (P.crossingSiteFin_injective N hD) e (i,t) + rcases hab with ⟨ha,hb⟩ | ⟨ha,hb⟩ + · exact Or.inl ⟨hvertex _ _ (by simpa only [ha] using hl), + hvertex _ _ (by simpa only [hb] using hr)⟩ + · exact Or.inr ⟨hvertex _ _ (by simpa only [ha] using hl), + hvertex _ _ (by simpa only [hb] using hr)⟩ + +end QMAPortRouteData +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRetainedGeometry.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRetainedGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..88e2218aa59a1b296bd664d77fe78297f13185f8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRetainedGeometry.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortRaySupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingPlacement +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortCellPositive + +namespace OAI + +/-! The actual retained interactions are source rays, noncrossing cell pairs, +or external corridors. All endpoint positions incorporate the inward move. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +def qmaMovedPort (cross : (ℕ × ℕ) → Prop) [DecidablePred cross] + (p : ℕ × ℕ) (a : Fin 4) : ℕ × ℕ := + if cross p then qmaInnerPort p a else qmaGridPort p a + +namespace QMAPortRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + +def RetainedGeometry (x y : ℕ × ℕ) : Prop := + (∃ p a, (∃ v, P.position v = p) ∧ ¬P.IsCrossing p ∧ + ((x = qmaExpandedPoint p ∧ y = qmaGridPort p a) ∨ + (x = qmaGridPort p a ∧ y = qmaExpandedPoint p))) ∨ + (∃ p a b, ¬P.IsCrossing p ∧ x = qmaGridPort p a ∧ y = qmaGridPort p b ∧ + ∃ i : P.Interior, P.cell i = p ∧ + ((P.port i 0 = a ∧ P.port i 1 = b) ∨ (P.port i 0 = b ∧ P.port i 1 = a))) ∨ + (∃ p q, qmaSquareGrid.Adj p q ∧ (0 < p.1 ∧ 0 < p.2) ∧ (0 < q.1 ∧ 0 < q.2) ∧ + x = qmaMovedPort P.IsCrossing p (qmaGridNeighborIndex p q) ∧ + y = qmaMovedPort P.IsCrossing q (qmaGridNeighborIndex q p)) + +theorem retained_geometry (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) + (havoid : ∀ i : P.Interior, ∀ v, P.cell i ≠ P.position v) + (e : (P.portCrossingSelection N hD).retained.Edge) : + P.RetainedGeometry + (P.movedPosition N D ((P.finishedGraph N D).left e.val)) + (P.movedPosition N D ((P.finishedGraph N D).right e.val)) := by + have hadj := P.finished_edge_adjacent N hD e.val + rcases P.finished_edge_link N hD e.val with + ⟨p,a,⟨hl,hr⟩ | ⟨hl,hr⟩⟩ | ⟨p,a,b,hl,hr⟩ | ⟨p,q,hpq,hl,hr⟩ + · have hn : ¬P.IsCrossing p := by + apply P.graph_center_not_crossing havoid + simpa only [hl] using hadj + have hv := P.graph_center_source (by simpa only [hl] using hadj) + refine Or.inl ⟨p,a,hv,hn,Or.inl ?_⟩ + simp only [movedPosition,hl,hr,qmaCrossingMove_center,qmaCrossingMove_port,hn,ite_false] + constructor <;> trivial + · have hn : ¬P.IsCrossing p := by + apply P.graph_center_not_crossing havoid + simpa only [hr] using hadj.symm + have hv := P.graph_center_source (by simpa only [hr] using hadj.symm) + refine Or.inl ⟨p,a,hv,hn,Or.inr ?_⟩ + simp only [movedPosition,hl,hr,qmaCrossingMove_center,qmaCrossingMove_port,hn,ite_false] + constructor <;> trivial + · have hn : ¬P.IsCrossing p := by + intro hc + exact P.retained_no_internal_crossing N hD e ⟨p,P.mem_crossingCells.mpr hc⟩ a b hl hr + have hvis := P.graph_inner_pair (by simpa only [hl,hr] using hadj) + refine Or.inr (Or.inl ⟨p,a,b,hn,?_,?_,hvis⟩) + · simp only [movedPosition,hl,qmaCrossingMove_port,hn,ite_false] + · simp only [movedPosition,hr,qmaCrossingMove_port,hn,ite_false] + · have hpos := P.graph_cell_positive hadj + simp only [hl,hr,qmaDirectedPort,qmaPointCell_port] at hpos + refine Or.inr (Or.inr ⟨p,q,hpq,hpos.1,hpos.2,?_,?_⟩) + · simp only [movedPosition,hl,qmaDirectedPort,qmaCrossingMove_port,qmaMovedPort] + · simp only [movedPosition,hr,qmaDirectedPort,qmaCrossingMove_port,qmaMovedPort] + +end QMAPortRouteData +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRetainedRoutes.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRetainedRoutes.lean new file mode 100644 index 0000000000000000000000000000000000000000..7fa7bb1d0f575a7ed97a3f36383fc79e94b03fd0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRetainedRoutes.lean @@ -0,0 +1,102 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRetainedGeometry +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCellRouteCatalog + +namespace OAI + +/-! Assign an actual short lattice path to every retained physical interaction. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +theorem qmaGridNeighborIndex_opposite {p q : ℕ × ℕ} + (hp : 0 < p.1 ∧ 0 < p.2) (ha : qmaSquareGrid.Adj p q) : + qmaGridNeighborIndex q p = qmaPortOpposite (qmaGridNeighborIndex p q) := by + obtain ⟨a,rfl⟩ := qmaGridNeighbor_exists ha + rcases p with ⟨x,y⟩ + have hx : x-1+1 = x := by omega + have hy : y-1+1 = y := by omega + fin_cases a <;> dsimp [qmaGridNeighborIndex,qmaGridNeighbor,qmaPortOpposite] + all_goals split_ifs <;> first | rfl | omega + +theorem qmaMovedPort_local (cross : (ℕ × ℕ) → Prop) [DecidablePred cross] + (p : ℕ × ℕ) (a : Fin 4) : + qmaMovedPort cross p a = qmaCellTranslate p (qmaLocalPort (decide (cross p)) a) := by + by_cases h : cross p + · simp only [qmaMovedPort,qmaLocalPort,h,decide_true,ite_true,qmaCellTranslate_inner] + · simp only [qmaMovedPort,qmaLocalPort,h,decide_false,Bool.false_eq_true,ite_false,qmaCellTranslate_port] + +namespace QMAPortRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + +def RoutingAllowed : QMACellRouteBody → Prop + | .ray p _ => (∃ v, P.position v = p) ∧ ¬P.IsCrossing p + | .pair p e => ¬P.IsCrossing p ∧ ∃ i : P.Interior, P.cell i = p ∧ + s(P.port i 0,P.port i 1) = s(qmaCellPairLeft e,qmaCellPairRight e) + | .patch p _ => P.IsCrossing p + | .corridor p a b c => b = decide (P.IsCrossing p) ∧ + c = decide (P.IsCrossing (qmaGridNeighbor p a)) + +theorem geometry_route_exists {x y : ℕ × ℕ} (h : P.RetainedGeometry x y) : + ∃ R : QMACellRoute, P.RoutingAllowed R.body ∧ R.Valid ∧ R.source = x ∧ R.target = y := by + rcases h with ⟨p,a,hsource,hn,⟨hx,hy⟩ | ⟨hx,hy⟩⟩ | ⟨p,a,b,hn,hx,hy,i,hi,hv⟩ | + ⟨p,q,hpq,hp,_,hx,hy⟩ + · exact ⟨⟨.ray p a,false⟩,⟨hsource,hn⟩,trivial,hx.symm,hy.symm⟩ + · exact ⟨⟨.ray p a,true⟩,⟨hsource,hn⟩,trivial,hx.symm,hy.symm⟩ + · have hab : a ≠ b := by + intro h + rcases hv with ⟨h0,h1⟩ | ⟨h0,h1⟩ + · exact (by decide : (0 : Fin 2) ≠ 1) (P.port_injective i (h0.trans (h.trans h1.symm))) + · exact (by decide : (0 : Fin 2) ≠ 1) (P.port_injective i (h0.trans (h.symm.trans h1.symm))) + have hpair : s(P.port i 0,P.port i 1) = s(a,b) := by + rcases hv with ⟨h0,h1⟩ | ⟨h0,h1⟩ + · rw [h0,h1] + · rw [h0,h1] + exact Sym2.eq_swap + obtain ⟨e,he⟩ := qmaCellPair_complete a b hab + rcases he with ⟨ha,hb⟩ | ⟨ha,hb⟩ + · refine ⟨⟨.pair p e,false⟩,⟨hn,i,hi,?_⟩,trivial,?_,?_⟩ + · simpa only [ha,hb] using hpair + · change qmaGridPort p (qmaCellPairLeft e) = x + rw [← ha,← hx] + · change qmaGridPort p (qmaCellPairRight e) = y + rw [← hb,← hy] + · refine ⟨⟨.pair p e,true⟩,⟨hn,i,hi,?_⟩,trivial,?_,?_⟩ + · rw [ha,hb] at hpair + exact hpair.trans Sym2.eq_swap + · change qmaGridPort p (qmaCellPairRight e) = x + rw [← ha,← hx] + · change qmaGridPort p (qmaCellPairLeft e) = y + rw [← hb,← hy] + · let a := qmaGridNeighborIndex p q + refine ⟨⟨.corridor p a (decide (P.IsCrossing p)) (decide (P.IsCrossing q)),false⟩, + ⟨rfl,?_⟩,hp,?_,?_⟩ + · rw [qmaGridNeighborIndex_spec hp.1 hp.2 hpq] + · exact (qmaMovedPort_local P.IsCrossing p a).symm.trans hx.symm + · change qmaCellTranslate (qmaGridNeighbor p a) + (qmaLocalPort (decide (P.IsCrossing q)) (qmaPortOpposite a)) = y + rw [qmaGridNeighborIndex_spec hp.1 hp.2 hpq,← qmaGridNeighborIndex_opposite hp hpq] + exact (qmaMovedPort_local P.IsCrossing q (qmaGridNeighborIndex q p)).symm.trans hy.symm + +def retainedRoute (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) + (havoid : ∀ i : P.Interior, ∀ v, P.cell i ≠ P.position v) + (e : (P.portCrossingSelection N hD).retained.Edge) : QMACellRoute := + Classical.choose (P.geometry_route_exists (P.retained_geometry N hD havoid e)) + +theorem retainedRoute_spec (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) + (havoid : ∀ i : P.Interior, ∀ v, P.cell i ≠ P.position v) + (e : (P.portCrossingSelection N hD).retained.Edge) : + P.RoutingAllowed (P.retainedRoute N hD havoid e).body ∧ + (P.retainedRoute N hD havoid e).Valid ∧ + (P.retainedRoute N hD havoid e).source = + P.movedPosition N D ((P.finishedGraph N D).left e.val) ∧ + (P.retainedRoute N hD havoid e).target = + P.movedPosition N D ((P.finishedGraph N D).right e.val) := + Classical.choose_spec (P.geometry_route_exists (P.retained_geometry N hD havoid e)) + +end QMAPortRouteData +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRetainedSupport.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRetainedSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..67c4e307f37cdd6f7d25bb7390ab92e6fdbaff77 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRetainedSupport.lean @@ -0,0 +1,63 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingCompiled + +namespace OAI + +/-! Filtering the bond tape retains exactly the unselected physical edges, +including their orientation, regardless of their list order. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumCrossingSelectProgram +open QuantumCrossingListBlock +open scoped Classical + +variable {G : QMARationalExchangeGraph} {r m : ℕ} + (S : QMARationalCrossingSelection G r) (labels : G.Edge ≃ Fin m) + (htag : ∀ e i a, S.tag e=some (i,a) ↔ G.CrossingMatch S.site e (i,a)) + +include htag in +theorem retained_edge_source (e : (retainedGraph S labels).Edge) : + ∃ f : S.retained.Edge, + (retainedGraph S labels).left e = S.retained.left f ∧ + (retainedGraph S labels).right e = S.retained.right f := by + let xs := retained (pairs (List.ofFn (encodedSites S.site)),QuantumListGraph.packed G labels) + have hm : xs.get e ∈ xs := List.get_mem xs e + obtain ⟨hm,hk⟩ := List.mem_filter.mp hm + obtain ⟨i,hi⟩ := List.mem_ofFn.mp hm + have ht : S.tag (labels.symm i)=none := by + rw [← hi] at hk + exact of_decide_eq_true ((keep_selected S htag (labels.symm i)).symm.trans hk) + refine ⟨⟨labels.symm i,ht⟩,?_,?_⟩ + · apply Fin.ext + change (xs.get e).1=(G.left (labels.symm i)).val + rw [← hi] + · apply Fin.ext + change (xs.get e).2.1=(G.right (labels.symm i)).val + rw [← hi] + +include htag in +theorem retained_edge_target (f : S.retained.Edge) : + ∃ e : (retainedGraph S labels).Edge, + (retainedGraph S labels).left e = S.retained.left f ∧ + (retainedGraph S labels).right e = S.retained.right f := by + let b : MediatorListProgram.Bond := ((G.left f.val).val,(G.right f.val).val,G.weight f.val) + let xs := retained (pairs (List.ofFn (encodedSites S.site)),QuantumListGraph.packed G labels) + have hm : b ∈ xs := by + apply List.mem_filter.mpr + refine ⟨List.mem_ofFn.mpr ⟨labels f.val,?_⟩,?_⟩ + · simp only [Equiv.symm_apply_apply] + rfl + · exact (keep_selected S htag f.val).trans (decide_eq_true f.property) + obtain ⟨e,he⟩ := List.mem_iff_get.mp hm + refine ⟨e,?_,?_⟩ + · apply Fin.ext + change (xs.get e).1=(G.left f.val).val + rw [he] + · apply Fin.ext + change (xs.get e).2.1=(G.right f.val).val + rw [he] + +end ContinuumCoulomb.QuantumCrossingSelectProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteCandidates.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteCandidates.lean new file mode 100644 index 0000000000000000000000000000000000000000..64ae49567df7a15ac343c7453f7b6786dd439324 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteCandidates.lean @@ -0,0 +1,28 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCellRouteSupport + +namespace OAI + +/-! The actual merged-output route uses the finite 140-element catalog search. -/ + +namespace ContinuumCoulomb + +theorem qmaInternalBody_cell (p : ℕ × ℕ) (e : QMAInternalEdge) : + (qmaInternalBody p e).cell = p := by + rcases e with a | (a | a) <;> rfl + +noncomputable section +open scoped Classical +namespace QMAPortRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + +theorem mergedOutputRoute_find (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) + (havoid : ∀ i : P.Interior, ∀ v, P.cell i ≠ P.position v) + (e : (P.crossingOutput N hD).merge.Edge) : + P.findMergedRoute N hD e = some (P.mergedOutputRoute N hD havoid e) := + (Option.some_get (P.findMergedRoute_isSome N hD havoid e)).symm + +end QMAPortRouteData +end +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteCongestion.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteCongestion.lean new file mode 100644 index 0000000000000000000000000000000000000000..21a65501763fa04b59d7996d7e05bf22c156d052 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteCongestion.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFineRoute +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridColor + +namespace OAI + +/-! Routing whole interactions retains constant congestion and the same color schedule. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +def qmaFineRouteSites {rows width A : ℕ} (p q : QMAFineGrid rows width A) : + Finset (QMAFineGrid rows width A) := Finset.univ.image (qmaFineRoute p q) + +theorem qmaFineRouteSites_local {rows width A : ℕ} (hA : 0 < A) + (p q : QMAFineGrid rows width A) (a : QMAGridCell rows width) + (hp : QMAGridCellsNear (qmaFineGridCell hA p) a) + (hq : QMAGridCellsNear (qmaFineGridCell hA q) a) + (z : QMAFineGrid rows width A) (hz : z ∈ qmaFineRouteSites p q) : + QMAGridCellsNear (qmaFineGridCell hA z) a := by + obtain ⟨k,_,rfl⟩ := Finset.mem_image.mp hz + exact qmaFineRoute_local hA p q a hp hq k + +theorem qmaFineRoutes_congestion {E : Type*} [Fintype E] {rows width A B : ℕ} + (hA : 0 < A) (left right : E → QMAFineGrid rows width A) + (anchor : E → QMAGridCell rows width) + (hlocal : ∀ e, QMAGridCellsNear (qmaFineGridCell hA (left e)) (anchor e) ∧ + QMAGridCellsNear (qmaFineGridCell hA (right e)) (anchor e)) + (hdensity : ∀ p, (Finset.univ.filter (fun e => anchor e = p)).card ≤ B) + (z : QMAFineGrid rows width A) : + (Finset.univ.filter (fun e => z ∈ qmaFineRouteSites (left e) (right e))).card ≤ 9*B := by + apply qmaGrid_incidence_bound (qmaFineGridCell hA) anchor _ _ hdensity z + intro e z hz + exact qmaFineRouteSites_local hA _ _ _ (hlocal e).1 (hlocal e).2 z hz + +theorem qmaFineRoutes_color_disjoint {E : Type*} [Fintype E] {rows width A B : ℕ} + (hA : 0 < A) (left right : E → QMAFineGrid rows width A) + (anchor : E → QMAGridCell rows width) + (hlocal : ∀ e, QMAGridCellsNear (qmaFineGridCell hA (left e)) (anchor e) ∧ + QMAGridCellsNear (qmaFineGridCell hA (right e)) (anchor e)) + (hdensity : ∀ p, (Finset.univ.filter (fun e => anchor e = p)).card ≤ B) + {e f : E} (hef : e ≠ f) (hcolor : qmaGridColor anchor hdensity e = qmaGridColor anchor hdensity f) : + Disjoint (qmaFineRouteSites (left e) (right e)) (qmaFineRouteSites (left f) (right f)) := by + apply qmaGridColor_disjoint (qmaFineGridCell hA) anchor _ hdensity _ hef hcolor + intro e z hz + exact qmaFineRouteSites_local hA _ _ _ (hlocal e).1 (hlocal e).2 z hz + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteEnumeration.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteEnumeration.lean new file mode 100644 index 0000000000000000000000000000000000000000..642c6fd746be499df39de15f614cf21c72f6e2b3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteEnumeration.lean @@ -0,0 +1,81 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCellRouteCatalog +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortCellPositive + +namespace OAI + +/-! Only 140 explicit catalog routes need be tested for a physical edge: the +seventy oriented routes in each endpoint cell. This supplies a fixed finite +search space for the literal planar-route compiler. -/ + +namespace ContinuumCoulomb + +def QMACellRouteBody.cell : QMACellRouteBody → ℕ × ℕ + | .ray p _ => p + | .pair p _ => p + | .patch p _ => p + | .corridor p _ _ _ => p + +def qmaCellBodies (p : ℕ × ℕ) : List QMACellRouteBody := + (List.finRange 4).map (.ray p) ++ (List.finRange 6).map (.pair p) ++ + (List.finRange 9).map (.patch p) ++ + (List.finRange 4).flatMap (fun a => + [.corridor p a false false,.corridor p a false true, + .corridor p a true false,.corridor p a true true]) + +def qmaCellRoutes (p : ℕ × ℕ) : List QMACellRoute := + (qmaCellBodies p).flatMap (fun B => [⟨B,false⟩,⟨B,true⟩]) + +def qmaRouteCandidates (x y : ℕ × ℕ) : List QMACellRoute := + qmaCellRoutes (qmaPointCell x) ++ qmaCellRoutes (qmaPointCell y) + +theorem qmaCellBodies_complete (B : QMACellRouteBody) : B ∈ qmaCellBodies B.cell := by + cases B with + | ray p a => simp [qmaCellBodies,QMACellRouteBody.cell] + | pair p a => simp [qmaCellBodies,QMACellRouteBody.cell] + | patch p a => simp [qmaCellBodies,QMACellRouteBody.cell] + | corridor p a b c => cases b <;> cases c <;> simp [qmaCellBodies,QMACellRouteBody.cell] + +theorem qmaCellRoutes_complete (R : QMACellRoute) : R ∈ qmaCellRoutes R.body.cell := by + apply List.mem_flatMap.mpr + refine ⟨R.body,qmaCellBodies_complete R.body,?_⟩ + rcases R with ⟨B,b⟩ + cases b <;> simp + +theorem qmaCellBodies_length (p : ℕ × ℕ) : (qmaCellBodies p).length = 35 := by + simp [qmaCellBodies,List.length_flatMap] + +theorem qmaCellRoutes_length (p : ℕ × ℕ) : (qmaCellRoutes p).length = 70 := by + simp [qmaCellRoutes,List.length_flatMap,qmaCellBodies_length] + +theorem qmaRouteCandidates_length (x y : ℕ × ℕ) : (qmaRouteCandidates x y).length = 140 := by + simp [qmaRouteCandidates,qmaCellRoutes_length] + +theorem QMACellRouteBody.source_cell (B : QMACellRouteBody) : qmaPointCell B.source = B.cell := by + cases B with + | ray p a => exact qmaPointCell_center p + | pair p e => exact qmaPointCell_port p (qmaCellPairLeft e) + | patch p e => + apply Prod.ext <;> fin_cases e <;> + simp [QMACellRouteBody.source,QMACellRouteBody.cell,qmaPointCell,qmaPatchTranslate, + qmaCrossingPatchLeft,qmaCrossingPatchVertex,Nat.add_div] + | corridor p a b c => + have h : (qmaLocalPort b a).1 < 32 ∧ (qmaLocalPort b a).2 < 32 := by + cases b <;> fin_cases a <;> decide + exact qmaCellTranslate_cell p _ h + +theorem qmaRouteCandidates_complete (R : QMACellRoute) : R ∈ qmaRouteCandidates R.source R.target := by + have h := qmaCellRoutes_complete R + have hc : R.body.cell = qmaPointCell R.source ∨ R.body.cell = qmaPointCell R.target := by + rcases R with ⟨B,b⟩ + cases b + · exact Or.inl B.source_cell.symm + · exact Or.inr B.source_cell.symm + rcases hc with hc | hc + · apply List.mem_append_left + rwa [hc] at h + · apply List.mem_append_right + rwa [hc] at h + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteLanes.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteLanes.lean new file mode 100644 index 0000000000000000000000000000000000000000..e923edf17e1bd8a03ccf832b71b8d1fe8a87b3be --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteLanes.lean @@ -0,0 +1,66 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRouteCongestion + +namespace OAI + +/-! Distinct residue lanes separate parallel routes and keep crossings away from bends. -/ + +namespace ContinuumCoulomb + +def qmaLanePoint {C : ℕ} (c : Fin C) (p : ℕ × ℕ) : ℕ × ℕ := + (C*p.1+c.val,C*p.2+c.val) + +@[simp] theorem qmaLanePoint_row_mod {C : ℕ} (c : Fin C) (p : ℕ × ℕ) : + (qmaLanePoint c p).1%C = c.val := by + simp [qmaLanePoint,Nat.add_mod,Nat.mod_eq_of_lt c.isLt] + +@[simp] theorem qmaLanePoint_col_mod {C : ℕ} (c : Fin C) (p : ℕ × ℕ) : + (qmaLanePoint c p).2%C = c.val := by + simp [qmaLanePoint,Nat.add_mod,Nat.mod_eq_of_lt c.isLt] + +theorem qmaLanePoint_eq_color {C : ℕ} {c d : Fin C} {p q : ℕ × ℕ} + (h : qmaLanePoint c p = qmaLanePoint d q) : c = d := by + apply Fin.ext + have he := congrArg (fun z : ℕ × ℕ => z.1%C) h + simpa only [qmaLanePoint_row_mod] using he + +theorem qmaLanePoint_injective {C : ℕ} (c : Fin C) : Function.Injective (qmaLanePoint c) := by + intro p q h + have hx := congrArg Prod.fst h + have hy := congrArg Prod.snd h + have hC : 0 < C := (Nat.zero_le c.val).trans_lt c.isLt + dsimp [qmaLanePoint] at hx hy + apply Prod.ext + · exact Nat.eq_of_mul_eq_mul_left hC (Nat.add_right_cancel hx) + · exact Nat.eq_of_mul_eq_mul_left hC (Nat.add_right_cancel hy) + +def qmaHorizontalLane {C : ℕ} (c : Fin C) (y : ℕ) (p : ℕ × ℕ) : Prop := + p.2 = C*y+c.val + +def qmaVerticalLane {C : ℕ} (c : Fin C) (x : ℕ) (p : ℕ × ℕ) : Prop := + p.1 = C*x+c.val + +theorem qmaHorizontalLane_color {C : ℕ} {c d : Fin C} {y z : ℕ} {p : ℕ × ℕ} + (hc : qmaHorizontalLane c y p) (hd : qmaHorizontalLane d z p) : c = d := by + apply Fin.ext + have he : (C*y+c.val)%C = (C*z+d.val)%C := congrArg (fun x => x%C) (hc.symm.trans hd) + simpa [Nat.add_mod,Nat.mod_eq_of_lt c.isLt,Nat.mod_eq_of_lt d.isLt] using he + +theorem qmaVerticalLane_color {C : ℕ} {c d : Fin C} {x z : ℕ} {p : ℕ × ℕ} + (hc : qmaVerticalLane c x p) (hd : qmaVerticalLane d z p) : c = d := by + apply Fin.ext + have he : (C*x+c.val)%C = (C*z+d.val)%C := congrArg (fun x => x%C) (hc.symm.trans hd) + simpa [Nat.add_mod,Nat.mod_eq_of_lt c.isLt,Nat.mod_eq_of_lt d.isLt] using he + +/-- A transverse crossing between distinct lanes cannot coincide with any lane vertex. -/ +theorem qmaLane_crossing_not_vertex {C : ℕ} {c d : Fin C} (hcd : c ≠ d) + {x y : ℕ} {p : ℕ × ℕ} (hh : qmaHorizontalLane c y p) (hv : qmaVerticalLane d x p) + (e : Fin C) (q : ℕ × ℕ) : p ≠ qmaLanePoint e q := by + intro he + subst p + have hc : c = e := qmaHorizontalLane_color hh (by rfl : qmaHorizontalLane e q.2 (qmaLanePoint e q)) + have hd : d = e := qmaVerticalLane_color hv (by rfl : qmaVerticalLane e q.1 (qmaLanePoint e q)) + exact hcd (hc.trans hd.symm) + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteLeaf.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteLeaf.lean new file mode 100644 index 0000000000000000000000000000000000000000..86aeafe1c9ce4b4ad0f99934feff5972c9be5743 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteLeaf.lean @@ -0,0 +1,63 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridWalk + +namespace OAI + +/-! Reserve one singlet leaf beside the initial step of every scaled route. +Four incident directions use four different quadrants. -/ + +namespace ContinuumCoulomb + +def qmaLeafCenter (p : ℕ × ℕ) : ℕ × ℕ := (8*p.1+4,8*p.2+4) + +def qmaLeafFirst (p : ℕ × ℕ) : Fin 4 → ℕ × ℕ := + ![(8*p.1+5,8*p.2+4),(8*p.1+4,8*p.2+5), + (8*p.1+3,8*p.2+4),(8*p.1+4,8*p.2+3)] + +def qmaRouteLeaf (p : ℕ × ℕ) : Fin 4 → ℕ × ℕ := + ![(8*p.1+5,8*p.2+5),(8*p.1+3,8*p.2+5), + (8*p.1+3,8*p.2+3),(8*p.1+5,8*p.2+3)] + +theorem qmaLeafFirst_step (p : ℕ × ℕ) (a : Fin 4) : + qmaSquareGrid.Adj (qmaLeafCenter p) (qmaLeafFirst p a) := by + fin_cases a <;> simp [qmaSquareGrid,qmaLeafCenter,qmaLeafFirst,Nat.dist] + +theorem qmaRouteLeaf_step (p : ℕ × ℕ) (a : Fin 4) : + qmaSquareGrid.Adj (qmaLeafFirst p a) (qmaRouteLeaf p a) := by + fin_cases a <;> simp [qmaSquareGrid,qmaLeafFirst,qmaRouteLeaf,Nat.dist] + +theorem qmaRouteLeaf_cell (p : ℕ × ℕ) (a : Fin 4) : + ((qmaRouteLeaf p a).1/8,(qmaRouteLeaf p a).2/8) = p := by + apply Prod.ext <;> fin_cases a <;> simp [qmaRouteLeaf,Nat.add_div] + +theorem qmaRouteLeaf_not_gridline (p : ℕ × ℕ) (a : Fin 4) : + (qmaRouteLeaf p a).1%8 ≠ 4 ∧ (qmaRouteLeaf p a).2%8 ≠ 4 := by + fin_cases a <;> norm_num [qmaRouteLeaf,Nat.add_mod] + +theorem qmaRouteLeaf_avoids (p z : ℕ × ℕ) (a : Fin 4) + (hz : z.1%8 = 4 ∨ z.2%8 = 4) : qmaRouteLeaf p a ≠ z := by + intro he + obtain ⟨hx,hy⟩ := qmaRouteLeaf_not_gridline p a + rw [he] at hx hy + exact hz.elim hx hy + +theorem qmaRouteLeaf_injective : Function.Injective + (fun x : (ℕ × ℕ) × Fin 4 => qmaRouteLeaf x.1 x.2) := by + rintro ⟨p,a⟩ ⟨q,b⟩ h + have hpq : p = q := by + have he := congrArg (fun z : ℕ × ℕ => (z.1/8,z.2/8)) h + simpa only [qmaRouteLeaf_cell] using he + subst q + have hx := congrArg Prod.fst h + have hy := congrArg Prod.snd h + have hab : a = b := by + fin_cases a <;> fin_cases b <;> simp [qmaRouteLeaf] at hx hy ⊢ + subst b + rfl + +theorem qmaRouteLeaf_bounds {X Y : ℕ} {p : ℕ × ℕ} (hx : p.1 < X) (hy : p.2 < Y) + (a : Fin 4) : (qmaRouteLeaf p a).1 < 8*X ∧ (qmaRouteLeaf p a).2 < 8*Y := by + fin_cases a <;> simp [qmaRouteLeaf] <;> omega + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteLeafProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteLeafProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..71fabf21efc54b9c7b159b2a4937c99275688483 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteLeafProgram.lean @@ -0,0 +1,99 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRouteLeaf +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridNeighborsFour +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRouteProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawProgram +import OAI.Computability.QuantumFactoring.BitStackOptions + +namespace OAI + +/-! Literal polynomial TM2 evaluators for scaled centers and reserved leaves. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumRouteLeafCode +open ExactQuantumFactoring.BitStackProgram QuantumRouteCode + +noncomputable def coordinateProgram (xAxis : Bool) (offset : ℕ) : Procedure pairCode Nat.bits + (fun p => 8*(if xAxis then p.1 else p.2)+offset) := by + let p : Procedure pairCode Nat.bits (fun p => if xAxis then p.1 else p.2) := by + cases xAxis + · exact Procedure.second Nat.bits Nat.bits + · exact Procedure.first Nat.bits Nat.bits + let mul := Procedure.binaryMul.comp ((Procedure.constant pairCode Nat.bits 8).pair p) + exact (Procedure.binaryAdd.comp (mul.pair (Procedure.constant pairCode Nat.bits offset))).congrFun + (by intro p; cases xAxis <;> rfl) + +noncomputable opaque centerProgram : Procedure pairCode pairCode qmaLeafCenter := + (coordinateProgram true 4).pair (coordinateProgram false 4) + +noncomputable def leafProgram (a : Fin 4) : Procedure pairCode pairCode (fun p => qmaRouteLeaf p a) := by + by_cases h0 : a = 0 + · subst a + exact ((coordinateProgram true 5).pair (coordinateProgram false 5)).congrFun (by intro p; rfl) + by_cases h1 : a = 1 + · subst a + exact ((coordinateProgram true 3).pair (coordinateProgram false 5)).congrFun (by intro p; rfl) + by_cases h2 : a = 2 + · subst a + exact ((coordinateProgram true 3).pair (coordinateProgram false 3)).congrFun (by intro p; rfl) + have h3 : a = 3 := by omega + subst a + exact ((coordinateProgram true 5).pair (coordinateProgram false 3)).congrFun (by intro p; rfl) + +noncomputable opaque leafListProgram : Procedure pairCode (listCode pairCode) + (fun p => List.ofFn (qmaRouteLeaf p)) := + QuantumRawExchange.fixedListProgram pairCode pairCode 4 (fun a p => qmaRouteLeaf p a) leafProgram + +abbrev Ends := Pair × Pair +def endsCode : Ends → List Bool := prodCode pairCode pairCode +noncomputable opaque firstProgram : Procedure endsCode pairCode Prod.fst := Procedure.first _ _ +noncomputable opaque secondProgram : Procedure endsCode pairCode Prod.snd := Procedure.second _ _ +noncomputable def axisProgram (left xAxis : Bool) : Procedure endsCode Nat.bits + (fun x => if xAxis then (if left then x.1 else x.2).1 else (if left then x.1 else x.2).2) := by + let p : Procedure endsCode pairCode (fun x => if left then x.1 else x.2) := by + cases left + · exact secondProgram + · exact firstProgram + let q : Procedure pairCode Nat.bits (fun x => if xAxis then x.1 else x.2) := by + cases xAxis + · exact Procedure.second Nat.bits Nat.bits + · exact Procedure.first Nat.bits Nat.bits + exact (q.comp p).congrFun (by intro x; cases left <;> cases xAxis <;> rfl) + +noncomputable opaque directionProgram : Procedure endsCode Nat.bits + (fun x => (qmaGridNeighborIndex x.1 x.2).val) := by + let one := Procedure.constant endsCode Nat.bits 1 + let east := Procedure.binaryEq.comp ((axisProgram false true).pair + (Procedure.binaryAdd.comp ((axisProgram true true).pair one))) + let north := Procedure.binaryEq.comp ((axisProgram false false).pair + (Procedure.binaryAdd.comp ((axisProgram true false).pair one))) + let west := Procedure.binaryEq.comp ((Procedure.binaryAdd.comp ((axisProgram false true).pair one)).pair + (axisProgram true true)) + exact (Procedure.conditional east (Procedure.constant endsCode Nat.bits 0) + (Procedure.conditional north (Procedure.constant endsCode Nat.bits 1) + (Procedure.conditional west (Procedure.constant endsCode Nat.bits 2) + (Procedure.constant endsCode Nat.bits 3)))).congrFun + (by intro x; simp [qmaGridNeighborIndex]; split_ifs <;> rfl) + +noncomputable opaque selectedLeafProgram : Procedure endsCode pairCode + (fun x => qmaRouteLeaf x.1 (qmaGridNeighborIndex x.1 x.2)) := by + let isZero := Procedure.binaryEq.comp (directionProgram.pair (Procedure.constant endsCode Nat.bits 0)) + let isOne := Procedure.binaryEq.comp (directionProgram.pair (Procedure.constant endsCode Nat.bits 1)) + let isTwo := Procedure.binaryEq.comp (directionProgram.pair (Procedure.constant endsCode Nat.bits 2)) + exact (Procedure.conditional isZero ((leafProgram 0).comp firstProgram) + (Procedure.conditional isOne ((leafProgram 1).comp firstProgram) + (Procedure.conditional isTwo ((leafProgram 2).comp firstProgram) + ((leafProgram 3).comp firstProgram)))).congrFun (by + intro x + generalize h : qmaGridNeighborIndex x.1 x.2 = a + fin_cases a <;> simp [h]) + +noncomputable def centerCertificate : Turing.TM2ComputableInPolyTime pairCode pairCode qmaLeafCenter := + centerProgram.toTM2 +noncomputable def selectedLeafCertificate : Turing.TM2ComputableInPolyTime endsCode pairCode + (fun x => qmaRouteLeaf x.1 (qmaGridNeighborIndex x.1 x.2)) := selectedLeafProgram.toTM2 + +end ContinuumCoulomb.QuantumRouteLeafCode + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutePermissionCongr.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutePermissionCongr.lean new file mode 100644 index 0000000000000000000000000000000000000000..ea0bb5b828d1781bd44a53a3e1be9f2d7ff286c9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutePermissionCongr.lean @@ -0,0 +1,33 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRouteSelectorProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathTable + +namespace OAI + +/-! The route selector depends on permission bits, independently of the +order in which the finite table records the same geometry. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumRouteSelectorProgram +open scoped Classical +open QuantumRoutingTable QuantumTaggedRouteProgram + +theorem value_congr {t u : Table} (h : ∀ B, allowed t B = allowed u B) + (ends : Ends) : value (t,ends) = value (u,ends) := by + have ht : tagged t = tagged u := by + funext R + change (allowed t R.body && decide R.body.Valid,R.path) = + (allowed u R.body && decide R.body.Valid,R.path) + rw [h] + simp only [value,candidates,ht] + +theorem compiled_value {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + (es : List G.Edge) (hcover : ∀ e, e ∈ es) (ends : Ends) : + value (QuantumPathTable.compile (List.ofFn P.position,es.map P.routeList),ends) = + value (P.routingTable,ends) := + value_congr (QuantumPathTable.compile_allowed P es hcover) ends + +end ContinuumCoulomb.QuantumRouteSelectorProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..6cbe9ebaae6559e1f08de826690d48cc57961582 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteProgram.lean @@ -0,0 +1,86 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumManhattanRoute +import OAI.Computability.QuantumFactoring.Procedure + +namespace OAI + +/-! Literal polynomial programs for the lattice route length and each route point. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumRouteCode +open ExactQuantumFactoring.BitStackProgram + +abbrev Pair := ℕ × ℕ +def pairCode : Pair → List Bool := prodCode Nat.bits Nat.bits +abbrev AxisInput := Pair × ℕ +def axisCode : AxisInput → List Bool := prodCode pairCode Nat.bits + +noncomputable opaque distanceProgram : Procedure pairCode Nat.bits (fun x => Nat.dist x.1 x.2) := by + let a := Procedure.first Nat.bits Nat.bits + let b := Procedure.second Nat.bits Nat.bits + exact Procedure.binaryAdd.comp ((Procedure.binarySub.comp (a.pair b)).pair + (Procedure.binarySub.comp (b.pair a))) + +noncomputable opaque axisPairProgram : Procedure axisCode pairCode Prod.fst := Procedure.first _ _ +noncomputable opaque axisStartProgram : Procedure axisCode Nat.bits (fun x => x.1.1) := + (Procedure.first _ _).comp axisPairProgram +noncomputable opaque axisEndProgram : Procedure axisCode Nat.bits (fun x => x.1.2) := + (Procedure.second _ _).comp axisPairProgram +noncomputable opaque axisCursorProgram : Procedure axisCode Nat.bits Prod.snd := Procedure.second _ _ + +noncomputable opaque axisProgram : Procedure axisCode Nat.bits (fun x => qmaAxisWalk x.1.1 x.1.2 x.2) := + (Procedure.conditional (Procedure.binaryLe.comp (axisStartProgram.pair axisEndProgram)) + (Procedure.binaryAdd.comp (axisStartProgram.pair axisCursorProgram)) + (Procedure.binarySub.comp (axisStartProgram.pair axisCursorProgram))).congrFun + (by intro x; simp [qmaAxisWalk]) + +abbrev RouteInput := (Pair × Pair) × ℕ +def routeCode : RouteInput → List Bool := prodCode (prodCode pairCode pairCode) Nat.bits +noncomputable opaque endsProgram : Procedure routeCode (prodCode pairCode pairCode) Prod.fst := + Procedure.first _ _ +noncomputable opaque startProgram : Procedure routeCode pairCode (fun x => x.1.1) := + (Procedure.first _ _).comp endsProgram +noncomputable opaque endProgram : Procedure routeCode pairCode (fun x => x.1.2) := + (Procedure.second _ _).comp endsProgram +noncomputable opaque cursorProgram : Procedure routeCode Nat.bits Prod.snd := Procedure.second _ _ +noncomputable opaque startXProgram : Procedure routeCode Nat.bits (fun x => x.1.1.1) := + (Procedure.first _ _).comp startProgram +noncomputable opaque startYProgram : Procedure routeCode Nat.bits (fun x => x.1.1.2) := + (Procedure.second _ _).comp startProgram +noncomputable opaque endXProgram : Procedure routeCode Nat.bits (fun x => x.1.2.1) := + (Procedure.first _ _).comp endProgram +noncomputable opaque endYProgram : Procedure routeCode Nat.bits (fun x => x.1.2.2) := + (Procedure.second _ _).comp endProgram +noncomputable opaque horizontalLengthProgram : Procedure routeCode Nat.bits + (fun x => Nat.dist x.1.1.1 x.1.2.1) := + distanceProgram.comp (startXProgram.pair endXProgram) +noncomputable opaque verticalLengthProgram : Procedure routeCode Nat.bits + (fun x => Nat.dist x.1.1.2 x.1.2.2) := + distanceProgram.comp (startYProgram.pair endYProgram) +noncomputable opaque lengthProgram : Procedure routeCode Nat.bits + (fun x => qmaManhattanLength x.1.1 x.1.2) := + Procedure.binaryAdd.comp (horizontalLengthProgram.pair verticalLengthProgram) + +noncomputable opaque horizontalPointProgram : Procedure routeCode Nat.bits + (fun x => qmaAxisWalk x.1.1.1 x.1.2.1 x.2) := + axisProgram.comp ((startXProgram.pair endXProgram).pair cursorProgram) +noncomputable opaque verticalPointProgram : Procedure routeCode Nat.bits + (fun x => qmaAxisWalk x.1.1.2 x.1.2.2 (x.2-Nat.dist x.1.1.1 x.1.2.1)) := + axisProgram.comp ((startYProgram.pair endYProgram).pair + (Procedure.binarySub.comp (cursorProgram.pair horizontalLengthProgram))) + +noncomputable opaque pointProgram : Procedure routeCode pairCode + (fun x => qmaManhattanPoint x.1.1 x.1.2 x.2) := + (Procedure.conditional (Procedure.binaryLe.comp (cursorProgram.pair horizontalLengthProgram)) + (horizontalPointProgram.pair startYProgram) (endXProgram.pair verticalPointProgram)).congrFun + (by intro x; simp [qmaManhattanPoint]) + +noncomputable def pointCertificate : Turing.TM2ComputableInPolyTime routeCode pairCode + (fun x => qmaManhattanPoint x.1.1 x.1.2 x.2) := pointProgram.toTM2 +noncomputable def lengthCertificate : Turing.TM2ComputableInPolyTime routeCode Nat.bits + (fun x => qmaManhattanLength x.1.1 x.1.2) := lengthProgram.toTM2 + +end ContinuumCoulomb.QuantumRouteCode + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteSelectorCorrectness.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteSelectorCorrectness.lean new file mode 100644 index 0000000000000000000000000000000000000000..78fc93b921bd6dbc9c9ed4f576c8096ab607d0e6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteSelectorCorrectness.lean @@ -0,0 +1,70 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRouteSelectorProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingTableCorrectness +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRouteCandidates + +namespace OAI + +/-! The finite data program returns exactly the path used by the actual +merged physical graph, rather than merely a path with the same endpoints. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical +open QuantumRoutingTable QuantumTaggedRouteProgram QuantumRouteSelectorProgram +open QuantumFiniteRouteSearch + +namespace QMACellRoute + +theorem headD_path (R : QMACellRoute) : R.path.headD (0,0) = R.source := by + rw [List.headD_eq_head?_getD,R.endpoints.1] + rfl + +theorem reverse_headD_path (R : QMACellRoute) : R.path.reverse.headD (0,0) = R.target := by + rw [List.headD_eq_head?_getD,List.head?_reverse,R.endpoints.2] + rfl + +end QMACellRoute + +namespace QMAPortRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + +theorem routing_accepts (ends : Ends) (R : QMACellRoute) : + accepts ends (tagged P.routingTable R) = + decide (P.RoutingAllowed R.body ∧ R.Valid ∧ R.source=ends.1 ∧ R.target=ends.2) := by + apply Bool.eq_iff_iff.mpr + simp only [accepts,tagged,Bool.and_eq_true,bodyPermitted_eq_true,decide_eq_true_eq, + P.routingTable_allowed,R.headD_path,R.reverse_headD_path,QMACellRoute.Valid] + constructor + · rintro ⟨⟨⟨ha,hv⟩,hs⟩,ht⟩ + exact decide_eq_true ⟨ha,hv,hs,ht⟩ + · intro h + obtain ⟨ha,hv,hs,ht⟩ := of_decide_eq_true h + exact ⟨⟨⟨ha,hv⟩,hs⟩,ht⟩ + +theorem selected_merged_path (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) + (havoid : ∀ i : P.Interior, ∀ v, P.cell i ≠ P.position v) + (e : (P.crossingOutput N hD).merge.Edge) : + QuantumRouteSelectorProgram.value (P.routingTable, + P.crossingPosition N D ((P.crossingOutput N hD).merge.left e), + P.crossingPosition N D ((P.crossingOutput N hD).merge.right e)) = + (P.mergedOutputRoute N hD havoid e).path := by + let ends : Ends := + (P.crossingPosition N D ((P.crossingOutput N hD).merge.left e), + P.crossingPosition N D ((P.crossingOutput N hD).merge.right e)) + have hf : (qmaRouteCandidates ends.1 ends.2).find? + (fun R => accepts ends (tagged P.routingTable R)) = + some (P.mergedOutputRoute N hD havoid e) := by + simp only [P.routing_accepts] + exact P.mergedOutputRoute_find N hD havoid e + have h := selectParallelValue_eq (false,[]) (qmaRouteCandidates ends.1 ends.2) + (fun R => accepts ends (tagged P.routingTable R)) (tagged P.routingTable) + (qmaRouteCandidates_length ends.1 ends.2) hf + have hs := congrArg (fun v : Tagged => v.2) h + simpa only [value,choose,candidates,List.map_map,Function.comp_def,tagged] using hs + +end QMAPortRouteData +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteSelectorProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteSelectorProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..f73c0590a206213be79bdd6c29493284a52dad59 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRouteSelectorProgram.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTaggedRouteProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumParallelRouteSearch + +namespace OAI + +/-! A literal 140-entry selector checks finite permissions and both physical +endpoints. No unbounded search or choice occurs in the resulting program. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumRouteSelectorProgram +open ExactQuantumFactoring.BitStackProgram QuantumRouteCode +open QuantumTaggedRouteProgram QuantumFiniteRouteSearch + +abbrev Ends := Pair × Pair +def endsCode : Ends → List Bool := prodCode pairCode pairCode +def accepts (ends : Ends) (v : Tagged) : Bool := + v.1 && decide (v.2.headD (0,0) = ends.1) && decide (v.2.reverse.headD (0,0) = ends.2) + +noncomputable opaque matchProgram : Procedure (prodCode endsCode taggedCode) Procedure.boolCode + (fun x => accepts x.1 x.2) := by + let ends := Procedure.first endsCode taggedCode + let tag := Procedure.second endsCode taggedCode + let bit := (Procedure.first Procedure.boolCode (listCode pairCode)).comp tag + let path := (Procedure.second Procedure.boolCode (listCode pairCode)).comp tag + let head := (Procedure.listHead pairCode (0,0)).comp path + let last := (Procedure.listHead pairCode (0,0)).comp + ((Procedure.listReverse pairCode (0,0)).comp path) + let left := QuantumFiniteMembership.pairEqProgram.comp + (head.pair ((Procedure.first pairCode pairCode).comp ends)) + let right := QuantumFiniteMembership.pairEqProgram.comp + (last.pair ((Procedure.second pairCode pairCode).comp ends)) + exact Procedure.boolAnd.comp ((Procedure.boolAnd.comp (bit.pair left)).pair right) + +def choose (x : Ends × List Tagged) : List Pair := + (selectParallelValue (false,[]) (x.2,x.2.map (accepts x.1))).2 + +noncomputable opaque chooseProgram : Procedure (prodCode endsCode (listCode taggedCode)) + (listCode pairCode) choose := by + let bits := Procedure.listMapWith (false,[]) false matchProgram + let tags := Procedure.second endsCode (listCode taggedCode) + let chosen := (selectParallelProgram taggedCode (false,[])).comp (tags.pair bits) + exact (Procedure.second Procedure.boolCode (listCode pairCode)).comp chosen + +abbrev Input := QuantumRoutingTable.Table × Ends +def inputCode : Input → List Bool := prodCode QuantumRoutingTable.tableCode endsCode + +def candidates (x : Input) : List Tagged := + (qmaRouteCandidates x.2.1 x.2.2).map (tagged x.1) + +noncomputable opaque candidatesProgram : Procedure inputCode (listCode taggedCode) candidates := by + let table := Procedure.first QuantumRoutingTable.tableCode endsCode + let ends := Procedure.second QuantumRoutingTable.tableCode endsCode + let leftCell := QuantumCellPathProgram.pointCellProgram.comp + ((Procedure.first pairCode pairCode).comp ends) + let rightCell := QuantumCellPathProgram.pointCellProgram.comp + ((Procedure.second pairCode pairCode).comp ends) + let left := QuantumTaggedRouteProgram.cellProgram.comp (table.pair leftCell) + let right := QuantumTaggedRouteProgram.cellProgram.comp (table.pair rightCell) + exact ((Procedure.listAppend taggedCode (false,[])).comp (left.pair right)).congrFun (by + intro x + simp only [Function.comp_apply,candidates,qmaRouteCandidates,List.map_append]) + +def value (x : Input) : List Pair := choose (x.2,candidates x) + +noncomputable opaque program : Procedure inputCode (listCode pairCode) value := + chooseProgram.comp ((Procedure.second _ _).pair candidatesProgram) + +noncomputable def certificate : Turing.TM2ComputableInPolyTime inputCode (listCode pairCode) value := + program.toTM2 + +end ContinuumCoulomb.QuantumRouteSelectorProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutedSubdivision.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutedSubdivision.lean new file mode 100644 index 0000000000000000000000000000000000000000..4b1c4664b8d5b4b99d35d80b3fbef07ce691c1cf --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutedSubdivision.lean @@ -0,0 +1,72 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathPlacement +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathScheduleSize + +namespace OAI + +/-! Complete odd-route realization with the actual rational Hamiltonian, +finite rectangle, degree bound and accumulated full-space spectral error. -/ + +noncomputable section +namespace ContinuumCoulomb +open MediatorGraph +open scoped Classical +namespace QMAPathEmbedding +variable {W : QMAPathSchedule} {Γ : SimpleGraph (ℕ × ℕ)} (P : QMAPathEmbedding W Γ) + +def Bounded (X Y : ℕ) : Prop := + (∀ v, (P.position v).1 < X ∧ (P.position v).2 < Y) ∧ + ∀ e k, k ≤ 2*W.work e+1 → (P.point e k).1 < X ∧ (P.point e k).2 < Y + +theorem next_bounded (N : ℚ) {X Y : ℕ} (h : P.Bounded X Y) : (P.next N).Bounded X Y := by + constructor + · change ∀ v : Fin (W.graph.n+W.active.card*2), + (P.nextPosition v).1 < X ∧ (P.nextPosition v).2 < Y + intro v + obtain ⟨v,rfl⟩ := (vertexEquiv W.graph.n W.active.card).surjective v + rcases v with v | ⟨i,b⟩ + · change (P.nextPosition (old _ _ v)).1 < X ∧ (P.nextPosition (old _ _ v)).2 < Y + simpa only [nextPosition_old] using h.1 v + · have hw := W.selected_work_pos i + have hb := b.isLt + change (P.nextPosition (fresh _ _ i b)).1 < X ∧ (P.nextPosition (fresh _ _ i b)).2 < Y + simpa only [nextPosition_fresh,freshPosition] using + h.2 (qmaSelectedIndex W.active i) (b.val+1) (by omega) + · intro e k hk + exact h.2 (W.nextParent e) (W.nextIndex e k) (W.nextIndex_bounds e hk) + +def iterate (P : QMAPathEmbedding W Γ) (N : ℚ) : (k : ℕ) → QMAPathEmbedding (W.iterate N k) Γ + | 0 => P + | k+1 => (iterate P N k).next N + +theorem iterate_bounded (N : ℚ) {X Y : ℕ} (h : P.Bounded X Y) (k : ℕ) : + (P.iterate N k).Bounded X Y := by + induction k with + | zero => exact h + | succ k ih => + change ((P.iterate N k).next N).Bounded X Y + exact (P.iterate N k).next_bounded N ih + +theorem realize {N : ℚ} (hN : 0 < N) {D X Y d : ℕ} (h3 : 3 ≤ d) + (hD : ∀ e, W.work e ≤ D) (hbox : P.Bounded X Y) + (hd : ∀ v, qmaGraphDegree W.graph.left W.graph.right v ≤ d) : + ∃ (H : QMARationalExchangeGraph) (position : Fin H.n → ℕ × ℕ), + Function.Injective position ∧ + (∀ v, (position v).1 < X ∧ (position v).2 < Y) ∧ + (∀ e, Γ.Adj (position (H.left e)) (position (H.right e))) ∧ + (∀ v, qmaGraphDegree H.left H.right v ≤ d) ∧ + H.n+Fintype.card H.Edge ≤ 5^D*(W.graph.n+Fintype.card W.graph.Edge) ∧ + |H.energy-W.graph.energy| ≤ (D:ℝ)/(N:ℝ) := by + let Q := P.iterate N D + refine ⟨(W.iterate N D).graph,Q.position,Q.position_injective,?_,?_,?_,?_,?_⟩ + · exact (P.iterate_bounded N hbox D).1 + · exact Q.adjacent_of_complete (W.iterate_complete N hD) + · exact W.iterate_degree N h3 hd D + · exact W.iterate_size N D + · exact W.iterate_energy_error hN D + +end QMAPathEmbedding +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingBlocks.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingBlocks.lean new file mode 100644 index 0000000000000000000000000000000000000000..057deab9d96a74a8c2153a7c02d5463fc606cb61 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingBlocks.lean @@ -0,0 +1,81 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.ManyBody.MediatorForms + +namespace OAI + +/-! Low and high blocks for the finite singlet stars used in lattice routing. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker InnerProductSpace + +def routingCoupling (n r : ℕ) + (W : Matrix (MediatedSpinBasis n r) (MediatedSpinBasis n r) ℂ) : + MediatorLowSpace n →L[ℝ] MediatorHighSpace n r := + ((mediatorHighRestriction n r).comp + ((spinMatrixOperator W).comp (mediatorLowInclusion n r))).restrictScalars ℝ + +def routingHighBlock (n r : ℕ) + (C : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) + (W : Matrix (MediatedSpinBasis n r) (MediatedSpinBasis n r) ℂ) : + MediatorHighSpace n r →L[ℝ] MediatorHighSpace n r := + ((mediatorHighRestriction n r).comp + ((spinMatrixOperator (C ⊗ₖ 1 + W)).comp + (mediatorHighInclusion n r))).restrictScalars ℝ + +theorem routingCoupling_norm (n r : ℕ) + (W : Matrix (MediatedSpinBasis n r) (MediatedSpinBasis n r) ℂ) : + ‖routingCoupling n r W‖ ≤ ‖spinMatrixOperator W‖ := by + unfold routingCoupling + rw [ContinuousLinearMap.norm_restrictScalars] + exact HubbardGlobal.coordinateCompression_norm _ _ _ + (mediatorHighRestriction_norm n r) (mediatorLowInclusion_norm n r) + +theorem routingHighBlock_norm (n r : ℕ) + (C : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) + (W : Matrix (MediatedSpinBasis n r) (MediatedSpinBasis n r) ℂ) : + ‖routingHighBlock n r C W‖ ≤ + ‖spinMatrixOperator (C ⊗ₖ (1 : Matrix (MediatorBasis r) (MediatorBasis r) ℂ))‖ + + ‖spinMatrixOperator W‖ := by + unfold routingHighBlock + rw [ContinuousLinearMap.norm_restrictScalars] + exact (HubbardGlobal.coordinateCompression_norm _ _ _ + (mediatorHighRestriction_norm n r) (mediatorHighInclusion_norm n r)).trans + (spinMatrixOperator_add_norm_bound _ _ _ le_rfl) + +theorem routing_second_order (n r : ℕ) {Delta : ℝ} (hDelta : 0 < Delta) + (C : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) + (W : Matrix (MediatedSpinBasis n r) (MediatedSpinBasis n r) ℂ) + {epsilon : ℝ} (hepsilon : 0 ≤ epsilon) (hsmall : epsilon ≤ 1 / 4) + (hbound : ‖spinMatrixOperator (C ⊗ₖ (1 : Matrix (MediatorBasis r) (MediatorBasis r) ℂ))‖ + + ‖spinMatrixOperator W‖ ≤ epsilon * (4 * Delta)) : + |Perturbation.lowBlockBottom (actualMediatorLowBlock n r C) + (diagonalPenalty (actualMediatorWeight n r Delta)) + (routingHighBlock n r C W) (routingCoupling n r W) - + Perturbation.effectiveBottom (actualMediatorLowBlock n r C) + (diagonalPenalty (fun s => (actualMediatorWeight n r Delta s)⁻¹)) + (routingCoupling n r W)| ≤ 16 * Delta * epsilon ^ 3 := by + obtain ⟨hAT, hT, hgap⟩ := actualMediator_inverse_data n r hDelta + have hg : 0 < 4 * Delta := by positivity + have hB : ‖routingCoupling n r W‖ ≤ epsilon * (4 * Delta) := + (routingCoupling_norm n r W).trans + ((le_add_of_nonneg_left (norm_nonneg _)).trans hbound) + have hC : ‖actualMediatorLowBlock n r C‖ ≤ epsilon * (4 * Delta) := + (actualMediatorLowBlock_norm n r C).trans + ((le_add_of_nonneg_right (norm_nonneg _)).trans hbound) + have hD := (routingHighBlock_norm n r C W).trans hbound + have hu : ‖(EuclideanSpace.single (fun _ : Fin n => (0 : Fin 2)) (1 : ℂ) : + MediatorLowSpace n)‖ = 1 := by simp + convert Perturbation.finite_lowBlockBottom_second_order + (actualMediatorLowBlock n r C) (diagonalPenalty (actualMediatorWeight n r Delta)) + (diagonalPenalty (fun s => (actualMediatorWeight n r Delta s)⁻¹)) + (routingHighBlock n r C W) (routingCoupling n r W) + hg hepsilon hsmall hAT (diagonalPenalty_symmetric _) + (fun q => (mul_nonneg hg.le (sq_nonneg ‖q‖)).trans (hgap q)) hgap hT hB hC hD _ hu using 1 + ring + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingCrossingTest.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingCrossingTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..ba2c755d8865ac29926286cddd4243594c0d4499 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingCrossingTest.lean @@ -0,0 +1,100 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingTableCorrectness + +namespace OAI + +/-! Crossing cells are detected from the two opposite port pairs in the finite +visit table. No search over a proof-level finite type is needed. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical +open ExactQuantumFactoring.BitStackProgram QuantumRouteCode QuantumRoutingTable +namespace QMAPortRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + + theorem crossing_iff_opposite_visits (p : Pair) : P.IsCrossing p ↔ + (p,(0,2)) ∈ P.routingTable.2.1 ∧ (p,(1,3)) ∈ P.routingTable.2.1 := by + have h02 := P.routingTable_pair p (0 : Fin 4) 2 + have h13 := P.routingTable_pair p (1 : Fin 4) 3 + change ((p,(0,2)) ∈ P.routingTable.2.1 ↔ _) at h02 + change ((p,(1,3)) ∈ P.routingTable.2.1 ↔ _) at h13 + rw [h02,h13] + constructor + · rintro ⟨i,j,hij,hi,hj,hpair⟩ + have h02 : s(0,2) ∈ P.pairing i j := by + rw [hpair] + simp [qmaCrossPortPairing] + have h13 : s(1,3) ∈ P.pairing i j := by + rw [hpair] + simp [qmaCrossPortPairing] + change s(0,2) ∈ ({s(P.port i 0,P.port i 1),s(P.port j 0,P.port j 1)} : + Finset (Sym2 (Fin 4))) at h02 + change s(1,3) ∈ ({s(P.port i 0,P.port i 1),s(P.port j 0,P.port j 1)} : + Finset (Sym2 (Fin 4))) at h13 + simp only [Finset.mem_insert,Finset.mem_singleton] at h02 h13 + rcases h02 with h02 | h02 + · refine ⟨⟨i,hi,h02.symm⟩,?_⟩ + rcases h13 with h13 | h13 + · exact False.elim ((by decide : (s(0,2) : Sym2 (Fin 4)) ≠ s(1,3)) + (h02.trans h13.symm)) + · exact ⟨j,hj,h13.symm⟩ + · refine ⟨⟨j,hj,h02.symm⟩,?_⟩ + rcases h13 with h13 | h13 + · exact ⟨i,hi,h13.symm⟩ + · exact False.elim ((by decide : (s(0,2) : Sym2 (Fin 4)) ≠ s(1,3)) + (h02.trans h13.symm)) + · rintro ⟨⟨i,hi,h02⟩,⟨j,hj,h13⟩⟩ + have hij : i ≠ j := by + intro he + subst j + exact (by decide : (s(0,2) : Sym2 (Fin 4)) ≠ s(1,3)) (h02.symm.trans h13) + refine ⟨i,j,hij,hi,hj,?_⟩ + change {s(P.port i 0,P.port i 1),s(P.port j 0,P.port j 1)} = _ + rw [h02,h13] + rfl + +end QMAPortRouteData +namespace QuantumRoutingTable + +def crossingTest (t : Table) (p : Pair) : Bool := + decide ((p,(0,2)) ∈ t.2.1) && decide ((p,(1,3)) ∈ t.2.1) + +def computedCrossings (t : Table) : List Pair := + (t.2.1.map Prod.fst).filter (crossingTest t) + + theorem mem_computedCrossings (t : Table) (p : Pair) : + p ∈ computedCrossings t ↔ crossingTest t p = true := by + simp only [computedCrossings,List.mem_filter] + constructor + · exact And.right + · intro h + have hv : (p,(0,2)) ∈ t.2.1 := by + have hh : decide ((p,(0,2)) ∈ t.2.1) = true ∧ + decide ((p,(1,3)) ∈ t.2.1) = true := by + simpa only [crossingTest,Bool.and_eq_true] using h + exact of_decide_eq_true hh.1 + exact ⟨List.mem_map.mpr ⟨(p,(0,2)),hv,rfl⟩,h⟩ + + theorem crossingTest_correct {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) (p : Pair) : + crossingTest P.routingTable p = true ↔ P.IsCrossing p := by + simp only [crossingTest,Bool.and_eq_true,decide_eq_true_eq] + exact (P.crossing_iff_opposite_visits p).symm + + theorem computedCrossings_correct {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + (p : Pair) : p ∈ computedCrossings P.routingTable ↔ P.IsCrossing p := by + rw [mem_computedCrossings,crossingTest_correct] + +noncomputable def crossingTestProgram : Procedure inputCode Procedure.boolCode + (fun x => crossingTest x.1 x.2) := by + let memp := QuantumFiniteMembership.memberProgram visitCode ((0,0),(0,0)) + (Procedure.prodEq QuantumFiniteMembership.pairEqProgram QuantumFiniteMembership.pairEqProgram) + let check (a b : ℕ) := memp.comp + ((cellProgram.pair (Procedure.constant inputCode pairCode (a,b))).pair visitsProgram) + exact Procedure.boolAnd.comp ((check 0 2).pair (check 1 3)) + +end QuantumRoutingTable +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingFamily.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..a04c0ec30b7f045dac964d90112d858146e268e4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingFamily.lean @@ -0,0 +1,125 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkRoutingPaths +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumComputedRouteSelector + +namespace OAI + +/-! Literal enumeration of every coarse route and source center. These are +the exact lists consumed by the finite crossing and permission tables. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumRoutingFamily +open ExactQuantumFactoring.BitStackProgram QuantumRouteCode QuantumRoutingInputProgram + +def placed (A B : ℕ) (x : Input) : Pair := + qmaBufferedCellPoint (9*B+3) + (QuantumSpatialSlotProgram.fineSite A (x.1,x.2.1.1)) (17,17) + +noncomputable opaque placedProgram (A B : ℕ) : Procedure inputCode pairCode (placed A B) := by + let cells := (Procedure.first (listCode pairCode) (listCode pairCode)).comp + ((Procedure.first (prodCode (listCode pairCode) (listCode pairCode)) + (listCode pairCode)).comp dataProgram) + let fine := (QuantumSpatialSlotProgram.fineSiteProgram A).comp (indexProgram.pair cells) + exact (QuantumEndpointListProgram.translateProgram B).comp + (fine.pair (Procedure.constant inputCode pairCode (17,17))) + +def positions (A B : ℕ) (d : Data) : List Pair := + (List.range d.1.1.length).map (fun i => placed A B (i,d)) + +noncomputable opaque positionsProgram (A B : ℕ) : Procedure dataCode (listCode pairCode) + (positions A B) := by + let cells : Procedure dataCode (listCode pairCode) (fun d => d.1.1) := + (Procedure.first (listCode pairCode) (listCode pairCode)).comp + (Procedure.first (prodCode (listCode pairCode) (listCode pairCode)) (listCode pairCode)) + let count : Procedure dataCode unaryCode (fun d => d.1.1.length) := + (ExactQuantumFactoring.NativeAIG.Emission.listUnaryLength pairCode (0,0)).comp cells + let tab : Procedure inputCode (listCode pairCode) + (fun x => (List.range x.1).map (fun i => placed A B (i,x.2))) := + Procedure.tabulate (f := fun d i => placed A B (i,d)) (0,0) (placedProgram A B) + exact (tab.comp (count.pair (Procedure.identity dataCode))).congrFun (by intro d; rfl) + +def coarse (A B : ℕ) (d : Data) : List (List Pair) := + (List.range d.2.length).map (fun i => + QuantumBufferedListProgram.path A B (value A B (i,d))) + +noncomputable opaque coarseProgram (A B : ℕ) : Procedure dataCode (listCode (listCode pairCode)) + (coarse A B) := by + let edges : Procedure dataCode (listCode pairCode) (fun d => d.2) := + Procedure.second (prodCode (listCode pairCode) (listCode pairCode)) (listCode pairCode) + let count : Procedure dataCode unaryCode (fun d => d.2.length) := + (ExactQuantumFactoring.NativeAIG.Emission.listUnaryLength pairCode (0,0)).comp edges + let tab : Procedure inputCode (listCode (listCode pairCode)) + (fun x => (List.range x.1).map (fun i => + QuantumBufferedListProgram.path A B (value A B (i,x.2)))) := + Procedure.tabulate + (f := fun d i => QuantumBufferedListProgram.path A B (value A B (i,d))) [] (pathProgram A B) + exact (tab.comp (count.pair (Procedure.identity dataCode))).congrFun (by intro d; rfl) + +def table (A B : ℕ) (d : Data) : QuantumPathTable.Input := + (positions A B d,coarse A B d) + +noncomputable def tableProgram (A B : ℕ) : + Procedure dataCode QuantumPathTable.inputCode (table A B) := + (positionsProgram A B).pair (coarseProgram A B) + +theorem placed_actual {A B : ℕ} (M : QMASpatialExchangeModel A B) {m : ℕ} + (labels : M.Term ≃ Fin m) (q : Fin M.n) : + placed A B (q.val,actualData M labels) = (M.withOrdinalSlots labels).placedVertex q := by + unfold placed actualData + rw [QuantumSpatialSlotProgram.fineSite_actual M labels q] + rfl + +theorem positions_actual {A B : ℕ} (M : QMASpatialExchangeModel A B) {m : ℕ} + (labels : M.Term ≃ Fin m) : + positions A B (actualData M labels) = List.ofFn (M.withOrdinalSlots labels).placedVertex := by + apply List.ext_getElem + · simp only [positions,actualData,List.length_map,List.length_range,List.length_ofFn] + rfl + · intro i hi hj + have hi' : i < M.n := by simpa only [List.length_ofFn, + QMASpatialExchangeModel.withOrdinalSlots] using hj + simp only [positions,List.getElem_map,List.getElem_range,List.getElem_ofFn] + exact placed_actual M labels ⟨i,hi'⟩ + +theorem coarse_actual {A B : ℕ} (M : QMASpatialExchangeModel A B) {m : ℕ} + (labels : M.Term ≃ Fin m) (hA : 0 < A) + (hd : ∀ v, qmaGraphDegree M.left M.right v ≤ 3) : + coarse A B (actualData M labels) = List.ofFn (fun e : Fin m => + ((M.withOrdinalSlots labels).bufferedPath hd (labels.symm e)).val.support) := by + apply List.ext_getElem + · simp only [coarse,actualData,List.length_map,List.length_range,List.length_ofFn] + · intro i hi hj + have hi' : i < m := by simpa only [List.length_ofFn] using hj + have h := path_actual M labels hA hd (labels.symm ⟨i,hi'⟩) + simpa only [coarse,List.getElem_map,List.getElem_range,List.getElem_ofFn, + Equiv.apply_symm_apply] using h + +private theorem support_range {u v : Pair} (p : qmaSquareGrid.Walk u v) : + p.support = (List.range (p.length+1)).map p.getVert := by + apply List.ext_getElem + · simp only [p.length_support,List.length_map,List.length_range] + · intro i hi hj + have hi' : i ≤ p.length := by + simp only [p.length_support] at hi + omega + simpa only [List.getElem_map,List.getElem_range] using + (p.getVert_eq_support_getElem hi').symm + +theorem table_actual {A B : ℕ} (M : QMASpatialExchangeModel A B) {m : ℕ} + (labels : M.Term ≃ Fin m) (hA : 0 < A) + (hd : ∀ v, qmaGraphDegree M.left M.right v ≤ 3) : + table A B (actualData M labels) = + (List.ofFn (M.withOrdinalSlots labels).placedVertex, + List.ofFn (fun e : Fin m => + ((M.withOrdinalSlots labels).portRouteData hA hd).routeList (labels.symm e))) := by + unfold table + rw [positions_actual,coarse_actual M labels hA hd] + apply congrArg (Prod.mk _) + apply congrArg List.ofFn + funext e + exact support_range ((M.withOrdinalSlots labels).bufferedPath hd (labels.symm e)).val + +end ContinuumCoulomb.QuantumRoutingFamily + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingForms.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingForms.lean new file mode 100644 index 0000000000000000000000000000000000000000..5552a92ca3a15cce99d321cee631e8b9d95595e0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingForms.lean @@ -0,0 +1,154 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingBlocks + +namespace OAI + +/-! Exact quadratic forms for the finite singlet routing gadgets. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker InnerProductSpace + +theorem routingLowRestriction_low (n r : ℕ) + (W : Matrix (MediatedSpinBasis n r) (MediatedSpinBasis n r) ℂ) + (hWlow : mediatorCompression n r W = 0) (p : MediatorLowSpace n) : + mediatorLowRestriction n r (spinMatrixOperator W + (mediatorLowInclusion n r p)) = 0 := by + have h := congrArg (fun T : MediatorLowSpace n →L[ℂ] MediatorLowSpace n => T p) + (mediatorLow_operator_compression n r W) + simpa only [ContinuousLinearMap.comp_apply, hWlow, + spinMatrixOperator_zero, _root_.zero_apply] using h + +/-- Hopping a singlet-sector state creates only actual mediator excitations. -/ +theorem routingHighInclusion_coupling (n r : ℕ) + (W : Matrix (MediatedSpinBasis n r) (MediatedSpinBasis n r) ℂ) + (hWlow : mediatorCompression n r W = 0) (p : MediatorLowSpace n) : + mediatorHighInclusion n r (routingCoupling n r W p) = + spinMatrixOperator W + (mediatorLowInclusion n r p) := by + change mediatorHighInclusion n r (mediatorHighRestriction n r + (spinMatrixOperator W + (mediatorLowInclusion n r p))) = _ + have h := mediator_full_decomposition n r + (spinMatrixOperator W + (mediatorLowInclusion n r p)) + simpa only [routingLowRestriction_low n r W hWlow, map_zero, zero_add] using h + +/-- The actual full matrix in the complete Bell-coordinate spin space. -/ +def routingHamiltonian (n r : ℕ) (Delta : ℝ) + (C : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) + (W : Matrix (MediatedSpinBasis n r) (MediatedSpinBasis n r) ℂ) : + Matrix (MediatedSpinBasis n r) (MediatedSpinBasis n r) ℂ := + bellMediatorPenaltyMatrix n r Delta + + (C ⊗ₖ 1 + W) + +/-- Exact effective quadratic form for every entangled original-spin vector. -/ +theorem routing_effectiveForm (n r : ℕ) (Delta : ℝ) + (C : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) + (W : Matrix (MediatedSpinBasis n r) (MediatedSpinBasis n r) ℂ) + (hW : W.conjTranspose = W) (hWlow : mediatorCompression n r W = 0) + (p : MediatorLowSpace n) : + Perturbation.effectiveForm (actualMediatorLowBlock n r C) + (diagonalPenalty (fun s => (actualMediatorWeight n r Delta s)⁻¹)) + (routingCoupling n r W) p = + ⟪p, spinMatrixOperator (C - mediatorCompression n r + (W * liftedMediatorInverse n r Delta * + W)) p⟫_ℝ := by + let B := routingCoupling n r W + let T := diagonalPenalty (fun s => (actualMediatorWeight n r Delta s)⁻¹) + have hB : mediatorHighInclusion n r (B p) = spinMatrixOperator W (mediatorLowInclusion n r p) := + routingHighInclusion_coupling n r W hWlow p + have hT : mediatorHighInclusion n r (T (B p)) = + spinMatrixOperator (liftedMediatorInverse n r Delta) (mediatorHighInclusion n r (B p)) := + (mediatorInverse_highInclusion n r Delta (B p)).symm + have hinner : ⟪B p, T (B p)⟫_ℝ = + ⟪p, spinMatrixOperator (mediatorCompression n r + (W * liftedMediatorInverse n r Delta * W)) p⟫_ℝ := by + calc + _ = ⟪mediatorHighInclusion n r (B p), mediatorHighInclusion n r (T (B p))⟫_ℝ := by + rw [mediatorHigh_real_inner, mediatorHighRestriction_inclusion] + _ = ⟪spinMatrixOperator W (mediatorLowInclusion n r p), + spinMatrixOperator (liftedMediatorInverse n r Delta) + (spinMatrixOperator W (mediatorLowInclusion n r p))⟫_ℝ := by rw [hT, hB] + _ = ⟪mediatorLowInclusion n r p, spinMatrixOperator W + (spinMatrixOperator (liftedMediatorInverse n r Delta) + (spinMatrixOperator W (mediatorLowInclusion n r p)))⟫_ℝ := + (spinMatrixOperator_real_symmetric W hW _ _).symm + _ = ⟪p, spinMatrixOperator (mediatorCompression n r + (W * liftedMediatorInverse n r Delta * W)) p⟫_ℝ := by + rw [mediatorLow_real_inner] + have hc := congrArg (fun A : MediatorLowSpace n →L[ℂ] MediatorLowSpace n => A p) + (mediatorLow_operator_compression n r (W * liftedMediatorInverse n r Delta * W)) + simpa only [spinMatrixOperator_mul, ContinuousLinearMap.comp_apply] using congrArg + (fun x : MediatorLowSpace n => ⟪p, x⟫_ℝ) hc + unfold Perturbation.effectiveForm Perturbation.inverseForm + rw [actualMediatorLowBlock_eq, hinner, spinMatrixOperator_sub] + simp only [ContinuousLinearMap.coe_restrictScalars', _root_.sub_apply, inner_sub_right] + + +/-- Full-state quadratic-form equality for the concrete low/high blocks. -/ +theorem routingHamiltonian_form_blocks (n r : ℕ) (Delta : ℝ) + (C : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) (hC : C.conjTranspose = C) + (W : Matrix (MediatedSpinBasis n r) (MediatedSpinBasis n r) ℂ) + (hW : W.conjTranspose = W) (hWlow : mediatorCompression n r W = 0) + (p : MediatorLowSpace n) (q : MediatorHighSpace n r) : + ⟪assembleMediator n r p q, + spinMatrixOperator (routingHamiltonian n r Delta C W) + (assembleMediator n r p q)⟫_ℝ = + Perturbation.lowBlockEnergy (actualMediatorLowBlock n r C) + (diagonalPenalty (actualMediatorWeight n r Delta)) + (routingHighBlock n r C W) + (routingCoupling n r W) p q := by + let H := spinMatrixOperator (C ⊗ₖ (1 : Matrix (MediatorBasis r) (MediatorBasis r) ℂ) + W) + let P := spinMatrixOperator (bellMediatorPenaltyMatrix n r Delta) + let lp := mediatorLowInclusion n r p + let hq := mediatorHighInclusion n r q + have hHermitian : (C ⊗ₖ (1 : Matrix (MediatorBasis r) (MediatorBasis r) ℂ) + W).conjTranspose = + C ⊗ₖ 1 + W := by + simp only [Matrix.conjTranspose_add, Matrix.conjTranspose_kronecker, hC, + Matrix.conjTranspose_one, hW] + have hPlow : P lp = 0 := bellMediatorPenalty_low n r Delta p + have hPhigh : P hq = mediatorHighInclusion n r + (diagonalPenalty (actualMediatorWeight n r Delta) q) := bellMediatorPenalty_high n r Delta q + have hPenaltyCross : ⟪lp, P hq⟫_ℝ = 0 := by + rw [hPhigh, mediatorLow_real_inner, mediatorLowRestriction_high, inner_zero_right] + have hPenaltyHigh : ⟪hq, P hq⟫_ℝ = + ⟪q, diagonalPenalty (actualMediatorWeight n r Delta) q⟫_ℝ := by + rw [hPhigh, mediatorHigh_real_inner, mediatorHighRestriction_inclusion] + have hHlow : H lp = mediatorLowInclusion n r (spinMatrixOperator C p) + spinMatrixOperator W lp := by + dsimp only [H, lp] + rw [spinMatrixOperator_add, _root_.add_apply, liftedSource_lowInclusion] + have hLow : ⟪lp, H lp⟫_ℝ = ⟪p, actualMediatorLowBlock n r C p⟫_ℝ := by + rw [hHlow, inner_add_right, mediatorLow_real_inner, mediatorLowRestriction_inclusion, + mediatorLow_real_inner, routingLowRestriction_low n r W hWlow, inner_zero_right, add_zero, + actualMediatorLowBlock_eq] + rfl + have hCross : ⟪hq, H lp⟫_ℝ = + ⟪q, routingCoupling n r W p⟫_ℝ := by + rw [hHlow, inner_add_right, mediatorHigh_real_inner, mediatorHighRestriction_low, + inner_zero_right, zero_add, mediatorHigh_real_inner] + rfl + have hReverse : ⟪lp, H hq⟫_ℝ = + ⟪q, routingCoupling n r W p⟫_ℝ := by + rw [spinMatrixOperator_real_symmetric _ hHermitian, real_inner_comm, hCross] + have hHigh : ⟪hq, H hq⟫_ℝ = + ⟪q, routingHighBlock n r C W q⟫_ℝ := by + rw [mediatorHigh_real_inner] + rfl + have hform : ⟪assembleMediator n r p q, + spinMatrixOperator (routingHamiltonian n r Delta C W) + (assembleMediator n r p q)⟫_ℝ = + ⟪lp + hq, P (lp + hq) + H (lp + hq)⟫_ℝ := by + unfold routingHamiltonian assembleMediator + rw [spinMatrixOperator_add, _root_.add_apply] + rw [hform, map_add, map_add] + simp only [inner_add_left, inner_add_right, hPlow, inner_zero_right, + hPenaltyCross, hPenaltyHigh, hLow, hCross, hReverse, hHigh, + Perturbation.lowBlockEnergy, Perturbation.blockEnergy, Perturbation.penaltyForm] + ring + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingGraph.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingGraph.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f7fcf891403ce8033507938fbbfd7c8bd2c8fd9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingGraph.lean @@ -0,0 +1,86 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingPhysical +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumExchangeRounding +import OAI.MathematicalPhysics.ContinuumCoulomb.ManyBody.MediatorGraph + +namespace OAI + +/-! Explicit ordinary-spin edges for a routing star, with the central offset. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix MediatorGraph +open scoped BigOperators Kronecker Classical +variable {ν κ : Type*} [Fintype ν] [Fintype κ] + +def qmaStarGraphLeft {n r : ℕ} (base : ν → Fin n) (_e : Fin r) (site : κ → Fin n) : + ν ⊕ (Fin r ⊕ κ) → Fin (n+r*2) + | .inl a => old n r (base a) + | .inr (.inl f) => fresh n r f 0 + | .inr (.inr a) => old n r (site a) + +def qmaStarGraphRight {n r : ℕ} (base : ν → Fin n) (e : Fin r) (member : κ → Fin 2) : + ν ⊕ (Fin r ⊕ κ) → Fin (n+r*2) + | .inl a => old n r (base a) + | .inr (.inl f) => fresh n r f 1 + | .inr (.inr a) => fresh n r e (member a) + +def qmaStarGraphWeight {r : ℕ} (base : ν → ℝ) (Delta : ℝ) (amplitude : κ → ℝ) : + ν ⊕ (Fin r ⊕ κ) → ℝ + | .inl a => base a + | .inr (.inl _) => Delta + | .inr (.inr a) => amplitude a + +omit [Fintype ν] [Fintype κ] in +theorem qmaStarGraph_distinct {n r : ℕ} (left right : ν → Fin n) + (hneq : ∀ a, left a ≠ right a) (e : Fin r) (site : κ → Fin n) (member : κ → Fin 2) : + ∀ a, qmaStarGraphLeft left e site a ≠ qmaStarGraphRight right e member a := by + intro a + rcases a with a | a + · exact fun h => hneq a (old_injective n r h) + · rcases a with f | a + · intro h + have hf := congrArg Prod.snd (fresh_injective n r (a₁ := (f,0)) (a₂ := (f,1)) h) + norm_num at hf + · exact old_ne_fresh n r _ _ _ + +theorem qmaStarGraph_matrix {n r : ℕ} (left right : ν → Fin n) + (hneq : ∀ a, left a ≠ right a) (weight : ν → ℝ) (constant Delta : ℝ) + (e : Fin r) (site : κ → Fin n) (member : κ → Fin 2) (amplitude : κ → ℝ) : + (qmaExchangeMatrix (qmaStarGraphLeft left e site) (qmaStarGraphRight right e member) + (qmaStarGraphWeight weight Delta amplitude) (constant+3*r*Delta)).submatrix + (basisEquiv n r) (basisEquiv n r) = + qmaPhysicalRoutingHamiltonian n r Delta (qmaExchangeMatrix left right weight constant) + e site member amplitude := by + simp only [qmaExchangeMatrix,Fintype.sum_sum_type,qmaStarGraphLeft,qmaStarGraphRight, + qmaStarGraphWeight,submatrix_add_apply,submatrix_sum,submatrix_smul_apply, + Matrix.submatrix_one_equiv,heisenberg_old n r _ _ (hneq _),heisenberg_central, + heisenberg_spoke] + unfold qmaPhysicalRoutingHamiltonian qmaPhysicalSingletStar + rw [physicalMediatorPenalty_offset] + simp only [Matrix.add_kronecker,Matrix.kronecker_add,Matrix.smul_kronecker, + Matrix.kronecker_smul,Matrix.one_kronecker_one,sum_kronecker,kronecker_sum, + Complex.ofReal_add,add_smul,Finset.smul_sum] + abel + +theorem qmaExchangeMatrix_lift {n r : ℕ} (left right : ν → Fin n) + (hneq : ∀ a, left a ≠ right a) (weight : ν → ℝ) (constant : ℝ) : + (qmaExchangeMatrix (fun a => old n r (left a)) (fun a => old n r (right a)) + weight constant).submatrix (basisEquiv n r) (basisEquiv n r) = + qmaExchangeMatrix left right weight constant ⊗ₖ (1 : Matrix (MediatorBasis r) (MediatorBasis r) ℂ) := by + simp only [qmaExchangeMatrix,submatrix_add_apply,submatrix_sum,submatrix_smul_apply, + Matrix.submatrix_one_equiv,heisenberg_old n r _ _ (hneq _),Matrix.add_kronecker, + Matrix.smul_kronecker,Matrix.one_kronecker_one,sum_kronecker] + +theorem qmaExchangeMatrix_lift_norm {n r : ℕ} (left right : ν → Fin n) + (hneq : ∀ a, left a ≠ right a) (weight : ν → ℝ) (constant : ℝ) : + ‖spinMatrixOperator (qmaExchangeMatrix left right weight constant ⊗ₖ + (1 : Matrix (MediatorBasis r) (MediatorBasis r) ℂ))‖ ≤ + 3*(∑ a, |weight a|)+|constant| := by + rw [← qmaExchangeMatrix_lift left right hneq weight constant,reindex_operator_norm] + exact qmaExchangeMatrix_norm _ _ (fun a h => hneq a (old_injective n r h)) weight constant + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingInputActual.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingInputActual.lean new file mode 100644 index 0000000000000000000000000000000000000000..3887522e330064c2d160f53f33011ea3132d3e22 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingInputActual.lean @@ -0,0 +1,104 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingInputProgram + +namespace OAI + +/-! The encoded cell/edge arrays evaluate to the actual buffered path of the +ordinal-slot spatial model. No arbitrary finite-fiber choice remains in this +part of the routing compiler. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumRoutingInputProgram +open QuantumRouteCode + +def actualData {A B : ℕ} (M : QMASpatialExchangeModel A B) {m : ℕ} + (labels : M.Term ≃ Fin m) : Data := + ((List.ofFn (QuantumOrdinalPlacement.coordinates M.cell), + List.ofFn (QuantumOrdinalPlacement.coordinates (M.anchor ∘ labels.symm))), + List.ofFn (fun i => ((M.left (labels.symm i)).val,(M.right (labels.symm i)).val))) + +theorem edge_actual {A B : ℕ} (M : QMASpatialExchangeModel A B) {m : ℕ} + (labels : M.Term ≃ Fin m) (e : M.Term) : + edge (actualData M labels) (labels e).val = ((M.left e).val,(M.right e).val) := by + unfold edge actualData + rw [QuantumOrdinalProgram.lookup_ofFn] + simp only [Equiv.symm_apply_apply] + +theorem fine_actual {A B : ℕ} (M : QMASpatialExchangeModel A B) {m : ℕ} + (labels : M.Term ≃ Fin m) (q : Fin M.n) : + fine A (actualData M labels) q.val = (M.withOrdinalSlots labels).routeVertex q := by + unfold fine actualData + simp only [List.length_ofFn,Nat.min_eq_right q.isLt.le] + exact QuantumSpatialSlotProgram.fineSite_actual M labels q + +theorem lane_actual {A B : ℕ} (M : QMASpatialExchangeModel A B) {m : ℕ} + (labels : M.Term ≃ Fin m) (e : M.Term) : + lane B ((labels e).val,actualData M labels) = ((M.withOrdinalSlots labels).laneColor e).val := + QuantumSpatialSlotProgram.lane_actual M labels e + +theorem entry_actual {A B : ℕ} (M : QMASpatialExchangeModel A B) {m : ℕ} + (labels : M.Term ≃ Fin m) (e : M.Term) : + entry B (actualData M labels) (labels e).val = + QuantumPortRankProgram.entries (M.withOrdinalSlots labels) labels (labels e) := by + unfold entry + rw [edge_actual,lane_actual] + exact (congrArg (fun t : M.Term => ((M.left t).val,(M.right t).val, + ((M.withOrdinalSlots labels).laneColor t).val)) (labels.symm_apply_apply e)).symm + +private theorem entries_ofFn (B : ℕ) (d : Data) {m : ℕ} + (f : Fin m → QuantumPortRankProgram.Entry) (hlen : d.2.length = m) + (h : ∀ i : Fin m, entry B d i.val = f i) : entries B d = List.ofFn f := by + apply List.ext_getElem + · simp only [entries,List.length_map,List.length_range,List.length_ofFn,hlen] + · intro i hi hj + have hi' : i < m := by simpa only [List.length_ofFn] using hj + simpa only [entries,List.getElem_map,List.getElem_range,List.getElem_ofFn] using h ⟨i,hi'⟩ + +theorem entries_actual {A B : ℕ} (M : QMASpatialExchangeModel A B) {m : ℕ} + (labels : M.Term ≃ Fin m) : + entries B (actualData M labels) = + List.ofFn (QuantumPortRankProgram.entries (M.withOrdinalSlots labels) labels) := by + apply entries_ofFn B (actualData M labels) + (QuantumPortRankProgram.entries (M.withOrdinalSlots labels) labels) + (by simp only [actualData,List.length_ofFn]) + intro j + calc + entry B (actualData M labels) j.val = + entry B (actualData M labels) (labels (labels.symm j)).val := + congrArg (fun k : Fin m => entry B (actualData M labels) k.val) + (labels.apply_symm_apply j).symm + _ = QuantumPortRankProgram.entries (M.withOrdinalSlots labels) labels + (labels (labels.symm j)) := entry_actual M labels (labels.symm j) + _ = _ := congrArg (QuantumPortRankProgram.entries (M.withOrdinalSlots labels) labels) + (labels.apply_symm_apply j) + +theorem value_actual {A B : ℕ} (M : QMASpatialExchangeModel A B) {m : ℕ} + (labels : M.Term ≃ Fin m) (hA : 0 < A) + (hd : ∀ v, qmaGraphDegree M.left M.right v ≤ 3) (e : M.Term) : + value A B ((labels e).val,actualData M labels) = + QuantumBufferedListProgram.actualInput (M.withOrdinalSlots labels) hd e := by + unfold value + rw [edge_actual,lane_actual,entries_actual] + dsimp only + exact congrArg₂ Prod.mk + (congrArg₂ Prod.mk (fine_actual M labels (M.left e)) (fine_actual M labels (M.right e))) + (congrArg (Prod.mk ((M.withOrdinalSlots labels).laneColor e).val) + (congrArg₂ Prod.mk + (QuantumPortRankProgram.value_actual (M.withOrdinalSlots labels) labels hA hd + (M.left e) ⟨e,Or.inl rfl⟩) + (QuantumPortRankProgram.value_actual (M.withOrdinalSlots labels) labels hA hd + (M.right e) ⟨e,Or.inr rfl⟩))) + +theorem path_actual {A B : ℕ} (M : QMASpatialExchangeModel A B) {m : ℕ} + (labels : M.Term ≃ Fin m) (hA : 0 < A) + (hd : ∀ v, qmaGraphDegree M.left M.right v ≤ 3) (e : M.Term) : + QuantumBufferedListProgram.path A B (value A B ((labels e).val,actualData M labels)) = + ((M.withOrdinalSlots labels).bufferedPath hd e).val.support := by + exact (congrArg (QuantumBufferedListProgram.path A B) + (value_actual M labels hA hd e)).trans + (QuantumBufferedListProgram.path_actual (M.withOrdinalSlots labels) hd e) + +end ContinuumCoulomb.QuantumRoutingInputProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingInputProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingInputProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..182c37ad7f7c1a1bc13298888669a455e0fee00d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingInputProgram.lean @@ -0,0 +1,93 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLaneUnaryProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortRankActual +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedListProgram + +namespace OAI + +/-! Compile cell arrays and an edge array into the registers needed by the +buffered-route evaluator. Binary endpoint labels are clipped by the explicit +qubit array length before their conversion to unary loop bounds. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumRoutingInputProgram +open ExactQuantumFactoring.BitStackProgram QuantumRouteCode + +abbrev Data := (List Pair × List Pair) × List Pair +def dataCode : Data → List Bool := + prodCode (prodCode (listCode pairCode) (listCode pairCode)) (listCode pairCode) +abbrev Input := ℕ × Data +def inputCode : Input → List Bool := prodCode unaryCode dataCode + +def edge (d : Data) (i : ℕ) : Pair := QuantumPathVisitProgram.lookup d.2 i +def lane (B : ℕ) (x : Input) : ℕ := QuantumSpatialSlotProgram.lane B (x.1,x.2.1.2) +def entry (B : ℕ) (d : Data) (i : ℕ) : QuantumPortRankProgram.Entry := + ((edge d i).1,(edge d i).2,lane B (i,d)) +def entries (B : ℕ) (d : Data) : List QuantumPortRankProgram.Entry := + (List.range d.2.length).map (entry B d) + +def fine (A : ℕ) (d : Data) (a : ℕ) : Pair := + QuantumSpatialSlotProgram.fineSite A (min d.1.1.length a,d.1.1) + +def value (A B : ℕ) (x : Input) : QuantumBufferedListProgram.Input := + let e := edge x.2 x.1 + let c := lane B x + let es := entries B x.2 + ((fine A x.2 e.1,fine A x.2 e.2),c, + QuantumPortRankProgram.value ((e.1,c),es), + QuantumPortRankProgram.value ((e.2,c),es)) + +noncomputable def dataProgram : Procedure inputCode dataCode Prod.snd := Procedure.second _ _ +noncomputable def indexProgram : Procedure inputCode unaryCode Prod.fst := Procedure.first _ _ +noncomputable def qubitsProgram : Procedure inputCode (listCode pairCode) (fun x => x.2.1.1) := + (Procedure.first (listCode pairCode) (listCode pairCode)).comp + ((Procedure.first (prodCode (listCode pairCode) (listCode pairCode)) (listCode pairCode)).comp dataProgram) +noncomputable def anchorsProgram : Procedure inputCode (listCode pairCode) (fun x => x.2.1.2) := + (Procedure.second (listCode pairCode) (listCode pairCode)).comp + ((Procedure.first (prodCode (listCode pairCode) (listCode pairCode)) (listCode pairCode)).comp dataProgram) +noncomputable def edgesProgram : Procedure inputCode (listCode pairCode) (fun x => x.2.2) := + (Procedure.second (prodCode (listCode pairCode) (listCode pairCode)) (listCode pairCode)).comp dataProgram + +noncomputable def edgeProgram : Procedure inputCode pairCode (fun x => edge x.2 x.1) := + (Procedure.listGet pairCode (0,0)).comp + ((Procedure.unaryToBits.comp indexProgram).pair edgesProgram) + +noncomputable def laneProgram (B : ℕ) : Procedure inputCode Nat.bits (lane B) := + (QuantumSpatialSlotProgram.laneProgram B).comp (indexProgram.pair anchorsProgram) +noncomputable def laneUnaryProgram (B : ℕ) : Procedure inputCode unaryCode (lane B) := + (QuantumLaneUnaryProgram.program B).comp (indexProgram.pair anchorsProgram) + +noncomputable def entryProgram (B : ℕ) : Procedure inputCode QuantumPortRankProgram.entryCode + (fun x => entry B x.2 x.1) := + ((Procedure.first Nat.bits Nat.bits).comp edgeProgram).pair + (((Procedure.second Nat.bits Nat.bits).comp edgeProgram).pair (laneProgram B)) + +noncomputable def entriesProgram (B : ℕ) : + Procedure dataCode (listCode QuantumPortRankProgram.entryCode) (entries B) := by + let edges := Procedure.second (prodCode (listCode pairCode) (listCode pairCode)) (listCode pairCode) + let n := (ExactQuantumFactoring.NativeAIG.Emission.listUnaryLength pairCode (0,0)).comp edges + exact (Procedure.tabulate (f := entry B) (0,0,0) (entryProgram B)).comp + (n.pair (Procedure.identity dataCode)) + +noncomputable def program (A B : ℕ) : + Procedure inputCode QuantumBufferedListProgram.inputCode (value A B) := by + let left := (Procedure.first Nat.bits Nat.bits).comp edgeProgram + let right := (Procedure.second Nat.bits Nat.bits).comp edgeProgram + let n := (ExactQuantumFactoring.NativeAIG.Emission.listUnaryLength pairCode (0,0)).comp qubitsProgram + let leftIndex := Procedure.clippedUnary.comp (n.pair left) + let rightIndex := Procedure.clippedUnary.comp (n.pair right) + let leftPoint := (QuantumSpatialSlotProgram.fineSiteProgram A).comp (leftIndex.pair qubitsProgram) + let rightPoint := (QuantumSpatialSlotProgram.fineSiteProgram A).comp (rightIndex.pair qubitsProgram) + let es := (entriesProgram B).comp dataProgram + let leftPort := QuantumPortRankProgram.program.comp ((left.pair (laneProgram B)).pair es) + let rightPort := QuantumPortRankProgram.program.comp ((right.pair (laneProgram B)).pair es) + exact (leftPoint.pair rightPoint).pair ((laneUnaryProgram B).pair (leftPort.pair rightPort)) + +noncomputable def pathProgram (A B : ℕ) : Procedure inputCode (listCode pairCode) + (fun x => QuantumBufferedListProgram.path A B (value A B x)) := + (QuantumBufferedListProgram.pathProgram A B).comp (program A B) + +end ContinuumCoulomb.QuantumRoutingInputProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingPhysical.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingPhysical.lean new file mode 100644 index 0000000000000000000000000000000000000000..60f65ce35cd965ea155defe32f56b7647dd55eeb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingPhysical.lean @@ -0,0 +1,69 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingSpectrum +import OAI.MathematicalPhysics.ContinuumCoulomb.ManyBody.MediatorPhysical + +namespace OAI + +/-! Actual physical spin interactions for the singlet routing construction. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker InnerProductSpace +variable {κ : Type*} [Fintype κ] + +def qmaPhysicalSingletStar (n r : ℕ) (e : Fin r) (site : κ → Fin n) + (member : κ → Fin 2) (amplitude : κ → ℝ) : + Matrix (MediatedSpinBasis n r) (MediatedSpinBasis n r) ℂ := + ∑ a, (amplitude a:ℂ) • ∑ μ : Fin 3, + sourceLocalPauli n (site a) μ ⊗ₖ mediatorLocal r e (physicalMemberPauli (member a) μ) + +theorem qmaPhysicalSingletStar_transform (n r : ℕ) (e : Fin r) (site : κ → Fin n) + (member : κ → Fin 2) (amplitude : κ → ℝ) : + (fullMediatorBellMatrix n r).conjTranspose * + qmaPhysicalSingletStar n r e site member amplitude * fullMediatorBellMatrix n r = + qmaSingletStar n r e site member amplitude := by + simp only [qmaPhysicalSingletStar,qmaSingletStar,mediatorAxisSpoke, + Finset.mul_sum,Finset.sum_mul,mul_smul_comm,smul_mul_assoc,physicalSpoke_bellTransform] + +def qmaPhysicalRoutingHamiltonian (n r : ℕ) (Delta : ℝ) + (C : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) + (e : Fin r) (site : κ → Fin n) (member : κ → Fin 2) (amplitude : κ → ℝ) : + Matrix (MediatedSpinBasis n r) (MediatedSpinBasis n r) ℂ := + 1 ⊗ₖ physicalMediatorPenalty r Delta + + (C ⊗ₖ 1 + qmaPhysicalSingletStar n r e site member amplitude) + +theorem qmaPhysicalRoutingHamiltonian_transform (n r : ℕ) (Delta : ℝ) + (C : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) + (e : Fin r) (site : κ → Fin n) (member : κ → Fin 2) (amplitude : κ → ℝ) : + (fullMediatorBellMatrix n r).conjTranspose * + qmaPhysicalRoutingHamiltonian n r Delta C e site member amplitude * + fullMediatorBellMatrix n r = + routingHamiltonian n r Delta C (qmaSingletStar n r e site member amplitude) := by + simp only [qmaPhysicalRoutingHamiltonian,routingHamiltonian,mul_add,add_mul, + physicalMediatorPenalty_full_transform,liftedSource_full_transform,qmaPhysicalSingletStar_transform] + +theorem qmaPhysicalCrossing_bottom {n r : ℕ} (e : Fin r) (site : Fin 4 → Fin n) + (hsite : Function.Injective site) (R J K : ℝ) (hR : 0 < R) + (C : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) (hC : C.conjTranspose = C) + {epsilon : ℝ} (hepsilon : 0 ≤ epsilon) (hsmall : epsilon ≤ 1 / 4) + (hbound : ‖spinMatrixOperator ((C + qmaCrossingCorrection site J K) ⊗ₖ + (1 : Matrix (MediatorBasis r) (MediatorBasis r) ℂ))‖ + + 3*∑ a, |qmaCrossingAmplitude R J K a| ≤ epsilon * (4 * R^2)) : + |mediatorFullBottom n r (qmaPhysicalRoutingHamiltonian n r (R^2) + (C + qmaCrossingCorrection site J K) e site qmaCrossingMember + (qmaCrossingAmplitude R J K)) - + sourceMatrixBottom n (C + ((J:ℂ) • sourceHeisenbergMatrix n (site 0) (site 2) + + (K:ℂ) • sourceHeisenbergMatrix n (site 1) (site 3)))| ≤ 16 * R^2 * epsilon^3 := by + have hb := mediatorFullBottom_unitary n r (fullMediatorBellMatrix n r) + (qmaPhysicalRoutingHamiltonian n r (R^2) (C + qmaCrossingCorrection site J K) + e site qmaCrossingMember (qmaCrossingAmplitude R J K)) + (fullMediatorBellMatrix_gram n r) (fullMediatorBellMatrix_cogram n r) + rw [qmaPhysicalRoutingHamiltonian_transform] at hb + rw [← hb] + exact qmaCrossing_bottom e site hsite R J K hR C hC hepsilon hsmall hbound + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..51805fb542ed3419e1e6187b9fd845a48c92e5dc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingProgram.lean @@ -0,0 +1,129 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingCalibration +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOffsetProgram + +namespace OAI + +/-! Literal polynomial rational programs for the crossing coefficients and penalty. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumRoutingCode +open ExactQuantumFactoring.BitStackProgram + +abbrev Triple := ℚ × (ℚ × ℚ) +def tripleCode : Triple → List Bool := prodCode ratCode (prodCode ratCode ratCode) + +noncomputable opaque firstProgram : Procedure tripleCode ratCode Prod.fst := Procedure.first _ _ +noncomputable opaque tailProgram : Procedure tripleCode (prodCode ratCode ratCode) Prod.snd := + Procedure.second _ _ +noncomputable opaque secondProgram : Procedure tripleCode ratCode (fun x => x.2.1) := + (Procedure.first _ _).comp tailProgram +noncomputable opaque thirdProgram : Procedure tripleCode ratCode (fun x => x.2.2) := + (Procedure.second _ _).comp tailProgram + +noncomputable def squareProgram {α : Type} {ea : α → List Bool} {f : α → ℚ} + (p : Procedure ea ratCode f) : Procedure ea ratCode (fun x => (f x)^2) := + (Procedure.ratMul.comp (p.pair p)).congrFun (by intro x; dsimp; ring) + +noncomputable def twiceProductProgram {α : Type} {ea : α → List Bool} {f g : α → ℚ} + (p : Procedure ea ratCode f) (q : Procedure ea ratCode g) : + Procedure ea ratCode (fun x => 2*f x*g x) := + Procedure.ratMul.comp ((Procedure.ratMul.comp + ((Procedure.constant ea ratCode 2).pair p)).pair q) + +noncomputable opaque sumPlusOneProgram : Procedure tripleCode ratCode + (fun x => x.1+x.2.1+1) := + Procedure.ratAdd.comp ((Procedure.ratAdd.comp (firstProgram.pair secondProgram)).pair + (Procedure.constant tripleCode ratCode 1)) + +noncomputable opaque cubeProgram : Procedure tripleCode ratCode (fun x => (x.1+x.2.1+1)^3) := + (Procedure.ratMul.comp ((squareProgram sumPlusOneProgram).pair sumPlusOneProgram)).congrFun + (by intro x; dsimp; ring) + +noncomputable opaque scaleProgram : Procedure tripleCode ratCode + (fun x => 16*(x.1+x.2.1+1)^3*x.2.2+4*(x.1+x.2.1+1)+1) := by + let leading := Procedure.ratMul.comp ((Procedure.ratMul.comp + ((Procedure.constant tripleCode ratCode 16).pair cubeProgram)).pair thirdProgram) + let lower := Procedure.ratMul.comp ((Procedure.constant tripleCode ratCode 4).pair sumPlusOneProgram) + exact Procedure.ratAdd.comp ((Procedure.ratAdd.comp (leading.pair lower)).pair + (Procedure.constant tripleCode ratCode 1)) + +noncomputable def scaleCertificate : Turing.TM2ComputableInPolyTime tripleCode ratCode + (fun x => 16*(x.1+x.2.1+1)^3*x.2.2+4*(x.1+x.2.1+1)+1) := scaleProgram.toTM2 + +theorem scale_cast (x : Triple) : + ((16*(x.1+x.2.1+1)^3*x.2.2+4*(x.1+x.2.1+1)+1:ℚ):ℝ) = + qmaRoutingScale (x.1:ℝ) (x.2.1:ℝ) (x.2.2:ℝ) := by + simp [qmaRoutingScale] + +noncomputable opaque offsetProgram : Procedure tripleCode ratCode + (fun x => 3/2+3*x.2.1^2+3*x.2.2^2) := by + let j := Procedure.ratMul.comp ((Procedure.constant tripleCode ratCode 3).pair (squareProgram secondProgram)) + let k := Procedure.ratMul.comp ((Procedure.constant tripleCode ratCode 3).pair (squareProgram thirdProgram)) + exact Procedure.ratAdd.comp ((Procedure.ratAdd.comp + ((Procedure.constant tripleCode ratCode (3/2)).pair j)).pair k) + +def coefficients (x : Triple) : Fin 10 → ℚ := + ![x.1^2,x.1,x.1,2*x.1*x.2.1,2*x.1*x.2.2, + 1/2,-x.2.2,-x.2.1,2*x.2.1*x.2.2,3/2+3*x.2.1^2+3*x.2.2^2+3*x.1^2] + +noncomputable opaque coefficientProgram (k : Fin 10) : + Procedure tripleCode ratCode (fun x => coefficients x k) := by + by_cases h0 : k = 0 + · subst k + exact (squareProgram firstProgram).congrFun (by intro x; rfl) + by_cases h1 : k = 1 + · subst k + exact firstProgram.congrFun (by intro x; rfl) + by_cases h2 : k = 2 + · subst k + exact firstProgram.congrFun (by intro x; rfl) + by_cases h3 : k = 3 + · subst k + exact (twiceProductProgram firstProgram secondProgram).congrFun (by intro x; rfl) + by_cases h4 : k = 4 + · subst k + exact (twiceProductProgram firstProgram thirdProgram).congrFun (by intro x; rfl) + by_cases h5 : k = 5 + · subst k + exact (Procedure.constant tripleCode ratCode (1/2)).congrFun (by intro x; rfl) + by_cases h6 : k = 6 + · subst k + exact (Procedure.ratNeg.comp thirdProgram).congrFun (by intro x; rfl) + by_cases h7 : k = 7 + · subst k + exact (Procedure.ratNeg.comp secondProgram).congrFun (by intro x; rfl) + by_cases h8 : k = 8 + · subst k + exact (twiceProductProgram secondProgram thirdProgram).congrFun (by intro x; rfl) + have h9 : k = 9 := by omega + subst k + exact (Procedure.ratAdd.comp (offsetProgram.pair + (Procedure.ratMul.comp ((Procedure.constant tripleCode ratCode 3).pair + (squareProgram firstProgram))))).congrFun (by intro x; rfl) + +noncomputable opaque coefficientListProgram : Procedure tripleCode (listCode ratCode) + (fun x => List.ofFn (coefficients x)) := + QuantumRawExchange.fixedListProgram tripleCode ratCode 10 (fun k x => coefficients x k) coefficientProgram + +noncomputable def coefficientListCertificate : Turing.TM2ComputableInPolyTime + tripleCode (listCode ratCode) (fun x => List.ofFn (coefficients x)) := coefficientListProgram.toTM2 + +theorem coefficients_spoke (x : Triple) (a : Fin 4) : + (coefficients x ⟨a.val+1,by omega⟩ : ℝ) = + qmaCrossingAmplitude (x.1:ℝ) (x.2.1:ℝ) (x.2.2:ℝ) a := by + fin_cases a <;> simp [coefficients,qmaCrossingAmplitude] + +theorem coefficients_perimeter (x : Triple) (a : Fin 4) : + (coefficients x ⟨a.val+5,by omega⟩ : ℝ) = qmaCrossingWeight (x.2.1:ℝ) (x.2.2:ℝ) a := by + fin_cases a <;> simp [coefficients,qmaCrossingWeight] + +theorem coefficients_offset (x : Triple) : + (coefficients x 9 : ℝ) = qmaCrossingOffset (x.2.1:ℝ) (x.2.2:ℝ)+3*(x.1:ℝ)^2 := by + simp [coefficients,qmaCrossingOffset] + +end ContinuumCoulomb.QuantumRoutingCode + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingScale.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingScale.lean new file mode 100644 index 0000000000000000000000000000000000000000..ccaef2659bbe2ff11d6d0fcf720eb7005c6a3b38 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingScale.lean @@ -0,0 +1,72 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingSpectrum + +namespace OAI + +/-! A polynomial penalty choice for the second-order routing gadgets. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped Kronecker + +def qmaRoutingScale (A B N : ℝ) : ℝ := 16*(A+B+1)^3*N+4*(A+B+1)+1 + +theorem qmaRoutingScale_bounds {A B N : ℝ} (hA : 0 ≤ A) (hB : 0 ≤ B) (hN : 0 < N) : + let R := qmaRoutingScale A B N + 0 < R ∧ 0 ≤ (A+B+1)/R ∧ (A+B+1)/R ≤ 1/4 ∧ + B+A*R ≤ ((A+B+1)/R)*(4*R^2) ∧ + 16*R^2*((A+B+1)/R)^3 ≤ 1/N := by + let Q := A+B+1 + have hQ : 0 < Q := by dsimp [Q]; linarith + have hq3 : 0 ≤ 16*Q^3*N := by positivity + have hR : 0 < qmaRoutingScale A B N := by + change 0 < 16*Q^3*N+4*Q+1 + positivity + have hR1 : 1 ≤ qmaRoutingScale A B N := by + change 1 ≤ 16*Q^3*N+4*Q+1 + nlinarith + have hR4 : 4*Q ≤ qmaRoutingScale A B N := by + change 4*Q ≤ 16*Q^3*N+4*Q+1 + linarith + have hR16 : 16*Q^3*N ≤ qmaRoutingScale A B N := by + change 16*Q^3*N ≤ 16*Q^3*N+4*Q+1 + linarith + refine ⟨hR,div_nonneg hQ.le hR.le,?_,?_,?_⟩ + · apply (div_le_iff₀ hR).mpr + change Q ≤ (1/4)*qmaRoutingScale A B N + linarith + · have heq : (Q/qmaRoutingScale A B N)*(4*qmaRoutingScale A B N^2) = + 4*Q*qmaRoutingScale A B N := by field_simp + change B+A*qmaRoutingScale A B N ≤ (Q/qmaRoutingScale A B N)*(4*qmaRoutingScale A B N^2) + rw [heq] + have hbR := mul_le_mul_of_nonneg_left hR1 hB + have hqR := mul_nonneg hQ.le hR.le + dsimp [Q] at * + nlinarith + · change 16*qmaRoutingScale A B N^2*(Q/qmaRoutingScale A B N)^3 ≤ 1/N + have heq : 16*qmaRoutingScale A B N^2*(Q/qmaRoutingScale A B N)^3 = + 16*Q^3/qmaRoutingScale A B N := by field_simp + rw [heq] + apply (div_le_iff₀ hR).mpr + simpa only [one_div,div_eq_mul_inv,mul_comm,mul_one] using (le_div_iff₀ hN).mpr hR16 + +theorem qmaRouting_accuracy (n r : ℕ) {A B N : ℝ} + (hA : 0 ≤ A) (hB : 0 ≤ B) (hN : 0 < N) + (C : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) (hC : C.conjTranspose = C) + (W : Matrix (MediatedSpinBasis n r) (MediatedSpinBasis n r) ℂ) + (hW : W.conjTranspose = W) (hWlow : mediatorCompression n r W = 0) + (hCn : ‖spinMatrixOperator (C ⊗ₖ (1 : Matrix (MediatorBasis r) (MediatorBasis r) ℂ))‖ ≤ B) + (hWn : ‖spinMatrixOperator W‖ ≤ A*qmaRoutingScale A B N) : + let R := qmaRoutingScale A B N + |mediatorFullBottom n r (routingHamiltonian n r (R^2) C W) - + sourceMatrixBottom n (C - mediatorCompression n r + (W * liftedMediatorInverse n r (R^2) * W))| ≤ 1/N := by + obtain ⟨hR,he,hes,hb,ha⟩ := qmaRoutingScale_bounds hA hB hN + exact (routing_bottom n r (sq_pos_of_pos hR) C hC W hW hWlow he hes + ((add_le_add hCn hWn).trans hb)).trans ha + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingSize.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingSize.lean new file mode 100644 index 0000000000000000000000000000000000000000..8be9c582913bee3924d21d7aa4d28d5ecf77ec2e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingSize.lean @@ -0,0 +1,49 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingsGraph +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathsGraph + +namespace OAI + +/-! Linear graph-size growth and an explicit polynomial routing penalty bound. -/ + +noncomputable section +namespace ContinuumCoulomb + +abbrev QMAForkGraphEdge (ν : Type*) (r : ℕ) := + (ν ⊕ Fin r) ⊕ (Fin r ⊕ (Fin r × Fin 3)) +abbrev QMACrossingsGraphEdge (ν : Type*) (r : ℕ) := + (ν ⊕ (Fin r × Fin 4)) ⊕ (Fin r ⊕ (Fin r × Fin 4)) +abbrev QMAPathsGraphEdge (ν : Type*) (r : ℕ) := + ν ⊕ (Fin r ⊕ (Fin r × Fin 2)) + +theorem qmaForkGraphEdge_card (ν : Type*) [Fintype ν] (r : ℕ) : + Fintype.card (QMAForkGraphEdge ν r) = Fintype.card ν+5*r := by + simp only [QMAForkGraphEdge,Fintype.card_sum,Fintype.card_prod,Fintype.card_fin] + omega + +theorem qmaCrossingsGraphEdge_card (ν : Type*) [Fintype ν] (r : ℕ) : + Fintype.card (QMACrossingsGraphEdge ν r) = Fintype.card ν+9*r := by + simp only [QMACrossingsGraphEdge,Fintype.card_sum,Fintype.card_prod,Fintype.card_fin] + omega + +theorem qmaPathsGraphEdge_card (ν : Type*) [Fintype ν] (r : ℕ) : + Fintype.card (QMAPathsGraphEdge ν r) = Fintype.card ν+3*r := by + simp only [QMAPathsGraphEdge,Fintype.card_sum,Fintype.card_prod,Fintype.card_fin] + omega + +theorem qmaRoutingScale_polynomial {A B N : ℝ} (hA : 0 ≤ A) (hB : 0 ≤ B) (hN : 0 ≤ N) : + qmaRoutingScale A B N ≤ 21*(A+B+1)^3*(N+1) := by + let Q := A+B+1 + have hQ : 1 ≤ Q := by dsimp [Q]; linarith + have hQ0 : 0 ≤ Q := le_trans (by norm_num) hQ + have hQ2 : 1 ≤ Q^2 := one_le_pow₀ hQ + have hQ3 : Q ≤ Q^3 := by nlinarith [mul_le_mul_of_nonneg_left hQ2 hQ0] + have hQ31 : 1 ≤ Q^3 := hQ.trans hQ3 + have hn : 0 ≤ Q^3*N := mul_nonneg (by positivity) hN + change 16*Q^3*N+4*Q+1 ≤ 21*Q^3*(N+1) + nlinarith + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingSpectrum.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingSpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..4863e2c7b0f6a15d0f079e2c1cf101725a873708 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingSpectrum.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingForms +import OAI.MathematicalPhysics.ContinuumCoulomb.ManyBody.MediatorSpectrum + +namespace OAI + +/-! Ground-energy comparison on the complete spin space for routing gadgets. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker InnerProductSpace + +theorem routingFullBottom_eq_lowBlockBottom (n r : ℕ) (Delta : ℝ) + (C : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) (hC : C.conjTranspose = C) + (W : Matrix (MediatedSpinBasis n r) (MediatedSpinBasis n r) ℂ) + (hW : W.conjTranspose = W) (hWlow : mediatorCompression n r W = 0) : + mediatorFullBottom n r (routingHamiltonian n r Delta C W) = + Perturbation.lowBlockBottom (actualMediatorLowBlock n r C) + (diagonalPenalty (actualMediatorWeight n r Delta)) + (routingHighBlock n r C W) + (routingCoupling n r W) := by + unfold mediatorFullBottom Perturbation.lowBlockBottom + congr 1 + ext e + constructor + · rintro ⟨x, hx, rfl⟩ + let p := mediatorLowRestriction n r x + let q := mediatorHighRestriction n r x + have hassemble : assembleMediator n r p q = x := mediator_full_decomposition n r x + have hnorm : 0 < ‖p‖ ^ 2 + ‖q‖ ^ 2 := by + rw [← assembleMediator_norm_sq, hassemble] + exact hx + refine ⟨p, q, hnorm, ?_⟩ + unfold Perturbation.lowBlockRayleigh + rw [← routingHamiltonian_form_blocks n r Delta C hC W hW hWlow, + ← assembleMediator_norm_sq, hassemble] + · rintro ⟨p, q, hpq, rfl⟩ + refine ⟨assembleMediator n r p q, ?_, ?_⟩ + · rw [assembleMediator_norm_sq] + exact hpq + · rw [routingHamiltonian_form_blocks n r Delta C hC W hW hWlow, + assembleMediator_norm_sq] + rfl + +theorem routing_effectiveBottom_matrix (n r : ℕ) (Delta : ℝ) + (C : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) + (W : Matrix (MediatedSpinBasis n r) (MediatedSpinBasis n r) ℂ) + (hW : W.conjTranspose = W) (hWlow : mediatorCompression n r W = 0) : + Perturbation.effectiveBottom (actualMediatorLowBlock n r C) + (diagonalPenalty (fun s => (actualMediatorWeight n r Delta s)⁻¹)) + (routingCoupling n r W) = + sourceMatrixBottom n (C - mediatorCompression n r + (W * liftedMediatorInverse n r Delta * + W)) := by + unfold Perturbation.effectiveBottom sourceMatrixBottom + simp_rw [routing_effectiveForm n r Delta C W hW hWlow] + +theorem routing_bottom (n r : ℕ) {Delta : ℝ} (hDelta : 0 < Delta) + (C : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) (hC : C.conjTranspose = C) + (W : Matrix (MediatedSpinBasis n r) (MediatedSpinBasis n r) ℂ) + (hW : W.conjTranspose = W) (hWlow : mediatorCompression n r W = 0) + {epsilon : ℝ} (hepsilon : 0 ≤ epsilon) (hsmall : epsilon ≤ 1 / 4) + (hbound : ‖spinMatrixOperator (C ⊗ₖ (1 : Matrix (MediatorBasis r) (MediatorBasis r) ℂ))‖ + + ‖spinMatrixOperator W‖ ≤ epsilon * (4 * Delta)) : + |mediatorFullBottom n r (routingHamiltonian n r Delta C W) - + sourceMatrixBottom n (C - mediatorCompression n r + (W * liftedMediatorInverse n r Delta * W))| ≤ 16 * Delta * epsilon ^ 3 := by + have h := routing_second_order n r hDelta C W hepsilon hsmall hbound + rw [← routingFullBottom_eq_lowBlockBottom n r Delta C hC W hW hWlow, + routing_effectiveBottom_matrix n r Delta C W hW hWlow] at h + exact h + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingTable.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingTable.lean new file mode 100644 index 0000000000000000000000000000000000000000..161eab60101ff9a21df4576a31ace45028a63c9b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingTable.lean @@ -0,0 +1,69 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFiniteMembership +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCellPathProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRetainedRoutes + +namespace OAI + +/-! Finite source cells, internal visits and crossing cells determine every +routing permission. These tests inspect finite encoded lists, including both +orientations of each internal port pair. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumRoutingTable +open ExactQuantumFactoring.BitStackProgram QuantumRouteCode QuantumFiniteMembership + +abbrev Visit := Pair × Pair +abbrev Table := List Pair × (List Visit × List Pair) +def visitCode : Visit → List Bool := prodCode pairCode pairCode +def tableCode : Table → List Bool := + prodCode (listCode pairCode) (prodCode (listCode visitCode) (listCode pairCode)) +def inputCode : (Table × Pair) → List Bool := prodCode tableCode pairCode + +def allowed (t : Table) : QMACellRouteBody → Bool + | .ray p _ => decide (p ∈ t.1) && !decide (p ∈ t.2.2) + | .pair p e => !decide (p ∈ t.2.2) && + decide ((p,((qmaCellPairLeft e).val,(qmaCellPairRight e).val)) ∈ t.2.1) + | .patch p _ => decide (p ∈ t.2.2) + | .corridor p a b c => decide (b = decide (p ∈ t.2.2)) && + decide (c = decide (qmaGridNeighbor p a ∈ t.2.2)) + +noncomputable opaque cellProgram : Procedure inputCode pairCode Prod.snd := Procedure.second _ _ +noncomputable opaque tableProgram : Procedure inputCode tableCode Prod.fst := Procedure.first _ _ +noncomputable opaque sourcesProgram : Procedure inputCode (listCode pairCode) (fun x => x.1.1) := + (Procedure.first _ _).comp tableProgram +noncomputable opaque visitsProgram : Procedure inputCode (listCode visitCode) (fun x => x.1.2.1) := + (Procedure.first _ _).comp ((Procedure.second _ _).comp tableProgram) +noncomputable opaque crossingsProgram : Procedure inputCode (listCode pairCode) (fun x => x.1.2.2) := + (Procedure.second _ _).comp ((Procedure.second _ _).comp tableProgram) +noncomputable opaque crossingProgram : Procedure inputCode Procedure.boolCode + (fun x => decide (x.2 ∈ x.1.2.2)) := pairMemberProgram.comp (cellProgram.pair crossingsProgram) + +noncomputable opaque rayAllowedProgram (a : Fin 4) : Procedure inputCode Procedure.boolCode + (fun x => allowed x.1 (.ray x.2 a)) := + Procedure.boolAnd.comp ((pairMemberProgram.comp (cellProgram.pair sourcesProgram)).pair + (Procedure.boolNot.comp crossingProgram)) + +noncomputable opaque pairAllowedProgram (e : Fin 6) : Procedure inputCode Procedure.boolCode + (fun x => allowed x.1 (.pair x.2 e)) := by + let memp := memberProgram visitCode ((0,0),(0,0)) (Procedure.prodEq pairEqProgram pairEqProgram) + let v := cellProgram.pair (Procedure.constant inputCode pairCode + ((qmaCellPairLeft e).val,(qmaCellPairRight e).val)) + exact Procedure.boolAnd.comp ((Procedure.boolNot.comp crossingProgram).pair + (memp.comp (v.pair visitsProgram))) + +noncomputable opaque patchAllowedProgram (e : Fin 9) : Procedure inputCode Procedure.boolCode + (fun x => allowed x.1 (.patch x.2 e)) := crossingProgram + +noncomputable opaque corridorAllowedProgram (a : Fin 4) (b c : Bool) : + Procedure inputCode Procedure.boolCode (fun x => allowed x.1 (.corridor x.2 a b c)) := by + let eqb := Procedure.ofBool Procedure.boolCode (fun x => decide (b=x)) + let eqc := Procedure.ofBool Procedure.boolCode (fun x => decide (c=x)) + let next := pairMemberProgram.comp + ((QuantumCellPathProgram.neighborProgram a |>.comp cellProgram).pair crossingsProgram) + exact Procedure.boolAnd.comp ((eqb.comp crossingProgram).pair (eqc.comp next)) + +end ContinuumCoulomb.QuantumRoutingTable + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingTableCorrectness.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingTableCorrectness.lean new file mode 100644 index 0000000000000000000000000000000000000000..a2aeb4ba092f319fe8a784f4273072aa642fcb92 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRoutingTableCorrectness.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingTable + +namespace OAI + +/-! The finite table is the data of the actual port routes. Its membership +tests agree exactly with the permissions used in the geometric proof. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical +open QuantumRoutingTable +namespace QMAPortRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + +def routingVisits : List Visit := + (Finset.univ : Finset P.Interior).toList.flatMap (fun i => + [(P.cell i,((P.port i 0).val,(P.port i 1).val)), + (P.cell i,((P.port i 1).val,(P.port i 0).val))]) + +def routingTable : Table := + (List.ofFn P.position,P.routingVisits,P.crossingCells.toList) + +theorem routingTable_source (p : ℕ × ℕ) : + p ∈ P.routingTable.1 ↔ ∃ v, P.position v = p := by + exact List.mem_ofFn + +theorem routingTable_crossing (p : ℕ × ℕ) : + p ∈ P.routingTable.2.2 ↔ P.IsCrossing p := by + exact Finset.mem_toList.trans P.mem_crossingCells + +theorem routingTable_pair (p : ℕ × ℕ) (a b : Fin 4) : + (p,(a.val,b.val)) ∈ P.routingTable.2.1 ↔ + ∃ i : P.Interior, P.cell i = p ∧ s(P.port i 0,P.port i 1) = s(a,b) := by + change (p,(a.val,b.val)) ∈ P.routingVisits ↔ _ + simp only [routingVisits,List.mem_flatMap,Finset.mem_toList,Finset.mem_univ,true_and, + List.mem_cons,List.not_mem_nil,or_false,Prod.mk.injEq,Sym2.eq_iff] + constructor + · rintro ⟨i,⟨hc,ha,hb⟩ | ⟨hc,ha,hb⟩⟩ + · exact ⟨i,hc.symm,Or.inl ⟨(Fin.ext ha).symm,(Fin.ext hb).symm⟩⟩ + · exact ⟨i,hc.symm,Or.inr ⟨(Fin.ext hb).symm,(Fin.ext ha).symm⟩⟩ + · rintro ⟨i,hc,⟨ha,hb⟩ | ⟨ha,hb⟩⟩ + · exact ⟨i,Or.inl ⟨hc.symm,congrArg Fin.val ha.symm,congrArg Fin.val hb.symm⟩⟩ + · exact ⟨i,Or.inr ⟨hc.symm,congrArg Fin.val hb.symm,congrArg Fin.val ha.symm⟩⟩ + +theorem routingTable_allowed (R : QMACellRouteBody) : + allowed P.routingTable R = true ↔ P.RoutingAllowed R := by + cases R with + | ray p a => + simp only [allowed,Bool.and_eq_true,Bool.not_eq_true_eq_eq_false,decide_eq_true_eq, + decide_eq_false_iff_not,routingTable_source,routingTable_crossing,RoutingAllowed] + | pair p e => + simp only [allowed,Bool.and_eq_true,Bool.not_eq_true_eq_eq_false,decide_eq_true_eq, + decide_eq_false_iff_not,routingTable_pair,routingTable_crossing,RoutingAllowed] + | patch p e => + simp only [allowed,decide_eq_true_eq,routingTable_crossing,RoutingAllowed] + | corridor p a b c => + have h (q : ℕ × ℕ) : decide (q ∈ P.routingTable.2.2) = decide (P.IsCrossing q) := by + apply Bool.eq_iff_iff.mpr + simp only [decide_eq_true_eq,P.routingTable_crossing] + simp only [allowed,Bool.and_eq_true,decide_eq_true_eq,h,RoutingAllowed] + +end QMAPortRouteData +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRowInsertion.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRowInsertion.lean new file mode 100644 index 0000000000000000000000000000000000000000..088796394ee166bc05e77d9bd0c5c70d7feaee5b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRowInsertion.lean @@ -0,0 +1,84 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRowOrder + +namespace OAI + +/-! A logical gate is inserted immediately after its last operand arrives. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped Classical + +theorem qmaMapGate_sites (sourceWork targetWork : ℕ) + (f : Fin (sourceWork+1) → Fin (targetWork+1)) (g : QMAGate) : + qmaGateSites targetWork (qmaMapGate sourceWork targetWork f g) = + (qmaGateSites sourceWork g).image f := by + cases g <;> simp [qmaMapGate,qmaGateSites,qmaQubit_fin] + +def qmaGateCut (work : ℕ) (e : Equiv.Perm (Fin (work+1))) (g : QMAGate) : ℕ := + (qmaGateSites work g).sup (fun i => (e.symm i).val)+1 + +theorem qmaGateCut_le (work : ℕ) (e : Equiv.Perm (Fin (work+1))) (g : QMAGate) : + qmaGateCut work e g ≤ work+1 := by + apply Nat.succ_le_of_lt + apply (Finset.sup_lt_iff (by omega : 0 < work+1)).mpr + intro i _ + exact (e.symm i).isLt + +theorem qmaGateCut_site (work : ℕ) (e : Equiv.Perm (Fin (work+1))) + (g : QMAGate) (i : Fin (work+1)) (hi : i ∈ qmaGateSites work g) : + (e.symm i).val < qmaGateCut work e g := by + exact Nat.lt_succ_of_le (Finset.le_sup (f := fun j => (e.symm j).val) hi) + +def qmaRowStage (width work : ℕ) + (l r : Fin (width+1) → Fin (work+1)) (e : Equiv.Perm (Fin (width+1))) + (g : QMAGate) : List QMAGate := + let ps := qmaRowPairs (l ∘ e) (r ∘ e) + qmaTransferGates (ps.take (qmaGateCut width e g)) ++ + [qmaMapGate width work r g] ++ + qmaTransferGates (ps.drop (qmaGateCut width e g)) + +theorem qmaRowStage_tail_avoids (width work : ℕ) + (l r : Fin (width+1) → Fin (work+1)) (hr : Function.Injective r) + (hlr : ∀ i j, l i ≠ r j) (e : Equiv.Perm (Fin (width+1))) (g : QMAGate) : + ∀ k ∈ qmaGateSites work (qmaMapGate width work r g), + ∀ p ∈ (qmaRowPairs (l ∘ e) (r ∘ e)).drop (qmaGateCut width e g), + k ≠ p.1 ∧ k ≠ p.2 := by + intro k hk p hp + rw [qmaMapGate_sites] at hk + obtain ⟨i,hi,rfl⟩ := Finset.mem_image.mp hk + obtain ⟨j,hj,hp⟩ := List.mem_drop_iff_getElem.mp hp + have hj' : qmaGateCut width e g+j < width+1 := by + simpa only [qmaRowPairs,List.length_ofFn,Nat.add_comm] using hj + have he : (l (e ⟨qmaGateCut width e g+j,hj'⟩), + r (e ⟨qmaGateCut width e g+j,hj'⟩)) = p := by + simpa only [qmaRowPairs,List.getElem_ofFn,Function.comp_apply] using hp + rw [←he] + refine ⟨(hlr _ i).symm,?_⟩ + intro heq + have hh := hr heq + have hcut := qmaGateCut_site width e g i hi + rw [hh,e.symm_apply_apply] at hcut + change qmaGateCut width e g+j < qmaGateCut width e g at hcut + omega + +theorem qmaRowStage_matrix (width work : ℕ) + (l r : Fin (width+1) → Fin (work+1)) (hl : Function.Injective l) + (hr : Function.Injective r) (hlr : ∀ i j, l i ≠ r j) + (e : Equiv.Perm (Fin (width+1))) (g : QMAGate) (hg : g.WellFormed (width+1)) : + qmaGateProduct work (qmaRowStage width work l r e g) = + qmaGateMatrix work (qmaMapGate width work r g)* + qmaGateProduct work (qmaTransferGates (qmaRowPairs l r)) := by + unfold qmaRowStage + rw [qmaTransfer_insert_gate _ _ + (fun p hp => qmaRowPairs_distinct (l ∘ e) (r ∘ e) + (fun i j => hlr (e i) (e j)) p (List.mem_of_mem_drop hp)) + _ (qmaMapGate_wellFormed width work r hr g hg) + (qmaRowStage_tail_avoids width work l r hr hlr e g), + List.take_append_drop,qmaRowTransfer_matrix_reindex l r hl hr hlr e] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRowOrder.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRowOrder.lean new file mode 100644 index 0000000000000000000000000000000000000000..43217f79395e89043ca6d112668195f80392f936 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRowOrder.lean @@ -0,0 +1,48 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridAcceptance + +namespace OAI + +/-! The completed row transfer is independent of the chosen column order. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped Classical + +theorem qmaRowTransfer_reindex {n work : ℕ} (l r : Fin n → Fin (work+1)) + (hl : Function.Injective l) (hr : Function.Injective r) + (hlr : ∀ i j, l i ≠ r j) (e : Equiv.Perm (Fin n)) : + qmaTransferPermutation (qmaRowPairs (l ∘ e) (r ∘ e)) = + qmaTransferPermutation (qmaRowPairs l r) := by + have hl' : Function.Injective (l ∘ e) := hl.comp e.injective + have hr' : Function.Injective (r ∘ e) := hr.comp e.injective + have hlr' : ∀ i j, (l ∘ e) i ≠ (r ∘ e) j := fun i j => hlr (e i) (e j) + apply Equiv.ext + intro k + by_cases hleft : ∃ i, k = l i + · obtain ⟨i,rfl⟩ := hleft + have ht := (qmaRowTransfer_coordinates (l ∘ e) (r ∘ e) hl' hr' hlr' (e.symm i)).1 + simpa only [Function.comp_apply,Equiv.apply_symm_apply, + (qmaRowTransfer_coordinates l r hl hr hlr i).1] using ht + by_cases hright : ∃ i, k = r i + · obtain ⟨i,rfl⟩ := hright + have ht := (qmaRowTransfer_coordinates (l ∘ e) (r ∘ e) hl' hr' hlr' (e.symm i)).2 + simpa only [Function.comp_apply,Equiv.apply_symm_apply, + (qmaRowTransfer_coordinates l r hl hr hlr i).2] using ht + · rw [qmaRowTransfer_fixed (l ∘ e) (r ∘ e) k + (fun i hi => hleft ⟨e i,hi⟩) (fun i hi => hright ⟨e i,hi⟩), + qmaRowTransfer_fixed l r k (fun i hi => hleft ⟨i,hi⟩) (fun i hi => hright ⟨i,hi⟩)] + +theorem qmaRowTransfer_matrix_reindex {n work : ℕ} (l r : Fin n → Fin (work+1)) + (hl : Function.Injective l) (hr : Function.Injective r) + (hlr : ∀ i j, l i ≠ r j) (e : Equiv.Perm (Fin n)) : + qmaGateProduct work (qmaTransferGates (qmaRowPairs (l ∘ e) (r ∘ e))) = + qmaGateProduct work (qmaTransferGates (qmaRowPairs l r)) := by + rw [qmaRowTransfer_matrix (l ∘ e) (r ∘ e) (fun i j => hlr (e i) (e j)), + qmaRowTransfer_matrix l r hlr,qmaRowTransfer_reindex l r hl hr hlr e] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRowStageBounds.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRowStageBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..93531f2b54bd72037fe457dd89e2d871eb66ea34 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRowStageBounds.lean @@ -0,0 +1,43 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRowInsertion + +namespace OAI + +/-! The insertion keeps the exact stage size and well-formed gate set. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +theorem qmaRowStage_length (width work : ℕ) + (l r : Fin (width+1) → Fin (work+1)) (e : Equiv.Perm (Fin (width+1))) + (g : QMAGate) : (qmaRowStage width work l r e g).length = 3*(width+1)+1 := by + let ps := qmaRowPairs (l ∘ e) (r ∘ e) + have hs : (ps.take (qmaGateCut width e g)).length+ + (ps.drop (qmaGateCut width e g)).length = width+1 := by + rw [←List.length_append,List.take_append_drop] + simp [ps,qmaRowPairs] + change (qmaTransferGates (ps.take (qmaGateCut width e g)) ++ + [qmaMapGate width work r g] ++ qmaTransferGates (ps.drop (qmaGateCut width e g))).length = _ + simp only [List.length_append,List.length_singleton,qmaTransferGates_length] + omega + +theorem qmaRowStage_wellFormed (width work : ℕ) + (l r : Fin (width+1) → Fin (work+1)) (hr : Function.Injective r) + (hlr : ∀ i j, l i ≠ r j) (e : Equiv.Perm (Fin (width+1))) + (g : QMAGate) (hg : g.WellFormed (width+1)) : + ∀ k ∈ qmaRowStage width work l r e g, k.WellFormed (work+1) := by + have hp := qmaRowPairs_distinct (l ∘ e) (r ∘ e) (fun i j => hlr (e i) (e j)) + intro k hk + simp only [qmaRowStage,List.mem_append,List.mem_singleton] at hk + rcases hk with (hk | rfl) | hk + · exact qmaTransferGates_wellFormed _ + (fun p hm => hp p (List.mem_of_mem_take hm)) k hk + · exact qmaMapGate_wellFormed width work r hr g hg + · exact qmaTransferGates_wellFormed _ + (fun p hm => hp p (List.mem_of_mem_drop hm)) k hk + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRowStageSupport.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRowStageSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd050f88736b69c3a7a5763e03cbda4e8feb86da --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRowStageSupport.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSweepCircuit + +namespace OAI + +/-! Each sweep stage uses only vertical transfers and its single horizontal gate. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +theorem qmaTransferGates_member {work : ℕ} + (ps : List (Fin (work+1) × Fin (work+1))) (g : QMAGate) : + g ∈ qmaTransferGates ps ↔ ∃ p ∈ ps, g ∈ qmaWireSwapGates p.1 p.2 := by + induction ps with + | nil => simp [qmaTransferGates] + | cons p ps ih => + rcases p with ⟨i,j⟩ + simp only [qmaTransferGates,List.mem_append,ih,List.mem_cons] + aesop + +theorem qmaRowStage_member (width work : ℕ) + (l r : Fin (width+1) → Fin (work+1)) (e : Equiv.Perm (Fin (width+1))) + (g k : QMAGate) (hk : k ∈ qmaRowStage width work l r e g) : + k = qmaMapGate width work r g ∨ + ∃ i : Fin (width+1), k ∈ qmaWireSwapGates (l i) (r i) := by + simp only [qmaRowStage,List.mem_append,List.mem_singleton] at hk + rcases hk with (hk | rfl) | hk + · obtain ⟨p,hp,hk⟩ := (qmaTransferGates_member _ k).mp hk + obtain ⟨i,rfl⟩ := List.mem_ofFn.mp (List.mem_of_mem_take hp) + exact Or.inr ⟨e i,hk⟩ + · exact Or.inl rfl + · obtain ⟨p,hp,hk⟩ := (qmaTransferGates_member _ k).mp hk + obtain ⟨i,rfl⟩ := List.mem_ofFn.mp (List.mem_of_mem_drop hp) + exact Or.inr ⟨e i,hk⟩ + +theorem qmaWireSwap_sites {work : ℕ} (i j : Fin (work+1)) + (g : QMAGate) (hg : g ∈ qmaWireSwapGates i j) : + ∀ k ∈ qmaGateSites work g, k = i ∨ k = j := by + simp only [qmaWireSwapGates,List.mem_cons,List.not_mem_nil,or_false] at hg + rcases hg with rfl | rfl | rfl <;> + simp [qmaGateSites,qmaQubit_fin,or_comm] + +theorem qmaAdjacentGate_window (work : ℕ) (g : QMAGate) + (hg : g.WellFormed (work+1)) (ha : g.Adjacent) : + ∃ lo : Fin (work+1), ∀ i ∈ qmaGateSites work g, + lo.val ≤ i.val ∧ i.val ≤ lo.val+1 := by + cases g with + | hadamard i => + refine ⟨⟨i,hg⟩,?_⟩ + intro k hk + simp only [qmaGateSites,Finset.mem_singleton] at hk + subst k + simp [qmaQubit,Nat.mod_eq_of_lt hg] + | phaseT i => + refine ⟨⟨i,hg⟩,?_⟩ + intro k hk + simp only [qmaGateSites,Finset.mem_singleton] at hk + subst k + simp [qmaQubit,Nat.mod_eq_of_lt hg] + | controlledNot i j => + refine ⟨⟨min i j,lt_of_le_of_lt (min_le_left _ _) hg.1⟩,?_⟩ + intro k hk + simp only [qmaGateSites,Finset.mem_insert,Finset.mem_singleton] at hk + change i+1 = j ∨ j+1 = i at ha + rcases hk with rfl | rfl + · simp only [qmaQubit,Fin.val_mk,Nat.mod_eq_of_lt hg.1] + omega + · simp only [qmaQubit,Fin.val_mk,Nat.mod_eq_of_lt hg.2.1] + omega + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRowTransfer.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRowTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..8b66c55869b628f71b7fdbaf3c27596a355fdccb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumRowTransfer.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFirstUse + +namespace OAI + +/-! Moving a complete register between two disjoint rows. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +def qmaRowPairs {n work : ℕ} (l r : Fin n → Fin (work+1)) : + List (Fin (work+1) × Fin (work+1)) := List.ofFn (fun i => (l i,r i)) + +theorem qmaRowPairs_disjoint {n work : ℕ} (l r : Fin n → Fin (work+1)) + (hl : Function.Injective l) (hr : Function.Injective r) + (hlr : ∀ i j, l i ≠ r j) : (qmaRowPairs l r).Pairwise QMATransferDisjoint := by + apply List.pairwise_ofFn.mpr + intro i j hij + have hne : i ≠ j := ne_of_lt hij + exact ⟨fun h => hne (hl h),hlr i j,(hlr j i).symm,fun h => hne (hr h)⟩ + +theorem qmaRowPairs_distinct {n work : ℕ} (l r : Fin n → Fin (work+1)) + (hlr : ∀ i j, l i ≠ r j) : ∀ p ∈ qmaRowPairs l r, p.1 ≠ p.2 := by + intro p hp + obtain ⟨i,rfl⟩ := List.mem_ofFn.mp hp + exact hlr i i + +theorem qmaRowTransfer_coordinates {n work : ℕ} (l r : Fin n → Fin (work+1)) + (hl : Function.Injective l) (hr : Function.Injective r) + (hlr : ∀ i j, l i ≠ r j) (i : Fin n) : + qmaTransferPermutation (qmaRowPairs l r) (l i) = r i ∧ + qmaTransferPermutation (qmaRowPairs l r) (r i) = l i := + qmaTransferPermutation_exchanges _ (qmaRowPairs_disjoint l r hl hr hlr) (l i,r i) + (List.mem_ofFn.mpr ⟨i,rfl⟩) + +theorem qmaRowTransfer_fixed {n work : ℕ} (l r : Fin n → Fin (work+1)) + (k : Fin (work+1)) (hl : ∀ i, k ≠ l i) (hr : ∀ i, k ≠ r i) : + qmaTransferPermutation (qmaRowPairs l r) k = k := by + apply qmaTransferPermutation_fixed + intro p hp + obtain ⟨i,rfl⟩ := List.mem_ofFn.mp hp + exact ⟨hl i,hr i⟩ + +theorem qmaRowTransfer_involutive {n work : ℕ} (l r : Fin n → Fin (work+1)) + (hl : Function.Injective l) (hr : Function.Injective r) + (hlr : ∀ i j, l i ≠ r j) : + Function.Involutive (qmaTransferPermutation (qmaRowPairs l r)) := by + intro k + by_cases hleft : ∃ i, k = l i + · obtain ⟨i,rfl⟩ := hleft + rw [(qmaRowTransfer_coordinates l r hl hr hlr i).1, + (qmaRowTransfer_coordinates l r hl hr hlr i).2] + by_cases hright : ∃ i, k = r i + · obtain ⟨i,rfl⟩ := hright + rw [(qmaRowTransfer_coordinates l r hl hr hlr i).2, + (qmaRowTransfer_coordinates l r hl hr hlr i).1] + · have h := qmaRowTransfer_fixed l r k + (fun i hi => hleft ⟨i,hi⟩) (fun i hi => hright ⟨i,hi⟩) + rw [h,h] + +theorem qmaRowTransfer_matrix {n work : ℕ} (l r : Fin n → Fin (work+1)) + (hlr : ∀ i j, l i ≠ r j) : + qmaGateProduct work (qmaTransferGates (qmaRowPairs l r)) = + qmaWirePermutation (fun s => s ∘ qmaTransferPermutation (qmaRowPairs l r)) := + qmaTransferGates_matrix _ (qmaRowPairs_distinct l r hlr) + +theorem qmaRowTransfer_length {n work : ℕ} (l r : Fin n → Fin (work+1)) : + (qmaTransferGates (qmaRowPairs l r)).length = 3*n := by + simp [qmaTransferGates_length,qmaRowPairs] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSampleAssembly.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSampleAssembly.lean new file mode 100644 index 0000000000000000000000000000000000000000..2cacf863dc52640fb922e4b5d435b1bb0a239aae --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSampleAssembly.lean @@ -0,0 +1,168 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumComputedAccuracy + +namespace OAI + +/-! Exact termwise assembly of the computed physical exchange list. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumAxisSample +open Matrix +open scoped BigOperators Classical + +abbrev TypedBond (m : ℕ) := Fin m × (Fin m × ℚ) + +def typedBondMatrix {m : ℕ} (b : TypedBond m) : Matrix (SourceSpinBasis m) (SourceSpinBasis m) ℂ := + (b.2.2:ℂ) • sourceHeisenbergMatrix m b.1 b.2.1 + +def fieldBonds {n : ℕ} (k : ℕ) (i : Fin n) (a : Fin 2) (J : ℚ) : List (TypedBond (n*4)) := + List.ofFn fun e : Fin 3 => (finProdFinEquiv (i,0), + finProdFinEquiv (i,qmaFieldEdgeRight e),fieldValue k a J e) + +def crossBonds {n : ℕ} (k : ℕ) (r : ℚ) (i j : Fin n) (a b : Fin 2) (J : ℚ) : + List (TypedBond (n*4)) := + List.ofFn fun e : Fin 16 => + let pq := (finProdFinEquiv : Fin 4 × Fin 4 ≃ Fin 16).symm e + (finProdFinEquiv (i,pq.1),finProdFinEquiv (j,pq.2),crossValue k r a b J pq.1 pq.2) + +def termBonds {n : ℕ} (k : ℕ) (r : ℚ) (t : QMAXZTerm n) (J : ℚ) : List (TypedBond (n*4)) := + match t with + | .scalar => [] + | .field i a => fieldBonds k i a J + | .pair i j _ a b => crossBonds k r i j a b J ++ + fieldBonds k i a (counterA k a b J) ++ fieldBonds k j b (counterB k a b J) + +def termScalar {n : ℕ} (k : ℕ) (t : QMAXZTerm n) (J : ℚ) : ℚ := + match t with + | .scalar => J + | .field _ a => -shiftValue a J + | .pair _ _ _ a b => -offset k a b J + +def penaltyBonds (n : ℕ) (r : ℚ) : List (TypedBond (n*4)) := + List.ofFn fun e : Fin (n*6) => + let ik := (finProdFinEquiv : Fin n × Fin 6 ≃ Fin (n*6)).symm e + (finProdFinEquiv (ik.1,qmaFourEdgeLeft ik.2), + finProdFinEquiv (ik.1,qmaFourEdgeRight ik.2),r^2) + +theorem fieldBonds_matrix {n : ℕ} (k : ℕ) (i : Fin n) (a : Fin 2) (J : ℚ) : + ((fieldBonds k i a J).map typedBondMatrix).sum = + ∑ e : Fin 3, (fieldValue k a J e:ℂ) • sourceHeisenbergMatrix (n*4) + (finProdFinEquiv (i,0)) (finProdFinEquiv (i,qmaFieldEdgeRight e)) := by + simp only [fieldBonds,List.map_ofFn,List.sum_ofFn,Function.comp_apply,typedBondMatrix] + +theorem crossBonds_matrix {n : ℕ} (k : ℕ) (r : ℚ) (i j : Fin n) (a b : Fin 2) (J : ℚ) : + ((crossBonds k r i j a b J).map typedBondMatrix).sum = + ∑ p : Fin 4, ∑ q : Fin 4, (crossValue k r a b J p q:ℂ) • + sourceHeisenbergMatrix (n*4) (finProdFinEquiv (i,p)) (finProdFinEquiv (j,q)) := by + simp only [crossBonds,List.map_ofFn,List.sum_ofFn,Function.comp_apply,typedBondMatrix] + calc + _ = ∑ pq : Fin 4 × Fin 4, (crossValue k r a b J pq.1 pq.2:ℂ) • + sourceHeisenbergMatrix (n*4) (finProdFinEquiv (i,pq.1)) (finProdFinEquiv (j,pq.2)) := + Fintype.sum_equiv (finProdFinEquiv : Fin 4 × Fin 4 ≃ Fin 16).symm _ _ (by intro e; rfl) + _ = _ := Fintype.sum_prod_type _ + +theorem penaltyBonds_matrix (n : ℕ) (r : ℚ) : + ((penaltyBonds n r).map typedBondMatrix).sum = + ∑ i : Fin n, ∑ e : Fin 6, ((r^2:ℚ):ℂ) • sourceHeisenbergMatrix (n*4) + (finProdFinEquiv (i,qmaFourEdgeLeft e)) (finProdFinEquiv (i,qmaFourEdgeRight e)) := by + simp only [penaltyBonds,List.map_ofFn,List.sum_ofFn,Function.comp_apply,typedBondMatrix] + calc + _ = ∑ ik : Fin n × Fin 6, ((r^2:ℚ):ℂ) • sourceHeisenbergMatrix (n*4) + (finProdFinEquiv (ik.1,qmaFourEdgeLeft ik.2)) (finProdFinEquiv (ik.1,qmaFourEdgeRight ik.2)) := + Fintype.sum_equiv (finProdFinEquiv : Fin n × Fin 6 ≃ Fin (n*6)).symm _ _ (by intro e; rfl) + _ = _ := Fintype.sum_prod_type _ + +variable {n : ℕ} {κ : Type*} [Fintype κ] + +theorem sum_term_partition {M : Type*} [AddCommMonoid M] + (t : κ → QMAXZTerm n) (f : κ → M) : + (∑ e, f e) = (∑ e : QMAXZScalarIndex t, f e.val)+ + (∑ e : QMAXZPairIndex t, f e.val)+(∑ e : QMAXZFieldIndex t, f e.val) := by + rw [qmaSum_subtype_ite (fun e => (t e).IsScalar), + qmaSum_subtype_ite (fun e => (t e).IsPair),qmaSum_subtype_ite (fun e => (t e).IsField), + ← Finset.sum_add_distrib,← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro e _ + cases t e <;> simp [QMAXZTerm.IsScalar,QMAXZTerm.IsPair,QMAXZTerm.IsField] + +theorem termScalar_sum (k : ℕ) (r : ℚ) (t : κ → QMAXZTerm n) (J : κ → ℚ) : + r^2*(n*6)+∑ e, termScalar k (t e) (J e) = scalarValue k r t J := by + have hs (e : QMAXZScalarIndex t) : termScalar k (t e.val) (J e.val) = J e.val := by + have h := e.property + cases ht : t e.val <;> simp_all [QMAXZTerm.IsScalar,termScalar] + have hp (e : QMAXZPairIndex t) : termScalar k (t e.val) (J e.val) = + -offset k (qmaXZPairData t e).axisLeft (qmaXZPairData t e).axisRight (J e.val) := by + have aux (u : QMAXZTerm n) (hu : u.IsPair) (q : ℚ) : termScalar k u q = + -offset k (u.asPair hu).axisLeft (u.asPair hu).axisRight q := by + cases u <;> first | exact hu.elim | rfl + exact aux (t e.val) e.property (J e.val) + have hf (e : QMAXZFieldIndex t) : termScalar k (t e.val) (J e.val) = + -shiftValue (qmaXZFieldData t e).axis (J e.val) := by + have aux (u : QMAXZTerm n) (hu : u.IsField) (q : ℚ) : termScalar k u q = + -shiftValue (u.asField hu).axis q := by + cases u <;> first | exact hu.elim | rfl + exact aux (t e.val) e.property (J e.val) + rw [sum_term_partition t (fun e => termScalar k (t e) (J e))] + simp only [hs,hp,hf,Finset.sum_neg_distrib,scalarValue] + ring + +def pairBondMatrix (k : ℕ) (r : ℚ) (d : QMAXZPair n) (J : ℚ) : + Matrix (SourceSpinBasis (n*4)) (SourceSpinBasis (n*4)) ℂ := + (∑ p : Fin 4, ∑ q : Fin 4, (crossValue k r d.axisLeft d.axisRight J p q:ℂ) • + sourceHeisenbergMatrix (n*4) (finProdFinEquiv (d.left,p)) (finProdFinEquiv (d.right,q)))+ + ((fieldBonds k d.left d.axisLeft (counterA k d.axisLeft d.axisRight J)).map typedBondMatrix).sum+ + ((fieldBonds k d.right d.axisRight (counterB k d.axisLeft d.axisRight J)).map typedBondMatrix).sum + +theorem termBonds_pair (k : ℕ) (r : ℚ) (u : QMAXZTerm n) (hu : u.IsPair) (J : ℚ) : + ((termBonds k r u J).map typedBondMatrix).sum = pairBondMatrix k r (u.asPair hu) J := by + cases u with + | scalar => exact hu.elim + | field => exact hu.elim + | pair i j hij a b => + simp only [termBonds,List.map_append,List.sum_append,crossBonds_matrix, + pairBondMatrix,QMAXZTerm.asPair] + +theorem termBonds_field (k : ℕ) (r : ℚ) (u : QMAXZTerm n) (hu : u.IsField) (J : ℚ) : + ((termBonds k r u J).map typedBondMatrix).sum = + ((fieldBonds k (u.asField hu).site (u.asField hu).axis J).map typedBondMatrix).sum := by + cases u <;> first | exact hu.elim | rfl + +theorem termBonds_scalar (k : ℕ) (r : ℚ) (u : QMAXZTerm n) (hu : u.IsScalar) (J : ℚ) : + ((termBonds k r u J).map typedBondMatrix).sum = 0 := by + cases u <;> first | exact hu.elim | rfl + +theorem matrixValue_assembly (k : ℕ) (r : ℚ) (t : κ → QMAXZTerm n) (J : κ → ℚ) : + matrixValue k r t J = ((penaltyBonds n r).map typedBondMatrix).sum+ + (∑ e, ((termBonds k r (t e) (J e)).map typedBondMatrix).sum)+ + (scalarValue k r t J:ℂ) • 1 := by + rw [sum_term_partition t (fun e => ((termBonds k r (t e) (J e)).map typedBondMatrix).sum)] + have hs : (∑ e : QMAXZScalarIndex t, + ((termBonds k r (t e.val) (J e.val)).map typedBondMatrix).sum) = 0 := by + apply Finset.sum_eq_zero + intro e _ + exact termBonds_scalar k r _ e.property _ + have hp : (∑ e : QMAXZPairIndex t, + ((termBonds k r (t e.val) (J e.val)).map typedBondMatrix).sum) = + ∑ e : QMAXZPairIndex t, pairBondMatrix k r (qmaXZPairData t e) (J e.val) := by + apply Finset.sum_congr rfl + intro e _ + exact termBonds_pair k r _ e.property _ + have hf : (∑ e : QMAXZFieldIndex t, + ((termBonds k r (t e.val) (J e.val)).map typedBondMatrix).sum) = + ∑ e : QMAXZFieldIndex t, + ((fieldBonds k (qmaXZFieldData t e).site (qmaXZFieldData t e).axis (J e.val)).map typedBondMatrix).sum := by + apply Finset.sum_congr rfl + intro e _ + exact termBonds_field k r _ e.property _ + rw [hs,hp,hf,zero_add,penaltyBonds_matrix] + simp only [matrixValue,qmaExchangeMatrix,QMAFourExchangeIndex,Fintype.sum_sum_type, + Fintype.sum_prod_type,qmaFourExchangeLeft,qmaFourExchangeRight,weightValue, + pairBondMatrix,fieldBonds_matrix,Fin.sum_univ_two,ite_true, + show (1:Fin 2) ≠ 0 by decide,ite_false,Complex.ofReal_ratCast, + Finset.sum_add_distrib] + abel + +end ContinuumCoulomb.QuantumAxisSample + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSampleBudget.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSampleBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..75e3b00fc5bc783d4eb06c7d92c5368273c855f4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSampleBudget.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumComputedAccuracy + +namespace OAI + +/-! A computable budget uses only the qubit count, term count and coefficient mass. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumAxisSample +open Matrix +open scoped BigOperators Classical + +def universalErrorBudget (n m : ℕ) (r S : ℚ) : ℚ := + 3*(6*n+25*m)*(1568*|r| *(1+(m+S))+26064*(m+S))+320800*S + +variable {n : ℕ} {κ : Type*} [Fintype κ] + +theorem rationalErrorBudget_le (r : ℚ) (t : κ → QMAXZTerm n) (J : κ → ℚ) : + rationalErrorBudget r t J ≤ universalErrorBudget n (Fintype.card κ) r (∑ e, |J e|) := by + have hc : (Fintype.card (QMAFourExchangeIndex n (QMAXZPairIndex t) (QMAXZFieldIndex t)):ℚ) ≤ + 6*n+25*Fintype.card κ := by exact_mod_cast qmaXZBlock_exchange_count t + have hU : (0:ℚ) ≤ Fintype.card κ+∑ e, |J e| := by positivity + unfold rationalErrorBudget universalErrorBudget rationalInputSize + gcongr + +def boundedPrecision (N : ℕ) (_t : κ → QMAXZTerm n) (J : κ → ℚ) : ℕ := + precision (universalErrorBudget n (Fintype.card κ) (rationalPenalty N J) (∑ e, |J e|)) N + +def boundedMatrix (N : ℕ) (t : κ → QMAXZTerm n) (J : κ → ℚ) : + Matrix (SourceSpinBasis (n*4)) (SourceSpinBasis (n*4)) ℂ := + matrixValue (boundedPrecision N t J) (rationalPenalty N J) t J + +theorem boundedMatrix_accuracy (N : ℕ) (hN : 0 < N) (t : κ → QMAXZTerm n) (J : κ → ℚ) + (hprivate : ∀ e f, (qmaPauliSupport (t e).word).card = 2 → + qmaPauliSupport (t e).word = qmaPauliSupport (t f).word → e = f) : + |MediatorGraph.normalizedBottom (boundedMatrix N t J)- + MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • (t e).matrix)| ≤ 2/(N:ℝ) := by + have h := matrixValue_accuracy (boundedPrecision N t J) N hN t J hprivate + have he := precision_error + (universalErrorBudget n (Fintype.card κ) (rationalPenalty N J) (∑ e, |J e|)) N hN + have hb : matrixErrorBudget (rationalPenalty N J) t J ≤ + (universalErrorBudget n (Fintype.card κ) (rationalPenalty N J) (∑ e, |J e|):ℝ) := by + rw [← rationalErrorBudget_cast] + exact_mod_cast rationalErrorBudget_le (rationalPenalty N J) t J + have he' := (mul_le_mul_of_nonneg_right hb + (by positivity : (0:ℝ) ≤ (2:ℝ)⁻¹^(boundedPrecision N t J))).trans he + apply h.trans + calc + _ ≤ 1/(N:ℝ)+1/(N:ℝ) := add_le_add he' le_rfl + _ = 2/(N:ℝ) := by ring + +end ContinuumCoulomb.QuantumAxisSample + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSamplePrecision.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSamplePrecision.lean new file mode 100644 index 0000000000000000000000000000000000000000..02aca93c03c6f54d5a9e1c6cd4e06c66b74584f1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSamplePrecision.lean @@ -0,0 +1,66 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZSample + +namespace OAI + +/-! Logarithmic precision, computed from binary numerators, suffices for the physical error budget. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumAxisSample +open ExactQuantumFactoring.BitStackProgram + +def precision (q : ℚ) (N : ℕ) : ℕ := q.num.natAbs.size+N.size + +theorem rational_le_numerator (q : ℚ) : (q:ℝ) ≤ (q.num.natAbs:ℝ) := by + have hden : (1:ℝ) ≤ q.den := by exact_mod_cast q.pos + have he : (q:ℝ) = (q.num:ℝ)/(q.den:ℝ) := by + exact_mod_cast (Rat.num_div_den q).symm + have habs : |(q.num:ℝ)| = (q.num.natAbs:ℝ) := by rw [Nat.cast_natAbs,Int.cast_abs] + calc + _ ≤ |(q:ℝ)| := le_abs_self _ + _ = |(q.num:ℝ)|/(q.den:ℝ) := by + rw [he,abs_div,abs_of_nonneg (show (0:ℝ) ≤ q.den by exact_mod_cast Nat.zero_le q.den)] + _ ≤ |(q.num:ℝ)| := div_le_self (abs_nonneg _) hden + _ = _ := habs + +theorem precision_error (q : ℚ) (N : ℕ) (hN : 0 < N) : + (q:ℝ)*(2:ℝ)⁻¹^(precision q N) ≤ 1/(N:ℝ) := by + have ha : (q.num.natAbs:ℝ) ≤ (2:ℝ)^q.num.natAbs.size := by + exact_mod_cast (Nat.lt_size_self q.num.natAbs).le + have hb : (N:ℝ) ≤ (2:ℝ)^N.size := by exact_mod_cast (Nat.lt_size_self N).le + have hprod : (q:ℝ)*(N:ℝ) ≤ (2:ℝ)^(precision q N) := by + rw [precision,pow_add] + exact mul_le_mul ((rational_le_numerator q).trans ha) hb (Nat.cast_nonneg _) (by positivity) + have hNp : (0:ℝ) < N := by exact_mod_cast hN + have hpow : (0:ℝ) < 2^(precision q N) := by positivity + have hdiv := (div_le_one hpow).mpr hprod + apply (le_div_iff₀ hNp).mpr + convert hdiv using 1 + simp only [div_eq_mul_inv,inv_pow] + ring + +def precisionCode : (ℚ × ℕ) → List Bool := prodCode ratCode Nat.bits + +noncomputable opaque numeratorMagnitudeProgram : Procedure precisionCode Nat.bits + (fun x => x.1.num.natAbs) := + Procedure.intAbs.comp (Procedure.ratNum.comp (Procedure.first ratCode Nat.bits)) + +noncomputable opaque numeratorSizeProgram : Procedure precisionCode unaryCode + (fun x => x.1.num.natAbs.size) := + ((Procedure.length.precompose Nat.bits).comp numeratorMagnitudeProgram).congrFun + (by intro x; exact Nat.size_eq_bits_len _) + +noncomputable opaque denominatorSizeProgram : Procedure precisionCode unaryCode (fun x => x.2.size) := + ((Procedure.length.precompose Nat.bits).comp (Procedure.second ratCode Nat.bits)).congrFun + (by intro x; exact Nat.size_eq_bits_len _) + +noncomputable opaque precisionProgram : Procedure precisionCode unaryCode (fun x => precision x.1 x.2) := + Procedure.unaryAdd.comp (numeratorSizeProgram.pair denominatorSizeProgram) + +noncomputable def precisionCertificate : Turing.TM2ComputableInPolyTime precisionCode unaryCode + (fun x => precision x.1 x.2) := precisionProgram.toTM2 + +end ContinuumCoulomb.QuantumAxisSample + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumScalarFaithful.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumScalarFaithful.lean new file mode 100644 index 0000000000000000000000000000000000000000..92fc822984c007088f07306b0311cc1edb2e3813 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumScalarFaithful.lean @@ -0,0 +1,48 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumAlgebraicScalar +import Mathlib.NumberTheory.Real.Irrational + +namespace OAI + +/-! The four rational registers faithfully represent their complex value. +This permits exact local-table identities to reuse the established complex +matrix identities, without changing the arithmetic program. -/ + +namespace ContinuumCoulomb.QuantumAlgebraicScalar + +theorem sqrtHalf_irrational : Irrational (Real.sqrt (1/2 : ℝ)) := by + rw [Real.sqrt_div (by norm_num : (0:ℝ)≤1),Real.sqrt_one,one_div] + exact irrational_sqrt_two.inv + +theorem realValue_injective : Function.Injective realValue := by + rintro ⟨a,b⟩ ⟨c,d⟩ h + have hb : b=d := by + by_contra hbd + have hi := (sqrtHalf_irrational.ratCast_mul (sub_ne_zero.mpr hbd)).ratCast_add (a-c) + have hz : ((a-c : ℚ) : ℝ)+((b-d : ℚ) : ℝ)*Real.sqrt (1/2 : ℝ)=0 := by + dsimp only [realValue] at h + push_cast + nlinarith [h] + rw [hz] at hi + exact not_irrational_zero hi + have ha : a=c := by + subst d + have he : (a:ℝ)=(c:ℝ) := by + dsimp only [realValue] at h + linarith + exact_mod_cast he + exact Prod.ext ha hb + +theorem value_injective : Function.Injective value := by + intro x y h + apply Prod.ext + · apply realValue_injective + simpa only [value_re] using congrArg Complex.re h + · apply realValue_injective + simpa only [value_im] using congrArg Complex.im h + +theorem scalar_eq_iff (x y : Scalar) : x=y ↔ value x=value y := + ⟨congrArg value,fun h => value_injective h⟩ + +end ContinuumCoulomb.QuantumAlgebraicScalar + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumScalarReindex.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumScalarReindex.lean new file mode 100644 index 0000000000000000000000000000000000000000..bd9161455d3f959a3856c94cf68c6d9026415206 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumScalarReindex.lean @@ -0,0 +1,54 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumAlgebraicHistory + +namespace OAI + +/-! Exact reindexing of the four-rational local-core sums. This lets the +literal support-list coordinates evaluate the propagation Gram matrix. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumAlgebraicHistory +open QuantumAlgebraicScalar QuantumFixedPauli +open scoped BigOperators + +private theorem scalar_add_eq (x y : Scalar) : add x y=x+y := rfl +theorem scalar_sum_eq (xs : List Scalar) : QuantumAlgebraicScalar.sum xs=xs.sum := by + induction xs with + | nil => rfl + | cons x xs ih => + rw [QuantumAlgebraicScalar.sum,ih,List.sum_cons,scalar_add_eq] + +theorem scalar_finiteSum_eq {α : Type} [Fintype α] (f : α → Scalar) : + finiteSum f=∑ a,f a := by + rw [finiteSum,scalar_sum_eq] + simp only [enumerate,List.map_ofFn,List.sum_ofFn] + exact (Fintype.equivFin α).symm.sum_comp f + +theorem scalar_finiteSum_reindex {α β : Type} [Fintype α] [Fintype β] + (e : α ≃ β) (f : β → Scalar) : + finiteSum (fun a => f (e a))=finiteSum f := by + rw [scalar_finiteSum_eq,scalar_finiteSum_eq] + exact e.sum_comp f + +def reindex {α β : Type} (e : α ≃ β) (A : Matrix β β Scalar) : Matrix α α Scalar := + fun s t => A (e s) (e t) + +theorem matMul_reindex {α β : Type} [Fintype α] [Fintype β] + (e : α ≃ β) (A B : Matrix β β Scalar) : + matMul (reindex e A) (reindex e B)=reindex e (matMul A B) := by + funext s t + exact scalar_finiteSum_reindex e (fun u => mul (A (e s) u) (B u (e t))) + +theorem adjoint_reindex {α β : Type} (e : α ≃ β) (A : Matrix β β Scalar) : + adjoint (reindex e A)=reindex e (adjoint A) := rfl + +theorem gram_reindex {α β : Type} [Fintype α] [Fintype β] + (e : α ≃ β) (A : Matrix β β Scalar) : + matMul (adjoint (reindex e A)) (reindex e A)= + reindex e (matMul (adjoint A) A) := by + rw [adjoint_reindex,matMul_reindex] + +end ContinuumCoulomb.QuantumAlgebraicHistory + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumScaledDirection.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumScaledDirection.lean new file mode 100644 index 0000000000000000000000000000000000000000..2a1198def86c66ed314e144f6163d49d118fe589 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumScaledDirection.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumScaledEdge + +namespace OAI + +/-! Interior points of two scaled unit segments can coincide only when the +underlying grid edge is the same, possibly with reversed orientation. -/ + +namespace ContinuumCoulomb + +def qmaScaledDirectionPoint (p : ℕ × ℕ) (a : Fin 4) (k : ℕ) : ℕ × ℕ := + ![(8*p.1+4+k,8*p.2+4),(8*p.1+4,8*p.2+4+k), + (8*p.1+4-k,8*p.2+4),(8*p.1+4,8*p.2+4-k)] a + +theorem qmaScaledDirectionPoint_eq (p : ℕ × ℕ) (hx : 0 < p.1) (hy : 0 < p.2) + (a : Fin 4) {k : ℕ} (hk : k ≤ 8) : + qmaManhattanPoint (qmaLeafCenter p) (qmaLeafCenter (qmaGridNeighbor p a)) k = + qmaScaledDirectionPoint p a k := by + have hpx : p.1-1+1 = p.1 := by omega + have hpy : p.2-1+1 = p.2 := by omega + fin_cases a <;> simp [qmaManhattanPoint,qmaAxisWalk,qmaLeafCenter,qmaGridNeighbor, + qmaScaledDirectionPoint,Nat.dist] + all_goals first | omega | (split_ifs <;> simp only [Prod.mk.injEq] <;> omega) + +theorem qmaScaledDirectionPoint_not_center (p r : ℕ × ℕ) + (a : Fin 4) {k : ℕ} (hk : 0 < k) (hk8 : k < 8) : + qmaScaledDirectionPoint p a k ≠ qmaLeafCenter r := by + intro h + have h1 := congrArg Prod.fst h + have h2 := congrArg Prod.snd h + fin_cases a <;> simp [qmaScaledDirectionPoint,qmaLeafCenter] at h1 h2 <;> omega + +theorem qmaScaledDirectionPoint_collision (p r : ℕ × ℕ) + (hpx : 0 < p.1) (hpy : 0 < p.2) (hrx : 0 < r.1) (hry : 0 < r.2) + (a b : Fin 4) {i j : ℕ} (hi : 0 < i) (hi8 : i < 8) (hj : 0 < j) (hj8 : j < 8) + (h : qmaScaledDirectionPoint p a i = qmaScaledDirectionPoint r b j) : + (p = r ∧ qmaGridNeighbor p a = qmaGridNeighbor r b) ∨ + (p = qmaGridNeighbor r b ∧ qmaGridNeighbor p a = r) := by + rcases p with ⟨x,y⟩ + rcases r with ⟨u,v⟩ + have h1 := congrArg Prod.fst h + have h2 := congrArg Prod.snd h + fin_cases a <;> fin_cases b <;> + simp [qmaScaledDirectionPoint,qmaGridNeighbor,Prod.mk.injEq] at h1 h2 ⊢ <;> omega + +theorem qmaScaledEdge_inner_collision {p q r s : ℕ × ℕ} + (hp : 0 < p.1 ∧ 0 < p.2) (hr : 0 < r.1 ∧ 0 < r.2) + (hpq : qmaSquareGrid.Adj p q) (hrs : qmaSquareGrid.Adj r s) + {i j : ℕ} (hi : 0 < i) (hi8 : i < 8) (hj : 0 < j) (hj8 : j < 8) + (h : qmaManhattanPoint (qmaLeafCenter p) (qmaLeafCenter q) i = + qmaManhattanPoint (qmaLeafCenter r) (qmaLeafCenter s) j) : + (p = r ∧ q = s) ∨ (p = s ∧ q = r) := by + obtain ⟨a,rfl⟩ := qmaGridNeighbor_exists hpq + obtain ⟨b,rfl⟩ := qmaGridNeighbor_exists hrs + rw [qmaScaledDirectionPoint_eq p hp.1 hp.2 a hi8.le, + qmaScaledDirectionPoint_eq r hr.1 hr.2 b hj8.le] at h + exact qmaScaledDirectionPoint_collision p r hp.1 hp.2 hr.1 hr.2 a b hi hi8 hj hj8 h + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumScaledEdge.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumScaledEdge.lean new file mode 100644 index 0000000000000000000000000000000000000000..e092f82031081b2e33bb413145d6028a9300cd2d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumScaledEdge.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRouteLeaf +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridNeighborsFour +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumManhattanSupport + +namespace OAI + +/-! Eightfold unit-edge corridors leave the diagonal leaf sites free. -/ + +namespace ContinuumCoulomb + +theorem qmaLeafCenter_length (p q : ℕ × ℕ) : + qmaManhattanLength (qmaLeafCenter p) (qmaLeafCenter q) = 8*qmaManhattanLength p q := by + simp only [qmaManhattanLength,qmaLeafCenter,Nat.dist_add_add_right,Nat.dist_mul_left,Nat.mul_add] + +theorem qmaLeafCenter_adj_length {p q : ℕ × ℕ} (h : qmaSquareGrid.Adj p q) : + qmaManhattanLength (qmaLeafCenter p) (qmaLeafCenter q) = 8 := by + rw [qmaLeafCenter_length] + change qmaManhattanLength p q = 1 at h + omega + +theorem qmaLeafCenter_point_gridline (p q : ℕ × ℕ) (k : ℕ) + (hk : k ≤ qmaManhattanLength (qmaLeafCenter p) (qmaLeafCenter q)) : + (qmaManhattanPoint (qmaLeafCenter p) (qmaLeafCenter q) k).1%8 = 4 ∨ + (qmaManhattanPoint (qmaLeafCenter p) (qmaLeafCenter q) k).2%8 = 4 := by + have h := qmaManhattanPoint_support (qmaLeafCenter p) (qmaLeafCenter q) k hk + rcases h with ⟨hy,_⟩ | ⟨hx,_⟩ + · right + rw [hy] + simp [qmaLeafCenter,Nat.add_mod] + · left + rw [hx] + simp [qmaLeafCenter,Nat.add_mod] + +theorem qmaRouteLeaf_avoids_corridor (p q r : ℕ × ℕ) (a : Fin 4) (k : ℕ) + (hk : k ≤ qmaManhattanLength (qmaLeafCenter q) (qmaLeafCenter r)) : + qmaRouteLeaf p a ≠ qmaManhattanPoint (qmaLeafCenter q) (qmaLeafCenter r) k := + qmaRouteLeaf_avoids p _ a (qmaLeafCenter_point_gridline q r k hk) + +theorem qmaLeafCenter_point_one (p : ℕ × ℕ) (hx : 0 < p.1) (hy : 0 < p.2) (a : Fin 4) : + qmaManhattanPoint (qmaLeafCenter p) (qmaLeafCenter (qmaGridNeighbor p a)) 1 = qmaLeafFirst p a := by + have hpx : p.1-1+1 = p.1 := by omega + have hpy : p.2-1+1 = p.2 := by omega + fin_cases a <;> simp [qmaManhattanPoint,qmaAxisWalk,qmaLeafCenter,qmaGridNeighbor,qmaLeafFirst,Nat.dist] + all_goals first | omega | (split_ifs <;> simp only [Prod.mk.injEq] <;> omega) + +theorem qmaLeafCenter_point_first {p q : ℕ × ℕ} (hx : 0 < p.1) (hy : 0 < p.2) + (ha : qmaSquareGrid.Adj p q) : + qmaManhattanPoint (qmaLeafCenter p) (qmaLeafCenter q) 1 = + qmaLeafFirst p (qmaGridNeighborIndex p q) := by + simpa only [qmaGridNeighborIndex_spec hx hy ha] using + qmaLeafCenter_point_one p hx hy (qmaGridNeighborIndex p q) + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumScheduleCrossingGeometry.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumScheduleCrossingGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..0cc7e27f57344456b3d070d17be0c27bad1ff288 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumScheduleCrossingGeometry.lean @@ -0,0 +1,132 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumComputedCrossingRelabel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingListSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingPositionRelabel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingSiteRelabel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumMergedSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListScheduleGraph +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPathRelabeling +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingOutputRoutes +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPacketGeometry + +namespace OAI + +/-! Match the complete literal crossing packet to the canonical port crossing +geometry. The input schedule and the crossing cells may have arbitrary orders. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumScheduleCrossingGeometry +open QuantumCrossingSelectProgram QuantumCrossingListLayer +open scoped Classical + +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) + (s : QuantumListSchedule.State) (hs : QuantumListSchedule.Valid s) + (E : QMAPathRelabeling (QuantumListSchedule.schedule s hs) (P.schedule.iterate N D)) + {r : ℕ} (cell : Fin r ≃ Fin P.crossingCells.card) + +def site (i : Fin r) (a : Fin 4) : Fin s.1 := + E.vertex.symm (P.crossingSiteFin N hD (cell i) a) + +theorem site_global : Function.Injective (fun p : Fin r × Fin 4 => site P N hD s hs E cell p.1 p.2) := + QuantumCrossingSiteProgram.reordered_sites_global P N hD E.vertex cell + +theorem site_injective (i : Fin r) : Function.Injective (site P N hD s hs E cell i) := by + intro a b hab + exact congrArg Prod.snd (site_global P N hD s hs E cell (a₁ := (i,a)) (a₂ := (i,b)) hab) + +def layer : QMARationalCrossingLayer r := + computedLayer ((QuantumListSchedule.graph s hs).crossingSelection + (site P N hD s hs E cell) (site_injective P N hD s hs E cell)) (Equiv.refl _) + +def input : QuantumCrossingListLayer.Input := + QuantumCrossingSelectProgram.value (N,(s.1,QuantumListSchedule.erase s.2.2,s.2.1), + List.ofFn (encodedSites (site P N hD s hs E cell))) + +theorem input_actual : input P N hD s hs E cell = + actualInput (layer P N hD s hs E cell) N (Equiv.refl _) := by + have h := compiled_packet ((QuantumListSchedule.graph s hs).crossingSelection + (site P N hD s hs E cell) (site_injective P N hD s hs E cell)) (Equiv.refl _) N + have hp := congrArg (fun bs => QuantumCrossingSelectProgram.value + (N,(s.1,bs,s.2.1),List.ofFn (encodedSites (site P N hD s hs E cell)))) + (QuantumListSchedule.graph_packed s hs).symm + exact hp.trans h + +def vertex : Fin (actualGraph (layer P N hD s hs E cell) N (Equiv.refl _)).n ≃ + Fin (P.crossingOutput N hD).n := + (actualVertex (layer P N hD s hs E cell) N (Equiv.refl _)).trans + ((layer P N hD s hs E cell).vertexRelabel (P.portCrossingSelection N hD).layer E.vertex cell) + +theorem layer_support : + (∀ e : ((layer P N hD s hs E cell).output N).Edge, + ∃ f : (P.crossingOutput N hD).Edge, + s((layer P N hD s hs E cell).vertexRelabel (P.portCrossingSelection N hD).layer + E.vertex cell (((layer P N hD s hs E cell).output N).left e), + (layer P N hD s hs E cell).vertexRelabel (P.portCrossingSelection N hD).layer + E.vertex cell (((layer P N hD s hs E cell).output N).right e)) = + s((P.crossingOutput N hD).left f,(P.crossingOutput N hD).right f)) ∧ + (∀ f : (P.crossingOutput N hD).Edge, + ∃ e : ((layer P N hD s hs E cell).output N).Edge, + s((layer P N hD s hs E cell).vertexRelabel (P.portCrossingSelection N hD).layer + E.vertex cell (((layer P N hD s hs E cell).output N).left e), + (layer P N hD s hs E cell).vertexRelabel (P.portCrossingSelection N hD).layer + E.vertex cell (((layer P N hD s hs E cell).output N).right e)) = + s((P.crossingOutput N hD).left f,(P.crossingOutput N hD).right f)) := by + exact computed_output_support E.vertex E.edge E.left E.right + (site P N hD s hs E cell) (P.crossingSiteFin N hD) cell + (fun _ _ => E.vertex.apply_symm_apply _) (site_injective P N hD s hs E cell) + (P.crossingSiteFin_injective N hD) (site_global P N hD s hs E cell) (Equiv.refl _) N N + +theorem output_support : + (∀ e : (actualGraph (layer P N hD s hs E cell) N (Equiv.refl _)).Edge, + ∃ f : (P.crossingOutput N hD).Edge, + s(vertex P N hD s hs E cell ((actualGraph (layer P N hD s hs E cell) N (Equiv.refl _)).left e), + vertex P N hD s hs E cell ((actualGraph (layer P N hD s hs E cell) N (Equiv.refl _)).right e)) = + s((P.crossingOutput N hD).left f,(P.crossingOutput N hD).right f)) ∧ + (∀ f : (P.crossingOutput N hD).Edge, + ∃ e : (actualGraph (layer P N hD s hs E cell) N (Equiv.refl _)).Edge, + s(vertex P N hD s hs E cell ((actualGraph (layer P N hD s hs E cell) N (Equiv.refl _)).left e), + vertex P N hD s hs E cell ((actualGraph (layer P N hD s hs E cell) N (Equiv.refl _)).right e)) = + s((P.crossingOutput N hD).left f,(P.crossingOutput N hD).right f)) := by + let C := layer P N hD s hs E cell + let V := C.vertexRelabel (P.portCrossingSelection N hD).layer E.vertex cell + have hl := layer_support P N hD s hs E cell + constructor + · intro e + obtain ⟨k,hk⟩ := actual_support_source C N (Equiv.refl _) e + obtain ⟨f,hf⟩ := hl.1 k + exact ⟨f,(qmaUnorderedPair_map V hk).trans hf⟩ + · intro f + obtain ⟨k,hk⟩ := hl.2 f + obtain ⟨e,he⟩ := actual_support_target C N (Equiv.refl _) k + exact ⟨e,(qmaUnorderedPair_map V he).trans hk⟩ + +theorem positions_actual : + QuantumCrossingPositionProgram.positions + (List.ofFn (fun i => (P.crossingCell (cell i)).val), + List.ofFn (fun v => P.finishedPosition N D (E.vertex v))) = + List.ofFn (fun v => P.crossingPosition N D (vertex P N hD s hs E cell v)) := by + let C := layer P N hD s hs E cell + have hp := QuantumCrossingPositionProgram.positions_reordered P N D E.vertex cell + apply hp.trans + exact List.ofFn_congr (count_actual C N (Equiv.refl _)).symm + (fun v => P.crossingPosition N D (C.vertexRelabel (P.portCrossingSelection N hD).layer E.vertex cell v)) + +theorem packet_geometry : QMAPacketGeometry (P.crossingOutput N hD) + (P.crossingPosition N D) (QuantumCrossingListLayer.value (input P N hD s hs E cell)) + (QuantumCrossingPositionProgram.positions + (List.ofFn (fun i => (P.crossingCell (cell i)).val), + List.ofFn (fun v => P.finishedPosition N D (E.vertex v)))) := by + rw [input_actual] + let C := layer P N hD s hs E cell + refine ⟨bonds_bounded _ (QuantumListGraph.packed_bounded C.base (Equiv.refl _)) + (sites_bounded C N (Equiv.refl _)), + bonds_noLoops _ (QuantumListGraph.packed_noLoops C.base (Equiv.refl _)) + (sites_bounded C N (Equiv.refl _)) (sites_injective C N (Equiv.refl _)),?_⟩ + exact ⟨vertex P N hD s hs E cell,positions_actual P N hD s hs E cell, + output_support P N hD s hs E cell⟩ + +end ContinuumCoulomb.QuantumScheduleCrossingGeometry + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSelectedRoute.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSelectedRoute.lean new file mode 100644 index 0000000000000000000000000000000000000000..798e9cedc4eca760b4ccb32ef249568a7f14afe5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSelectedRoute.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRouteSelectorCorrectness + +namespace OAI + +/-! The literal route selector returns a permitted catalog path for any +oriented pair of endpoints for which such a path exists. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical +open QuantumRouteSelectorProgram QuantumTaggedRouteProgram QuantumFiniteRouteSearch + +namespace QMAPortRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + +def HasAllowedRoute (x y : ℕ × ℕ) : Prop := + ∃ R : QMACellRoute, P.RoutingAllowed R.body ∧ R.Valid ∧ R.source = x ∧ R.target = y + +def findAllowedRoute (x y : ℕ × ℕ) : Option QMACellRoute := + (qmaRouteCandidates x y).find? (fun R => + decide (P.RoutingAllowed R.body ∧ R.Valid ∧ R.source = x ∧ R.target = y)) + +theorem findAllowedRoute_isSome {x y : ℕ × ℕ} (h : P.HasAllowedRoute x y) : + (P.findAllowedRoute x y).isSome := by + obtain ⟨R,ha,hv,hs,ht⟩ := h + apply List.find?_isSome.mpr + refine ⟨R,?_,decide_eq_true ⟨ha,hv,hs,ht⟩⟩ + simpa only [hs,ht] using qmaRouteCandidates_complete R + +def selectedAllowedRoute (x y : ℕ × ℕ) (h : P.HasAllowedRoute x y) : QMACellRoute := + (P.findAllowedRoute x y).get (P.findAllowedRoute_isSome h) + +theorem selectedAllowedRoute_spec (x y : ℕ × ℕ) (h : P.HasAllowedRoute x y) : + P.RoutingAllowed (P.selectedAllowedRoute x y h).body ∧ + (P.selectedAllowedRoute x y h).Valid ∧ + (P.selectedAllowedRoute x y h).source = x ∧ + (P.selectedAllowedRoute x y h).target = y := by + have he : P.findAllowedRoute x y = some (P.selectedAllowedRoute x y h) := + (Option.some_get (P.findAllowedRoute_isSome h)).symm + unfold findAllowedRoute at he + have hp := List.find?_some he + exact of_decide_eq_true hp + +theorem selectedAllowedRoute_path (x y : ℕ × ℕ) (h : P.HasAllowedRoute x y) : + QuantumRouteSelectorProgram.value (P.routingTable,(x,y)) = + (P.selectedAllowedRoute x y h).path := by + have hf : (qmaRouteCandidates x y).find? + (fun R => accepts (x,y) (tagged P.routingTable R)) = + some (P.selectedAllowedRoute x y h) := by + simp only [P.routing_accepts] + exact (Option.some_get (P.findAllowedRoute_isSome h)).symm + have hs := selectParallelValue_eq (false,[]) (qmaRouteCandidates x y) + (fun R => accepts (x,y) (tagged P.routingTable R)) (tagged P.routingTable) + (qmaRouteCandidates_length x y) hf + simpa only [value,choose,candidates,List.map_map,Function.comp_def,tagged] + using congrArg (fun v : Tagged => v.2) hs + +theorem hasAllowedRoute_reverse {x y : ℕ × ℕ} (h : P.HasAllowedRoute x y) : + P.HasAllowedRoute y x := by + obtain ⟨R,ha,hv,hs,ht⟩ := h + exact ⟨R.reverse,ha,hv,R.reverse_source.trans ht,R.reverse_target.trans hs⟩ + +end QMAPortRouteData +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSingletStar.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSingletStar.lean new file mode 100644 index 0000000000000000000000000000000000000000..991539589b3cc99b1712a5f422a074fc710b882f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSingletStar.lean @@ -0,0 +1,88 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.ManyBody.MediatorEffective + +namespace OAI + +/-! Weighted multi-terminal singlet stars for the lattice routing gadgets. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +def qmaPauliKernel (n : ℕ) (i j : Fin n) : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ := + ∑ μ : Fin 3, sourceLocalPauli n i μ*sourceLocalPauli n j μ + +theorem qmaPauliKernel_self (n : ℕ) (i : Fin n) : qmaPauliKernel n i i = (3:ℂ) • 1 := by + simp only [qmaPauliKernel,sourceLocalPauli_sq] + simp only [Fin.sum_univ_succ,Fin.sum_univ_zero,add_zero] + module + +theorem qmaPauliKernel_eq (n : ℕ) (i j : Fin n) (hij : i ≠ j) : + qmaPauliKernel n i j = sourceHeisenbergMatrix n i j := sourceLocalPauli_sum n i j hij + +theorem qmaHeisenberg_symm (n : ℕ) (i j : Fin n) : + sourceHeisenbergMatrix n i j = sourceHeisenbergMatrix n j i := by + unfold sourceHeisenbergMatrix sourceSpinSwap + rw [Equiv.swap_comm i j] + +variable {κ : Type*} [Fintype κ] + +def qmaSingletStar (n r : ℕ) (e : Fin r) (site : κ → Fin n) + (member : κ → Fin 2) (amplitude : κ → ℝ) : + Matrix (MediatedSpinBasis n r) (MediatedSpinBasis n r) ℂ := + ∑ a, (amplitude a:ℂ) • mediatorAxisSpoke n r e (site a) (member a) + +theorem qmaSingletStar_compression (n r : ℕ) (Delta : ℝ) (e : Fin r) + (site : κ → Fin n) (member : κ → Fin 2) (amplitude : κ → ℝ) : + mediatorCompression n r (qmaSingletStar n r e site member amplitude * + liftedMediatorInverse n r Delta * qmaSingletStar n r e site member amplitude) = + ∑ a, ∑ b, (((amplitude a:ℂ)*(amplitude b:ℂ))* + ((4*Delta)⁻¹:ℝ)*(if member a = member b then (1:ℂ) else -1)) • + qmaPauliKernel n (site a) (site b) := by + simp only [qmaSingletStar,Finset.sum_mul,Finset.mul_sum,smul_mul_assoc,mul_smul_comm, + map_sum,map_smul,mediatorAxisSpoke_compression,ite_true,qmaPauliKernel,smul_smul,Finset.smul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro a _ + apply Finset.sum_congr rfl + intro b _ + congr 1 + by_cases hm : member a = member b + · simp only [hm,ite_true] + ring_nf + · simp only [hm,ite_false] + ring_nf + +/-- Separate singlet pairs have zero mixed second-order compression. -/ +theorem qmaSingletStar_cross_zero (n r : ℕ) (Delta : ℝ) (e f : Fin r) (hef : e ≠ f) + (site site' : κ → Fin n) (member member' : κ → Fin 2) (amplitude amplitude' : κ → ℝ) : + mediatorCompression n r (qmaSingletStar n r e site member amplitude * + liftedMediatorInverse n r Delta * qmaSingletStar n r f site' member' amplitude') = 0 := by + simp only [qmaSingletStar,Finset.sum_mul,Finset.mul_sum,smul_mul_assoc,mul_smul_comm, + map_sum,map_smul,mediatorAxisSpoke_compression,hef,ite_false,smul_zero,Finset.sum_const_zero] + +/-- All routing stars are applied simultaneously, one per distinct singlet pair. -/ +def qmaRoutingStars (n r : ℕ) (site : Fin r → κ → Fin n) + (member : Fin r → κ → Fin 2) (amplitude : Fin r → κ → ℝ) : + Matrix (MediatedSpinBasis n r) (MediatedSpinBasis n r) ℂ := + ∑ e, qmaSingletStar n r e (site e) (member e) (amplitude e) + +theorem qmaRoutingStars_compression (n r : ℕ) (Delta : ℝ) + (site : Fin r → κ → Fin n) (member : Fin r → κ → Fin 2) (amplitude : Fin r → κ → ℝ) : + mediatorCompression n r (qmaRoutingStars n r site member amplitude * + liftedMediatorInverse n r Delta * qmaRoutingStars n r site member amplitude) = + ∑ e, mediatorCompression n r (qmaSingletStar n r e (site e) (member e) (amplitude e) * + liftedMediatorInverse n r Delta * qmaSingletStar n r e (site e) (member e) (amplitude e)) := by + simp only [qmaRoutingStars,Finset.sum_mul,Finset.mul_sum,map_sum] + apply Finset.sum_congr rfl + intro e _ + apply Finset.sum_eq_single e + · intro f _ hfe + exact qmaSingletStar_cross_zero n r Delta f e hfe _ _ _ _ _ _ + · simp + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSingletStarBounds.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSingletStarBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..08a62c683bb984a923f7377ae55506a712f64a70 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSingletStarBounds.lean @@ -0,0 +1,74 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSingletStar +import OAI.MathematicalPhysics.ContinuumCoulomb.ManyBody.SpinMatrixNorm + +namespace OAI + +/-! Full-space norm and low-sector facts for the routing singlet stars. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {κ : Type*} [Fintype κ] + +theorem mediatorAxisSpoke_star (n r : ℕ) (e : Fin r) (i : Fin n) (member : Fin 2) : + (mediatorAxisSpoke n r e i member).conjTranspose = mediatorAxisSpoke n r e i member := by + simp only [mediatorAxisSpoke,Matrix.conjTranspose_sum,elementaryMediatorSpoke_star] + +theorem mediatorAxisSpoke_norm (n r : ℕ) (e : Fin r) (i : Fin n) (member : Fin 2) : + ‖spinMatrixOperator (mediatorAxisSpoke n r e i member)‖ ≤ 3 := by + rw [mediatorAxisSpoke,spinMatrixOperator_sum] + apply (norm_sum_le _ _).trans + calc + _ ≤ ∑ _μ : Fin 3, (1:ℝ) := Finset.sum_le_sum (fun μ _ => + elementaryMediatorSpoke_operator_norm n r e member μ i) + _ = 3 := by norm_num + +theorem qmaSingletStar_star (n r : ℕ) (e : Fin r) (site : κ → Fin n) + (member : κ → Fin 2) (amplitude : κ → ℝ) : + (qmaSingletStar n r e site member amplitude).conjTranspose = + qmaSingletStar n r e site member amplitude := by + simp only [qmaSingletStar,Matrix.conjTranspose_sum,Matrix.conjTranspose_smul, + Complex.star_def,Complex.conj_ofReal,mediatorAxisSpoke_star] + +theorem qmaSingletStar_norm (n r : ℕ) (e : Fin r) (site : κ → Fin n) + (member : κ → Fin 2) (amplitude : κ → ℝ) : + ‖spinMatrixOperator (qmaSingletStar n r e site member amplitude)‖ ≤ + 3*∑ a, |amplitude a| := by + rw [qmaSingletStar,spinMatrixOperator_sum,Finset.mul_sum] + apply (norm_sum_le _ _).trans + apply Finset.sum_le_sum + intro a _ + rw [spinMatrixOperator_smul,norm_smul,Complex.norm_real,Real.norm_eq_abs,mul_comm] + exact mul_le_mul_of_nonneg_right (mediatorAxisSpoke_norm n r e _ _) (abs_nonneg _) + +theorem qmaSingletStar_low (n r : ℕ) (e : Fin r) (site : κ → Fin n) + (member : κ → Fin 2) (amplitude : κ → ℝ) : + mediatorCompression n r (qmaSingletStar n r e site member amplitude) = 0 := by + simp only [qmaSingletStar,mediatorAxisSpoke,map_sum,map_smul, + elementaryMediatorSpoke_low_compression,Finset.sum_const_zero,smul_zero] + +theorem qmaRoutingStars_star (n r : ℕ) (site : Fin r → κ → Fin n) + (member : Fin r → κ → Fin 2) (amplitude : Fin r → κ → ℝ) : + (qmaRoutingStars n r site member amplitude).conjTranspose = + qmaRoutingStars n r site member amplitude := by + simp only [qmaRoutingStars,Matrix.conjTranspose_sum,qmaSingletStar_star] + +theorem qmaRoutingStars_low (n r : ℕ) (site : Fin r → κ → Fin n) + (member : Fin r → κ → Fin 2) (amplitude : Fin r → κ → ℝ) : + mediatorCompression n r (qmaRoutingStars n r site member amplitude) = 0 := by + simp only [qmaRoutingStars,map_sum,qmaSingletStar_low,Finset.sum_const_zero] + +theorem qmaRoutingStars_norm (n r : ℕ) (site : Fin r → κ → Fin n) + (member : Fin r → κ → Fin 2) (amplitude : Fin r → κ → ℝ) : + ‖spinMatrixOperator (qmaRoutingStars n r site member amplitude)‖ ≤ + 3*∑ e, ∑ a, |amplitude e a| := by + rw [qmaRoutingStars,spinMatrixOperator_sum,Finset.mul_sum] + exact (norm_sum_le _ _).trans (Finset.sum_le_sum (fun e _ => + qmaSingletStar_norm n r e (site e) (member e) (amplitude e))) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSingletStarSpectrum.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSingletStarSpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..b2f68e01467dfe1d3c573252707ed308eab7b15a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSingletStarSpectrum.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSingletStarBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingSpectrum + +namespace OAI + +/-! Ground-energy estimate for the finite singlet stars used in routing. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical +variable {κ : Type*} [Fintype κ] + +theorem qmaSingletStar_bottom (n r : ℕ) {Delta : ℝ} (hDelta : 0 < Delta) + (C : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) (hC : C.conjTranspose = C) + (e : Fin r) (site : κ → Fin n) (member : κ → Fin 2) (amplitude : κ → ℝ) + {epsilon : ℝ} (hepsilon : 0 ≤ epsilon) (hsmall : epsilon ≤ 1 / 4) + (hbound : ‖spinMatrixOperator (C ⊗ₖ (1 : Matrix (MediatorBasis r) (MediatorBasis r) ℂ))‖ + + 3*∑ a, |amplitude a| ≤ epsilon * (4 * Delta)) : + |mediatorFullBottom n r (routingHamiltonian n r Delta C + (qmaSingletStar n r e site member amplitude)) - + sourceMatrixBottom n (C - mediatorCompression n r + (qmaSingletStar n r e site member amplitude * liftedMediatorInverse n r Delta * + qmaSingletStar n r e site member amplitude))| ≤ 16 * Delta * epsilon ^ 3 := by + have hb : ‖spinMatrixOperator (C ⊗ₖ (1 : Matrix (MediatorBasis r) (MediatorBasis r) ℂ))‖ + + ‖spinMatrixOperator (qmaSingletStar n r e site member amplitude)‖ ≤ epsilon * (4 * Delta) := + calc + _ ≤ ‖spinMatrixOperator (C ⊗ₖ (1 : Matrix (MediatorBasis r) (MediatorBasis r) ℂ))‖ + + 3*∑ a, |amplitude a| := add_le_add le_rfl (qmaSingletStar_norm n r e site member amplitude) + _ ≤ epsilon * (4 * Delta) := hbound + exact routing_bottom n r hDelta C hC (qmaSingletStar n r e site member amplitude) + (qmaSingletStar_star n r e site member amplitude) + (qmaSingletStar_low n r e site member amplitude) hepsilon hsmall hb + +theorem qmaRoutingStars_bottom (n r : ℕ) {Delta : ℝ} (hDelta : 0 < Delta) + (C : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) (hC : C.conjTranspose = C) + (site : Fin r → κ → Fin n) (member : Fin r → κ → Fin 2) (amplitude : Fin r → κ → ℝ) + {epsilon : ℝ} (hepsilon : 0 ≤ epsilon) (hsmall : epsilon ≤ 1/4) + (hbound : ‖spinMatrixOperator (C ⊗ₖ (1 : Matrix (MediatorBasis r) (MediatorBasis r) ℂ))‖ + + 3*∑ e, ∑ a, |amplitude e a| ≤ epsilon * (4*Delta)) : + |mediatorFullBottom n r (routingHamiltonian n r Delta C + (qmaRoutingStars n r site member amplitude)) - + sourceMatrixBottom n (C - mediatorCompression n r + (qmaRoutingStars n r site member amplitude * liftedMediatorInverse n r Delta * + qmaRoutingStars n r site member amplitude))| ≤ 16*Delta*epsilon^3 := by + have hb : ‖spinMatrixOperator (C ⊗ₖ (1 : Matrix (MediatorBasis r) (MediatorBasis r) ℂ))‖ + + ‖spinMatrixOperator (qmaRoutingStars n r site member amplitude)‖ ≤ epsilon * (4*Delta) := by + calc + _ ≤ ‖spinMatrixOperator (C ⊗ₖ (1 : Matrix (MediatorBasis r) (MediatorBasis r) ℂ))‖ + + 3*∑ e, ∑ a, |amplitude e a| := add_le_add le_rfl (qmaRoutingStars_norm n r site member amplitude) + _ ≤ epsilon * (4*Delta) := hbound + exact routing_bottom n r hDelta C hC (qmaRoutingStars n r site member amplitude) + (qmaRoutingStars_star n r site member amplitude) + (qmaRoutingStars_low n r site member amplitude) hepsilon hsmall hb + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSortedTime.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSortedTime.lean new file mode 100644 index 0000000000000000000000000000000000000000..4b27df7bf4de95b17b8b4008cb8ef8c27045c5ee --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSortedTime.lean @@ -0,0 +1,58 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTermTime + +namespace OAI + +/-! Coverage at every clock time bounds jumps in the ordered interaction list. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +variable {α : Type*} + +theorem qmaSortedTime_step {T : ℕ} (time : α → Fin T) (xs : List α) + (hs : xs.Pairwise (fun a b => time a ≤ time b)) + (hc : ∀ t : Fin T, ∃ a ∈ xs, time a = t) + (i j : Fin xs.length) (hj : j.val = i.val+1) : + (time xs[j.val]).val ≤ (time xs[i.val]).val+1 := by + by_contra hn + have hgap : (time xs[i.val]).val+1 < (time xs[j.val]).val := by omega + let t : Fin T := ⟨(time xs[i.val]).val+1,lt_trans hgap (time xs[j.val]).isLt⟩ + obtain ⟨a,ha,hat⟩ := hc t + obtain ⟨k,hk⟩ := List.mem_iff_get.mp ha + have hk' : xs[k.val] = a := hk + by_cases hki : k.val ≤ i.val + · have hle : time xs[k.val] ≤ time xs[i.val] := by + rcases lt_or_eq_of_le hki with hl | he + · exact hs.rel_getElem_of_lt k.isLt i.isLt hl + · simp only [he,le_refl] + rw [hk',hat] at hle + change (time xs[i.val]).val+1 ≤ (time xs[i.val]).val at hle + omega + · have hjk : j.val ≤ k.val := by omega + have hle : time xs[j.val] ≤ time xs[k.val] := by + rcases lt_or_eq_of_le hjk with hl | he + · exact hs.rel_getElem_of_lt j.isLt k.isLt hl + · simp only [he,le_refl] + rw [hk',hat] at hle + change (time xs[j.val]).val ≤ (time xs[i.val]).val+1 at hle + omega + +theorem qmaOrderedHistoryTerms_cover (c : QMACircuit) (hT : 0 < c.gates.length) + (τ : Fin (c.work+1) → Fin (c.gates.length+1)) (t : Fin c.gates.length) : + ∃ a ∈ qmaOrderedHistoryTerms c hT τ, qmaHistoryTermTime c hT τ a = t := by + refine ⟨.inr (.inr (.inr (.inr t))),qmaOrderedHistoryTerms_mem c hT τ _,rfl⟩ + +theorem qmaOrderedHistoryTerms_step (c : QMACircuit) (hT : 0 < c.gates.length) + (τ : Fin (c.work+1) → Fin (c.gates.length+1)) + (i j : Fin (qmaOrderedHistoryTerms c hT τ).length) (hj : j.val = i.val+1) : + (qmaHistoryTermTime c hT τ (qmaOrderedHistoryTerms c hT τ)[j.val]).val ≤ + (qmaHistoryTermTime c hT τ (qmaOrderedHistoryTerms c hT τ)[i.val]).val+1 := + qmaSortedTime_step _ _ (qmaOrderedHistoryTerms_sorted c hT τ) + (qmaOrderedHistoryTerms_cover c hT τ) i j hj + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSoundness.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSoundness.lean new file mode 100644 index 0000000000000000000000000000000000000000..beccdff404baf5f23c44939ef0365bbd1cdd62af --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSoundness.lean @@ -0,0 +1,38 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEndpoint + +namespace OAI + +/-! Homogeneous soundness for arbitrary, unnormalized witnesses. -/ + +noncomputable section +namespace ContinuumCoulomb + +theorem qmaRejectVector_sound_all (c : QMACircuit) (hc : c.WellFormed) + (hsound : ∀ psi : EuclideanSpace ℂ (SourceSpinBasis c.witness), + ‖psi‖ = 1 → qmaAcceptance c hc psi ≤ 1/3) + (psi : EuclideanSpace ℂ (SourceSpinBasis c.witness)) : + (2/3:ℝ)*‖psi‖^2 ≤ ‖qmaRejectVector c hc psi‖^2 := by + by_cases hz : psi = 0 + · subst psi + simp + have hn : ‖psi‖ ≠ 0 := norm_ne_zero_iff.mpr hz + let phi := ((‖psi‖⁻¹ : ℝ) : ℂ) • psi + have hphi : ‖phi‖ = 1 := by + simp [phi,norm_smul,hn] + have hscale : psi = (‖psi‖ : ℂ) • phi := by + change psi = (‖psi‖ : ℝ) • (‖psi‖⁻¹ • psi) + rw [smul_smul,mul_inv_cancel₀ hn,one_smul] + have hb := qmaRejectVector_of_sound c hc phi hphi (hsound phi hphi) + have he : ‖qmaRejectVector c hc psi‖^2 = + ‖psi‖^2*‖qmaRejectVector c hc phi‖^2 := by + conv_lhs => rw [hscale] + rw [qmaRejectVector_smul] + simp [norm_smul,mul_pow] + rw [he] + nlinarith [sq_nonneg ‖psi‖] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpacedListProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpacedListProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..2e605c6fdf46f80ce55a733eca141b6ffcbe4207 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpacedListProgram.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEndpointListProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumManhattanListProgram + +namespace OAI + +/-! Enumerate the bounded Manhattan portion of each actual buffered route. +The horizontal and vertical translations are literal binary arithmetic. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumSpacedListProgram +open ExactQuantumFactoring.BitStackProgram QuantumRouteCode + +def point (B color : ℕ) (p : Pair) : Pair := + qmaBufferedCellPoint (9*B+3) p (8*(color+3),8*(color+3)) + +abbrev PointInput := ℕ × Pair +def pointCode : PointInput → List Bool := prodCode unaryCode pairCode + +noncomputable def pointProgram (B : ℕ) : Procedure pointCode pairCode + (fun x => point B x.1 x.2) := by + let color := Procedure.unaryToBits.comp (Procedure.first unaryCode pairCode) + let port := Procedure.binaryMul.comp ((Procedure.constant pointCode Nat.bits 8).pair + (Procedure.binaryAdd.comp (color.pair (Procedure.constant pointCode Nat.bits 3)))) + exact (QuantumEndpointListProgram.translateProgram B).comp + ((Procedure.second unaryCode pairCode).pair (port.pair port)) + +abbrev Input := ℕ × (Pair × Pair) +def inputCode : Input → List Bool := prodCode unaryCode (prodCode pairCode pairCode) +def budget (A B : ℕ) : ℕ := 8*(9*B+9)*(3*A+2) +def value (A B : ℕ) (x : Input) : List Pair := + QuantumManhattanListProgram.value (budget A B) (point B x.1 x.2.1,point B x.1 x.2.2) + +noncomputable def program (A B : ℕ) : Procedure inputCode (listCode pairCode) (value A B) := by + let color := Procedure.first unaryCode (prodCode pairCode pairCode) + let ends := Procedure.second unaryCode (prodCode pairCode pairCode) + let left := (pointProgram B).comp (color.pair ((Procedure.first pairCode pairCode).comp ends)) + let right := (pointProgram B).comp (color.pair ((Procedure.second pairCode pairCode).comp ends)) + exact (QuantumManhattanListProgram.program (budget A B)).comp (left.pair right) + +theorem point_actual {A B : ℕ} (M : QMASpatialExchangeModel A B) (e : M.Term) (p : Pair) : + point B (M.laneColor e).val p = qmaLanePoint (M.spacedColor e) p := rfl + +theorem value_actual {A B : ℕ} (M : QMASpatialExchangeModel A B) (e : M.Term) : + value A B ((M.laneColor e).val,M.routeVertex (M.left e),M.routeVertex (M.right e)) = + M.spacedList e := by + unfold value + rw [point_actual,point_actual,QuantumManhattanListProgram.value_exact] + · rfl + · exact M.spaced_length e + +end ContinuumCoulomb.QuantumSpacedListProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSparseEndpoint.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSparseEndpoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..3adf3b24b09d61d4b5a1cece85e94b798d4b1c1d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSparseEndpoint.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSweepEndpoint +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridCoordinates + +namespace OAI + +/-! The last physical gate sits immediately above the output qubit. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +theorem qmaSparseTags_last (c : QMACircuit) + (hT : 0 < (qmaSparseCircuit c).gates.length) : + (qmaSparseTags c).getLast?.map Prod.snd = some + ((⟨(qmaNearestCircuit c).gates.length-1,by omega⟩ : + Fin ((qmaNearestCircuit c).gates.length+1)),Fin.last c.work) := by + have hn : (qmaNearestCircuit c).gates ≠ [] := by + intro he + have hl := qmaSweepCircuitFrom_length (qmaNearestCircuit c).gates.length c.work 0 + (qmaNearestCircuit c).gates (by omega) + change (qmaSparseCircuit c).gates.length = _ at hl + rw [hl,he] at hT + simp at hT + have hl := qmaTaggedSweepFrom_last_nonempty (qmaNearestCircuit c).gates.length c.work 0 + (qmaNearestCircuit c).gates (by omega) hn + simpa only [qmaSparseTags,Nat.zero_add,Nat.sub_zero,Nat.sub_self,qmaSweepOrder, + Nat.zero_mod,ite_true,Equiv.refl_apply] using hl + +theorem qmaSparseGateCell_last (c : QMACircuit) + (hT : 0 < (qmaSparseCircuit c).gates.length) : + qmaSparseGateCell c ⟨(qmaSparseCircuit c).gates.length-1,by omega⟩ = + ((⟨(qmaNearestCircuit c).gates.length-1,by omega⟩ : + Fin ((qmaNearestCircuit c).gates.length+1)),Fin.last c.work) := by + have hl := qmaSparseTags_last c hT + have hlen := qmaSparseTags_length c + have hb : (qmaSparseTags c).length-1 < (qmaSparseTags c).length := by omega + rw [List.getLast?_eq_getElem?,List.getElem?_eq_getElem hb] at hl + simp only [Option.map_some,Option.some.injEq] at hl + unfold qmaSparseGateCell qmaSparseCell + simpa only [Fin.val_cast,hlen] using hl + +theorem qmaGridQubit_last (rows width : ℕ) : + qmaGridQubit rows width (Fin.last rows) (Fin.last width) = + Fin.last (qmaGridWork rows width) := by + apply Fin.ext + simp only [qmaGridQubit,Fin.val_last,qmaGridWork] + omega + +theorem qmaSparseWorkCell_last (c : QMACircuit) : + qmaSparseWorkCell c (Fin.last (qmaSparseCircuit c).work) = + (Fin.last (qmaNearestCircuit c).gates.length,Fin.last c.work) := by + change qmaGridCoordinates (qmaNearestCircuit c).gates.length c.work + (Fin.last (qmaGridWork (qmaNearestCircuit c).gates.length c.work)) = _ + rw [←qmaGridQubit_last,qmaGridCoordinates_left] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSparseFirstUse.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSparseFirstUse.lean new file mode 100644 index 0000000000000000000000000000000000000000..f46085082a54e731d5233fd542fcc3d7dd8a51e8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSparseFirstUse.lean @@ -0,0 +1,85 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFirstUseSites + +namespace OAI + +/-! First-use input checks inherit the actual sweep geometry and constant congestion. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators Classical + +theorem qmaSparseTags_length (c : QMACircuit) : + (qmaSparseTags c).length = (qmaSparseCircuit c).gates.length := by + have h := congrArg List.length (qmaSparseTags_gates c) + simpa only [List.length_map] using h + +def qmaSparseTime (c : QMACircuit) (t : Fin (qmaSparseTags c).length) : + Fin (qmaSparseCircuit c).gates.length := t.cast (qmaSparseTags_length c) + +def qmaSparseCell (c : QMACircuit) (t : Fin (qmaSparseTags c).length) : + QMAGridCell (qmaNearestCircuit c).gates.length c.work := (qmaSparseTags c)[t.val].2 + +theorem qmaSparseTag_gate (c : QMACircuit) (t : Fin (qmaSparseTags c).length) : + (qmaSparseTags c)[t.val].1 = (qmaSparseCircuit c).gates[(qmaSparseTime c t).val] := by + have ht : t.val < (qmaSparseCircuit c).gates.length := by + rw [←qmaSparseTags_length] + exact t.isLt + have hm : ((qmaSparseTags c)[t.val]?).map Prod.fst = (qmaSparseCircuit c).gates[t.val]? := by + rw [←List.getElem?_map,qmaSparseTags_gates] + simpa only [List.getElem?_eq_getElem t.isLt,List.getElem?_eq_getElem ht, + Option.map_some,Option.some.injEq,qmaSparseTime,Fin.val_cast] using hm + +def qmaSparseCellTimes (c : QMACircuit) + (p : QMAGridCell (qmaNearestCircuit c).gates.length c.work) : Finset (Fin (qmaSparseTags c).length) := + Finset.univ.filter (fun t => qmaSparseCell c t = p) + +theorem qmaSparseCellTimes_card (c : QMACircuit) + (p : QMAGridCell (qmaNearestCircuit c).gates.length c.work) : + (qmaSparseCellTimes c p).card ≤ 4 := by + have he := qmaList_filter_index_card (qmaSparseTags c) (fun q => decide (q.2 = p)) + change (Finset.univ.filter (fun t : Fin (qmaSparseTags c).length => + (qmaSparseTags c)[t.val].2 = p)).card ≤ 4 + simpa only [decide_eq_true_eq] using he.trans_le (qmaSparseTags_count c p) + +def qmaSparseInitialCellSites (c : QMACircuit) + (p : QMAGridCell (qmaNearestCircuit c).gates.length c.work) : Finset (Fin ((qmaSparseCircuit c).work+1)) := + (qmaSparseCellTimes c p).biUnion (fun t => qmaFirstUseSites (qmaSparseCircuit c) (qmaSparseTime c t)) + +theorem qmaSparseInitialCellSites_card (c : QMACircuit) + (p : QMAGridCell (qmaNearestCircuit c).gates.length c.work) : + (qmaSparseInitialCellSites c p).card ≤ 8 := by + calc + _ ≤ ∑ t ∈ qmaSparseCellTimes c p, + (qmaFirstUseSites (qmaSparseCircuit c) (qmaSparseTime c t)).card := Finset.card_biUnion_le + _ ≤ ∑ _t ∈ qmaSparseCellTimes c p, 2 := + Finset.sum_le_sum (fun t _ => qmaFirstUseSites_card _ _) + _ = (qmaSparseCellTimes c p).card*2 := by simp + _ ≤ 8 := by have := qmaSparseCellTimes_card c p; omega + +theorem qmaSparseFirstUse_located (c : QMACircuit) (hc : c.WellFormed) + (t : Fin (qmaSparseTags c).length) (i : Fin ((qmaSparseCircuit c).work+1)) + (hi : i ∈ qmaFirstUseSites (qmaSparseCircuit c) (qmaSparseTime c t)) : + ∃ r : Fin ((qmaNearestCircuit c).gates.length+1), ∃ j : Fin (c.work+1), + i = qmaGridQubit (qmaNearestCircuit c).gates.length c.work r j ∧ + (qmaSparseCell c t).1.val ≤ r.val ∧ r.val ≤ (qmaSparseCell c t).1.val+1 ∧ + j.val ≤ (qmaSparseCell c t).2.val+1 ∧ (qmaSparseCell c t).2.val ≤ j.val+1 := by + have hs := qmaFirstUseSites_subset (qmaSparseCircuit c) (qmaSparseTime c t) hi + rw [←qmaSparseTag_gate] at hs + exact qmaSparseTags_located c hc _ (List.getElem_mem t.isLt) i hs + +theorem qmaSparseInitialCellSites_cover (c : QMACircuit) + (hne : (qmaNearestCircuit c).gates ≠ []) (i : Fin ((qmaSparseCircuit c).work+1)) : + ∃ p, i ∈ qmaSparseInitialCellSites c p := by + have ht := qmaSweepFirstUse_lt (qmaNearestCircuit c) hne i + let t : Fin (qmaSparseTags c).length := + ⟨qmaFirstUse (qmaSparseCircuit c) i,by rw [qmaSparseTags_length]; exact ht⟩ + refine ⟨qmaSparseCell c t,Finset.mem_biUnion.mpr ⟨t,?_,?_⟩⟩ + · simp [qmaSparseCellTimes] + · simp only [qmaFirstUseSites,Finset.mem_filter,Finset.mem_univ,true_and] + rfl + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialCircuit.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialCircuit.lean new file mode 100644 index 0000000000000000000000000000000000000000..7c24be5030eba760e96af82f2a8a6eb34dac4595 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialCircuit.lean @@ -0,0 +1,51 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialGadgets + +namespace OAI + +/-! A single spatial two-local Hamiltonian carries both verifier promise cases. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +theorem qmaCircuit_spatial_two_local (c : QMACircuit) (hc : c.WellFormed) + (hT : 0 < (qmaSparseCircuit c).gates.length) + (hne : (qmaNearestCircuit c).gates ≠ []) {N : ℝ} (hN : 1 ≤ N) : + ∃ G : QMASpatialModel 2 (45+1077940224*64) (7516192768*64), + G.rows = (qmaNearestCircuit c).gates.length ∧ G.width = c.work ∧ + (∀ psi : EuclideanSpace ℂ (SourceSpinBasis c.witness), ‖psi‖ = 1 → + 2/3 ≤ qmaAcceptance c hc psi → + G.toQMARealLocalModel.energy ≤ 1/(3*((qmaSparseCircuit c).gates.length+1:ℝ))+1/N) ∧ + ((∀ psi : EuclideanSpace ℂ (SourceSpinBasis c.witness), ‖psi‖ = 1 → + qmaAcceptance c hc psi ≤ 1/3) → + 2/(5*((qmaSparseCircuit c).gates.length+1:ℝ))-1/N ≤ G.toQMARealLocalModel.energy) := by + let M := qmaSpatialHistoryModel c hc hT hne + obtain ⟨G,hG,hr,hw⟩ := M.six_to_two hN + refine ⟨G,hr,hw,?_,?_⟩ + · intro psi hpsi hacc + have ha : 2/3 ≤ qmaAcceptance (qmaSparseCircuit c) (qmaSparseCircuit_wellFormed c hc) psi := by + rwa [qmaSparseCircuit_acceptance] + have hm := qmaOrderedHistoryModel_yes (qmaSparseCircuit c) hT + (qmaSparseCircuit_wellFormed c hc) psi hpsi ha + change (qmaOrderedHistoryModel (qmaSparseCircuit c) hT).energy ≤ _ at hm + change |G.toQMARealLocalModel.energy-(qmaOrderedHistoryModel (qmaSparseCircuit c) hT).energy| ≤ 1/N at hG + have he := (abs_le.mp hG).2 + linarith + · intro hsound + have ha : ∀ psi : EuclideanSpace ℂ (SourceSpinBasis (qmaSparseCircuit c).witness), ‖psi‖ = 1 → + qmaAcceptance (qmaSparseCircuit c) (qmaSparseCircuit_wellFormed c hc) psi ≤ 1/3 := by + intro psi hpsi + rw [qmaSparseCircuit_acceptance] + exact hsound psi hpsi + have hm := qmaOrderedHistoryModel_no (qmaSparseCircuit c) hT + (qmaSparseCircuit_wellFormed c hc) ha + change _ ≤ (qmaOrderedHistoryModel (qmaSparseCircuit c) hT).energy at hm + change |G.toQMARealLocalModel.energy-(qmaOrderedHistoryModel (qmaSparseCircuit c) hT).energy| ≤ 1/N at hG + have he := (abs_le.mp hG).1 + linarith + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialClockTerms.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialClockTerms.lean new file mode 100644 index 0000000000000000000000000000000000000000..bda6fa1bdfd281e37ac3962c59161285eb6321a8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialClockTerms.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedReference + +namespace OAI + +/-! Clock faults and endpoint pins are close to their assigned history time. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +theorem qmaBoundedClockTime_pair (T : ℕ) (hT : 0 < T) (i : Fin (T+1)) : + (qmaBoundedClockTime T hT i.val).val ≤ i.val ∧ + i.val+1 ≤ (qmaBoundedClockTime T hT i.val).val+2 := by + dsimp only [qmaBoundedClockTime] + omega + +theorem qmaSparseClockFault_cell (c : QMACircuit) + (hT : 0 < (qmaSparseCircuit c).gates.length) + (i : Fin ((qmaSparseCircuit c).gates.length+1)) + (k : QMACircuitQubit (qmaSparseCircuit c)) + (hk : k ∈ qmaCircuitTermSites (qmaSparseCircuit c) (.inl i)) : + QMAGridCellsNear (qmaSparseQubitCell c hT k) + (qmaSparseGateCell c (qmaBoundedClockTime _ hT i.val)) := by + have hb := qmaBoundedClockTime_pair _ hT i + have hk' : k = .inl i.castSucc ∨ k = .inl i.succ := by + simpa [qmaCircuitTermSites] using hk + rcases hk' with rfl | rfl + · apply qmaSparseClockCells_near_gate c hT + change (qmaBoundedClockTime _ hT i.val).val ≤ i.val ∧ + i.val ≤ (qmaBoundedClockTime _ hT i.val).val+2 + omega + · apply qmaSparseClockCells_near_gate c hT + change (qmaBoundedClockTime _ hT i.val).val ≤ i.val+1 ∧ + i.val+1 ≤ (qmaBoundedClockTime _ hT i.val).val+2 + omega + +theorem qmaSparseClockPin_cell (c : QMACircuit) + (hT : 0 < (qmaSparseCircuit c).gates.length) (b : Fin 2) + (k : QMACircuitQubit (qmaSparseCircuit c)) + (hk : k ∈ qmaCircuitTermSites (qmaSparseCircuit c) (.inr (.inl b))) : + QMAGridCellsNear (qmaSparseQubitCell c hT k) + (qmaSparseGateCell c (qmaHistoryTermTime (qmaSparseCircuit c) hT + (qmaFirstUseTime (qmaSparseCircuit c)) (.inr (.inl b)))) := by + fin_cases b + · have hk' : k = .inl 0 := by simpa [qmaCircuitTermSites] using hk + subst k + apply qmaSparseClockCells_near_gate + exact ⟨by simp [qmaHistoryTermTime],by simp [qmaHistoryTermTime]⟩ + · have hk' : k = .inl (Fin.last ((qmaSparseCircuit c).gates.length+1)) := by + simpa [qmaCircuitTermSites] using hk + subst k + apply qmaSparseClockCells_near_gate + dsimp [qmaHistoryTermTime,qmaBoundedClockTime] + omega + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialCrossingGeometry.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialCrossingGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..46cc0b98e66acd2fbd96c4f4d837381bc3cbc73b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialCrossingGeometry.lean @@ -0,0 +1,133 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialPortMatching +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialCrossingProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialRoutingTape +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingSiteRelabel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingPositionRelabel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingPacketEnergy +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutePermissionCongr + +namespace OAI + +/-! The computed crossing cells and terminal scans use exactly the physical +port geometry, with finite permutations accounting for their output order. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumSpatialCrossingProgram +open QuantumForkList QuantumRouteCode +open scoped Classical + +variable {rows width A D : ℕ} (I : SpatialInput rows width A D) + (hA : 0 < spatialDensity A D) (N : ℚ) + +private def edgeList := List.ofFn (fun e : I.model.Term => e) + +private theorem edgeList_complete (e : I.model.Term) : e ∈ edgeList I := + List.mem_ofFn.mpr ⟨e,rfl⟩ + +private theorem ofFn_map_id {n : ℕ} {α : Type*} (f : Fin n → α) : + List.ofFn f = (List.ofFn (fun e : Fin n => e)).map f := by + rw [List.map_ofFn] + rfl + +theorem coarse_actual : coarse A D (N,QuantumSpatialInputTape.input I) = + (List.ofFn (I.model.portRouteData hA I.model_degree).position, + (edgeList I).map (I.model.portRouteData hA I.model_degree).routeList) := by + have h := QuantumSpatialRoutingTape.value_actual I hA + change QuantumSpatialRoutingTape.value A D (QuantumSpatialInputTape.input I) = _ + rw [h] + refine Prod.ext ?_ ?_ + · rfl + exact ofFn_map_id (fun e : Fin (fullList I.state).length => + (I.model.portRouteData hA I.model_degree).routeList e) + +theorem cells_order : + ∃ τ : Fin (cells A D (N,QuantumSpatialInputTape.input I)).length ≃ + Fin (I.model.portRouteData hA I.model_degree).crossingCells.card, + cells A D (N,QuantumSpatialInputTape.input I) = + List.ofFn (fun i => ((I.model.portRouteData hA I.model_degree).crossingCell (τ i)).val) := by + unfold cells + rw [coarse_actual I hA N] + let P := I.model.portRouteData hA I.model_degree + refine ⟨(QuantumDistinctCrossings.cellsEquiv P (edgeList I) (edgeList_complete I)).trans + P.crossingCells.equivFin,?_⟩ + apply (QuantumDistinctCrossings.list_eq P (edgeList I) (edgeList_complete I)).trans + apply congrArg List.ofFn + funext i + change ((QuantumDistinctCrossings.cellsEquiv P (edgeList I) (edgeList_complete I)) i).val = + (P.crossingCells.equivFin.symm (P.crossingCells.equivFin + ((QuantumDistinctCrossings.cellsEquiv P (edgeList I) (edgeList_complete I)) i))).val + rw [Equiv.symm_apply_apply] + +theorem old_positions_order : + ∃ σ : Fin (oldPacket A D (N,QuantumSpatialInputTape.input I)).1 ≃ + Fin ((I.model.portRouteData hA I.model_degree).finishedGraph N + (QuantumSpatialPortProgram.rounds A D)).n, + oldPositions A D (N,QuantumSpatialInputTape.input I) = + List.ofFn (fun v => (I.model.portRouteData hA I.model_degree).finishedPosition N + (QuantumSpatialPortProgram.rounds A D) (σ v)) := by + obtain ⟨hk,Pk,Ek,hrep,hpos,_⟩ := QuantumSpatialPortProgram.value_matches I hA N + refine ⟨Ek.vertex,hrep.1.trans ?_⟩ + apply congrArg List.ofFn + funext v + exact (hpos v).symm + +theorem table_permission (R : QMACellRouteBody) : + QuantumRoutingTable.allowed (table A D (N,QuantumSpatialInputTape.input I)) R = + QuantumRoutingTable.allowed (I.model.portRouteData hA I.model_degree).routingTable R := by + unfold table + rw [coarse_actual I hA N] + exact QuantumPathTable.compile_allowed _ _ (edgeList_complete I) R + +theorem length_bound (e : I.model.Term) : + (I.model.portRouteData hA I.model_degree).length e ≤ + QuantumSpatialPortProgram.rounds A D := by + rw [← QuantumSpatialPortProgram.rounds_eq] + exact I.model.bufferedPath_length I.model_degree e + +theorem sites_positions_order : + ∃ (σ : Fin (oldPacket A D (N,QuantumSpatialInputTape.input I)).1 ≃ + Fin ((I.model.portRouteData hA I.model_degree).finishedGraph N + (QuantumSpatialPortProgram.rounds A D)).n) + (τ : Fin (cells A D (N,QuantumSpatialInputTape.input I)).length ≃ + Fin (I.model.portRouteData hA I.model_degree).crossingCells.card), + sites A D (N,QuantumSpatialInputTape.input I) = + List.ofFn (QuantumCrossingSelectProgram.encodedSites + (fun i a => σ.symm ((I.model.portRouteData hA I.model_degree).crossingSiteFin N + (length_bound I hA) (τ i) a))) ∧ + positions A D (N,QuantumSpatialInputTape.input I) = + List.ofFn (fun v => (I.model.portRouteData hA I.model_degree).crossingPosition N + (QuantumSpatialPortProgram.rounds A D) + (QuantumCrossingPositionProgram.extend _ _ _ σ τ v)) := by + obtain ⟨σ,hσ⟩ := old_positions_order I hA N + obtain ⟨τ,hτ⟩ := cells_order I hA N + refine ⟨σ,τ,?_,?_⟩ + · unfold sites + apply (congrArg QuantumCrossingSiteProgram.allSites + (congrArg₂ Prod.mk hσ hτ)).trans + exact QuantumCrossingSiteProgram.allSites_reordered _ N (length_bound I hA) σ + (fun v => (I.model.portRouteData hA I.model_degree).finishedPosition N + (QuantumSpatialPortProgram.rounds A D) (σ v)) (fun _ => rfl) τ + · unfold positions + apply (congrArg QuantumCrossingPositionProgram.positions + (congrArg₂ Prod.mk hτ hσ)).trans + exact QuantumCrossingPositionProgram.positions_reordered _ _ _ σ τ + +include hA in +theorem energy_error {N : ℚ} (hN : 0 < N) : + |QuantumCrossingPacketEnergy.energy (value A D (N,QuantumSpatialInputTape.input I)).1.1 - + QuantumCrossingPacketEnergy.energy (oldPacket A D (N,QuantumSpatialInputTape.input I))| ≤ + 1/(N:ℝ) := by + obtain ⟨hk,Pk,Ek,hrep,hpos,hpoint⟩ := QuantumSpatialPortProgram.value_matches I hA N + obtain ⟨σ,τ,hsite,_⟩ := sites_positions_order I hA N + change |QuantumCrossingPacketEnergy.energy (QuantumCrossingListLayer.value + (QuantumCrossingSelectProgram.value (N,oldPacket A D (N,QuantumSpatialInputTape.input I), + sites A D (N,QuantumSpatialInputTape.input I)))) - _| ≤ _ + rw [hsite] + exact QuantumCrossingPacketEnergy.list_error _ _ _ hk.1 hk.2 _ + (QuantumCrossingSiteProgram.reordered_sites_global _ N (length_bound I hA) σ τ) hN + +end ContinuumCoulomb.QuantumSpatialCrossingProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialCrossingProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialCrossingProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..ccf684b577a28e4003367136dbfc01875acd4f0c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialCrossingProgram.lean @@ -0,0 +1,94 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialPortProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumDistinctCrossings +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingFamily +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingCompiled +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingSiteProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingPositionProgram + +namespace OAI + +/-! A literal composition from the prepared spatial input to the crossing +Hamiltonian, its physical positions, and the finite routing permission table. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumSpatialCrossingProgram +open ExactQuantumFactoring.BitStackProgram QuantumRouteCode +open QuantumForkList (spatialDensity) + +abbrev Input := QuantumSpatialPortProgram.Input +def inputCode : Input → List Bool := QuantumSpatialPortProgram.inputCode +abbrev Output := (QuantumListPathStep.Output × List Pair) × QuantumRoutingTable.Table +def outputCode : Output → List Bool := + prodCode (prodCode QuantumListPathStep.outputCode (listCode pairCode)) + QuantumRoutingTable.tableCode + +def coarse (A D : ℕ) (x : Input) : QuantumPathTable.Input := + QuantumRoutingFamily.table (spatialDensity A D) (27*spatialDensity A D) + (QuantumForkRoutingData.value (QuantumForkGridProgram.output D x.2)) +def cells (A D : ℕ) (x : Input) : List Pair := QuantumDistinctCrossings.value (coarse A D x) +def table (A D : ℕ) (x : Input) : QuantumRoutingTable.Table := QuantumPathTable.compile (coarse A D x) +def oldPositions (A D : ℕ) (x : Input) : List Pair := (QuantumSpatialPortProgram.value A D x).2.1 +def oldPacket (A D : ℕ) (x : Input) : QuantumListPathStep.Output := + let s := (QuantumSpatialPortProgram.value A D x).1 + (s.1,QuantumListSchedule.erase s.2.2,s.2.1) +def sites (A D : ℕ) (x : Input) : List QuantumCrossingListBlock.Sites := + QuantumCrossingSiteProgram.allSites (oldPositions A D x,cells A D x) +def crossingInput (A D : ℕ) (x : Input) : QuantumCrossingListLayer.Input := + QuantumCrossingSelectProgram.value (x.1,oldPacket A D x,sites A D x) +def positions (A D : ℕ) (x : Input) : List Pair := + QuantumCrossingPositionProgram.positions (cells A D x,oldPositions A D x) +def value (A D : ℕ) (x : Input) : Output := + ((QuantumCrossingListLayer.value (crossingInput A D x),positions A D x),table A D x) + +noncomputable opaque coarseProgram (A D : ℕ) : + Procedure inputCode QuantumPathTable.inputCode (coarse A D) := + (QuantumRoutingFamily.tableProgram (spatialDensity A D) (27*spatialDensity A D)).comp + (QuantumForkRoutingData.program.comp ((QuantumForkGridProgram.outputProgram D).comp + (Procedure.second ratCode QuantumForkGridProgram.preparedCode))) +noncomputable opaque cellsProgram (A D : ℕ) : + Procedure inputCode (listCode pairCode) (cells A D) := + QuantumDistinctCrossings.program.comp (coarseProgram A D) +noncomputable opaque tableProgram (A D : ℕ) : + Procedure inputCode QuantumRoutingTable.tableCode (table A D) := + QuantumPathTable.compileProgram.comp (coarseProgram A D) +noncomputable opaque oldPositionsProgram (A D : ℕ) : + Procedure inputCode (listCode pairCode) (oldPositions A D) := + ((Procedure.first (listCode pairCode) (listCode (listCode pairCode))).comp + (Procedure.second QuantumListSchedule.stateCode + (prodCode (listCode pairCode) (listCode (listCode pairCode))))).comp + (QuantumSpatialPortProgram.program A D) +noncomputable opaque oldPacketProgram (A D : ℕ) : + Procedure inputCode QuantumListPathStep.outputCode (oldPacket A D) := by + let s := (Procedure.first QuantumListSchedule.stateCode + (prodCode (listCode pairCode) (listCode (listCode pairCode)))).comp + (QuantumSpatialPortProgram.program A D) + let n := (Procedure.first unaryCode + (prodCode ratCode (listCode QuantumListSchedule.entryCode))).comp s + let rest := (Procedure.second unaryCode + (prodCode ratCode (listCode QuantumListSchedule.entryCode))).comp s + let c := (Procedure.first ratCode (listCode QuantumListSchedule.entryCode)).comp rest + let bs := QuantumListSchedule.eraseProgram.comp + ((Procedure.second ratCode (listCode QuantumListSchedule.entryCode)).comp rest) + exact n.pair (bs.pair c) +noncomputable opaque sitesProgram (A D : ℕ) : + Procedure inputCode (listCode QuantumCrossingListBlock.sitesCode) (sites A D) := + QuantumCrossingSiteProgram.allSitesProgram.comp + ((oldPositionsProgram A D).pair (cellsProgram A D)) +noncomputable opaque crossingInputProgram (A D : ℕ) : + Procedure inputCode QuantumCrossingListLayer.inputCode (crossingInput A D) := + QuantumCrossingSelectProgram.program.comp + ((Procedure.first ratCode QuantumForkGridProgram.preparedCode).pair + ((oldPacketProgram A D).pair (sitesProgram A D))) +noncomputable opaque positionsProgram (A D : ℕ) : + Procedure inputCode (listCode pairCode) (positions A D) := + QuantumCrossingPositionProgram.positionsProgram.comp + ((cellsProgram A D).pair (oldPositionsProgram A D)) +noncomputable opaque program (A D : ℕ) : Procedure inputCode outputCode (value A D) := + ((QuantumCrossingListLayer.program.comp (crossingInputProgram A D)).pair + (positionsProgram A D)).pair (tableProgram A D) + +end ContinuumCoulomb.QuantumSpatialCrossingProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialCrossingSupport.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialCrossingSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..b5318a7eddd6a55fb1101cff823ccf3649d4601c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialCrossingSupport.lean @@ -0,0 +1,63 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialCrossingGeometry +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumScheduleCrossingGeometry + +namespace OAI + +/-! The actual spatial compiler emits a crossing packet with the canonical +physical support and positions, rather than merely an abstract simulation. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumSpatialCrossingProgram +open QuantumForkList + +variable {rows width A D : ℕ} (I : SpatialInput rows width A D) + (hA : 0 < spatialDensity A D) (N : ℚ) + +theorem packet_geometry : + QMAPacketGeometry + ((I.model.portRouteData hA I.model_degree).crossingOutput N (length_bound I hA)) + ((I.model.portRouteData hA I.model_degree).crossingPosition N + (QuantumSpatialPortProgram.rounds A D)) + (value A D (N,QuantumSpatialInputTape.input I)).1.1 + (value A D (N,QuantumSpatialInputTape.input I)).1.2 := by + let P := I.model.portRouteData hA I.model_degree + let S := (QuantumSpatialPortProgram.value A D (N,QuantumSpatialInputTape.input I)).1 + obtain ⟨hs,Ps,E,hrep,hpos,hpoint⟩ := QuantumSpatialPortProgram.value_matches I hA N + obtain ⟨cell,hcell⟩ := cells_order I hA N + have hp : oldPositions A D (N,QuantumSpatialInputTape.input I) = + List.ofFn (fun v => P.finishedPosition N (QuantumSpatialPortProgram.rounds A D) + (E.vertex v)) := by + apply hrep.1.trans + exact congrArg List.ofFn (funext fun v => (hpos v).symm) + have hsites : sites A D (N,QuantumSpatialInputTape.input I) = + List.ofFn (QuantumCrossingSelectProgram.encodedSites + (QuantumScheduleCrossingGeometry.site P N (length_bound I hA) S hs E cell)) := by + change QuantumCrossingSiteProgram.allSites + (oldPositions A D (N,QuantumSpatialInputTape.input I), + cells A D (N,QuantumSpatialInputTape.input I)) = _ + apply (congrArg QuantumCrossingSiteProgram.allSites (congrArg₂ Prod.mk hp hcell)).trans + exact QuantumCrossingSiteProgram.allSites_reordered P N (length_bound I hA) E.vertex + (fun v => P.finishedPosition N (QuantumSpatialPortProgram.rounds A D) (E.vertex v)) + (fun _ => rfl) cell + have hinput : crossingInput A D (N,QuantumSpatialInputTape.input I) = + QuantumScheduleCrossingGeometry.input P N (length_bound I hA) S hs E cell := by + exact congrArg (fun ss => QuantumCrossingSelectProgram.value + (N,oldPacket A D (N,QuantumSpatialInputTape.input I),ss)) hsites + have hpositions : positions A D (N,QuantumSpatialInputTape.input I) = + QuantumCrossingPositionProgram.positions + (List.ofFn (fun i => (P.crossingCell (cell i)).val), + List.ofFn (fun v => P.finishedPosition N (QuantumSpatialPortProgram.rounds A D) + (E.vertex v))) := + congrArg QuantumCrossingPositionProgram.positions (congrArg₂ Prod.mk hcell hp) + change QMAPacketGeometry (P.crossingOutput N (length_bound I hA)) + (P.crossingPosition N (QuantumSpatialPortProgram.rounds A D)) + (QuantumCrossingListLayer.value (crossingInput A D (N,QuantumSpatialInputTape.input I))) + (positions A D (N,QuantumSpatialInputTape.input I)) + rw [hinput,hpositions] + exact QuantumScheduleCrossingGeometry.packet_geometry P N (length_bound I hA) S hs E cell + +end ContinuumCoulomb.QuantumSpatialCrossingProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialDegreeReduction.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialDegreeReduction.lean new file mode 100644 index 0000000000000000000000000000000000000000..1250e29d4d3ae32e332fb3108f101ca46d684610 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialDegreeReduction.lean @@ -0,0 +1,76 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumDegreeReduction +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialExchange +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridNeighbors + +namespace OAI + +/-! Apply the constant-round degree reduction to the actual spatial exchange family. -/ + +noncomputable section +namespace ContinuumCoulomb +open MediatorGraph +open scoped BigOperators Classical +namespace QMASpatialExchangeModel +variable {A B : ℕ} (M : QMASpatialExchangeModel A B) + +def termIndex : M.Term ≃ Fin (Fintype.card M.Term) := Fintype.equivFin _ +def indexedLeft (e : Fin (Fintype.card M.Term)) : Fin M.n := M.left (M.termIndex.symm e) +def indexedRight (e : Fin (Fintype.card M.Term)) : Fin M.n := M.right (M.termIndex.symm e) +def indexedWeight (e : Fin (Fintype.card M.Term)) : ℝ := M.weight (M.termIndex.symm e) + +theorem indexed_distinct (e : Fin (Fintype.card M.Term)) : M.indexedLeft e ≠ M.indexedRight e := + M.distinct _ + +theorem graphDegree_bound (v : Fin M.n) : qmaGraphDegree M.left M.right v ≤ 9*B := by + have h := qmaGrid_incidence_bound M.cell M.anchor (fun e => {M.left e,M.right e}) + (by + intro e q hq + simp only [Finset.mem_insert,Finset.mem_singleton] at hq + rcases hq with rfl | rfl + · exact (M.geometry e).1 + · exact (M.geometry e).2) M.termDensity v + simpa [qmaGraphDegree,eq_comm] using h + +theorem indexed_degree_bound (v : Fin M.n) : + qmaGraphDegree M.indexedLeft M.indexedRight v ≤ 9*B := by + have h := M.termIndex.symm.sum_comp + (fun e => if M.left e = v ∨ M.right e = v then (1:ℕ) else 0) + change qmaGraphDegree M.indexedLeft M.indexedRight v = qmaGraphDegree M.left M.right v at h + exact h.le.trans (M.graphDegree_bound v) + +theorem indexed_matrix : qmaExchangeMatrix M.indexedLeft M.indexedRight M.indexedWeight M.constant = + qmaExchangeMatrix M.left M.right (fun e => (M.weight e:ℝ)) M.constant := by + have h := M.termIndex.symm.sum_comp (fun e => ((M.weight e:ℝ):ℂ) • + sourceHeisenbergMatrix M.n (M.left e) (M.right e)) + unfold qmaExchangeMatrix + exact congrArg (fun s => s+(M.constant:ℂ) • 1) h + +def degreeReduction (N : ℝ) : QMAWeightedForkNetwork M.n := + qmaDegreeReduction M.indexedLeft M.indexedRight M.indexedWeight M.constant N (9*B) + +theorem degreeReduction_degree (N : ℝ) : + ∀ v, qmaGraphDegree (M.degreeReduction N).graph.state.fullLeft + (M.degreeReduction N).graph.state.fullRight v ≤ 3 := + qmaDegreeReduction_degree M.indexedLeft M.indexedRight M.indexed_distinct M.indexedWeight + M.constant N (9*B) M.indexed_degree_bound + +theorem degreeReduction_energy {N : ℝ} (hN : 0 < N) : + |(M.degreeReduction N).energy-M.energy| ≤ (((9*B:ℕ):ℝ)+1)/N := by + have h := qmaDegreeReduction_energy M.indexedLeft M.indexedRight M.indexed_distinct + M.indexedWeight M.constant hN (9*B) + rw [M.indexed_matrix] at h + exact h + +theorem degreeReduction_vertices (N : ℝ) : + (M.degreeReduction N).graph.n ≤ M.n+2*Fintype.card M.Term+36*B*Fintype.card M.Term := by + have h := qmaDegreeReduction_vertices M.indexedLeft M.indexedRight M.indexedWeight M.constant N (9*B) + calc + _ ≤ M.n+2*Fintype.card M.Term+4*(9*B)*Fintype.card M.Term := h + _ = _ := by ring + +end QMASpatialExchangeModel +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialDegreeThree.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialDegreeThree.lean new file mode 100644 index 0000000000000000000000000000000000000000..5479b19b0443e872257dc41ebd1093b3f7808d36 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialDegreeThree.lean @@ -0,0 +1,51 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRationalDegreeReduction +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRationalSpatialPackage + +namespace OAI + +/-! A rational degree-three spatial simulator for the actual exchange construction. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators Classical +namespace QMASpatialExchangeModel +variable {A B : ℕ} (M : QMASpatialExchangeModel A B) + +theorem degreeThree_spatial {N : ℚ} (hN : 0 < N) : + let C := (1+9*B+2*(9*B)^2)*A + ∃ H : QMASpatialExchangeModel C (27*C), + H.rows = M.rows ∧ H.width = M.width ∧ + H.n ≤ M.n+2*Fintype.card M.Term+36*B*Fintype.card M.Term ∧ + |H.energy-M.energy| ≤ (((9*B:ℕ):ℝ)+1)/(N:ℝ) ∧ + ∀ v, qmaGraphDegree H.left H.right v ≤ 3 := by + dsimp only + let P := M.placedDegreeReduction + let G := qmaRationalDegreeReduction M.indexedLeft M.indexedRight + (fun e => M.weight (M.termIndex.symm e)) M.constant N (9*B) + have hr : G.real = M.degreeReduction N := + qmaRationalDegreeReduction_real M.indexedLeft M.indexedRight + (fun e => M.weight (M.termIndex.symm e)) M.constant N (9*B) + have hg : G.graph = P.graph := by + calc + G.graph = G.real.graph := rfl + _ = (M.degreeReduction N).graph := congrArg QMAWeightedForkNetwork.graph hr + _ = P.graph := (M.placedDegreeReduction_graph N).symm + have hd : ∀ v, qmaGraphDegree P.graph.state.fullLeft P.graph.state.fullRight v ≤ 3 := by + change ∀ v, qmaGraphDegree M.placedDegreeReduction.graph.state.fullLeft + M.placedDegreeReduction.graph.state.fullRight v ≤ 3 + rw [M.placedDegreeReduction_graph N] + exact M.degreeReduction_degree N + obtain ⟨H,hrows,hwidth,hn,he,hdH⟩ := qmaRationalPlacedPackage G P hg + M.placedDegreeReduction_density hd M.placedDegreeReduction_local + refine ⟨H,hrows,hwidth,?_,?_,hdH⟩ + · rw [hn,show G.graph = (M.degreeReduction N).graph from congrArg QMAWeightedForkNetwork.graph hr] + exact M.degreeReduction_vertices N + · rw [he,hr] + exact M.degreeReduction_energy (by exact_mod_cast hN) + +end QMASpatialExchangeModel +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialExchange.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialExchange.lean new file mode 100644 index 0000000000000000000000000000000000000000..e141a1fe69c266cff7998055261fa9b3ad748ff4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialExchange.lean @@ -0,0 +1,128 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourSpatial +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBlockRational +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumChosenSlots + +namespace OAI + +/-! The actual rational four-spin simulator retains bounded spatial density. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +theorem qmaXZFieldData_mem {n : ℕ} (t : QMAXZTerm n) (h : t.IsField) : + (t.asField h).site ∈ qmaPauliSupport t.word := by + cases t with + | scalar => exact h.elim + | field i a => + change i ∈ qmaPauliSupport (QMAXZTerm.field i a).word + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _,?_⟩ + simpa only [QMAXZTerm.word,ite_true] using qmaXZLabel_ne_zero a + | pair => exact h.elim + +structure QMASpatialExchangeModel (A B : ℕ) where + n : ℕ + Term : Type + [termFinite : Fintype Term] + left : Term → Fin n + right : Term → Fin n + distinct : ∀ e, left e ≠ right e + weight : Term → ℚ + constant : ℚ + rows : ℕ + width : ℕ + cell : Fin n → QMAGridCell rows width + anchor : Term → QMAGridCell rows width + geometry : ∀ e, QMAGridCellsNear (cell (left e)) (anchor e) ∧ + QMAGridCellsNear (cell (right e)) (anchor e) + qubitDensity : ∀ p, (Finset.univ.filter (fun i => cell i = p)).card ≤ A + termDensity : ∀ p, (Finset.univ.filter (fun e => anchor e = p)).card ≤ B + qubitSlots : QMACellSlots cell A := QMACellSlots.ofDensity qubitDensity + termSlots : QMACellSlots anchor B := QMACellSlots.ofDensity termDensity + +attribute [instance] QMASpatialExchangeModel.termFinite + +def QMASpatialExchangeModel.energy {A B : ℕ} (M : QMASpatialExchangeModel A B) : ℝ := + MediatorGraph.normalizedBottom (qmaExchangeMatrix M.left M.right (fun e => (M.weight e:ℝ)) M.constant) + +theorem qmaSubtype_filter_card_le {α : Type*} [Fintype α] (P : α → Prop) [DecidablePred P] + (f : α → Prop) [DecidablePred f] : + (Finset.univ.filter (fun a : {a // P a} => f a.val)).card ≤ (Finset.univ.filter f).card := by + apply Finset.card_le_card_of_injOn Subtype.val + · intro a ha + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,(Finset.mem_filter.mp ha).2⟩ + · intro a _ b _ h + exact Subtype.ext h + +theorem qmaSpatialXZTerms_exchange {κ : Type} [Fintype κ] {n rows width A B : ℕ} + (t : κ → QMAXZTerm n) (J : κ → ℝ) + (cell : Fin n → QMAGridCell rows width) (anchor : κ → QMAGridCell rows width) + (hlocal : ∀ e, ∀ q ∈ qmaPauliSupport (t e).word, QMAGridCellsNear (cell q) (anchor e)) + (hq : ∀ p, (Finset.univ.filter (fun i => cell i = p)).card ≤ A) + (ht : ∀ p, (Finset.univ.filter (fun e => anchor e = p)).card ≤ B) + (hprivate : ∀ e f, (qmaPauliSupport (t e).word).card = 2 → + qmaPauliSupport (t e).word = qmaPauliSupport (t f).word → e = f) + (N : ℕ) (hN : 0 < N) : + ∃ G : QMASpatialExchangeModel (4*A) (6*A+25*B), + G.rows = rows ∧ G.width = width ∧ + |G.energy-MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • (t e).matrix)| ≤ 2/(N:ℝ) := by + let left := fun e => (qmaXZPairData t e).left + let right := fun e => (qmaXZPairData t e).right + let a := fun e => (qmaXZPairData t e).axisLeft + let b := fun e => (qmaXZPairData t e).axisRight + let site := fun e => (qmaXZFieldData t e).site + let axis := fun e => (qmaXZFieldData t e).axis + let pa := fun e : QMAXZPairIndex t => anchor e.val + let fa := fun e : QMAXZFieldIndex t => anchor e.val + let r := 9*(qmaXZBlockBudget t J)^3*N + let m := (3*Fintype.card (QMAFourExchangeIndex n (QMAXZPairIndex t) (QMAXZFieldIndex t))+1)*N + have hp (p : QMAGridCell rows width) : + (Finset.univ.filter (fun e : QMAXZPairIndex t => pa e = p)).card ≤ B := + (qmaSubtype_filter_card_le (fun e => (t e).IsPair) (fun e => anchor e = p)).trans (ht p) + have hf (p : QMAGridCell rows width) : + (Finset.univ.filter (fun e : QMAXZFieldIndex t => fa e = p)).card ≤ B := + (qmaSubtype_filter_card_le (fun e => (t e).IsField) (fun e => anchor e = p)).trans (ht p) + have hleft (e : QMAXZPairIndex t) : QMAGridCellsNear (cell (left e)) (pa e) := by + apply hlocal e.val + rw [(t e.val).pair_support e.property] + exact Finset.mem_insert_self _ _ + have hright (e : QMAXZPairIndex t) : QMAGridCellsNear (cell (right e)) (pa e) := by + apply hlocal e.val + rw [(t e.val).pair_support e.property] + exact Finset.mem_insert_of_mem (Finset.mem_singleton_self _) + have hsite (e : QMAXZFieldIndex t) : QMAGridCellsNear (cell (site e)) (fa e) := + hlocal e.val _ (qmaXZFieldData_mem (t e.val) e.property) + let G : QMASpatialExchangeModel (4*A) (6*A+25*B) := { + n := n*4 + Term := QMAFourExchangeIndex n (QMAXZPairIndex t) (QMAXZFieldIndex t) + left := qmaFourExchangeLeft left right site + right := qmaFourExchangeRight left right site + distinct := qmaFourExchange_distinct left right site (fun e => (qmaXZPairData t e).distinct) + weight := fun x => qmaRationalRound m (qmaFourExchangeWeight r a b (fun e => J e.val) axis (fun e => J e.val) x) + constant := qmaRationalRound m (qmaFourExchangeScalar n r axis (fun e => J e.val) (qmaXZFamilyConstant t J)) + rows := rows + width := width + cell := qmaFourBlockCell cell + anchor := qmaFourExchangeAnchor cell pa fa + geometry := qmaFourExchange_spatial cell pa fa left right site hleft hright hsite + qubitDensity := qmaFourBlockCell_density cell hq + termDensity := by + intro p + exact (qmaFourExchangeAnchor_density cell pa fa hq hp hf p).trans (by omega) } + refine ⟨G,rfl,rfl,?_⟩ + have h := qmaBlock_rational_accuracy left right a b (fun e => J e.val) + (fun e => (qmaXZPairData t e).distinct) + (fun e f hef => qmaXZPairData_distinct t hprivate e f hef) + site axis (fun e => J e.val) (qmaXZFamilyConstant t J) N hN + change |G.energy-MediatorGraph.normalizedBottom (qmaFourTensorFullTarget left right a b + (fun e => J e.val) site axis (fun e => J e.val) (qmaXZFamilyConstant t J))| ≤ _ at h + rw [qmaXZFamily_target] at h + exact h + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialExchangeCircuit.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialExchangeCircuit.lean new file mode 100644 index 0000000000000000000000000000000000000000..ef15ec087abc24a301bd556ae880435b2fdbc7e7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialExchangeCircuit.lean @@ -0,0 +1,58 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialExchangeModel + +namespace OAI + +/-! The full verifier promise is preserved by a bounded-density rational exchange family. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +theorem QMASpatialExchangeModel.qubits_bound {A B : ℕ} (M : QMASpatialExchangeModel A B) : + M.n ≤ (M.rows+1)*(M.width+1)*A := by + simpa only [Fintype.card_fin] using qmaGrid_density_card M.cell M.qubitDensity + +theorem QMASpatialExchangeModel.incidence_bound {A B : ℕ} (M : QMASpatialExchangeModel A B) + (q : Fin M.n) : + (Finset.univ.filter (fun e => q = M.left e ∨ q = M.right e)).card ≤ 9*B := by + have h := qmaGrid_incidence_bound M.cell M.anchor (fun e => {M.left e,M.right e}) + (by + intro e i hi + simp only [Finset.mem_insert,Finset.mem_singleton] at hi + rcases hi with rfl | rfl + · exact (M.geometry e).1 + · exact (M.geometry e).2) M.termDensity q + simpa only [Finset.mem_insert,Finset.mem_singleton] using h + +theorem qmaCircuit_spatial_exchange (c : QMACircuit) (hc : c.WellFormed) + (N : ℕ) (hN : 0 < N) : + ∃ G : QMASpatialExchangeModel + (4*(qmaVerifierSpatialQubits+qmaVerifierSpatialTerms)) + (6*(qmaVerifierSpatialQubits+qmaVerifierSpatialTerms)+25*(4*qmaVerifierSpatialTerms)), + G.rows = (qmaNearestCircuit (qmaNonemptyCircuit c)).gates.length ∧ G.width = c.work ∧ + (∀ psi : EuclideanSpace ℂ (SourceSpinBasis c.witness), ‖psi‖ = 1 → + 2/3 ≤ qmaAcceptance c hc psi → + G.energy ≤ 1/(3*((qmaSparseCircuit (qmaNonemptyCircuit c)).gates.length+1:ℝ))+1/(N:ℝ)) ∧ + ((∀ psi : EuclideanSpace ℂ (SourceSpinBasis c.witness), ‖psi‖ = 1 → + qmaAcceptance c hc psi ≤ 1/3) → + 2/(5*((qmaSparseCircuit (qmaNonemptyCircuit c)).gates.length+1:ℝ))-1/(N:ℝ) ≤ G.energy) := by + obtain ⟨M,hr,hw,_hcoeff,hp,hy,hn⟩ := qmaCircuit_spatial_rational_private c hc (3*N) (by omega) + obtain ⟨G,hGr,hGw,he⟩ := M.toExchange hp (3*N) (by omega) + simp only [Nat.cast_mul,Nat.cast_ofNat] at he hy hn + refine ⟨G,hGr.trans hr,hGw.trans hw,?_,?_⟩ + · intro psi hpsi ha + have h := hy psi hpsi ha + have hle := (abs_le.mp he).2 + have hsum : 1/(3*N:ℝ)+2/(3*N:ℝ) = 1/(N:ℝ) := by ring + linarith + · intro hs + have h := hn hs + have hle := (abs_le.mp he).1 + have hsum : 1/(3*N:ℝ)+2/(3*N:ℝ) = 1/(N:ℝ) := by ring + linarith + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialExchangeModel.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialExchangeModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..3ccf81fad04a3a43247c4dfad1d4bdef0515c947 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialExchangeModel.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialExchange +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialReindex + +namespace OAI + +/-! The private-pair spatial X/Z model has a spatial rational exchange simulator. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +theorem QMASpatialXZModel.toExchange {A B : ℕ} (M : QMASpatialXZModel A B) + (hprivate : ∀ p q, (qmaPauliSupport (M.word p)).card = 2 → + qmaPauliSupport (M.word p) = qmaPauliSupport (M.word q) → p = q) + (N : ℕ) (hN : 0 < N) : + ∃ G : QMASpatialExchangeModel (4*A) (6*A+25*B), + G.rows = M.rows ∧ G.width = M.width ∧ + |G.energy-M.toQMAXZModel.energy| ≤ 2/(N:ℝ) := by + let E := Fintype.equivFin M.Q + let w := fun a => M.word a ∘ E.symm + have hy : ∀ a i, w a i ≠ 2 := fun a i => M.noY a (E.symm i) + have hw : ∀ a, (qmaPauliSupport (w a)).card ≤ 2 := by + intro a + rw [qmaPauliSupport_relabel,Finset.card_map] + exact M.card a + choose t ht using fun a => qmaXZWord_term (w a) (hy a) (hw a) + have hp : ∀ a b, (qmaPauliSupport (t a).word).card = 2 → + qmaPauliSupport (t a).word = qmaPauliSupport (t b).word → a = b := by + intro a b ha hab + simp only [ht,w,qmaPauliSupport_relabel,Finset.card_map] at ha hab + exact hprivate a b ha (Finset.map_injective E.toEmbedding hab) + have hl : ∀ a, ∀ i ∈ qmaPauliSupport (t a).word, + QMAGridCellsNear (M.cell (E.symm i)) (M.anchor a) := by + intro a i hi + rw [ht] at hi + apply M.geometry a (E.symm i) + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,(Finset.mem_filter.mp hi).2⟩ + have hc : ∀ p, (Finset.univ.filter (fun i => M.cell (E.symm i) = p)).card ≤ A := + (M.reindex E).qubitDensity + obtain ⟨G,hr,hwG,he⟩ := qmaSpatialXZTerms_exchange t M.coefficient + (fun i => M.cell (E.symm i)) M.anchor hl hc M.termDensity hp N hN + refine ⟨G,hr,hwG,?_⟩ + have hm : (∑ a, (M.coefficient a:ℂ) • (t a).matrix) = + ∑ a, (M.coefficient a:ℂ) • qmaPauliWord (w a) := by + simp only [← QMAXZTerm.word_matrix,ht] + rw [hm] at he + change |G.energy-(M.reindex E).toQMAXZModel.energy| ≤ _ at he + rwa [M.reindex_energy E] at he + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialFinalCount.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialFinalCount.lean new file mode 100644 index 0000000000000000000000000000000000000000..38ef1771351a4bdde1591a19f1238bb4a79406d6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialFinalCount.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialFinalGeometry +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialFinalEnergy + +namespace OAI + +/-! Routing retains every original spin. This supplies positivity of the +emitted lattice size and its comparison with the history input size. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumFinalRoutingProgram +open QuantumForkList + +theorem crossing_count_le (A D : ℕ) (x : QuantumSpatialPortProgram.Input) : + (QuantumSpatialPortProgram.value A D x).1.1 ≤ + (QuantumSpatialCrossingProgram.value A D x).1.1.1 := by + change (QuantumSpatialPortProgram.value A D x).1.1 ≤ + (QuantumSpatialPortProgram.value A D x).1.1+_ + exact Nat.le_add_right _ _ + +theorem even_count_le (A D : ℕ) (x : Input) : + (QuantumSpatialCrossingProgram.value A D x.1).1.1.1 ≤ (even A D x).1.1 := by + change (QuantumSpatialCrossingProgram.value A D x.1).1.1.1 ≤ + (QuantumSpatialCrossingProgram.value A D x.1).1.1.1+_ + exact Nat.le_add_right _ _ + +theorem initial_count_le (A D : ℕ) (x : Input) : + (QuantumSpatialPortProgram.initial A D x.1.2).1.1 ≤ (routed A D x).1.1 := by + have hp := QuantumListRouteProgram.iterate_count_le x.1.1 + (QuantumSpatialPortProgram.initial A D x.1.2) (QuantumSpatialPortProgram.rounds A D) + have hf := QuantumListRouteProgram.iterate_count_le x.1.1 (even A D x) rounds + exact hp.trans ((crossing_count_le A D x.1).trans ((even_count_le A D x).trans hf)) + +theorem spatial_count_le {rows width A D : ℕ} (I : SpatialInput rows width A D) + (hA : 0 < spatialDensity A D) (N a b : ℚ) : + I.model.n ≤ (routed A D ((N,QuantumSpatialInputTape.input I),a,b)).1.1 := by + have h := initial_count_le A D ((N,QuantumSpatialInputTape.input I),a,b) + have hi := congrArg (fun s : QuantumListSchedule.State => s.1) + (QuantumPortSchedulePacking.state_eq I hA) + have hh : (QuantumSpatialPortProgram.initial A D (QuantumSpatialInputTape.input I)).1.1 = + I.model.n := hi + exact hh ▸ h + +theorem spatial_crossing_count_le {rows width A D : ℕ} (I : SpatialInput rows width A D) + (hA : 0 < spatialDensity A D) (N : ℚ) : + I.model.n ≤ (QuantumSpatialCrossingProgram.value A D + (N,QuantumSpatialInputTape.input I)).1.1.1 := by + have hp := QuantumListRouteProgram.iterate_count_le N + (QuantumSpatialPortProgram.initial A D (QuantumSpatialInputTape.input I)) + (QuantumSpatialPortProgram.rounds A D) + have hi := congrArg (fun s : QuantumListSchedule.State => s.1) + (QuantumPortSchedulePacking.state_eq I hA) + have hh : (QuantumSpatialPortProgram.initial A D (QuantumSpatialInputTape.input I)).1.1 = + I.model.n := hi + exact hh ▸ hp.trans (crossing_count_le A D (N,QuantumSpatialInputTape.input I)) + +theorem spatial_valid {rows width A D : ℕ} (I : SpatialInput rows width A D) + (hA : 0 < spatialDensity A D) {N : ℚ} (hN : 0 < N) + (hn : 0 < I.model.n) (a b : ℚ) (hab : a < b) : + (value A D ((N,QuantumSpatialInputTape.input I),a,b)).Valid := by + obtain ⟨hs,Q,hQ,_,hgrid⟩ := spatial_realization I hA hN a b + exact QuantumListRouteProgram.latticeOutput_valid _ hs Q hQ hgrid + (hn.trans_le (spatial_count_le I hA N a b)) a b hab + +end ContinuumCoulomb.QuantumFinalRoutingProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialFinalEnergy.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialFinalEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..28e16701fa4274753feef3b4fad8ae79c7a4c64c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialFinalEnergy.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialCrossingSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFinalRoutingProgram + +namespace OAI + +/-! Full-space error of the complete literal routing program. The sum pays +for the actual port, crossing, parity and final subdivision stages. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumFinalRoutingProgram +open QuantumForkList + +theorem planar_energy (x : QuantumPlanarTapeProgram.Input) + (hb : SourceBondLists.bounded x.1.1.1 x.1.1.2.1) : + QuantumCrossingPacketEnergy.energy (QuantumPlanarTapeProgram.value x).1 = + QuantumCrossingPacketEnergy.energy x.1.1 := by + change sourceMatrixBottom x.1.1.1 + (SourceBondLists.matrix x.1.1.1 (QuantumListMerge.value x.1.1.1 x.1.1.2.1)+ + (x.1.1.2.2:ℂ) • 1) = _ + rw [QuantumListMerge.matrix_eq _ _ hb] + rfl + +theorem spatial_planar_noLoops {rows width A D : ℕ} (I : SpatialInput rows width A D) + (hA : 0 < spatialDensity A D) (N a b : ℚ) : + ∀ e ∈ (planar A D ((N,QuantumSpatialInputTape.input I),a,b)).1.2.1, + e.1 ≠ e.2.1 := by + have h := QuantumListMerge.noLoops + (n := (QuantumSpatialCrossingProgram.value A D (N,QuantumSpatialInputTape.input I)).1.1.1) + (xs := (QuantumSpatialCrossingProgram.value A D (N,QuantumSpatialInputTape.input I)).1.1.2.1) + (QuantumSpatialCrossingProgram.packet_geometry I hA N).noLoops + simpa only [planar,QuantumPlanarTapeProgram.value,QuantumPlanarTapeProgram.merged] using h + +theorem spatial_planar_energy {rows width A D : ℕ} (I : SpatialInput rows width A D) + (hA : 0 < spatialDensity A D) (N a b : ℚ) : + QuantumCrossingPacketEnergy.energy (planar A D ((N,QuantumSpatialInputTape.input I),a,b)).1 = + QuantumCrossingPacketEnergy.energy + (QuantumSpatialCrossingProgram.value A D (N,QuantumSpatialInputTape.input I)).1.1 := by + exact planar_energy _ (QuantumSpatialCrossingProgram.packet_geometry I hA N).bounded + +theorem spatial_routed_energy_error {rows width A D : ℕ} (I : SpatialInput rows width A D) + (hA : 0 < spatialDensity A D) {N : ℚ} (hN : 0 < N) (a b : ℚ) : + |QuantumListSchedule.energy (routed A D ((N,QuantumSpatialInputTape.input I),a,b)).1- + QuantumCrossingPacketEnergy.energy + (QuantumSpatialCrossingProgram.value A D (N,QuantumSpatialInputTape.input I)).1.1| ≤ + 81/(N:ℝ) := by + have h := energy_error A D ((N,QuantumSpatialInputTape.input I),a,b) hN + (spatial_planar_noLoops I hA N a b) + rw [← spatial_planar_energy I hA N a b] + exact h + +private theorem sum_error {a b c d n r : ℝ} + (hab : |a-b| ≤ 81/n) (hbc : |b-c| ≤ 1/n) (hcd : |c-d| ≤ r/n) : + |a-d| ≤ (r+82)/n := by + calc + _ ≤ |a-b|+|b-c|+|c-d| := + le_trans (abs_sub_le a c d) (by linarith [abs_sub_le a b c]) + _ ≤ 81/n+1/n+r/n := add_le_add (add_le_add hab hbc) hcd + _ = _ := by ring + +theorem spatial_energy_error {rows width A D : ℕ} (I : SpatialInput rows width A D) + (hA : 0 < spatialDensity A D) {N : ℚ} (hN : 0 < N) (a b : ℚ) : + |QuantumListSchedule.energy (routed A D ((N,QuantumSpatialInputTape.input I),a,b)).1- + I.model.energy| ≤ ((QuantumSpatialPortProgram.rounds A D:ℝ)+82)/(N:ℝ) := by + have hf := spatial_routed_energy_error I hA hN a b + have hc := QuantumSpatialCrossingProgram.energy_error I hA hN + obtain ⟨_,_,_,_,_,_,hp⟩ := QuantumSpatialPortProgram.realizes I hA hN + exact sum_error hf hc hp + +end ContinuumCoulomb.QuantumFinalRoutingProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialFinalGeometry.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialFinalGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..d9c7b31195b3ac471d0a5ba4203b45cbacd70efa --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialFinalGeometry.lean @@ -0,0 +1,42 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPacketRoutingGeometry +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialCrossingSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialPlanarRealization + +namespace OAI + +/-! The complete literal spatial routing output carries the exact physical +square-lattice embedding, with a fixed multiple of the original box. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumFinalRoutingProgram +open QuantumForkList + +theorem spatial_realization {rows width A D : ℕ} (I : SpatialInput rows width A D) + (hA : 0 < spatialDensity A D) {N : ℚ} (hN : 0 < N) (a b : ℚ) : + let s := routed A D ((N,QuantumSpatialInputTape.input I),a,b) + ∃ (hs : QuantumListSchedule.Valid s.1) + (Q : QMAPathEmbedding (QuantumListSchedule.schedule s.1 hs)), + QuantumListRouteProgram.Represents s hs Q ∧ + Q.Bounded (256*I.model.bufferedWidth) (256*I.model.bufferedHeight) ∧ + (∀ e, qmaSquareGrid.Adj (Q.position ((QuantumListSchedule.schedule s.1 hs).graph.left e)) + (Q.position ((QuantumListSchedule.schedule s.1 hs).graph.right e))) := by + let P := I.model.portRouteData hA I.model_degree + have hpath : ∀ e k, k ≤ P.length e → + (P.point e k).1 < I.model.bufferedWidth ∧ + (P.point e k).2 < I.model.bufferedHeight := by + intro e k _ + exact I.model.bufferedPath_bounds I.model_degree e + ((I.model.bufferedPath I.model_degree e).val.getVert_mem_support k) + exact QuantumPlanarTapeGeometry.final_realization P N + (QuantumSpatialCrossingProgram.length_bound I hA) + (QuantumSpatialCrossingProgram.value A D (N,QuantumSpatialInputTape.input I)) + (QuantumSpatialCrossingProgram.packet_geometry I hA N) + (QuantumSpatialCrossingProgram.table_permission I hA N) + (I.model.sourceCell_no_passage hA I.model_degree) I.model.placedVertex_positive + I.model.placedVertex_bounds hpath hN + +end ContinuumCoulomb.QuantumFinalRoutingProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialGadgets.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialGadgets.lean new file mode 100644 index 0000000000000000000000000000000000000000..eed58bf93612b57e109e2d8d1bcfada68845ebf4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialGadgets.lean @@ -0,0 +1,53 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialThird + +namespace OAI + +/-! The fixed six-to-two gadget chain preserves bounded density on the same grid. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +def QMASpatialModel.relaxDensity {d A B A' B' : ℕ} (M : QMASpatialModel d A B) + (hA : A ≤ A') (hB : B ≤ B') : QMASpatialModel d A' B' where + toQMARealLocalModel := M.toQMARealLocalModel + rows := M.rows + width := M.width + cell := M.cell + anchor := M.anchor + geometry := M.geometry + qubitDensity p := (M.qubitDensity p).trans hA + termDensity p := (M.termDensity p).trans hB + +theorem QMASpatialModel.six_to_two {A B : ℕ} (M : QMASpatialModel 6 A B) + {N : ℝ} (hN : 1 ≤ N) : + ∃ G : QMASpatialModel 2 (A+1077940224*B) (7516192768*B), + |G.toQMARealLocalModel.energy-M.toQMARealLocalModel.energy| ≤ 1/N ∧ + G.rows = M.rows ∧ G.width = M.width := by + have h3N : 1 ≤ 3*N := by linarith + obtain ⟨M4,h4,hr4,hw4⟩ := M.subdivision (d := 3) h3N + obtain ⟨M3,h3,hr3,hw3⟩ := M4.subdivision (d := 2) h3N + obtain ⟨M2,h2,hr2,hw2⟩ := M3.third h3N + have hA : (A+4^6*B)+4^4*(4*4^6*B)+4^3*(4*4^4*(4*4^6*B)) ≤ A+1077940224*B := by + norm_num only [show (4:ℕ)^6 = 4096 by norm_num,show (4:ℕ)^4 = 256 by norm_num, + show (4:ℕ)^3 = 64 by norm_num] + omega + have hB : 7*4^3*(4*4^4*(4*4^6*B)) ≤ 7516192768*B := by + norm_num only [show (4:ℕ)^6 = 4096 by norm_num,show (4:ℕ)^4 = 256 by norm_num, + show (4:ℕ)^3 = 64 by norm_num] + omega + refine ⟨M2.relaxDensity hA hB,?_,hr2.trans (hr3.trans hr4),hw2.trans (hw3.trans hw4)⟩ + change |M2.toQMARealLocalModel.energy-M.toQMARealLocalModel.energy| ≤ 1/N + have ht := (abs_sub_le M2.toQMARealLocalModel.energy M3.toQMARealLocalModel.energy + M.toQMARealLocalModel.energy).trans (add_le_add le_rfl + (abs_sub_le M3.toQMARealLocalModel.energy M4.toQMARealLocalModel.energy + M.toQMARealLocalModel.energy)) + have hN0 : N ≠ 0 := by linarith + have he : 1/(3*N)+1/(3*N)+1/(3*N) = 1/N := by field_simp; ring + linarith + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialInput.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialInput.lean new file mode 100644 index 0000000000000000000000000000000000000000..c13321a0cd1a79b08c41378c5004dca57225d204 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialInput.lean @@ -0,0 +1,44 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialPropagation +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceModel + +namespace OAI + +/-! Both clock bits and the initialized qubit are near the first-use gate. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +theorem qmaSparseInput_cell (c : QMACircuit) (hc : c.WellFormed) + (hT : 0 < (qmaSparseCircuit c).gates.length) (i : Fin ((qmaSparseCircuit c).work+1)) + (ht : qmaFirstUse (qmaSparseCircuit c) i < (qmaSparseCircuit c).gates.length) + (k : QMACircuitQubit (qmaSparseCircuit c)) + (hk : k ∈ qmaDistributedInputSites (qmaSparseCircuit c) (qmaFirstUseTime (qmaSparseCircuit c)) i) : + QMAGridCellsNear (qmaSparseQubitCell c hT k) + (qmaSparseGateCell c ⟨qmaFirstUse (qmaSparseCircuit c) i,ht⟩) := by + let t : Fin (qmaSparseCircuit c).gates.length := ⟨qmaFirstUse (qmaSparseCircuit c) i,ht⟩ + cases k with + | inl b => + have hb : b = (qmaFirstUseTime (qmaSparseCircuit c) i).castSucc ∨ + b = (qmaFirstUseTime (qmaSparseCircuit c) i).succ := by + simpa [qmaDistributedInputSites] using hk + rcases hb with rfl | rfl + · apply qmaSparseClockCells_near_gate c hT t + change t.val ≤ t.val ∧ t.val ≤ t.val+2 + omega + · apply qmaSparseClockCells_near_gate c hT t + change t.val ≤ t.val+1 ∧ t.val+1 ≤ t.val+2 + omega + | inr j => + have hj : j = i := by simpa [qmaDistributedInputSites] using hk + subst j + apply qmaSparseWorkCell_near_gate c hc t i + apply qmaFirstUseSites_subset + simp only [qmaFirstUseSites,Finset.mem_filter,Finset.mem_univ,true_and] + rfl + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialInputBounds.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialInputBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..0b05b8f5ed1ae5a1ad4feea11c157e0b6a49a583 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialInputBounds.lean @@ -0,0 +1,50 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListInitialSpatial +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListOutputBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListBoundProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedPortChain + +namespace OAI + +/-! Size and coefficient bounds for the same full spatial graph that is routed +to the lattice. Active-star bonds and the scalar offset are included. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumForkList.SpatialInput +open scoped Classical +variable {rows width A D : ℕ} (I : SpatialInput rows width A D) + +theorem model_size : I.model.n+Fintype.card I.model.Term ≤ + I.n+5*I.bonds.length+12*D*I.bonds.length := by + have hn := initial_iterate_count_le I.n I.bonds I.bounded I.constant I.precision D + have he := initial_iterate_bonds_le I.n I.bonds I.bounded I.constant I.precision D + change I.state.1+Fintype.card (Fin (fullList I.state).length) ≤ _ + rw [Fintype.card_fin] + calc + _ ≤ (I.n+2*I.bonds.length+4*D*I.bonds.length)+ + (3*I.bonds.length+8*D*I.bonds.length) := Nat.add_le_add hn he + _ = _ := by ring + +theorem model_coefficientBound {L T : ℝ} (hN : 0 ≤ I.precision) + (hL : 1 ≤ L) (hT : |(I.precision:ℝ)| ≤ T) + (hc : |(I.constant:ℝ)| ≤ L) (hw : ∀ b ∈ I.bonds, |(b.2.2:ℝ)| ≤ L) : + I.model.exchangeGraph.CoefficientBound (outputCoefficient I.bonds.length D L T) := by + have h := initial_iterate_coefficientBound I.n I.bonds I.bounded I.constant I.precision + hN hL hT hc hw D + constructor + · exact h.scalar + · intro e + exact h.full I.state ((fullList I.state).get e) (List.get_mem _ e) + +theorem model_nat_coefficientBound {L T : ℕ} (hN : 0 ≤ I.precision) + (hL : 1 ≤ L) (hT : |(I.precision:ℝ)| ≤ T) + (hc : |(I.constant:ℝ)| ≤ L) (hw : ∀ b ∈ I.bonds, |(b.2.2:ℝ)| ≤ L) : + I.model.exchangeGraph.CoefficientBound + (outputCoefficientNat I.bonds.length D L T) := by + rw [outputCoefficientNat_cast] + exact I.model_coefficientBound hN (by exact_mod_cast hL) hT hc hw + +end ContinuumCoulomb.QuantumForkList.SpatialInput + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialInputTape.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialInputTape.lean new file mode 100644 index 0000000000000000000000000000000000000000..308da1ec6a993f70fb327f0ea7c0b5807fca1903 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialInputTape.lean @@ -0,0 +1,88 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkRoutingData +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkListInitialSpatial + +namespace OAI + +/-! The computed fork-state/cell tape is exactly the array of the spatial +model. Only cells at actual spin indices are read. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumSpatialInputTape +open QuantumForkList QuantumForkGridProgram QuantumRouteCode + +def coordinates {rows width : ℕ} (p : QMAGridCell rows width) : QuantumRouteCode.Pair := + (p.1.val,p.2.val) + +private theorem iterate_coordinates {rows width : ℕ} (N : ℚ) (s : State) + (cell : ℕ → QMAGridCell rows width) (k : ℕ) : + iterateCell N k s (coordinates ∘ cell) = coordinates ∘ iterateCell N k s cell := by + induction k with + | zero => rfl + | succ k ih => + funext v + simp only [iterateCell,nextCell,Function.comp_apply] + split <;> exact congrFun ih _ + +def input {rows width A D : ℕ} (I : SpatialInput rows width A D) : PreparedInput := + ((I.precision,I.n,I.bonds,I.constant),List.ofFn (fun v : Fin I.n => coordinates (I.cell v.val))) + +theorem state_eq {rows width A D : ℕ} (I : SpatialInput rows width A D) : + (output D (input I)).1 = I.state := output_state D (input I) + +private theorem prepare_represents_input {rows width A D : ℕ} + (I : SpatialInput rows width A D) : + Represents (prepare (input I)).2 (coordinates ∘ initialCell I.n I.bonds I.cell) := by + intro v hv + change v < I.n+2*I.bonds.length at hv + change lookup (initialCells (I.n,I.bonds, + List.ofFn (fun v : Fin I.n => coordinates (I.cell v.val)))) v = _ + rw [lookup_initialCells _ v hv] + change initialCell I.n I.bonds + (lookup (List.ofFn (fun v : Fin I.n => coordinates (I.cell v.val)))) v = _ + by_cases h : v < I.n + · simp only [Function.comp_apply,initialCell,h,ite_true] + exact QuantumOrdinalProgram.lookup_ofFn _ ⟨v,h⟩ + · have hb : v-I.n < 2*I.bonds.length := by + change v < I.n+2*I.bonds.length at hv + omega + have he := initialEndpoint_bound I.n I.bonds I.bounded (v-I.n) hb + simp only [initialCell,h,ite_false,Function.comp_apply] + exact QuantumOrdinalProgram.lookup_ofFn _ ⟨_,he⟩ + +theorem output_represents_input {rows width A D : ℕ} + (I : SpatialInput rows width A D) : + Represents (output D (input I)) (coordinates ∘ I.cells) := by + have h := run_represents D (prepare (input I)) (initial_validPorts _ _ _ _) + (coordinates ∘ initialCell I.n I.bonds I.cell) (prepare_represents_input I) + change Represents (output D (input I)) + (iterateCell I.precision D (initial I.n I.bonds I.constant I.precision) + (coordinates ∘ initialCell I.n I.bonds I.cell)) at h + rw [iterate_coordinates] at h + exact h + +theorem output_eq {rows width A D : ℕ} (I : SpatialInput rows width A D) : + output D (input I) = + (I.state,List.ofFn (fun v : Fin I.state.1 => coordinates (I.cells v.val))) := by + apply Prod.ext + · exact state_eq I + · apply List.ext_getElem + · rw [List.length_ofFn,output_length,state_eq] + · intro i hi hj + have hi' : i < I.state.1 := by simpa only [List.length_ofFn] using hj + have h := output_represents_input I i (by rwa [state_eq]) + simpa only [lookup,List.headD_eq_head?_getD,List.head?_drop, + List.getElem?_eq_getElem hi,Option.getD_some,Function.comp_apply, + List.getElem_ofFn] using h + +theorem routing_eq {rows width A D : ℕ} (I : SpatialInput rows width A D) : + QuantumForkRoutingData.value (output D (input I)) = + QuantumRoutingInputProgram.actualData I.model (Equiv.refl _) := by + rw [output_eq] + exact QuantumForkRoutingData.value_spatialModel I.state I.validPorts I.state_bounded + I.state_noLoops I.cells (spatialDensity A D) I.state_density I.state_degree I.state_locality + +end ContinuumCoulomb.QuantumSpatialInputTape + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialLattice.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialLattice.lean new file mode 100644 index 0000000000000000000000000000000000000000..442ca867476752e5ec6e0ae5527b26751701eeb7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialLattice.lean @@ -0,0 +1,90 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialPlanarRealization +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLatticeSourceBounds + +namespace OAI + +/-! The specified nearest-neighbor output of a degree-three spatial model. +The graph, positions, source thresholds and estimates refer to one construction. -/ + +noncomputable section +namespace ContinuumCoulomb.QMASpatialExchangeModel +open scoped Classical +variable {A B : ℕ} (M : QMASpatialExchangeModel A B) +variable (hA : 0 < A) (hd : ∀ v, qmaGraphDegree M.left M.right v ≤ 3) + +def latticeGraph (N : ℚ) := + (M.portRouteData hA hd).latticeGraph N (M.bufferedPath_length hd) + (M.sourceCell_no_passage hA hd) M.placedVertex_positive + +def latticePosition (N : ℚ) := + (M.portRouteData hA hd).latticePosition N (M.bufferedPath_length hd) + (M.sourceCell_no_passage hA hd) M.placedVertex_positive + +theorem lattice_vertices_ge (N : ℚ) : M.n ≤ (M.latticeGraph hA hd N).n := + (M.portRouteData hA hd).lattice_vertices_ge N (M.bufferedPath_length hd) + (M.sourceCell_no_passage hA hd) M.placedVertex_positive + +theorem lattice_position_injective (N : ℚ) : + Function.Injective (M.latticePosition hA hd N) := + (M.portRouteData hA hd).lattice_position_injective N (M.bufferedPath_length hd) + (M.sourceCell_no_passage hA hd) M.placedVertex_positive + +theorem lattice_adjacent (N : ℚ) (e : (M.latticeGraph hA hd N).Edge) : + qmaSquareGrid.Adj + (M.latticePosition hA hd N ((M.latticeGraph hA hd N).left e)) + (M.latticePosition hA hd N ((M.latticeGraph hA hd N).right e)) := + (M.portRouteData hA hd).lattice_adjacent N (M.bufferedPath_length hd) + (M.sourceCell_no_passage hA hd) M.placedVertex_positive e + +theorem lattice_bounded (N : ℚ) (v : Fin (M.latticeGraph hA hd N).n) : + (M.latticePosition hA hd N v).1 < 256*M.bufferedWidth ∧ + (M.latticePosition hA hd N v).2 < 256*M.bufferedHeight := by + apply (M.portRouteData hA hd).lattice_bounded N (M.bufferedPath_length hd) + (M.sourceCell_no_passage hA hd) M.placedVertex_positive M.placedVertex_bounds + intro e k _ + exact M.bufferedPath_bounds hd e ((M.bufferedPath hd e).val.getVert_mem_support k) + +theorem lattice_energy_error {N : ℚ} (hN : 0 < N) : + |(M.latticeGraph hA hd N).energy-M.energy| ≤ + ((routeLengthBound A B+82:ℕ):ℝ)/(N:ℝ) := + (M.portRouteData hA hd).lattice_energy_error N (M.bufferedPath_length hd) + (M.sourceCell_no_passage hA hd) M.placedVertex_positive hN + +theorem lattice_energy_error_nat (N : ℕ) (hN : 0 < N) : + |(M.latticeGraph hA hd (N:ℚ)).energy-M.energy| ≤ + ((routeLengthBound A B:ℝ)+82)/(N:ℝ) := by + have h := M.lattice_energy_error hA hd (N := (N:ℚ)) (by exact_mod_cast hN) + simpa only [Nat.cast_add,Nat.cast_ofNat,Rat.cast_natCast] using h + +def latticeSource (N : ℚ) (hn : 0 < M.n) (a b : ℚ) (hab : a < b) : + SquareLatticeHeisenberg := + (M.portRouteData hA hd).latticeSource N (M.bufferedPath_length hd) + (M.sourceCell_no_passage hA hd) M.placedVertex_positive hn a b hab + +theorem latticeSource_energy (N : ℚ) (hn : 0 < M.n) (a b : ℚ) (hab : a < b) : + realSourceGroundEnergy (M.latticeSource hA hd N hn a b hab) = + (M.latticeGraph hA hd N).energy-((M.latticeGraph hA hd N).constant:ℝ) := + (M.portRouteData hA hd).latticeSource_energy N (M.bufferedPath_length hd) + (M.sourceCell_no_passage hA hd) M.placedVertex_positive hn a b hab + +theorem latticeSource_binary_promise (N : ℚ) (hn : 0 < M.n) (a b : ℚ) (hab : a < b) + {n k L T : ℕ} (hsize : n ≤ M.n) + (hN : 0 ≤ N) (hL : 1 ≤ L) (hT : |(N:ℝ)| ≤ T) + (hc : M.exchangeGraph.CoefficientBound L) + (hx : (256*M.bufferedWidth:ℕ) ≤ (n+1:ℝ)^k) + (hy : (256*M.bufferedHeight:ℕ) ≤ (n+1:ℝ)^k) + (hw : (QuantumCoefficientPrograms.latticeBound (routeLengthBound A B) + (Fintype.card M.Term) (M.portRouteData hA hd).crossingCells.card L T:ℝ) ≤ (n+1:ℝ)^k) + (hg : ((n+1:ℝ)^k)⁻¹ ≤ (b:ℝ)-a) : + (M.latticeSource hA hd N hn a b hab).binary.PolynomialPromise k := by + apply (M.portRouteData hA hd).latticeSource_binary_promise N + (M.bufferedPath_length hd) (M.sourceCell_no_passage hA hd) M.placedVertex_positive + hn a b hab hsize M.placedVertex_bounds ?_ hN hL hT hc hx hy hw hg + intro e j _ + exact M.bufferedPath_bounds hd e ((M.bufferedPath hd e).val.getVert_mem_support j) + +end ContinuumCoulomb.QMASpatialExchangeModel + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialModel.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..d913010cef49364ba8eb20d461d491cb262356c4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialModel.lean @@ -0,0 +1,36 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialOccupancy + +namespace OAI + +/-! Spatial data for the actual finite real Hamiltonian, including bounded density. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +structure QMASpatialModel (d A B : ℕ) extends QMARealLocalModel d where + rows : ℕ + width : ℕ + cell : Q → QMAGridCell rows width + anchor : Term → QMAGridCell rows width + geometry : ∀ a, ∀ q ∈ sites a, QMAGridCellsNear (cell q) (anchor a) + qubitDensity : ∀ p, (Finset.univ.filter (fun q => cell q = p)).card ≤ A + termDensity : ∀ p, (Finset.univ.filter (fun a => anchor a = p)).card ≤ B + +def qmaSpatialHistoryModel (c : QMACircuit) (hc : c.WellFormed) + (hT : 0 < (qmaSparseCircuit c).gates.length) + (hne : (qmaNearestCircuit c).gates ≠ []) : QMASpatialModel 6 45 64 where + toQMARealLocalModel := qmaOrderedHistoryModel (qmaSparseCircuit c) hT + rows := (qmaNearestCircuit c).gates.length + width := c.work + cell := qmaOrderedQubitCell c hT + anchor := qmaOrderedTermCell c hT + geometry := qmaOrderedHistoryModel_spatial c hc hT hne + qubitDensity := qmaOrderedQubitCell_fiber_card c hT hne + termDensity := qmaOrderedTermCell_fiber_card c hT hne + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialOccupancy.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialOccupancy.lean new file mode 100644 index 0000000000000000000000000000000000000000..2920b4971512022510bbbb398c34a73a7bba8fa3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialOccupancy.lean @@ -0,0 +1,84 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialReference + +namespace OAI + +/-! The concrete real history model has bounded qubit and term density in its grid. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +theorem qmaSparseWorkCell_injective (c : QMACircuit) : Function.Injective (qmaSparseWorkCell c) := by + intro i j h + have hh := congrArg (fun p => qmaGridQubit (qmaNearestCircuit c).gates.length c.work p.1 p.2) h + simpa only [qmaSparseWorkCell,qmaGridCoordinates_right] using hh + +theorem qmaSparseWorkCell_fiber_card (c : QMACircuit) + (p : QMAGridCell (qmaNearestCircuit c).gates.length c.work) : + (Finset.univ.filter (fun i => qmaSparseWorkCell c i = p)).card ≤ 1 := by + apply Finset.card_le_one.mpr + intro i hi j hj + exact qmaSparseWorkCell_injective c + ((Finset.mem_filter.mp hi).2.trans (Finset.mem_filter.mp hj).2.symm) + +theorem qmaSparseClockCell_fiber_card (c : QMACircuit) + (hT : 0 < (qmaSparseCircuit c).gates.length) + (p : QMAGridCell (qmaNearestCircuit c).gates.length c.work) : + (Finset.univ.filter (fun b => qmaSparseClockCell c hT b = p)).card ≤ 12 := by + apply (Finset.card_le_card (show _ ⊆ qmaSparseClockCellBits c hT p from ?_)).trans + (qmaSparseClockCellBits_card c hT p) + intro b hb + have hm := qmaSparseClockCellBits_mem c hT b + rw [(Finset.mem_filter.mp hb).2] at hm + exact hm + +theorem qmaOrderedReferenceCell_fiber_card (c : QMACircuit) + (hT : 0 < (qmaSparseCircuit c).gates.length) + (hne : (qmaNearestCircuit c).gates ≠ []) + (p : QMAGridCell (qmaNearestCircuit c).gates.length c.work) : + (Finset.univ.filter (fun i => qmaOrderedSparseReferenceCell c hT i = p)).card ≤ 32 := by + apply (Finset.card_le_card (show _ ⊆ qmaSparseReferenceCellIndices c hT p from ?_)).trans + (qmaSparseReferenceCellIndices_card c hT hne p) + intro i hi + have hm := qmaSparseReferenceCellIndices_mem c hT i + rw [(Finset.mem_filter.mp hi).2] at hm + exact hm + +theorem qmaOrderedQubitCell_fiber_card (c : QMACircuit) + (hT : 0 < (qmaSparseCircuit c).gates.length) + (hne : (qmaNearestCircuit c).gates ≠ []) + (p : QMAGridCell (qmaNearestCircuit c).gates.length c.work) : + (Finset.univ.filter (fun k => qmaOrderedQubitCell c hT k = p)).card ≤ 45 := by + rw [qmaSumFilter_card] + change (Finset.univ.filter (fun i => qmaOrderedSparseReferenceCell c hT i = p)).card+ + (Finset.univ.filter (fun k : Fin ((qmaSparseCircuit c).gates.length+2) ⊕ + Fin ((qmaSparseCircuit c).work+1) => qmaSparseQubitCell c hT k = p)).card ≤ 45 + rw [qmaSumFilter_card] + exact (Nat.add_le_add (qmaOrderedReferenceCell_fiber_card c hT hne p) + (Nat.add_le_add (qmaSparseClockCell_fiber_card c hT p) (qmaSparseWorkCell_fiber_card c p))).trans + (by decide) + +theorem qmaOrderedTermCell_fiber_card (c : QMACircuit) + (hT : 0 < (qmaSparseCircuit c).gates.length) + (hne : (qmaNearestCircuit c).gates ≠ []) + (p : QMAGridCell (qmaNearestCircuit c).gates.length c.work) : + (Finset.univ.filter (fun a => qmaOrderedTermCell c hT a = p)).card ≤ 64 := by + have hr := qmaOrderedReferenceCell_fiber_card c hT hne p + have he : (Finset.univ.filter (fun i : Fin (qmaHistoryReferenceWork (qmaSparseCircuit c)) => + qmaOrderedSparseReferenceCell c hT i.castSucc = p)).card ≤ + (Finset.univ.filter (fun i => qmaOrderedSparseReferenceCell c hT i = p)).card := by + apply Finset.card_le_card_of_injOn Fin.castSucc + · intro i hi + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,(Finset.mem_filter.mp hi).2⟩ + · intro i _ j _ h + exact (Fin.castSucc_inj.mp h) + change (Finset.univ.filter (fun a : Fin (qmaHistoryReferenceWork (qmaSparseCircuit c)+1) ⊕ + Fin (qmaHistoryReferenceWork (qmaSparseCircuit c)) => qmaOrderedTermCell c hT a = p)).card ≤ 64 + rw [qmaSumFilter_card] + exact (Nat.add_le_add hr (he.trans hr)).trans (by decide) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialPlaced.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialPlaced.lean new file mode 100644 index 0000000000000000000000000000000000000000..3c74d3e28a71bee637c218abd68acc5862b45796 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialPlaced.lean @@ -0,0 +1,51 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialDegreeReduction +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumForkInitialLocality + +namespace OAI + +/-! The actual degree-three output retains constant density in the original rectangular grid. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators Classical +namespace QMASpatialExchangeModel +variable {A B : ℕ} (M : QMASpatialExchangeModel A B) + +def placedDegreeReduction : QMAPlacedForkNetwork (QMAGridCell M.rows M.width) M.n := + (qmaSubdivisionPlaced M.indexedLeft M.indexedRight M.cell).iterate (9*B) + +theorem placedDegreeReduction_graph (N : ℝ) : + M.placedDegreeReduction.graph = (M.degreeReduction N).graph := by + unfold placedDegreeReduction degreeReduction + rw [QMAPlacedForkNetwork.iterate_graph,qmaDegreeReduction_graph] + rfl + +theorem placedDegreeReduction_density (p : QMAGridCell M.rows M.width) : + qmaCellMass M.placedDegreeReduction.cell p ≤ (1+9*B+2*(9*B)^2)*A := by + have h := qmaSubdivisionPlaced_density M.indexedLeft M.indexedRight M.indexed_distinct + M.cell (9*B) M.indexed_degree_bound p + have hc : qmaCellMass M.cell p ≤ A := by + simpa [qmaCellMass] using M.qubitDensity p + exact h.trans (Nat.mul_le_mul_left _ hc) + +theorem placedDegreeReduction_local : + let G := M.placedDegreeReduction + ∀ e, ∃ a : QMAGridCell M.rows M.width, + QMAGridCellsNear (G.cell (G.graph.state.fullLeft e)) a ∧ + QMAGridCellsNear (G.cell (G.graph.state.fullRight e)) a := by + let R := fun p q : QMAGridCell M.rows M.width => + ∃ a, QMAGridCellsNear p a ∧ QMAGridCellsNear q a + have hr : ∀ p, R p p := by + intro p + refine ⟨p,?_,?_⟩ <;> simp [QMAGridCellsNear] + have he : ∀ e, R (M.cell (M.indexedLeft e)) (M.cell (M.indexedRight e)) := by + intro e + exact ⟨M.anchor (M.termIndex.symm e),M.geometry (M.termIndex.symm e)⟩ + exact qmaSubdivisionPlaced_full_local M.indexedLeft M.indexedRight M.cell R hr he (9*B) + +end QMASpatialExchangeModel +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialPlanarBounds.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialPlanarBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..d4be9848d82810b1e7c06555da1bbc88df309f61 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialPlanarBounds.lean @@ -0,0 +1,65 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialPortBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialCrossingSupport +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumMergedCoefficientBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLatticeCoefficient + +namespace OAI + +/-! The actual merged crossing packet satisfies the same polynomial +envelope as the physical construction, including parallel-edge sums. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumSpatialCrossingProgram +open QuantumForkList QuantumCrossingSelectProgram QuantumCoefficientPrograms +open scoped Classical + +theorem planar_bounds {rows width A D : ℕ} (I : SpatialInput rows width A D) + (hA : 0 < spatialDensity A D) {N : ℚ} (hN : 0 ≤ N) {L T : ℕ} + (hL : 1 ≤ L) (hT : |(N:ℝ)| ≤ T) (hc : I.model.exchangeGraph.CoefficientBound L) + (hn : ∀ e ∈ (value A D (N,QuantumSpatialInputTape.input I)).1.1.2.1, e.1 ≠ e.2.1) : + let K := QuantumSpatialPortProgram.rounds A D + let m := 3^K*Fintype.card I.model.Term + let r := (I.model.portRouteData hA I.model_degree).crossingCells.card + let B := iterated (Fintype.card I.model.Term) L T K + (QuantumPlanarTapeGeometry.graph (value A D (N,QuantumSpatialInputTape.input I)) hn).CoefficientBound + ((m+9*r+1)*crossingCoefficient m r ((m+1)*B) T) ∧ + Fintype.card (QuantumPlanarTapeGeometry.graph + (value A D (N,QuantumSpatialInputTape.input I)) hn).Edge ≤ m+9*r := by + let P := I.model.portRouteData hA I.model_degree + let s := (QuantumSpatialPortProgram.value A D (N,QuantumSpatialInputTape.input I)).1 + obtain ⟨hs,hC,hcount⟩ := QuantumSpatialPortProgram.value_bounds I hA hN hL hT hc + obtain ⟨σ,τ,hsite,_⟩ := sites_positions_order I hA N + let site := fun i a => σ.symm (P.crossingSiteFin N (length_bound I hA) (τ i) a) + have hsi (i) : Function.Injective (site i) := by + intro a b hab + exact P.crossingSiteFin_injective N (length_bound I hA) (τ i) (σ.symm.injective hab) + let H := QuantumListSchedule.graph s hs + let S := H.crossingSelection site hsi + have hx : (value A D (N,QuantumSpatialInputTape.input I)).1.1 = + QuantumCrossingListLayer.value + (QuantumCrossingListLayer.actualInput (computedLayer S (Equiv.refl _)) N (Equiv.refl _)) := by + have hp := QuantumListSchedule.graph_packed s hs + have h := compiled_packet S (Equiv.refl _) N + have hh := congrArg (fun bs => QuantumCrossingSelectProgram.value + (N,(s.1,bs,s.2.1),List.ofFn (encodedSites site))) hp.symm + have hv := congrArg QuantumCrossingListLayer.value (hh.trans h) + change QuantumCrossingListLayer.value (QuantumCrossingSelectProgram.value + (N,oldPacket A D (N,QuantumSpatialInputTape.input I), + sites A D (N,QuantumSpatialInputTape.input I))) = _ + rw [hsite] + exact hv + have hm : Fintype.card H.Edge ≤ 3^(QuantumSpatialPortProgram.rounds A D)*Fintype.card I.model.Term := by + simpa only [H,QuantumListSchedule.graph,Fintype.card_fin] using hcount + have hB : 1 ≤ iterated (Fintype.card I.model.Term) L T (QuantumSpatialPortProgram.rounds A D) := + iterated_one hL _ _ _ + have h := compiled_planar_nat S (Equiv.refl _) hN hm hB hT hC + (value A D (N,QuantumSpatialInputTape.input I)) hx hn + have hr : (cells A D (N,QuantumSpatialInputTape.input I)).length = P.crossingCells.card := + (Fintype.card_fin _).symm.trans ((Fintype.card_congr τ).trans (Fintype.card_fin _)) + simpa only [hr] using h + +end ContinuumCoulomb.QuantumSpatialCrossingProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialPlanarRealization.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialPlanarRealization.lean new file mode 100644 index 0000000000000000000000000000000000000000..4fbe98f06be6ea651b909caad52f76354d7d3f1a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialPlanarRealization.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPortPlanarRealization +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingSize +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedPortRealization +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedSourceCells + +namespace OAI + +/-! Every actual degree-three spatial exchange model has a nearest-neighbor +square-lattice realization. The number of layers and the size factor depend +only on its fixed spatial-density constants. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical +namespace QMASpatialExchangeModel +variable {A B : ℕ} (M : QMASpatialExchangeModel A B) + +theorem placedVertex_positive (v : Fin M.n) : + 0 < (M.placedVertex v).1 ∧ 0 < (M.placedVertex v).2 := by + change 0 < 8*(9*B+3+6)*(M.routeVertex v).1+17 ∧ + 0 < 8*(9*B+3+6)*(M.routeVertex v).2+17 + omega + +theorem planar_realize (hA : 0 < A) + (hd : ∀ v, qmaGraphDegree M.left M.right v ≤ 3) {N : ℚ} (hN : 0 < N) : + ∃ (H : QMARationalExchangeGraph) (position : Fin H.n → ℕ × ℕ), + Function.Injective position ∧ + (∀ v, (position v).1 < 256*M.bufferedWidth ∧ (position v).2 < 256*M.bufferedHeight) ∧ + (∀ e, qmaSquareGrid.Adj (position (H.left e)) (position (H.right e))) ∧ + (∀ v, qmaGraphDegree H.left H.right v ≤ 4) ∧ + H.n+Fintype.card H.Edge ≤ + (5^81*(5^(routeLengthBound A B)+11*routeLengthBound A B))*(M.n+Fintype.card M.Term) ∧ + |H.energy-M.energy| ≤ ((routeLengthBound A B+82:ℕ):ℝ)/(N:ℝ) := by + let P := M.portRouteData hA hd + have hD : ∀ e, P.length e ≤ routeLengthBound A B := M.bufferedPath_length hd + have hpath : ∀ e k, k ≤ P.length e → + (P.point e k).1 < M.bufferedWidth ∧ (P.point e k).2 < M.bufferedHeight := by + intro e k _ + exact M.bufferedPath_bounds hd e ((M.bufferedPath hd e).val.getVert_mem_support k) + obtain ⟨H,pos,hinj,hbox,hgrid,hdegree,hsize,herr⟩ := + P.planar_realize hN hD (M.sourceCell_no_passage hA hd) + M.placedVertex_positive M.placedVertex_bounds hpath + refine ⟨H,pos,hinj,hbox,hgrid,hdegree,?_,herr⟩ + have hs := Nat.mul_le_mul_left (5^81) (P.mergedOutput_size N hD) + exact hsize.trans (by simpa only [Nat.mul_assoc] using hs) + +end QMASpatialExchangeModel +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialPortBounds.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialPortBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..49b5192c2597af2bc3905230c1d9b2c82589057e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialPortBounds.lean @@ -0,0 +1,91 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialPortProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListScheduleBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCoefficientPrograms + +namespace OAI + +/-! Coefficient and edge-count bounds for the actual port schedule tape. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumPackedSchedule +open QuantumListSchedule + +theorem state_coefficientBound (G : QMARationalExchangeGraph) {m : ℕ} + (labels : G.Edge ≃ Fin m) (work : G.Edge → ℕ) {L : ℝ} + (hc : G.CoefficientBound L) : + (graph (state G labels work) (valid G labels work)).CoefficientBound L := by + constructor + · exact hc.1 + · intro i + change |(((List.ofFn (fun j : Fin m => (work (labels.symm j), + (G.left (labels.symm j)).val,(G.right (labels.symm j)).val,G.weight (labels.symm j)))).get i).2.2.2:ℝ)| ≤ L + have he := List.get_ofFn (fun j : Fin m => (work (labels.symm j), + (G.left (labels.symm j)).val,(G.right (labels.symm j)).val,G.weight (labels.symm j))) i + exact (congrArg (fun e : QuantumListSchedule.Entry => |(e.2.2.2:ℝ)|) he).le.trans (hc.2 _) + +end ContinuumCoulomb.QuantumPackedSchedule + +namespace ContinuumCoulomb.QuantumSpatialPortProgram +open QuantumForkList QuantumListSchedule +open scoped Classical + +variable {rows width A D : ℕ} (I : SpatialInput rows width A D) + (hA : 0 < spatialDensity A D) +include hA + +theorem initial_count : (initial A D (QuantumSpatialInputTape.input I)).1.2.2.length = + Fintype.card I.model.Term := by + have h := congrArg (fun s : QuantumListSchedule.State => s.2.2.length) + (QuantumPortSchedulePacking.state_eq I hA) + have hc : Fintype.card I.model.Term = (QuantumForkList.fullList I.state).length := + Fintype.card_fin _ + exact (h.trans (List.length_ofFn)).trans hc.symm + +theorem initial_coefficientBound (hs : Valid (initial A D (QuantumSpatialInputTape.input I)).1) + {L : ℝ} (hc : I.model.exchangeGraph.CoefficientBound L) : + (graph (initial A D (QuantumSpatialInputTape.input I)).1 hs).CoefficientBound L := by + have he := QuantumPortSchedulePacking.state_eq I hA + have h := QuantumPackedSchedule.state_coefficientBound I.model.exchangeGraph (Equiv.refl _) + (I.model.coarseLength I.model_degree) hc + have transfer (t : QuantumListSchedule.State) (ht : Valid t) + (e : t = QuantumPackedSchedule.state I.model.exchangeGraph (Equiv.refl _) + (I.model.coarseLength I.model_degree)) : (graph t ht).CoefficientBound L := by + subst t + exact h + exact transfer _ hs he + +theorem value_bounds {N : ℚ} (hN : 0 ≤ N) {L T : ℕ} (hL : 1 ≤ L) + (hT : |(N:ℝ)| ≤ T) (hc : I.model.exchangeGraph.CoefficientBound L) : + ∃ hs : Valid (value A D (N,QuantumSpatialInputTape.input I)).1, + (graph (value A D (N,QuantumSpatialInputTape.input I)).1 hs).CoefficientBound + (QuantumCoefficientPrograms.iterated (Fintype.card I.model.Term) L T (rounds A D)) ∧ + (value A D (N,QuantumSpatialInputTape.input I)).1.2.2.length ≤ + 3^(rounds A D)*Fintype.card I.model.Term := by + let s := (initial A D (QuantumSpatialInputTape.input I)).1 + have hs : Valid s := QuantumPortSchedulePacking.valid I hA + have hm : (s.2.2.length:ℝ) ≤ Fintype.card I.model.Term := by + exact_mod_cast (initial_count I hA).le + have hbound := iterate_coefficientBound hN s hs (L := (L:ℝ)) (T := (T:ℝ)) hm (by exact_mod_cast hL) hT + (initial_coefficientBound I hA hs hc) (rounds A D) + have hlen := iterate_edge_count N s (rounds A D) + change (QuantumListSchedule.iterate N (rounds A D) s).2.2.length ≤ + 3^(rounds A D)*(initial A D (QuantumSpatialInputTape.input I)).1.2.2.length at hlen + rw [initial_count I hA] at hlen + have he : (value A D (N,QuantumSpatialInputTape.input I)).1 = + QuantumListSchedule.iterate N (rounds A D) s := + QuantumListRouteProgram.iterate_state N (initial A D (QuantumSpatialInputTape.input I)) (rounds A D) + refine ⟨he.symm ▸ iterate_valid N s hs (rounds A D),?_,?_⟩ + · have transfer (t : QuantumListSchedule.State) (ht : Valid t) + (e : t = QuantumListSchedule.iterate N (rounds A D) s) : + (graph t ht).CoefficientBound + (QuantumCoefficientPrograms.iterated (Fintype.card I.model.Term) L T (rounds A D)) := by + subst t + simpa only [QuantumCoefficientPrograms.iterated_cast] using hbound + exact transfer _ _ he + · exact (congrArg (fun t : QuantumListSchedule.State => t.2.2.length) he).le.trans hlen + +end ContinuumCoulomb.QuantumSpatialPortProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialPortMatching.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialPortMatching.lean new file mode 100644 index 0000000000000000000000000000000000000000..a86dcad27934335ce0664ae1235c2e703a875533 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialPortMatching.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialPortProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumListRouteMatching + +namespace OAI + +/-! Exact geometric matching for the actual spatial compiler. Its position +tape is a permutation of the canonical completed port graph. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumSpatialPortProgram +open QuantumForkList +open scoped Classical + +theorem port_layout_matches {A B : ℕ} (M : QMASpatialExchangeModel A B) {m : ℕ} (labels : M.Term ≃ Fin m) + (hA : 0 I.model.bufferedPath_bounds I.model_degree e + ((I.model.bufferedPath I.model_degree e).val.getVert_mem_support i)) k + (by have := List.mem_range.mp hk; omega) + +theorem initial_work : ∀ e ∈ (initial A D (QuantumSpatialInputTape.input I)).1.2.2, + e.1 ≤ rounds A D := by + intro e he + change e ∈ (QuantumPortScheduleTape.value _ _ (QuantumPortScheduleActual.tape I)).1.2.2 at he + rw [QuantumPortScheduleActual.entries_actual I hA] at he + obtain ⟨i,rfl⟩ := List.mem_ofFn.mp he + rw [← rounds_eq] + exact I.model.bufferedPath_length I.model_degree i + +theorem realizes {N : ℚ} (hN : 0 < N) : + ∃ (hs : QuantumListSchedule.Valid (value A D (N,QuantumSpatialInputTape.input I)).1) + (P : QMAPathEmbedding + (QuantumListSchedule.schedule (value A D (N,QuantumSpatialInputTape.input I)).1 hs) + (I.model.portGraph I.model_degree)), + QuantumListRouteProgram.Represents (value A D (N,QuantumSpatialInputTape.input I)) hs P ∧ + P.Bounded (32*I.model.bufferedWidth) (32*I.model.bufferedHeight) ∧ + (∀ e, (I.model.portGraph I.model_degree).Adj + (P.position ((QuantumListSchedule.schedule _ hs).graph.left e)) + (P.position ((QuantumListSchedule.schedule _ hs).graph.right e))) ∧ + (value A D (N,QuantumSpatialInputTape.input I)).1.1+ + (value A D (N,QuantumSpatialInputTape.input I)).1.2.2.length ≤ + 5^(rounds A D)*((initial A D (QuantumSpatialInputTape.input I)).1.1+ + (initial A D (QuantumSpatialInputTape.input I)).1.2.2.length) ∧ + |QuantumListSchedule.energy (value A D (N,QuantumSpatialInputTape.input I)).1- + I.model.energy| ≤ (rounds A D:ℝ)/(N:ℝ) := by + obtain ⟨hs,P,hP,hbox⟩ := initial_bounded I hA + obtain ⟨hs',Q,hQ,hQbox,hadj,hsize,henergy⟩ := + QuantumListRouteProgram.compile_realization hN _ hs P hP (initial_work I hA) hbox + refine ⟨hs',Q,hQ,hQbox,hadj,hsize,?_⟩ + exact (QuantumPortSchedulePacking.energy I hA) ▸ henergy + +end ContinuumCoulomb.QuantumSpatialPortProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialPrivate.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialPrivate.lean new file mode 100644 index 0000000000000000000000000000000000000000..4a13b85105ee83f7cd766d8786c956e69c66e16c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialPrivate.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialXZBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPrivateSupported + +namespace OAI + +/-! Private-pair subdivision preserves bounded spatial density. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators Classical + +theorem QMASpatialXZModel.private {A B : ℕ} (M : QMASpatialXZModel A B) + {N : ℝ} (hN : 1 ≤ N) : + ∃ G : QMASpatialXZModel (A+B) (4*B), + (∀ p q, (qmaPauliSupport (G.word p)).card = 2 → + qmaPauliSupport (G.word p) = qmaPauliSupport (G.word q) → p = q) ∧ + |G.toQMAXZModel.energy-M.toQMAXZModel.energy| ≤ 1/N ∧ + G.rows = M.rows ∧ G.width = M.width := by + obtain ⟨v,K,hvy,hv,hprivate,hvs,he⟩ := + qmaXZPrivate_supported M.word M.coefficient M.card M.noY hN + let cell := qmaMediatorCell M.cell M.anchor + let anchor := fun p : M.Term × Fin 4 => M.anchor p.1 + let G : QMASpatialXZModel (A+B) (4*B) := { + toQMAXZModel := QMAXZModel.ofWords v K hvy hv + rows := M.rows + width := M.width + cell := cell + anchor := anchor + geometry := by + intro e q hq + exact qmaMediatorSupport_geometry M.cell M.anchor (qmaPauliSupport (M.word e.1)) e.1 + (M.geometry e.1) q (hvs e hq) + qubitDensity := by + intro p + change (Finset.univ.filter (fun q : M.Q ⊕ M.Term => cell q = p)).card ≤ _ + rw [qmaSumFilter_card] + exact Nat.add_le_add (M.qubitDensity p) (M.termDensity p) + termDensity := by + intro p + change (Finset.univ.filter (fun e : M.Term × Fin 4 => M.anchor e.1 = p)).card ≤ _ + rw [qmaProdFilter_card (α := M.Term) 4 (fun e => M.anchor e = p)] + exact Nat.mul_le_mul_left 4 (M.termDensity p) } + refine ⟨G,hprivate,?_,rfl,rfl⟩ + change |(QMAXZModel.ofWords v K hvy hv).energy-M.toQMAXZModel.energy| ≤ 1/N + rw [QMAXZModel.ofWords_energy] + exact he + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialPropagation.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialPropagation.lean new file mode 100644 index 0000000000000000000000000000000000000000..55ace64d7668840a9c283ba456dd902e141898c5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialPropagation.lean @@ -0,0 +1,36 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridCoordinates + +namespace OAI + +/-! Every actual propagation interaction is contained near its computation-gate anchor. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +theorem qmaSparsePropagation_cell (c : QMACircuit) (hc : c.WellFormed) + (hT : 0 < (qmaSparseCircuit c).gates.length) (t : Fin (qmaSparseCircuit c).gates.length) + (k : QMACircuitQubit (qmaSparseCircuit c)) (hk : k ∈ qmaPropagationSites (qmaSparseCircuit c) t) : + QMAGridCellsNear (qmaSparseQubitCell c hT k) (qmaSparseGateCell c t) := by + cases k with + | inl b => + have hb : b = qmaClockLeft _ t ∨ b = qmaClockMiddle _ t ∨ b = qmaClockRight _ t := by + simpa [qmaPropagationSites] using hk + rcases hb with rfl | rfl | rfl + · exact qmaSparseClockCells_near_gate c hT t _ ⟨le_rfl,by simp [qmaClockLeft]⟩ + · apply qmaSparseClockCells_near_gate c hT t + simp [qmaClockMiddle] + · apply qmaSparseClockCells_near_gate c hT t + simp [qmaClockRight] + | inr i => + apply qmaSparseWorkCell_near_gate c hc t i + have hi : i ∈ qmaGateSites (qmaSparseCircuit c).work + ((qmaSparseCircuit c).gates.getD t.val (.hadamard 0)) := by + simpa [qmaPropagationSites] using hk + simpa only [List.getD_eq_getElem _ _ t.isLt] using hi + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialRational.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialRational.lean new file mode 100644 index 0000000000000000000000000000000000000000..a28b39eaf31feb9603ababf156edc96367761467 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialRational.lean @@ -0,0 +1,30 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialXZBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliRounding + +namespace OAI + +/-! Rational coefficient approximation retains every spatial support and density bound. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +def QMASpatialXZModel.withCoefficients {A B : ℕ} (M : QMASpatialXZModel A B) + (K : M.Term → ℝ) : QMASpatialXZModel A B := + { M with coefficient := K } + +theorem QMASpatialXZModel.round_energy {A B : ℕ} (M : QMASpatialXZModel A B) + (N : ℕ) (hN : 0 < N) : + let m := (Fintype.card M.Term+1)*N + |(M.withCoefficients (fun e => (qmaRationalRound m (M.coefficient e):ℝ))).toQMAXZModel.energy- + M.toQMAXZModel.energy| ≤ 1/(N:ℝ) := by + have h := qmaPauliFamily_round_accuracy M.word M.coefficient N hN + dsimp only at h ⊢ + rw [abs_sub_comm] + exact h + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialReference.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialReference.lean new file mode 100644 index 0000000000000000000000000000000000000000..ff1a2962067369f77b3ee91cfc2664cf58116a7b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialReference.lean @@ -0,0 +1,64 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedModel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialTerms +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumReferenceCongestion + +namespace OAI + +/-! All terms of the real reference model are localized in the actual clock grid. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +theorem qmaGridCellsNear_refl {rows width : ℕ} (p : QMAGridCell rows width) : + QMAGridCellsNear p p := by + unfold QMAGridCellsNear + omega + +theorem qmaGridCellsNear_symm {rows width : ℕ} {p q : QMAGridCell rows width} + (h : QMAGridCellsNear p q) : QMAGridCellsNear q p := + ⟨h.2.1,h.1,h.2.2.2,h.2.2.1⟩ + +def qmaOrderedQubitCell (c : QMACircuit) (hT : 0 < (qmaSparseCircuit c).gates.length) : + Fin (qmaHistoryReferenceWork (qmaSparseCircuit c)+1) ⊕ QMACircuitQubit (qmaSparseCircuit c) → + QMAGridCell (qmaNearestCircuit c).gates.length c.work := + Sum.elim (qmaOrderedSparseReferenceCell c hT) (qmaSparseQubitCell c hT) + +def qmaOrderedTermCell (c : QMACircuit) (hT : 0 < (qmaSparseCircuit c).gates.length) : + QMAReferenceTerm (qmaHistoryReferenceWork (qmaSparseCircuit c)) → + QMAGridCell (qmaNearestCircuit c).gates.length c.work + | .inl i => qmaOrderedSparseReferenceCell c hT i + | .inr i => qmaOrderedSparseReferenceCell c hT i.castSucc + +theorem qmaOrderedHistoryModel_spatial (c : QMACircuit) (hc : c.WellFormed) + (hT : 0 < (qmaSparseCircuit c).gates.length) + (hne : (qmaNearestCircuit c).gates ≠ []) + (a : QMAReferenceTerm (qmaHistoryReferenceWork (qmaSparseCircuit c))) + (k : Fin (qmaHistoryReferenceWork (qmaSparseCircuit c)+1) ⊕ QMACircuitQubit (qmaSparseCircuit c)) + (hk : k ∈ (qmaOrderedHistoryModel (qmaSparseCircuit c) hT).sites a) : + QMAGridCellsNear (qmaOrderedQubitCell c hT k) (qmaOrderedTermCell c hT a) := by + change k ∈ qmaReferenceTermSites _ (qmaOrderedHistorySites (qmaSparseCircuit c) hT) a at hk + cases a with + | inl i => + cases k with + | inl j => + have he : j = i := by + simpa [qmaReferenceTermSites,qmaDistributedRebitSites] using hk + subst j + exact qmaGridCellsNear_refl _ + | inr k => + have hk' : k ∈ qmaOrderedHistorySites (qmaSparseCircuit c) hT i := by + simpa [qmaReferenceTermSites,qmaDistributedRebitSites] using hk + exact qmaSparseHistoryTerm_cell c hc hT hne _ k hk' + | inr i => + have hk' : k = .inl i.castSucc ∨ k = .inl i.succ := by + simpa [qmaReferenceTermSites,qmaReferenceEdgeSites] using hk + rcases hk' with rfl | rfl + · exact qmaGridCellsNear_refl _ + · exact qmaGridCellsNear_symm (qmaOrderedSparseReferenceCell_near c hT i) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialReindex.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialReindex.lean new file mode 100644 index 0000000000000000000000000000000000000000..ec6de792329eb41dae4f2d5a8bcb419f7e38d078 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialReindex.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialTotal + +namespace OAI + +/-! Finite qubit relabeling preserves the spatial data and the exact Hamiltonian spectrum. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {Q R : Type*} [Fintype Q] [DecidableEq Q] [Fintype R] [DecidableEq R] + +def qmaQubitBasisEquiv (e : Q ≃ R) : (R → Fin 2) ≃ (Q → Fin 2) := + Equiv.arrowCongr e.symm (Equiv.refl (Fin 2)) + +omit [DecidableEq Q] [DecidableEq R] in +theorem qmaPauliWord_relabel (e : Q ≃ R) (w : Q → Fin 4) : + qmaPauliWord (w ∘ e.symm) = + (qmaPauliWord w).submatrix (qmaQubitBasisEquiv e) (qmaQubitBasisEquiv e) := by + ext s t + change (∏ r, qmaPauli (w (e.symm r)) (s r) (t r)) = + ∏ q, qmaPauli (w q) (s (e q)) (t (e q)) + exact Fintype.prod_equiv e.symm _ _ (by intro r; simp) + +omit [DecidableEq Q] [DecidableEq R] in +theorem qmaPauliSupport_relabel (e : Q ≃ R) (w : Q → Fin 4) : + qmaPauliSupport (w ∘ e.symm) = (qmaPauliSupport w).map e.toEmbedding := by + ext r + simp only [Finset.mem_map_equiv,qmaPauliSupport,Finset.mem_filter,Finset.mem_univ,true_and] + rfl + +def QMASpatialXZModel.reindex {A B : ℕ} (M : QMASpatialXZModel A B) + {R : Type} [Fintype R] [DecidableEq R] (e : M.Q ≃ R) : QMASpatialXZModel A B where + toQMAXZModel := QMAXZModel.ofWords (fun a => M.word a ∘ e.symm) M.coefficient + (fun a r => M.noY a (e.symm r)) + (fun a => by rw [qmaPauliSupport_relabel,Finset.card_map]; exact M.card a) + rows := M.rows + width := M.width + cell r := M.cell (e.symm r) + anchor := M.anchor + geometry := by + intro a r hr + apply M.geometry a (e.symm r) + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,(Finset.mem_filter.mp hr).2⟩ + qubitDensity := by + intro p + change (Finset.univ.filter (fun r : R => M.cell (e.symm r) = p)).card ≤ A + have he : (Finset.univ.filter (fun r : R => M.cell (e.symm r) = p)).card = + (Finset.univ.filter (fun q : M.Q => M.cell q = p)).card := by + apply Finset.card_equiv e.symm + intro r + simp only [Finset.mem_filter,Finset.mem_univ,true_and] + rw [he] + exact M.qubitDensity p + termDensity := M.termDensity + +theorem QMASpatialXZModel.reindex_energy {A B : ℕ} (M : QMASpatialXZModel A B) + {R : Type} [Fintype R] [DecidableEq R] (e : M.Q ≃ R) : + (M.reindex e).toQMAXZModel.energy = M.toQMAXZModel.energy := by + change MediatorGraph.normalizedBottom (∑ a, (M.coefficient a:ℂ) • qmaPauliWord (M.word a ∘ e.symm)) = _ + simp only [qmaPauliWord_relabel] + have hs : (∑ a, (M.coefficient a:ℂ) • + (qmaPauliWord (M.word a)).submatrix (qmaQubitBasisEquiv e) (qmaQubitBasisEquiv e)) = + (∑ a, (M.coefficient a:ℂ) • qmaPauliWord (M.word a)).submatrix + (qmaQubitBasisEquiv e) (qmaQubitBasisEquiv e) := by + ext s t + simp only [Matrix.sum_apply,Matrix.smul_apply,Matrix.submatrix_apply] + rw [hs] + exact MediatorGraph.normalizedBottom_reindex (qmaQubitBasisEquiv e) _ + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialRoutingTape.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialRoutingTape.lean new file mode 100644 index 0000000000000000000000000000000000000000..f1339453f676a8553225c68d52d6a448c45375e3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialRoutingTape.lean @@ -0,0 +1,36 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialInputTape +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingFamily + +namespace OAI + +/-! The literal initial/fork program supplies the same source-center and +coarse-path arrays used by the actual lattice crossing construction. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumSpatialRoutingTape +open QuantumForkList ExactQuantumFactoring.BitStackProgram + +def value (A D : ℕ) (x : QuantumForkGridProgram.PreparedInput) : QuantumPathTable.Input := + QuantumRoutingFamily.table (spatialDensity A D) (27*spatialDensity A D) + (QuantumForkRoutingData.value (QuantumForkGridProgram.output D x)) + +noncomputable opaque program (A D : ℕ) : + Procedure QuantumForkGridProgram.preparedCode QuantumPathTable.inputCode (value A D) := + (QuantumRoutingFamily.tableProgram (spatialDensity A D) (27*spatialDensity A D)).comp + (QuantumForkRoutingData.program.comp (QuantumForkGridProgram.outputProgram D)) + +theorem value_actual {rows width A D : ℕ} (I : SpatialInput rows width A D) + (hA : 0 < spatialDensity A D) : + value A D (QuantumSpatialInputTape.input I) = + (List.ofFn I.model.placedVertex, + List.ofFn (fun e : I.model.Term => (I.model.portRouteData hA I.model_degree).routeList e)) := by + unfold value + rw [QuantumSpatialInputTape.routing_eq] + have h := QuantumRoutingFamily.table_actual I.model (Equiv.refl _) hA I.model_degree + exact h + +end ContinuumCoulomb.QuantumSpatialRoutingTape + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialSlotProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialSlotProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..cf51c667585f74784e6bf8546ca4bc0434ec57de --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialSlotProgram.lean @@ -0,0 +1,80 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrdinalProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrdinalSpatial +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedEndpointWalk + +namespace OAI + +/-! The actual fine-grid positions and lane colors of the ordinal-slot model +are computed directly from encoded lists of cells. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumSpatialSlotProgram +open ExactQuantumFactoring.BitStackProgram QuantumRouteCode QuantumOrdinalProgram + +def fineSite (A : ℕ) (x : Input) : Pair := + let p := QuantumPathVisitProgram.lookup x.2 x.1 + (value x+A*p.1,p.2) + +def lane (B : ℕ) (x : Input) : ℕ := + let p := QuantumPathVisitProgram.lookup x.2 x.1 + value x+B*(p.2%3)+(3*B)*(p.1%3) + +noncomputable def cellProgram : Procedure inputCode pairCode + (fun x => QuantumPathVisitProgram.lookup x.2 x.1) := + (Procedure.listGet pairCode (0,0)).comp + ((Procedure.unaryToBits.comp (Procedure.first unaryCode (listCode pairCode))).pair + (Procedure.second unaryCode (listCode pairCode))) + +noncomputable def fineSiteProgram (A : ℕ) : Procedure inputCode pairCode (fineSite A) := by + let p := cellProgram + let row := (Procedure.first Nat.bits Nat.bits).comp p + let col := (Procedure.second Nat.bits Nat.bits).comp p + let rank := Procedure.unaryToBits.comp QuantumOrdinalProgram.program + let x := Procedure.binaryAdd.comp (rank.pair + (Procedure.binaryMul.comp ((Procedure.constant inputCode Nat.bits A).pair row))) + exact x.pair col + +noncomputable def laneProgram (B : ℕ) : Procedure inputCode Nat.bits (lane B) := by + let p := cellProgram + let row := (Procedure.first Nat.bits Nat.bits).comp p + let col := (Procedure.second Nat.bits Nat.bits).comp p + let rem (v : Procedure inputCode Nat.bits (fun x => + (QuantumPathVisitProgram.lookup x.2 x.1).1)) := + Procedure.binaryMod.comp (v.pair (Procedure.constant inputCode Nat.bits 3)) + let rowTerm := Procedure.binaryMul.comp + ((Procedure.constant inputCode Nat.bits (3*B)).pair (rem row)) + let colTerm := Procedure.binaryMul.comp ((Procedure.constant inputCode Nat.bits B).pair + (Procedure.binaryMod.comp (col.pair (Procedure.constant inputCode Nat.bits 3)))) + let rank := Procedure.unaryToBits.comp QuantumOrdinalProgram.program + exact Procedure.binaryAdd.comp ((Procedure.binaryAdd.comp (rank.pair colTerm)).pair rowTerm) + +theorem colorEquiv_val {B : ℕ} (c : Fin 3 × Fin 3 × Fin B) : + (qmaGridColorEquiv B c).val = c.2.2.val+B*c.2.1.val+(3*B)*c.1.val := by + rfl + +theorem fineSite_actual {A B : ℕ} (M : QMASpatialExchangeModel A B) + {m : ℕ} (labels : M.Term ≃ Fin m) (q : Fin M.n) : + fineSite A (q.val,List.ofFn (QuantumOrdinalPlacement.coordinates M.cell)) = + (M.withOrdinalSlots labels).routeVertex q := by + unfold fineSite + rw [lookup_ofFn,value_ofFn] + rfl + +theorem lane_actual {A B : ℕ} (M : QMASpatialExchangeModel A B) + {m : ℕ} (labels : M.Term ≃ Fin m) (e : M.Term) : + lane B ((labels e).val, + List.ofFn (QuantumOrdinalPlacement.coordinates (M.anchor ∘ labels.symm))) = + ((M.withOrdinalSlots labels).laneColor e).val := by + unfold lane + rw [lookup_ofFn,value_ofFn] + change _ = (qmaGridColorEquiv B ((M.withOrdinalSlots labels).termSlots.color e)).val + rw [colorEquiv_val] + simp only [QMASpatialExchangeModel.withOrdinalSlots,QMACellSlots.color, + QMACellSlots.transport,QuantumOrdinalPlacement.slots,QuantumOrdinalPlacement.coordinates, + Function.comp_apply,Equiv.symm_apply_apply] + +end ContinuumCoulomb.QuantumSpatialSlotProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialSourcePromise.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialSourcePromise.lean new file mode 100644 index 0000000000000000000000000000000000000000..78d28fd6ce806ee7da6947c6046a6cb15b30aca5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialSourcePromise.lean @@ -0,0 +1,66 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialPlanarBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialFinalCount +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEvenTapeOutputBounds + +namespace OAI + +/-! Polynomial promise of the actual emitted lattice packet from the +fixed spatial graph, using its uniform coefficient and geometric bounds. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumFinalRoutingProgram +open QuantumForkList QuantumCoefficientPrograms +open scoped Classical + +theorem spatial_polynomialPromise {rows width A D : ℕ} (I : SpatialInput rows width A D) + (hA : 0 < spatialDensity A D) {N : ℚ} (hN : 0 < N) + {L T n k : ℕ} (hn : 0 < I.model.n) (hsize : n ≤ I.model.n) + (hL : 1 ≤ L) (hT : |(N:ℝ)| ≤ T) (hc : I.model.exchangeGraph.CoefficientBound L) + (a b : ℚ) (hab : a < b) + (hx : (256*I.model.bufferedWidth:ℕ) ≤ (n+1:ℝ)^k) + (hy : (256*I.model.bufferedHeight:ℕ) ≤ (n+1:ℝ)^k) + (hw : (latticeBound (QuantumSpatialPortProgram.rounds A D) (Fintype.card I.model.Term) + (I.model.portRouteData hA I.model_degree).crossingCells.card L T:ℝ) ≤ (n+1:ℝ)^k) + (hgap : ((n+1:ℝ)^k)⁻¹ ≤ (b:ℝ)-a) : + (value A D ((N,QuantumSpatialInputTape.input I),a,b)).PolynomialPromise k := by + let P := I.model.portRouteData hA I.model_degree + let x := QuantumSpatialCrossingProgram.value A D (N,QuantumSpatialInputTape.input I) + have hg := QuantumSpatialCrossingProgram.packet_geometry I hA N + have hp : ∀ e j, j ≤ P.length e → + (P.point e j).1 < I.model.bufferedWidth ∧ (P.point e j).2 < I.model.bufferedHeight := by + intro e j _ + exact I.model.bufferedPath_bounds I.model_degree e + ((I.model.bufferedPath I.model_degree e).val.getVert_mem_support j) + obtain ⟨R,hinput,hR,hbox⟩ := QuantumPlanarTapeGeometry.planar_family P N + (QuantumSpatialCrossingProgram.length_bound I hA) x hg + (QuantumSpatialCrossingProgram.table_permission I hA N) + (I.model.sourceCell_no_passage hA I.model_degree) I.model.placedVertex_positive + I.model.placedVertex_bounds hp + let m₁ := 3^(QuantumSpatialPortProgram.rounds A D)*Fintype.card I.model.Term + let B := iterated (Fintype.card I.model.Term) L T (QuantumSpatialPortProgram.rounds A D) + let m₂ := m₁+9*P.crossingCells.card + let C := (m₂+1)*crossingCoefficient m₁ P.crossingCells.card ((m₁+1)*B) T + obtain ⟨hC,hm⟩ := QuantumSpatialCrossingProgram.planar_bounds I hA hN.le hL hT hc hg.noLoops + have hnR : 0 < (QuantumPlanarTapeGeometry.graph x hg.noLoops).n := + hn.trans_le (spatial_crossing_count_le I hA N) + have hsR : n ≤ (QuantumPlanarTapeGeometry.graph x hg.noLoops).n := + hsize.trans (spatial_crossing_count_le I hA N) + have hC1 : 1 ≤ C := by + have h := crossingCoefficient_one m₁ P.crossingCells.card ((m₁+1)*B) T + exact Nat.mul_le_mul (Nat.succ_le_succ (Nat.zero_le m₂)) h + have hC' : (QuantumPlanarTapeGeometry.graph x hg.noLoops).CoefficientBound (C:ℝ) := by + simpa only [C,m₂,m₁,B,Nat.cast_mul,Nat.cast_add,Nat.cast_one,Nat.cast_ofNat] using hC + have h := QuantumEvenTapeGeometry.output_polynomialPromise R (Equiv.refl _) + hN hR hbox hnR hm hC1 hT hC' hsR a b hab + (by simpa only [← Nat.mul_assoc,show 8*32=256 by decide] using hx) + (by simpa only [← Nat.mul_assoc,show 8*32=256 by decide] using hy) + (show ((3^81*m₂+1)*iterated (3*m₂) (pathCoefficient m₂ C T) T 80:ℕ) ≤ + (n+1:ℝ)^k from hw) hgap + rw [← hinput] at h + exact h + +end ContinuumCoulomb.QuantumFinalRoutingProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialSubdivision.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialSubdivision.lean new file mode 100644 index 0000000000000000000000000000000000000000..92b82bc9933beff7227ad9c75e616af76537e53f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialSubdivision.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumMediatorGeometry +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliCongestion + +namespace OAI + +/-! Subdivision preserves the grid and bounded density with explicit constant factors. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators Classical + +theorem qmaProdFilter_card {α : Type*} [Fintype α] (n : ℕ) (p : α → Prop) [DecidablePred p] : + (Finset.univ.filter (fun q : α × Fin n => p q.1)).card = + n*(Finset.univ.filter p).card := by + have he : (Finset.univ.filter (fun q : α × Fin n => p q.1)) = + (Finset.univ.filter p) ×ˢ (Finset.univ : Finset (Fin n)) := by + ext q + simp + rw [he,Finset.card_product] + simp only [Finset.card_univ,Fintype.card_fin,Nat.mul_comm] + +theorem QMASpatialModel.subdivision {d A B : ℕ} (M : QMASpatialModel (2*d) A B) + {N : ℝ} (hN : 1 ≤ N) : + ∃ G : QMASpatialModel (d+1) (A+4^(2*d)*B) (4*4^(2*d)*B), + |G.toQMARealLocalModel.energy-M.toQMARealLocalModel.energy| ≤ 1/N ∧ + G.rows = M.rows ∧ G.width = M.width := by + obtain ⟨F,hFH,hFR,hFS,hFE⟩ := qmaLocalSubdivision_supported M.matrix M.sites M.card + M.localOn M.hermitian M.real hN + choose S hSc hSl hSs using hFS + let cell := qmaMediatorCell M.cell (fun e : QMALocalEvenPauliTerm M.sites => M.anchor e.val.1) + let anchor := fun p : QMALocalEvenPauliTerm M.sites × Fin 4 => M.anchor p.1.val.1 + have hcount (p : QMAGridCell M.rows M.width) : + (Finset.univ.filter (fun e : QMALocalEvenPauliTerm M.sites => M.anchor e.val.1 = p)).card ≤ + 4^(2*d)*B := by + have h := qmaLocalEvenPauli_filter_card M.sites M.card (fun a => M.anchor a = p) + have hp := Nat.mul_le_mul_left (4^(2*d)) (M.termDensity p) + simpa only using h.trans hp + let G : QMASpatialModel (d+1) (A+4^(2*d)*B) (4*4^(2*d)*B) := { + toQMARealLocalModel := { + Q := M.Q ⊕ QMALocalEvenPauliTerm M.sites + Term := QMALocalEvenPauliTerm M.sites × Fin 4 + qFinite := inferInstance + qDecidable := inferInstance + termFinite := inferInstance + matrix := F + sites := S + localOn := hSl + card := hSc + hermitian := hFH + real := hFR } + rows := M.rows + width := M.width + cell := cell + anchor := anchor + geometry := by + intro p q hq + exact qmaMediatorSupport_geometry M.cell _ _ p.1 + (M.geometry p.1.val.1) q (hSs p hq) + qubitDensity := by + intro p + change (Finset.univ.filter (fun q : M.Q ⊕ QMALocalEvenPauliTerm M.sites => + cell q = p)).card ≤ _ + rw [qmaSumFilter_card] + exact Nat.add_le_add (M.qubitDensity p) (hcount p) + termDensity := by + intro p + change (Finset.univ.filter (fun q : QMALocalEvenPauliTerm M.sites × Fin 4 => + M.anchor q.1.val.1 = p)).card ≤ _ + rw [qmaProdFilter_card (α := QMALocalEvenPauliTerm M.sites) 4 (fun e => M.anchor e.val.1 = p)] + simpa only [Nat.mul_assoc] using Nat.mul_le_mul_left 4 (hcount p) } + exact ⟨G,hFE,rfl,rfl⟩ + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialTerms.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialTerms.lean new file mode 100644 index 0000000000000000000000000000000000000000..37f51f4a5f3441ea99a75138499322ff57f9df66 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialTerms.lean @@ -0,0 +1,64 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSparseEndpoint +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialClockTerms + +namespace OAI + +/-! Every term in the actual distributed history is near its ordered reference. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +theorem qmaSparseOutput_cell (c : QMACircuit) + (hT : 0 < (qmaSparseCircuit c).gates.length) + (k : QMACircuitQubit (qmaSparseCircuit c)) + (hk : k ∈ qmaCircuitTermSites (qmaSparseCircuit c) (.inr (.inr (.inr (.inl ()))))) : + QMAGridCellsNear (qmaSparseQubitCell c hT k) + (qmaSparseGateCell c (qmaBoundedClockTime _ hT (qmaSparseCircuit c).gates.length)) := by + have he : qmaBoundedClockTime _ hT (qmaSparseCircuit c).gates.length = + (⟨(qmaSparseCircuit c).gates.length-1,by omega⟩ : Fin (qmaSparseCircuit c).gates.length) := by + apply Fin.ext + change min _ (_-1) = _-1 + omega + have hk' : k = .inl (qmaOutputMarker (qmaSparseCircuit c)) ∨ + k = .inr (Fin.last (qmaSparseCircuit c).work) := by + simpa [qmaCircuitTermSites] using hk + rcases hk' with rfl | rfl + · rw [he] + apply qmaSparseClockCells_near_gate c hT + change (qmaSparseCircuit c).gates.length-1 ≤ (qmaSparseCircuit c).gates.length ∧ + (qmaSparseCircuit c).gates.length ≤ (qmaSparseCircuit c).gates.length-1+2 + omega + · change QMAGridCellsNear (qmaSparseWorkCell c (Fin.last (qmaSparseCircuit c).work)) _ + rw [he,qmaSparseWorkCell_last,qmaSparseGateCell_last c hT] + unfold QMAGridCellsNear + simp only [Fin.val_last] + omega + +theorem qmaSparseHistoryTerm_cell (c : QMACircuit) (hc : c.WellFormed) + (hT : 0 < (qmaSparseCircuit c).gates.length) + (hne : (qmaNearestCircuit c).gates ≠ []) (a : QMACircuitTerm (qmaSparseCircuit c)) + (k : QMACircuitQubit (qmaSparseCircuit c)) + (hk : k ∈ qmaDistributedTermSites (qmaSparseCircuit c) + (qmaFirstUseTime (qmaSparseCircuit c)) a) : + QMAGridCellsNear (qmaSparseQubitCell c hT k) + (qmaSparseGateCell c (qmaHistoryTermTime (qmaSparseCircuit c) hT + (qmaFirstUseTime (qmaSparseCircuit c)) a)) := by + rcases a with i | (b | (i | (u | t))) + · exact qmaSparseClockFault_cell c hT i k hk + · exact qmaSparseClockPin_cell c hT b k hk + · have hi := qmaSweepFirstUse_lt (qmaNearestCircuit c) hne i + have he := qmaBoundedClockTime_eq _ hT (⟨qmaFirstUse (qmaSparseCircuit c) i,hi⟩ : + Fin (qmaSparseCircuit c).gates.length) + change QMAGridCellsNear _ (qmaSparseGateCell c (qmaBoundedClockTime _ hT _)) + rw [he] + exact qmaSparseInput_cell c hc hT i hi k hk + · cases u + exact qmaSparseOutput_cell c hT k hk + · exact qmaSparsePropagation_cell c hc hT t k hk + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialThird.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialThird.lean new file mode 100644 index 0000000000000000000000000000000000000000..4454754a180e30b92d1792ac08fe15ba51631e38 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialThird.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialSubdivision +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalThirdSupported + +namespace OAI + +/-! The third-order gadget preserves the grid and bounded spatial density. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators Classical + +theorem QMASpatialModel.third {A B : ℕ} (M : QMASpatialModel 3 A B) + {N : ℝ} (hN : 1 ≤ N) : + ∃ G : QMASpatialModel 2 (A+4^3*B) (7*4^3*B), + |G.toQMARealLocalModel.energy-M.toQMARealLocalModel.energy| ≤ 1/N ∧ + G.rows = M.rows ∧ G.width = M.width := by + obtain ⟨F,hFH,hFR,hFS,hFE⟩ := qmaLocalThird_supported M.matrix M.sites M.card + M.localOn M.hermitian M.real hN + choose S hSc hSl hSs using hFS + let cell := qmaMediatorCell M.cell (fun e : QMALocalEvenPauliTerm M.sites => M.anchor e.val.1) + let anchor := fun p : QMALocalEvenPauliTerm M.sites × Fin 7 => M.anchor p.1.val.1 + have hcount (p : QMAGridCell M.rows M.width) : + (Finset.univ.filter (fun e : QMALocalEvenPauliTerm M.sites => M.anchor e.val.1 = p)).card ≤ + 4^3*B := by + have h := qmaLocalEvenPauli_filter_card M.sites M.card (fun a => M.anchor a = p) + have hp := Nat.mul_le_mul_left (4^3) (M.termDensity p) + simpa only using h.trans hp + let G : QMASpatialModel 2 (A+4^3*B) (7*4^3*B) := { + toQMARealLocalModel := { + Q := M.Q ⊕ QMALocalEvenPauliTerm M.sites + Term := QMALocalEvenPauliTerm M.sites × Fin 7 + qFinite := inferInstance + qDecidable := inferInstance + termFinite := inferInstance + matrix := F + sites := S + localOn := hSl + card := hSc + hermitian := hFH + real := hFR } + rows := M.rows + width := M.width + cell := cell + anchor := anchor + geometry := by + intro p q hq + exact qmaMediatorSupport_geometry M.cell _ _ p.1 + (M.geometry p.1.val.1) q (hSs p hq) + qubitDensity := by + intro p + change (Finset.univ.filter (fun q : M.Q ⊕ QMALocalEvenPauliTerm M.sites => + cell q = p)).card ≤ _ + rw [qmaSumFilter_card] + exact Nat.add_le_add (M.qubitDensity p) (hcount p) + termDensity := by + intro p + change (Finset.univ.filter (fun q : QMALocalEvenPauliTerm M.sites × Fin 7 => + M.anchor q.1.val.1 = p)).card ≤ _ + rw [qmaProdFilter_card (α := QMALocalEvenPauliTerm M.sites) 7 (fun e => M.anchor e.val.1 = p)] + simpa only [Nat.mul_assoc] using Nat.mul_le_mul_left 7 (hcount p) } + exact ⟨G,hFE,rfl,rfl⟩ + + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialTotal.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialTotal.lean new file mode 100644 index 0000000000000000000000000000000000000000..4a41dab1421a6b929e69b66dc9832b61371d5f64 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialTotal.lean @@ -0,0 +1,86 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCircuitPadding +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialPrivate +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialRational + +namespace OAI + +/-! Every verifier circuit admits a spatial private-pair X/Z family with rational coefficients. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +abbrev qmaVerifierSpatialQubits : ℕ := 45+1077940224*64+80*(7516192768*64) +abbrev qmaVerifierSpatialTerms : ℕ := 448*(7516192768*64) + +theorem qmaCircuit_spatial_XZ_total (c : QMACircuit) (hc : c.WellFormed) + {N : ℝ} (hN : 1 ≤ N) : + ∃ G : QMASpatialXZModel qmaVerifierSpatialQubits qmaVerifierSpatialTerms, + G.rows = (qmaNearestCircuit (qmaNonemptyCircuit c)).gates.length ∧ G.width = c.work ∧ + (∀ psi : EuclideanSpace ℂ (SourceSpinBasis c.witness), ‖psi‖ = 1 → + 2/3 ≤ qmaAcceptance c hc psi → + G.toQMAXZModel.energy ≤ + 1/(3*((qmaSparseCircuit (qmaNonemptyCircuit c)).gates.length+1:ℝ))+1/N) ∧ + ((∀ psi : EuclideanSpace ℂ (SourceSpinBasis c.witness), ‖psi‖ = 1 → + qmaAcceptance c hc psi ≤ 1/3) → + 2/(5*((qmaSparseCircuit (qmaNonemptyCircuit c)).gates.length+1:ℝ))-1/N ≤ + G.toQMAXZModel.energy) := by + obtain ⟨G,hr,hw,hy,hn⟩ := qmaCircuit_spatial_XZ (qmaNonemptyCircuit c) + (qmaNonemptyCircuit_wellFormed c hc) (qmaNonemptyCircuit_sparse_pos c) + (qmaNonemptyCircuit_nearest c) hN + refine ⟨G,hr,hw,?_,?_⟩ + · intro psi hpsi ha + apply hy psi hpsi + rwa [qmaNonemptyCircuit_acceptance] + · intro hs + apply hn + intro psi hpsi + rw [qmaNonemptyCircuit_acceptance c hc psi] + exact hs psi hpsi + +theorem qmaCircuit_spatial_rational_private (c : QMACircuit) (hc : c.WellFormed) + (N : ℕ) (hN : 0 < N) : + ∃ G : QMASpatialXZModel (qmaVerifierSpatialQubits+qmaVerifierSpatialTerms) + (4*qmaVerifierSpatialTerms), + G.rows = (qmaNearestCircuit (qmaNonemptyCircuit c)).gates.length ∧ G.width = c.work ∧ + (∀ e, ∃ r : ℚ, G.coefficient e = r) ∧ + (∀ p q, (qmaPauliSupport (G.word p)).card = 2 → + qmaPauliSupport (G.word p) = qmaPauliSupport (G.word q) → p = q) ∧ + (∀ psi : EuclideanSpace ℂ (SourceSpinBasis c.witness), ‖psi‖ = 1 → + 2/3 ≤ qmaAcceptance c hc psi → + G.toQMAXZModel.energy ≤ + 1/(3*((qmaSparseCircuit (qmaNonemptyCircuit c)).gates.length+1:ℝ))+1/(N:ℝ)) ∧ + ((∀ psi : EuclideanSpace ℂ (SourceSpinBasis c.witness), ‖psi‖ = 1 → + qmaAcceptance c hc psi ≤ 1/3) → + 2/(5*((qmaSparseCircuit (qmaNonemptyCircuit c)).gates.length+1:ℝ))-1/(N:ℝ) ≤ + G.toQMAXZModel.energy) := by + have h3N : 1 ≤ (3*N:ℕ) := by omega + have h3NR : 1 ≤ (3*N:ℝ) := by exact_mod_cast h3N + obtain ⟨M,hr,hw,hy,hn⟩ := qmaCircuit_spatial_XZ_total c hc h3NR + obtain ⟨P,hp,he,hPr,hPw⟩ := M.private h3NR + let m := (Fintype.card P.Term+1)*(3*N) + let G := P.withCoefficients (fun e => (qmaRationalRound m (P.coefficient e):ℝ)) + have hg : |G.toQMAXZModel.energy-P.toQMAXZModel.energy| ≤ 1/(3*N:ℝ) := by + have h := P.round_energy (3*N) (by omega) + simpa only [Nat.cast_mul,Nat.cast_ofNat] using h + refine ⟨G,hPr.trans hr,hPw.trans hw,?_,hp,?_,?_⟩ + · intro e + exact ⟨qmaRationalRound m (P.coefficient e),rfl⟩ + · intro psi hpsi ha + have h := hy psi hpsi ha + have he' := (abs_le.mp he).2 + have hg' := (abs_le.mp hg).2 + have hsum : 1/(3*N:ℝ)+1/(3*N:ℝ)+1/(3*N:ℝ) = 1/(N:ℝ) := by ring + linarith + · intro hs + have h := hn hs + have he' := (abs_le.mp he).1 + have hg' := (abs_le.mp hg).1 + have hsum : 1/(3*N:ℝ)+1/(3*N:ℝ)+1/(3*N:ℝ) = 1/(N:ℝ) := by ring + linarith + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialXZ.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialXZ.lean new file mode 100644 index 0000000000000000000000000000000000000000..cb09d6aff80bdf5c0bac6abdce1b24d921e8c5d4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialXZ.lean @@ -0,0 +1,108 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialGadgets +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZSupported +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZFamily + +namespace OAI + +/-! X/Z conversion with explicit neighboring-cell support and constant density. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +structure QMASpatialXZModel (A B : ℕ) extends QMAXZModel where + rows : ℕ + width : ℕ + cell : Q → QMAGridCell rows width + anchor : Term → QMAGridCell rows width + geometry : ∀ e, ∀ q ∈ qmaPauliSupport (word e), QMAGridCellsNear (cell q) (anchor e) + qubitDensity : ∀ p, (Finset.univ.filter (fun q => cell q = p)).card ≤ A + termDensity : ∀ p, (Finset.univ.filter (fun e => anchor e = p)).card ≤ B + +theorem qmaSpatialXZ_of_stages {A B : ℕ} (M : QMASpatialModel 2 A B) + (v : ((QMALocalEvenPauliTerm M.sites × Fin 4) × Fin 7) → + ((M.Q ⊕ QMALocalEvenPauliTerm M.sites) ⊕ (QMALocalEvenPauliTerm M.sites × Fin 4)) → Fin 4) + (K : ((QMALocalEvenPauliTerm M.sites × Fin 4) × Fin 7) → ℝ) + (hvy : ∀ e i, v e i ≠ 2) (hv : ∀ e, (qmaPauliSupport (v e)).card ≤ 2) + (hvs : ∀ e, qmaPauliSupport (v e) ⊆ + qmaMediatorSupport (qmaMediatorSupport + (qmaPauliSupport (qmaLocalPauliWord M.sites e.1.1.val)) e.1.1) e.1) : + ∃ G : QMASpatialXZModel (A+80*B) (448*B), + G.toQMAXZModel = QMAXZModel.ofWords v K hvy hv ∧ G.rows = M.rows ∧ G.width = M.width := by + let E := QMALocalEvenPauliTerm M.sites + let a₀ := fun p : E => M.anchor p.val.1 + let c₁ := qmaMediatorCell M.cell a₀ + let a₁ := fun p : E × Fin 4 => a₀ p.1 + let c₂ := qmaMediatorCell c₁ a₁ + let a₂ := fun p : (E × Fin 4) × Fin 7 => a₁ p.1 + have hE (p : QMAGridCell M.rows M.width) : + (Finset.univ.filter (fun e : E => a₀ e = p)).card ≤ 16*B := by + have h := qmaLocalEvenPauli_filter_card M.sites M.card (fun a => M.anchor a = p) + exact h.trans (Nat.mul_le_mul_left 16 (M.termDensity p)) + have hT (p : QMAGridCell M.rows M.width) : + (Finset.univ.filter (fun e : E × Fin 4 => a₁ e = p)).card ≤ 64*B := by + change (Finset.univ.filter (fun e : E × Fin 4 => a₀ e.1 = p)).card ≤ _ + rw [qmaProdFilter_card (α := E) 4 (fun e => a₀ e = p)] + exact (Nat.mul_le_mul_left 4 (hE p)).trans (by omega) + have hC₁ (p : QMAGridCell M.rows M.width) : + (Finset.univ.filter (fun q : M.Q ⊕ E => c₁ q = p)).card ≤ A+16*B := by + rw [qmaSumFilter_card] + exact Nat.add_le_add (M.qubitDensity p) (hE p) + have hU (e : E × Fin 4) (q : M.Q ⊕ E) + (hq : q ∈ qmaMediatorSupport + (qmaPauliSupport (qmaLocalPauliWord M.sites e.1.val)) e.1) : + QMAGridCellsNear (c₁ q) (a₁ e) := by + apply qmaMediatorSupport_geometry M.cell a₀ (M.sites e.1.val.1) e.1 + (M.geometry e.1.val.1) q + exact (qmaMediatorSupport_mono (qmaPauliExtend_support _ _) e.1) hq + let G : QMASpatialXZModel (A+80*B) (448*B) := { + toQMAXZModel := QMAXZModel.ofWords v K hvy hv + rows := M.rows + width := M.width + cell := c₂ + anchor := a₂ + geometry := by + intro e q hq + exact qmaMediatorSupport_geometry c₁ a₁ + (qmaMediatorSupport (qmaPauliSupport (qmaLocalPauliWord M.sites e.1.1.val)) e.1.1) e.1 + (hU e.1) q (hvs e hq) + qubitDensity := by + intro p + change (Finset.univ.filter (fun q : (M.Q ⊕ E) ⊕ (E × Fin 4) => c₂ q = p)).card ≤ _ + rw [qmaSumFilter_card] + exact (Nat.add_le_add (hC₁ p) (hT p)).trans (by omega) + termDensity := by + intro p + change (Finset.univ.filter (fun e : (E × Fin 4) × Fin 7 => a₁ e.1 = p)).card ≤ _ + rw [qmaProdFilter_card (α := E × Fin 4) 7 (fun e => a₁ e = p)] + exact (Nat.mul_le_mul_left 7 (hT p)).trans (by omega) } + exact ⟨G,rfl,rfl,rfl⟩ + +theorem QMASpatialModel.toXZ {A B : ℕ} (M : QMASpatialModel 2 A B) + {N : ℝ} (hN : 1 ≤ N) : + ∃ G : QMASpatialXZModel (A+80*B) (448*B), + |G.toQMAXZModel.energy-M.toQMARealLocalModel.energy| ≤ 1/N ∧ + G.rows = M.rows ∧ G.width = M.width := by + let E := QMALocalEvenPauliTerm M.sites + obtain ⟨v,K,hvy,hv,hvs,he⟩ := qmaTwoLocalXZ_supported + (fun p : E => qmaLocalPauliWord M.sites p.val) + (fun p => qmaLocalPauliCoefficient M.matrix M.sites p.val) + (qmaLocalEvenPauli_support M.sites M.card) (qmaLocalEvenPauli_even M.sites) hN + obtain ⟨G,hG,hr,hw⟩ := qmaSpatialXZ_of_stages M v K hvy hv hvs + refine ⟨G,?_,hr,hw⟩ + have hs := qmaLocalEvenPauli_sum M.matrix M.sites M.localOn M.hermitian M.real + change (∑ e : E, (qmaLocalPauliCoefficient M.matrix M.sites e.val:ℂ) • + qmaPauliWord (qmaLocalPauliWord M.sites e.val)) = ∑ a, M.matrix a at hs + rw [hG] + change |(QMAXZModel.ofWords v K hvy hv).energy-M.toQMARealLocalModel.energy| ≤ 1/N + rw [QMAXZModel.ofWords_energy,QMARealLocalModel.energy,← hs] + convert he using 1 + congr 2 + exact qmaNormalizedBottom_instances _ _ _ _ _ + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialXZBounds.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialXZBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..50cddd30a98170503fbda4aa0a9645cc47c6299b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpatialXZBounds.lean @@ -0,0 +1,57 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialXZ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridNeighbors +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialCircuit + +namespace OAI + +/-! Explicit size, degree and promise bounds for the spatial X/Z Hamiltonian. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +theorem QMASpatialXZModel.incidence_bound {A B : ℕ} (M : QMASpatialXZModel A B) (q : M.Q) : + (Finset.univ.filter (fun e => q ∈ qmaPauliSupport (M.word e))).card ≤ 9*B := + qmaGrid_incidence_bound M.cell M.anchor (fun e => qmaPauliSupport (M.word e)) + M.geometry M.termDensity q + +theorem QMASpatialXZModel.qubits_bound {A B : ℕ} (M : QMASpatialXZModel A B) : + M.toQMAXZModel.qubits ≤ (M.rows+1)*(M.width+1)*A := + qmaGrid_density_card M.cell M.qubitDensity + +theorem QMASpatialXZModel.terms_bound {A B : ℕ} (M : QMASpatialXZModel A B) : + M.toQMAXZModel.terms ≤ (M.rows+1)*(M.width+1)*B := + qmaGrid_density_card M.anchor M.termDensity + +theorem qmaCircuit_spatial_XZ (c : QMACircuit) (hc : c.WellFormed) + (hT : 0 < (qmaSparseCircuit c).gates.length) + (hne : (qmaNearestCircuit c).gates ≠ []) {N : ℝ} (hN : 1 ≤ N) : + ∃ G : QMASpatialXZModel + (45+1077940224*64+80*(7516192768*64)) (448*(7516192768*64)), + G.rows = (qmaNearestCircuit c).gates.length ∧ G.width = c.work ∧ + (∀ psi : EuclideanSpace ℂ (SourceSpinBasis c.witness), ‖psi‖ = 1 → + 2/3 ≤ qmaAcceptance c hc psi → + G.toQMAXZModel.energy ≤ 1/(3*((qmaSparseCircuit c).gates.length+1:ℝ))+1/N) ∧ + ((∀ psi : EuclideanSpace ℂ (SourceSpinBasis c.witness), ‖psi‖ = 1 → + qmaAcceptance c hc psi ≤ 1/3) → + 2/(5*((qmaSparseCircuit c).gates.length+1:ℝ))-1/N ≤ G.toQMAXZModel.energy) := by + have h2N : 1 ≤ 2*N := by linarith + obtain ⟨M,hr,hw,hyes,hno⟩ := qmaCircuit_spatial_two_local c hc hT hne h2N + obtain ⟨G,he,hGr,hGw⟩ := M.toXZ h2N + refine ⟨G,hGr.trans hr,hGw.trans hw,?_,?_⟩ + · intro psi hpsi ha + have h := hyes psi hpsi ha + have hle := (abs_le.mp he).2 + have hsum : 1/(2*N)+1/(2*N) = 1/N := by ring + linarith + · intro ha + have h := hno ha + have hle := (abs_le.mp he).1 + have hsum : 1/(2*N)+1/(2*N) = 1/N := by ring + linarith + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpecifiedLattice.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpecifiedLattice.lean new file mode 100644 index 0000000000000000000000000000000000000000..021bc7f742e827ae1ba381ded527839e68b4dc39 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSpecifiedLattice.lean @@ -0,0 +1,135 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumDefinedRealization +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGraphCoefficientBound +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingPlanarRoutes +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingSize +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLatticeSource + +namespace OAI + +/-! A specified finite square-lattice source, with its exact energy shift and +coefficient envelope. All estimates refer to this same constructed graph. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +namespace QMARationalExchangeGraph +variable (G : QMARationalExchangeGraph) + +theorem merge_adjacent (position : Fin G.n → ℕ × ℕ) + (h : ∀ e, qmaSquareGrid.Adj (position (G.left e)) (position (G.right e))) + (e : G.merge.Edge) : + qmaSquareGrid.Adj (position (G.merge.left e)) (position (G.merge.right e)) := by + obtain ⟨f,he|he⟩ := G.merge_edge_source e + · rw [he.1,he.2] + exact h f + · rw [he.1,he.2] + exact (h f).symm + +end QMARationalExchangeGraph + +namespace QMAEvenRouteData +variable {G : QMARationalExchangeGraph} (P : QMAEvenRouteData G) + +theorem output_coefficientBound {N : ℚ} (hN : 0 ≤ N) {m L T : ℝ} + (hm : (Fintype.card G.Edge:ℝ) ≤ m) (hL : 1 ≤ L) (hT : |(N:ℝ)| ≤ T) + (hc : G.CoefficientBound L) (D : ℕ) : + (P.output N D).CoefficientBound + (qmaPathIteratedBound (3*m) (qmaPathCoefficientBound m L T) T D) := by + have hm0 : 0 ≤ m := (Nat.cast_nonneg _).trans hm + have hcount : (Fintype.card (P.schedule N).graph.Edge:ℝ) ≤ 3*m := by + have hs : Fintype.card (P.schedule N).graph.Edge ≤ 3*Fintype.card G.Edge := by + change Fintype.card (G.subdivide Finset.univ (fun _ => true) N).Edge ≤ _ + rw [G.subdivide_edge_count] + simp only [Finset.card_univ] + omega + have hs' : (Fintype.card (P.schedule N).graph.Edge:ℝ) ≤ + 3*(Fintype.card G.Edge:ℝ) := by exact_mod_cast hs + exact hs'.trans (by linarith) + exact (P.schedule N).iterate_coefficientBound hN hcount + (qmaPathCoefficientBound_one hm0 hL) hT + (G.subdivide_coefficientBound Finset.univ (fun _ => true) hN hm hL hT hc) D + +end QMAEvenRouteData + +namespace QMAPortRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) +variable (N : ℚ) {D : ℕ} (hD : ∀ e, P.length e ≤ D) +variable (havoid : ∀ i : P.Interior, ∀ v, P.cell i ≠ P.position v) +variable (hpositive : ∀ v, 0 < (P.position v).1 ∧ 0 < (P.position v).2) + +def latticeGraph : QMARationalExchangeGraph := + ((P.crossingPlanarRoute N hD havoid hpositive).toEven.output N 80).merge + +def latticePosition := (P.crossingPlanarRoute N hD havoid hpositive).toEven.outputPosition N 80 + +theorem lattice_vertices_ge : G.n ≤ (P.latticeGraph N hD havoid hpositive).n := by + have h := (P.crossingPlanarRoute N hD havoid hpositive).toEven.output_vertices_ge N 80 + have hfirst := P.schedule.iterate_vertices_ge N D + change G.n ≤ _ at hfirst + change (P.crossingOutput N hD).n ≤ _ at h + change G.n ≤ _ + have hc : (P.finishedGraph N D).n ≤ (P.crossingOutput N hD).n := by + change (P.finishedGraph N D).n ≤ (P.finishedGraph N D).n+P.crossingCells.card*2 + omega + exact hfirst.trans (hc.trans h) + +theorem lattice_position_injective : + Function.Injective (P.latticePosition N hD havoid hpositive) := + (P.crossingPlanarRoute N hD havoid hpositive).toEven.output_position_injective N 80 + +theorem lattice_adjacent (e : (P.latticeGraph N hD havoid hpositive).Edge) : + qmaSquareGrid.Adj + (P.latticePosition N hD havoid hpositive ((P.latticeGraph N hD havoid hpositive).left e)) + (P.latticePosition N hD havoid hpositive ((P.latticeGraph N hD havoid hpositive).right e)) := by + let R := P.crossingPlanarRoute N hD havoid hpositive + have hw : ∀ e, R.toEven.work e ≤ 80 := by + intro e + have hl := P.crossingPlanarRoute_length N hD havoid hpositive e + change R.length e ≤ 20 at hl + change 4*R.length e-1 ≤ 80 + omega + exact (R.toEven.output N 80).merge_adjacent _ (R.toEven.output_adjacent N hw) e + +theorem lattice_bounded {X Y : ℕ} + (hsource : ∀ v, (P.position v).1 < X ∧ (P.position v).2 < Y) + (hpath : ∀ e k, k ≤ P.length e → (P.point e k).1 < X ∧ (P.point e k).2 < Y) : + ∀ v, (P.latticePosition N hD havoid hpositive v).1 < 256*X ∧ + (P.latticePosition N hD havoid hpositive v).2 < 256*Y := by + have hb := P.crossingPlanarRoute_bounded N hD havoid hpositive hsource hpath + have h := (P.crossingPlanarRoute N hD havoid hpositive).toEven.output_position_bounded + N 80 ((P.crossingPlanarRoute N hD havoid hpositive).toEven_bounded hb) + simpa only [latticePosition,← Nat.mul_assoc] using h + +theorem lattice_energy_error (hN : 0 < N) : + |(P.latticeGraph N hD havoid hpositive).energy-G.energy| ≤ ((D+82:ℕ):ℝ)/(N:ℝ) := by + let R := P.crossingPlanarRoute N hD havoid hpositive + have he := R.toEven.output_energy_error hN 80 + have hc := P.mergedOutput_energy_error hN hD + rw [latticeGraph,QMARationalExchangeGraph.merge_energy] + calc + _ ≤ |(R.toEven.output N 80).energy-(P.crossingOutput N hD).merge.energy|+ + |(P.crossingOutput N hD).merge.energy-G.energy| := abs_sub_le _ _ _ + _ ≤ ((80+1:ℕ):ℝ)/(N:ℝ)+((D+1:ℕ):ℝ)/(N:ℝ) := add_le_add he hc + _ = _ := by push_cast; ring + +def latticeSource (hn : 0 < G.n) (a b : ℚ) (hab : a < b) : SquareLatticeHeisenberg := + (P.latticeGraph N hD havoid hpositive).latticeSource + (hn.trans_le (P.lattice_vertices_ge N hD havoid hpositive)) + (P.latticePosition N hD havoid hpositive) + (P.lattice_position_injective N hD havoid hpositive) + (P.lattice_adjacent N hD havoid hpositive) + (QMARationalExchangeGraph.merge_simple _) a b hab + +theorem latticeSource_energy (hn : 0 < G.n) (a b : ℚ) (hab : a < b) : + realSourceGroundEnergy (P.latticeSource N hD havoid hpositive hn a b hab) = + (P.latticeGraph N hD havoid hpositive).energy- + ((P.latticeGraph N hD havoid hpositive).constant:ℝ) := + QMARationalExchangeGraph.latticeSource_energy _ _ _ _ _ _ _ _ _ + +end QMAPortRouteData +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumStageIndex.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumStageIndex.lean new file mode 100644 index 0000000000000000000000000000000000000000..ff5c62a6df60ad6fc02ba7219040e5049c92b78d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumStageIndex.lean @@ -0,0 +1,71 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTransferIndex + +namespace OAI + +/-! The actual tagged row-stage column is the explicit insertion cursor. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +theorem qmaTaggedRowStage_get_column (width work : ℕ) + (l r : Fin (width+1) → Fin (work+1)) (e : Equiv.Perm (Fin (width+1))) + (g : QMAGate) (t : Fin (3*(width+1)+1)) : + ((qmaTaggedRowStage width work l r e g)[t.val]' + (by rw [qmaTaggedRowStage_length]; exact t.isLt)).2 = e (qmaStageCursorFin width e g t) := by + let cut := qmaGateCut width e g + let cols := List.ofFn e + let pre := qmaColumnTransfer l r (cols.take cut) + let post := qmaColumnTransfer l r (cols.drop cut) + let ins := (qmaMapGate width work r g,qmaGateArrivalColumn width e g) + have hc : cut ≤ width+1 := qmaGateCut_le width e g + have hp : 0 < cut := by dsimp [cut,qmaGateCut]; omega + have hpre : pre.length = 3*cut := by + simp only [pre,qmaColumnTransfer_length,List.length_take,cols,List.length_ofFn,Nat.min_eq_left hc] + have hpost : post.length = 3*(width+1-cut) := by + simp only [post,qmaColumnTransfer_length,List.length_drop,cols,List.length_ofFn] + have ht := t.isLt + have hbound : t.val < ((pre ++ [ins]) ++ post).length := by + simp only [List.length_append,List.length_singleton,hpre,hpost] + omega + change (((pre ++ [ins]) ++ post)[t.val]'hbound).2 = _ + by_cases hb : t.val < 3*cut + · rw [List.getElem_append_left (by simp only [List.length_append,List.length_singleton,hpre]; omega), + List.getElem_append_left (by omega)] + have hsmall : t.val < 3*(cols.take cut).length := by + simp only [List.length_take,cols,List.length_ofFn,Nat.min_eq_left hc] + exact hb + rw [qmaColumnTransfer_get_column l r (cols.take cut) t.val hsmall,List.getElem_take, + List.getElem_ofFn] + apply congrArg e + apply Fin.ext + simp only [qmaStageCursorFin,Fin.val_mk,qmaStageCursor,cut,hb,ite_true] + · by_cases he : t.val = 3*cut + · rw [List.getElem_append_left (by simp only [List.length_append,List.length_singleton,hpre]; omega), + List.getElem_append_right (by omega)] + have hz : t.val-pre.length = 0 := by omega + simp only [hz,List.getElem_cons_zero] + change qmaGateArrivalColumn width e g = e (qmaStageCursorFin width e g t) + apply congrArg e + apply Fin.ext + simp only [qmaGateArrivalIndex,qmaStageCursorFin,Fin.val_mk,qmaStageCursor] + change cut-1 = if t.val < 3*cut then _ else if t.val = 3*cut then _ else _ + simp [he,cut] + · rw [List.getElem_append_right (by simp only [List.length_append,List.length_singleton,hpre]; omega)] + have hsmall : t.val-(pre ++ [ins]).length < 3*(cols.drop cut).length := by + simp only [List.length_append,List.length_singleton,hpre,List.length_drop,cols,List.length_ofFn] + omega + rw [qmaColumnTransfer_get_column l r (cols.drop cut) _ hsmall,List.getElem_drop,List.getElem_ofFn] + apply congrArg e + apply Fin.ext + simp only [qmaStageCursorFin,Fin.val_mk,List.length_append,List.length_singleton,hpre] + change cut+(t.val-(3*cut+1))/3 = qmaStageCursor cut t.val + unfold qmaStageCursor + simp only [hb,he,ite_false] + omega + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumStagePath.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumStagePath.lean new file mode 100644 index 0000000000000000000000000000000000000000..2b67a101ef991b592094b8706ca0950d432ee629 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumStagePath.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumStageStep +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSweepCongestion + +namespace OAI + +/-! Row-labelled stages form bounded-step spatial paths with explicit endpoints. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +def qmaRowLift {rows width : ℕ} (r : Fin (rows+1)) (ps : List (QMAGate × Fin (width+1))) : + List (QMAGate × QMAGridCell rows width) := ps.map (fun p => (p.1,(r,p.2))) + +def QMAGridTagNear {rows width : ℕ} (p q : QMAGate × QMAGridCell rows width) : Prop := + p.2.1.val ≤ q.2.1.val+1 ∧ q.2.1.val ≤ p.2.1.val+1 ∧ + p.2.2.val ≤ q.2.2.val+1 ∧ q.2.2.val ≤ p.2.2.val+1 + +theorem qmaRowLift_chain {rows width : ℕ} (r : Fin (rows+1)) + (ps : List (QMAGate × Fin (width+1))) (h : ps.IsChain QMALabeledColumnNear) : + (qmaRowLift r ps).IsChain QMAGridTagNear := by + apply (List.isChain_map _).mpr + exact h.imp (fun p q hh => by + change r.val ≤ r.val+1 ∧ r.val ≤ r.val+1 ∧ p.2.val ≤ q.2.val+1 ∧ q.2.val ≤ p.2.val+1 + exact ⟨by omega,by omega,hh⟩) + +def qmaGridStageTags (rows width : ℕ) (r : Fin rows) (e : Equiv.Perm (Fin (width+1))) + (g : QMAGate) : List (QMAGate × QMAGridCell rows width) := + qmaRowLift r.castSucc (qmaTaggedRowStage width (qmaGridWork rows width) + (qmaGridQubit rows width r.castSucc) (qmaGridQubit rows width r.succ) e g) + +theorem qmaGridStageTags_nonempty (rows width : ℕ) (r : Fin rows) + (e : Equiv.Perm (Fin (width+1))) (g : QMAGate) : qmaGridStageTags rows width r e g ≠ [] := by + intro h + have hh := congrArg List.length h + simp only [qmaGridStageTags,qmaRowLift,List.length_map,qmaTaggedRowStage_length,List.length_nil] at hh + omega + +theorem qmaGridStageTags_head (rows width : ℕ) (r : Fin rows) + (e : Equiv.Perm (Fin (width+1))) (g : QMAGate) : + (qmaGridStageTags rows width r e g).head?.map Prod.snd = some (r.castSucc,e 0) := by + let ps := qmaTaggedRowStage width (qmaGridWork rows width) + (qmaGridQubit rows width r.castSucc) (qmaGridQubit rows width r.succ) e g + have hp : 0 < ps.length := by rw [qmaTaggedRowStage_length]; omega + simp only [qmaGridStageTags,qmaRowLift,List.head?_map,Option.map_map,Function.comp_def] + rw [List.head?_eq_getElem?,List.getElem?_eq_getElem hp] + simp only [Option.map_some] + congr 1 + exact Prod.ext rfl (qmaTaggedRowStage_first_column _ _ _ _ _ _) + +theorem qmaGridStageTags_last (rows width : ℕ) (r : Fin rows) + (e : Equiv.Perm (Fin (width+1))) (g : QMAGate) : + (qmaGridStageTags rows width r e g).getLast?.map Prod.snd = some (r.castSucc,e (Fin.last width)) := by + let ps := qmaTaggedRowStage width (qmaGridWork rows width) + (qmaGridQubit rows width r.castSucc) (qmaGridQubit rows width r.succ) e g + have hp : 3*(width+1) < ps.length := by rw [qmaTaggedRowStage_length]; omega + simp only [qmaGridStageTags,qmaRowLift,List.getLast?_map,Option.map_map,Function.comp_def] + rw [List.getLast?_eq_getElem?] + simp only [qmaTaggedRowStage_length,Nat.add_sub_cancel] + rw [List.getElem?_eq_getElem hp] + simp only [Option.map_some] + congr 1 + exact Prod.ext rfl (qmaTaggedRowStage_last_column _ _ _ _ _ _) + +theorem qmaGridStageTags_chain (rows width : ℕ) (r : Fin rows) (g : QMAGate) : + (qmaGridStageTags rows width r (qmaSweepOrder width (rows-1-r.val)) g).IsChain QMAGridTagNear := + qmaRowLift_chain _ _ (qmaTaggedRowStage_chain _ _ _ _ _ _) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumStageStep.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumStageStep.lean new file mode 100644 index 0000000000000000000000000000000000000000..2a497d03fb0a8154e44127c6cd7c6034189b9a20 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumStageStep.lean @@ -0,0 +1,81 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumStageIndex +import Mathlib.Data.List.Chain + +namespace OAI + +/-! Consecutive clock anchors within a stage are neighboring columns. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +def QMALabeledColumnNear {width : ℕ} (p q : QMAGate × Fin (width+1)) : Prop := + p.2.val ≤ q.2.val+1 ∧ q.2.val ≤ p.2.val+1 + +theorem qmaTaggedRowStage_step (width work row : ℕ) + (l r : Fin (width+1) → Fin (work+1)) (g : QMAGate) (t : Fin (3*(width+1))) : + QMALabeledColumnNear + ((qmaTaggedRowStage width work l r (qmaSweepOrder width row) g)[t.val]' + (by rw [qmaTaggedRowStage_length]; omega)) + ((qmaTaggedRowStage width work l r (qmaSweepOrder width row) g)[t.val+1]' + (by rw [qmaTaggedRowStage_length]; omega)) := by + have hstep := qmaStageCursor_step (qmaGateCut width (qmaSweepOrder width row) g) t.val + (by unfold qmaGateCut; omega) + change _ ≤ _ ∧ _ ≤ _ + have h0 := qmaTaggedRowStage_get_column width work l r (qmaSweepOrder width row) g t.castSucc + have h1 := qmaTaggedRowStage_get_column width work l r (qmaSweepOrder width row) g t.succ + simp only [Fin.val_castSucc] at h0 + simp only [Fin.val_succ] at h1 + rw [h0,h1] + apply qmaSweepOrder_near + · change qmaStageCursor _ t.val ≤ qmaStageCursor _ (t.val+1)+1 + omega + · exact hstep.2 + +theorem qmaTaggedRowStage_chain (width work row : ℕ) + (l r : Fin (width+1) → Fin (work+1)) (g : QMAGate) : + (qmaTaggedRowStage width work l r (qmaSweepOrder width row) g).IsChain QMALabeledColumnNear := by + apply List.isChain_iff_getElem.mpr + intro t ht + have hlt : t < 3*(width+1) := by rw [qmaTaggedRowStage_length] at ht; omega + exact qmaTaggedRowStage_step width work row l r g ⟨t,hlt⟩ + +theorem qmaTaggedRowStage_first_column (width work : ℕ) + (l r : Fin (width+1) → Fin (work+1)) (e : Equiv.Perm (Fin (width+1))) (g : QMAGate) : + ((qmaTaggedRowStage width work l r e g)[0]' + (by rw [qmaTaggedRowStage_length]; omega)).2 = e 0 := by + have h0 := qmaTaggedRowStage_get_column width work l r e g 0 + simp only [Fin.val_zero] at h0 + rw [h0] + apply congrArg e + apply Fin.ext + change qmaStageCursor (qmaGateCut width e g) 0 = 0 + exact qmaStageCursor_zero _ (by unfold qmaGateCut; omega) + +theorem qmaTaggedRowStage_last_column (width work : ℕ) + (l r : Fin (width+1) → Fin (work+1)) (e : Equiv.Perm (Fin (width+1))) (g : QMAGate) : + ((qmaTaggedRowStage width work l r e g)[3*(width+1)]' + (by rw [qmaTaggedRowStage_length]; omega)).2 = e (Fin.last width) := by + have h0 := qmaTaggedRowStage_get_column width work l r e g (Fin.last (3*(width+1))) + simp only [Fin.val_last] at h0 + rw [h0] + apply congrArg e + apply Fin.ext + simpa only [qmaStageCursorFin,Fin.val_mk,Fin.val_last,Nat.add_sub_cancel] using + qmaStageCursor_last (width+1) (qmaGateCut width e g) + (by unfold qmaGateCut; omega) (qmaGateCut_le width e g) + +theorem qmaSweepOrder_turn (width row : ℕ) (hr : 0 < row) : + qmaSweepOrder width row (Fin.last width) = qmaSweepOrder width (row-1) 0 := by + have h : row%2 = 0 ∨ row%2 = 1 := by omega + rcases h with h | h + · have hp : (row-1)%2 = 1 := by omega + simp [qmaSweepOrder,h,hp] + · have hp : (row-1)%2 = 0 := by omega + simp [qmaSweepOrder,h,hp] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSubdivisionSites.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSubdivisionSites.lean new file mode 100644 index 0000000000000000000000000000000000000000..90ff6615aa9c16020de498f2c6a12ded6323324a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSubdivisionSites.lean @@ -0,0 +1,106 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedSubdivision + +namespace OAI + +/-! Literal ordered site lists for each of the four subdivision terms. +The two finite subdivision stages reuse these lists, rather than selecting +a new support from an existential locality certificate. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumOrderedSubdivision +open scoped Classical + +variable {ι κ : Type} + +def appendMediator (xs : List ι) (e : κ) : List (ι ⊕ κ) := + xs.map Sum.inl ++ [Sum.inr e] + +theorem appendMediator_nodup (xs : List ι) (hx : xs.Nodup) (e : κ) : + (appendMediator xs e).Nodup := by + apply (hx.map Sum.inl_injective).append (List.nodup_singleton _) + intro x hx he + have hxe : x = Sum.inr e := by simpa using he + subst x + simp at hx + +theorem appendMediator_length (xs : List ι) (e : κ) : + (appendMediator xs e).length = xs.length+1 := by + simp [appendMediator] + +def outputSites (xs : κ → List ι) (d : ℕ) (p : κ × Fin 4) : List (ι ⊕ κ) := + ![[],[Sum.inr p.1],appendMediator ((xs p.1).take d) p.1, + appendMediator ((xs p.1).drop d) p.1] p.2 + +theorem outputSites_nodup (xs : κ → List ι) (d : ℕ) + (hx : ∀ e, (xs e).Nodup) (p : κ × Fin 4) : + (outputSites xs d p).Nodup := by + rcases p with ⟨e,k⟩ + fin_cases k + · exact List.nodup_nil + · exact List.nodup_singleton _ + · exact appendMediator_nodup _ ((hx e).sublist (List.take_sublist d _)) e + · exact appendMediator_nodup _ ((hx e).sublist (List.drop_sublist d _)) e + +theorem outputSites_length (xs : κ → List ι) (d : ℕ) + (hx : ∀ e, (xs e).length ≤ 2*d) (p : κ × Fin 4) : + (outputSites xs d p).length ≤ d+1 := by + rcases p with ⟨e,k⟩ + fin_cases k + · change 0 ≤ d+1 + omega + · change 1 ≤ d+1 + omega + · change (appendMediator ((xs e).take d) e).length ≤ d+1 + rw [appendMediator_length,List.length_take] + omega + · change (appendMediator ((xs e).drop d) e).length ≤ d+1 + rw [appendMediator_length,List.length_drop] + have := hx e + omega + +variable [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +theorem join_support_cover (xs : List ι) (a : ι → Fin 4) + (ha : qmaPauliSupport a ⊆ xs.toFinset) (e : κ) (μ : Fin 4) : + qmaPauliSupport (Sum.elim a (qmaSinglePauliWord e μ)) ⊆ + (appendMediator xs e).toFinset := by + intro x hx + cases x with + | inl i => + have hi : i ∈ qmaPauliSupport a := by simpa [qmaPauliSupport] using hx + have him := ha hi + simpa [appendMediator] using him + | inr j => + have hj : j ∈ qmaPauliSupport (qmaSinglePauliWord e μ) := by + simpa [qmaPauliSupport] using hx + have hje := qmaSinglePauliWord_support e μ hj + have he : j = e := by simpa using hje + simp [appendMediator,he] + +theorem outputSites_cover (xs : κ → List ι) (d : ℕ) (w : κ → ι → Fin 4) + (p : κ × Fin 4) : + qmaPauliSupport (outputWord xs d w p) ⊆ (outputSites xs d p).toFinset := by + rcases p with ⟨e,k⟩ + fin_cases k + · change qmaPauliSupport (fun _ : ι ⊕ κ => 0) ⊆ ([] : List (ι ⊕ κ)).toFinset + simp [qmaPauliSupport] + · intro x hx + cases x with + | inl i => simp [outputWord,QuantumPolarizedSubdivision.word,qmaPauliSupport] at hx + | inr j => + have hj : j ∈ qmaPauliSupport (qmaSinglePauliWord e 3) := by + simpa [outputWord,QuantumPolarizedSubdivision.word,qmaPauliSupport] using hx + have hje := qmaSinglePauliWord_support e 3 hj + simpa [outputSites] using hje + · exact join_support_cover ((xs e).take d) + (QuantumOrderedSplit.firstWord (xs e) d (w e)) + (qmaPauliRestrict_support _ _) e _ + · exact join_support_cover ((xs e).drop d) + (QuantumOrderedSplit.secondWord (xs e) d (w e)) + (qmaPauliRestrict_support _ _) e _ + +end ContinuumCoulomb.QuantumOrderedSubdivision + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSupportDedup.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSupportDedup.lean new file mode 100644 index 0000000000000000000000000000000000000000..6341490c4f6f55a45b446a9a1290aafddbcf13e4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSupportDedup.lean @@ -0,0 +1,72 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumWalkErasure +import OAI.Computability.QuantumFactoring.BitStackListFold + +namespace OAI + +/-! The support compiler retains the last occurrence of each numeric label, +exactly as `List.dedup` does in the mathematical ordered support. -/ + +noncomputable section +open scoped List +namespace ContinuumCoulomb.QuantumSupportDedup +open ExactQuantumFactoring.BitStackProgram + +def insert (a : ℕ) (xs : List ℕ) : List ℕ := if a ∈ xs then xs else a::xs + +theorem insert_sublist (a : ℕ) (xs : List ℕ) : insert a xs <+ a::xs := by + unfold insert + split + · exact List.sublist_cons_self _ _ + · exact List.Sublist.refl _ + +theorem fold_sublist (xs ys : List ℕ) : + xs.foldl (fun zs a => insert a zs) ys <+ xs.reverse++ys := by + induction xs generalizing ys with + | nil => exact List.Sublist.refl _ + | cons a xs ih => + simp only [List.foldl_cons,List.reverse_cons,List.append_assoc,List.singleton_append] + exact (ih (insert a ys)).trans ((insert_sublist a ys).append_left xs.reverse) + +theorem fold_bound (xs ys : List ℕ) : + (listCode Nat.bits (xs.foldl (fun zs a => insert a zs) ys)).length ≤ + (listCode Nat.bits xs).length+(listCode Nat.bits ys).length := by + have h := QuantumWalkErasure.listCode_length_sublist Nat.bits (fold_sublist xs ys) + have ha := listCode_length_append Nat.bits xs.reverse ys + rw [listCode_length_rev] at ha + omega + +theorem foldr_eq (xs : List ℕ) : xs.foldr insert []=xs.dedup := by + induction xs with + | nil => rfl + | cons a xs ih => + rw [List.foldr_cons,ih,List.dedup_cons'] + rfl + +noncomputable opaque insertProgram : + Procedure (prodCode Nat.bits (listCode Nat.bits)) (listCode Nat.bits) + (fun x => insert x.1 x.2) := + (Procedure.conditional (QuantumFiniteMembership.memberProgram Nat.bits 0 Procedure.binaryEq) + (Procedure.second Nat.bits (listCode Nat.bits)) (Procedure.listCons Nat.bits)).congrFun + (by intro x; simp only [insert,decide_eq_true_eq]) + +noncomputable opaque foldProgram : + Procedure (prodCode (listCode Nat.bits) (listCode Nat.bits)) (listCode Nat.bits) + (fun x => x.1.foldl (fun zs a => insert a zs) x.2) := + Procedure.foldList 0 insertProgram Polynomial.X (by + intro xs ys i + have h := fold_bound (xs.take i) ys + have ht := listCode_length_take_le Nat.bits i xs + simp only [Polynomial.eval_X] + omega) + +noncomputable opaque program : Procedure (listCode Nat.bits) (listCode Nat.bits) List.dedup := + (foldProgram.comp ((Procedure.listReverse Nat.bits 0).pair + (Procedure.constant (listCode Nat.bits) (listCode Nat.bits) []))).congrFun (by + intro xs + simp only [Function.comp_apply,List.foldl_reverse,foldr_eq]) + +end ContinuumCoulomb.QuantumSupportDedup + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSupportLookup.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSupportLookup.lean new file mode 100644 index 0000000000000000000000000000000000000000..72ea33a400d8a0c72dcc9933492c8c3b678633a6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSupportLookup.lean @@ -0,0 +1,164 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFirstUseProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedTable +import OAI.Computability.QuantumFactoring.BitStackListIndex + +namespace OAI + +/-! The actual local support coordinates are read by literal label lookup. +This identifies a small matrix input with its zero extension on spectator +qubits, without enumerating the ambient spin basis. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumSupportLookup +open ExactQuantumFactoring.BitStackProgram + +abbrev Input := ℕ × (List ℕ × List ℕ) +def inputCode : Input → List Bool := + prodCode Nat.bits (prodCode (listCode Nat.bits) (listCode Nat.bits)) + +def value (x : Input) : ℕ := (x.2.2.drop (x.2.1.idxOf x.1)).headD 0 + +noncomputable def matchesProgram : + Procedure (prodCode Nat.bits (listCode Nat.bits)) (listCode Procedure.boolCode) + (fun x => x.2.map (fun a => decide (a=x.1))) := + Procedure.listMapWith (f := fun label a => decide (a=label)) 0 false + (Procedure.binaryEq.comp + ((Procedure.second Nat.bits Nat.bits).pair (Procedure.first Nat.bits Nat.bits))) + +noncomputable def indexProgram : + Procedure (prodCode Nat.bits (listCode Nat.bits)) Nat.bits + (fun x => x.2.idxOf x.1) := + ((Procedure.unaryToBits.comp QuantumFirstUseProgram.firstProgram).comp matchesProgram).congrFun + (by + intro x + simp only [Function.comp_apply,id_eq] + rw [QuantumFirstUseProgram.first_eq_findIdx,List.findIdx_map] + change x.2.findIdx (fun a => decide (a=x.1)) = x.2.findIdx (fun a => a==x.1) + congr 1) + +noncomputable def program : Procedure inputCode Nat.bits value := by + let label := Procedure.first Nat.bits (prodCode (listCode Nat.bits) (listCode Nat.bits)) + let rest := Procedure.second Nat.bits (prodCode (listCode Nat.bits) (listCode Nat.bits)) + let sites := (Procedure.first (listCode Nat.bits) (listCode Nat.bits)).comp rest + let bits := (Procedure.second (listCode Nat.bits) (listCode Nat.bits)).comp rest + exact (Procedure.listGet Nat.bits 0).comp + ((indexProgram.comp (label.pair sites)).pair bits) + +noncomputable def certificate : Turing.TM2ComputableInPolyTime inputCode Nat.bits value := + program.toTM2 + +theorem value_get (xs : List ℕ) (hx : xs.Nodup) (s : Fin xs.length → ℕ) + (i : Fin xs.length) : + value (xs.get i,xs,List.ofFn s)=s i := by + unfold value + rw [List.get_idxOf hx] + rw [List.headD_eq_head?_getD,List.head?_drop] + simp + +theorem value_absent (xs : List ℕ) (s : Fin xs.length → ℕ) (q : ℕ) + (hq : q ∉ xs) : value (q,xs,List.ofFn s)=0 := by + unfold value + rw [List.idxOf_of_notMem hq] + simp + +theorem value_map_get {α : Type} (xs : List α) (hx : xs.Nodup) + (f : α → ℕ) (hf : Function.Injective f) (s : Fin xs.length → ℕ) + (i : Fin xs.length) : + value (f (xs.get i),xs.map f,List.ofFn s)=s i := by + have hi : i.val < (xs.map f).length := by simpa only [List.length_map] using i.isLt + have he : (xs.map f)[i.val]'hi = f (xs.get i) := by + simp only [List.getElem_map,List.get_eq_getElem] + have hind := (hx.map hf).idxOf_getElem i.val hi + rw [he] at hind + unfold value + rw [hind,List.headD_eq_head?_getD,List.head?_drop] + simp + +theorem value_not_mem (xs ys : List ℕ) (q : ℕ) + (hq : q ∉ xs) (hy : ys.length ≤ xs.length) : value (q,xs,ys)=0 := by + unfold value + rw [List.idxOf_of_notMem hq,List.drop_eq_nil_of_le hy] + rfl + +open QuantumOrderedSupport +open scoped Classical + +private theorem extend_mem {α : Type} [Fintype α] [DecidableEq α] + (S : Finset α) (u : QMASupportBasis S) (q : α) (hq : q ∈ S) : + qmaSupportExtend S u q = u ⟨q,hq⟩ := + dite_eq_left hq + +private theorem extend_not_mem {α : Type} [Fintype α] [DecidableEq α] + (S : Finset α) (u : QMASupportBasis S) (q : α) (hq : q ∉ S) : + qmaSupportExtend S u q = 0 := + dite_eq_right hq + +def supportBits (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) + (s : Fin (sites c hT a).length → Fin 2) : List ℕ := + List.ofFn (fun i => (s i).val) + +theorem support_value (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) + (s : Fin (sites c hT a).length → Fin 2) (q : Qubit c) : + value (siteNumber c q,encodedSites c hT a,supportBits c hT a s) = + (qmaSupportExtend ((qmaOrderedHistoryModel c hT).sites a) + (fun i => s ((supportEquiv c hT a).symm i)) q).val := by + by_cases hq : q ∈ (qmaOrderedHistoryModel c hT).sites a + · let i := (supportEquiv c hT a).symm ⟨q,hq⟩ + have hi : (sites c hT a).get i=q := by + have h := congrArg Subtype.val ((supportEquiv c hT a).apply_symm_apply ⟨q,hq⟩) + exact h + have hlookup := value_map_get (sites c hT a) (sites_nodup c hT a) + (siteNumber c) (siteNumber_injective c) (fun j => (s j).val) i + have hv : value (siteNumber c q,encodedSites c hT a,supportBits c hT a s) = + (s i).val := by + simpa only [encodedSites,supportBits,hi] using hlookup + exact hv.trans (congrArg Fin.val (extend_mem + ((qmaOrderedHistoryModel c hT).sites a) + (fun j => s ((supportEquiv c hT a).symm j)) q hq)).symm + · have hn : siteNumber c q ∉ encodedSites c hT a := by + intro h + obtain ⟨p,hp,he⟩ := List.mem_map.mp h + have hpq := siteNumber_injective c he + subst p + apply hq + rw [← sites_finset c hT a] + exact List.mem_toFinset.mpr hp + have hzero := value_not_mem (encodedSites c hT a) (supportBits c hT a s) + (siteNumber c q) hn (by simp only [supportBits,List.length_ofFn, + encodedSites,List.length_map,le_refl]) + have hv : value (siteNumber c q,encodedSites c hT a,supportBits c hT a s) = 0 := by + exact hzero + exact hv.trans (congrArg Fin.val (extend_not_mem + ((qmaOrderedHistoryModel c hT).sites a) + (fun j => s ((supportEquiv c hT a).symm j)) q hq)).symm + +def readBit (x : Input) : Fin 2 := ⟨value x % 2,Nat.mod_lt _ (by decide)⟩ + +theorem support_readBit (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) + (s : Fin (sites c hT a).length → Fin 2) (q : Qubit c) : + readBit (siteNumber c q,encodedSites c hT a,supportBits c hT a s) = + qmaSupportExtend ((qmaOrderedHistoryModel c hT).sites a) + (fun i => s ((supportEquiv c hT a).symm i)) q := by + apply Fin.ext + change value _ % 2 = _ + rw [support_value] + exact Nat.mod_eq_of_lt (Fin.isLt _) + +theorem orderedTable_lookup (c : QMACircuit) (hT : 0 < c.gates.length) + (a : QMAReferenceTerm (qmaHistoryReferenceWork c)) + (s t : Fin (sites c hT a).length → Fin 2) : + QuantumAlgebraicHistory.orderedTable c hT a s t = + QuantumAlgebraicHistory.orderedTerm c hT a + (fun q => readBit (siteNumber c q,encodedSites c hT a,supportBits c hT a s)) + (fun q => readBit (siteNumber c q,encodedSites c hT a,supportBits c hT a t)) := by + unfold QuantumAlgebraicHistory.orderedTable QuantumAlgebraicHistory.orderedCore + congr 1 <;> funext q <;> exact (support_readBit c hT a _ q).symm + +end ContinuumCoulomb.QuantumSupportLookup + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSupportedSubdivision.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSupportedSubdivision.lean new file mode 100644 index 0000000000000000000000000000000000000000..7962c9452beef852581047b86096a0086cb179f1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSupportedSubdivision.lean @@ -0,0 +1,76 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionEnvelope + +namespace OAI + +/-! Simultaneous subdivision with explicit small supports inside each source envelope. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +theorem qmaPauliSubdivision_supported (w : κ → ι → Fin 4) (J : κ → ℝ) {d : ℕ} + (hw : ∀ e, (qmaPauliSupport (w e)).card ≤ 2*d) + (hEven : ∀ e, Even (qmaPauliYCount (w e))) {N : ℝ} (hN : 1 ≤ N) : + ∃ G : (κ × Fin 4) → Matrix (ι ⊕ κ → Fin 2) (ι ⊕ κ → Fin 2) ℂ, + (∀ p, (G p).IsHermitian) ∧ (∀ p, QMAEntryParity false (G p)) ∧ + (∀ p, ∃ S : Finset (ι ⊕ κ), S.card ≤ d+1 ∧ QMALocalOn S (G p) ∧ + S ⊆ qmaMediatorSupport (qmaPauliSupport (w p.1)) p.1) ∧ + |MediatorGraph.normalizedBottom (∑ p, G p)- + MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • qmaPauliWord (w e))| ≤ 1/N := by + choose L T hL hT hdis hcover using fun e => qmaBalancedSupport (qmaPauliSupport (w e)) d (hw e) + let A := fun e => qmaPauliWord (qmaPauliRestrict (L e) (w e)) + let B := fun e => qmaPauliWord (qmaPauliRestrict (T e) (w e)) + let m := fun e => decide (Odd (qmaPauliYCount (qmaPauliRestrict (L e) (w e)))) + let R := 8*(qmaThirdBudget 0 J)^4*N + let G := fun p : κ × Fin 4 => qmaSubdivisionLocalPiece (A p.1) (B p.1) p.1 R (J p.1) m p.2 + have hcover' (e : κ) : qmaPauliSupport (w e) ⊆ L e ∪ T e := by rw [hcover e] + have hAst (e : κ) : (A e).conjTranspose = A e := qmaPauliWord_hermitian _ + have hBst (e : κ) : (B e).conjTranspose = B e := qmaPauliWord_hermitian _ + have hAr (e : κ) : QMAEntryParity (m e) (A e) := qmaPauliWord_entryParity _ + have hBr (e : κ) : QMAEntryParity (m e) (B e) := by + dsimp only [m,B] + rw [qmaPauliRestrict_same_parity (L e) (T e) (w e) (hdis e) (hcover' e) (hEven e)] + exact qmaPauliWord_entryParity _ + have hAB (e : κ) : A e*B e = B e*A e := qmaPauliRestrict_commute _ _ _ (hdis e) + have hfactor (e : κ) : A e*B e = qmaPauliWord (w e) := + qmaPauliRestrict_factor _ _ _ (hdis e) (hcover' e) + have hAl (e : κ) : QMALocalOn (L e) (A e) := + (qmaPauliWord_support _).mono (qmaPauliRestrict_support _ _) + have hBl (e : κ) : QMALocalOn (T e) (B e) := + (qmaPauliWord_support _).mono (qmaPauliRestrict_support _ _) + refine ⟨G,?_,?_,?_,?_⟩ + · intro p + exact qmaSubdivisionLocalPiece_star _ _ _ _ _ _ (hAst p.1) (hBst p.1) p.2 + · intro p + exact qmaSubdivisionLocalPiece_real _ _ _ _ _ _ (hAr p.1) (hBr p.1) p.2 + · intro p + refine ⟨qmaSubdivisionPieceSites (L p.1) (T p.1) p.1 p.2, + qmaSubdivisionPieceSites_card (hL p.1) (hT p.1) _ _, + qmaSubdivisionPieceSites_local _ _ _ _ _ _ (hAl p.1) (hBl p.1) p.2,?_⟩ + apply qmaSubdivisionPieceSites_subset + · rw [←hcover p.1] + exact Finset.subset_union_left + · rw [←hcover p.1] + exact Finset.subset_union_right + · have hsum : (∑ p, G p) = qmaSubdivisionOnQubits 0 A B R J m := by + unfold qmaSubdivisionOnQubits + rw [qmaSubdivisionPolarized_decomposition] + simp only [Matrix.zero_kronecker,zero_add,MediatorGraph.submatrix_sum, + qmaSubdivisionPiece_reindex,Fintype.sum_prod_type,G] + have htarget : qmaSubdivisionTarget 0 A B (fun e => (J e:ℂ)) = + ∑ e, (J e:ℂ) • qmaPauliWord (w e) := by + simp only [qmaSubdivisionTarget,zero_add,hfactor] + rw [hsum,qmaSubdivisionOnQubits_bottom,← htarget] + apply qmaSubdivision_polynomial_accuracy 0 A B J (by norm_num) hN + Matrix.conjTranspose_zero (by simp) hAst hBst + (fun e => qmaPauliWord_square _) (fun e => qmaPauliWord_square _) hAB + (EuclideanSpace.single (fun _ : ι => (0 : Fin 2)) (1:ℂ)) + simp [PiLp.norm_single] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSupportedThird.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSupportedThird.lean new file mode 100644 index 0000000000000000000000000000000000000000..792aa301ef2aa7269611b808eeaac61157cc0fbd --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSupportedThird.lean @@ -0,0 +1,72 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTripleSupported +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdEnvelope + +namespace OAI + +/-! The actual phase-corrected third-order gadget reduces real three-local +Pauli families to real two-local families with inverse-polynomial error. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +theorem qmaPauliThird_supported (w : κ → ι → Fin 4) (J : κ → ℝ) + (hw : ∀ e, (qmaPauliSupport (w e)).card ≤ 3) + (hEven : ∀ e, Even (qmaPauliYCount (w e))) {N : ℝ} (hN : 1 ≤ N) : + ∃ G : (κ × Fin 7) → Matrix (ι ⊕ κ → Fin 2) (ι ⊕ κ → Fin 2) ℂ, + (∀ p, (G p).IsHermitian) ∧ (∀ p, QMAEntryParity false (G p)) ∧ + (∀ p, ∃ S : Finset (ι ⊕ κ), S.card ≤ 2 ∧ QMALocalOn S (G p) ∧ + S ⊆ qmaMediatorSupport (qmaPauliSupport (w p.1)) p.1) ∧ + |MediatorGraph.normalizedBottom (∑ p, G p)- + MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • qmaPauliWord (w e))| ≤ 1/N := by + choose a b c hsa hsb hsc ha hb hc habc hab hac hbc hpar hce using + fun e => qmaPauliWord_triple_supported (w e) (hw e) (hEven e) + let A := fun e => qmaPauliWord (a e) + let B := fun e => qmaPauliWord (b e) + let C := fun e => qmaPauliWord (c e) + let m := fun e => decide (Odd (qmaPauliYCount (a e))) + let R := 8*(qmaThirdBudget 0 J)^4*N + let G := fun p : κ × Fin 7 => qmaThirdPhasedLocalPiece (A p.1) (B p.1) (C p.1) p.1 R (J p.1) m p.2 + have hAst (e : κ) : (A e).conjTranspose = A e := qmaPauliWord_hermitian _ + have hBst (e : κ) : (B e).conjTranspose = B e := qmaPauliWord_hermitian _ + have hCst (e : κ) : (C e).conjTranspose = C e := qmaPauliWord_hermitian _ + have hAr (e : κ) : QMAEntryParity (m e) (A e) := qmaPauliWord_entryParity _ + have hBr (e : κ) : QMAEntryParity (m e) (B e) := by + dsimp only [m,B] + rw [hpar e] + exact qmaPauliWord_entryParity _ + have hCr (e : κ) : QMAEntryParity false (C e) := qmaPauliWord_real_of_even _ (hce e) + refine ⟨G,?_,?_,?_,?_⟩ + · intro p + exact qmaThirdPhasedLocalPiece_star _ _ _ _ _ _ _ (hAst p.1) (hBst p.1) (hCst p.1) (hab p.1) p.2 + · intro p + exact qmaThirdPhasedLocalPiece_real _ _ _ _ _ _ _ (hAr p.1) (hBr p.1) (hCr p.1) p.2 + · intro p + refine ⟨qmaThirdPieceSites (qmaPauliSupport (a p.1)) (qmaPauliSupport (b p.1)) + (qmaPauliSupport (c p.1)) p.1 p.2, + qmaThirdPieceSites_card (ha p.1) (hb p.1) (hc p.1) _ _, + qmaThirdPieceSites_local _ _ _ _ _ _ _ (qmaPauliWord_support (a p.1)) + (qmaPauliWord_support (b p.1)) (qmaPauliWord_support (c p.1)) p.2, + qmaThirdPieceSites_subset (hsa p.1) (hsb p.1) (hsc p.1) _ _⟩ + · have hsum : (∑ p, G p) = (qmaThirdPhased 0 A B C R J m).submatrix + (Equiv.sumArrowEquivProdArrow ι κ (Fin 2)) (Equiv.sumArrowEquivProdArrow ι κ (Fin 2)) := by + rw [qmaThirdPhased_decomposition] + simp only [Matrix.zero_kronecker,zero_add,MediatorGraph.submatrix_sum, + Fintype.sum_prod_type,G,qmaThirdPhasedLocalPiece] + have htarget : qmaThirdSeriesTarget 0 A B C (fun e => (J e:ℂ)) = + ∑ e, (J e:ℂ) • qmaPauliWord (w e) := by + simp only [qmaThirdSeriesTarget,zero_add,A,B,C,habc] + rw [hsum,MediatorGraph.normalizedBottom_reindex,qmaThirdPhased_bottom,← htarget] + apply qmaThirdGadget_polynomial_accuracy 0 A B C J (by norm_num) hN + Matrix.conjTranspose_zero (by simp) hAst hBst hCst + (fun e => qmaPauliWord_square _) (fun e => qmaPauliWord_square _) (fun e => qmaPauliWord_square _) + hab hac hbc (EuclideanSpace.single (fun _ : ι => (0 : Fin 2)) (1:ℂ)) + simp [PiLp.norm_single] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSwapConjugation.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSwapConjugation.lean new file mode 100644 index 0000000000000000000000000000000000000000..b8b456813b8630328fe9089f975ccea54c1e1971 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSwapConjugation.lean @@ -0,0 +1,38 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridAcceptance + +namespace OAI + +/-! Exact conjugation by the three-CNOT adjacent-swap program. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped Classical + +def qmaOrderedCnot (i j : ℕ) (forward : Bool) : QMAGate := + if forward then .controlledNot i j else .controlledNot j i + +theorem qmaWireSwap_conjugate {work : ℕ} (i j : Fin (work+1)) (hij : i ≠ j) + (g : QMAGate) : + qmaGateProduct work (qmaWireSwapGates i j)*qmaGateMatrix work g* + qmaGateProduct work (qmaWireSwapGates i j) = + qmaGateMatrix work (qmaRelabelGate work (Equiv.swap i j) g) := by + have hm : qmaGateProduct work (qmaWireSwapGates i j) = + qmaWirePermutation (qmaWireBasis (Equiv.swap i j)) := qmaWireSwap_matrix i j hij + rw [hm] + rw [qmaGate_wire_intertwines,Equiv.symm_swap,mul_assoc,qmaWireBasis_product, + Equiv.swap_swap,qmaWirePermutation_refl,mul_one] + +theorem qmaSwap_relabels_ordered {work : ℕ} (i j k : Fin (work+1)) + (hki : k ≠ i) (hkj : k ≠ j) (forward : Bool) : + qmaRelabelGate work (Equiv.swap i j) (qmaOrderedCnot j.val k.val forward) = + qmaOrderedCnot i.val k.val forward := by + cases forward <;> + simp [qmaOrderedCnot,qmaRelabelGate,qmaQubit_fin, + Equiv.swap_apply_of_ne_of_ne hki hkj] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepCellProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepCellProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..4c3ed4370dad24ce3ef5f90db783cbcc1407837d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepCellProgram.lean @@ -0,0 +1,120 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSweepCells +import OAI.Computability.QuantumFactoring.BitStackListMapWith + +namespace OAI + +/-! A polynomial program for the exact sweep tag list. Only unary width +and the actual gate-list length control list generation. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumSweepCells +open ExactQuantumFactoring.BitStackProgram QuantumCircuitCode + +def pairCode : (ℕ × ℕ) → List Bool := prodCode Nat.bits Nat.bits + +noncomputable opaque repeatProgram : Procedure (listCode Nat.bits) (listCode Nat.bits) + repeatColumns := by + let n := Procedure.identity Nat.bits + let nil := Procedure.constant Nat.bits (listCode Nat.bits) [] + let one := (Procedure.listCons Nat.bits).comp (n.pair nil) + let two := (Procedure.listCons Nat.bits).comp (n.pair one) + let three := (Procedure.listCons Nat.bits).comp (n.pair two) + exact ((QuantumRawExchange.flattenProgram Nat.bits 0).comp + (Procedure.listMap 0 [] three)).congrFun (by intro xs; rfl) + +noncomputable opaque columnsProgram : Procedure (prodCode unaryCode Nat.bits) + (listCode Nat.bits) (fun x => columns x.1 x.2) := by + let width := Procedure.first unaryCode Nat.bits + let context := (Procedure.unaryToBits.comp width).pair (Procedure.second unaryCode Nat.bits) + let env := Procedure.second unaryCode pairCode + let w := (Procedure.first Nat.bits Nat.bits).comp env + let order := (Procedure.second Nat.bits Nat.bits).comp env + let index := Procedure.unaryToBits.comp (Procedure.first unaryCode pairCode) + let entry := sweepIndexProgram.comp (w.pair (order.pair index)) + exact ((Procedure.tabulate (f := fun x i => sweepIndex x.1 x.2 i) 0 entry).comp + ((Procedure.unarySuccessor.comp width).pair context)).congrFun (by intro x; rfl) + +private noncomputable def takeProgram : Procedure (prodCode Nat.bits (listCode Nat.bits)) + (listCode Nat.bits) (fun x => x.2.take x.1) := by + let n := Procedure.first Nat.bits (listCode Nat.bits) + let xs := Procedure.second Nat.bits (listCode Nat.bits) + let len := (Procedure.listLength Nat.bits 0).comp xs + let count := Procedure.binarySub.comp (len.pair n) + let rev := (Procedure.listReverse Nat.bits 0).comp xs + exact ((Procedure.listReverse Nat.bits 0).comp + ((Procedure.listDrop Nat.bits).comp (count.pair rev))).congrFun (by + intro x + simp only [Function.comp_apply,← List.reverse_take,List.reverse_reverse]) + +noncomputable opaque rowColumnsProgram : Procedure stageInputCode (listCode Nat.bits) + (fun x => rowColumns x.2.1 (x.1-1-x.2.2.1) x.2.2.2) := by + let rows := Procedure.first Nat.bits (prodCode unaryCode (prodCode Nat.bits gateCode)) + let tail := Procedure.second Nat.bits (prodCode unaryCode (prodCode Nat.bits gateCode)) + let width := (Procedure.first unaryCode (prodCode Nat.bits gateCode)).comp tail + let rest := (Procedure.second unaryCode (prodCode Nat.bits gateCode)).comp tail + let start := (Procedure.first Nat.bits gateCode).comp rest + let gate := (Procedure.second Nat.bits gateCode).comp rest + let order := Procedure.binarySub.comp + ((Procedure.binarySub.comp (rows.pair + (Procedure.constant stageInputCode Nat.bits 1))).pair start) + let wb := Procedure.unaryToBits.comp width + let xs := columnsProgram.comp (width.pair order) + let cut := rowCutProgram.comp (wb.pair (order.pair gate)) + let front := repeatProgram.comp (takeProgram.comp (cut.pair xs)) + let back := repeatProgram.comp ((Procedure.listDrop Nat.bits).comp (cut.pair xs)) + let arrival := sweepIndexProgram.comp (wb.pair (order.pair + (Procedure.binarySub.comp (cut.pair (Procedure.constant stageInputCode Nat.bits 1))))) + let center := (Procedure.listCons Nat.bits).comp + (arrival.pair (Procedure.constant stageInputCode (listCode Nat.bits) [])) + let first := (Procedure.listAppend Nat.bits 0).comp (front.pair center) + exact (Procedure.listAppend Nat.bits 0).comp (first.pair back) + +noncomputable opaque rowCellsProgram : Procedure stageInputCode (listCode pairCode) + (fun x => rowCells x.1 x.2.1 x.2.2.1 x.2.2.2) := by + let tail := Procedure.second Nat.bits (prodCode unaryCode (prodCode Nat.bits gateCode)) + let rest := (Procedure.second unaryCode (prodCode Nat.bits gateCode)).comp tail + let start := (Procedure.first Nat.bits gateCode).comp rest + exact (Procedure.listMapWith (f := fun i j => (i,j)) 0 (0,0) + (Procedure.identity pairCode)).comp (start.pair rowColumnsProgram) + +noncomputable opaque sweepCellsProgram : Procedure sweepInputCode (listCode pairCode) + (fun x => sweepCells x.1 x.2.1 x.2.2.1 x.2.2.2) := by + let rest := Procedure.second Nat.bits (prodCode unaryCode (prodCode Nat.bits (listCode gateCode))) + let tail := (Procedure.second unaryCode (prodCode Nat.bits (listCode gateCode))).comp rest + let gates := (Procedure.second Nat.bits (listCode gateCode)).comp tail + let env := Procedure.second unaryCode sweepInputCode + let index := Procedure.unaryToBits.comp (Procedure.first unaryCode sweepInputCode) + let rows := (Procedure.first Nat.bits (prodCode unaryCode + (prodCode Nat.bits (listCode gateCode)))).comp env + let er := (Procedure.second Nat.bits (prodCode unaryCode + (prodCode Nat.bits (listCode gateCode)))).comp env + let width := (Procedure.first unaryCode (prodCode Nat.bits (listCode gateCode))).comp er + let et := (Procedure.second unaryCode (prodCode Nat.bits (listCode gateCode))).comp er + let start := (Procedure.first Nat.bits (listCode gateCode)).comp et + let gs := (Procedure.second Nat.bits (listCode gateCode)).comp et + let gate := (Procedure.listGet gateCode (.hadamard 0)).comp (index.pair gs) + let stage := rowCellsProgram.comp (rows.pair (width.pair + ((Procedure.binaryAdd.comp (start.pair index)).pair gate))) + let table := Procedure.tabulate (f := fun (x : SweepInput) i => + rowCells x.1 x.2.1 (x.2.2.1+i) (readGate x.2.2.2 i)) [] stage + exact ((QuantumRawExchange.flattenProgram pairCode (0,0)).comp + (table.comp ((gateLengthProgram.comp gates).pair + (Procedure.identity sweepInputCode)))).congrFun (by + intro x + simp only [Function.comp_apply,id_eq,sweepCells,List.flatMap_def]) + +noncomputable opaque valueProgram : Procedure circuitCode (listCode pairCode) value := by + let c := nearestCircuitProgram + let gs := gatesProgram.comp c + let rows := Procedure.unaryToBits.comp (gateLengthProgram.comp gs) + exact sweepCellsProgram.comp (rows.pair (workProgram.pair + ((Procedure.constant circuitCode Nat.bits 0).pair gs))) + +noncomputable def certificate : Turing.TM2ComputableInPolyTime circuitCode + (listCode pairCode) value := valueProgram.toTM2 + +end ContinuumCoulomb.QuantumSweepCells + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepCells.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepCells.lean new file mode 100644 index 0000000000000000000000000000000000000000..069d246bba4103f91d6c71a9205908b8b24d1b6e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepCells.lean @@ -0,0 +1,120 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSweepListProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSweepCongestion + +namespace OAI + +/-! Literal natural row/column tags for the sparse sweep. The +three gates of each wire transfer carry the same column; the original gate +keeps its proved arrival column. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumSweepCells +open QuantumCircuitCode + +def repeatColumns (xs : List ℕ) : List ℕ := xs.flatMap (fun j => [j,j,j]) + +def columns (width order : ℕ) : List ℕ := + (List.range (width+1)).map (sweepIndex width order) + +def rowColumns (width order : ℕ) (g : QMAGate) : List ℕ := + let xs := columns width order + let cut := rowCut width order g + repeatColumns (xs.take cut) ++ [sweepIndex width order (cut-1)] ++ + repeatColumns (xs.drop cut) + +def rowCells (rows width start : ℕ) (g : QMAGate) : List (ℕ × ℕ) := + (rowColumns width (rows-1-start) g).map (fun j => (start,j)) + +def sweepCells (rows width start : ℕ) (gs : List QMAGate) : List (ℕ × ℕ) := + (List.range gs.length).flatMap (fun i => + rowCells rows width (start+i) (readGate gs i)) + +def value (c : QMACircuit) : List (ℕ × ℕ) := + sweepCells (qmaNearestCircuit c).gates.length c.work 0 (qmaNearestCircuit c).gates + +theorem transfer_columns {width work : ℕ} + (l r : Fin (width+1) → Fin (work+1)) (xs : List (Fin (width+1))) : + (qmaColumnTransfer l r xs).map (fun p => p.2.val)= + repeatColumns (xs.map Fin.val) := by + induction xs with + | nil => rfl + | cons j xs ih => + simp only [qmaColumnTransfer,List.flatMap_cons,List.map_append, + qmaWireSwapGates,List.map_cons,List.map_nil,repeatColumns] + simpa only [repeatColumns,qmaColumnTransfer,qmaWireSwapGates,List.map_cons,List.map_nil] + using congrArg (fun ys => [j.val,j.val,j.val]++ys) ih + +theorem columns_actual (width order : ℕ) : + (List.ofFn (qmaSweepOrder width order)).map Fin.val=columns width order := by + apply List.ext_getElem + · simp only [List.length_map,List.length_ofFn,columns,List.length_range] + · intro i hi hj + simp only [List.getElem_map,List.getElem_ofFn,columns,List.getElem_range, + sweepIndex_value] + +theorem arrival_actual (width order : ℕ) (g : QMAGate) : + (qmaGateArrivalColumn width (qmaSweepOrder width order) g).val= + sweepIndex width order (rowCut width order g-1) := by + rw [qmaGateArrivalColumn,sweepIndex_value] + simp only [qmaGateArrivalIndex,rowCut_eq] + +theorem rowColumns_actual (width work order : ℕ) + (l r : Fin (width+1) → Fin (work+1)) (g : QMAGate) : + (qmaTaggedRowStage width work l r (qmaSweepOrder width order) g).map + (fun p => p.2.val)=rowColumns width order g := by + simp only [qmaTaggedRowStage,List.map_append,List.map_cons,List.map_nil, + transfer_columns,List.map_take,List.map_drop,columns_actual,rowCut_eq, + arrival_actual,rowColumns] + +theorem rowCells_actual (rows width start : ℕ) (hs : start < rows) (g : QMAGate) : + ((qmaTaggedRowStage width (qmaGridWork rows width) + (qmaGridQubit rows width ⟨start,by omega⟩) + (qmaGridQubit rows width ⟨start+1,by omega⟩) + (qmaSweepOrder width (rows-1-start)) g).map + (fun p => (p.1,((⟨start,by omega⟩ : Fin (rows+1)),p.2)))).map + (fun p => (p.2.1.val,p.2.2.val))=rowCells rows width start g := by + simpa only [List.map_map,Function.comp_def,rowCells] using + congrArg (List.map (fun j => (start,j))) + (rowColumns_actual width (qmaGridWork rows width) (rows-1-start) + (qmaGridQubit rows width ⟨start,by omega⟩) + (qmaGridQubit rows width ⟨start+1,by omega⟩) g) + +theorem sweepCells_cons (rows width start : ℕ) (g : QMAGate) (gs : List QMAGate) : + sweepCells rows width start (g::gs)= + rowCells rows width start g++sweepCells rows width (start+1) gs := by + simp only [sweepCells,List.length_cons,List.range_succ_eq_map,List.flatMap_cons, + List.flatMap_map,readGate,List.drop_zero,List.headD_cons,Nat.add_zero,List.drop_succ_cons] + congr 1 + have h : (fun i => rowCells rows width (start+Nat.succ i) + ((gs.drop i).headD (.hadamard 0)))= + (fun i => rowCells rows width (start+1+i) ((gs.drop i).headD (.hadamard 0))) := by + funext i + congr 1 + omega + rw [h] + +theorem sweepCells_actual (rows width start : ℕ) (gs : List QMAGate) + (h : start+gs.length ≤ rows) : + (qmaTaggedSweepFrom rows width start gs h).map + (fun p => (p.2.1.val,p.2.2.val))=sweepCells rows width start gs := by + induction gs generalizing start with + | nil => rfl + | cons g gs ih => + have hs : start < rows := by simp only [List.length_cons] at h; omega + rw [sweepCells_cons] + simp only [qmaTaggedSweepFrom,List.map_append] + rw [rowCells_actual rows width start hs g,ih] + +theorem value_actual (c : QMACircuit) : + value c=(qmaSparseTags c).map (fun p => (p.2.1.val,p.2.2.val)) := + (sweepCells_actual _ _ _ _ _).symm + +theorem value_length (c : QMACircuit) : + (value c).length=(qmaSparseCircuit c).gates.length := by + rw [value_actual,List.length_map,qmaSparseTags_length] + +end ContinuumCoulomb.QuantumSweepCells + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepCircuit.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepCircuit.lean new file mode 100644 index 0000000000000000000000000000000000000000..302b72f7f5ca5eb95867c846e24c9f0b1bf182de --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepCircuit.lean @@ -0,0 +1,98 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRowStageBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumNearestCircuit +import Mathlib.Data.Fin.Rev + +namespace OAI + +/-! Alternating row sweeps with gates inserted at the arrival of their operands. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped Classical + +def qmaSweepOrder (width row : ℕ) : Equiv.Perm (Fin (width+1)) := + if row % 2 = 0 then Equiv.refl _ else Fin.revPerm + +def qmaSweepCircuitFrom (rows width : ℕ) : + (start : ℕ) → (gs : List QMAGate) → start+gs.length ≤ rows → List QMAGate + | _,[],_ => [] + | start,g::gs,h => + qmaRowStage width (qmaGridWork rows width) + (qmaGridQubit rows width ⟨start,by simp only [List.length_cons] at h; omega⟩) + (qmaGridQubit rows width ⟨start+1,by simp only [List.length_cons] at h; omega⟩) + (qmaSweepOrder width (rows-1-start)) g ++ + qmaSweepCircuitFrom rows width (start+1) gs (by simp only [List.length_cons] at h; omega) + +theorem qmaSweepCircuitFrom_length (rows width start : ℕ) (gs : List QMAGate) + (h : start+gs.length ≤ rows) : + (qmaSweepCircuitFrom rows width start gs h).length = (3*(width+1)+1)*gs.length := by + induction gs generalizing start with + | nil => simp [qmaSweepCircuitFrom] + | cons g gs ih => + simp only [qmaSweepCircuitFrom,List.length_append,qmaRowStage_length,ih,List.length_cons] + ring + +theorem qmaSweepCircuitFrom_matrix (rows width start : ℕ) (gs : List QMAGate) + (h : start+gs.length ≤ rows) (hg : ∀ g ∈ gs, g.WellFormed (width+1)) : + qmaGateProduct (qmaGridWork rows width) (qmaSweepCircuitFrom rows width start gs h) = + qmaGateProduct (qmaGridWork rows width) (qmaGridCircuitFrom rows width start gs h) := by + induction gs generalizing start with + | nil => rfl + | cons g gs ih => + have hs : start < rows := by simp only [List.length_cons] at h; omega + have ht : start+1+gs.length ≤ rows := by simp only [List.length_cons] at h; omega + simp only [qmaSweepCircuitFrom,qmaGridCircuitFrom,qmaGateProduct_append, + qmaGateProduct_singleton] + rw [ih (start+1) ht (fun k hk => hg k (by simp [hk]))] + have hstage := qmaRowStage_matrix width (qmaGridWork rows width) + (qmaGridQubit rows width ⟨start,by omega⟩) + (qmaGridQubit rows width ⟨start+1,by omega⟩) + (qmaGridRow_injective rows width _) (qmaGridRow_injective rows width _) + (qmaGridRows_disjoint rows width _ _ (by intro he; have := congrArg Fin.val he; simp at this)) + (qmaSweepOrder width (rows-1-start)) g (hg g (by simp)) + rw [hstage] + rfl + +theorem qmaSweepCircuitFrom_wellFormed (rows width start : ℕ) (gs : List QMAGate) + (h : start+gs.length ≤ rows) (hg : ∀ g ∈ gs, g.WellFormed (width+1)) : + ∀ g ∈ qmaSweepCircuitFrom rows width start gs h, + g.WellFormed (qmaGridWork rows width+1) := by + induction gs generalizing start with + | nil => simp [qmaSweepCircuitFrom] + | cons g gs ih => + intro k hk + have hs : start < rows := by simp only [List.length_cons] at h; omega + have ht : start+1+gs.length ≤ rows := by simp only [List.length_cons] at h; omega + rcases List.mem_append.mp hk with hk | hk + · exact qmaRowStage_wellFormed _ _ _ _ (qmaGridRow_injective rows width _) + (qmaGridRows_disjoint rows width _ _ (qmaGridRow_ne rows ⟨start,hs⟩)) + _ g (hg g (by simp)) k hk + · exact ih (start+1) ht (fun k hk => hg k (by simp [hk])) k hk + +abbrev qmaSweepCircuit (c : QMACircuit) : QMACircuit := + ⟨qmaGridWork c.gates.length c.work,c.witness, + qmaSweepCircuitFrom c.gates.length c.work 0 c.gates (by omega)⟩ + +theorem qmaSweepCircuit_wellFormed (c : QMACircuit) (hc : c.WellFormed) : + (qmaSweepCircuit c).WellFormed := by + exact ⟨hc.1.trans (Nat.le_add_right _ _),qmaSweepCircuitFrom_wellFormed _ _ _ _ _ hc.2⟩ + +theorem qmaSweepCircuit_acceptance (c : QMACircuit) (hc : c.WellFormed) + (psi : EuclideanSpace ℂ (SourceSpinBasis c.witness)) : + qmaAcceptance (qmaSweepCircuit c) (qmaSweepCircuit_wellFormed c hc) psi = + qmaAcceptance c hc psi := by + have hm : qmaCircuitMatrix (qmaSweepCircuit c) = qmaCircuitMatrix (qmaGridCircuit c) := + qmaSweepCircuitFrom_matrix _ _ _ _ _ hc.2 + calc + _ = qmaAcceptance (qmaGridCircuit c) (qmaGridCircuit_wellFormed c hc) psi := by + unfold qmaAcceptance + rw [hm] + rfl + _ = _ := qmaGridCircuit_acceptance c hc psi + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepCongestion.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepCongestion.lean new file mode 100644 index 0000000000000000000000000000000000000000..cc73aa7e08e2f4ed726b6167e0ffeae95c36aad4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepCongestion.lean @@ -0,0 +1,78 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTaggedSweep + +namespace OAI + +/-! The complete literal sweep has at most four gates assigned to any grid cell. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +theorem qmaTagRow_count (rows width : ℕ) (ps : List (QMAGate × Fin (width+1))) + (r q : Fin (rows+1)) (j : Fin (width+1)) : + (((ps.map (fun p => (p.1,(r,p.2)))).filter + (fun p => decide (p.2 = (q,j)))).length) = + if r = q then (ps.filter (fun p => decide (p.2 = j))).length else 0 := by + induction ps with + | nil => simp + | cons p ps ih => + rcases p with ⟨g,i⟩ + by_cases hr : r = q + · subst q + by_cases hi : i = j <;> simp [hi,ih] + · simp [hr,ih] + +theorem qmaTaggedSweepFrom_before (rows width start : ℕ) (gs : List QMAGate) + (h : start+gs.length ≤ rows) (c : QMAGridCell rows width) (hc : c.1.val < start) : + ((qmaTaggedSweepFrom rows width start gs h).filter (fun p => decide (p.2 = c))).length = 0 := by + have he : (qmaTaggedSweepFrom rows width start gs h).filter (fun p => decide (p.2 = c)) = [] := by + apply List.filter_eq_nil_iff.mpr + intro p hp + simp only [decide_eq_true_eq] + intro hpc + have hh := qmaTaggedSweepFrom_rows rows width start gs h p hp + rw [hpc] at hh + omega + rw [he] + rfl + +theorem qmaTaggedSweepFrom_count (rows width start : ℕ) (gs : List QMAGate) + (h : start+gs.length ≤ rows) (c : QMAGridCell rows width) : + ((qmaTaggedSweepFrom rows width start gs h).filter (fun p => decide (p.2 = c))).length ≤ 4 := by + induction gs generalizing start with + | nil => simp [qmaTaggedSweepFrom] + | cons g gs ih => + rcases c with ⟨q,j⟩ + rw [qmaTaggedSweepFrom,List.filter_append,List.length_append,qmaTagRow_count] + split_ifs with hr + · have hq : q.val = start := by rw [←hr] + rw [qmaTaggedSweepFrom_before rows width (start+1) gs _ (q,j) (by simp [hq]),add_zero] + exact qmaTaggedRowStage_count _ _ _ _ _ _ _ + · simpa only [zero_add] using ih (start+1) _ + +def qmaSparseTags (c : QMACircuit) : + List (QMAGate × QMAGridCell (qmaNearestCircuit c).gates.length c.work) := + qmaTaggedSweepFrom (qmaNearestCircuit c).gates.length c.work 0 + (qmaNearestCircuit c).gates (by omega) + +theorem qmaSparseTags_gates (c : QMACircuit) : + (qmaSparseTags c).map Prod.fst = (qmaSparseCircuit c).gates := + qmaTaggedSweepFrom_gates _ _ _ _ _ + +theorem qmaSparseTags_count (c : QMACircuit) + (p : QMAGridCell (qmaNearestCircuit c).gates.length c.work) : + ((qmaSparseTags c).filter (fun q => decide (q.2 = p))).length ≤ 4 := + qmaTaggedSweepFrom_count _ _ _ _ _ _ + +theorem qmaSparseTags_located (c : QMACircuit) (hc : c.WellFormed) + (p : QMAGate × QMAGridCell (qmaNearestCircuit c).gates.length c.work) + (hp : p ∈ qmaSparseTags c) : + QMALocatedGate (qmaNearestCircuit c).gates.length c.work p.2.1 p.2.2 p.1 := + qmaTaggedSweepFrom_located _ _ _ _ _ (qmaNearestCircuit_wellFormed c hc).2 + (qmaNearestCircuit_adjacent c hc) p hp + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepCoverage.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepCoverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..b7cbf0f203c7d2635f45d2bf06d8a6a61a41bff5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepCoverage.lean @@ -0,0 +1,89 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSweepCongestion + +namespace OAI + +/-! Every physical row is touched in a nonempty sweep, including the final row. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +theorem qmaRowStage_containsSwap (width work : ℕ) + (l r : Fin (width+1) → Fin (work+1)) (e : Equiv.Perm (Fin (width+1))) + (g k : QMAGate) (i : Fin (width+1)) (hk : k ∈ qmaWireSwapGates (l i) (r i)) : + k ∈ qmaRowStage width work l r e g := by + let ps := qmaRowPairs (l ∘ e) (r ∘ e) + have hp : (l i,r i) ∈ ps := by + exact List.mem_ofFn.mpr ⟨e.symm i,by simp⟩ + have hcases : (l i,r i) ∈ ps.take (qmaGateCut width e g) ∨ + (l i,r i) ∈ ps.drop (qmaGateCut width e g) := by + rw [←List.mem_append,List.take_append_drop] + exact hp + change k ∈ qmaTransferGates (ps.take (qmaGateCut width e g)) ++ [_] ++ + qmaTransferGates (ps.drop (qmaGateCut width e g)) + rcases hcases with hp | hp + · exact List.mem_append_left _ (List.mem_append_left _ + ((qmaTransferGates_member _ k).mpr ⟨_,hp,hk⟩)) + · exact List.mem_append_right _ ((qmaTransferGates_member _ k).mpr ⟨_,hp,hk⟩) + +theorem qmaGridStage_touches (rows width : ℕ) (r : Fin rows) + (e : Equiv.Perm (Fin (width+1))) (g : QMAGate) (j : Fin (width+1)) : + ∃ k ∈ qmaRowStage width (qmaGridWork rows width) + (qmaGridQubit rows width r.castSucc) (qmaGridQubit rows width r.succ) e g, + qmaGridQubit rows width r.castSucc j ∈ qmaGateSites (qmaGridWork rows width) k ∧ + qmaGridQubit rows width r.succ j ∈ qmaGateSites (qmaGridWork rows width) k := by + let a := qmaGridQubit rows width r.castSucc j + let b := qmaGridQubit rows width r.succ j + refine ⟨.controlledNot a.val b.val,?_,?_⟩ + · apply qmaRowStage_containsSwap _ _ _ _ _ g _ j + simp [qmaWireSwapGates,a,b] + · simp [qmaGateSites,qmaQubit_fin,a,b] + +theorem qmaSweepCircuitFrom_touches (rows width start : ℕ) (gs : List QMAGate) + (h : start+gs.length ≤ rows) (hne : gs ≠ []) + (q : Fin (rows+1)) (hq : start ≤ q.val) (hq' : q.val ≤ start+gs.length) + (j : Fin (width+1)) : + ∃ k ∈ qmaSweepCircuitFrom rows width start gs h, + qmaGridQubit rows width q j ∈ qmaGateSites (qmaGridWork rows width) k := by + induction gs generalizing start with + | nil => exact False.elim (hne rfl) + | cons g gs ih => + have hs : start < rows := by simp only [List.length_cons] at h; omega + by_cases hnear : q.val ≤ start+1 + · obtain ⟨k,hk,hl,hr⟩ := qmaGridStage_touches rows width ⟨start,hs⟩ + (qmaSweepOrder width (rows-1-start)) g j + refine ⟨k,List.mem_append_left _ hk,?_⟩ + have hqcases : q = (⟨start,hs⟩ : Fin rows).castSucc ∨ + q = (⟨start,hs⟩ : Fin rows).succ := by + have : q.val = start ∨ q.val = start+1 := by omega + exact this.imp (fun h => Fin.ext h) (fun h => Fin.ext h) + rcases hqcases with rfl | rfl + · exact hl + · exact hr + · have htail : gs ≠ [] := by + intro he + simp only [he,List.length_cons,List.length_nil] at hq' + omega + obtain ⟨k,hk,hv⟩ := ih (start+1) (by simp only [List.length_cons] at h; omega) + htail (by omega) (by simp only [List.length_cons] at hq'; omega) + exact ⟨k,List.mem_append_right _ hk,hv⟩ + +theorem qmaGridQubit_surjective (rows width : ℕ) : + Function.Surjective (fun p : Fin (rows+1) × Fin (width+1) => qmaGridQubit rows width p.1 p.2) := by + apply ((Fintype.bijective_iff_injective_and_card _).mpr ⟨qmaGridQubit_injective rows width,?_⟩).2 + simp only [Fintype.card_prod,Fintype.card_fin] + unfold qmaGridWork + ring + +theorem qmaSweepCircuit_touches (c : QMACircuit) (hne : c.gates ≠ []) + (i : Fin ((qmaSweepCircuit c).work+1)) : + ∃ g ∈ (qmaSweepCircuit c).gates, i ∈ qmaGateSites (qmaSweepCircuit c).work g := by + obtain ⟨⟨r,j⟩,he⟩ := qmaGridQubit_surjective c.gates.length c.work i + rw [←he] + exact qmaSweepCircuitFrom_touches _ _ _ _ _ hne r (by omega) (by have := r.isLt; omega) j + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepCursor.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepCursor.lean new file mode 100644 index 0000000000000000000000000000000000000000..f413eadaecbb4dfd3ab0351dbe96b1cfaebdff29 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepCursor.lean @@ -0,0 +1,54 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTaggedStage + +namespace OAI + +/-! Exact sweep cursor around the inserted logical gate. -/ + +noncomputable section +namespace ContinuumCoulomb + +/-- Three transfer gates per column, with one gate inserted at the previous column. -/ +def qmaStageCursor (cut t : ℕ) : ℕ := + if t < 3*cut then t/3 else if t = 3*cut then cut-1 else (t-1)/3 + +theorem qmaStageCursor_lt (n cut t : ℕ) (hc : 0 < cut) (hcn : cut ≤ n) + (ht : t < 3*n+1) : qmaStageCursor cut t < n := by + unfold qmaStageCursor + split_ifs <;> omega + +theorem qmaStageCursor_step (cut t : ℕ) (hc : 0 < cut) : + qmaStageCursor cut t ≤ qmaStageCursor cut (t+1) ∧ + qmaStageCursor cut (t+1) ≤ qmaStageCursor cut t+1 := by + unfold qmaStageCursor + split_ifs <;> omega + +theorem qmaStageCursor_zero (cut : ℕ) (hc : 0 < cut) : qmaStageCursor cut 0 = 0 := by + simp [qmaStageCursor,show 0 < 3*cut by omega] + +theorem qmaStageCursor_last (n cut : ℕ) (hc : 0 < cut) (hcn : cut ≤ n) : + qmaStageCursor cut (3*n) = n-1 := by + unfold qmaStageCursor + split_ifs <;> omega + +def qmaStageCursorFin (width : ℕ) (e : Equiv.Perm (Fin (width+1))) (g : QMAGate) + (t : Fin (3*(width+1)+1)) : Fin (width+1) := + ⟨qmaStageCursor (qmaGateCut width e g) t.val, + qmaStageCursor_lt _ _ _ (by unfold qmaGateCut; omega) (qmaGateCut_le width e g) t.isLt⟩ + +theorem qmaSweepOrder_near (width row : ℕ) (i j : Fin (width+1)) + (hij : i.val ≤ j.val+1) (hji : j.val ≤ i.val+1) : + (qmaSweepOrder width row i).val ≤ (qmaSweepOrder width row j).val+1 ∧ + (qmaSweepOrder width row j).val ≤ (qmaSweepOrder width row i).val+1 := by + unfold qmaSweepOrder + split_ifs + · exact ⟨hij,hji⟩ + · simp only [Fin.revPerm_apply,Fin.val_rev] + have hi := i.isLt + have hj := j.isLt + omega + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepEndpoint.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepEndpoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..57bb18c96fa1f909eaf26bc4049d2351e624ded3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepEndpoint.lean @@ -0,0 +1,62 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumClockCells + +namespace OAI + +/-! The last clock cell lies beside the measured output on the final sweep row. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +theorem qmaTaggedSweepFrom_last (rows width start : ℕ) (g : QMAGate) (gs : List QMAGate) + (h : start+(g::gs).length ≤ rows) : + (qmaTaggedSweepFrom rows width start (g::gs) h).getLast?.map Prod.snd = + some ((⟨start+gs.length,by simp only [List.length_cons] at h; omega⟩ : Fin (rows+1)), + qmaSweepOrder width (rows-1-start-gs.length) (Fin.last width)) := by + induction gs generalizing start g with + | nil => + have hs : start < rows := by simp only [List.length_cons,List.length_nil] at h; omega + change ((qmaGridStageTags rows width ⟨start,hs⟩ (qmaSweepOrder width (rows-1-start)) g) ++ + []).getLast?.map Prod.snd = _ + simp only [List.append_nil] + exact qmaGridStageTags_last rows width ⟨start,hs⟩ _ g + | cons g' gs ih => + have hs : start < rows := by simp only [List.length_cons] at h; omega + change ((qmaGridStageTags rows width ⟨start,hs⟩ (qmaSweepOrder width (rows-1-start)) g) ++ + qmaTaggedSweepFrom rows width (start+1) (g'::gs) _).getLast?.map Prod.snd = _ + have ht : start+1+(g'::gs).length ≤ rows := by + simp only [List.length_cons] at h ⊢; omega + have hlast := ih (start+1) g' ht + have hne : (qmaTaggedSweepFrom rows width (start+1) (g'::gs) ht).getLast? ≠ none := by + intro he + rw [he] at hlast + simp at hlast + rw [List.getLast?_append,Option.or_eq_left_of_isSome (Option.isSome_iff_ne_none.mpr hne)] + have he : rows-1-(start+1)-gs.length = rows-1-start-(gs.length+1) := by omega + rw [hlast] + simp only [List.length_cons] + rw [he] + congr 2 + apply Fin.ext + dsimp only + omega + +theorem qmaTaggedSweepFrom_last_nonempty (rows width start : ℕ) (gs : List QMAGate) + (h : start+gs.length ≤ rows) (hne : gs ≠ []) : + (qmaTaggedSweepFrom rows width start gs h).getLast?.map Prod.snd = + some ((⟨start+gs.length-1,by have := List.length_pos_iff.mpr hne; omega⟩ : Fin (rows+1)), + qmaSweepOrder width (rows-start-gs.length) (Fin.last width)) := by + cases gs with + | nil => exact (hne rfl).elim + | cons g gs => + have hr : start+(g::gs).length-1 = start+gs.length := by + simp only [List.length_cons]; omega + have he : rows-start-(g::gs).length = rows-1-start-gs.length := by + simp only [List.length_cons]; omega + simpa only [hr,he] using qmaTaggedSweepFrom_last rows width start g gs h + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepIndex.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepIndex.lean new file mode 100644 index 0000000000000000000000000000000000000000..4d54aa2ea2650624576a6a0c29dc94e4e76a2ace --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepIndex.lean @@ -0,0 +1,97 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGateCode +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSweepCircuit + +namespace OAI + +/-! Natural-number formulas for the checked row sweep. These formulas keep +the same operand order and insertion point as the physical circuit. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumCircuitCode + +def sweepIndex (width row k : ℕ) : ℕ := if row%2=0 then k else width-k + +theorem sweepIndex_value (width row : ℕ) (i : Fin (width+1)) : + (qmaSweepOrder width row i).val=sweepIndex width row i.val := by + by_cases h : row%2=0 + · simp only [qmaSweepOrder,sweepIndex,h,ite_true,Equiv.refl_apply] + · simp [qmaSweepOrder,sweepIndex,h,Fin.revPerm,Fin.rev] + +theorem sweepIndex_inverse (width row : ℕ) (i : Fin (width+1)) : + ((qmaSweepOrder width row).symm i).val=sweepIndex width row i.val := by + by_cases h : row%2=0 + · simp only [qmaSweepOrder,sweepIndex,h,ite_true,Equiv.refl_symm,Equiv.refl_apply] + · simp [qmaSweepOrder,sweepIndex,h,Fin.revPerm,Fin.rev] + +def rowCut (width row : ℕ) (g : QMAGate) : ℕ := + let i := sweepIndex width row (gateLeft g%(width+1)) + let j := sweepIndex width row (gateRight g%(width+1)) + if gateTag g=2 then max i j+1 else i+1 + +theorem rowCut_eq (width row : ℕ) (g : QMAGate) : + qmaGateCut width (qmaSweepOrder width row) g=rowCut width row g := by + cases g <;> simp [qmaGateCut,qmaGateSites,rowCut,gateTag,gateLeft,gateRight, + sweepIndex_inverse,qmaQubit] + +def rowAddress (width row i : ℕ) : ℕ := row*(width+1)+i%(width+1) + +def mapToRow (width row : ℕ) : QMAGate → QMAGate + | .hadamard i => .hadamard (rowAddress width row i) + | .phaseT i => .phaseT (rowAddress width row i) + | .controlledNot i j => .controlledNot (rowAddress width row i) (rowAddress width row j) + +theorem mapToRow_eq (rows width : ℕ) (row : Fin (rows+1)) (g : QMAGate) : + qmaMapGate width (qmaGridWork rows width) (qmaGridQubit rows width row) g= + mapToRow width row.val g := by + cases g <;> rfl + +def rowPairs (width row order : ℕ) : List (ℕ × ℕ) := + (List.range (width+1)).map (fun k => + (row*(width+1)+sweepIndex width order k, + (row+1)*(width+1)+sweepIndex width order k)) + +theorem rowPairs_eq (rows width : ℕ) (row : Fin rows) (order : ℕ) : + (qmaRowPairs (qmaGridQubit rows width row.castSucc ∘ qmaSweepOrder width order) + (qmaGridQubit rows width row.succ ∘ qmaSweepOrder width order)).map + (fun p => (p.1.val,p.2.val))=rowPairs width row.val order := by + apply List.ext_getElem + · simp only [qmaRowPairs,rowPairs,List.length_map,List.length_ofFn,List.length_range] + · intro i hi hj + simp only [qmaRowPairs,rowPairs,List.getElem_map,List.getElem_ofFn,List.getElem_range, + Function.comp_apply,qmaGridQubit,Fin.val_castSucc,Fin.val_succ,sweepIndex_value] + +def transferList (ps : List (ℕ × ℕ)) : List QMAGate := + ps.flatMap (fun p => [.controlledNot p.1 p.2,.controlledNot p.2 p.1,.controlledNot p.1 p.2]) + +theorem transferList_eq {work : ℕ} (ps : List (Fin (work+1) × Fin (work+1))) : + qmaTransferGates ps=transferList (ps.map (fun p => (p.1.val,p.2.val))) := by + induction ps with + | nil => rfl + | cons p ps ih => + simp only [qmaTransferGates,List.map_cons,transferList,List.flatMap_cons,qmaWireSwapGates] + rw [ih] + rfl + +def rowStage (rows width start : ℕ) (g : QMAGate) : List QMAGate := + let order := rows-1-start + let ps := rowPairs width start order + let cut := rowCut width order g + transferList (ps.take cut)++[mapToRow width (start+1) g]++transferList (ps.drop cut) + +theorem rowStage_eq (rows width start : ℕ) (h : start < rows) (g : QMAGate) : + qmaRowStage width (qmaGridWork rows width) + (qmaGridQubit rows width ⟨start,by omega⟩) + (qmaGridQubit rows width ⟨start+1,by omega⟩) + (qmaSweepOrder width (rows-1-start)) g=rowStage rows width start g := by + unfold qmaRowStage rowStage + dsimp only + rw [rowCut_eq,transferList_eq,transferList_eq,List.map_take,List.map_drop] + have hp := rowPairs_eq rows width ⟨start,h⟩ (rows-1-start) + simp only [Fin.castSucc_mk,Fin.succ_mk] at hp + rw [hp,mapToRow_eq] + +end ContinuumCoulomb.QuantumCircuitCode + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepListProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepListProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..00965abf2a09f577574d85bafc5630a5c606ec09 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepListProgram.lean @@ -0,0 +1,103 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSweepProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumNearestProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGridLocality +import OAI.Computability.QuantumFactoring.BitStackBoundedUnary + +namespace OAI + +/-! The complete sweep is a finite table of the literal row stages, followed +by concatenation. It agrees with the recursive physical circuit. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumCircuitCode +open ExactQuantumFactoring.BitStackProgram + +def readGate (gs : List QMAGate) (i : ℕ) : QMAGate := + (gs.drop i).headD (.hadamard 0) + +def sweepList (rows width start : ℕ) (gs : List QMAGate) : List QMAGate := + (List.range gs.length).flatMap (fun i => rowStage rows width (start+i) (readGate gs i)) + +theorem sweepList_cons (rows width start : ℕ) (g : QMAGate) (gs : List QMAGate) : + sweepList rows width start (g::gs)= + rowStage rows width start g++sweepList rows width (start+1) gs := by + simp only [sweepList,List.length_cons,List.range_succ_eq_map,List.flatMap_cons, + List.flatMap_map,readGate,List.drop_zero,List.headD_cons, + Nat.add_zero,List.drop_succ_cons] + congr 1 + have h : (fun i => rowStage rows width (start+Nat.succ i) + ((gs.drop i).headD (.hadamard 0)))= + (fun i => rowStage rows width (start+1+i) ((gs.drop i).headD (.hadamard 0))) := by + funext i + congr 1 + omega + rw [h] + +theorem sweepList_eq (rows width start : ℕ) (gs : List QMAGate) + (h : start+gs.length ≤ rows) : + qmaSweepCircuitFrom rows width start gs h=sweepList rows width start gs := by + induction gs generalizing start with + | nil => rfl + | cons g gs ih => + have hs : start < rows := by simp only [List.length_cons] at h; omega + rw [sweepList_cons] + simp only [qmaSweepCircuitFrom] + rw [rowStage_eq rows width start hs,ih] + +noncomputable def gateLengthProgram : Procedure (listCode gateCode) unaryCode List.length := + Procedure.boundedUnary (Procedure.listLength gateCode (.hadamard 0)) + (Procedure.length.precompose (listCode gateCode)) (list_length_le_code gateCode) + +abbrev SweepInput := ℕ × (ℕ × (ℕ × List QMAGate)) +def sweepInputCode : SweepInput → List Bool := + prodCode Nat.bits (prodCode unaryCode (prodCode Nat.bits (listCode gateCode))) + +noncomputable def sweepListProgram : Procedure sweepInputCode (listCode gateCode) + (fun x => sweepList x.1 x.2.1 x.2.2.1 x.2.2.2) := by + let rest := Procedure.second Nat.bits (prodCode unaryCode (prodCode Nat.bits (listCode gateCode))) + let tail := (Procedure.second unaryCode (prodCode Nat.bits (listCode gateCode))).comp rest + let gates := (Procedure.second Nat.bits (listCode gateCode)).comp tail + let context := Procedure.second unaryCode sweepInputCode + let index := Procedure.unaryToBits.comp (Procedure.first unaryCode sweepInputCode) + let rows := (Procedure.first Nat.bits (prodCode unaryCode (prodCode Nat.bits (listCode gateCode)))).comp context + let cr := (Procedure.second Nat.bits (prodCode unaryCode (prodCode Nat.bits (listCode gateCode)))).comp context + let width := (Procedure.first unaryCode (prodCode Nat.bits (listCode gateCode))).comp cr + let ct := (Procedure.second unaryCode (prodCode Nat.bits (listCode gateCode))).comp cr + let start := (Procedure.first Nat.bits (listCode gateCode)).comp ct + let gs := (Procedure.second Nat.bits (listCode gateCode)).comp ct + let gate := (Procedure.listGet gateCode (.hadamard 0)).comp (index.pair gs) + let stage := rowStageProgram.comp + (rows.pair (width.pair ((Procedure.binaryAdd.comp (start.pair index)).pair gate))) + let table := Procedure.tabulate (f := fun (x : SweepInput) i => + rowStage x.1 x.2.1 (x.2.2.1+i) (readGate x.2.2.2 i)) [] stage + exact ((QuantumRawExchange.flattenProgram gateCode (.hadamard 0)).comp + (table.comp ((gateLengthProgram.comp gates).pair + (Procedure.identity sweepInputCode)))).congrFun (by + intro x + simp only [Function.comp_apply,id_eq,sweepList,List.flatMap_def]) + +noncomputable def sweepCircuitProgram : Procedure circuitCode circuitCode qmaSweepCircuit := by + let rows := gateLengthProgram.comp gatesProgram + let count := Procedure.unaryAdd.comp + (workProgram.pair (Procedure.unaryMul.comp + (rows.pair (Procedure.unarySuccessor.comp workProgram)))) + let gates := sweepListProgram.comp ((Procedure.unaryToBits.comp rows).pair + (workProgram.pair ((Procedure.constant circuitCode Nat.bits 0).pair gatesProgram))) + exact (count.pair (witnessProgram.pair gates)).result (by + intro c + change prodCode unaryCode (prodCode unaryCode (listCode gateCode)) + (qmaGridWork c.gates.length c.work,c.witness, + sweepList c.gates.length c.work 0 c.gates)= + prodCode unaryCode (prodCode unaryCode (listCode gateCode)) + (qmaGridWork c.gates.length c.work,c.witness, + qmaSweepCircuitFrom c.gates.length c.work 0 c.gates _) + rw [sweepList_eq]) + +noncomputable def sparseCircuitProgram : Procedure circuitCode circuitCode qmaSparseCircuit := + sweepCircuitProgram.comp nearestCircuitProgram + +end ContinuumCoulomb.QuantumCircuitCode + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..09947bd808cd11fd5dd879326de65e709bb1ccb7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumSweepProgram.lean @@ -0,0 +1,164 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSweepIndex +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRawFamilyProgram +import OAI.Computability.QuantumFactoring.BitStackTabulate +import OAI.Computability.QuantumFactoring.BitStackListIndex +import OAI.Computability.QuantumFactoring.BitStackListLength + +namespace OAI + +/-! Literal arithmetic and finite lists for the alternating row sweep. The +row width is supplied in unary exactly where a list is enumerated. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumCircuitCode +open ExactQuantumFactoring.BitStackProgram + +abbrev TripleNat := ℕ × (ℕ × ℕ) +def tripleNatCode : TripleNat → List Bool := prodCode Nat.bits (prodCode Nat.bits Nat.bits) + +noncomputable def sweepIndexProgram : Procedure tripleNatCode Nat.bits + (fun x => sweepIndex x.1 x.2.1 x.2.2) := by + let w := Procedure.first Nat.bits (prodCode Nat.bits Nat.bits) + let rest := Procedure.second Nat.bits (prodCode Nat.bits Nat.bits) + let row := (Procedure.first Nat.bits Nat.bits).comp rest + let k := (Procedure.second Nat.bits Nat.bits).comp rest + let parity := Procedure.binaryZero.comp (Procedure.binaryMod.comp + (row.pair (Procedure.constant tripleNatCode Nat.bits 2))) + exact (Procedure.conditional parity k (Procedure.binarySub.comp (w.pair k))).congrFun + (by intro x; simp only [Function.comp_apply,sweepIndex,decide_eq_true_eq]) + +abbrev RowGate := ℕ × (ℕ × QMAGate) +def rowGateCode : RowGate → List Bool := prodCode Nat.bits (prodCode Nat.bits gateCode) + +noncomputable def rowCutProgram : Procedure rowGateCode Nat.bits + (fun x => rowCut x.1 x.2.1 x.2.2) := by + let w := Procedure.first Nat.bits (prodCode Nat.bits gateCode) + let rest := Procedure.second Nat.bits (prodCode Nat.bits gateCode) + let row := (Procedure.first Nat.bits gateCode).comp rest + let gate := (Procedure.second Nat.bits gateCode).comp rest + let modulus := Procedure.successor.comp w + let left := Procedure.binaryMod.comp ((gateLeftProgram.comp gate).pair modulus) + let right := Procedure.binaryMod.comp ((gateRightProgram.comp gate).pair modulus) + let i := sweepIndexProgram.comp (w.pair (row.pair left)) + let j := sweepIndexProgram.comp (w.pair (row.pair right)) + let maximum := Procedure.conditional (Procedure.binaryLe.comp (i.pair j)) j i + let tag := Procedure.binaryEq.comp ((gateTagProgram.comp gate).pair + (Procedure.constant rowGateCode Nat.bits 2)) + exact (Procedure.successor.comp (Procedure.conditional tag maximum i)).congrFun (by + intro x + simp only [Function.comp_apply,decide_eq_true_eq,rowCut] + split <;> simp only [max_def]) + +noncomputable def rowAddressProgram : Procedure tripleNatCode Nat.bits + (fun x => rowAddress x.1 x.2.1 x.2.2) := by + let w := Procedure.first Nat.bits (prodCode Nat.bits Nat.bits) + let rest := Procedure.second Nat.bits (prodCode Nat.bits Nat.bits) + let row := (Procedure.first Nat.bits Nat.bits).comp rest + let i := (Procedure.second Nat.bits Nat.bits).comp rest + let modulus := Procedure.successor.comp w + exact Procedure.binaryAdd.comp ((Procedure.binaryMul.comp (row.pair modulus)).pair + (Procedure.binaryMod.comp (i.pair modulus))) + +noncomputable def mapToRowProgram : Procedure rowGateCode gateCode + (fun x => mapToRow x.1 x.2.1 x.2.2) := by + let w := Procedure.first Nat.bits (prodCode Nat.bits gateCode) + let rest := Procedure.second Nat.bits (prodCode Nat.bits gateCode) + let row := (Procedure.first Nat.bits gateCode).comp rest + let gate := (Procedure.second Nat.bits gateCode).comp rest + let left := rowAddressProgram.comp (w.pair (row.pair (gateLeftProgram.comp gate))) + let right := rowAddressProgram.comp (w.pair (row.pair (gateRightProgram.comp gate))) + let tag := gateTagProgram.comp gate + let isH := Procedure.binaryZero.comp tag + let isT := Procedure.binaryEq.comp (tag.pair (Procedure.constant rowGateCode Nat.bits 1)) + exact (Procedure.conditional isH (hadamardProgram.comp left) + (Procedure.conditional isT (phaseProgram.comp left) + (cnotProgram.comp (left.pair right)))).congrFun (by + rintro ⟨w,row,g⟩ + cases g <;> rfl) + +def wirePairCode : (ℕ × ℕ) → List Bool := prodCode Nat.bits Nat.bits +def rowPairsInputCode : TripleNat → List Bool := + prodCode unaryCode (prodCode Nat.bits Nat.bits) + +noncomputable def rowPairsProgram : Procedure rowPairsInputCode (listCode wirePairCode) + (fun x => rowPairs x.1 x.2.1 x.2.2) := by + let w := Procedure.first unaryCode (prodCode Nat.bits Nat.bits) + let rest := Procedure.second unaryCode (prodCode Nat.bits Nat.bits) + let wb := Procedure.unaryToBits.comp w + let context := wb.pair rest + let pointContext := Procedure.second unaryCode tripleNatCode + let k := Procedure.unaryToBits.comp (Procedure.first unaryCode tripleNatCode) + let pw := (Procedure.first Nat.bits (prodCode Nat.bits Nat.bits)).comp pointContext + let pr := (Procedure.second Nat.bits (prodCode Nat.bits Nat.bits)).comp pointContext + let row := (Procedure.first Nat.bits Nat.bits).comp pr + let order := (Procedure.second Nat.bits Nat.bits).comp pr + let index := sweepIndexProgram.comp (pw.pair (order.pair k)) + let modulus := Procedure.successor.comp pw + let left := Procedure.binaryAdd.comp + ((Procedure.binaryMul.comp (row.pair modulus)).pair index) + let right := Procedure.binaryAdd.comp + ((Procedure.binaryMul.comp ((Procedure.successor.comp row).pair modulus)).pair index) + let point := left.pair right + exact ((Procedure.tabulate (f := fun x k => + (x.2.1*(x.1+1)+sweepIndex x.1 x.2.2 k, + (x.2.1+1)*(x.1+1)+sweepIndex x.1 x.2.2 k)) (0,0) point).comp + ((Procedure.unarySuccessor.comp w).pair context)).congrFun (by intro x; rfl) + +noncomputable def transferListProgram : Procedure (listCode wirePairCode) (listCode gateCode) + transferList := by + let left := Procedure.first Nat.bits Nat.bits + let right := Procedure.second Nat.bits Nat.bits + let forward := cnotProgram + let backward := cnotProgram.comp (right.pair left) + let nil := Procedure.constant wirePairCode (listCode gateCode) [] + let one := (Procedure.listCons gateCode).comp (forward.pair nil) + let two := (Procedure.listCons gateCode).comp (backward.pair one) + let three := (Procedure.listCons gateCode).comp (forward.pair two) + exact ((QuantumRawExchange.flattenProgram gateCode (.hadamard 0)).comp + (Procedure.listMap (0,0) [] three)).congrFun (by intro ps; rfl) + +private noncomputable def pairTakeProgram : + Procedure (prodCode Nat.bits (listCode wirePairCode)) (listCode wirePairCode) + (fun x => x.2.take x.1) := by + let n := Procedure.first Nat.bits (listCode wirePairCode) + let ps := Procedure.second Nat.bits (listCode wirePairCode) + let len := (Procedure.listLength wirePairCode (0,0)).comp ps + let count := Procedure.binarySub.comp (len.pair n) + let reverse := (Procedure.listReverse wirePairCode (0,0)).comp ps + exact ((Procedure.listReverse wirePairCode (0,0)).comp + ((Procedure.listDrop wirePairCode).comp (count.pair reverse))).congrFun (by + intro x + simp only [Function.comp_apply,← List.reverse_take,List.reverse_reverse]) + +abbrev StageInput := ℕ × (ℕ × (ℕ × QMAGate)) +def stageInputCode : StageInput → List Bool := + prodCode Nat.bits (prodCode unaryCode (prodCode Nat.bits gateCode)) + +noncomputable def rowStageProgram : Procedure stageInputCode (listCode gateCode) + (fun x => rowStage x.1 x.2.1 x.2.2.1 x.2.2.2) := by + let rows := Procedure.first Nat.bits (prodCode unaryCode (prodCode Nat.bits gateCode)) + let tail := Procedure.second Nat.bits (prodCode unaryCode (prodCode Nat.bits gateCode)) + let width := (Procedure.first unaryCode (prodCode Nat.bits gateCode)).comp tail + let rest := (Procedure.second unaryCode (prodCode Nat.bits gateCode)).comp tail + let start := (Procedure.first Nat.bits gateCode).comp rest + let gate := (Procedure.second Nat.bits gateCode).comp rest + let order := Procedure.binarySub.comp + ((Procedure.binarySub.comp (rows.pair + (Procedure.constant stageInputCode Nat.bits 1))).pair start) + let ps := rowPairsProgram.comp (width.pair (start.pair order)) + let cut := rowCutProgram.comp + ((Procedure.unaryToBits.comp width).pair (order.pair gate)) + let front := transferListProgram.comp (pairTakeProgram.comp (cut.pair ps)) + let back := transferListProgram.comp ((Procedure.listDrop wirePairCode).comp (cut.pair ps)) + let mapped := mapToRowProgram.comp ((Procedure.unaryToBits.comp width).pair + ((Procedure.successor.comp start).pair gate)) + let center := (Procedure.listCons gateCode).comp + (mapped.pair (Procedure.constant stageInputCode (listCode gateCode) [])) + let first := (Procedure.listAppend gateCode (.hadamard 0)).comp (front.pair center) + exact (Procedure.listAppend gateCode (.hadamard 0)).comp (first.pair back) + +end ContinuumCoulomb.QuantumCircuitCode + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTaggedRouteProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTaggedRouteProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd85f687b4049f155e98f457e8ee8385ebfd1679 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTaggedRouteProgram.lean @@ -0,0 +1,146 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRoutingTable +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCellCatalogProgram + +namespace OAI + +/-! Evaluate each candidate together with its finite permission bit. Keeping +that bit attached to the path preserves the exact catalog order during the +bounded search, including reversed paths. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumTaggedRouteProgram +open scoped Classical +open ExactQuantumFactoring.BitStackProgram QuantumRouteCode +open QuantumRoutingTable + +abbrev Tagged := Bool × List Pair +def taggedCode : Tagged → List Bool := prodCode Procedure.boolCode (listCode pairCode) +def bodyPermitted (t : Table) (B : QMACellRouteBody) : Bool := allowed t B && decide B.Valid + +theorem bodyPermitted_eq_true (t : Table) (B : QMACellRouteBody) : + bodyPermitted t B = true ↔ allowed t B = true ∧ B.Valid := by + simp only [bodyPermitted,Bool.and_eq_true] + exact and_congr_right (fun _ => ⟨of_decide_eq_true,decide_eq_true⟩) + +def tagged (t : Table) (R : QMACellRoute) : Tagged := (bodyPermitted t R.body,R.path) + +def oriented (b : Bool) (xs : List Pair) : List Tagged := [(b,xs),(b,xs.reverse)] + +private noncomputable def append {α β : Type} (ea : α → List Bool) (eb : β → List Bool) + (d : β) {f g : α → List β} (p : Procedure ea (listCode eb) f) + (q : Procedure ea (listCode eb) g) : Procedure ea (listCode eb) (fun x => f x++g x) := + (Procedure.listAppend eb d).comp (p.pair q) + +private noncomputable def fixedFlat {α β : Type} (ea : α → List Bool) (eb : β → List Bool) + (d : β) (m : ℕ) (f : Fin m → α → List β) + (p : ∀ i, Procedure ea (listCode eb) (f i)) : + Procedure ea (listCode eb) (fun x => (List.ofFn (fun i => f i x)).flatten) := by + induction m with + | zero => exact (Procedure.constant _ _ []).congrFun (by intro x; simp) + | succ m ih => + exact (append ea eb d (p 0) (ih (fun i => f i.succ) (fun i => p i.succ))).congrFun (by + intro x + simp only [List.ofFn_succ,List.flatten_cons]) + +noncomputable opaque orientedProgram : Procedure taggedCode (listCode taggedCode) + (fun x => oriented x.1 x.2) := by + let same := Procedure.identity taggedCode + let rev := (Procedure.first Procedure.boolCode (listCode pairCode)).pair + ((Procedure.listReverse pairCode (0,0)).comp + (Procedure.second Procedure.boolCode (listCode pairCode))) + exact (Procedure.listCons taggedCode).comp (same.pair + ((Procedure.listCons taggedCode).comp + (rev.pair (Procedure.constant taggedCode (listCode taggedCode) [])))) + +private noncomputable def bodyProgram (B : Pair → QMACellRouteBody) + (p : Procedure inputCode (listCode pairCode) (fun x => (B x.2).path)) + (q : Procedure inputCode Procedure.boolCode (fun x => bodyPermitted x.1 (B x.2))) : + Procedure inputCode (listCode taggedCode) + (fun x => oriented (bodyPermitted x.1 (B x.2)) ((B x.2).path)) := + orientedProgram.comp (q.pair p) + +noncomputable opaque rayProgram (a : Fin 4) : Procedure inputCode (listCode taggedCode) + (fun x => oriented (bodyPermitted x.1 (.ray x.2 a)) ((QMACellRouteBody.ray x.2 a).path)) := + bodyProgram (fun p => .ray p a) ((QuantumCellPathProgram.rayProgram a).comp cellProgram) + ((rayAllowedProgram a).congrFun (by + intro x + apply Bool.eq_iff_iff.mpr + rw [bodyPermitted_eq_true] + exact ⟨fun h => ⟨h,trivial⟩,And.left⟩)) + +noncomputable opaque pairProgram (e : Fin 6) : Procedure inputCode (listCode taggedCode) + (fun x => oriented (bodyPermitted x.1 (.pair x.2 e)) ((QMACellRouteBody.pair x.2 e).path)) := + bodyProgram (fun p => .pair p e) ((QuantumCellPathProgram.pairProgram e).comp cellProgram) + ((pairAllowedProgram e).congrFun (by + intro x + apply Bool.eq_iff_iff.mpr + rw [bodyPermitted_eq_true] + exact ⟨fun h => ⟨h,trivial⟩,And.left⟩)) + +noncomputable opaque patchProgram (e : Fin 9) : Procedure inputCode (listCode taggedCode) + (fun x => oriented (bodyPermitted x.1 (.patch x.2 e)) ((QMACellRouteBody.patch x.2 e).path)) := + bodyProgram (fun p => .patch p e) ((QuantumCellPathProgram.patchProgram e).comp cellProgram) + ((patchAllowedProgram e).congrFun (by + intro x + apply Bool.eq_iff_iff.mpr + rw [bodyPermitted_eq_true] + exact ⟨fun h => ⟨h,trivial⟩,And.left⟩)) + +noncomputable opaque cellPositiveProgram : Procedure inputCode Procedure.boolCode + (fun x => decide (0 < x.2.1 ∧ 0 < x.2.2)) := by + let one := Procedure.constant inputCode Nat.bits 1 + let px := (Procedure.first Nat.bits Nat.bits).comp cellProgram + let py := (Procedure.second Nat.bits Nat.bits).comp cellProgram + exact (Procedure.boolAnd.comp + ((Procedure.binaryLe.comp (one.pair px)).pair (Procedure.binaryLe.comp (one.pair py)))).congrFun (by + intro x + apply Bool.eq_iff_iff.mpr + simp only [Function.comp_apply,Bool.and_eq_true,decide_eq_true_eq] + omega) + +noncomputable opaque corridorProgram (a : Fin 4) (b c : Bool) : + Procedure inputCode (listCode taggedCode) + (fun x => oriented (bodyPermitted x.1 (.corridor x.2 a b c)) + ((QMACellRouteBody.corridor x.2 a b c).path)) := + bodyProgram (fun p => .corridor p a b c) + ((QuantumCellPathProgram.corridorProgram a b c).comp cellProgram) + ((Procedure.boolAnd.comp ((corridorAllowedProgram a b c).pair cellPositiveProgram)).congrFun (by + intro x + apply Bool.eq_iff_iff.mpr + simp only [Function.comp_apply,Bool.and_eq_true,decide_eq_true_eq,bodyPermitted_eq_true] + rfl)) + +noncomputable opaque corridorBlock (a : Fin 4) : Procedure inputCode (listCode taggedCode) + (fun x => oriented (bodyPermitted x.1 (.corridor x.2 a false false)) + ((QMACellRouteBody.corridor x.2 a false false).path) ++ + oriented (bodyPermitted x.1 (.corridor x.2 a false true)) + ((QMACellRouteBody.corridor x.2 a false true).path) ++ + oriented (bodyPermitted x.1 (.corridor x.2 a true false)) + ((QMACellRouteBody.corridor x.2 a true false).path) ++ + oriented (bodyPermitted x.1 (.corridor x.2 a true true)) + ((QMACellRouteBody.corridor x.2 a true true).path)) := + append inputCode taggedCode (false,[]) (append inputCode taggedCode (false,[]) + (append inputCode taggedCode (false,[]) (corridorProgram a false false) + (corridorProgram a false true)) (corridorProgram a true false)) (corridorProgram a true true) + +noncomputable opaque cellProgram : Procedure inputCode (listCode taggedCode) + (fun x => (qmaCellRoutes x.2).map (tagged x.1)) := by + let rays := fixedFlat inputCode taggedCode (false,[]) 4 _ rayProgram + let pairs := fixedFlat inputCode taggedCode (false,[]) 6 _ pairProgram + let patches := fixedFlat inputCode taggedCode (false,[]) 9 _ patchProgram + let corridors := fixedFlat inputCode taggedCode (false,[]) 4 _ corridorBlock + exact (append inputCode taggedCode (false,[]) + (append inputCode taggedCode (false,[]) (append inputCode taggedCode (false,[]) rays pairs) + patches) corridors).congrFun (by + intro x + simp only [qmaCellRoutes,qmaCellBodies,List.flatMap_def,List.map_flatten,List.map_append, + List.map_map,List.ofFn_eq_map,List.map_cons,List.map_nil,List.flatten_cons,List.flatten_nil, + List.flatten_append,List.flatten_flatten, + Function.comp_def,tagged,oriented,QMACellRoute.path,Bool.false_eq_true,ite_false,ite_true, + List.append_assoc,List.append_nil]) + +end ContinuumCoulomb.QuantumTaggedRouteProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTaggedStage.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTaggedStage.lean new file mode 100644 index 0000000000000000000000000000000000000000..1333d733e9c53fd00cc5b13f3d66889d7734e48d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTaggedStage.lean @@ -0,0 +1,69 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTaggedTransfer + +namespace OAI + +/-! Exact labelled row stages with at most four computation gates per column. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +def qmaTaggedRowStage (width work : ℕ) + (l r : Fin (width+1) → Fin (work+1)) (e : Equiv.Perm (Fin (width+1))) + (g : QMAGate) : List (QMAGate × Fin (width+1)) := + let cols := List.ofFn e + qmaColumnTransfer l r (cols.take (qmaGateCut width e g)) ++ + [(qmaMapGate width work r g,qmaGateArrivalColumn width e g)] ++ + qmaColumnTransfer l r (cols.drop (qmaGateCut width e g)) + +theorem qmaTaggedRowStage_gates (width work : ℕ) + (l r : Fin (width+1) → Fin (work+1)) (e : Equiv.Perm (Fin (width+1))) + (g : QMAGate) : + (qmaTaggedRowStage width work l r e g).map Prod.fst = qmaRowStage width work l r e g := by + have hp : (List.ofFn e).map (fun i => (l i,r i)) = qmaRowPairs (l ∘ e) (r ∘ e) := by + simp [qmaRowPairs,List.map_ofFn,Function.comp_def] + simp only [qmaTaggedRowStage,List.map_append,List.map_cons,List.map_nil, + qmaColumnTransfer_gates,List.map_take,List.map_drop,hp,qmaRowStage] + +theorem qmaNodup_filter_singleton_length {α : Type*} [DecidableEq α] (xs : List α) + (hx : xs.Nodup) (j : α) : (xs.filter (fun i => decide (i = j))).length ≤ 1 := by + induction xs with + | nil => simp + | cons i xs ih => + have hi := (List.nodup_cons.mp hx).1 + have ht := (List.nodup_cons.mp hx).2 + by_cases hij : i = j + · subst i + have hz : xs.filter (fun i => decide (i = j)) = [] := by + apply List.filter_eq_nil_iff.mpr + intro k hk + have hkj : k ≠ j := by intro he; subst k; exact hi hk + simp [hkj] + simp [hz] + · simpa [hij] using ih ht + +theorem qmaTaggedRowStage_count (width work : ℕ) + (l r : Fin (width+1) → Fin (work+1)) (e : Equiv.Perm (Fin (width+1))) + (g : QMAGate) (j : Fin (width+1)) : + ((qmaTaggedRowStage width work l r e g).filter (fun p => decide (p.2 = j))).length ≤ 4 := by + let cols := List.ofFn e + have hc : (cols.filter (fun i => decide (i = j))).length ≤ 1 := + qmaNodup_filter_singleton_length cols (List.nodup_ofFn.mpr e.injective) j + have hs : ((cols.take (qmaGateCut width e g)).filter (fun i => decide (i = j))).length+ + ((cols.drop (qmaGateCut width e g)).filter (fun i => decide (i = j))).length ≤ 1 := by + rw [←List.length_append,←List.filter_append,List.take_append_drop] + exact hc + simp only [qmaTaggedRowStage,List.filter_append,List.length_append,qmaColumnTransfer_count] + change 3*((cols.take (qmaGateCut width e g)).filter (fun i => decide (i = j))).length+ + ([(qmaMapGate width work r g,qmaGateArrivalColumn width e g)].filter (fun p => decide (p.2 = j))).length+ + 3*((cols.drop (qmaGateCut width e g)).filter (fun i => decide (i = j))).length ≤ 4 + have hi : ([(qmaMapGate width work r g,qmaGateArrivalColumn width e g)].filter (fun p : QMAGate × Fin (width+1) => + decide (p.2 = j))).length ≤ 1 := by + exact le_trans (List.length_filter_le _ _) (by simp) + omega + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTaggedSupport.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTaggedSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..7b22523d5ee38a63f857a39524385ec8b0534e3a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTaggedSupport.lean @@ -0,0 +1,54 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTaggedStage + +namespace OAI + +/-! Every column label gives an explicit bounded spatial support for its gate. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +def QMALocatedGate (rows width : ℕ) (r : Fin (rows+1)) (j : Fin (width+1)) (g : QMAGate) : Prop := + ∀ k ∈ qmaGateSites (qmaGridWork rows width) g, + ∃ s : Fin (rows+1), ∃ i : Fin (width+1), + k = qmaGridQubit rows width s i ∧ r.val ≤ s.val ∧ s.val ≤ r.val+1 ∧ + i.val ≤ j.val+1 ∧ j.val ≤ i.val+1 + +theorem qmaColumnTransfer_located (rows width : ℕ) (r : Fin rows) + (cols : List (Fin (width+1))) (g : QMAGate) (j : Fin (width+1)) + (h : (g,j) ∈ qmaColumnTransfer (qmaGridQubit rows width r.castSucc) + (qmaGridQubit rows width r.succ) cols) : + QMALocatedGate rows width r.castSucc j g := by + obtain ⟨_,hg⟩ := qmaColumnTransfer_member _ _ _ _ _ h + intro k hk + rcases qmaWireSwap_sites _ _ g hg k hk with rfl | rfl + · exact ⟨r.castSucc,j,rfl,le_rfl,by simp,by omega,by omega⟩ + · exact ⟨r.succ,j,rfl,by simp,by simp,by omega,by omega⟩ + +theorem qmaTaggedRowStage_located (rows width : ℕ) (r : Fin rows) + (e : Equiv.Perm (Fin (width+1))) (g : QMAGate) + (hg : g.WellFormed (width+1)) (ha : g.Adjacent) + (k : QMAGate) (j : Fin (width+1)) + (hk : (k,j) ∈ qmaTaggedRowStage width (qmaGridWork rows width) + (qmaGridQubit rows width r.castSucc) (qmaGridQubit rows width r.succ) e g) : + QMALocatedGate rows width r.castSucc j k := by + simp only [qmaTaggedRowStage,List.mem_append,List.mem_singleton] at hk + rcases hk with (hk | hk) | hk + · exact qmaColumnTransfer_located rows width r _ k j hk + · have he1 := congrArg Prod.fst hk + have he2 := congrArg Prod.snd hk + dsimp only at he1 he2 + subst k + subst j + intro v hv + rw [qmaMapGate_sites] at hv + obtain ⟨i,hi,rfl⟩ := Finset.mem_image.mp hv + have hn := qmaGateArrivalColumn_near width e g hg ha i hi + exact ⟨r.succ,i,rfl,by simp,by simp,hn.1,hn.2⟩ + · exact qmaColumnTransfer_located rows width r _ k j hk + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTaggedSweep.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTaggedSweep.lean new file mode 100644 index 0000000000000000000000000000000000000000..1395a45fb9c8ef02e5b92d1891e79e68af956da2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTaggedSweep.lean @@ -0,0 +1,74 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTaggedSupport + +namespace OAI + +/-! The literal sparse sweep comes with row and column labels. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +abbrev QMAGridCell (rows width : ℕ) := Fin (rows+1) × Fin (width+1) + +def qmaTaggedSweepFrom (rows width : ℕ) : + (start : ℕ) → (gs : List QMAGate) → start+gs.length ≤ rows → + List (QMAGate × QMAGridCell rows width) + | _,[],_ => [] + | start,g::gs,h => + (qmaTaggedRowStage width (qmaGridWork rows width) + (qmaGridQubit rows width ⟨start,by simp only [List.length_cons] at h; omega⟩) + (qmaGridQubit rows width ⟨start+1,by simp only [List.length_cons] at h; omega⟩) + (qmaSweepOrder width (rows-1-start)) g).map + (fun p => (p.1,(⟨start,by simp only [List.length_cons] at h; omega⟩,p.2))) ++ + qmaTaggedSweepFrom rows width (start+1) gs (by simp only [List.length_cons] at h; omega) + +theorem qmaTaggedSweepFrom_gates (rows width start : ℕ) (gs : List QMAGate) + (h : start+gs.length ≤ rows) : + (qmaTaggedSweepFrom rows width start gs h).map Prod.fst = + qmaSweepCircuitFrom rows width start gs h := by + induction gs generalizing start with + | nil => rfl + | cons g gs ih => + simp only [qmaTaggedSweepFrom,List.map_append,List.map_map,Function.comp_def, + qmaTaggedRowStage_gates,ih,qmaSweepCircuitFrom] + +theorem qmaTaggedSweepFrom_rows (rows width start : ℕ) (gs : List QMAGate) + (h : start+gs.length ≤ rows) (p : QMAGate × QMAGridCell rows width) + (hp : p ∈ qmaTaggedSweepFrom rows width start gs h) : + start ≤ p.2.1.val ∧ p.2.1.val < start+gs.length := by + induction gs generalizing start with + | nil => simp [qmaTaggedSweepFrom] at hp + | cons g gs ih => + simp only [qmaTaggedSweepFrom,List.mem_append] at hp + rcases hp with hp | hp + · obtain ⟨q,_,hq⟩ := List.mem_map.mp hp + subst p + simp only [List.length_cons] + exact ⟨le_rfl,by omega⟩ + · have hh := ih (start+1) _ hp + simp only [List.length_cons] + omega + +theorem qmaTaggedSweepFrom_located (rows width start : ℕ) (gs : List QMAGate) + (h : start+gs.length ≤ rows) + (hg : ∀ g ∈ gs, g.WellFormed (width+1)) (ha : ∀ g ∈ gs, g.Adjacent) + (p : QMAGate × QMAGridCell rows width) + (hp : p ∈ qmaTaggedSweepFrom rows width start gs h) : + QMALocatedGate rows width p.2.1 p.2.2 p.1 := by + induction gs generalizing start with + | nil => simp [qmaTaggedSweepFrom] at hp + | cons g gs ih => + simp only [qmaTaggedSweepFrom,List.mem_append] at hp + rcases hp with hp | hp + · obtain ⟨q,hq,hqp⟩ := List.mem_map.mp hp + subst p + exact qmaTaggedRowStage_located rows width ⟨start,by simp at h; omega⟩ _ g + (hg g (by simp)) (ha g (by simp)) q.1 q.2 hq + · exact ih (start+1) _ (fun g hh => hg g (by simp [hh])) + (fun g hh => ha g (by simp [hh])) hp + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTaggedTransfer.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTaggedTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..81da934cd7460a411d7d950b8f4f8b8d04810ca5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTaggedTransfer.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGateArrival + +namespace OAI + +/-! Column-labelled transfers retain the exact gates and have three gates per column. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +def qmaColumnTransfer {width work : ℕ} (l r : Fin (width+1) → Fin (work+1)) + (cols : List (Fin (width+1))) : List (QMAGate × Fin (width+1)) := + cols.flatMap (fun i => (qmaWireSwapGates (l i) (r i)).map (fun g => (g,i))) + +theorem qmaColumnTransfer_gates {width work : ℕ} (l r : Fin (width+1) → Fin (work+1)) + (cols : List (Fin (width+1))) : + (qmaColumnTransfer l r cols).map Prod.fst = + qmaTransferGates (cols.map (fun i => (l i,r i))) := by + induction cols with + | nil => rfl + | cons i cols ih => + change ((qmaWireSwapGates (l i) (r i)).map (fun g => (g,i)) ++ + qmaColumnTransfer l r cols).map Prod.fst = + qmaWireSwapGates (l i) (r i) ++ qmaTransferGates (cols.map (fun i => (l i,r i))) + simp only [List.map_append,List.map_map,Function.comp_def,List.map_id',ih] + +theorem qmaColumnTransfer_count {width work : ℕ} (l r : Fin (width+1) → Fin (work+1)) + (cols : List (Fin (width+1))) (j : Fin (width+1)) : + ((qmaColumnTransfer l r cols).filter (fun p => decide (p.2 = j))).length = + 3*(cols.filter (fun i => decide (i = j))).length := by + induction cols with + | nil => simp [qmaColumnTransfer] + | cons i cols ih => + change (((qmaWireSwapGates (l i) (r i)).map (fun g => (g,i)) ++ + qmaColumnTransfer l r cols).filter (fun p => decide (p.2 = j))).length = _ + rw [List.filter_append,List.length_append,ih] + by_cases hij : i = j <;> simp [qmaWireSwapGates,hij,Nat.mul_add,Nat.add_comm] + +theorem qmaColumnTransfer_member {width work : ℕ} (l r : Fin (width+1) → Fin (work+1)) + (cols : List (Fin (width+1))) (g : QMAGate) (j : Fin (width+1)) + (h : (g,j) ∈ qmaColumnTransfer l r cols) : + j ∈ cols ∧ g ∈ qmaWireSwapGates (l j) (r j) := by + obtain ⟨i,hi,hh⟩ := List.mem_flatMap.mp h + obtain ⟨k,hk,he⟩ := List.mem_map.mp hh + have hij : i = j := congrArg Prod.snd he + have hkg : k = g := congrArg Prod.fst he + subst i + subst k + exact ⟨hi,hk⟩ + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTensorAction.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTensorAction.lean new file mode 100644 index 0000000000000000000000000000000000000000..db1dc74ec35e51da928ccf28d3e87eb4c901cf63 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTensorAction.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorGap + +namespace OAI + +/-! Local actions and excitation energies of actual finite tensor columns. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {Q σ τ : Type*} [Fintype Q] [DecidableEq Q] + [Fintype σ] [DecidableEq σ] [Fintype τ] + +omit [Fintype τ] in +theorem qmaSiteMatrix_tensor (i : Q) (A : Matrix σ σ ℂ) (B : Q → Matrix σ τ ℂ) : + qmaSiteMatrix i A*qmaTensorMatrix B = + qmaTensorMatrix (fun j => if j = i then A*B j else B j) := by + rw [qmaSiteMatrix,qmaTensorMatrix_mul] + congr 1 + funext j + by_cases h : j = i <;> simp [h] + +omit [Fintype σ] [DecidableEq σ] [Fintype τ] [DecidableEq Q] in +theorem qmaTensorMatrix_zero_at (A : Q → Matrix σ τ ℂ) (i : Q) (hA : A i = 0) : + qmaTensorMatrix A = 0 := by + ext s t + exact Finset.prod_eq_zero (Finset.mem_univ i) (by simp [hA]) + +omit [Fintype σ] [DecidableEq σ] [Fintype τ] in +theorem qmaTensorMatrix_smul_at (A : Q → Matrix σ τ ℂ) (i : Q) (c : ℂ) : + qmaTensorMatrix (fun j => if j = i then c • A j else A j) = c • qmaTensorMatrix A := by + ext s t + simp only [qmaTensorMatrix,Matrix.smul_apply,smul_eq_mul] + rw [← Finset.mul_prod_erase _ _ (Finset.mem_univ i), + ← Finset.mul_prod_erase _ _ (Finset.mem_univ i)] + simp only [ite_true,Matrix.smul_apply,smul_eq_mul] + have hp : (∏ j ∈ Finset.univ.erase i, + (if j = i then c • A j else A j) (s j) (t j)) = + ∏ j ∈ Finset.univ.erase i, A j (s j) (t j) := by + apply Finset.prod_congr rfl + intro j hj + rw [ite_eq_right (Finset.mem_erase.mp hj).1] + rw [hp] + ring + +omit [Fintype τ] in +theorem qmaSiteMatrix_tensor_eigen (i : Q) (H : Matrix σ σ ℂ) (A : Q → Matrix σ τ ℂ) + (c : ℂ) (hA : H*A i = c • A i) : + qmaSiteMatrix i H*qmaTensorMatrix A = c • qmaTensorMatrix A := by + rw [qmaSiteMatrix_tensor,← qmaTensorMatrix_smul_at A i c] + congr 1 + funext j + by_cases hj : j = i + · subst j + simp only [ite_true,hA] + · simp only [hj,ite_false] + +variable {n : ℕ} + +omit [Fintype τ] in +theorem qmaTensorPenalty_eigen (H : Matrix σ σ ℂ) (A : Fin n → Matrix σ τ ℂ) + (c : Fin n → ℂ) (hA : ∀ i, H*A i = c i • A i) : + qmaTensorPenalty n H*qmaTensorMatrix A = (∑ i, c i) • qmaTensorMatrix A := by + rw [qmaTensorPenalty,Matrix.sum_mul] + simp only [qmaSiteMatrix_tensor_eigen _ H A _ (hA _),Finset.sum_smul] + +theorem qmaFourTensorPenalty_encoding (n : ℕ) : + qmaFourTensorPenalty n*qmaFourTensorEncoding n = 0 := by + have h := qmaTensorPenalty_eigen qmaFourPenalty (fun _ : Fin n => qmaFourEncoding) + (fun _ => (0:ℂ)) (by intro i; simp [qmaFourPenalty_encoding]) + simpa only [qmaFourTensorPenalty,qmaFourTensorEncoding,Finset.sum_const_zero,zero_smul] using h + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTensorMatrix.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTensorMatrix.lean new file mode 100644 index 0000000000000000000000000000000000000000..6e67e193ac47effbcbe136fb9d28a87c0eef3005 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTensorMatrix.lean @@ -0,0 +1,128 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourDoubleGap + +namespace OAI + +/-! Finite tensor matrices used to place the proved four-spin code at every site. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical ComplexOrder +variable {Q σ τ υ : Type*} [Fintype Q] [DecidableEq Q] [Fintype σ] [Fintype τ] [Fintype υ] + +def qmaTensorMatrix (A : Q → Matrix σ τ ℂ) : Matrix (Q → σ) (Q → τ) ℂ := + fun s t => ∏ i, A i (s i) (t i) + +omit [Fintype σ] [Fintype υ] in +theorem qmaTensorMatrix_mul (A : Q → Matrix σ τ ℂ) (B : Q → Matrix τ υ ℂ) : + qmaTensorMatrix A*qmaTensorMatrix B = qmaTensorMatrix (fun i => A i*B i) := by + ext s t + change (∑ r : Q → τ, (∏ i, A i (s i) (r i))*(∏ i, B i (r i) (t i))) = _ + simp only [← Finset.prod_mul_distrib] + exact (Fintype.prod_sum (fun i a => A i (s i) a*B i a (t i))).symm + +omit [Fintype σ] [Fintype τ] [DecidableEq Q] in +theorem qmaTensorMatrix_star (A : Q → Matrix σ τ ℂ) : + (qmaTensorMatrix A).conjTranspose = qmaTensorMatrix (fun i => (A i).conjTranspose) := by + ext s t + simp [qmaTensorMatrix,Matrix.conjTranspose_apply] + +variable [DecidableEq σ] + +omit [Fintype σ] [DecidableEq Q] in +theorem qmaTensorMatrix_one : qmaTensorMatrix (fun _ : Q => (1 : Matrix σ σ ℂ)) = 1 := by + ext s t + simp only [qmaTensorMatrix,Matrix.one_apply] + by_cases h : s = t + · subst t + simp + · rw [ite_eq_right h] + obtain ⟨i,hi⟩ := Function.ne_iff.mp h + exact Finset.prod_eq_zero (Finset.mem_univ i) (ite_eq_right hi) + +omit [Fintype τ] [DecidableEq σ] in +theorem qmaTensorMatrix_gram [DecidableEq τ] (A : Q → Matrix σ τ ℂ) + (hA : ∀ i, (A i).conjTranspose*A i = 1) : + (qmaTensorMatrix A).conjTranspose*qmaTensorMatrix A = 1 := by + rw [qmaTensorMatrix_star,qmaTensorMatrix_mul] + simpa only [hA] using (qmaTensorMatrix_one (Q := Q) (σ := τ)) + +omit [DecidableEq σ] in +theorem qmaTensorMatrix_projector (P : Q → Matrix σ σ ℂ) + (hP : ∀ i, (P i).conjTranspose = P i) (hPP : ∀ i, P i*P i = P i) : + (qmaTensorMatrix P).conjTranspose*qmaTensorMatrix P = qmaTensorMatrix P := by + rw [qmaTensorMatrix_star,qmaTensorMatrix_mul] + simp only [hP,hPP] + +omit [DecidableEq σ] in +theorem qmaTensorMatrix_projector_posSemidef (P : Q → Matrix σ σ ℂ) + (hP : ∀ i, (P i).conjTranspose = P i) (hPP : ∀ i, P i*P i = P i) : + (qmaTensorMatrix P).PosSemidef := by + rw [← qmaTensorMatrix_projector P hP hPP] + exact Matrix.posSemidef_conjTranspose_mul_self _ + +theorem qmaTensorMatrix_complement_posSemidef (P : Q → Matrix σ σ ℂ) + (hP : ∀ i, (P i).conjTranspose = P i) (hPP : ∀ i, P i*P i = P i) : + (1-qmaTensorMatrix P).PosSemidef := by + have hstar : (qmaTensorMatrix P).conjTranspose = qmaTensorMatrix P := by + rw [qmaTensorMatrix_star] + simp only [hP] + have hs : qmaTensorMatrix P*qmaTensorMatrix P = qmaTensorMatrix P := by + simpa only [hstar] using qmaTensorMatrix_projector P hP hPP + have he : (1-qmaTensorMatrix P).conjTranspose*(1-qmaTensorMatrix P) = 1-qmaTensorMatrix P := by + simp only [Matrix.conjTranspose_sub,Matrix.conjTranspose_one,hstar] + noncomm_ring [hs] + rw [← he] + exact Matrix.posSemidef_conjTranspose_mul_self _ + +def qmaSiteMatrix (i : Q) (A : Matrix σ σ ℂ) : Matrix (Q → σ) (Q → σ) ℂ := + qmaTensorMatrix (fun j => if j = i then A else 1) + +theorem qmaSiteMatrix_mul (i : Q) (A B : Matrix σ σ ℂ) : + qmaSiteMatrix i A*qmaSiteMatrix i B = qmaSiteMatrix i (A*B) := by + rw [qmaSiteMatrix,qmaSiteMatrix,qmaTensorMatrix_mul] + congr 1 + funext j + by_cases h : j = i <;> simp [h] + +omit [Fintype σ] in +theorem qmaSiteMatrix_one (i : Q) : qmaSiteMatrix i (1 : Matrix σ σ ℂ) = 1 := by + simp only [qmaSiteMatrix,ite_self,qmaTensorMatrix_one] + +omit [Fintype σ] in +theorem qmaSiteMatrix_star (i : Q) (A : Matrix σ σ ℂ) : + (qmaSiteMatrix i A).conjTranspose = qmaSiteMatrix i A.conjTranspose := by + rw [qmaSiteMatrix,qmaTensorMatrix_star] + congr 1 + funext j + by_cases h : j = i <;> simp [h] + +omit [Fintype σ] in +theorem qmaSiteMatrix_apply (i : Q) (A : Matrix σ σ ℂ) (s t : Q → σ) : + qmaSiteMatrix i A s t = A (s i) (t i)* + ∏ j ∈ Finset.univ.erase i, if s j = t j then (1:ℂ) else 0 := by + unfold qmaSiteMatrix qmaTensorMatrix + rw [← Finset.mul_prod_erase _ _ (Finset.mem_univ i)] + simp only [ite_true] + congr 1 + apply Finset.prod_congr rfl + intro j hj + simp [(Finset.mem_erase.mp hj).1,Matrix.one_apply] + +omit [Fintype σ] in +theorem qmaSiteMatrix_add (i : Q) (A B : Matrix σ σ ℂ) : + qmaSiteMatrix i (A+B) = qmaSiteMatrix i A+qmaSiteMatrix i B := by + ext s t + simp only [qmaSiteMatrix_apply,Matrix.add_apply,add_mul] + +omit [Fintype σ] in +theorem qmaSiteMatrix_smul (i : Q) (c : ℂ) (A : Matrix σ σ ℂ) : + qmaSiteMatrix i (c • A) = c • qmaSiteMatrix i A := by + ext s t + simp only [qmaSiteMatrix_apply,Matrix.smul_apply,smul_eq_mul,mul_assoc] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTensorPair.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTensorPair.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd3a67a2ea8142625258c2a196c6a005c18b874e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTensorPair.lean @@ -0,0 +1,54 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTensorAction + +namespace OAI + +/-! Two-block tensor placements and their exact algebra. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {Q σ : Type*} [Fintype Q] [DecidableEq Q] [Fintype σ] [DecidableEq σ] + +def qmaPairMatrix (i j : Q) (A B : Matrix σ σ ℂ) : Matrix (Q → σ) (Q → σ) ℂ := + qmaTensorMatrix (fun k => if k = i then A else if k = j then B else 1) + +theorem qmaPairMatrix_eq_mul (i j : Q) (hij : i ≠ j) (A B : Matrix σ σ ℂ) : + qmaPairMatrix i j A B = qmaSiteMatrix i A*qmaSiteMatrix j B := by + rw [qmaPairMatrix,qmaSiteMatrix,qmaSiteMatrix,qmaTensorMatrix_mul] + congr 1 + funext k + by_cases hki : k = i + · subst k + simp [hij] + · by_cases hkj : k = j + · subst k + simp [Ne.symm hij] + · simp [hki,hkj] + +omit [Fintype σ] in +theorem qmaPairMatrix_zero_left (i j : Q) (B : Matrix σ σ ℂ) : qmaPairMatrix i j 0 B = 0 := by + apply qmaTensorMatrix_zero_at _ i + simp + +theorem qmaPairMatrix_add_left (i j : Q) (hij : i ≠ j) (A B C : Matrix σ σ ℂ) : + qmaPairMatrix i j (A+B) C = qmaPairMatrix i j A C+qmaPairMatrix i j B C := by + simp only [qmaPairMatrix_eq_mul _ _ hij,qmaSiteMatrix_add,Matrix.add_mul] + +theorem qmaPairMatrix_add_right (i j : Q) (hij : i ≠ j) (A B C : Matrix σ σ ℂ) : + qmaPairMatrix i j A (B+C) = qmaPairMatrix i j A B+qmaPairMatrix i j A C := by + simp only [qmaPairMatrix_eq_mul _ _ hij,qmaSiteMatrix_add,Matrix.mul_add] + +theorem qmaPairMatrix_smul_left (i j : Q) (hij : i ≠ j) (r : ℂ) (A B : Matrix σ σ ℂ) : + qmaPairMatrix i j (r • A) B = r • qmaPairMatrix i j A B := by + simp only [qmaPairMatrix_eq_mul _ _ hij,qmaSiteMatrix_smul,Matrix.smul_mul] + +theorem qmaPairMatrix_smul_right (i j : Q) (hij : i ≠ j) (r : ℂ) (A B : Matrix σ σ ℂ) : + qmaPairMatrix i j A (r • B) = r • qmaPairMatrix i j A B := by + simp only [qmaPairMatrix_eq_mul _ _ hij,qmaSiteMatrix_smul,Matrix.mul_smul] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTensorPairLinear.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTensorPairLinear.lean new file mode 100644 index 0000000000000000000000000000000000000000..e8ea6e0c687726a99ce410a8fb9e90ec6b521c5a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTensorPairLinear.lean @@ -0,0 +1,43 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTensorPair + +namespace OAI + +/-! Bilinearity of two-site placements in the finite tensor product. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {Q σ α : Type*} [Fintype Q] [DecidableEq Q] [Fintype σ] [DecidableEq σ] [Fintype α] + +omit [Fintype σ] in +theorem qmaSiteMatrix_sum (i : Q) (A : α → Matrix σ σ ℂ) : + qmaSiteMatrix i (∑ a, A a) = ∑ a, qmaSiteMatrix i (A a) := by + ext s t + simp only [qmaSiteMatrix_apply,Matrix.sum_apply,Finset.sum_mul] + +theorem qmaPairMatrix_sum_left (i j : Q) (hij : i ≠ j) + (A : α → Matrix σ σ ℂ) (B : Matrix σ σ ℂ) : + qmaPairMatrix i j (∑ a, A a) B = ∑ a, qmaPairMatrix i j (A a) B := by + simp only [qmaPairMatrix_eq_mul _ _ hij,qmaSiteMatrix_sum,Matrix.sum_mul] + +theorem qmaPairMatrix_sum_right (i j : Q) (hij : i ≠ j) + (A : Matrix σ σ ℂ) (B : α → Matrix σ σ ℂ) : + qmaPairMatrix i j A (∑ a, B a) = ∑ a, qmaPairMatrix i j A (B a) := by + simp only [qmaPairMatrix_eq_mul _ _ hij,qmaSiteMatrix_sum,Matrix.mul_sum] + +omit [Fintype α] in +theorem qmaPairMatrix_one_right (i j : Q) (hij : i ≠ j) (A : Matrix σ σ ℂ) : + qmaPairMatrix i j A 1 = qmaSiteMatrix i A := by + rw [qmaPairMatrix_eq_mul i j hij,qmaSiteMatrix_one,Matrix.mul_one] + +omit [Fintype α] in +theorem qmaPairMatrix_one_left (i j : Q) (hij : i ≠ j) (A : Matrix σ σ ℂ) : + qmaPairMatrix i j 1 A = qmaSiteMatrix j A := by + rw [qmaPairMatrix_eq_mul i j hij,qmaSiteMatrix_one,Matrix.one_mul] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTensorSucc.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTensorSucc.lean new file mode 100644 index 0000000000000000000000000000000000000000..0faaa06e5348cec3a42963f3964a61c15748a1fa --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTensorSucc.lean @@ -0,0 +1,65 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTensorMatrix +import OAI.MathematicalPhysics.ContinuumCoulomb.ManyBody.MediatorGraph + +namespace OAI + +/-! Splitting off the first physical block in a finite tensor Hamiltonian. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical ComplexOrder +variable {σ τ : Type*} {n : ℕ} + +def qmaTensorSuccEquiv (σ : Type*) (n : ℕ) : (Fin (n+1) → σ) ≃ σ × (Fin n → σ) where + toFun s := (s 0, fun i => s i.succ) + invFun s := Fin.cases s.1 s.2 + left_inv s := by funext i; refine Fin.cases ?_ (fun j => ?_) i <;> rfl + right_inv s := by cases s; rfl + +theorem qmaTensorMatrix_succ (A : Fin (n+1) → Matrix σ τ ℂ) : + qmaTensorMatrix A = + (A 0 ⊗ₖ qmaTensorMatrix (fun i : Fin n => A i.succ)).submatrix + (qmaTensorSuccEquiv σ n) (qmaTensorSuccEquiv τ n) := by + ext s t + simp only [qmaTensorMatrix,Matrix.submatrix_apply,Matrix.kroneckerMap_apply,Fin.prod_univ_succ] + rfl + +variable [Fintype σ] [DecidableEq σ] + +omit [Fintype σ] in +theorem qmaSiteMatrix_succ_zero (H : Matrix σ σ ℂ) : + qmaSiteMatrix (0:Fin (n+1)) H = + (H ⊗ₖ (1 : Matrix (Fin n → σ) (Fin n → σ) ℂ)).submatrix + (qmaTensorSuccEquiv σ n) (qmaTensorSuccEquiv σ n) := by + rw [qmaSiteMatrix,qmaTensorMatrix_succ] + simp only [ite_true,Fin.succ_ne_zero,ite_false,qmaTensorMatrix_one] + +omit [Fintype σ] in +theorem qmaSiteMatrix_succ_succ (i : Fin n) (H : Matrix σ σ ℂ) : + qmaSiteMatrix i.succ H = + ((1 : Matrix σ σ ℂ) ⊗ₖ qmaSiteMatrix i H).submatrix + (qmaTensorSuccEquiv σ n) (qmaTensorSuccEquiv σ n) := by + rw [qmaSiteMatrix,qmaTensorMatrix_succ] + have hz : (0:Fin (n+1)) ≠ i.succ := (Fin.succ_ne_zero i).symm + simp only [hz,ite_false,Fin.succ_inj] + rfl + +def qmaTensorPenalty (n : ℕ) (H : Matrix σ σ ℂ) : + Matrix (Fin n → σ) (Fin n → σ) ℂ := ∑ i : Fin n, qmaSiteMatrix i H + +omit [Fintype σ] in +theorem qmaTensorPenalty_succ (H : Matrix σ σ ℂ) : + qmaTensorPenalty (n+1) H = + (H ⊗ₖ (1 : Matrix (Fin n → σ) (Fin n → σ) ℂ)+ + (1 : Matrix σ σ ℂ) ⊗ₖ qmaTensorPenalty n H).submatrix + (qmaTensorSuccEquiv σ n) (qmaTensorSuccEquiv σ n) := by + rw [qmaTensorPenalty,Fin.sum_univ_succ,qmaSiteMatrix_succ_zero] + simp only [qmaSiteMatrix_succ_succ,← MediatorGraph.submatrix_sum, + ← MediatorGraph.kronecker_sum,← MediatorGraph.submatrix_add_apply,qmaTensorPenalty] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTermTime.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTermTime.lean new file mode 100644 index 0000000000000000000000000000000000000000..5d5b8820ed6071faefad71e9a4be9f6f1f4d596e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTermTime.lean @@ -0,0 +1,69 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTimeGrouping + +namespace OAI + +/-! Assign every actual history term to its clock time and enumerate by time. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +def qmaBoundedClockTime (T : ℕ) (hT : 0 < T) (n : ℕ) : Fin T := + ⟨min n (T-1),by omega⟩ + +theorem qmaBoundedClockTime_eq (T : ℕ) (hT : 0 < T) (n : Fin T) : + qmaBoundedClockTime T hT n.val = n := by + apply Fin.ext + simp only [qmaBoundedClockTime] + exact min_eq_left (by omega) + +def qmaHistoryTermTime (c : QMACircuit) (hT : 0 < c.gates.length) + (τ : Fin (c.work+1) → Fin (c.gates.length+1)) : QMACircuitTerm c → Fin c.gates.length + | .inl i => qmaBoundedClockTime _ hT i.val + | .inr (.inl b) => if b = 0 then ⟨0,hT⟩ else qmaBoundedClockTime _ hT c.gates.length + | .inr (.inr (.inl i)) => qmaBoundedClockTime _ hT (τ i).val + | .inr (.inr (.inr (.inl _))) => qmaBoundedClockTime _ hT c.gates.length + | .inr (.inr (.inr (.inr t))) => t + +def qmaHistoryTermList (c : QMACircuit) : List (QMACircuitTerm c) := + List.ofFn (qmaHistoryTermIndex c).symm + +theorem qmaHistoryTermList_mem (c : QMACircuit) (a : QMACircuitTerm c) : + a ∈ qmaHistoryTermList c := by + apply List.mem_ofFn.mpr + exact ⟨qmaHistoryTermIndex c a,(qmaHistoryTermIndex c).symm_apply_apply a⟩ + +theorem qmaHistoryTermList_nodup (c : QMACircuit) : (qmaHistoryTermList c).Nodup := + List.nodup_ofFn.mpr (qmaHistoryTermIndex c).symm.injective + +def qmaOrderedHistoryTerms (c : QMACircuit) (hT : 0 < c.gates.length) + (τ : Fin (c.work+1) → Fin (c.gates.length+1)) : List (QMACircuitTerm c) := + qmaGroupByTime c.gates.length (qmaHistoryTermTime c hT τ) (qmaHistoryTermList c) + +theorem qmaOrderedHistoryTerms_mem (c : QMACircuit) (hT : 0 < c.gates.length) + (τ : Fin (c.work+1) → Fin (c.gates.length+1)) (a : QMACircuitTerm c) : + a ∈ qmaOrderedHistoryTerms c hT τ := + (qmaGroupByTime_perm _ _ _).mem_iff.mpr (qmaHistoryTermList_mem c a) + +theorem qmaOrderedHistoryTerms_nodup (c : QMACircuit) (hT : 0 < c.gates.length) + (τ : Fin (c.work+1) → Fin (c.gates.length+1)) : + (qmaOrderedHistoryTerms c hT τ).Nodup := + qmaGroupByTime_nodup _ _ _ (qmaHistoryTermList_nodup c) + +theorem qmaOrderedHistoryTerms_length (c : QMACircuit) (hT : 0 < c.gates.length) + (τ : Fin (c.work+1) → Fin (c.gates.length+1)) : + (qmaOrderedHistoryTerms c hT τ).length = qmaHistoryReferenceWork c+1 := by + rw [qmaOrderedHistoryTerms,qmaGroupByTime_length] + exact List.length_ofFn + +theorem qmaOrderedHistoryTerms_sorted (c : QMACircuit) (hT : 0 < c.gates.length) + (τ : Fin (c.work+1) → Fin (c.gates.length+1)) : + (qmaOrderedHistoryTerms c hT τ).Pairwise + (fun a b => qmaHistoryTermTime c hT τ a ≤ qmaHistoryTermTime c hT τ b) := + qmaGroupByTime_sorted _ _ _ + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumThirdCounterterm.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumThirdCounterterm.lean new file mode 100644 index 0000000000000000000000000000000000000000..a45a98dc5754f2a824ddae59ecea6c8eb7101917 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumThirdCounterterm.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGadgetCounterterms + +namespace OAI + +/-! The third-order series gadget uses only polynomial coefficients. +Its parallel version is controlled by ThirdOrderPerturbation. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +def qmaThirdSeriesPair (A B : Matrix ι ι ℂ) (J : ℂ) : Matrix ι ι ℂ := + A+(J/2) • B + +def qmaThirdSeriesCounter (A B C : Matrix ι ι ℂ) (r J : ℂ) : Matrix ι ι ℂ := + r • ((1+(J/2)^2) • (1 : Matrix ι ι ℂ)+J • (A*B))- + (1+(J/2)^2) • C + +theorem qmaThirdSeries_effective (A B C : Matrix ι ι ℂ) (r J : ℂ) + (hA : A*A = 1) (hB : B*B = 1) (hAB : A*B = B*A) + (hAC : A*C = C*A) (hBC : B*C = C*B) : + qmaThirdSeriesCounter A B C r J - + r • (qmaThirdSeriesPair A B J*qmaThirdSeriesPair A B J)+ + qmaThirdSeriesPair A B J*C*qmaThirdSeriesPair A B J = J • (A*B*C) := by + unfold qmaThirdSeriesCounter qmaThirdSeriesPair + rw [qmaGadget_pair_square A B (J/2) hA hB hAB, + qmaGadget_pair_sandwich A B C (J/2) hA hB hAB hAC hBC] + module + +theorem qmaThirdSeries_scaled_effective (A B C : Matrix ι ι ℂ) (r J : ℂ) + (hr : r ≠ 0) (hA : A*A = 1) (hB : B*B = 1) (hAB : A*B = B*A) + (hAC : A*C = C*A) (hBC : B*C = C*B) : + qmaThirdSeriesCounter A B C r J - + (r^3)⁻¹ • ((r^2 • qmaThirdSeriesPair A B J)*(r^2 • qmaThirdSeriesPair A B J))+ + ((r^3)⁻¹ • (r^2 • qmaThirdSeriesPair A B J))*(r^2 • C)* + ((r^3)⁻¹ • (r^2 • qmaThirdSeriesPair A B J)) = J • (A*B*C) := by + have hfirst : (r^3)⁻¹*(r^2*r^2) = r := by field_simp + have hthird : ((r^3)⁻¹*r^2)*r^2*((r^3)⁻¹*r^2) = 1 := by field_simp + simp only [smul_mul_assoc,mul_smul_comm,smul_smul] + rw [hfirst] + have ht : ((r^3)⁻¹*r^2)*(r^2*((r^3)⁻¹*r^2)) = 1 := by + rw [← mul_assoc] + exact hthird + rw [ht,one_smul] + exact qmaThirdSeries_effective A B C r J hA hB hAB hAC hBC + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTimeCongestion.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTimeCongestion.lean new file mode 100644 index 0000000000000000000000000000000000000000..44d69a601de779f476a6fb9c6d96a2ba8cf7474a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTimeCongestion.lean @@ -0,0 +1,74 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOrderedReference + +namespace OAI + +/-! At most eight actual interaction terms are assigned to any clock time. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators Classical + +theorem qmaSumFilter_card {α β : Type*} [Fintype α] [Fintype β] + (p : α ⊕ β → Prop) [DecidablePred p] : + (Finset.univ.filter p).card = + (Finset.univ.filter (fun a => p (.inl a))).card+ + (Finset.univ.filter (fun b => p (.inr b))).card := by + simp only [Finset.card_filter,Fintype.sum_sum_type] + +theorem qmaBoundedClockTime_fiber_card (T : ℕ) (hT : 0 < T) (t : Fin T) : + (Finset.univ.filter (fun i : Fin (T+1) => qmaBoundedClockTime T hT i.val = t)).card ≤ 2 := by + have hs : Finset.univ.filter (fun i : Fin (T+1) => qmaBoundedClockTime T hT i.val = t) ⊆ + {t.castSucc,Fin.last T} := by + intro i hi + have hv := congrArg Fin.val (Finset.mem_filter.mp hi).2 + change min i.val (T-1) = t.val at hv + have hit := i.isLt + have htt := t.isLt + have he : i.val = t.val ∨ i.val = T := by omega + simpa only [Finset.mem_insert,Finset.mem_singleton] using + he.imp (fun h => Fin.ext h) (fun h => Fin.ext h) + have hp := Finset.card_insert_le t.castSucc {Fin.last T} + rw [Finset.card_singleton] at hp + exact (Finset.card_le_card hs).trans hp + +theorem qmaHistoryTimeFiber_card (c : QMACircuit) (hT : 0 < c.gates.length) + (hi : ∀ i, qmaFirstUse c i < c.gates.length) (t : Fin c.gates.length) : + (Finset.univ.filter (fun a : QMACircuitTerm c => + qmaHistoryTermTime c hT (qmaFirstUseTime c) a = t)).card ≤ 8 := by + have hclock := qmaBoundedClockTime_fiber_card c.gates.length hT t + have hboundary : (Finset.univ.filter (fun b : Fin 2 => + (if b = 0 then (⟨0,hT⟩ : Fin c.gates.length) + else qmaBoundedClockTime _ hT c.gates.length) = t)).card ≤ 2 := by + exact (Finset.card_filter_le _ _).trans (by simp) + have hinput : (Finset.univ.filter (fun i : Fin (c.work+1) => + qmaBoundedClockTime _ hT (qmaFirstUse c i) = t)).card ≤ 2 := by + apply le_trans (Finset.card_le_card (show _ ⊆ qmaFirstUseSites c t from ?_)) + (qmaFirstUseSites_card c t) + intro i hm + have hv := congrArg Fin.val (Finset.mem_filter.mp hm).2 + change min (qmaFirstUse c i) (c.gates.length-1) = t.val at hv + simp only [qmaFirstUseSites,Finset.mem_filter,Finset.mem_univ,true_and] + have := hi i + omega + have houtput : (Finset.univ.filter (fun _ : Unit => + qmaBoundedClockTime _ hT c.gates.length = t)).card ≤ 1 := by + exact (Finset.card_filter_le _ _).trans (by simp) + have hprop : (Finset.univ.filter (fun u : Fin c.gates.length => u = t)).card ≤ 1 := by + have hs : (Finset.univ.filter (fun u : Fin c.gates.length => u = t)) ⊆ + ({t} : Finset (Fin c.gates.length)) := by + intro u hu + simpa only [Finset.mem_singleton] using (Finset.mem_filter.mp hu).2 + exact (Finset.card_le_card hs).trans (by simp) + change (Finset.univ.filter (fun a : + Fin (c.gates.length+1) ⊕ (Fin 2 ⊕ (Fin (c.work+1) ⊕ (Unit ⊕ Fin c.gates.length))) => + qmaHistoryTermTime c hT (qmaFirstUseTime c) a = t)).card ≤ 8 + rw [qmaSumFilter_card,qmaSumFilter_card,qmaSumFilter_card,qmaSumFilter_card] + simp only [qmaHistoryTermTime] + exact (Nat.add_le_add hclock (Nat.add_le_add hboundary + (Nat.add_le_add hinput (Nat.add_le_add houtput hprop)))).trans (by decide) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTimeGrouping.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTimeGrouping.lean new file mode 100644 index 0000000000000000000000000000000000000000..1c4f912e9af706b329910e943dc3ac126337845c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTimeGrouping.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSpatialInput +import Mathlib.Data.List.NodupEquivFin +import Mathlib.Data.List.ChainOfFn + +namespace OAI + +/-! A literal finite time grouping permutes the interaction list without duplicating terms. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators Classical + +variable {α : Type*} [DecidableEq α] + +def qmaGroupByTime (T : ℕ) (time : α → Fin T) (xs : List α) : List α := + (List.ofFn (fun t : Fin T => t)).flatMap (fun t => xs.filter (fun a => decide (time a = t))) + +theorem qmaGroupByTime_count (T : ℕ) (time : α → Fin T) (xs : List α) (a : α) : + (qmaGroupByTime T time xs).count a = xs.count a := by + have hf (t : Fin T) : (xs.filter (fun b => decide (time b = t))).count a = + if time a = t then xs.count a else 0 := by + by_cases h : time a = t + · simp only [h,ite_true] + apply List.count_filter + simp [h] + · simp only [h,ite_false] + apply List.count_eq_zero.mpr + intro ha + exact h (of_decide_eq_true (List.mem_filter.mp ha).2) + simp only [qmaGroupByTime,List.count_flatMap,List.map_ofFn,List.sum_ofFn,Function.comp_apply] + simp_rw [hf] + simp + +theorem qmaGroupByTime_perm (T : ℕ) (time : α → Fin T) (xs : List α) : + (qmaGroupByTime T time xs).Perm xs := + List.perm_iff_count.mpr (qmaGroupByTime_count T time xs) + +theorem qmaGroupByTime_length (T : ℕ) (time : α → Fin T) (xs : List α) : + (qmaGroupByTime T time xs).length = xs.length := + (qmaGroupByTime_perm T time xs).length_eq + +theorem qmaGroupByTime_nodup (T : ℕ) (time : α → Fin T) (xs : List α) (hx : xs.Nodup) : + (qmaGroupByTime T time xs).Nodup := + (qmaGroupByTime_perm T time xs).nodup_iff.mpr hx + +omit [DecidableEq α] in +theorem qmaGroupByTime_sorted (T : ℕ) (time : α → Fin T) (xs : List α) : + (qmaGroupByTime T time xs).Pairwise (fun a b => time a ≤ time b) := by + unfold qmaGroupByTime + apply List.pairwise_flatMap.mpr + constructor + · intro t _ + apply List.pairwise_of_forall_mem_list + intro a ha b hb + have ha' := of_decide_eq_true (List.mem_filter.mp ha).2 + have hb' := of_decide_eq_true (List.mem_filter.mp hb).2 + exact le_of_eq (ha'.trans hb'.symm) + · apply List.pairwise_ofFn.mpr + intro i j hij a ha b hb + have ha' := of_decide_eq_true (List.mem_filter.mp ha).2 + have hb' := of_decide_eq_true (List.mem_filter.mp hb).2 + simpa only [ha',hb'] using le_of_lt hij + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTransferGate.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTransferGate.lean new file mode 100644 index 0000000000000000000000000000000000000000..0aa2be0ef4a9cbf97383db5e3779d4819b717a1c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTransferGate.lean @@ -0,0 +1,69 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumWireIntertwining + +namespace OAI + +/-! A logical gate may be inserted when its operands have reached the next row. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped Classical + +theorem qmaRelabelGate_fixed (work : ℕ) (σ : Equiv.Perm (Fin (work+1))) + (g : QMAGate) (hg : g.WellFormed (work+1)) + (hs : ∀ i ∈ qmaGateSites work g, σ i = i) : qmaRelabelGate work σ g = g := by + cases g with + | hadamard i => + have hi := hs (qmaQubit work i) (by simp [qmaGateSites]) + rw [qmaRelabelGate,hi] + simp only [qmaQubit,Nat.mod_eq_of_lt hg] + | phaseT i => + have hi := hs (qmaQubit work i) (by simp [qmaGateSites]) + rw [qmaRelabelGate,hi] + simp only [qmaQubit,Nat.mod_eq_of_lt hg] + | controlledNot i j => + have hi := hs (qmaQubit work i) (by simp [qmaGateSites]) + have hj := hs (qmaQubit work j) (by simp [qmaGateSites]) + rw [qmaRelabelGate,hi,hj] + simp only [qmaQubit,Nat.mod_eq_of_lt hg.1,Nat.mod_eq_of_lt hg.2.1] + +theorem qmaTransferGates_append {work : ℕ} + (xs ys : List (Fin (work+1) × Fin (work+1))) : + qmaTransferGates (xs++ys) = qmaTransferGates xs++qmaTransferGates ys := by + induction xs with + | nil => rfl + | cons p xs ih => + rcases p with ⟨i,j⟩ + simp only [List.cons_append,qmaTransferGates,ih,List.append_assoc] + +theorem qmaTransfer_gate_commute {work : ℕ} + (ps : List (Fin (work+1) × Fin (work+1))) (hp : ∀ p ∈ ps, p.1 ≠ p.2) + (g : QMAGate) (hg : g.WellFormed (work+1)) + (ha : ∀ i ∈ qmaGateSites work g, ∀ p ∈ ps, i ≠ p.1 ∧ i ≠ p.2) : + qmaGateProduct work (qmaTransferGates ps)*qmaGateMatrix work g = + qmaGateMatrix work g*qmaGateProduct work (qmaTransferGates ps) := by + let σ := qmaTransferPermutation ps + have hs : ∀ i ∈ qmaGateSites work g, σ i = i := + fun i hi => qmaTransferPermutation_fixed ps i (ha i hi) + have hi : ∀ i ∈ qmaGateSites work g, σ.symm i = i := by + intro i h + exact σ.symm_apply_eq.mpr (hs i h).symm + rw [qmaTransferGates_matrix ps hp] + change qmaWirePermutation (qmaWireBasis σ)*qmaGateMatrix work g = + qmaGateMatrix work g*qmaWirePermutation (qmaWireBasis σ) + rw [qmaGate_wire_intertwines,qmaRelabelGate_fixed work σ.symm g hg hi] + +theorem qmaTransfer_insert_gate {work : ℕ} + (xs ys : List (Fin (work+1) × Fin (work+1))) (hy : ∀ p ∈ ys, p.1 ≠ p.2) + (g : QMAGate) (hg : g.WellFormed (work+1)) + (ha : ∀ i ∈ qmaGateSites work g, ∀ p ∈ ys, i ≠ p.1 ∧ i ≠ p.2) : + qmaGateProduct work (qmaTransferGates xs++[g]++qmaTransferGates ys) = + qmaGateMatrix work g*qmaGateProduct work (qmaTransferGates (xs++ys)) := by + simp only [qmaTransferGates_append,qmaGateProduct_append,qmaGateProduct_singleton] + rw [←mul_assoc,qmaTransfer_gate_commute ys hy g hg ha,mul_assoc] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTransferIndex.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTransferIndex.lean new file mode 100644 index 0000000000000000000000000000000000000000..da2ec3ae62190ecf99e0c68f67f72cd7eedf3a85 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTransferIndex.lean @@ -0,0 +1,48 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumSweepCursor + +namespace OAI + +/-! Exact time-to-column indexing for the three-gate transfer blocks. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +theorem qmaColumnTransfer_length {width work : ℕ} (l r : Fin (width+1) → Fin (work+1)) + (cols : List (Fin (width+1))) : (qmaColumnTransfer l r cols).length = 3*cols.length := by + have h := congrArg List.length (qmaColumnTransfer_gates l r cols) + simpa only [List.length_map,qmaTransferGates_length] using h + +theorem qmaColumnTransfer_get_column {width work : ℕ} (l r : Fin (width+1) → Fin (work+1)) + (cols : List (Fin (width+1))) (t : ℕ) (ht : t < 3*cols.length) : + ((qmaColumnTransfer l r cols)[t]'(by rw [qmaColumnTransfer_length]; exact ht)).2 = + cols[t/3]'(by omega) := by + induction cols generalizing t with + | nil => simp at ht + | cons a cols ih => + cases t with + | zero => rfl + | succ t => + cases t with + | zero => rfl + | succ t => + cases t with + | zero => rfl + | succ t => + have ht' : t < 3*cols.length := by simp only [List.length_cons] at ht; omega + have hd : (t+1+1+1)/3 = t/3+1 := by omega + change ((qmaColumnTransfer l r cols)[t]'(by rw [qmaColumnTransfer_length]; exact ht')).2 = + (a::cols)[(t+1+1+1)/3] + simpa only [hd,List.getElem_cons_succ] using ih t ht' + +theorem qmaTaggedRowStage_length (width work : ℕ) + (l r : Fin (width+1) → Fin (work+1)) (e : Equiv.Perm (Fin (width+1))) (g : QMAGate) : + (qmaTaggedRowStage width work l r e g).length = 3*(width+1)+1 := by + have h := congrArg List.length (qmaTaggedRowStage_gates width work l r e g) + simpa only [List.length_map,qmaRowStage_length] using h + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTransferSweep.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTransferSweep.lean new file mode 100644 index 0000000000000000000000000000000000000000..35397aafdb0ba6485c276ab4548cea5a691d9d0b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTransferSweep.lean @@ -0,0 +1,98 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUntouchedInput + +namespace OAI + +/-! Exact sweeps of disjoint three-CNOT wire transfers. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped Classical + +def qmaTransferGates {work : ℕ} : List (Fin (work+1) × Fin (work+1)) → List QMAGate + | [] => [] + | (i,j)::ps => qmaWireSwapGates i j ++ qmaTransferGates ps + +def qmaTransferPermutation {n : ℕ} : List (Fin n × Fin n) → Equiv.Perm (Fin n) + | [] => Equiv.refl _ + | (i,j)::ps => (qmaTransferPermutation ps).trans (Equiv.swap i j) + +theorem qmaTransferGates_length {work : ℕ} (ps : List (Fin (work+1) × Fin (work+1))) : + (qmaTransferGates ps).length = 3*ps.length := by + induction ps with + | nil => rfl + | cons p ps ih => + rcases p with ⟨i,j⟩ + simp only [qmaTransferGates,List.length_append,qmaWireSwapGates,List.length_cons, + List.length_nil,ih] + omega + +theorem qmaTransferGates_wellFormed {work : ℕ} (ps : List (Fin (work+1) × Fin (work+1))) + (hp : ∀ p ∈ ps, p.1 ≠ p.2) : + ∀ g ∈ qmaTransferGates ps, g.WellFormed (work+1) := by + induction ps with + | nil => simp [qmaTransferGates] + | cons p ps ih => + rcases p with ⟨i,j⟩ + intro g hg + rcases List.mem_append.mp hg with hg | hg + · exact qmaWireSwapGates_wellFormed i j (hp (i,j) (by simp)) g hg + · exact ih (fun p h => hp p (by simp [h])) g hg + +theorem qmaTransferGates_matrix {work : ℕ} (ps : List (Fin (work+1) × Fin (work+1))) + (hp : ∀ p ∈ ps, p.1 ≠ p.2) : + qmaGateProduct work (qmaTransferGates ps) = + qmaWirePermutation (fun s => s ∘ qmaTransferPermutation ps) := by + induction ps with + | nil => + ext s t + simp [qmaTransferGates,qmaGateProduct_nil,qmaTransferPermutation,qmaWirePermutation,Matrix.one_apply] + | cons p ps ih => + rcases p with ⟨i,j⟩ + rw [qmaTransferGates,qmaGateProduct_append,ih (fun p h => hp p (by simp [h]))] + rw [show qmaGateProduct work (qmaWireSwapGates i j) = + qmaWirePermutation (fun s => s ∘ Equiv.swap i j) from + qmaWireSwap_matrix i j (hp (i,j) (by simp))] + rw [qmaWirePermutation_mul] + rfl + +theorem qmaTransferPermutation_fixed {n : ℕ} (ps : List (Fin n × Fin n)) (k : Fin n) + (hk : ∀ p ∈ ps, k ≠ p.1 ∧ k ≠ p.2) : qmaTransferPermutation ps k = k := by + induction ps with + | nil => rfl + | cons p ps ih => + rcases p with ⟨i,j⟩ + change Equiv.swap i j (qmaTransferPermutation ps k) = k + rw [ih (fun p h => hk p (by simp [h]))] + exact Equiv.swap_apply_of_ne_of_ne (hk (i,j) (by simp)).1 (hk (i,j) (by simp)).2 + +def QMATransferDisjoint {n : ℕ} (p q : Fin n × Fin n) : Prop := + p.1 ≠ q.1 ∧ p.1 ≠ q.2 ∧ p.2 ≠ q.1 ∧ p.2 ≠ q.2 + +theorem qmaTransferPermutation_exchanges {n : ℕ} (ps : List (Fin n × Fin n)) + (hp : ps.Pairwise QMATransferDisjoint) (p : Fin n × Fin n) (hm : p ∈ ps) : + qmaTransferPermutation ps p.1 = p.2 ∧ qmaTransferPermutation ps p.2 = p.1 := by + induction ps with + | nil => simp at hm + | cons q ps ih => + obtain ⟨hq,ht⟩ := List.pairwise_cons.mp hp + rcases List.mem_cons.mp hm with rfl | hm + · have h₁ : qmaTransferPermutation ps p.1 = p.1 := + qmaTransferPermutation_fixed ps p.1 (fun p h => ⟨(hq p h).1,(hq p h).2.1⟩) + have h₂ : qmaTransferPermutation ps p.2 = p.2 := + qmaTransferPermutation_fixed ps p.2 (fun p h => ⟨(hq p h).2.2.1,(hq p h).2.2.2⟩) + change Equiv.swap p.1 p.2 (qmaTransferPermutation ps p.1) = p.2 ∧ + Equiv.swap p.1 p.2 (qmaTransferPermutation ps p.2) = p.1 + simp [h₁,h₂] + · obtain ⟨h₁,h₂⟩ := ih ht hm + change Equiv.swap q.1 q.2 (qmaTransferPermutation ps p.1) = p.2 ∧ + Equiv.swap q.1 q.2 (qmaTransferPermutation ps p.2) = p.1 + rw [h₁,h₂] + exact ⟨Equiv.swap_apply_of_ne_of_ne (hq p hm).2.1.symm (hq p hm).2.2.2.symm, + Equiv.swap_apply_of_ne_of_ne (hq p hm).1.symm (hq p hm).2.2.1.symm⟩ + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTranslatedInternalSeparation.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTranslatedInternalSeparation.lean new file mode 100644 index 0000000000000000000000000000000000000000..257c1567d1c648189960592a9b9de978497eebe6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTranslatedInternalSeparation.lean @@ -0,0 +1,59 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumInternalRouteSeparation + +namespace OAI + +/-! Cell-local disjointness extends to the actual translated physical paths. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +theorem qmaInterior_reverse (l : List (ℕ × ℕ)) : + (((l.reverse).drop 1).dropLast).toFinset = ((l.drop 1).dropLast).toFinset := by + simp only [List.drop_one,List.tail_reverse,List.dropLast_reverse,List.tail_dropLast,List.toFinset_reverse] + +theorem qmaRoute_path_finset (R : QMACellRoute) : R.path.toFinset = R.body.path.toFinset := by + rcases R with ⟨b,r⟩ + cases r + · rfl + · exact List.toFinset_reverse + +theorem qmaRoute_interior_finset (R : QMACellRoute) : + ((R.path.drop 1).dropLast).toFinset = ((R.body.path.drop 1).dropLast).toFinset := by + rcases R with ⟨b,r⟩ + cases r + · rfl + · exact qmaInterior_reverse b.path + +namespace QMAPortRouteData +variable {G : QMARationalExchangeGraph} (P : QMAPortRouteData G) + +theorem internal_bodies_disjoint + (havoid : ∀ i : P.Interior, ∀ v, P.cell i ≠ P.position v) + (p q : ℕ × ℕ) (e f : QMAInternalEdge) (hne : p ≠ q ∨ e ≠ f) + (he : P.RoutingAllowed (qmaInternalBody p e)) + (hf : P.RoutingAllowed (qmaInternalBody q f)) : + Disjoint ((((qmaInternalBody p e).path).drop 1).dropLast).toFinset + (qmaInternalBody q f).path.toFinset := by + apply Finset.disjoint_left.mpr + intro z hz hw + have hz' := List.mem_toFinset.mp hz + have hw' := List.mem_toFinset.mp hw + rw [qmaInternalBody_path,← List.map_drop,← List.map_dropLast] at hz' + rw [qmaInternalBody_path] at hw' + obtain ⟨u,hu,heu⟩ := List.mem_map.mp hz' + obtain ⟨v,hv,hev⟩ := List.mem_map.mp hw' + have hu' := List.mem_of_mem_drop (List.mem_of_mem_dropLast hu) + have hh := qmaCellTranslate_unique (qmaInternalPath_bounded e u hu') + (qmaInternalPath_bounded f v hv) (heu.trans hev.symm) + rcases hh with ⟨rfl,rfl⟩ + have hef : e ≠ f := hne.resolve_left (by intro h; exact h rfl) + exact Finset.disjoint_left.mp (P.internal_allowed_disjoint havoid p e f hef he hf) + (List.mem_toFinset.mpr hu) (List.mem_toFinset.mpr hv) + +end QMAPortRouteData +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTranslatedPatch.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTranslatedPatch.lean new file mode 100644 index 0000000000000000000000000000000000000000..c66dd9105f01d06c6deca2de52d5f0b3f9adc7f4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTranslatedPatch.lean @@ -0,0 +1,83 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCrossingPatch +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPatchSeparation + +namespace OAI + +/-! Translating the fixed crossing patch to every isolated route crossing. -/ + +namespace ContinuumCoulomb + +def qmaPatchTranslate (p z : ℕ × ℕ) : ℕ × ℕ := (32*p.1+10+z.1,32*p.2+10+z.2) + +theorem qmaPatchTranslate_injective (p : ℕ × ℕ) : Function.Injective (qmaPatchTranslate p) := by + intro x y h + apply Prod.ext + · exact Nat.add_left_cancel (congrArg Prod.fst h) + · exact Nat.add_left_cancel (congrArg Prod.snd h) + +theorem qmaPatchTranslate_distance (p x y : ℕ × ℕ) : + Nat.dist (qmaPatchTranslate p x).1 (qmaPatchTranslate p y).1+ + Nat.dist (qmaPatchTranslate p x).2 (qmaPatchTranslate p y).2 = + Nat.dist x.1 y.1+Nat.dist x.2 y.2 := by + simp only [qmaPatchTranslate,Nat.dist_add_add_left] + +theorem qmaPatchTranslate_mem {p z : ℕ × ℕ} (hx : z.1 ≤ 12) (hy : z.2 ≤ 12) : + qmaPatchTranslate p z ∈ qmaPatchBox p := by + unfold qmaPatchBox qmaPatchTranslate qmaExpandedPoint Nat.dist + simp only [Set.mem_ofPred_eq] + omega + +theorem qmaPatchTranslate_ne {p q x y : ℕ × ℕ} (hpq : p ≠ q) + (hx : x.1 ≤ 12 ∧ x.2 ≤ 12) (hy : y.1 ≤ 12 ∧ y.2 ≤ 12) : + qmaPatchTranslate p x ≠ qmaPatchTranslate q y := by + intro he + have h1 := qmaPatchTranslate_mem (p := p) hx.1 hx.2 + have h2 := qmaPatchTranslate_mem (p := q) hy.1 hy.2 + rw [← he] at h2 + exact Set.disjoint_left.mp (qmaPatchBox_disjoint hpq) h1 h2 + +def qmaCrossingPathAt (p : ℕ × ℕ) (e : Fin 9) : List (ℕ × ℕ) := + (qmaCrossingPatchPath e).map (qmaPatchTranslate p) + +theorem qmaCrossingPathAt_chain (p : ℕ × ℕ) (e : Fin 9) : + (qmaCrossingPathAt p e).IsChain + (fun x y => Nat.dist x.1 y.1+Nat.dist x.2 y.2 = 1) := by + apply List.isChain_map_of_isChain (qmaPatchTranslate p) _ (qmaCrossingPatch_chain e) + intro x y h + simpa only [qmaPatchTranslate_distance] using h + +theorem qmaCrossingPathAt_simple (p : ℕ × ℕ) (e : Fin 9) : (qmaCrossingPathAt p e).Nodup := + (qmaCrossingPatch_simple e).map (qmaPatchTranslate_injective p) + +theorem qmaCrossingPathAt_mem (p : ℕ × ℕ) (e : Fin 9) {z : ℕ × ℕ} + (hz : z ∈ qmaCrossingPathAt p e) : z ∈ qmaPatchBox p := by + obtain ⟨w,hw,rfl⟩ := List.mem_map.mp hz + exact qmaPatchTranslate_mem (qmaCrossingPatch_bounded e w hw).1 (qmaCrossingPatch_bounded e w hw).2 + +theorem qmaCrossingPathAt_disjoint {p q : ℕ × ℕ} (hpq : p ≠ q) (e f : Fin 9) : + Disjoint (qmaCrossingPathAt p e).toFinset (qmaCrossingPathAt q f).toFinset := by + apply Finset.disjoint_left.mpr + intro z hz hq + exact Set.disjoint_left.mp (qmaPatchBox_disjoint hpq) + (qmaCrossingPathAt_mem p e (List.mem_toFinset.mp hz)) + (qmaCrossingPathAt_mem q f (List.mem_toFinset.mp hq)) + +def qmaCrossingPortAt (p : ℕ × ℕ) : Fin 4 → ℕ × ℕ := + ![(32*p.1+9,32*p.2+16),(32*p.1+16,32*p.2+23), + (32*p.1+23,32*p.2+16),(32*p.1+16,32*p.2+9)] + +theorem qmaCrossingPortAt_step (p : ℕ × ℕ) (a : Fin 4) : + Nat.dist (qmaCrossingPortAt p a).1 (qmaPatchTranslate p (qmaCrossingPatchVertex (a.castLE (by decide)))).1+ + Nat.dist (qmaCrossingPortAt p a).2 (qmaPatchTranslate p (qmaCrossingPatchVertex (a.castLE (by decide)))).2 = 1 := by + fin_cases a <;> norm_num [qmaCrossingPortAt,qmaPatchTranslate,qmaCrossingPatchVertex, + Nat.add_assoc,Nat.dist_add_add_left] + all_goals decide + +theorem qmaCrossingPortAt_outside (p : ℕ × ℕ) (a : Fin 4) : + qmaCrossingPortAt p a ∉ qmaPatchBox p := by + fin_cases a <;> norm_num [qmaCrossingPortAt,qmaPatchBox,qmaExpandedPoint,Nat.dist_add_add_left] + all_goals decide + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTripleSupported.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTripleSupported.lean new file mode 100644 index 0000000000000000000000000000000000000000..62a9cf57f8f28bd6c27241bcc21467e44befb613 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumTripleSupported.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliTripleSplit + +namespace OAI + +/-! The three factors can be chosen inside the original Pauli support. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +theorem qmaPauliWord_triple_supported (w : ι → Fin 4) (hw : (qmaPauliSupport w).card ≤ 3) + (he : Even (qmaPauliYCount w)) : + ∃ a b c : ι → Fin 4, + qmaPauliSupport a ⊆ qmaPauliSupport w ∧ + qmaPauliSupport b ⊆ qmaPauliSupport w ∧ + qmaPauliSupport c ⊆ qmaPauliSupport w ∧ + (qmaPauliSupport a).card ≤ 1 ∧ (qmaPauliSupport b).card ≤ 1 ∧ (qmaPauliSupport c).card ≤ 1 ∧ + qmaPauliWord a*qmaPauliWord b*qmaPauliWord c = qmaPauliWord w ∧ + qmaPauliWord a*qmaPauliWord b = qmaPauliWord b*qmaPauliWord a ∧ + qmaPauliWord a*qmaPauliWord c = qmaPauliWord c*qmaPauliWord a ∧ + qmaPauliWord b*qmaPauliWord c = qmaPauliWord c*qmaPauliWord b ∧ + decide (Odd (qmaPauliYCount a)) = decide (Odd (qmaPauliYCount b)) ∧ + Even (qmaPauliYCount c) := by + obtain ⟨P,C,hP,hC,hPC,hcover,hnoY⟩ := qmaThreeSupport_split w hw he + obtain ⟨L,T,hL,hT,hLT,hunion⟩ := qmaBalancedSupport P 1 (by omega) + have hLP : L ⊆ P := by rw [← hunion]; exact Finset.subset_union_left + have hTP : T ⊆ P := by rw [← hunion]; exact Finset.subset_union_right + let a := qmaPauliRestrict L w + let b := qmaPauliRestrict T w + let c := qmaPauliRestrict C w + let v := qmaPauliRestrict P w + have hc : qmaPauliYCount c = 0 := by + apply qmaPauliYCount_zero + intro i + by_cases hi : i ∈ C + · simpa only [c,qmaPauliRestrict,hi,ite_true] using hnoY i hi + · simp [c,qmaPauliRestrict,hi] + have hvcover : qmaPauliSupport v ⊆ L ∪ T := by + rw [hunion] + exact qmaPauliRestrict_support P w + have hv : Even (qmaPauliYCount v) := by + have hs := qmaPauliYCount_split P C w hPC (by rw [hcover]) + change qmaPauliYCount v+qmaPauliYCount c = qmaPauliYCount w at hs + rw [hc,add_zero] at hs + rwa [hs] + have hab : qmaPauliWord a*qmaPauliWord b = qmaPauliWord v := by + have h := qmaPauliRestrict_factor L T v hLT hvcover + simpa only [v,qmaPauliRestrict_restrict L P w hLP,qmaPauliRestrict_restrict T P w hTP] using h + have hPS : P ⊆ qmaPauliSupport w := by rw [←hcover]; exact Finset.subset_union_left + have hCS : C ⊆ qmaPauliSupport w := by rw [←hcover]; exact Finset.subset_union_right + refine ⟨a,b,c,(qmaPauliRestrict_support L w).trans (hLP.trans hPS), + (qmaPauliRestrict_support T w).trans (hTP.trans hPS), + (qmaPauliRestrict_support C w).trans hCS,(Finset.card_le_card (qmaPauliRestrict_support L w)).trans hL, + (Finset.card_le_card (qmaPauliRestrict_support T w)).trans hT, + (Finset.card_le_card (qmaPauliRestrict_support C w)).trans hC,?_, + qmaPauliRestrict_commute L T w hLT, + qmaPauliRestrict_commute L C w (hPC.mono_left hLP), + qmaPauliRestrict_commute T C w (hPC.mono_left hTP),?_,?_⟩ + · rw [hab] + exact qmaPauliRestrict_factor P C w hPC (by rw [hcover]) + · have h := qmaPauliRestrict_same_parity L T v hLT hvcover hv + simpa only [v,qmaPauliRestrict_restrict L P w hLP,qmaPauliRestrict_restrict T P w hTP] using h + · rw [hc] + norm_num + + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryClock.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryClock.lean new file mode 100644 index 0000000000000000000000000000000000000000..1c475761c21fb8bfc0c184700db4e2501abe773e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryClock.lean @@ -0,0 +1,78 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalInput +import Mathlib.Order.Fin.Basic +import Mathlib.Order.UpperLower.Basic + +namespace OAI + +/-! Unary clock states and the adjacent-pair characterization of validity. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators Classical + +def qmaUnaryClock (N : ℕ) (t : Fin (N+1)) : SourceSpinBasis N := + fun i => if i.val < t.val then 1 else 0 + +theorem qmaUnaryClock_injective (N : ℕ) : Function.Injective (qmaUnaryClock N) := by + intro s t h + apply Fin.ext + by_contra hne + rcases lt_or_gt_of_ne hne with hst | hts + · let i : Fin N := ⟨s.val,lt_of_lt_of_le hst (Nat.le_of_lt_succ t.isLt)⟩ + have hi := congrFun h i + have hs : ¬i.val < s.val := by simp [i] + have ht : i.val < t.val := hst + simp [qmaUnaryClock,hs,ht] at hi + · let i : Fin N := ⟨t.val,lt_of_lt_of_le hts (Nat.le_of_lt_succ s.isLt)⟩ + have hi := congrFun h i + have hs : i.val < s.val := hts + have ht : ¬i.val < t.val := by simp [i] + simp [qmaUnaryClock,hs,ht] at hi + +theorem qmaUnaryClock_antitone (N : ℕ) (t : Fin (N+1)) : Antitone (qmaUnaryClock N t) := by + intro i j hij + by_cases hi : i.val < t.val + · by_cases hj : j.val < t.val <;> simp [qmaUnaryClock,hi,hj] + · have hj : ¬j.val < t.val := by omega + simp [qmaUnaryClock,hi,hj] + +theorem qmaUnaryClock_of_antitone (N : ℕ) (s : SourceSpinBasis N) (hs : Antitone s) : + ∃ t : Fin (N+1), qmaUnaryClock N t = s := by + have hlow : IsLowerSet {i : Fin N | s i = 1} := by + intro j i hij hj + have h := hs hij + change s j = 1 at hj + rw [hj] at h + have hb := (s i).isLt + apply Fin.ext + change (s i).val = 1 + change (1 : Fin 2).val ≤ (s i).val at h + norm_num at h + omega + rcases hlow.eq_univ_or_Iio with hall | ⟨t,ht⟩ + · refine ⟨Fin.last N,?_⟩ + funext i + have hi : s i = 1 := by + have hm : i ∈ ({j : Fin N | s j = 1} : Set (Fin N)) := by rw [hall]; trivial + exact hm + simp [qmaUnaryClock,i.isLt,hi] + · refine ⟨⟨t.val,Nat.lt_succ_of_lt t.isLt⟩,?_⟩ + funext i + have hi : s i = 1 ↔ i < t := Set.ext_iff.mp ht i + by_cases hit : i.val < t.val + · have hsi : s i = 1 := hi.mpr hit + simp [qmaUnaryClock,hit,hsi] + · have hsi : s i ≠ 1 := fun h => hit (hi.mp h) + have hz : s i = 0 := by + apply Fin.ext + have hb := (s i).isLt + have hn : (s i).val ≠ 1 := fun h => hsi (Fin.ext h) + change (s i).val = 0 + omega + simp [qmaUnaryClock,hit,hz] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryEmbedding.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryEmbedding.lean new file mode 100644 index 0000000000000000000000000000000000000000..1a9ab5d96bd8f52068f51e5e79e0b4d238f58e3d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryEmbedding.lean @@ -0,0 +1,83 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnarySoundness + +namespace OAI + +/-! Isometric embedding of the finite history into all unary clock strings. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +def qmaUnaryInclusion (c : QMACircuit) (p : QMAHistoryBasis c) : QMAUnaryBasis c := + (qmaHistoryClock c.gates.length p.1,p.2) + +theorem qmaUnaryInclusion_injective (c : QMACircuit) : Function.Injective (qmaUnaryInclusion c) := by + intro p q h + change (qmaHistoryClock c.gates.length p.1,p.2) = + (qmaHistoryClock c.gates.length q.1,q.2) at h + apply Prod.ext + · exact qmaHistoryClock_injective c.gates.length (congrArg Prod.fst h) + · exact congrArg (fun r : QMAUnaryBasis c => r.2) h + +def qmaUnaryExtend (c : QMACircuit) (u : QMAHistoryBasis c → ℂ) : QMAUnaryBasis c → ℂ := + Function.extend (qmaUnaryInclusion c) u (fun _ => 0) + +@[simp] theorem qmaUnaryExtend_valid (c : QMACircuit) (u : QMAHistoryBasis c → ℂ) + (t : Fin (c.gates.length+1)) (a : SourceSpinBasis (c.work+1)) : + qmaUnaryExtend c u (qmaHistoryClock c.gates.length t,a) = u (t,a) := + (qmaUnaryInclusion_injective c).extend_apply u (fun _ => 0) (t,a) + +theorem qmaUnaryExtend_zero (c : QMACircuit) (u : QMAHistoryBasis c → ℂ) + (s : SourceSpinBasis (c.gates.length+2)) (a : SourceSpinBasis (c.work+1)) + (hs : ¬QMALegalClock c.gates.length s) : qmaUnaryExtend c u (s,a) = 0 := by + apply Function.extend_apply' + rintro ⟨p,hp⟩ + apply hs + have h := qmaHistoryClock_legal c.gates.length p.1 + rwa [show qmaHistoryClock c.gates.length p.1 = s from congrArg Prod.fst hp] at h + +@[simp] theorem qmaUnaryRestrict_extend (c : QMACircuit) (u : QMAHistoryBasis c → ℂ) : + qmaUnaryRestrict c (qmaUnaryExtend c u) = u := by + funext p + exact qmaUnaryExtend_valid c u p.1 p.2 + +theorem qmaUnaryExtend_invalid_mass (c : QMACircuit) (u : QMAHistoryBasis c → ℂ) : + qmaUnaryInvalidMass c (qmaUnaryExtend c u) = 0 := by + apply Finset.sum_eq_zero + intro s _ + by_cases hs : QMALegalClock c.gates.length s + · simp only [ite_eq_left hs] + · simp only [ite_eq_right hs,qmaUnaryExtend_zero c u s _ hs,Complex.normSq_zero,Finset.sum_const_zero] + +theorem qmaUnaryExtend_mass (c : QMACircuit) (u : QMAHistoryBasis c → ℂ) : + qmaUnaryMass c (qmaUnaryExtend c u) = ∑ p, Complex.normSq (u p) := by + rw [qmaUnaryMass_split,qmaUnaryRestrict_extend,qmaUnaryExtend_invalid_mass,add_zero] + +theorem qmaUnaryExtend_clock_energy (c : QMACircuit) (u : QMAHistoryBasis c → ℂ) : + qmaUnaryClockEnergy c (qmaUnaryExtend c u) = 0 := by + apply Finset.sum_eq_zero + intro s _ + by_cases hs : QMALegalClock c.gates.length s + · rw [qmaPinnedClockPenalty_zero _ _ hs,zero_mul] + · simp only [qmaUnaryExtend_zero c u s _ hs,Complex.normSq_zero,Finset.sum_const_zero,mul_zero] + +theorem qmaUnaryResidual_extend_invalid (c : QMACircuit) (u : QMAHistoryBasis c → ℂ) + (t : Fin c.gates.length) (s : SourceSpinBasis (c.gates.length+2)) + (hg : QMAClockGuard c.gates.length t s) (hz : s (qmaClockMiddle c.gates.length t) = 0) + (hs : ¬QMALegalClock c.gates.length s) (a : SourceSpinBasis (c.work+1)) : + qmaUnaryResidual c (qmaUnaryExtend c u) t s a = 0 := by + have ha : ¬QMALegalClock c.gates.length (Function.update s (qmaClockMiddle c.gates.length t) 1) := + fun h => hs ((qmaClock_step_legal_iff c.gates.length t s hg hz).mp h) + have he : (fun b => qmaUnaryExtend c u (s,b)) = 0 := by + funext b + exact qmaUnaryExtend_zero c u s b hs + unfold qmaUnaryResidual + rw [he,Matrix.mulVec_zero,qmaUnaryExtend_zero c u _ a ha] + simp + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryEmbeddingEnergy.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryEmbeddingEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..8ced21731b16ed19e72d758bb6da558b4609a4ef --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryEmbeddingEnergy.lean @@ -0,0 +1,107 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnaryEmbedding + +namespace OAI + +/-! Exact energy preservation of the accepting unary-clock embedding. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators Classical + +theorem qmaUnaryExtend_weighted_sum (c : QMACircuit) (u : QMAHistoryBasis c → ℂ) + (w : SourceSpinBasis (c.gates.length+2) → SourceSpinBasis (c.work+1) → ℝ) : + (∑ s : SourceSpinBasis (c.gates.length+2), ∑ a, + w s a*Complex.normSq (qmaUnaryExtend c u (s,a))) = + ∑ t : Fin (c.gates.length+1), ∑ a, + w (qmaHistoryClock c.gates.length t) a*Complex.normSq (u (t,a)) := by + have he := qmaClock_sector_sum c.gates.length (fun s => + ∑ a, w s a*Complex.normSq (qmaUnaryExtend c u (s,a))) + have hz : (∑ s : SourceSpinBasis (c.gates.length+2), + if QMALegalClock c.gates.length s then 0 else + ∑ a, w s a*Complex.normSq (qmaUnaryExtend c u (s,a))) = 0 := by + apply Finset.sum_eq_zero + intro s _ + by_cases hs : QMALegalClock c.gates.length s + · exact ite_eq_left hs + · simp only [ite_eq_right hs,qmaUnaryExtend_zero c u s _ hs, + Complex.normSq_zero,mul_zero,Finset.sum_const_zero] + rw [hz,add_zero] at he + simpa only [qmaUnaryExtend_valid] using he + +theorem qmaHistoryClock_input_marker (c : QMACircuit) (t : Fin (c.gates.length+1)) : + qmaHistoryClock c.gates.length t (qmaInputMarker c) = 0 ↔ t = 0 := by + by_cases ht : t = 0 + · subst t + simp [qmaHistoryClock,qmaUnaryClock,qmaInputMarker] + · have hn : t.val ≠ 0 := fun h => ht (Fin.ext h) + have hh : 1 < t.val+1 := by omega + simp [qmaHistoryClock,qmaUnaryClock,qmaInputMarker,hh,ht] + +theorem qmaHistoryClock_output_marker (c : QMACircuit) (t : Fin (c.gates.length+1)) : + qmaHistoryClock c.gates.length t (qmaOutputMarker c) = 1 ↔ t = Fin.last c.gates.length := by + by_cases ht : t = Fin.last c.gates.length + · subst t + simp [qmaHistoryClock,qmaUnaryClock,qmaOutputMarker] + · have hn : t.val ≠ c.gates.length := fun h => ht (Fin.ext h) + have hh : ¬c.gates.length < t.val+1 := by omega + simp [qmaHistoryClock,qmaUnaryClock,qmaOutputMarker,hh,ht] + +theorem qmaUnaryExtend_input_energy (c : QMACircuit) (u : QMAHistoryBasis c → ℂ) : + qmaUnaryInputEnergy c (qmaUnaryExtend c u) = + qmaQuadratic (Matrix.diagonal (fun k => (qmaInitialCountDiagonal c k : ℂ))) u := by + have h := qmaUnaryExtend_weighted_sum c u (fun s a => + if s (qmaInputMarker c) = 0 then qmaAncillaCount c a else 0) + simp only [ite_mul,zero_mul,Finset.sum_ite_irrel,Finset.sum_const_zero, + qmaHistoryClock_input_marker] at h + rw [qmaInitialCountDiagonal_sum] + simpa only [qmaUnaryInputEnergy,Finset.sum_ite_eq',Finset.mem_univ,ite_true] using h + +theorem qmaUnaryExtend_output_energy (c : QMACircuit) (u : QMAHistoryBasis c → ℂ) : + qmaUnaryOutputEnergy c (qmaUnaryExtend c u) = + qmaOutputPenalty c (qmaHistoryFromVector c u) := by + have h := qmaUnaryExtend_weighted_sum c u (fun s a => + if s (qmaOutputMarker c) = 1 ∧ a (Fin.last c.work) ≠ 1 then 1 else 0) + simp only [ite_mul,one_mul,zero_mul,ite_and,Finset.sum_ite_irrel, + Finset.sum_const_zero,qmaHistoryClock_output_marker] at h + rw [qmaOutputPenalty_sum] + simpa only [qmaUnaryOutputEnergy,Finset.sum_ite_eq',Finset.mem_univ,ite_true] using h + +theorem qmaUnaryExtend_propagation_energy (c : QMACircuit) (u : QMAHistoryBasis c → ℂ) : + qmaUnaryPropagationEnergy c (qmaUnaryExtend c u) = + qmaPropagationEnergy c (qmaHistoryFromVector c u) := by + rw [←qmaPropagationMatrix_energy,qmaQuadratic_gram,Fintype.sum_prod_type] + apply Finset.sum_congr rfl + intro t _ + have hz : QMAClockGuard c.gates.length t (qmaHistoryClock c.gates.length t.castSucc) ∧ + qmaHistoryClock c.gates.length t.castSucc (qmaClockMiddle c.gates.length t) = 0 := + ⟨qmaClock_step_guard _ _,qmaClock_step_zero _ _⟩ + calc + _ = (if QMAClockGuard c.gates.length t (qmaHistoryClock c.gates.length t.castSucc) ∧ + qmaHistoryClock c.gates.length t.castSucc (qmaClockMiddle c.gates.length t) = 0 then + ∑ a, Complex.normSq (qmaUnaryResidual c (qmaUnaryExtend c u) t + (qmaHistoryClock c.gates.length t.castSucc) a) else 0) := by + apply Finset.sum_eq_single (qmaHistoryClock c.gates.length t.castSucc) + · intro s _ hne + by_cases ha : QMAClockGuard c.gates.length t s ∧ s (qmaClockMiddle c.gates.length t) = 0 + · rw [ite_eq_left ha] + have hs : ¬QMALegalClock c.gates.length s := by + intro hs + exact hne (qmaClock_step_legal_before _ _ _ ha.1 ha.2 hs).symm + apply Finset.sum_eq_zero + intro a _ + rw [qmaUnaryResidual_extend_invalid c u t s ha.1 ha.2 hs a,Complex.normSq_zero] + · exact ite_eq_right ha + · simp + _ = _ := by simp only [ite_eq_left hz,qmaUnaryResidual_valid,qmaUnaryRestrict_extend] + +theorem qmaUnaryExtend_energy (c : QMACircuit) (u : QMAHistoryBasis c → ℂ) : + qmaUnaryEnergy c (qmaUnaryExtend c u) = qmaQuadratic (qmaCountedHistoryHamiltonian c) u := by + rw [qmaUnaryEnergy,qmaUnaryExtend_clock_energy,qmaUnaryExtend_input_energy, + qmaUnaryExtend_output_energy,qmaUnaryExtend_propagation_energy, + qmaCountedHistoryHamiltonian_form,zero_add] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryEnergy.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..eaa60eab6d2b0ef5fa512a509ba41b0f75e3d94c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryEnergy.lean @@ -0,0 +1,95 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnaryForm + +namespace OAI + +/-! The local endpoint penalties dominate the finite history penalties. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators Classical + +def qmaInputMarker (c : QMACircuit) : Fin (c.gates.length+2) := ⟨1,by omega⟩ +def qmaOutputMarker (c : QMACircuit) : Fin (c.gates.length+2) := ⟨c.gates.length,by omega⟩ + +def qmaUnaryInputEnergy (c : QMACircuit) (u : QMAUnaryBasis c → ℂ) : ℝ := + ∑ s : SourceSpinBasis (c.gates.length+2), + if s (qmaInputMarker c) = 0 then ∑ a, qmaAncillaCount c a*Complex.normSq (u (s,a)) else 0 + +def qmaUnaryOutputEnergy (c : QMACircuit) (u : QMAUnaryBasis c → ℂ) : ℝ := + ∑ s : SourceSpinBasis (c.gates.length+2), if s (qmaOutputMarker c) = 1 then + ∑ a : SourceSpinBasis (c.work+1), if a (Fin.last c.work) ≠ 1 then + Complex.normSq (u (s,a)) else 0 else 0 + +def qmaUnaryEnergy (c : QMACircuit) (u : QMAUnaryBasis c → ℂ) : ℝ := + qmaUnaryClockEnergy c u+qmaUnaryOutputEnergy c u+7*qmaUnaryInputEnergy c u+ + 8*c.gates.length*qmaUnaryPropagationEnergy c u + +theorem qmaInitialCountDiagonal_sum (c : QMACircuit) (u : QMAHistoryBasis c → ℂ) : + qmaQuadratic (Matrix.diagonal (fun k => (qmaInitialCountDiagonal c k : ℂ))) u = + ∑ a : SourceSpinBasis (c.work+1), qmaAncillaCount c a*Complex.normSq (u (0,a)) := by + rw [qmaQuadratic_diagonal_real] + simp [qmaInitialCountDiagonal,Fintype.sum_prod_type,ite_mul,Finset.sum_ite_irrel] + +theorem qmaOutputPenalty_sum (c : QMACircuit) (u : QMAHistoryBasis c → ℂ) : + qmaOutputPenalty c (qmaHistoryFromVector c u) = + ∑ a : SourceSpinBasis (c.work+1), if a (Fin.last c.work) ≠ 1 then + Complex.normSq (u (Fin.last c.gates.length,a)) else 0 := by + unfold qmaOutputPenalty + have hslice : qmaHistoryFromVector c u c.gates.length = + WithLp.toLp 2 (fun a => u (Fin.last c.gates.length,a)) := by + ext a + exact qmaHistoryFromVector_fin c u (Fin.last c.gates.length) a + rw [hslice,EuclideanSpace.norm_sq_eq] + simp [qmaMask_apply,apply_ite,Complex.sq_norm] + +theorem qmaUnaryInputEnergy_valid_le (c : QMACircuit) (u : QMAUnaryBasis c → ℂ) : + qmaQuadratic (Matrix.diagonal (fun k => (qmaInitialCountDiagonal c k : ℂ))) + (qmaUnaryRestrict c u) ≤ qmaUnaryInputEnergy c u := by + rw [qmaInitialCountDiagonal_sum] + have hm : qmaHistoryClock c.gates.length 0 (qmaInputMarker c) = 0 := by + simp [qmaHistoryClock,qmaUnaryClock,qmaInputMarker] + have h := Finset.single_le_sum + (f := fun s : SourceSpinBasis (c.gates.length+2) => + if s (qmaInputMarker c) = 0 then ∑ a, qmaAncillaCount c a*Complex.normSq (u (s,a)) else 0) + (s := Finset.univ) (a := qmaHistoryClock c.gates.length 0) + (by intro s _; split + · exact Finset.sum_nonneg (fun a _ => mul_nonneg (qmaAncillaCount_nonneg c a) (Complex.normSq_nonneg _)) + · exact le_rfl) (Finset.mem_univ _) + simpa only [ite_eq_left hm,qmaUnaryRestrict,qmaUnaryInputEnergy] using h + +theorem qmaUnaryOutputEnergy_valid_le (c : QMACircuit) (u : QMAUnaryBasis c → ℂ) : + qmaOutputPenalty c (qmaHistoryFromVector c (qmaUnaryRestrict c u)) ≤ qmaUnaryOutputEnergy c u := by + rw [qmaOutputPenalty_sum] + have hm : qmaHistoryClock c.gates.length (Fin.last c.gates.length) (qmaOutputMarker c) = 1 := by + simp [qmaHistoryClock,qmaUnaryClock,qmaOutputMarker] + have h := Finset.single_le_sum + (f := fun s : SourceSpinBasis (c.gates.length+2) => + if s (qmaOutputMarker c) = 1 then + ∑ a : SourceSpinBasis (c.work+1), if a (Fin.last c.work) ≠ 1 then + Complex.normSq (u (s,a)) else 0 else 0) + (s := Finset.univ) (a := qmaHistoryClock c.gates.length (Fin.last c.gates.length)) + (by intro s _; split + · apply Finset.sum_nonneg + intro a _ + split + · exact Complex.normSq_nonneg _ + · exact le_rfl + · exact le_rfl) (Finset.mem_univ _) + simpa only [ite_eq_left hm,qmaUnaryRestrict,qmaUnaryOutputEnergy] using h + +theorem qmaUnaryEnergy_restriction (c : QMACircuit) (u : QMAUnaryBasis c → ℂ) : + qmaQuadratic (qmaCountedHistoryHamiltonian c) (qmaUnaryRestrict c u)+ + qmaUnaryClockEnergy c u ≤ qmaUnaryEnergy c u := by + rw [qmaCountedHistoryHamiltonian_form] + have hi := qmaUnaryInputEnergy_valid_le c u + have ho := qmaUnaryOutputEnergy_valid_le c u + have hp := mul_le_mul_of_nonneg_left (qmaUnaryPropagationEnergy_valid_le c u) + (by positivity : 0 ≤ 8*(c.gates.length:ℝ)) + unfold qmaUnaryEnergy + linarith + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryForm.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryForm.lean new file mode 100644 index 0000000000000000000000000000000000000000..840eefbb34e4bb676de41e8afd40ed24af95719d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryForm.lean @@ -0,0 +1,87 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumClockSector +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCountedHistory + +namespace OAI + +/-! The full unary-clock form retains every clock configuration. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +abbrev QMAUnaryBasis (c : QMACircuit) := + SourceSpinBasis (c.gates.length+2) × SourceSpinBasis (c.work+1) + +def qmaUnaryRestrict (c : QMACircuit) (u : QMAUnaryBasis c → ℂ) : QMAHistoryBasis c → ℂ := + fun p => u (qmaHistoryClock c.gates.length p.1,p.2) + +def qmaUnaryMass (c : QMACircuit) (u : QMAUnaryBasis c → ℂ) : ℝ := + ∑ p, Complex.normSq (u p) + +def qmaUnaryInvalidMass (c : QMACircuit) (u : QMAUnaryBasis c → ℂ) : ℝ := + ∑ s : SourceSpinBasis (c.gates.length+2), + if QMALegalClock c.gates.length s then 0 else ∑ a, Complex.normSq (u (s,a)) + +def qmaUnaryClockEnergy (c : QMACircuit) (u : QMAUnaryBasis c → ℂ) : ℝ := + ∑ s : SourceSpinBasis (c.gates.length+2), + qmaPinnedClockPenalty c.gates.length s * ∑ a, Complex.normSq (u (s,a)) + +theorem qmaUnaryMass_split (c : QMACircuit) (u : QMAUnaryBasis c → ℂ) : + qmaUnaryMass c u = + (∑ p : QMAHistoryBasis c, Complex.normSq (qmaUnaryRestrict c u p))+ + qmaUnaryInvalidMass c u := by + unfold qmaUnaryMass qmaUnaryInvalidMass qmaUnaryRestrict + rw [Fintype.sum_prod_type,Fintype.sum_prod_type] + exact qmaClock_sector_sum c.gates.length (fun s => ∑ a, Complex.normSq (u (s,a))) + +theorem qmaUnaryInvalidMass_le (c : QMACircuit) (u : QMAUnaryBasis c → ℂ) : + qmaUnaryInvalidMass c u ≤ qmaUnaryClockEnergy c u := by + apply qmaClock_invalid_mass_bound + intro s + exact Finset.sum_nonneg (fun a _ => Complex.normSq_nonneg (u (s,a))) + +def qmaUnaryResidual (c : QMACircuit) (u : QMAUnaryBasis c → ℂ) + (t : Fin c.gates.length) (s : SourceSpinBasis (c.gates.length+2)) : + SourceSpinBasis (c.work+1) → ℂ := + fun a => u (Function.update s (qmaClockMiddle c.gates.length t) 1,a)- + (qmaStepMatrix c t.val).mulVec (fun b => u (s,b)) a + +def qmaUnaryPropagationEnergy (c : QMACircuit) (u : QMAUnaryBasis c → ℂ) : ℝ := + ∑ t : Fin c.gates.length, ∑ s : SourceSpinBasis (c.gates.length+2), + if QMAClockGuard c.gates.length t s ∧ s (qmaClockMiddle c.gates.length t) = 0 then + ∑ a, Complex.normSq (qmaUnaryResidual c u t s a) else 0 + +theorem qmaUnaryResidual_valid (c : QMACircuit) (u : QMAUnaryBasis c → ℂ) + (t : Fin c.gates.length) (a : SourceSpinBasis (c.work+1)) : + qmaUnaryResidual c u t (qmaHistoryClock c.gates.length t.castSucc) a = + (qmaPropagationMatrix c).mulVec (qmaUnaryRestrict c u) (t,a) := by + rw [qmaPropagationMatrix,LinearMap.toMatrix'_mulVec] + unfold qmaUnaryResidual + rw [qmaClock_step_update] + rfl + +theorem qmaUnaryPropagationEnergy_valid_le (c : QMACircuit) (u : QMAUnaryBasis c → ℂ) : + qmaPropagationEnergy c (qmaHistoryFromVector c (qmaUnaryRestrict c u)) ≤ + qmaUnaryPropagationEnergy c u := by + rw [←qmaPropagationMatrix_energy,qmaQuadratic_gram,Fintype.sum_prod_type] + apply Finset.sum_le_sum + intro t _ + have h := Finset.single_le_sum + (f := fun s : SourceSpinBasis (c.gates.length+2) => + if QMAClockGuard c.gates.length t s ∧ s (qmaClockMiddle c.gates.length t) = 0 then + ∑ a, Complex.normSq (qmaUnaryResidual c u t s a) else 0) + (s := Finset.univ) (a := qmaHistoryClock c.gates.length t.castSucc) + (by intro s _; split + · exact Finset.sum_nonneg (fun a _ => Complex.normSq_nonneg _) + · exact le_rfl) (Finset.mem_univ _) + have hg : QMAClockGuard c.gates.length t (qmaHistoryClock c.gates.length t.castSucc) ∧ + qmaHistoryClock c.gates.length t.castSucc (qmaClockMiddle c.gates.length t) = 0 := + ⟨qmaClock_step_guard c.gates.length t,qmaClock_step_zero c.gates.length t⟩ + simpa only [ite_eq_left hg,qmaUnaryResidual_valid] using h + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryMatrix.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryMatrix.lean new file mode 100644 index 0000000000000000000000000000000000000000..2df2309a3e7cbd1ebdd673f797b1ad2b00423ff8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryMatrix.lean @@ -0,0 +1,92 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnaryEmbeddingEnergy + +namespace OAI + +/-! The actual Hermitian matrix on all clock and computation qubits. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +abbrev QMAUnaryRow (c : QMACircuit) := Fin c.gates.length × QMAUnaryBasis c + +def qmaUnaryPropagationMap (c : QMACircuit) : + (QMAUnaryBasis c → ℂ) →ₗ[ℂ] (QMAUnaryRow c → ℂ) where + toFun u p := if QMAClockGuard c.gates.length p.1 p.2.1 ∧ + p.2.1 (qmaClockMiddle c.gates.length p.1) = 0 then + qmaUnaryResidual c u p.1 p.2.1 p.2.2 else 0 + map_add' u v := by + funext p + by_cases h : QMAClockGuard c.gates.length p.1 p.2.1 ∧ + p.2.1 (qmaClockMiddle c.gates.length p.1) = 0 + · simp only [ite_eq_left h,Pi.add_apply] + change (u _+v _)-(qmaStepMatrix c p.1.val).mulVec + ((fun a => u (p.2.1,a))+(fun a => v (p.2.1,a))) p.2.2 = _ + rw [Matrix.mulVec_add] + simp only [qmaUnaryResidual,Pi.add_apply] + ring + · simp only [ite_eq_right h,Pi.add_apply,add_zero] + map_smul' a u := by + funext p + by_cases h : QMAClockGuard c.gates.length p.1 p.2.1 ∧ + p.2.1 (qmaClockMiddle c.gates.length p.1) = 0 + · simp only [ite_eq_left h,Pi.smul_apply,RingHom.id_apply] + change a*u _-(qmaStepMatrix c p.1.val).mulVec + (a • (fun b => u (p.2.1,b))) p.2.2 = _ + rw [Matrix.mulVec_smul] + simp only [qmaUnaryResidual,Pi.smul_apply,smul_eq_mul] + ring + · simp only [ite_eq_right h,Pi.smul_apply,RingHom.id_apply,smul_zero] + +def qmaUnaryPropagationMatrix (c : QMACircuit) : Matrix (QMAUnaryRow c) (QMAUnaryBasis c) ℂ := + LinearMap.toMatrix' (qmaUnaryPropagationMap c) + +def qmaUnaryClockDiagonal (c : QMACircuit) (p : QMAUnaryBasis c) : ℝ := + qmaPinnedClockPenalty c.gates.length p.1 + +def qmaUnaryInputDiagonal (c : QMACircuit) (p : QMAUnaryBasis c) : ℝ := + if p.1 (qmaInputMarker c) = 0 then qmaAncillaCount c p.2 else 0 + +def qmaUnaryOutputDiagonal (c : QMACircuit) (p : QMAUnaryBasis c) : ℝ := + if p.1 (qmaOutputMarker c) = 1 ∧ p.2 (Fin.last c.work) ≠ 1 then 1 else 0 + +def qmaUnaryHamiltonian (c : QMACircuit) : Matrix (QMAUnaryBasis c) (QMAUnaryBasis c) ℂ := + Matrix.diagonal (fun p => (qmaUnaryClockDiagonal c p : ℂ))+ + Matrix.diagonal (fun p => (qmaUnaryOutputDiagonal c p : ℂ))+ + (7:ℂ) • Matrix.diagonal (fun p => (qmaUnaryInputDiagonal c p : ℂ))+ + (8*c.gates.length:ℂ) • ((qmaUnaryPropagationMatrix c).conjTranspose*qmaUnaryPropagationMatrix c) + +theorem qmaUnaryPropagationMatrix_form (c : QMACircuit) (u : QMAUnaryBasis c → ℂ) : + qmaQuadratic ((qmaUnaryPropagationMatrix c).conjTranspose*qmaUnaryPropagationMatrix c) u = + qmaUnaryPropagationEnergy c u := by + rw [qmaQuadratic_gram,qmaUnaryPropagationMatrix,LinearMap.toMatrix'_mulVec] + simp [Fintype.sum_prod_type,qmaUnaryPropagationMap,qmaUnaryPropagationEnergy, + apply_ite,Finset.sum_ite_irrel] + +theorem qmaUnaryHamiltonian_hermitian (c : QMACircuit) : (qmaUnaryHamiltonian c).IsHermitian := by + have hd (d : QMAUnaryBasis c → ℝ) : (Matrix.diagonal (fun p => (d p : ℂ))).IsHermitian := by + apply Matrix.isHermitian_diagonal_iff.mpr + intro p + simp [isSelfAdjoint_iff] + exact (((hd _).add (hd _)).add ((hd _).smul (by simp))).add + ((Matrix.isHermitian_conjTranspose_mul_self (qmaUnaryPropagationMatrix c)).smul + (by simp [isSelfAdjoint_iff])) + +theorem qmaUnaryHamiltonian_form (c : QMACircuit) (u : QMAUnaryBasis c → ℂ) : + qmaQuadratic (qmaUnaryHamiltonian c) u = qmaUnaryEnergy c u := by + unfold qmaUnaryHamiltonian + rw [qmaQuadratic_add,qmaQuadratic_add,qmaQuadratic_add] + have hs : (8*c.gates.length:ℂ) = ((8*(c.gates.length:ℝ):ℝ):ℂ) := by push_cast; rfl + have h7 : (7:ℂ) = ((7:ℝ):ℂ) := by norm_num + rw [hs,h7,qmaQuadratic_smul,qmaQuadratic_smul,qmaQuadratic_diagonal_real, + qmaQuadratic_diagonal_real,qmaQuadratic_diagonal_real,qmaUnaryPropagationMatrix_form] + simp only [qmaUnaryEnergy,qmaUnaryClockEnergy,qmaUnaryOutputEnergy,qmaUnaryInputEnergy, + qmaUnaryClockDiagonal,qmaUnaryOutputDiagonal,qmaUnaryInputDiagonal,Fintype.sum_prod_type, + ite_mul,one_mul,zero_mul,ite_and,Finset.sum_ite_irrel,Finset.sum_const_zero,Finset.mul_sum] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryPenalty.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryPenalty.lean new file mode 100644 index 0000000000000000000000000000000000000000..3831483ece90f3f6d21722fc017d4a89a2769153 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryPenalty.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnaryClock + +namespace OAI + +/-! The adjacent 01 penalties separate all invalid unary clock states. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators Classical + +def qmaClockFaultCount : (N : ℕ) → SourceSpinBasis N → ℝ + | 0, _ => 0 + | n+1, s => ∑ i : Fin n, if s i.castSucc = 0 ∧ s i.succ = 1 then 1 else 0 + +theorem qmaClockFaultCount_nonneg (N : ℕ) (s : SourceSpinBasis N) : + 0 ≤ qmaClockFaultCount N s := by + cases N with + | zero => rfl + | succ n => unfold qmaClockFaultCount; positivity + +theorem qmaClockFaultCount_zero (N : ℕ) (s : SourceSpinBasis N) (hs : Antitone s) : + qmaClockFaultCount N s = 0 := by + cases N with + | zero => rfl + | succ n => + apply Finset.sum_eq_zero + intro i _ + have hi := hs (Fin.castSucc_lt_succ (i := i)).le + have hn : ¬(s i.castSucc = 0 ∧ s i.succ = 1) := by + rintro ⟨hl,hr⟩ + rw [hl,hr] at hi + norm_num at hi + simp [hn] + +theorem qmaClockFaultCount_one_le (N : ℕ) (s : SourceSpinBasis N) (hs : ¬Antitone s) : + 1 ≤ qmaClockFaultCount N s := by + cases N with + | zero => + exfalso + apply hs + intro i + exact Fin.elim0 i + | succ n => + have hn : ¬∀ i : Fin n, s i.succ ≤ s i.castSucc := + fun h => hs (Fin.antitone_iff_succ_le.mpr h) + obtain ⟨i,hi⟩ := not_forall.mp hn + have hv : s i.castSucc = 0 ∧ s i.succ = 1 := by + constructor <;> apply Fin.ext + all_goals + have hleft := (s i.castSucc).isLt + have hright := (s i.succ).isLt + simp only [Fin.le_def] at hi + simp only [Fin.val_zero,Fin.val_one] + omega + have h := Finset.single_le_sum + (f := fun j : Fin n => if s j.castSucc = 0 ∧ s j.succ = 1 then (1:ℝ) else 0) + (s := Finset.univ) (a := i) (by intro j _; positivity) (Finset.mem_univ _) + simpa only [qmaClockFaultCount,ite_eq_left hv] using h + +theorem qmaClockFaultCount_unary (N : ℕ) (t : Fin (N+1)) : + qmaClockFaultCount N (qmaUnaryClock N t) = 0 := + qmaClockFaultCount_zero N _ (qmaUnaryClock_antitone N t) + +theorem qmaClockFaultCount_invalid (N : ℕ) (s : SourceSpinBasis N) + (hs : ¬∃ t : Fin (N+1), qmaUnaryClock N t = s) : + 1 ≤ qmaClockFaultCount N s := + qmaClockFaultCount_one_le N s (fun h => hs (qmaUnaryClock_of_antitone N s h)) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryPrefix.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryPrefix.lean new file mode 100644 index 0000000000000000000000000000000000000000..7908e9ea072e0cdae9d20f17562c78750748d65d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryPrefix.lean @@ -0,0 +1,108 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBitTransfer +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCircuitCode + +namespace OAI + +/-! Preserve the unary size bound while calling the given verifier generator. +The extra tapes hold only Boolean words; the original machine is embedded +without changing any of its instructions. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumUnaryPrefix +open Turing ExactQuantumFactoring.BitStackProgram +open MinUncutGames.Foundations.Complexity + +variable {α β : Type} {ea : α → List Bool} {eb : β → List Bool} {f : α → β} + +abbrev Tape (h : TM2ComputableInPolyTime ea eb f) := h.tm.K ⊕ Fin 3 +abbrev Alphabet (h : TM2ComputableInPolyTime ea eb f) : Tape h → Type := + MachineEmbedding.Alphabet h.tm.Γ (fun _ : Fin 3 => Bool) +abbrev Label (h : TM2ComputableInPolyTime ea eb f) := h.tm.Λ ⊕ Fin 7 +abbrev State (h : TM2ComputableInPolyTime ea eb f) := h.tm.σ × Option Bool + +def program (h : TM2ComputableInPolyTime ea eb f) : + Label h → TM2.Stmt (Alphabet h) (Label h) (State h) + | .inl l => MachineEmbedding.statement (some (.inr 3)) (h.tm.m l) + | .inr i => + if i=0 then + .pop (.inr 0) (fun s b => (s.1,b)) + (.branch (fun s => s.2.getD false) + (.pop (.inr 0) (fun s _ => s) + (.push (.inr 1) (fun _ => true) (.goto fun _ => .inr 0))) + (.load (fun s => (s.1,none)) (.goto fun _ => .inr 1))) + else if i=1 then + QuantumBitTransfer.loop (.inr 0) (.inr 2) id id (.inr 1) (some (.inr 2)) + else if i=2 then + QuantumBitTransfer.loop (.inr 2) (.inl h.tm.k₀) id h.inputAlphabet.invFun + (.inr 2) (some (.inl h.tm.main)) + else if i=3 then + QuantumBitTransfer.loop (.inl h.tm.k₁) (.inr 2) h.outputAlphabet id + (.inr 3) (some (.inr 4)) + else if i=4 then + QuantumBitTransfer.loop (.inr 2) (.inr 0) id id (.inr 4) (some (.inr 5)) + else if i=5 then + .push (.inr 0) (fun _ => false) + (.load (fun s => (s.1,none)) (.goto fun _ => .inr 6)) + else + .pop (.inr 1) (fun s b => (s.1,b)) + (.branch (fun s => s.2.isSome) + (.push (.inr 0) (fun _ => true) + (.push (.inr 0) (fun _ => true) (.goto fun _ => .inr 6))) + (.load (fun _ => (h.tm.initialState,none)) .halt)) + +def machine (h : TM2ComputableInPolyTime ea eb f) : FinTM2 where + K := Tape h + kFin := by letI := h.tm.kFin; exact inferInstance + k₀ := .inr 0 + k₁ := .inr 0 + Γ := Alphabet h + Λ := Label h + ΛFin := by letI := h.tm.ΛFin; exact inferInstance + main := .inr 0 + σ := State h + σFin := by letI := h.tm.σFin; exact inferInstance + initialState := (h.tm.initialState,none) + Γk₀Fin := inferInstanceAs (Fintype Bool) + m := program h + +def extraTapes (input saved temp : List Bool) : Fin 3 → List Bool := + fun i => if i=0 then input else if i=1 then saved else temp + +def tapes (h : TM2ComputableInPolyTime ea eb f) (source : ∀ k, List (h.tm.Γ k)) + (input saved temp : List Bool) : ∀ k, List (Alphabet h k) := + MachineEmbedding.tapes source (extraTapes input saved temp) + +def configuration (h : TM2ComputableInPolyTime ea eb f) (label : Option (Label h)) + (state : h.tm.σ) (r : Option Bool) (source : ∀ k, List (h.tm.Γ k)) + (input saved temp : List Bool) : (machine h).Cfg := + ⟨label,(state,r),tapes h source input saved temp⟩ + +def next (h : TM2ComputableInPolyTime ea eb f) (c : Option (machine h).Cfg) := + c.bind (machine h).step + +theorem embedded_program (h : TM2ComputableInPolyTime ea eb f) : + program h = MachineEmbedding.program (some (.inr 3)) h.tm.m + (fun i => program h (.inr i)) := by + funext l + cases l <;> rfl + +def source_execution (h : TM2ComputableInPolyTime ea eb f) (b : ℕ) (x : α) : + StateTransition.EvalsToInTime (machine h).step + (MachineEmbedding.configuration (some (.inr 3)) (none : Option Bool) + (extraTapes [] (unaryCode b) []) + (initList h.tm ((ea x).map h.inputAlphabet.invFun))) + (some (MachineEmbedding.configuration (some (.inr 3)) (none : Option Bool) + (extraTapes [] (unaryCode b) []) + (haltList h.tm ((eb (f x)).map h.outputAlphabet.invFun)))) + (h.time.eval (ea x).length) := by + have hh := MachineComposition.embeddedExecution (some (Sum.inr (3 : Fin 7))) + (none : Option Bool) (extraTapes [] (unaryCode b) []) h.tm.m + (fun i => program h (.inr i)) (h.outputsFun x) + rw [← embedded_program h] at hh + exact hh + +end ContinuumCoulomb.QuantumUnaryPrefix + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryPrefixCertificate.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryPrefixCertificate.lean new file mode 100644 index 0000000000000000000000000000000000000000..016e4d7d659894d1f6178d072ea3f4955341f1b2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryPrefixCertificate.lean @@ -0,0 +1,144 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnaryPrefixTransfers + +namespace OAI + +/-! Polynomial time for retaining a unary size certificate around an arbitrary +Boolean-input/Boolean-output TM2 computation. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumUnaryPrefix +open Turing ExactQuantumFactoring.BitStackProgram +open MinUncutGames.Foundations.Complexity + +variable {α β : Type} {ea : α → List Bool} {eb : β → List Bool} {f : α → β} + +theorem initial_eq (h : TM2ComputableInPolyTime ea eb f) (b : ℕ) (xs : List Bool) : + initList (machine h) (pairBits (unaryCode b) xs)= + configuration h (some (.inr 0)) h.tm.initialState none + (fun _ => []) (pairBits (unaryCode b) xs) [] [] := by + classical + change TM2.Cfg.mk _ _ _=TM2.Cfg.mk _ _ _ + congr 1 + funext k + cases k with + | inl k => simp [machine,tapes,MachineEmbedding.tapes] + | inr k => + fin_cases k + · simp [machine,tapes,MachineEmbedding.tapes,extraTapes] + rfl + · simp [machine,tapes,MachineEmbedding.tapes,extraTapes] + · simp [machine,tapes,MachineEmbedding.tapes,extraTapes] + +theorem final_eq (h : TM2ComputableInPolyTime ea eb f) (b : ℕ) (ys : List Bool) : + haltList (machine h) (pairBits (unaryCode b) ys)= + configuration h none h.tm.initialState none + (fun _ => []) (pairBits (unaryCode b) ys) [] [] := by + classical + change TM2.Cfg.mk _ _ _=TM2.Cfg.mk _ _ _ + congr 1 + funext k + cases k with + | inl k => simp [machine,tapes,MachineEmbedding.tapes] + | inr k => + fin_cases k + · simp [machine,tapes,MachineEmbedding.tapes,extraTapes] + rfl + · simp [machine,tapes,MachineEmbedding.tapes,extraTapes] + · simp [machine,tapes,MachineEmbedding.tapes,extraTapes] + +def parse_run (h : TM2ComputableInPolyTime ea eb f) (b : ℕ) (xs : List Bool) : + StateTransition.EvalsToInTime (machine h).step + (configuration h (some (.inr 0)) h.tm.initialState none + (fun _ => []) (pairBits (unaryCode b) xs) [] []) + (some (configuration h (some (.inr 1)) h.tm.initialState none + (fun _ => []) xs (unaryCode b) [])) (b+1) where + steps := b+1 + evals_in_steps := by + change (next h)^[b+1] _=_ + simpa only [unaryCode,List.replicate_zero,Nat.zero_add] using parse_steps h b 0 xs none + steps_le_m := le_rfl + +def delimiter_run (h : TM2ComputableInPolyTime ea eb f) (b : ℕ) (ys : List Bool) : + StateTransition.EvalsToInTime (machine h).step + (configuration h (some (.inr 5)) h.tm.initialState none + (fun _ => []) ys (unaryCode b) []) + (some (configuration h (some (.inr 6)) h.tm.initialState none + (fun _ => []) (pairBits (unaryCode 0) ys) (unaryCode b) [])) 1 where + steps := 1 + evals_in_steps := by + change (next h)^[1] _=_ + simpa only [Function.iterate_one,next_some] using emit_delimiter h b ys + steps_le_m := le_rfl + +def emit_run (h : TM2ComputableInPolyTime ea eb f) (b : ℕ) (ys : List Bool) : + StateTransition.EvalsToInTime (machine h).step + (configuration h (some (.inr 6)) h.tm.initialState none + (fun _ => []) (pairBits (unaryCode 0) ys) (unaryCode b) []) + (some (configuration h none h.tm.initialState none + (fun _ => []) (pairBits (unaryCode b) ys) [] [])) (b+1) where + steps := b+1 + evals_in_steps := by + change (next h)^[b+1] _=_ + simpa only [unaryCode,List.replicate_zero,Nat.zero_add] using emit_steps h b 0 ys none + steps_le_m := le_rfl + +def execution (h : TM2ComputableInPolyTime ea eb f) (b : ℕ) (x : α) : + TM2OutputsInTime (machine h) (pairBits (unaryCode b) (ea x)) + (some (pairBits (unaryCode b) (eb (f x)))) + (h.time.eval (ea x).length+2*b+2*(ea x).length+2*(eb (f x)).length+7) := by + let r₁ := StateTransition.EvalsToInTime.trans _ _ _ _ _ _ + (parse_run h b (ea x)) (input_reverse h b (ea x)) + let r₂ := StateTransition.EvalsToInTime.trans _ _ _ _ _ _ r₁ (input_restore h b (ea x)) + let r₃ := StateTransition.EvalsToInTime.trans _ _ _ _ _ _ r₂ (source_execution h b x) + let r₄ := StateTransition.EvalsToInTime.trans _ _ _ _ _ _ r₃ (output_reverse h b (eb (f x))) + let r₅ := StateTransition.EvalsToInTime.trans _ _ _ _ _ _ r₄ (output_restore h b (eb (f x))) + let r₆ := StateTransition.EvalsToInTime.trans _ _ _ _ _ _ r₅ (delimiter_run h b (eb (f x))) + let r₇ := StateTransition.EvalsToInTime.trans _ _ _ _ _ _ r₆ (emit_run h b (eb (f x))) + change StateTransition.EvalsToInTime (machine h).step + (initList (machine h) (pairBits (unaryCode b) (ea x))) + (some (haltList (machine h) (pairBits (unaryCode b) (eb (f x))))) _ + rw [initial_eq,final_eq] + refine ⟨r₇.toEvalsTo,?_⟩ + have hr := r₇.steps_le_m + exact hr.trans (by omega) + +def time (h : TM2ComputableInPolyTime ea eb f) : Polynomial ℕ := + Polynomial.C (1+2*TM2Size.programPushes h.tm)*h.time+6*Polynomial.X+7 + +theorem execution_bound (h : TM2ComputableInPolyTime ea eb f) (b : ℕ) (x : α) : + h.time.eval (ea x).length+2*b+2*(ea x).length+2*(eb (f x)).length+7 ≤ + (time h).eval (pairBits (unaryCode b) (ea x)).length := by + have hl : (pairBits (unaryCode b) (ea x)).length=2*b+1+(ea x).length := by + simp [pairBits,quoteBits_length,unaryCode] + have hm := MachineComposition.natPolynomial_eval_mono h.time + (show (ea x).length ≤ (pairBits (unaryCode b) (ea x)).length by omega) + have ho := TM2Size.output_length h x + simp only [time,Polynomial.eval_add,Polynomial.eval_mul,Polynomial.eval_C, + Polynomial.eval_X,Polynomial.eval_ofNat] + nlinarith + +def computable (h : TM2ComputableInPolyTime ea eb f) : + TM2ComputableInPolyTime (prodCode unaryCode ea) (prodCode unaryCode eb) + (fun x : ℕ × α => (x.1,f x.2)) where + tm := machine h + inputAlphabet := Equiv.refl Bool + outputAlphabet := Equiv.refl Bool + time := time h + outputsFun x := by + have hr := execution h x.1 x.2 + have run : TM2OutputsInTime (machine h) + (pairBits (unaryCode x.1) (ea x.2)) + (some (pairBits (unaryCode x.1) (eb (f x.2)))) + ((time h).eval (pairBits (unaryCode x.1) (ea x.2)).length) := + ⟨hr.toEvalsTo,hr.steps_le_m.trans (execution_bound h x.1 x.2)⟩ + convert run using 1 + congr 1 + · exact List.map_id _ + · congr 1 + exact List.map_id _ + +end ContinuumCoulomb.QuantumUnaryPrefix + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryPrefixRun.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryPrefixRun.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d595ec54112452a9e0e62d34c5dc0d676c1127f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryPrefixRun.lean @@ -0,0 +1,160 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnaryPrefix + +namespace OAI + +/-! Exact prefix parsing and emission for the verifier wrapper. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumUnaryPrefix +open Turing ExactQuantumFactoring.BitStackProgram +open MinUncutGames.Foundations.Complexity + +variable {α β : Type} {ea : α → List Bool} {eb : β → List Bool} {f : α → β} + +@[simp] theorem next_some (h : TM2ComputableInPolyTime ea eb f) (c : (machine h).Cfg) : + next h (some c)=(machine h).step c := rfl + +@[simp] theorem tapes_input (h : TM2ComputableInPolyTime ea eb f) + (s : ∀ k, List (h.tm.Γ k)) (xs bs ts : List Bool) : + tapes h s xs bs ts (.inr 0)=xs := rfl + +@[simp] theorem tapes_saved (h : TM2ComputableInPolyTime ea eb f) + (s : ∀ k, List (h.tm.Γ k)) (xs bs ts : List Bool) : + tapes h s xs bs ts (.inr 1)=bs := rfl + +@[simp] theorem tapes_temp (h : TM2ComputableInPolyTime ea eb f) + (s : ∀ k, List (h.tm.Γ k)) (xs bs ts : List Bool) : + tapes h s xs bs ts (.inr 2)=ts := rfl + +@[simp] theorem tapes_source (h : TM2ComputableInPolyTime ea eb f) + (s : ∀ k, List (h.tm.Γ k)) (xs bs ts : List Bool) (k : h.tm.K) : + tapes h s xs bs ts (.inl k)=s k := rfl + +@[simp] theorem update_input (h : TM2ComputableInPolyTime ea eb f) + (s : ∀ k, List (h.tm.Γ k)) (xs bs ts ys : List Bool) : + Function.update (tapes h s xs bs ts) (.inr 0) ys=tapes h s ys bs ts := by + classical + funext k + cases k with + | inl k => simp [tapes,MachineEmbedding.tapes] + | inr k => fin_cases k <;> simp [tapes,MachineEmbedding.tapes,extraTapes] + +@[simp] theorem update_saved (h : TM2ComputableInPolyTime ea eb f) + (s : ∀ k, List (h.tm.Γ k)) (xs bs ts ys : List Bool) : + Function.update (tapes h s xs bs ts) (.inr 1) ys=tapes h s xs ys ts := by + classical + funext k + cases k with + | inl k => simp [tapes,MachineEmbedding.tapes] + | inr k => fin_cases k <;> simp [tapes,MachineEmbedding.tapes,extraTapes] + +@[simp] theorem update_temp (h : TM2ComputableInPolyTime ea eb f) + (s : ∀ k, List (h.tm.Γ k)) (xs bs ts ys : List Bool) : + Function.update (tapes h s xs bs ts) (.inr 2) ys=tapes h s xs bs ys := by + classical + funext k + cases k with + | inl k => simp [tapes,MachineEmbedding.tapes] + | inr k => fin_cases k <;> simp [tapes,MachineEmbedding.tapes,extraTapes] + +theorem parse_cons (h : TM2ComputableInPolyTime ea eb f) (n k : ℕ) + (xs : List Bool) (r : Option Bool) : + (machine h).step (configuration h (some (.inr 0)) h.tm.initialState r + (fun _ => []) (pairBits (unaryCode (n+1)) xs) (unaryCode k) [])= + some (configuration h (some (.inr 0)) h.tm.initialState (some true) + (fun _ => []) (pairBits (unaryCode n) xs) (unaryCode (k+1)) []) := by + simp [FinTM2.step,TM2.step,machine,configuration,program,TM2.stepAux, + pairBits,unaryCode,List.replicate_succ,quoteBits_cons] + congr 2 + funext j + cases j with + | inl j => simp [Function.update,tapes,MachineEmbedding.tapes] + | inr j => fin_cases j <;> simp [Function.update,tapes,MachineEmbedding.tapes,extraTapes] + +theorem parse_zero (h : TM2ComputableInPolyTime ea eb f) (k : ℕ) + (xs : List Bool) (r : Option Bool) : + (machine h).step (configuration h (some (.inr 0)) h.tm.initialState r + (fun _ => []) (pairBits (unaryCode 0) xs) (unaryCode k) [])= + some (configuration h (some (.inr 1)) h.tm.initialState none + (fun _ => []) xs (unaryCode k) []) := by + simp [FinTM2.step,TM2.step,machine,configuration,program,TM2.stepAux, + pairBits,unaryCode] + congr 2 + funext j + cases j with + | inl j => simp [Function.update,tapes,MachineEmbedding.tapes] + | inr j => fin_cases j <;> simp [Function.update,tapes,MachineEmbedding.tapes,extraTapes] + +theorem parse_steps (h : TM2ComputableInPolyTime ea eb f) (n k : ℕ) + (xs : List Bool) (r : Option Bool) : + (next h)^[n+1] (some (configuration h (some (.inr 0)) h.tm.initialState r + (fun _ => []) (pairBits (unaryCode n) xs) (unaryCode k) []))= + some (configuration h (some (.inr 1)) h.tm.initialState none + (fun _ => []) xs (unaryCode (k+n)) []) := by + induction n generalizing k r with + | zero => simpa only [Nat.add_zero,Nat.zero_add,Function.iterate_one,next_some] using + parse_zero h k xs r + | succ n ih => + rw [Function.iterate_succ_apply] + rw [next_some,parse_cons,ih] + rw [show k+1+n = k+(n+1) by omega] + +theorem emit_delimiter (h : TM2ComputableInPolyTime ea eb f) (n : ℕ) + (ys : List Bool) : + (machine h).step (configuration h (some (.inr 5)) h.tm.initialState none + (fun _ => []) ys (unaryCode n) [])= + some (configuration h (some (.inr 6)) h.tm.initialState none + (fun _ => []) (pairBits (unaryCode 0) ys) (unaryCode n) []) := by + simp [FinTM2.step,TM2.step,machine,configuration,program,TM2.stepAux,pairBits,unaryCode] + congr 2 + funext j + cases j with + | inl j => simp [Function.update,tapes,MachineEmbedding.tapes] + | inr j => fin_cases j <;> simp [Function.update,tapes,MachineEmbedding.tapes,extraTapes] + +theorem emit_cons (h : TM2ComputableInPolyTime ea eb f) (n k : ℕ) + (ys : List Bool) (r : Option Bool) : + (machine h).step (configuration h (some (.inr 6)) h.tm.initialState r + (fun _ => []) (pairBits (unaryCode k) ys) (unaryCode (n+1)) [])= + some (configuration h (some (.inr 6)) h.tm.initialState (some true) + (fun _ => []) (pairBits (unaryCode (k+1)) ys) (unaryCode n) []) := by + simp [FinTM2.step,TM2.step,machine,configuration,program,TM2.stepAux, + pairBits,unaryCode,List.replicate_succ,quoteBits_cons] + congr 2 + funext j + cases j with + | inl j => simp [Function.update,tapes,MachineEmbedding.tapes] + | inr j => fin_cases j <;> simp [Function.update,tapes,MachineEmbedding.tapes,extraTapes] + +theorem emit_zero (h : TM2ComputableInPolyTime ea eb f) (k : ℕ) + (ys : List Bool) (r : Option Bool) : + (machine h).step (configuration h (some (.inr 6)) h.tm.initialState r + (fun _ => []) (pairBits (unaryCode k) ys) (unaryCode 0) [])= + some (configuration h none h.tm.initialState none + (fun _ => []) (pairBits (unaryCode k) ys) [] []) := by + simp [FinTM2.step,TM2.step,machine,configuration,program,TM2.stepAux,unaryCode] + congr 2 + funext j + cases j with + | inl j => simp [Function.update,tapes,MachineEmbedding.tapes] + | inr j => fin_cases j <;> simp [Function.update,tapes,MachineEmbedding.tapes,extraTapes] + +theorem emit_steps (h : TM2ComputableInPolyTime ea eb f) (n k : ℕ) + (ys : List Bool) (r : Option Bool) : + (next h)^[n+1] (some (configuration h (some (.inr 6)) h.tm.initialState r + (fun _ => []) (pairBits (unaryCode k) ys) (unaryCode n) []))= + some (configuration h none h.tm.initialState none + (fun _ => []) (pairBits (unaryCode (k+n)) ys) [] []) := by + induction n generalizing k r with + | zero => simpa only [Nat.add_zero,Nat.zero_add,Function.iterate_one,next_some] using + emit_zero h k ys r + | succ n ih => + rw [Function.iterate_succ_apply] + rw [next_some,emit_cons,ih] + rw [show k+1+n = k+(n+1) by omega] + +end ContinuumCoulomb.QuantumUnaryPrefix + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryPrefixTransfers.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryPrefixTransfers.lean new file mode 100644 index 0000000000000000000000000000000000000000..f72bf820f272a8e30b86cd9bc05d8b26b290301f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnaryPrefixTransfers.lean @@ -0,0 +1,111 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnaryPrefixRun + +namespace OAI + +/-! The four word transfers surrounding the original verifier computation. +The saved unary prefix is untouched throughout these phases. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumUnaryPrefix +open Turing ExactQuantumFactoring.BitStackProgram +open MinUncutGames.Foundations.Complexity +open MinUncutGames.Reduction.MachineTransfer + +variable {α β : Type} {ea : α → List Bool} {eb : β → List Bool} {f : α → β} + +@[simp] theorem update_source (h : TM2ComputableInPolyTime ea eb f) + (s : ∀ k, List (h.tm.Γ k)) (xs bs ts : List Bool) (k : h.tm.K) + (ys : List (h.tm.Γ k)) : + Function.update (tapes h s xs bs ts) (.inl k) ys= + tapes h (Function.update s k ys) xs bs ts := by + classical + funext j + cases j with + | inl j => + by_cases hj : j=k + · subst j; simp [tapes,MachineEmbedding.tapes,Function.update] + · simp [tapes,MachineEmbedding.tapes,Function.update,hj] + | inr j => simp [tapes,MachineEmbedding.tapes,Function.update] + +def input_reverse (h : TM2ComputableInPolyTime ea eb f) (b : ℕ) (xs : List Bool) : + StateTransition.EvalsToInTime (machine h).step + (configuration h (some (.inr 1)) h.tm.initialState none + (fun _ => []) xs (unaryCode b) []) + (some (configuration h (some (.inr 2)) h.tm.initialState none + (fun _ => []) [] (unaryCode b) xs.reverse)) (xs.length+1) := by + have hr := QuantumBitTransfer.transfer (Sum.inr (0 : Fin 3) : Tape h) + (.inr 2) (by simp) id id (.inr 1) (some (.inr 2)) (program h) rfl + (tapes h (fun _ => []) xs (unaryCode b) []) h.tm.initialState none + simp only [tapes_input,tapes_temp,tapesAt,update_input,update_temp, + Function.comp_def,id_eq,List.map_id',List.append_nil] at hr + exact hr + +def input_restore (h : TM2ComputableInPolyTime ea eb f) (b : ℕ) (xs : List Bool) : + StateTransition.EvalsToInTime (machine h).step + (configuration h (some (.inr 2)) h.tm.initialState none + (fun _ => []) [] (unaryCode b) xs.reverse) + (some (MachineEmbedding.configuration (some (Sum.inr (3 : Fin 7))) (none : Option Bool) + (extraTapes [] (unaryCode b) []) + (initList h.tm (xs.map h.inputAlphabet.invFun)))) (xs.length+1) := by + have hr := QuantumBitTransfer.transfer (Sum.inr (2 : Fin 3) : Tape h) + (.inl h.tm.k₀) (by simp) id h.inputAlphabet.invFun (.inr 2) (some (.inl h.tm.main)) + (program h) rfl (tapes h (fun _ => []) [] (unaryCode b) xs.reverse) h.tm.initialState none + simp only [tapes_temp,tapes_source,tapesAt,update_temp,update_source, + Function.comp_def,id_eq,List.reverse_reverse,List.append_nil,List.length_reverse] at hr + have hs : Function.update (fun k => ([] : List (h.tm.Γ k))) h.tm.k₀ + (xs.map h.inputAlphabet.invFun) = (initList h.tm (xs.map h.inputAlphabet.invFun)).stk := by + funext k + by_cases hk : k=h.tm.k₀ + · subst k + simp [initList] + · simp [initList,Function.update,hk] + rw [hs] at hr + exact hr + +def output_reverse (h : TM2ComputableInPolyTime ea eb f) (b : ℕ) (ys : List Bool) : + StateTransition.EvalsToInTime (machine h).step + (MachineEmbedding.configuration (some (Sum.inr (3 : Fin 7))) (none : Option Bool) + (extraTapes [] (unaryCode b) []) + (haltList h.tm (ys.map h.outputAlphabet.invFun))) + (some (configuration h (some (.inr 4)) h.tm.initialState none + (fun _ => []) [] (unaryCode b) ys.reverse)) (ys.length+1) := by + have hr := QuantumBitTransfer.transfer (Sum.inl h.tm.k₁ : Tape h) + (.inr 2) (by simp) h.outputAlphabet id (.inr 3) (some (.inr 4)) (program h) rfl + (tapes h (haltList h.tm (ys.map h.outputAlphabet.invFun)).stk [] (unaryCode b) []) + h.tm.initialState none + have hs : Function.update (haltList h.tm (ys.map h.outputAlphabet.invFun)).stk h.tm.k₁ []= + fun k => ([] : List (h.tm.Γ k)) := by + funext k + by_cases hk : k=h.tm.k₁ + · subst k + simp + · simp [haltList,Function.update,hk] + have ht : (haltList h.tm (ys.map h.outputAlphabet.invFun)).stk h.tm.k₁ = + ys.map h.outputAlphabet.invFun := by simp [haltList] + simp only [tapes_source,tapes_temp,tapesAt,update_source,update_temp,ht,hs, + List.length_map,Function.comp_def,id_eq,List.map_reverse,List.map_map, + List.append_nil] at hr + have he : (fun x => h.outputAlphabet (h.outputAlphabet.invFun x)) = id := + funext h.outputAlphabet.right_inv + rw [he,List.map_id] at hr + exact hr + +def output_restore (h : TM2ComputableInPolyTime ea eb f) (b : ℕ) (ys : List Bool) : + StateTransition.EvalsToInTime (machine h).step + (configuration h (some (.inr 4)) h.tm.initialState none + (fun _ => []) [] (unaryCode b) ys.reverse) + (some (configuration h (some (.inr 5)) h.tm.initialState none + (fun _ => []) ys (unaryCode b) [])) (ys.length+1) := by + have hr := QuantumBitTransfer.transfer (Sum.inr (2 : Fin 3) : Tape h) + (.inr 0) (by simp) id id (.inr 4) (some (.inr 5)) (program h) rfl + (tapes h (fun _ => []) [] (unaryCode b) ys.reverse) h.tm.initialState none + simp only [tapes_input,tapes_temp,tapesAt,update_input,update_temp, + Function.comp_def,id_eq,List.map_id',List.append_nil,List.length_reverse, + List.reverse_reverse] at hr + exact hr + +end ContinuumCoulomb.QuantumUnaryPrefix + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnarySoundness.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnarySoundness.lean new file mode 100644 index 0000000000000000000000000000000000000000..880d47f20fc14fefb2a0301aa0f0ba4ad70ecd41 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnarySoundness.lean @@ -0,0 +1,46 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnaryEnergy + +namespace OAI + +/-! Soundness on the entire unary-clock Hilbert space, including every +invalid clock configuration. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators + +theorem qmaUnaryInvalidMass_nonneg (c : QMACircuit) (u : QMAUnaryBasis c → ℂ) : + 0 ≤ qmaUnaryInvalidMass c u := by + apply Finset.sum_nonneg + intro s _ + split + · exact le_rfl + · exact Finset.sum_nonneg (fun a _ => Complex.normSq_nonneg _) + +theorem qmaUnaryEnergy_sound (c : QMACircuit) (hc : c.WellFormed) + (hsound : ∀ psi : EuclideanSpace ℂ (SourceSpinBasis c.witness), + ‖psi‖ = 1 → qmaAcceptance c hc psi ≤ 1/3) + (u : QMAUnaryBasis c → ℂ) : + 2*qmaUnaryMass c u ≤ 5*(c.gates.length+1:ℝ)*qmaUnaryEnergy c u := by + have hs := qmaCountedHistoryHamiltonian_sound c hc hsound + (WithLp.toLp 2 (qmaUnaryRestrict c u)) + simp only [EuclideanSpace.norm_sq_eq,Complex.sq_norm] at hs + have hb := qmaUnaryInvalidMass_le c u + have hn := qmaUnaryInvalidMass_nonneg c u + have hcoef : (2:ℝ) ≤ 5*(c.gates.length+1:ℝ) := by + have h := Nat.cast_nonneg (α := ℝ) c.gates.length + nlinarith + have hb' : 2*qmaUnaryInvalidMass c u ≤ + 5*(c.gates.length+1:ℝ)*qmaUnaryClockEnergy c u := + (mul_le_mul_of_nonneg_right hcoef hn).trans + (mul_le_mul_of_nonneg_left hb (by positivity)) + have he := mul_le_mul_of_nonneg_left (qmaUnaryEnergy_restriction c u) + (by positivity : 0 ≤ 5*(c.gates.length+1:ℝ)) + rw [qmaUnaryMass_split] + nlinarith + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnarySpectrum.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnarySpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..fc65593f95c7eca4464e4cdd83c50317cb3d53df --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnarySpectrum.lean @@ -0,0 +1,57 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnaryMatrix + +namespace OAI + +/-! The full qubit-space history Hamiltonian has a strict inverse-polynomial +promise gap. No restriction to the valid clock subspace is assumed. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped BigOperators + +theorem qmaUnaryMass_norm (c : QMACircuit) (u : EuclideanSpace ℂ (QMAUnaryBasis c)) : + qmaUnaryMass c (fun p => u p) = ‖u‖^2 := by + simp only [qmaUnaryMass,EuclideanSpace.norm_sq_eq,Complex.sq_norm] + +theorem qmaUnaryHamiltonian_sound (c : QMACircuit) (hc : c.WellFormed) + (hsound : ∀ psi : EuclideanSpace ℂ (SourceSpinBasis c.witness), + ‖psi‖ = 1 → qmaAcceptance c hc psi ≤ 1/3) + (u : EuclideanSpace ℂ (QMAUnaryBasis c)) : + 2*‖u‖^2 ≤ 5*(c.gates.length+1:ℝ)* + qmaQuadratic (qmaUnaryHamiltonian c) (fun p => u p) := by + rw [qmaUnaryHamiltonian_form,←qmaUnaryMass_norm] + exact qmaUnaryEnergy_sound c hc hsound (fun p => u p) + +theorem qmaUnaryHamiltonian_accepting (c : QMACircuit) (hc : c.WellFormed) + (psi : EuclideanSpace ℂ (SourceSpinBasis c.witness)) (hpsi : ‖psi‖ = 1) + (hacc : 2/3 ≤ qmaAcceptance c hc psi) : + ∃ u : EuclideanSpace ℂ (QMAUnaryBasis c), ‖u‖ = 1 ∧ + 3*(c.gates.length+1:ℝ)*qmaQuadratic (qmaUnaryHamiltonian c) (fun p => u p) ≤ 1 := by + obtain ⟨v,hv,he⟩ := qmaCountedHistoryHamiltonian_accepting c hc psi hpsi hacc + let u : EuclideanSpace ℂ (QMAUnaryBasis c) := WithLp.toLp 2 (qmaUnaryExtend c (fun p => v p)) + have hu : ‖u‖ = 1 := by + apply (sq_eq_sq₀ (norm_nonneg _) (by norm_num : (0:ℝ) ≤ 1)).mp + rw [←qmaUnaryMass_norm] + change qmaUnaryMass c (qmaUnaryExtend c (fun p => v p)) = 1^2 + rw [qmaUnaryExtend_mass] + have hv2 : ‖v‖^2 = (1:ℝ)^2 := by rw [hv] + rw [EuclideanSpace.norm_sq_eq] at hv2 + simpa only [Complex.sq_norm] using hv2 + refine ⟨u,hu,?_⟩ + rw [qmaUnaryHamiltonian_form] + change 3*(c.gates.length+1:ℝ)*qmaUnaryEnergy c (qmaUnaryExtend c (fun p => v p)) ≤ 1 + rw [qmaUnaryExtend_energy] + exact he + +theorem qmaUnaryBasis_card (c : QMACircuit) : + Fintype.card (QMAUnaryBasis c) = 2^(c.gates.length+c.work+3) := by + simp only [QMAUnaryBasis,SourceSpinBasis,Fintype.card_prod,Fintype.card_fun,Fintype.card_fin] + rw [←pow_add] + congr 1 + omega + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnitaryGround.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnitaryGround.lean new file mode 100644 index 0000000000000000000000000000000000000000..b617b3bfc070f0d299f80e59fbffe9b4ed67d0ff --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUnitaryGround.lean @@ -0,0 +1,43 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGroundComparison + +namespace OAI + +/-! Exact unitary changes of basis preserve the actual finite ground energy. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped InnerProductSpace +variable {σ : Type*} [Fintype σ] [DecidableEq σ] + +theorem qmaUnitary_sandwich_form (U H : Matrix σ σ ℂ) (x : EuclideanSpace ℂ σ) : + ⟪x,spinMatrixOperator (U.conjTranspose*H*U) x⟫_ℝ = + ⟪spinMatrixOperator U x,spinMatrixOperator H (spinMatrixOperator U x)⟫_ℝ := by + simpa only [qmaQuadratic_operator,qmaMatrixOperator_square] using qmaQuadratic_sandwich U H x + +theorem qmaNormalizedBottom_unitary (U H : Matrix σ σ ℂ) + (hU : U.conjTranspose*U = 1) (hU' : U*U.conjTranspose = 1) : + MediatorGraph.normalizedBottom (U.conjTranspose*H*U) = MediatorGraph.normalizedBottom H := by + have hnorm := spinMatrixOperator_unitary_norm_map U hU + have hnorm' := spinMatrixOperator_unitary_norm_map U.conjTranspose + (by simpa only [Matrix.conjTranspose_conjTranspose] using hU') + have hinv (x : EuclideanSpace ℂ σ) : + spinMatrixOperator U (spinMatrixOperator U.conjTranspose x) = x := by + have hm := congrArg (fun M : Matrix σ σ ℂ => spinMatrixOperator M x) hU' + simpa only [spinMatrixOperator_mul,ContinuousLinearMap.comp_apply, + spinMatrixOperator_one,one_apply_eq_self] using hm + unfold MediatorGraph.normalizedBottom + congr 1 + ext e + constructor + · rintro ⟨x,hx,rfl⟩ + exact ⟨spinMatrixOperator U x,(hnorm x).trans hx,qmaUnitary_sandwich_form U H x⟩ + · rintro ⟨x,hx,rfl⟩ + refine ⟨spinMatrixOperator U.conjTranspose x,(hnorm' x).trans hx,?_⟩ + rw [qmaUnitary_sandwich_form,hinv] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUntouchedInput.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUntouchedInput.lean new file mode 100644 index 0000000000000000000000000000000000000000..399739c343d449de429bda842172120b2f262c77 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumUntouchedInput.lean @@ -0,0 +1,88 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumWireRelabel +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGateLocality + +namespace OAI + +/-! A qubit's initialization check can be placed immediately before its first gate. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +theorem QMALocalOn.entry_zero_of_outside {n : ℕ} {S : Finset (Fin n)} + {M : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ} + (hM : QMALocalOn S M) {i : Fin n} (hi : i ∉ S) + (s t : SourceSpinBasis n) (hst : s i ≠ t i) : M s t = 0 := by + obtain ⟨A,rfl⟩ := hM + rw [qmaLocalLift_apply] + have h : (fun k : {k // k ∉ S} => s k.val) ≠ (fun k : {k // k ∉ S} => t k.val) := by + intro he + exact hst (congrFun he ⟨i,hi⟩) + simp [h] + +theorem qmaLocal_mask_commute {n : ℕ} {S : Finset (Fin n)} + {M : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ} + (hM : QMALocalOn S M) {i : Fin n} (hi : i ∉ S) (P : Fin 2 → Prop) + (u : EuclideanSpace ℂ (SourceSpinBasis n)) : + qmaMask (fun s => P (s i)) (qmaApplyMatrix M u) = + qmaApplyMatrix M (qmaMask (fun s => P (s i)) u) := by + ext s + change (if P (s i) then ∑ t, M s t*u t else 0) = + ∑ t, M s t*(if P (t i) then u t else 0) + by_cases hs : P (s i) + · rw [ite_eq_left hs] + apply Finset.sum_congr rfl + intro t _ + by_cases ht : P (t i) + · simp [ht] + · have he : s i ≠ t i := fun h => ht (h ▸ hs) + simp [ht,hM.entry_zero_of_outside hi s t he] + · rw [ite_eq_right hs] + symm + apply Finset.sum_eq_zero + intro t _ + by_cases ht : P (t i) + · have he : s i ≠ t i := fun h => hs (h ▸ ht) + simp [ht,hM.entry_zero_of_outside hi s t he] + · simp [ht] + +theorem qmaGateProduct_mask_commute (work : ℕ) (gs : List QMAGate) + (i : Fin (work+1)) (hi : ∀ g ∈ gs, i ∉ qmaGateSites work g) + (P : Fin 2 → Prop) (u : EuclideanSpace ℂ (SourceSpinBasis (work+1))) : + qmaMask (fun s => P (s i)) (qmaApplyMatrix (qmaGateProduct work gs) u) = + qmaApplyMatrix (qmaGateProduct work gs) (qmaMask (fun s => P (s i)) u) := by + induction gs using List.reverseRecOn with + | nil => simp [qmaGateProduct_nil] + | append_singleton gs g ih => + simp only [qmaGateProduct_append,qmaGateProduct_singleton,qmaApplyMatrix_mul] + rw [qmaLocal_mask_commute (qmaGateMatrix_local work g) + (hi g (by simp)) P,ih (fun g hg => hi g (by simp [hg]))] + +theorem qmaInputCheck_prefix_untouched (c : QMACircuit) (hc : c.WellFormed) + (i : Fin (c.work+1)) (t : ℕ) + (hi : ∀ g ∈ c.gates.take t, i ∉ qmaGateSites c.work g) + (u : EuclideanSpace ℂ (SourceSpinBasis (c.work+1))) : + ‖qmaMask (qmaInputCheck c i) (qmaApplyMatrix (qmaPrefixMatrix c t) u)‖ = + ‖qmaMask (qmaInputCheck c i) u‖ := by + have h := qmaGateProduct_mask_commute c.work (c.gates.take t) i hi + (fun b => c.witness ≤ i.val ∧ b ≠ 0) u + change qmaMask (qmaInputCheck c i) (qmaApplyMatrix (qmaPrefixMatrix c t) u) = + qmaApplyMatrix (qmaPrefixMatrix c t) (qmaMask (qmaInputCheck c i) u) at h + rw [h,qmaApplyMatrix_norm _ (qmaPrefixMatrix_gram c hc t)] + +theorem qmaDistributedHistoryEnergy_sound_untouched (c : QMACircuit) (hc : c.WellFormed) + (τ : Fin (c.work+1) → ℕ) (hτ : ∀ i, τ i ≤ c.gates.length) + (hi : ∀ i, ∀ g ∈ c.gates.take (τ i), i ∉ qmaGateSites c.work g) + (hsound : ∀ psi : EuclideanSpace ℂ (SourceSpinBasis c.witness), + ‖psi‖ = 1 → qmaAcceptance c hc psi ≤ 1/3) + (u : ℕ → EuclideanSpace ℂ (SourceSpinBasis (c.work+1))) : + 2*qmaHistoryMass c u ≤ 5*(c.gates.length+1:ℝ)*qmaDistributedHistoryEnergy c τ u := + qmaDistributedHistoryEnergy_sound c hc τ hτ + (fun i v => qmaInputCheck_prefix_untouched c hc i (τ i) (hi i) v) hsound u + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumVerifier.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumVerifier.lean new file mode 100644 index 0000000000000000000000000000000000000000..5807dc33dcb000b1eb90183e4abcaaa0a91b339f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumVerifier.lean @@ -0,0 +1,163 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.BinaryEncoding +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourcePauli +import OAI.MathematicalPhysics.ContinuumCoulomb.ManyBody.GlobalSinglet +import Mathlib.Computability.TuringMachine.Computable + +namespace OAI + +/-! The promise-QMA interface for the Heisenberg source. +The verifier uses the fixed H,T,CNOT gate set, complex quantum witnesses, +ancillas initialized to zero, one output measurement and a polynomial-time +TM2 circuit generator. There is no condition outside either promise set. -/ + +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker +open BinaryEncoding + +inductive QMAGate where + | hadamard (qubit : ℕ) + | phaseT (qubit : ℕ) + | controlledNot (control target : ℕ) + deriving DecidableEq, Repr + +def qmaGateEquiv : QMAGate ≃ ((ℕ ⊕ ℕ) ⊕ (ℕ × ℕ)) where + toFun + | .hadamard i => Sum.inl (Sum.inl i) + | .phaseT i => Sum.inl (Sum.inr i) + | .controlledNot i j => Sum.inr (i, j) + invFun + | Sum.inl (Sum.inl i) => .hadamard i + | Sum.inl (Sum.inr i) => .phaseT i + | Sum.inr (i, j) => .controlledNot i j + left_inv g := by cases g <;> rfl + right_inv g := by rcases g with (i | i) | ⟨i, j⟩ <;> rfl + +def qmaGateCodec : Codec QMAGate := BinaryEncoding.equiv + (BinaryEncoding.sum (BinaryEncoding.sum natural natural) (pair natural natural)) qmaGateEquiv + +structure QMACircuit where + /-- The circuit has work + 1 qubits; the final qubit is measured. -/ + work : ℕ + witness : ℕ + gates : List QMAGate + deriving DecidableEq, Repr + +def qmaCircuitEquiv : QMACircuit ≃ (ℕ × (ℕ × List QMAGate)) where + toFun c := (c.work, c.witness, c.gates) + invFun c := ⟨c.1, c.2.1, c.2.2⟩ + left_inv c := by cases c; rfl + right_inv c := by rcases c with ⟨n, w, gs⟩; rfl + +def qmaCircuitCodec : Codec QMACircuit := BinaryEncoding.equiv + (pair natural (pair natural (BinaryEncoding.list qmaGateCodec))) qmaCircuitEquiv + +def QMAGate.WellFormed (n : ℕ) : QMAGate → Prop + | .hadamard i => i < n + | .phaseT i => i < n + | .controlledNot i j => i < n ∧ j < n ∧ i ≠ j + +def QMACircuit.WellFormed (c : QMACircuit) : Prop := + c.witness ≤ c.work ∧ ∀ g ∈ c.gates, g.WellFormed (c.work + 1) + +noncomputable section + +/-- Exact algebraic Hadamard gate. -/ +def qmaHadamard : Matrix (Fin 2) (Fin 2) ℂ := + bellScale • !![1, 1; 1, -1] + +/-- T=diag(1,exp(i*pi/4)), written with its exact algebraic entries. -/ +def qmaPhaseT : Matrix (Fin 2) (Fin 2) ℂ := + !![1, 0; 0, bellScale * (1 + Complex.I)] + +def qmaQubit (work index : ℕ) : Fin (work + 1) := + ⟨index % (work + 1), Nat.mod_lt _ (Nat.succ_pos _)⟩ + +def qmaControlledNot (work : ℕ) (control target : Fin (work + 1)) + (s : SourceSpinBasis (work + 1)) : SourceSpinBasis (work + 1) := + fun i => if i = target ∧ s control = 1 then Equiv.swap (0 : Fin 2) 1 (s i) else s i + +def qmaGateMatrix (work : ℕ) : QMAGate → + Matrix (SourceSpinBasis (work + 1)) (SourceSpinBasis (work + 1)) ℂ + | .hadamard i => sourceTensor (work + 1) + (fun k => if k = qmaQubit work i then qmaHadamard else 1) + | .phaseT i => sourceTensor (work + 1) + (fun k => if k = qmaQubit work i then qmaPhaseT else 1) + | .controlledNot i j => fun s t => + if s = qmaControlledNot work (qmaQubit work i) (qmaQubit work j) t then 1 else 0 + +def qmaCircuitMatrix (c : QMACircuit) : + Matrix (SourceSpinBasis (c.work + 1)) (SourceSpinBasis (c.work + 1)) ℂ := + c.gates.foldl (fun M g => qmaGateMatrix c.work g * M) 1 + +/-- The witness occupies the first witness qubits; every remaining qubit, +including the measured final qubit, starts in the zero state. -/ +def qmaInitialState (c : QMACircuit) (hc : c.WellFormed) + (psi : EuclideanSpace ℂ (SourceSpinBasis c.witness)) : + SourceSpinBasis (c.work + 1) → ℂ := + fun s => if ∀ i : Fin (c.work + 1), c.witness ≤ i.val → s i = 0 then + psi (fun i => s ⟨i.val, lt_of_lt_of_le i.isLt (hc.1.trans (Nat.le_succ _))⟩) + else 0 + +/-- Born probability of measuring one on the output qubit. -/ +def qmaAcceptance (c : QMACircuit) (hc : c.WellFormed) + (psi : EuclideanSpace ℂ (SourceSpinBasis c.witness)) : ℝ := + ∑ s : SourceSpinBasis (c.work + 1), + if s (Fin.last c.work) = 1 then + Complex.normSq ((qmaCircuitMatrix c).mulVec (qmaInitialState c hc psi) s) else 0 + +structure QuantumVerifier where + generate : BitString → QMACircuit + uniform : Turing.TM2ComputableInPolyTime id qmaCircuitCodec.encode generate + size : Polynomial ℕ + size_bound : ∀ x, (generate x).work + (generate x).gates.length ≤ size.eval x.length + wellFormed : ∀ x, (generate x).WellFormed + +structure PromiseProblem (α : Type) where + yes : Set α + no : Set α + disjoint : Disjoint yes no + +section + +theorem inQMA_two_atLeastTwo : Nat.AtLeastTwo (1 + 1) := + @Nat.instAtLeastTwoHAddOfNat 1 (@Nat.instNeZeroSucc 0) + +theorem inQMA_three_atLeastTwo : Nat.AtLeastTwo (2 + 1) := + @Nat.instAtLeastTwoHAddOfNat 2 (@Nat.instNeZeroSucc 1) + +attribute [local instance] inQMA_two_atLeastTwo inQMA_three_atLeastTwo + +/-- Promise-QMA with completeness 2/3 and soundness 1/3. -/ +def InQMA (P : PromiseProblem BitString) : Prop := + ∃ V : QuantumVerifier, + (∀ x ∈ P.yes, ∃ psi : EuclideanSpace ℂ (SourceSpinBasis (V.generate x).witness), + ‖psi‖ = 1 ∧ 2 / 3 ≤ qmaAcceptance (V.generate x) (V.wellFormed x) psi) ∧ + (∀ x ∈ P.no, ∀ psi : EuclideanSpace ℂ (SourceSpinBasis (V.generate x).witness), + ‖psi‖ = 1 → qmaAcceptance (V.generate x) (V.wellFormed x) psi ≤ 1 / 3) + +end + +/-- Actual polynomial-time many-one reduction with both promise maps. -/ +structure PolynomialManyOne {α β : Type} (ea : α → BitString) (eb : β → BitString) + (P : PromiseProblem α) (Q : PromiseProblem β) where + map : α → β + polynomialTime : Turing.TM2ComputableInPolyTime ea eb map + maps_yes : ∀ x ∈ P.yes, map x ∈ Q.yes + maps_no : ∀ x ∈ P.no, map x ∈ Q.no + +def QMAHard {α : Type} (encoding : α → BitString) (Q : PromiseProblem α) : Prop := + ∀ P : PromiseProblem BitString, InQMA P → Nonempty (PolynomialManyOne id encoding P Q) + +/-- The machine-based definition includes the identity reduction. -/ +def PolynomialManyOne.refl {α : Type} (ea : α → BitString) (P : PromiseProblem α) : + PolynomialManyOne ea ea P P where + map := id + polynomialTime := Turing.idComputableInPolyTime ea + maps_yes _ h := h + maps_no _ h := h + +end +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWalkErasure.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWalkErasure.lean new file mode 100644 index 0000000000000000000000000000000000000000..72806eb8dffab0c9522f010d1f3533535fb256ce --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWalkErasure.lean @@ -0,0 +1,86 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBufferedPortChain +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFiniteMembership + +namespace OAI + +/-! The coarse route's library loop erasure is the explicit right-to-left +finite-list algorithm. This identifies the actual path data needed by the +literal spatial compiler. -/ + +noncomputable section +open scoped List +namespace ContinuumCoulomb.QuantumWalkErasure +open ExactQuantumFactoring.BitStackProgram + +variable {α : Type} [DecidableEq α] + +def step (a : α) (xs : List α) : List α := + if a ∈ xs then xs.drop (xs.idxOf a) else a::xs + +def erase (xs : List α) : List α := xs.foldr step [] + +@[simp] theorem erase_nil : erase ([] : List α) = [] := rfl +@[simp] theorem erase_cons (a : α) (xs : List α) : erase (a::xs) = step a (erase xs) := rfl + +theorem step_sublist (a : α) (xs : List α) : step a xs <+ a::xs := by + unfold step + split + · exact (List.drop_sublist _ _).trans (List.sublist_cons_self _ _) + · exact List.Sublist.refl _ + +theorem erase_sublist (xs : List α) : erase xs <+ xs := by + induction xs with + | nil => exact List.Sublist.refl _ + | cons a xs ih => + rw [erase_cons] + exact (step_sublist a (erase xs)).trans (ih.cons_cons a) + +omit [DecidableEq α] in +theorem listCode_length_sublist (ea : α → List Bool) {xs ys : List α} (h : xs <+ ys) : + (listCode ea xs).length ≤ (listCode ea ys).length := by + induction h with + | slnil => exact le_rfl + | cons a h ih => + rw [listCode_length_cons] + omega + | cons_cons a h ih => + simp only [listCode_length_cons] + omega + +variable {G : SimpleGraph α} {a b c : α} + +private theorem support_dropUntil (p : G.Walk a b) (h : c ∈ p.support) : + (p.dropUntil c h).support = p.support.drop (p.support.idxOf c) := by + have hi := List.idxOf_lt_length_of_mem h + have hs := p.length_support + have hib : p.support.idxOf c ≤ p.length := by omega + rw [SimpleGraph.Walk.dropUntil_eq_drop,SimpleGraph.Walk.support_copy, + SimpleGraph.Walk.drop_support_eq_support_drop_min,Nat.min_eq_left hib] + +theorem support_bypass (p : G.Walk a b) : erase p.support = p.bypass.support := by + induction p with + | nil => simp [erase,step,SimpleGraph.Walk.bypass] + | @cons a b c hab p ih => + rw [SimpleGraph.Walk.support_cons,erase_cons,ih] + simp only [step,SimpleGraph.Walk.bypass] + split_ifs with h + · exact (support_dropUntil p.bypass h).symm + · rfl + +end QuantumWalkErasure + +namespace QMASpatialExchangeModel +variable {A B : ℕ} (M : QMASpatialExchangeModel A B) + +theorem bufferedPath_support_explicit + (hd : ∀ v, qmaGraphDegree M.left M.right v ≤ 3) (e : M.Term) : + (M.bufferedPath hd e).val.support = + QuantumWalkErasure.erase (M.bufferedWalk hd e).support := + (QuantumWalkErasure.support_bypass (M.bufferedWalk hd e)).symm + +end QMASpatialExchangeModel +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWalkErasureProgram.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWalkErasureProgram.lean new file mode 100644 index 0000000000000000000000000000000000000000..9cb2e87818388963365b35f31d8595d45fe78dea --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWalkErasureProgram.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumWalkSeek +import OAI.Computability.QuantumFactoring.BitStackListFold + +namespace OAI + +/-! A polynomial finite-stack implementation of the actual coarse-walk loop +erasure. Each fold output is a sublist of the processed input and initial list. -/ + +noncomputable section +open scoped List +namespace ContinuumCoulomb.QuantumWalkErasure +open ExactQuantumFactoring.BitStackProgram +variable {α : Type} [DecidableEq α] + +noncomputable def stepProgram (ea : α → List Bool) (d : α) + (eqp : Procedure (prodCode ea ea) Procedure.boolCode (fun x => decide (x.1=x.2))) : + Procedure (prodCode ea (listCode ea)) (listCode ea) (fun x => step x.1 x.2) := + (Procedure.conditional (QuantumFiniteMembership.memberProgram ea d eqp) + (QuantumWalkSeek.program ea d eqp) (Procedure.listCons ea)).congrFun (by + intro x + simp only [step,decide_eq_true_eq]) + +theorem fold_sublist (xs bs : List α) : + xs.foldl (fun ys a => step a ys) bs <+ xs.reverse ++ bs := by + induction xs generalizing bs with + | nil => exact List.Sublist.refl _ + | cons a xs ih => + simp only [List.foldl_cons,List.reverse_cons,List.append_assoc,List.singleton_append] + exact (ih (step a bs)).trans ((step_sublist a bs).append_left xs.reverse) + +theorem fold_code_bound (ea : α → List Bool) (xs bs : List α) : + (listCode ea (xs.foldl (fun ys a => step a ys) bs)).length ≤ + (listCode ea xs).length+(listCode ea bs).length := by + have h := listCode_length_sublist ea (fold_sublist xs bs) + have ha := listCode_length_append ea xs.reverse bs + rw [listCode_length_rev] at ha + omega + +noncomputable def foldProgram (ea : α → List Bool) (d : α) + (eqp : Procedure (prodCode ea ea) Procedure.boolCode (fun x => decide (x.1=x.2))) : + Procedure (prodCode (listCode ea) (listCode ea)) (listCode ea) + (fun x => x.1.foldl (fun ys a => step a ys) x.2) := + Procedure.foldList d (stepProgram ea d eqp) Polynomial.X (by + intro xs bs i + have h := fold_code_bound ea (xs.take i) bs + have ht := listCode_length_take_le ea i xs + simp only [Polynomial.eval_X] + omega) + +noncomputable def program (ea : α → List Bool) (d : α) + (eqp : Procedure (prodCode ea ea) Procedure.boolCode (fun x => decide (x.1=x.2))) : + Procedure (listCode ea) (listCode ea) erase := + ((foldProgram ea d eqp).comp ((Procedure.listReverse ea d).pair + (Procedure.constant (listCode ea) (listCode ea) []))).congrFun (by + intro xs + simp only [Function.comp_apply,List.foldl_reverse,erase]) + +noncomputable def cellProgram : + Procedure (listCode QuantumRouteCode.pairCode) (listCode QuantumRouteCode.pairCode) + (erase : List (ℕ × ℕ) → List (ℕ × ℕ)) := + program QuantumRouteCode.pairCode (0,0) QuantumFiniteMembership.pairEqProgram + +end ContinuumCoulomb.QuantumWalkErasure + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWalkSeek.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWalkSeek.lean new file mode 100644 index 0000000000000000000000000000000000000000..3396d02ce89e006ed00a9dd312703b8fd7ca1c9f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWalkSeek.lean @@ -0,0 +1,92 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumWalkErasure +import OAI.Computability.QuantumFactoring.BitStackIteration + +namespace OAI + +/-! A bounded scan finds the first occurrence of a cell in a route list. +It only removes list heads, so the machine state never grows. -/ + +noncomputable section +open scoped List +namespace ContinuumCoulomb.QuantumWalkSeek +open ExactQuantumFactoring.BitStackProgram +variable {α : Type} [DecidableEq α] + +def scan (d : α) (x : α × List α) : α × List α := + if x.1 = x.2.headD d then x else (x.1,x.2.tail) + +@[simp] theorem scan_first (d : α) (x : α × List α) : (scan d x).1 = x.1 := by + unfold scan + split <;> rfl + +theorem scan_sublist (d : α) (x : α × List α) : (scan d x).2 <+ x.2 := by + unfold scan + split + · exact List.Sublist.refl _ + · exact List.tail_sublist _ + +theorem iterate_first (d : α) (x : α × List α) (n : ℕ) : ((scan d)^[n] x).1 = x.1 := by + induction n with + | zero => rfl + | succ n ih => rw [Function.iterate_succ_apply',scan_first,ih] + +theorem iterate_sublist (d : α) (x : α × List α) (n : ℕ) : ((scan d)^[n] x).2 <+ x.2 := by + induction n with + | zero => exact List.Sublist.refl _ + | succ n ih => + rw [Function.iterate_succ_apply'] + exact (scan_sublist d _).trans ih + +theorem scan_drop_idx (d a : α) (xs : List α) (n : ℕ) (hn : xs.length ≤ n) : + ((scan d)^[n] (a,xs)).2 = xs.drop (xs.idxOf a) := by + induction n generalizing xs with + | zero => + have h : xs = [] := List.length_eq_zero_iff.mp (by omega) + subst xs + rfl + | succ n ih => + rw [Function.iterate_succ_apply] + cases xs with + | nil => + have h : scan d (a,[]) = (a,[]) := by unfold scan; split <;> rfl + have hi : ((scan d)^[n] (a,[])) = (a,[]) := by + exact Function.iterate_fixed h n + rw [h,hi] + rfl + | cons b xs => + by_cases hab : a=b + · subst b + have h : scan d (a,a::xs) = (a,a::xs) := by simp [scan] + rw [h,Function.iterate_fixed h n] + simp + · have hlen : xs.length ≤ n := by simpa using hn + simpa [scan,hab,List.idxOf_cons,beq_iff_eq,eq_comm] using ih xs hlen + +noncomputable def scanProgram (ea : α → List Bool) (d : α) + (eqp : Procedure (prodCode ea ea) Procedure.boolCode (fun x => decide (x.1=x.2))) : + Procedure (prodCode ea (listCode ea)) (prodCode ea (listCode ea)) (scan d) := by + let a := Procedure.first ea (listCode ea) + let xs := Procedure.second ea (listCode ea) + let same := eqp.comp (a.pair ((Procedure.listHead ea d).comp xs)) + exact (Procedure.conditional same (Procedure.identity _) (a.pair ((Procedure.listTail ea).comp xs))).congrFun + (by intro x; simp only [Function.comp_apply,scan,decide_eq_true_eq,id_eq]) + +noncomputable def program (ea : α → List Bool) (d : α) + (eqp : Procedure (prodCode ea ea) Procedure.boolCode (fun x => decide (x.1=x.2))) : + Procedure (prodCode ea (listCode ea)) (listCode ea) (fun x => x.2.drop (x.2.idxOf x.1)) := by + let rep := (scanProgram ea d eqp).iterate Polynomial.X (by + intro n x i _ + simp only [prodCode,pairBits_length,Polynomial.eval_X,iterate_first] + have h := QuantumWalkErasure.listCode_length_sublist ea (iterate_sublist d x i) + omega) + let count := (Procedure.length.precompose (listCode ea)).comp (Procedure.second ea (listCode ea)) + exact ((Procedure.second ea (listCode ea)).comp + (rep.comp (count.pair (Procedure.identity _)))).congrFun (by + intro x + exact scan_drop_idx d x.1 x.2 _ (list_length_le_code ea x.2)) + +end ContinuumCoulomb.QuantumWalkSeek + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWalkSupport.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWalkSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..0ff6fc7ace745de81aadaa873bbd5f6c81f4bd94 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWalkSupport.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumWalkErasure + +namespace OAI + +/-! The actual buffered walk is a finite list of explicit arm and Manhattan +points. Loop erasure therefore computes the path used by the port geometry. -/ + +noncomputable section +namespace ContinuumCoulomb + + theorem qmaGridWalk_support_list (p : ℕ → ℕ × ℕ) (L : ℕ) + (hstep : ∀ k < L, qmaSquareGrid.Adj (p k) (p (k+1))) : + (qmaGridWalk p L hstep).support = (List.range (L+1)).map p := by + induction L generalizing p with + | zero => simp [qmaGridWalk] + | succ L ih => + simp only [qmaGridWalk,SimpleGraph.Walk.support_cons,ih,List.range_succ_eq_map, + List.map_cons,List.map_map,Function.comp_def] + +namespace QMASpatialExchangeModel +variable {A B : ℕ} (M : QMASpatialExchangeModel A B) + +def endpointArmList (hd : ∀ v, qmaGraphDegree M.left M.right v ≤ 3) + (v : Fin M.n) (e : M.Incident v) : List (ℕ × ℕ) := + (List.range (M.endpointArmLength hd v e+1)).map (M.endpointArmPoint hd v e) + +def spacedList (e : M.Term) : List (ℕ × ℕ) := + let p := qmaLanePoint (M.spacedColor e) (M.routeVertex (M.left e)) + let q := qmaLanePoint (M.spacedColor e) (M.routeVertex (M.right e)) + (List.range (qmaManhattanLength p q+1)).map (qmaManhattanPoint p q) + +def bufferedList (hd : ∀ v, qmaGraphDegree M.left M.right v ≤ 3) + (e : M.Term) : List (ℕ × ℕ) := + M.endpointArmList hd (M.left e) ⟨e,Or.inl rfl⟩ ++ (M.spacedList e).tail ++ + (M.endpointArmList hd (M.right e) ⟨e,Or.inr rfl⟩).reverse.tail + +@[simp] theorem endpointArmWalk_support_eq (hd : ∀ v, qmaGraphDegree M.left M.right v ≤ 3) + (v : Fin M.n) (e : M.Incident v) : + (M.endpointArmWalk hd v e).support = M.endpointArmList hd v e := by + simp only [endpointArmWalk,SimpleGraph.Walk.support_copy,qmaGridWalk_support_list, + endpointArmList] + +@[simp] theorem spacedWalk_support_eq (e : M.Term) : + (M.spacedWalk e).support = M.spacedList e := by + simp only [spacedWalk,SimpleGraph.Walk.support_copy,qmaGridWalk_support_list,spacedList] + + theorem bufferedWalk_support_eq (hd : ∀ v, qmaGraphDegree M.left M.right v ≤ 3) + (e : M.Term) : (M.bufferedWalk hd e).support = M.bufferedList hd e := by + simp only [bufferedWalk,SimpleGraph.Walk.support_append,SimpleGraph.Walk.support_reverse, + endpointArmWalk_support_eq,spacedWalk_support_eq,bufferedList] + + theorem bufferedPath_support_list (hd : ∀ v, qmaGraphDegree M.left M.right v ≤ 3) + (e : M.Term) : + (M.bufferedPath hd e).val.support = QuantumWalkErasure.erase (M.bufferedList hd e) := by + rw [M.bufferedPath_support_explicit,M.bufferedWalk_support_eq] + + theorem coarseRoute_list (hd : ∀ v, qmaGraphDegree M.left M.right v ≤ 3) + (e : M.Term) (i : ℕ) : + M.coarseRoute hd e i = + (QuantumWalkErasure.erase (M.bufferedList hd e)).getD i (M.placedVertex (M.right e)) := by + rw [coarseRoute,SimpleGraph.Walk.getVert_eq_getD_support,M.bufferedPath_support_list] + +end QMASpatialExchangeModel +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWireGrid.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWireGrid.lean new file mode 100644 index 0000000000000000000000000000000000000000..edb44f0a41350fedda334dbca92eef7f872bfae4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWireGrid.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumTransferGate + +namespace OAI + +/-! Concrete row-major physical qubits for the space-time wire construction. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical + +abbrev qmaGridWork (rows width : ℕ) : ℕ := width+rows*(width+1) + +def qmaGridQubit (rows width : ℕ) (r : Fin (rows+1)) (i : Fin (width+1)) : + Fin (qmaGridWork rows width+1) := + ⟨r.val*(width+1)+i.val,by + have hr : r.val ≤ rows := Nat.le_of_lt_succ r.isLt + have hi : i.val ≤ width := Nat.le_of_lt_succ i.isLt + have hm := Nat.mul_le_mul_right (width+1) hr + unfold qmaGridWork + omega⟩ + +theorem qmaGridQubit_injective (rows width : ℕ) : + Function.Injective (fun p : Fin (rows+1) × Fin (width+1) => qmaGridQubit rows width p.1 p.2) := by + rintro ⟨r,i⟩ ⟨s,j⟩ h + have hv : r.val*(width+1)+i.val = s.val*(width+1)+j.val := congrArg Fin.val h + have hm := congrArg (fun k => k % (width+1)) hv + rw [Nat.mul_add_mod_self_right,Nat.mul_add_mod_self_right,Nat.mod_eq_of_lt i.isLt,Nat.mod_eq_of_lt j.isLt] at hm + have hi : i = j := Fin.ext hm + have hr : r = s := by + apply Fin.ext + have hpos : 0 < width+1 := by omega + have hij : i.val = j.val := congrArg Fin.val hi + nlinarith + exact Prod.ext hr hi + +theorem qmaGridRow_injective (rows width : ℕ) (r : Fin (rows+1)) : + Function.Injective (qmaGridQubit rows width r) := by + intro i j h + exact congrArg Prod.snd (qmaGridQubit_injective rows width (a₁ := (r,i)) (a₂ := (r,j)) h) + +theorem qmaGridRows_disjoint (rows width : ℕ) (r s : Fin (rows+1)) (hrs : r ≠ s) + (i j : Fin (width+1)) : qmaGridQubit rows width r i ≠ qmaGridQubit rows width s j := by + intro h + exact hrs (congrArg Prod.fst (qmaGridQubit_injective rows width (a₁ := (r,i)) (a₂ := (s,j)) h)) + +def qmaGridTransfer (rows width : ℕ) (r : Fin rows) : List QMAGate := + qmaTransferGates (qmaRowPairs (qmaGridQubit rows width r.castSucc) + (qmaGridQubit rows width r.succ)) + +theorem qmaGridTransfer_length (rows width : ℕ) (r : Fin rows) : + (qmaGridTransfer rows width r).length = 3*(width+1) := qmaRowTransfer_length _ _ + +theorem qmaGridRow_ne (rows : ℕ) (r : Fin rows) : r.castSucc ≠ r.succ := by + intro h + have hv := congrArg Fin.val h + simp at hv + +theorem qmaGridTransfer_wellFormed (rows width : ℕ) (r : Fin rows) : + ∀ g ∈ qmaGridTransfer rows width r, g.WellFormed (qmaGridWork rows width+1) := by + apply qmaTransferGates_wellFormed + apply qmaRowPairs_distinct + exact qmaGridRows_disjoint rows width r.castSucc r.succ (qmaGridRow_ne rows r) + +theorem qmaGridTransfer_coordinates (rows width : ℕ) (r : Fin rows) (i : Fin (width+1)) : + let σ := qmaTransferPermutation (qmaRowPairs (qmaGridQubit rows width r.castSucc) + (qmaGridQubit rows width r.succ)) + σ (qmaGridQubit rows width r.castSucc i) = qmaGridQubit rows width r.succ i ∧ + σ (qmaGridQubit rows width r.succ i) = qmaGridQubit rows width r.castSucc i := by + exact qmaRowTransfer_coordinates _ _ (qmaGridRow_injective rows width r.castSucc) + (qmaGridRow_injective rows width r.succ) + (qmaGridRows_disjoint rows width r.castSucc r.succ (qmaGridRow_ne rows r)) i + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWireIntertwining.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWireIntertwining.lean new file mode 100644 index 0000000000000000000000000000000000000000..3fec01327e4cb7e5768de142aa687dccba7340a3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWireIntertwining.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRowTransfer + +namespace OAI + +/-! Intertwining identities for moving operators together with their active wires. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +theorem qmaWirePermutation_mul_matrix {n : ℕ} + (e : SourceSpinBasis n ≃ SourceSpinBasis n) + (M : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) (s t : SourceSpinBasis n) : + (qmaWirePermutation e*M) s t = M (e.symm s) t := by + simp only [Matrix.mul_apply,qmaWirePermutation] + rw [Finset.sum_eq_single (e.symm s)] + · simp + · intro b _ hb + have h : s ≠ e b := fun he => hb ((e.eq_symm_apply.mpr he.symm)) + simp [h] + · simp + +theorem qmaMatrix_mul_wirePermutation {n : ℕ} + (e : SourceSpinBasis n ≃ SourceSpinBasis n) + (M : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) (s t : SourceSpinBasis n) : + (M*qmaWirePermutation e) s t = M s (e t) := by + simp only [Matrix.mul_apply,qmaWirePermutation] + rw [Finset.sum_eq_single (e t)] + · simp + · intro b _ hb + simp [hb] + · simp + +theorem qmaWirePermutation_intertwines {n : ℕ} + (e : SourceSpinBasis n ≃ SourceSpinBasis n) + (M : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) : + qmaWirePermutation e*M = M.submatrix e.symm e.symm*qmaWirePermutation e := by + ext s t + rw [qmaWirePermutation_mul_matrix,qmaMatrix_mul_wirePermutation] + simp + +theorem qmaWireBasis_symm {n : ℕ} (σ : Equiv.Perm (Fin n)) : + (qmaWireBasis σ).symm = qmaWireBasis σ.symm := by + ext s k + rfl + +theorem qmaGate_wire_intertwines (work : ℕ) (σ : Equiv.Perm (Fin (work+1))) + (g : QMAGate) : + qmaWirePermutation (qmaWireBasis σ)*qmaGateMatrix work g = + qmaGateMatrix work (qmaRelabelGate work σ.symm g)*qmaWirePermutation (qmaWireBasis σ) := by + rw [qmaWirePermutation_intertwines,qmaRelabelGate_matrix,qmaWireBasis_symm] + rfl + +theorem qmaGateProduct_wire_intertwines (work : ℕ) (σ : Equiv.Perm (Fin (work+1))) + (gs : List QMAGate) : + qmaWirePermutation (qmaWireBasis σ)*qmaGateProduct work gs = + qmaGateProduct work (gs.map (qmaRelabelGate work σ.symm))* + qmaWirePermutation (qmaWireBasis σ) := by + rw [qmaGateProduct_relabel,qmaWirePermutation_intertwines,qmaWireBasis_symm] + rfl + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWireRelabel.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWireRelabel.lean new file mode 100644 index 0000000000000000000000000000000000000000..fcb52ae7cac5ece254f56f0d3fcdbba30949bf42 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWireRelabel.lean @@ -0,0 +1,106 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGateProduct + +namespace OAI + +/-! Exact coordinate changes for gates and circuit products. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +def qmaWireBasis {n : ℕ} (σ : Equiv.Perm (Fin n)) : + SourceSpinBasis n ≃ SourceSpinBasis n where + toFun s := s ∘ σ + invFun s := s ∘ σ.symm + left_inv s := by funext i; simp + right_inv s := by funext i; simp + +def qmaWireRelabelMatrix {n : ℕ} (σ : Equiv.Perm (Fin n)) + (M : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) := + M.submatrix (qmaWireBasis σ) (qmaWireBasis σ) + +theorem sourceTensor_wire_relabel {n : ℕ} (σ : Equiv.Perm (Fin n)) + (M : Fin n → Matrix (Fin 2) (Fin 2) ℂ) : + sourceTensor n (fun k => M (σ.symm k)) = qmaWireRelabelMatrix σ (sourceTensor n M) := by + ext s t + change (∏ k, M (σ.symm k) (s k) (t k)) = ∏ k, M k (s (σ k)) (t (σ k)) + exact Fintype.prod_equiv σ.symm _ _ (by intro k; simp) + +def qmaRelabelGate (work : ℕ) (σ : Equiv.Perm (Fin (work+1))) : QMAGate → QMAGate + | .hadamard i => .hadamard (σ (qmaQubit work i)).val + | .phaseT i => .phaseT (σ (qmaQubit work i)).val + | .controlledNot i j => + .controlledNot (σ (qmaQubit work i)).val (σ (qmaQubit work j)).val + +theorem qmaControlledNot_wire_relabel (work : ℕ) (σ : Equiv.Perm (Fin (work+1))) + (i j : Fin (work+1)) (s : SourceSpinBasis (work+1)) : + qmaControlledNot work i j (qmaWireBasis σ s) = + qmaWireBasis σ (qmaControlledNot work (σ i) (σ j) s) := by + funext k + by_cases hk : k = j + · subst k + by_cases hs : s (σ i) = 1 <;> simp [qmaControlledNot,qmaWireBasis,hs] + · have hσ : σ k ≠ σ j := fun h => hk (σ.injective h) + simp [qmaControlledNot,qmaWireBasis,hk,hσ] + +theorem qmaRelabelGate_matrix (work : ℕ) (σ : Equiv.Perm (Fin (work+1))) (g : QMAGate) : + qmaGateMatrix work (qmaRelabelGate work σ g) = + qmaWireRelabelMatrix σ (qmaGateMatrix work g) := by + cases g with + | hadamard i => + simp only [qmaRelabelGate,qmaGateMatrix,qmaQubit_fin] + rw [← sourceTensor_wire_relabel] + congr 1 + funext k + simp [Equiv.symm_apply_eq] + | phaseT i => + simp only [qmaRelabelGate,qmaGateMatrix,qmaQubit_fin] + rw [← sourceTensor_wire_relabel] + congr 1 + funext k + simp [Equiv.symm_apply_eq] + | controlledNot i j => + simp only [qmaRelabelGate,qmaGateMatrix,qmaQubit_fin] + ext s t + change (if s = qmaControlledNot work (σ (qmaQubit work i)) (σ (qmaQubit work j)) t + then (1:ℂ) else 0) = + if qmaWireBasis σ s = qmaControlledNot work (qmaQubit work i) (qmaQubit work j) + (qmaWireBasis σ t) then 1 else 0 + simp only [qmaControlledNot_wire_relabel, (qmaWireBasis σ).injective.eq_iff] + +theorem qmaRelabelGate_wellFormed (work : ℕ) (σ : Equiv.Perm (Fin (work+1))) + (g : QMAGate) (hg : g.WellFormed (work+1)) : + (qmaRelabelGate work σ g).WellFormed (work+1) := by + cases g with + | hadamard i => exact (σ (qmaQubit work i)).isLt + | phaseT i => exact (σ (qmaQubit work i)).isLt + | controlledNot i j => + refine ⟨(σ (qmaQubit work i)).isLt,(σ (qmaQubit work j)).isLt,?_⟩ + intro h + have he := σ.injective (Fin.ext h) + have hv := congrArg Fin.val he + simp only [qmaQubit,Nat.mod_eq_of_lt hg.1,Nat.mod_eq_of_lt hg.2.1] at hv + exact hg.2.2 hv + +theorem qmaWireRelabelMatrix_mul {n : ℕ} (σ : Equiv.Perm (Fin n)) + (A B : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ) : + qmaWireRelabelMatrix σ (A*B) = qmaWireRelabelMatrix σ A*qmaWireRelabelMatrix σ B := by + exact (Matrix.submatrix_mul_equiv A B (qmaWireBasis σ) (qmaWireBasis σ) + (qmaWireBasis σ)).symm + +theorem qmaGateProduct_relabel (work : ℕ) (σ : Equiv.Perm (Fin (work+1))) + (gs : List QMAGate) : + qmaGateProduct work (gs.map (qmaRelabelGate work σ)) = + qmaWireRelabelMatrix σ (qmaGateProduct work gs) := by + induction gs using List.reverseRecOn with + | nil => simp [qmaGateProduct_nil,qmaWireRelabelMatrix,Matrix.submatrix_one_equiv] + | append_singleton gs g ih => + simp only [List.map_append,List.map_cons,List.map_nil,qmaGateProduct_append, + qmaGateProduct_singleton,qmaWireRelabelMatrix_mul,qmaRelabelGate_matrix,ih] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWireRouting.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWireRouting.lean new file mode 100644 index 0000000000000000000000000000000000000000..7b5d0998aac68a5a7eae1919fe32aba8027a643c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWireRouting.lean @@ -0,0 +1,95 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumWireGrid + +namespace OAI + +/-! Exact composition of logical gates with successive physical wire transfers. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped Classical + +abbrev QMAWireInstruction (work : ℕ) := List (Fin (work+1) × Fin (work+1)) × QMAGate + +def qmaRoutedFrame {work : ℕ} (σ : Equiv.Perm (Fin (work+1))) : + List (QMAWireInstruction work) → Equiv.Perm (Fin (work+1)) + | [] => σ + | (ps,_)::xs => qmaRoutedFrame ((qmaTransferPermutation ps).trans σ) xs + +def qmaRoutedGates (work : ℕ) (σ : Equiv.Perm (Fin (work+1))) : + List (QMAWireInstruction work) → List QMAGate + | [] => [] + | (ps,g)::xs => + let next := (qmaTransferPermutation ps).trans σ + qmaTransferGates ps ++ [qmaRelabelGate work next.symm g] ++ qmaRoutedGates work next xs + +theorem qmaWireBasis_product {n : ℕ} (σ τ : Equiv.Perm (Fin n)) : + qmaWirePermutation (qmaWireBasis σ)*qmaWirePermutation (qmaWireBasis τ) = + qmaWirePermutation (qmaWireBasis (σ.trans τ)) := by + rw [qmaWirePermutation_mul] + rfl + +theorem qmaRoutedGates_matrix (work : ℕ) (σ : Equiv.Perm (Fin (work+1))) + (xs : List (QMAWireInstruction work)) + (hx : ∀ x ∈ xs, ∀ p ∈ x.1, p.1 ≠ p.2) : + qmaGateProduct work (qmaRoutedGates work σ xs)*qmaWirePermutation (qmaWireBasis σ) = + qmaWirePermutation (qmaWireBasis (qmaRoutedFrame σ xs))* + qmaGateProduct work (xs.map Prod.snd) := by + induction xs generalizing σ with + | nil => simp [qmaRoutedGates,qmaRoutedFrame,qmaGateProduct_nil] + | cons x xs ih => + rcases x with ⟨ps,g⟩ + let next := (qmaTransferPermutation ps).trans σ + have hp : ∀ p ∈ ps, p.1 ≠ p.2 := hx (ps,g) (by simp) + have ht : ∀ x ∈ xs, ∀ p ∈ x.1, p.1 ≠ p.2 := fun x h => hx x (by simp [h]) + have hframe : qmaGateProduct work (qmaTransferGates ps)*qmaWirePermutation (qmaWireBasis σ) = + qmaWirePermutation (qmaWireBasis next) := by + rw [qmaTransferGates_matrix ps hp] + exact qmaWireBasis_product _ _ + change qmaGateProduct work (qmaTransferGates ps++[qmaRelabelGate work next.symm g]++ + qmaRoutedGates work next xs)*qmaWirePermutation (qmaWireBasis σ) = + qmaWirePermutation (qmaWireBasis (qmaRoutedFrame next xs))* + qmaGateProduct work (g::xs.map Prod.snd) + rw [show g::xs.map Prod.snd = [g]++xs.map Prod.snd from rfl] + simp only [qmaGateProduct_append,qmaGateProduct_singleton] + calc + _ = qmaGateProduct work (qmaRoutedGates work next xs)* + (qmaGateMatrix work (qmaRelabelGate work next.symm g)* + (qmaGateProduct work (qmaTransferGates ps)*qmaWirePermutation (qmaWireBasis σ))) := by + simp only [mul_assoc] + _ = qmaGateProduct work (qmaRoutedGates work next xs)* + (qmaWirePermutation (qmaWireBasis next)*qmaGateMatrix work g) := by + rw [hframe,←qmaGate_wire_intertwines] + _ = _ := by rw [←mul_assoc,ih next ht,mul_assoc] + +theorem qmaRoutedGates_length (work : ℕ) (σ : Equiv.Perm (Fin (work+1))) + (xs : List (QMAWireInstruction work)) : + (qmaRoutedGates work σ xs).length = (xs.map (fun x => 3*x.1.length+1)).sum := by + induction xs generalizing σ with + | nil => rfl + | cons x xs ih => + rcases x with ⟨ps,g⟩ + simp [qmaRoutedGates,qmaTransferGates_length,ih,Nat.add_assoc] + omega + +theorem qmaRoutedGates_wellFormed (work : ℕ) (σ : Equiv.Perm (Fin (work+1))) + (xs : List (QMAWireInstruction work)) + (hx : ∀ x ∈ xs, (∀ p ∈ x.1, p.1 ≠ p.2) ∧ x.2.WellFormed (work+1)) : + ∀ g ∈ qmaRoutedGates work σ xs, g.WellFormed (work+1) := by + induction xs generalizing σ with + | nil => simp [qmaRoutedGates] + | cons x xs ih => + rcases x with ⟨ps,g⟩ + intro h hh + have hp := hx (ps,g) (by simp) + simp only [qmaRoutedGates,List.mem_append,List.mem_singleton] at hh + rcases hh with (hh | rfl) | hh + · exact qmaTransferGates_wellFormed ps hp.1 h hh + · exact qmaRelabelGate_wellFormed _ _ _ hp.2 + · exact ih _ (fun x h => hx x (by simp [h])) h hh + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWireState.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWireState.lean new file mode 100644 index 0000000000000000000000000000000000000000..97c94e22f3a40065420600eff97e1ffd7ebe7f5c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWireState.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPaddedGate + +namespace OAI + +/-! Exact state and measurement transport under wire permutations. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +theorem qmaWirePermutation_apply {n : ℕ} + (e : SourceSpinBasis n ≃ SourceSpinBasis n) + (u : EuclideanSpace ℂ (SourceSpinBasis n)) (s : SourceSpinBasis n) : + qmaApplyMatrix (qmaWirePermutation e) u s = u (e.symm s) := by + change (∑ t, (if s = e t then (1:ℂ) else 0)*u t) = _ + rw [Finset.sum_eq_single (e.symm s)] + · simp + · intro t _ ht + have hs : s ≠ e t := fun h => ht ((e.eq_symm_apply.mpr h.symm)) + simp [hs] + · simp + +theorem qmaWirePermutation_norm {n : ℕ} + (e : SourceSpinBasis n ≃ SourceSpinBasis n) + (u : EuclideanSpace ℂ (SourceSpinBasis n)) : + ‖qmaApplyMatrix (qmaWirePermutation e) u‖ = ‖u‖ := by + apply (sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)).mp + simp only [EuclideanSpace.norm_sq_eq,qmaWirePermutation_apply] + exact e.symm.sum_comp (fun s => ‖u s‖^2) + +theorem qmaWirePermutation_mask {n : ℕ} (σ : Equiv.Perm (Fin n)) + (i : Fin n) (b : Fin 2) (u : EuclideanSpace ℂ (SourceSpinBasis n)) : + qmaMask (fun s => s (σ.symm i) = b) + (qmaApplyMatrix (qmaWirePermutation (qmaWireBasis σ)) u) = + qmaApplyMatrix (qmaWirePermutation (qmaWireBasis σ)) (qmaMask (fun s => s i = b) u) := by + ext s + simp only [qmaMask_apply,qmaWirePermutation_apply,qmaWireBasis_symm] + rfl + +theorem qmaWirePermutation_probability {n : ℕ} (σ : Equiv.Perm (Fin n)) + (i : Fin n) (b : Fin 2) (u : EuclideanSpace ℂ (SourceSpinBasis n)) : + ‖qmaMask (fun s => s (σ.symm i) = b) + (qmaApplyMatrix (qmaWirePermutation (qmaWireBasis σ)) u)‖^2 = + ‖qmaMask (fun s => s i = b) u‖^2 := by + rw [qmaWirePermutation_mask,qmaWirePermutation_norm] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWireSwap.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWireSwap.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d1c65bf438da2950c28a6ea0156f16ce277357c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumWireSwap.lean @@ -0,0 +1,80 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumDistributedInput + +namespace OAI + +/-! Exact three-CNOT transfers for a circuit whose active wires move through a grid. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +def qmaWirePermutation {n : ℕ} (f : SourceSpinBasis n → SourceSpinBasis n) : + Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ := fun s t => if s = f t then 1 else 0 + +theorem qmaWirePermutation_mul {n : ℕ} (f g : SourceSpinBasis n → SourceSpinBasis n) : + qmaWirePermutation f*qmaWirePermutation g = qmaWirePermutation (f ∘ g) := by + ext s t + simp only [qmaWirePermutation,Matrix.mul_apply,mul_ite,mul_zero] + rw [Finset.sum_eq_single (g t)] + · simp + · intro b _ hb + simp [hb] + · simp + +theorem qmaControlledNot_swap (work : ℕ) (i j : Fin (work+1)) (hij : i ≠ j) + (s : SourceSpinBasis (work+1)) : + qmaControlledNot work i j (qmaControlledNot work j i (qmaControlledNot work i j s)) = + s ∘ Equiv.swap i j := by + funext k + by_cases hki : k = i + · subst k + generalize hi : s i = a + generalize hj : s j = b + fin_cases a <;> fin_cases b <;> + simp [qmaControlledNot,hij,hi,hj] + by_cases hkj : k = j + · subst k + generalize hi : s i = a + generalize hj : s j = b + fin_cases a <;> fin_cases b <;> + simp [qmaControlledNot,hij,Ne.symm hij,hi,hj] + · simp [qmaControlledNot,hki,hkj,Equiv.swap_apply_def] + +def qmaWireSwapGates {work : ℕ} (i j : Fin (work+1)) : List QMAGate := + [.controlledNot i.val j.val,.controlledNot j.val i.val,.controlledNot i.val j.val] + +theorem qmaWireSwapGates_wellFormed {work : ℕ} (i j : Fin (work+1)) (hij : i ≠ j) : + ∀ g ∈ qmaWireSwapGates i j, g.WellFormed (work+1) := by + intro g hg + have hval : i.val ≠ j.val := fun h => hij (Fin.ext h) + simp only [qmaWireSwapGates,List.mem_cons,List.not_mem_nil,or_false] at hg + rcases hg with rfl | rfl | rfl + · exact ⟨i.isLt,j.isLt,hval⟩ + · exact ⟨j.isLt,i.isLt,hval.symm⟩ + · exact ⟨i.isLt,j.isLt,hval⟩ + +theorem qmaQubit_fin {work : ℕ} (i : Fin (work+1)) : qmaQubit work i.val = i := by + apply Fin.ext + exact Nat.mod_eq_of_lt i.isLt + +theorem qmaGateMatrix_cnot_fin {work : ℕ} (i j : Fin (work+1)) : + qmaGateMatrix work (.controlledNot i.val j.val) = qmaWirePermutation (qmaControlledNot work i j) := by + rw [qmaGateMatrix,qmaQubit_fin,qmaQubit_fin] + rfl + +theorem qmaWireSwap_matrix {work : ℕ} (i j : Fin (work+1)) (hij : i ≠ j) : + qmaCircuitMatrix ⟨work,0,qmaWireSwapGates i j⟩ = + qmaWirePermutation (fun s => s ∘ Equiv.swap i j) := by + simp only [qmaCircuitMatrix,qmaWireSwapGates,List.foldl_cons,List.foldl_nil, + qmaGateMatrix_cnot_fin,mul_one] + rw [qmaWirePermutation_mul,qmaWirePermutation_mul] + congr 1 + funext s + exact qmaControlledNot_swap work i j hij s + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZEnvelopes.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZEnvelopes.lean new file mode 100644 index 0000000000000000000000000000000000000000..df02389f55faaa467bb4c98db9a13db384e58c84 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZEnvelopes.lean @@ -0,0 +1,53 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZThird +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionEnvelope + +namespace OAI + +/-! Every explicit X/Z gadget word stays in its original support plus its mediator. -/ + +noncomputable section +namespace ContinuumCoulomb +open scoped Classical +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +theorem qmaJoinedWord_envelope (w : ι → Fin 4) (e : κ) (a : Fin 4) {S : Finset ι} + (h : qmaPauliSupport w ⊆ S) : + qmaPauliSupport (Sum.elim w (qmaSinglePauliWord e a)) ⊆ qmaMediatorSupport S e := by + rw [qmaPauliSupport_join] + exact Finset.union_subset_union (Finset.map_subset_map.mpr h) + (Finset.map_subset_map.mpr (qmaSinglePauliWord_support e a)) + +theorem qmaJoinedLeftWord_envelope (w : ι → Fin 4) (e : κ) {S : Finset ι} + (h : qmaPauliSupport w ⊆ S) : + qmaPauliSupport (Sum.elim w (fun _ : κ => 0)) ⊆ qmaMediatorSupport S e := by + rw [qmaPauliSupport_join] + apply Finset.union_subset_union (Finset.map_subset_map.mpr h) + simp [qmaPauliSupport] + +theorem qmaXZSubdivisionWord_envelope (a b : ι → Fin 4) (e : κ) {S : Finset ι} + (ha : qmaPauliSupport a ⊆ S) (hb : qmaPauliSupport b ⊆ S) (k : Fin 4) : + qmaPauliSupport (qmaXZSubdivisionWord a b e k) ⊆ qmaMediatorSupport S e := by + fin_cases k + · simp [qmaXZSubdivisionWord,qmaPauliSupport] + · exact qmaJoinedWord_envelope (fun _ => 0) e 3 (by simp [qmaPauliSupport]) + · exact qmaJoinedWord_envelope a e 1 ha + · exact qmaJoinedWord_envelope b e 1 hb + +theorem qmaXZThirdWord_envelope (a b c v : ι → Fin 4) (e : κ) {S : Finset ι} + (ha : qmaPauliSupport a ⊆ S) (hb : qmaPauliSupport b ⊆ S) + (hc : qmaPauliSupport c ⊆ S) (hv : qmaPauliSupport v ⊆ S) (k : Fin 7) : + qmaPauliSupport (qmaXZThirdWord a b c v e k) ⊆ qmaMediatorSupport S e := by + fin_cases k + · simp [qmaXZThirdWord,qmaPauliSupport] + · exact qmaJoinedWord_envelope (fun _ => 0) e 3 (by simp [qmaPauliSupport]) + · exact qmaJoinedLeftWord_envelope v e hv + · exact qmaJoinedLeftWord_envelope c e hc + · exact qmaJoinedWord_envelope c e 3 hc + · exact qmaJoinedWord_envelope a e 1 ha + · exact qmaJoinedWord_envelope b e 1 hb + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZFamily.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..3e3818411541035a43ba268abd1d02bc80307385 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZFamily.lean @@ -0,0 +1,70 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZReduction + +namespace OAI + +/-! Finite X/Z word families with their actual normalized ground energy. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +theorem qmaNormalizedBottom_instances {σ : Type*} (F G : Fintype σ) + (d e : DecidableEq σ) (A : Matrix σ σ ℂ) : + @MediatorGraph.normalizedBottom σ F d A = @MediatorGraph.normalizedBottom σ G e A := by + cases Subsingleton.elim F G + cases Subsingleton.elim d e + rfl + +structure QMAXZModel where + Q : Type + Term : Type + [qFinite : Fintype Q] + [qDecidable : DecidableEq Q] + [termFinite : Fintype Term] + word : Term → Q → Fin 4 + coefficient : Term → ℝ + noY : ∀ e i, word e i ≠ 2 + card : ∀ e, (qmaPauliSupport (word e)).card ≤ 2 + +attribute [instance] QMAXZModel.qFinite QMAXZModel.qDecidable QMAXZModel.termFinite + +def QMAXZModel.energy (M : QMAXZModel) : ℝ := + MediatorGraph.normalizedBottom (∑ e, (M.coefficient e:ℂ) • qmaPauliWord (M.word e)) + +def QMAXZModel.qubits (M : QMAXZModel) : ℕ := Fintype.card M.Q + +def QMAXZModel.terms (M : QMAXZModel) : ℕ := Fintype.card M.Term + +variable {ι κ : Type} [Fintype ι] [DecidableEq ι] [Fintype κ] + +def QMAXZModel.ofWords (w : κ → ι → Fin 4) (J : κ → ℝ) + (hy : ∀ e i, w e i ≠ 2) (hw : ∀ e, (qmaPauliSupport (w e)).card ≤ 2) : QMAXZModel where + Q := ι + Term := κ + qFinite := inferInstance + qDecidable := inferInstance + termFinite := inferInstance + word := w + coefficient := J + noY := hy + card := hw + +theorem QMAXZModel.ofWords_energy (w : κ → ι → Fin 4) (J : κ → ℝ) + (hy : ∀ e i, w e i ≠ 2) (hw : ∀ e, (qmaPauliSupport (w e)).card ≤ 2) : + (QMAXZModel.ofWords w J hy hw).energy = + MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • qmaPauliWord (w e)) := rfl + +theorem QMAXZModel.ofWords_qubits (w : κ → ι → Fin 4) (J : κ → ℝ) + (hy : ∀ e i, w e i ≠ 2) (hw : ∀ e, (qmaPauliSupport (w e)).card ≤ 2) : + (QMAXZModel.ofWords w J hy hw).qubits = Fintype.card ι := rfl + +theorem QMAXZModel.ofWords_terms (w : κ → ι → Fin 4) (J : κ → ℝ) + (hy : ∀ e i, w e i ≠ 2) (hw : ∀ e, (qmaPauliSupport (w e)).card ≤ 2) : + (QMAXZModel.ofWords w J hy hw).terms = Fintype.card κ := rfl + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZFamilySplit.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZFamilySplit.lean new file mode 100644 index 0000000000000000000000000000000000000000..492bb2b01006f5e7d1d7cf066eba0310e052efff --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZFamilySplit.lean @@ -0,0 +1,185 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZTerms +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorFullFamily + +namespace OAI + +/-! The actual word family splits into the three kinds of physical simulator terms. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +structure QMAXZPair (n : ℕ) where + left : Fin n + right : Fin n + distinct : left ≠ right + axisLeft : Fin 2 + axisRight : Fin 2 + +structure QMAXZField (n : ℕ) where + site : Fin n + axis : Fin 2 + +def QMAXZTerm.IsPair {n : ℕ} : QMAXZTerm n → Prop + | .pair .. => True + | _ => False + +def QMAXZTerm.IsField {n : ℕ} : QMAXZTerm n → Prop + | .field .. => True + | _ => False + +def QMAXZTerm.IsScalar {n : ℕ} : QMAXZTerm n → Prop + | .scalar => True + | _ => False + +def QMAXZTerm.asPair {n : ℕ} (t : QMAXZTerm n) (h : t.IsPair) : QMAXZPair n := by + cases t with + | scalar => exact h.elim + | field => exact h.elim + | pair i j hij a b => exact ⟨i,j,hij,a,b⟩ + +def QMAXZTerm.asField {n : ℕ} (t : QMAXZTerm n) (h : t.IsField) : QMAXZField n := by + cases t with + | scalar => exact h.elim + | field i a => exact ⟨i,a⟩ + | pair => exact h.elim + +theorem QMAXZTerm.pair_matrix {n : ℕ} (t : QMAXZTerm n) (h : t.IsPair) : + t.matrix = qmaPairMatrix (t.asPair h).left (t.asPair h).right + (qmaFourAxis (t.asPair h).axisLeft) (qmaFourAxis (t.asPair h).axisRight) := by + cases t <;> first | exact h.elim | rfl + +theorem QMAXZTerm.field_matrix {n : ℕ} (t : QMAXZTerm n) (h : t.IsField) : + t.matrix = qmaSiteMatrix (t.asField h).site (qmaFourAxis (t.asField h).axis) := by + cases t <;> first | exact h.elim | rfl + +theorem QMAXZTerm.scalar_matrix {n : ℕ} (t : QMAXZTerm n) (h : t.IsScalar) : t.matrix = 1 := by + cases t <;> first | exact h.elim | rfl + +theorem qmaXZLabel_ne_zero (a : Fin 2) : qmaXZLabel a ≠ 0 := by + fin_cases a <;> decide + +theorem QMAXZTerm.pair_support {n : ℕ} (t : QMAXZTerm n) (h : t.IsPair) : + qmaPauliSupport t.word = {(t.asPair h).left,(t.asPair h).right} := by + cases t with + | scalar => exact h.elim + | field => exact h.elim + | pair i j hij a b => + change qmaPauliSupport (QMAXZTerm.pair i j hij a b).word = {i,j} + apply Finset.ext + intro k + unfold qmaPauliSupport + rw [Finset.mem_filter] + simp only [Finset.mem_univ,true_and,Finset.mem_insert,Finset.mem_singleton,QMAXZTerm.word] + by_cases hi : k = i + · subst k + simp only [ite_true,true_or,iff_true] + exact qmaXZLabel_ne_zero a + · by_cases hj : k = j + · subst k + simp only [hi,ite_false,ite_true,or_true,iff_true] + exact qmaXZLabel_ne_zero b + · simp only [hi,hj,ite_false,ne_eq,not_true_eq_false,or_self] + +variable {n : ℕ} {κ : Type*} [Fintype κ] + +abbrev QMAXZPairIndex (t : κ → QMAXZTerm n) := {e // (t e).IsPair} +abbrev QMAXZFieldIndex (t : κ → QMAXZTerm n) := {e // (t e).IsField} +abbrev QMAXZScalarIndex (t : κ → QMAXZTerm n) := {e // (t e).IsScalar} + +def qmaXZPairData (t : κ → QMAXZTerm n) (e : QMAXZPairIndex t) : QMAXZPair n := + (t e.val).asPair e.property + +def qmaXZFieldData (t : κ → QMAXZTerm n) (e : QMAXZFieldIndex t) : QMAXZField n := + (t e.val).asField e.property + +omit [Fintype κ] in +theorem qmaXZPairData_distinct (t : κ → QMAXZTerm n) + (hprivate : ∀ e f, (qmaPauliSupport (t e).word).card = 2 → + qmaPauliSupport (t e).word = qmaPauliSupport (t f).word → e = f) + (e f : QMAXZPairIndex t) (hef : e ≠ f) : + ({(qmaXZPairData t e).left,(qmaXZPairData t e).right} : Finset (Fin n)) ≠ + {(qmaXZPairData t f).left,(qmaXZPairData t f).right} := by + intro heq + apply hef + apply Subtype.ext + apply hprivate e.val f.val + · rw [(t e.val).pair_support e.property] + exact Finset.card_pair ((qmaXZPairData t e).distinct) + · rw [(t e.val).pair_support e.property,(t f.val).pair_support f.property] + exact heq + +theorem qmaSum_subtype_ite {α M : Type*} [Fintype α] [AddCommMonoid M] + (p : α → Prop) [DecidablePred p] (f : α → M) : + (∑ e : {x // p x}, f e.val) = ∑ e, if p e then f e else 0 := by + have h := Fintype.sum_subtype_add_sum_subtype p (fun e => if p e then f e else 0) + have hp : (∑ e : {x // p x}, if p e.val then f e.val else 0) = ∑ e : {x // p x}, f e.val := by + apply Finset.sum_congr rfl + intro e _ + exact ite_eq_left e.property + have hn : (∑ e : {x // ¬p x}, if p e.val then f e.val else 0) = 0 := by + apply Finset.sum_eq_zero + intro e _ + exact ite_eq_right e.property + simpa only [hp,hn,add_zero] using h + +theorem qmaXZFamily_split (t : κ → QMAXZTerm n) (J : κ → ℝ) : + (∑ e, (J e:ℂ) • (t e).matrix) = + (∑ e : QMAXZPairIndex t, (J e.val:ℂ) • qmaPairMatrix + (qmaXZPairData t e).left (qmaXZPairData t e).right + (qmaFourAxis (qmaXZPairData t e).axisLeft) (qmaFourAxis (qmaXZPairData t e).axisRight))+ + (∑ e : QMAXZFieldIndex t, (J e.val:ℂ) • qmaSiteMatrix + (qmaXZFieldData t e).site (qmaFourAxis (qmaXZFieldData t e).axis))+ + ((∑ e : QMAXZScalarIndex t, J e.val:ℝ):ℂ) • 1 := by + have hp : (∑ e : QMAXZPairIndex t, (J e.val:ℂ) • (t e.val).matrix) = + ∑ e : QMAXZPairIndex t, (J e.val:ℂ) • qmaPairMatrix + (qmaXZPairData t e).left (qmaXZPairData t e).right + (qmaFourAxis (qmaXZPairData t e).axisLeft) (qmaFourAxis (qmaXZPairData t e).axisRight) := by + apply Finset.sum_congr rfl + intro e _ + rw [(t e.val).pair_matrix e.property] + rfl + have hf : (∑ e : QMAXZFieldIndex t, (J e.val:ℂ) • (t e.val).matrix) = + ∑ e : QMAXZFieldIndex t, (J e.val:ℂ) • qmaSiteMatrix + (qmaXZFieldData t e).site (qmaFourAxis (qmaXZFieldData t e).axis) := by + apply Finset.sum_congr rfl + intro e _ + rw [(t e.val).field_matrix e.property] + rfl + have hs : (∑ e : QMAXZScalarIndex t, (J e.val:ℂ) • (t e.val).matrix) = + ((∑ e : QMAXZScalarIndex t, J e.val:ℝ):ℂ) • 1 := by + rw [Complex.ofReal_sum,Finset.sum_smul] + apply Finset.sum_congr rfl + intro e _ + rw [(t e.val).scalar_matrix e.property] + rw [← hp,← hf,← hs] + rw [qmaSum_subtype_ite (fun e => (t e).IsPair) (fun e => (J e:ℂ) • (t e).matrix), + qmaSum_subtype_ite (fun e => (t e).IsField) (fun e => (J e:ℂ) • (t e).matrix), + qmaSum_subtype_ite (fun e => (t e).IsScalar) (fun e => (J e:ℂ) • (t e).matrix)] + rw [← Finset.sum_add_distrib,← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro e _ + cases t e <;> simp [QMAXZTerm.IsPair,QMAXZTerm.IsField,QMAXZTerm.IsScalar] + +def qmaXZFamilyConstant (t : κ → QMAXZTerm n) (J : κ → ℝ) : ℝ := + (∑ e : QMAXZScalarIndex t, J e.val)- + ∑ e : QMAXZPairIndex t, qmaFourEnergyOffset + (qmaXZPairData t e).axisLeft (qmaXZPairData t e).axisRight (J e.val) + +theorem qmaXZFamily_target (t : κ → QMAXZTerm n) (J : κ → ℝ) : + qmaFourTensorFullTarget + (fun e => (qmaXZPairData t e).left) (fun e => (qmaXZPairData t e).right) + (fun e => (qmaXZPairData t e).axisLeft) (fun e => (qmaXZPairData t e).axisRight) + (fun e => J e.val) + (fun e => (qmaXZFieldData t e).site) (fun e => (qmaXZFieldData t e).axis) + (fun e => J e.val) (qmaXZFamilyConstant t J) = ∑ e, (J e:ℂ) • (t e).matrix := by + rw [qmaXZFamily_split t J] + simp only [qmaFourTensorFullTarget,qmaFourTensorFamilyTarget,qmaXZFamilyConstant,Complex.ofReal_sub] + module + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZHeisenberg.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZHeisenberg.lean new file mode 100644 index 0000000000000000000000000000000000000000..561962a1f60fed3ac5a01d78c2595f72339de89d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZHeisenberg.lean @@ -0,0 +1,66 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZFamilySplit +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumBlockFull + +namespace OAI + +/-! The full X/Z family is simulated in the ordinary physical qubit space. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {n : ℕ} {κ : Type*} [Fintype κ] + +def qmaXZBlockBudget (t : κ → QMAXZTerm n) (J : κ → ℝ) : ℝ := + qmaFourTensorFullBudget (fun e : QMAXZPairIndex t => J e.val) + (fun e : QMAXZFieldIndex t => J e.val) (qmaXZFamilyConstant t J) + +def qmaXZBlockSource (r : ℝ) (t : κ → QMAXZTerm n) (J : κ → ℝ) : + Matrix (SourceSpinBasis (n*4)) (SourceSpinBasis (n*4)) ℂ := + qmaBlockSourceFull r + (fun e => (qmaXZPairData t e).left) (fun e => (qmaXZPairData t e).right) + (fun e => (qmaXZPairData t e).axisLeft) (fun e => (qmaXZPairData t e).axisRight) + (fun e => J e.val) + (fun e => (qmaXZFieldData t e).site) (fun e => (qmaXZFieldData t e).axis) + (fun e => J e.val) (qmaXZFamilyConstant t J) + +theorem qmaXZBlock_accuracy (t : κ → QMAXZTerm n) (J : κ → ℝ) + (hprivate : ∀ e f, (qmaPauliSupport (t e).word).card = 2 → + qmaPauliSupport (t e).word = qmaPauliSupport (t f).word → e = f) + (N : ℕ) (hN : 0 < N) : + |MediatorGraph.normalizedBottom (qmaXZBlockSource (9*(qmaXZBlockBudget t J)^3*N) t J)- + MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • (t e).matrix)| ≤ 1/(N:ℝ) := by + have h := qmaBlockSourceFull_accuracy + (fun e => (qmaXZPairData t e).left) (fun e => (qmaXZPairData t e).right) + (fun e => (qmaXZPairData t e).axisLeft) (fun e => (qmaXZPairData t e).axisRight) + (fun e => J e.val) + (fun e => (qmaXZPairData t e).distinct) + (fun e f hef => qmaXZPairData_distinct t hprivate e f hef) + (fun e => (qmaXZFieldData t e).site) (fun e => (qmaXZFieldData t e).axis) + (fun e => J e.val) (qmaXZFamilyConstant t J) N hN + rw [qmaXZFamily_target] at h + exact h + +theorem qmaXZWords_heisenberg (w : κ → Fin n → Fin 4) (J : κ → ℝ) + (hy : ∀ e i, w e i ≠ 2) (hw : ∀ e, (qmaPauliSupport (w e)).card ≤ 2) + (hprivate : ∀ e f, (qmaPauliSupport (w e)).card = 2 → + qmaPauliSupport (w e) = qmaPauliSupport (w f) → e = f) + (N : ℕ) (hN : 0 < N) : + ∃ t : κ → QMAXZTerm n, (∀ e, (t e).word = w e) ∧ + |MediatorGraph.normalizedBottom (qmaXZBlockSource (9*(qmaXZBlockBudget t J)^3*N) t J)- + MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • qmaPauliWord (w e))| ≤ 1/(N:ℝ) := by + choose t ht using fun e => qmaXZWord_term (w e) (hy e) (hw e) + refine ⟨t,ht,?_⟩ + have hp : ∀ e f, (qmaPauliSupport (t e).word).card = 2 → + qmaPauliSupport (t e).word = qmaPauliSupport (t f).word → e = f := by + simpa only [ht] using hprivate + have hm : ∀ e, (t e).matrix = qmaPauliWord (w e) := by + intro e + rw [← QMAXZTerm.word_matrix,ht] + simpa only [hm] using qmaXZBlock_accuracy t J hp N hN + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZModel.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..5074afa67f15311e4e7f041f0f4fd86de153d961 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZModel.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZFamily +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumCircuitTwoLocal + +namespace OAI + +/-! A finite X/Z Hamiltonian and its application to the actual verifier circuit. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +theorem QMARealLocalModel.toXZ (M : QMARealLocalModel 2) {N : ℝ} (hN : 1 ≤ N) : + ∃ G : QMAXZModel, |G.energy-M.energy| ≤ 1/N ∧ + G.qubits ≤ M.qubits+80*M.terms ∧ G.terms ≤ 448*M.terms := by + let E := QMALocalEvenPauliTerm M.sites + obtain ⟨v,K,hy,hv,he⟩ := qmaTwoLocalXZ_exists + (fun p : E => qmaLocalPauliWord M.sites p.val) + (fun p : E => qmaLocalPauliCoefficient M.matrix M.sites p.val) + (qmaLocalEvenPauli_support M.sites M.card) (qmaLocalEvenPauli_even M.sites) hN + let G := QMAXZModel.ofWords v K hy hv + have hs : (∑ p : E, (qmaLocalPauliCoefficient M.matrix M.sites p.val:ℂ) • + qmaPauliWord (qmaLocalPauliWord M.sites p.val)) = ∑ a, M.matrix a := + qmaLocalEvenPauli_sum M.matrix M.sites M.localOn M.hermitian M.real + have hc : Fintype.card E ≤ 16*M.terms := qmaLocalEvenPauli_count M.sites M.card + refine ⟨G,?_,?_,?_⟩ + · change |(QMAXZModel.ofWords v K hy hv).energy-M.energy| ≤ 1/N + rw [QMAXZModel.ofWords_energy,QMARealLocalModel.energy,← hs] + convert he using 1 + congr 2 + exact qmaNormalizedBottom_instances _ _ _ _ _ + · change Fintype.card ((M.Q ⊕ E) ⊕ (E × Fin 4)) ≤ M.qubits+80*M.terms + simp only [Fintype.card_sum,Fintype.card_prod,Fintype.card_fin] + change M.qubits+Fintype.card E+Fintype.card E*4 ≤ _ + omega + · change Fintype.card ((E × Fin 4) × Fin 7) ≤ 448*M.terms + simp only [Fintype.card_prod,Fintype.card_fin] + omega + +theorem qmaCircuit_XZ (c : QMACircuit) {N : ℝ} (hN : 1 ≤ N) : + ∃ G : QMAXZModel, + |G.energy-MediatorGraph.normalizedBottom (qmaRealQubitHamiltonian c)| ≤ 1/N ∧ + G.qubits ≤ c.gates.length+c.work+4+602373361664*(2*c.gates.length+c.work+5) ∧ + G.terms ≤ 3367254360064*(2*c.gates.length+c.work+5) := by + have h2N : 1 ≤ 2*N := by linarith + obtain ⟨M,he₁,hq₁,ht₁⟩ := qmaCircuit_two_local c h2N + obtain ⟨G,he₂,hq₂,ht₂⟩ := M.toXZ h2N + refine ⟨G,?_,?_,?_⟩ + · apply (abs_sub_le G.energy M.energy _).trans + apply (add_le_add he₂ he₁).trans + have h : 1/(2*N)+1/(2*N) = 1/N := by ring + exact h.le + · omega + · omega + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZPrivate.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZPrivate.lean new file mode 100644 index 0000000000000000000000000000000000000000..cecbf04f5b3f2e204206a312134022bb025b732a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZPrivate.lean @@ -0,0 +1,117 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZModel + +namespace OAI + +/-! Private subdivision mediators prevent distinct two-body terms from sharing a pair. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +theorem qmaSinglePauliWord_support_eq (i : ι) (a : Fin 4) (ha : a ≠ 0) : + qmaPauliSupport (qmaSinglePauliWord i a) = {i} := by + ext k + by_cases hk : k = i <;> simp [qmaPauliSupport,qmaSinglePauliWord,hk,ha] + +omit [DecidableEq ι] in +theorem qmaXZSubdivision_inr_mem (a b : ι → Fin 4) (e t : κ) (k : Fin 4) : + Sum.inr t ∈ qmaPauliSupport (qmaXZSubdivisionWord a b e k) ↔ k ≠ 0 ∧ t = e := by + fin_cases k <;> simp [qmaXZSubdivisionWord,qmaPauliSupport,qmaSinglePauliWord] + +theorem qmaXZSubdivision_pair_index (a b : ι → Fin 4) (e : κ) (k : Fin 4) + (h : (qmaPauliSupport (qmaXZSubdivisionWord a b e k)).card = 2) : k = 2 ∨ k = 3 := by + fin_cases k + · change (qmaPauliSupport (fun _ : ι ⊕ κ => 0)).card = 2 at h + simp [qmaPauliSupport] at h + · change (qmaPauliSupport (Sum.elim (fun _ : ι => 0) (qmaSinglePauliWord e 3))).card = 2 at h + rw [qmaPauliSupport_join_card,qmaSinglePauliWord_support_eq e 3 (by decide)] at h + simp [qmaPauliSupport] at h + · exact Or.inl rfl + · exact Or.inr rfl + +theorem qmaXZSubdivision_private_pair (a b : κ → ι → Fin 4) + (hd : ∀ e, Disjoint (qmaPauliSupport (a e)) (qmaPauliSupport (b e))) + (e f : κ) (k l : Fin 4) + (hk : (qmaPauliSupport (qmaXZSubdivisionWord (a e) (b e) e k)).card = 2) + (heq : qmaPauliSupport (qmaXZSubdivisionWord (a e) (b e) e k) = + qmaPauliSupport (qmaXZSubdivisionWord (a f) (b f) f l)) : e = f ∧ k = l := by + have hl := heq ▸ hk + have hk' := qmaXZSubdivision_pair_index (a e) (b e) e k hk + have hl' := qmaXZSubdivision_pair_index (a f) (b f) f l hl + have hk0 : k ≠ 0 := by rcases hk' with rfl | rfl <;> decide + have hin : Sum.inr e ∈ qmaPauliSupport (qmaXZSubdivisionWord (a e) (b e) e k) := + (qmaXZSubdivision_inr_mem _ _ _ _ _).mpr ⟨hk0,rfl⟩ + rw [heq] at hin + have hef := ((qmaXZSubdivision_inr_mem _ _ _ _ _).mp hin).2 + subst f + refine ⟨rfl,?_⟩ + rcases hk' with rfl | rfl <;> rcases hl' with rfl | rfl + · rfl + · change qmaPauliSupport (Sum.elim (a e) (qmaSinglePauliWord e 1)) = + qmaPauliSupport (Sum.elim (b e) (qmaSinglePauliWord e 1)) at heq + have hab : qmaPauliSupport (a e) = qmaPauliSupport (b e) := by + ext i + have h := Finset.ext_iff.mp heq (Sum.inl i) + simpa [qmaPauliSupport] using h + have hz : qmaPauliSupport (a e) = ∅ := + (Finset.disjoint_self_iff_empty _).mp (by simpa only [← hab] using hd e) + change (qmaPauliSupport (Sum.elim (a e) (qmaSinglePauliWord e 1))).card = 2 at hk + rw [qmaPauliSupport_join_card,hz,qmaSinglePauliWord_support_eq e 1 (by decide)] at hk + norm_num at hk + · change qmaPauliSupport (Sum.elim (b e) (qmaSinglePauliWord e 1)) = + qmaPauliSupport (Sum.elim (a e) (qmaSinglePauliWord e 1)) at heq + have hab : qmaPauliSupport (b e) = qmaPauliSupport (a e) := by + ext i + have h := Finset.ext_iff.mp heq (Sum.inl i) + simpa [qmaPauliSupport] using h + have hz : qmaPauliSupport (b e) = ∅ := + (Finset.disjoint_self_iff_empty _).mp (by simpa only [← hab] using (hd e).symm) + change (qmaPauliSupport (Sum.elim (b e) (qmaSinglePauliWord e 1))).card = 2 at hk + rw [qmaPauliSupport_join_card,hz,qmaSinglePauliWord_support_eq e 1 (by decide)] at hk + norm_num at hk + · rfl + +theorem qmaXZPrivate_exists (w : κ → ι → Fin 4) (J : κ → ℝ) + (hw : ∀ e, (qmaPauliSupport (w e)).card ≤ 2) + (hy : ∀ e i, w e i ≠ 2) {N : ℝ} (hN : 1 ≤ N) : + ∃ (v : (κ × Fin 4) → (ι ⊕ κ → Fin 4)) (K : (κ × Fin 4) → ℝ), + (∀ p i, v p i ≠ 2) ∧ (∀ p, (qmaPauliSupport (v p)).card ≤ 2) ∧ + (∀ p q, (qmaPauliSupport (v p)).card = 2 → + qmaPauliSupport (v p) = qmaPauliSupport (v q) → p = q) ∧ + |MediatorGraph.normalizedBottom (∑ p, (K p:ℂ) • qmaPauliWord (v p)) - + MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • qmaPauliWord (w e))| ≤ 1/N := by + choose L T hL hT hdis hcover using fun e => + qmaBalancedSupport (qmaPauliSupport (w e)) 1 (hw e) + let a := fun e => qmaPauliRestrict (L e) (w e) + let b := fun e => qmaPauliRestrict (T e) (w e) + have ha (e : κ) : (qmaPauliSupport (a e)).card ≤ 1 := + (Finset.card_le_card (qmaPauliRestrict_support _ _)).trans (hL e) + have hb (e : κ) : (qmaPauliSupport (b e)).card ≤ 1 := + (Finset.card_le_card (qmaPauliRestrict_support _ _)).trans (hT e) + have hab (e : κ) : qmaPauliWord (a e)*qmaPauliWord (b e) = qmaPauliWord (w e) := + qmaPauliRestrict_factor _ _ _ (hdis e) (by rw [hcover e]) + have hcomm (e : κ) : qmaPauliWord (a e)*qmaPauliWord (b e) = + qmaPauliWord (b e)*qmaPauliWord (a e) := qmaPauliRestrict_commute _ _ _ (hdis e) + have hd (e : κ) : Disjoint (qmaPauliSupport (a e)) (qmaPauliSupport (b e)) := + (hdis e).mono (qmaPauliRestrict_support _ _) (qmaPauliRestrict_support _ _) + let R := 8*(qmaThirdBudget 0 J)^4*N + refine ⟨fun p => qmaXZSubdivisionWord (a p.1) (b p.1) p.1 p.2, + fun p => qmaXZSubdivisionWeight R (J p.1) p.2,?_,?_,?_,?_⟩ + · intro p i + exact qmaXZSubdivision_noY _ _ _ (qmaPauliRestrict_noY _ _ (hy p.1)) + (qmaPauliRestrict_noY _ _ (hy p.1)) _ _ + · intro p + exact qmaXZSubdivision_support _ _ _ (ha p.1) (hb p.1) _ + · intro p q hp hpq + obtain ⟨he,hk⟩ := qmaXZSubdivision_private_pair a b hd p.1 q.1 p.2 q.2 hp hpq + exact Prod.ext he hk + · have h := qmaXZSubdivision_accuracy a b J hcomm hN + simpa only [hab] using h + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZReduction.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZReduction.lean new file mode 100644 index 0000000000000000000000000000000000000000..bb57a7d8d73c4289f267b98dbe1caac44670ef6f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZReduction.lean @@ -0,0 +1,79 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZThird +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumYYReduction + +namespace OAI + +/-! Explicit reduction to two-local X/Z Pauli terms, with full-space spectral error. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +theorem qmaXZThird_exists (w : κ → ι → Fin 4) (J : κ → ℝ) + (hw : ∀ e, (qmaPauliSupport (w e)).card ≤ 3) + (hy : ∀ e i, w e i ≠ 2) {N : ℝ} (hN : 1 ≤ N) : + ∃ (v : (κ × Fin 7) → (ι ⊕ κ → Fin 4)) (K : (κ × Fin 7) → ℝ), + (∀ p i, v p i ≠ 2) ∧ (∀ p, (qmaPauliSupport (v p)).card ≤ 2) ∧ + |MediatorGraph.normalizedBottom (∑ p, (K p:ℂ) • qmaPauliWord (v p)) - + MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • qmaPauliWord (w e))| ≤ 1/N := by + choose a b c v hay hby hcy hvy ha hb hc hv hab hvc habc hac hbc using + fun e => qmaXZTripleFactor (w e) (hw e) (hy e) + let A := fun e => qmaPauliWord (a e) + let B := fun e => qmaPauliWord (b e) + let C := fun e => qmaPauliWord (c e) + let R := 8*(qmaThirdBudget 0 J)^4*N + refine ⟨fun p => qmaXZThirdWord (a p.1) (b p.1) (c p.1) (v p.1) p.1 p.2, + fun p => qmaXZThirdWeight R (J p.1) p.2,?_,?_,?_⟩ + · intro p i + exact qmaXZThird_noY _ _ _ _ _ (hay p.1) (hby p.1) (hcy p.1) (hvy p.1) _ _ + · intro p + exact qmaXZThird_support _ _ _ _ _ (ha p.1) (hb p.1) (hc p.1) (hv p.1) _ + · have hsum : (∑ p : κ × Fin 7, (qmaXZThirdWeight R (J p.1) p.2 : ℂ) • + qmaPauliWord (qmaXZThirdWord (a p.1) (b p.1) (c p.1) (v p.1) p.1 p.2)) = + (qmaThirdGadget 0 A B C R J).submatrix + (Equiv.sumArrowEquivProdArrow ι κ (Fin 2)) + (Equiv.sumArrowEquivProdArrow ι κ (Fin 2)) := by + rw [Fintype.sum_prod_type] + simp only [qmaXZThird_sum _ _ _ _ _ _ _ (hab _)] + rw [qmaThirdGadget_decomposition] + simp only [Matrix.zero_kronecker,zero_add,MediatorGraph.submatrix_sum,qmaThirdPiece_reindex,A,B,C] + have ht : qmaThirdSeriesTarget 0 A B C (fun e => (J e:ℂ)) = + ∑ e, (J e:ℂ) • qmaPauliWord (w e) := by + simp only [qmaThirdSeriesTarget,zero_add,A,B,C,hab,hvc] + rw [hsum,MediatorGraph.normalizedBottom_reindex,← ht] + apply qmaThirdGadget_polynomial_accuracy 0 A B C J (by norm_num) hN + Matrix.conjTranspose_zero (by simp) + (fun _ => qmaPauliWord_hermitian _) (fun _ => qmaPauliWord_hermitian _) + (fun _ => qmaPauliWord_hermitian _) + (fun _ => qmaPauliWord_square _) (fun _ => qmaPauliWord_square _) + (fun _ => qmaPauliWord_square _) habc hac hbc + (EuclideanSpace.single (fun _ : ι => (0:Fin 2)) (1:ℂ)) + simp [PiLp.norm_single] + +theorem qmaTwoLocalXZ_exists (w : κ → ι → Fin 4) (J : κ → ℝ) + (hw : ∀ e, (qmaPauliSupport (w e)).card ≤ 2) + (he : ∀ e, Even (qmaPauliYCount (w e))) {N : ℝ} (hN : 1 ≤ N) : + ∃ (v : ((κ × Fin 4) × Fin 7) → ((ι ⊕ κ) ⊕ (κ × Fin 4) → Fin 4)) + (K : ((κ × Fin 4) × Fin 7) → ℝ), + (∀ p i, v p i ≠ 2) ∧ (∀ p, (qmaPauliSupport (v p)).card ≤ 2) ∧ + |MediatorGraph.normalizedBottom (∑ p, (K p:ℂ) • qmaPauliWord (v p)) - + MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • qmaPauliWord (w e))| ≤ 1/N := by + have h2N : 1 ≤ 2*N := by linarith + obtain ⟨u,L,huy,hu,he₁⟩ := qmaYYReduction_exists w J hw he h2N + obtain ⟨v,K,hvy,hv,he₂⟩ := qmaXZThird_exists u L hu huy h2N + refine ⟨v,K,hvy,hv,?_⟩ + calc + _ ≤ |MediatorGraph.normalizedBottom (∑ p, (K p:ℂ) • qmaPauliWord (v p)) - + MediatorGraph.normalizedBottom (∑ p, (L p:ℂ) • qmaPauliWord (u p))| + + |MediatorGraph.normalizedBottom (∑ p, (L p:ℂ) • qmaPauliWord (u p)) - + MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • qmaPauliWord (w e))| := abs_sub_le _ _ _ + _ ≤ 1/(2*N)+1/(2*N) := add_le_add he₂ he₁ + _ = 1/N := by ring + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZSample.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZSample.lean new file mode 100644 index 0000000000000000000000000000000000000000..446579959c71bc3b5bf98d7334cf47e683b710bc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZSample.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZScalarSample + +namespace OAI + +/-! The sampled rational exchange Hamiltonian approximates the entire logical X/Z family. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumAxisSample +open Matrix +open scoped BigOperators Classical +variable {n : ℕ} {κ : Type*} [Fintype κ] + +def matrixValue (k : ℕ) (r : ℚ) (t : κ → QMAXZTerm n) (J : κ → ℚ) : + Matrix (SourceSpinBasis (n*4)) (SourceSpinBasis (n*4)) ℂ := + qmaExchangeMatrix + (qmaFourExchangeLeft (fun e => (qmaXZPairData t e).left) (fun e => (qmaXZPairData t e).right) + (fun e => (qmaXZFieldData t e).site)) + (qmaFourExchangeRight (fun e => (qmaXZPairData t e).left) (fun e => (qmaXZPairData t e).right) + (fun e => (qmaXZFieldData t e).site)) + (fun x => (weightValue k r + (fun e => (qmaXZPairData t e).axisLeft) (fun e => (qmaXZPairData t e).axisRight) + (fun e => J e.val) (fun e => (qmaXZFieldData t e).axis) (fun e => J e.val) x:ℝ)) + (scalarValue k r t J:ℝ) + +def matrixErrorBudget (r : ℚ) (t : κ → QMAXZTerm n) (J : κ → ℚ) : ℝ := + 3*(Fintype.card (QMAFourExchangeIndex n (QMAXZPairIndex t) (QMAXZFieldIndex t)):ℝ)* + weightErrorBudget (r:ℝ) (qmaXZInputSize (fun e => (J e:ℝ)))+320800*(∑ e, |(J e:ℝ)|) + +theorem matrixValue_error (k : ℕ) (r : ℚ) (t : κ → QMAXZTerm n) (J : κ → ℚ) : + |MediatorGraph.normalizedBottom (matrixValue k r t J)- + MediatorGraph.normalizedBottom (qmaXZBlockSource (r:ℝ) t (fun e => (J e:ℝ)))| ≤ + matrixErrorBudget r t J*(2:ℝ)⁻¹^k := by + have hB : 0 ≤ qmaXZInputSize (fun e => (J e:ℝ)) := by unfold qmaXZInputSize; positivity + have hJ (e : κ) : |(J e:ℝ)| ≤ qmaXZInputSize (fun e => (J e:ℝ)) := by + apply (Finset.single_le_sum (fun f _ => abs_nonneg (J f:ℝ)) (Finset.mem_univ e)).trans + unfold qmaXZInputSize + exact le_add_of_nonneg_left (Nat.cast_nonneg _) + exact weightValue_ground_error k r + (fun e => (qmaXZPairData t e).left) (fun e => (qmaXZPairData t e).right) + (fun e => (qmaXZPairData t e).distinct) + (fun e => (qmaXZPairData t e).axisLeft) (fun e => (qmaXZPairData t e).axisRight) + (fun e => J e.val) (fun e => (qmaXZFieldData t e).site) (fun e => (qmaXZFieldData t e).axis) + (fun e => J e.val) (scalarValue k r t J) (qmaXZFamilyConstant t (fun e => (J e:ℝ))) + (qmaXZInputSize (fun e => (J e:ℝ))) (320800*(∑ e, |(J e:ℝ)|)) hB + (fun e => hJ e.val) (fun e => hJ e.val) (scalarValue_error k r t J) + +def rationalInputSize (J : κ → ℚ) : ℚ := Fintype.card κ+∑ e, |J e| +def rationalBudget (J : κ → ℚ) : ℚ := 1+2000000*rationalInputSize J+(7056*rationalInputSize J)^2 +def rationalPenalty (N : ℕ) (J : κ → ℚ) : ℚ := 9*(rationalBudget J)^3*N + +theorem rationalBudget_cast (J : κ → ℚ) : + (rationalBudget J:ℝ) = qmaXZPolynomialBudget (fun e => (J e:ℝ)) := by + simp only [rationalBudget,rationalInputSize,qmaXZPolynomialBudget,qmaXZInputSize, + Rat.cast_add,Rat.cast_mul,Rat.cast_pow,Rat.cast_natCast,Rat.cast_ofNat,Rat.cast_sum,Rat.cast_abs,Rat.cast_one] + +theorem matrixValue_accuracy (k N : ℕ) (hN : 0 < N) (t : κ → QMAXZTerm n) (J : κ → ℚ) + (hprivate : ∀ e f, (qmaPauliSupport (t e).word).card = 2 → + qmaPauliSupport (t e).word = qmaPauliSupport (t f).word → e = f) : + |MediatorGraph.normalizedBottom (matrixValue k (rationalPenalty N J) t J)- + MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • (t e).matrix)| ≤ + matrixErrorBudget (rationalPenalty N J) t J*(2:ℝ)⁻¹^k+1/(N:ℝ) := by + have hsample := matrixValue_error k (rationalPenalty N J) t J + have hphys := qmaXZBlock_polynomial_accuracy t (fun e => (J e:ℝ)) hprivate N hN + have hcast : (rationalPenalty N J:ℝ) = 9*(qmaXZPolynomialBudget (fun e => (J e:ℝ)))^3*N := by + simp only [rationalPenalty,Rat.cast_mul,Rat.cast_pow,Rat.cast_natCast,Rat.cast_ofNat,rationalBudget_cast] + rw [← hcast] at hphys + simpa only [Complex.ofReal_ratCast] using (abs_sub_le _ _ _).trans (add_le_add hsample hphys) + +end ContinuumCoulomb.QuantumAxisSample + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZScalarSample.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZScalarSample.lean new file mode 100644 index 0000000000000000000000000000000000000000..5f48b134edb843b96154aba61db6e578ef695380 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZScalarSample.lean @@ -0,0 +1,58 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumExchangeSample + +namespace OAI + +/-! The computed scalar correction for the complete private-pair X/Z family. -/ + +noncomputable section +namespace ContinuumCoulomb.QuantumAxisSample +open Matrix +open scoped BigOperators Classical +variable {n : ℕ} {κ : Type*} [Fintype κ] + +theorem shiftValue_cast (a : Fin 2) (q : ℚ) : + (shiftValue a q:ℝ) = qmaFourAxisFieldShift a (q:ℝ) := by + unfold shiftValue qmaFourAxisFieldShift + split_ifs <;> norm_num + +def scalarValue (k : ℕ) (r : ℚ) (t : κ → QMAXZTerm n) (J : κ → ℚ) : ℚ := + r^2*(n*6)+(∑ e : QMAXZScalarIndex t, J e.val)- + (∑ e : QMAXZPairIndex t, offset k (qmaXZPairData t e).axisLeft (qmaXZPairData t e).axisRight (J e.val))- + ∑ e : QMAXZFieldIndex t, shiftValue (qmaXZFieldData t e).axis (J e.val) + +theorem scalarValue_sub (k : ℕ) (r : ℚ) (t : κ → QMAXZTerm n) (J : κ → ℚ) : + (scalarValue k r t J:ℝ)-qmaFourExchangeScalar n (r:ℝ) + (fun e => (qmaXZFieldData t e).axis) (fun e => (J e.val:ℝ)) + (qmaXZFamilyConstant t (fun e => (J e:ℝ))) = + ∑ e : QMAXZPairIndex t, + (qmaFourEnergyOffset (qmaXZPairData t e).axisLeft (qmaXZPairData t e).axisRight (J e.val:ℝ)- + (offset k (qmaXZPairData t e).axisLeft (qmaXZPairData t e).axisRight (J e.val):ℝ)) := by + simp only [scalarValue,qmaFourExchangeScalar,qmaXZFamilyConstant,qmaFourTensorFieldShift, + Rat.cast_sub,Rat.cast_add,Rat.cast_mul,Rat.cast_pow,Rat.cast_natCast,Rat.cast_ofNat, + Rat.cast_sum,shiftValue_cast,Finset.sum_sub_distrib] + ring + +theorem scalarValue_error (k : ℕ) (r : ℚ) (t : κ → QMAXZTerm n) (J : κ → ℚ) : + |(scalarValue k r t J:ℝ)-qmaFourExchangeScalar n (r:ℝ) + (fun e => (qmaXZFieldData t e).axis) (fun e => (J e.val:ℝ)) + (qmaXZFamilyConstant t (fun e => (J e:ℝ)))| ≤ + (320800*(∑ e, |(J e:ℝ)|))*(2:ℝ)⁻¹^k := by + rw [scalarValue_sub] + apply (Finset.abs_sum_le_sum_abs _ _).trans + calc + _ ≤ ∑ e : QMAXZPairIndex t, 320800*|(J e.val:ℝ)| *(2:ℝ)⁻¹^k := by + apply Finset.sum_le_sum + intro e _ + rw [abs_sub_comm] + exact offset_error k _ _ _ + _ = (320800*(∑ e : QMAXZPairIndex t, |(J e.val:ℝ)|))*(2:ℝ)⁻¹^k := by + rw [Finset.mul_sum,Finset.sum_mul] + _ ≤ _ := mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_left (qmaSum_subtype_abs_le (fun e => (t e).IsPair) (fun e => (J e:ℝ))) + (by norm_num)) (by positivity) + +end ContinuumCoulomb.QuantumAxisSample + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZSubdivision.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZSubdivision.lean new file mode 100644 index 0000000000000000000000000000000000000000..216d9a00b5100f3d8e2eba0fdc9e3123fec988f9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZSubdivision.lean @@ -0,0 +1,92 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliSingle +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionLocalFamily + +namespace OAI + +/-! Explicit X/Z Pauli output for subdivision, including its occupation term. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +def qmaXZSubdivisionWord (a b : ι → Fin 4) (e : κ) : Fin 4 → (ι ⊕ κ → Fin 4) := + ![fun _ => 0, Sum.elim (fun _ => 0) (qmaSinglePauliWord e 3), + Sum.elim a (qmaSinglePauliWord e 1), Sum.elim b (qmaSinglePauliWord e 1)] + +def qmaXZSubdivisionWeight (R j : ℝ) : Fin 4 → ℝ := + ![R^2/2+1+(j/2)^2, -R^2/2, R, -R*j/2] + +omit [DecidableEq ι] in +theorem qmaJoinOccupation_pauli (e : κ) : + qmaJoinMatrix (1 : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (qmaAncillaOccupation e) = + (1/2:ℂ) • (1-qmaPauliWord (Sum.elim (fun _ : ι => 0) (qmaSinglePauliWord e 3))) := by + rw [← qmaPauliWord_join,qmaPauliWord_zero,qmaAncillaOccupation_pauli] + ext s t + simp only [qmaJoinMatrix,Matrix.submatrix_apply,Matrix.kroneckerMap_apply, + Matrix.smul_apply,Matrix.sub_apply,Matrix.one_apply] + have he : (s = t) ↔ + ((Equiv.sumArrowEquivProdArrow ι κ (Fin 2)) s).1 = + ((Equiv.sumArrowEquivProdArrow ι κ (Fin 2)) t).1 ∧ + ((Equiv.sumArrowEquivProdArrow ι κ (Fin 2)) s).2 = + ((Equiv.sumArrowEquivProdArrow ι κ (Fin 2)) t).2 := by + constructor + · rintro rfl + exact ⟨rfl,rfl⟩ + · intro h + apply (Equiv.sumArrowEquivProdArrow ι κ (Fin 2)).injective + exact Prod.ext h.1 h.2 + simp only [smul_eq_mul,he,ite_and] + split_ifs <;> ring + +omit [DecidableEq ι] in +theorem qmaXZSubdivision_sum (a b : ι → Fin 4) (e : κ) (R j : ℝ) : + (∑ k, (qmaXZSubdivisionWeight R j k : ℂ) • qmaPauliWord (qmaXZSubdivisionWord a b e k)) = + ∑ k, qmaSubdivisionLocalPiece (qmaPauliWord a) (qmaPauliWord b) e R j (fun _ => false) k := by + have hflip : qmaPolarizedFlip (fun _ : κ => false) e = qmaBitFlipMatrix e := by + simp [qmaPolarizedFlip_eq] + simp only [qmaXZSubdivisionWord,qmaXZSubdivisionWeight,qmaSubdivisionLocalPiece, + Fin.sum_univ_succ,Fin.sum_univ_zero,Matrix.cons_val_zero,Matrix.cons_val_succ,add_zero, + qmaPauliWord_zero,← qmaPauliWord_join,qmaSinglePauliWord_X,hflip, + qmaJoinOccupation_pauli] + have hr (r : ℝ) (M : Matrix (ι ⊕ κ → Fin 2) (ι ⊕ κ → Fin 2) ℂ) : + r • M = (r:ℂ) • M := rfl + simp only [hr] + push_cast + module + +omit [Fintype ι] [DecidableEq ι] [Fintype κ] in +theorem qmaXZSubdivision_noY (a b : ι → Fin 4) (e : κ) + (ha : ∀ i, a i ≠ 2) (hb : ∀ i, b i ≠ 2) (k : Fin 4) (x : ι ⊕ κ) : + qmaXZSubdivisionWord a b e k x ≠ 2 := by + fin_cases k <;> cases x <;> simp [qmaXZSubdivisionWord,qmaSinglePauliWord,ha,hb] <;> split_ifs <;> decide + +theorem qmaXZSubdivision_support (a b : ι → Fin 4) (e : κ) {d : ℕ} + (ha : (qmaPauliSupport a).card ≤ d) (hb : (qmaPauliSupport b).card ≤ d) (k : Fin 4) : + (qmaPauliSupport (qmaXZSubdivisionWord a b e k)).card ≤ d+1 := by + have hs (i : Fin 4) : (qmaPauliSupport (qmaSinglePauliWord e i)).card ≤ 1 := + (Finset.card_le_card (qmaSinglePauliWord_support e i)).trans (by simp) + fin_cases k + · change (qmaPauliSupport (fun _ : ι ⊕ κ => 0)).card ≤ d+1 + simp [qmaPauliSupport] + · change (qmaPauliSupport (Sum.elim (fun _ : ι => 0) (qmaSinglePauliWord e 3))).card ≤ d+1 + rw [qmaPauliSupport_join_card] + have hz : (qmaPauliSupport (fun _ : ι => 0)).card = 0 := by simp [qmaPauliSupport] + rw [hz] + have := hs 3 + omega + · change (qmaPauliSupport (Sum.elim a (qmaSinglePauliWord e 1))).card ≤ d+1 + rw [qmaPauliSupport_join_card] + have := hs 1 + omega + · change (qmaPauliSupport (Sum.elim b (qmaSinglePauliWord e 1))).card ≤ d+1 + rw [qmaPauliSupport_join_card] + have := hs 1 + omega + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZSupportFactors.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZSupportFactors.lean new file mode 100644 index 0000000000000000000000000000000000000000..28e8fcfec06a2d280131b28e5502e884097c5037 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZSupportFactors.lean @@ -0,0 +1,91 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumYYElimination +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZTriple + +namespace OAI + +/-! X/Z factorizations can be chosen inside the original Pauli support. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +theorem qmaTwoPauliYY_support_eq (i j : ι) : + qmaPauliSupport (qmaTwoPauliWord i j 2 2) = {i,j} := by + ext k + simp only [qmaPauliSupport,Finset.mem_filter,Finset.mem_univ,true_and, + Finset.mem_insert,Finset.mem_singleton] + by_cases hki : k = i <;> by_cases hkj : k = j <;> + simp [qmaTwoPauliWord,hki,hkj] + +theorem qmaTwoLocalEvenXZ_supported (w : ι → Fin 4) + (hw : (qmaPauliSupport w).card ≤ 2) (he : Even (qmaPauliYCount w)) : + ∃ a b : ι → Fin 4, qmaPauliSupport a ⊆ qmaPauliSupport w ∧ + qmaPauliSupport b ⊆ qmaPauliSupport w ∧ (∀ i, a i ≠ 2) ∧ (∀ i, b i ≠ 2) ∧ + (qmaPauliSupport a).card ≤ 2 ∧ (qmaPauliSupport b).card ≤ 2 ∧ + qmaPauliWord a*qmaPauliWord b = qmaPauliWord w ∧ + qmaPauliWord a*qmaPauliWord b = qmaPauliWord b*qmaPauliWord a := by + rcases qmaTwoLocalEvenY_cases w hw he with h | ⟨i,j,hij,rfl⟩ + · refine ⟨w,fun _ => 0,Finset.Subset.refl _,by simp [qmaPauliSupport],h,by simp,hw,?_,?_,?_⟩ + · simp [qmaPauliSupport] + · rw [qmaPauliWord_zero,Matrix.mul_one] + · rw [qmaPauliWord_zero,Matrix.mul_one,Matrix.one_mul] + · refine ⟨qmaTwoPauliWord i j 1 3,qmaTwoPauliWord i j 3 1, + (qmaTwoPauliWord_support i j 1 3).trans_eq (qmaTwoPauliYY_support_eq i j).symm, + (qmaTwoPauliWord_support i j 3 1).trans_eq (qmaTwoPauliYY_support_eq i j).symm,?_,?_,?_,?_, + qmaYY_factor i j hij,qmaYY_factor_commute i j hij⟩ + · intro k + simp only [qmaTwoPauliWord] + split_ifs <;> decide + · intro k + simp only [qmaTwoPauliWord] + split_ifs <;> decide + · exact (Finset.card_le_card (qmaTwoPauliWord_support i j 1 3)).trans (Finset.card_insert_le _ _) + · exact (Finset.card_le_card (qmaTwoPauliWord_support i j 3 1)).trans (Finset.card_insert_le _ _) + + +theorem qmaXZTriple_supported (w : ι → Fin 4) (hw : (qmaPauliSupport w).card ≤ 3) + (hy : ∀ i, w i ≠ 2) : + ∃ a b c v : ι → Fin 4, + qmaPauliSupport a ⊆ qmaPauliSupport w ∧ qmaPauliSupport b ⊆ qmaPauliSupport w ∧ + qmaPauliSupport c ⊆ qmaPauliSupport w ∧ qmaPauliSupport v ⊆ qmaPauliSupport w ∧ + (∀ i, a i ≠ 2) ∧ (∀ i, b i ≠ 2) ∧ (∀ i, c i ≠ 2) ∧ (∀ i, v i ≠ 2) ∧ + (qmaPauliSupport a).card ≤ 1 ∧ (qmaPauliSupport b).card ≤ 1 ∧ + (qmaPauliSupport c).card ≤ 1 ∧ (qmaPauliSupport v).card ≤ 2 ∧ + qmaPauliWord a*qmaPauliWord b = qmaPauliWord v ∧ + qmaPauliWord v*qmaPauliWord c = qmaPauliWord w ∧ + qmaPauliWord a*qmaPauliWord b = qmaPauliWord b*qmaPauliWord a ∧ + qmaPauliWord a*qmaPauliWord c = qmaPauliWord c*qmaPauliWord a ∧ + qmaPauliWord b*qmaPauliWord c = qmaPauliWord c*qmaPauliWord b := by + have he : Even (qmaPauliYCount w) := by rw [qmaPauliYCount_zero w hy]; norm_num + obtain ⟨P,C,hP,hC,hPC,hcover,_⟩ := qmaThreeSupport_split w hw he + obtain ⟨L,T,hL,hT,hLT,hunion⟩ := qmaBalancedSupport P 1 (by omega) + have hLP : L ⊆ P := by rw [← hunion]; exact Finset.subset_union_left + have hTP : T ⊆ P := by rw [← hunion]; exact Finset.subset_union_right + have hPS : P ⊆ qmaPauliSupport w := by rw [←hcover]; exact Finset.subset_union_left + have hCS : C ⊆ qmaPauliSupport w := by rw [←hcover]; exact Finset.subset_union_right + refine ⟨qmaPauliRestrict L w,qmaPauliRestrict T w,qmaPauliRestrict C w, + qmaPauliRestrict P w,(qmaPauliRestrict_support L w).trans (hLP.trans hPS), + (qmaPauliRestrict_support T w).trans (hTP.trans hPS), + (qmaPauliRestrict_support C w).trans hCS,(qmaPauliRestrict_support P w).trans hPS, + qmaPauliRestrict_noY _ _ hy,qmaPauliRestrict_noY _ _ hy, + qmaPauliRestrict_noY _ _ hy,qmaPauliRestrict_noY _ _ hy, + (Finset.card_le_card (qmaPauliRestrict_support L w)).trans hL, + (Finset.card_le_card (qmaPauliRestrict_support T w)).trans hT, + (Finset.card_le_card (qmaPauliRestrict_support C w)).trans hC, + (Finset.card_le_card (qmaPauliRestrict_support P w)).trans hP,?_,?_, + qmaPauliRestrict_commute L T w hLT, + qmaPauliRestrict_commute L C w (hPC.mono_left hLP), + qmaPauliRestrict_commute T C w (hPC.mono_left hTP)⟩ + · have h := qmaPauliRestrict_factor L T (qmaPauliRestrict P w) hLT + (by rw [hunion]; exact qmaPauliRestrict_support P w) + simpa only [qmaPauliRestrict_restrict L P w hLP,qmaPauliRestrict_restrict T P w hTP] using h + · exact qmaPauliRestrict_factor P C w hPC (by rw [hcover]) + + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZSupported.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZSupported.lean new file mode 100644 index 0000000000000000000000000000000000000000..ac9dec4de55a14508374d5693e18fd7054f0f649 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZSupported.lean @@ -0,0 +1,42 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumYYSupported +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZThirdSupported + +namespace OAI + +/-! Two-local X/Z reduction with a nested, explicit mediator support. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +theorem qmaTwoLocalXZ_supported (w : κ → ι → Fin 4) (J : κ → ℝ) + (hw : ∀ e, (qmaPauliSupport (w e)).card ≤ 2) + (he : ∀ e, Even (qmaPauliYCount (w e))) {N : ℝ} (hN : 1 ≤ N) : + ∃ (v : ((κ × Fin 4) × Fin 7) → ((ι ⊕ κ) ⊕ (κ × Fin 4) → Fin 4)) + (K : ((κ × Fin 4) × Fin 7) → ℝ), + (∀ p i, v p i ≠ 2) ∧ (∀ p, (qmaPauliSupport (v p)).card ≤ 2) ∧ + (∀ p, qmaPauliSupport (v p) ⊆ + qmaMediatorSupport (qmaMediatorSupport (qmaPauliSupport (w p.1.1)) p.1.1) p.1) ∧ + |MediatorGraph.normalizedBottom (∑ p, (K p:ℂ) • qmaPauliWord (v p)) - + MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • qmaPauliWord (w e))| ≤ 1/N := by + have h2N : 1 ≤ 2*N := by linarith + obtain ⟨u,L,huy,hu,hus,he₁⟩ := qmaYYReduction_supported w J hw he h2N + obtain ⟨v,K,hvy,hv,hvs,he₂⟩ := qmaXZThird_supported u L hu huy h2N + refine ⟨v,K,hvy,hv,?_,?_⟩ + · intro p + exact (hvs p).trans (qmaMediatorSupport_mono (hus p.1) p.1) + · calc + _ ≤ |MediatorGraph.normalizedBottom (∑ p, (K p:ℂ) • qmaPauliWord (v p)) - + MediatorGraph.normalizedBottom (∑ p, (L p:ℂ) • qmaPauliWord (u p))| + + |MediatorGraph.normalizedBottom (∑ p, (L p:ℂ) • qmaPauliWord (u p)) - + MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • qmaPauliWord (w e))| := abs_sub_le _ _ _ + _ ≤ 1/(2*N)+1/(2*N) := add_le_add he₂ he₁ + _ = 1/N := by ring + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZTerms.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZTerms.lean new file mode 100644 index 0000000000000000000000000000000000000000..bee82a9c1e28112b95f2419a9191d080826335f8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZTerms.lean @@ -0,0 +1,104 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumFourTensorFamilyAccuracy +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZPrivate + +namespace OAI + +/-! Explicit scalar, one-site and two-site terms for the X/Z circuit family. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +def qmaXZLabel (a : Fin 2) : Fin 4 := if a = 0 then 1 else 3 + +theorem qmaXZLabel_exists (i : Fin 4) (hi : i ≠ 0) (hy : i ≠ 2) : + ∃ a : Fin 2, qmaXZLabel a = i := by + fin_cases i + · exact (hi rfl).elim + · exact ⟨0,rfl⟩ + · exact (hy rfl).elim + · exact ⟨1,rfl⟩ + +theorem qmaXZLabel_pauli (a : Fin 2) : qmaPauli (qmaXZLabel a) = qmaFourAxis a := by + fin_cases a <;> rfl + +inductive QMAXZTerm (n : ℕ) where + | scalar + | field (i : Fin n) (a : Fin 2) + | pair (i j : Fin n) (hij : i ≠ j) (a b : Fin 2) + +def QMAXZTerm.word {n : ℕ} : QMAXZTerm n → Fin n → Fin 4 + | .scalar => fun _ => 0 + | .field i a => fun k => if k = i then qmaXZLabel a else 0 + | .pair i j _ a b => fun k => if k = i then qmaXZLabel a else if k = j then qmaXZLabel b else 0 + +def QMAXZTerm.matrix {n : ℕ} : QMAXZTerm n → Matrix (Fin n → Fin 2) (Fin n → Fin 2) ℂ + | .scalar => 1 + | .field i a => qmaSiteMatrix i (qmaFourAxis a) + | .pair i j _ a b => qmaPairMatrix i j (qmaFourAxis a) (qmaFourAxis b) + +theorem QMAXZTerm.word_matrix {n : ℕ} (t : QMAXZTerm n) : qmaPauliWord t.word = t.matrix := by + change qmaTensorMatrix (fun k => qmaPauli (t.word k)) = _ + cases t with + | scalar => + simpa only [QMAXZTerm.word,QMAXZTerm.matrix,qmaPauli_zero] using qmaTensorMatrix_one (Q := Fin n) (σ := Fin 2) + | field i a => + change qmaTensorMatrix _ = qmaSiteMatrix i (qmaFourAxis a) + rw [qmaSiteMatrix] + congr 1 + funext k + by_cases h : k = i <;> simp only [QMAXZTerm.word,h,ite_true,ite_false,qmaXZLabel_pauli,qmaPauli_zero] + | pair i j hij a b => + change qmaTensorMatrix _ = qmaPairMatrix i j (qmaFourAxis a) (qmaFourAxis b) + rw [qmaPairMatrix] + congr 1 + funext k + by_cases hi : k = i + · simp only [QMAXZTerm.word,hi,ite_true,qmaXZLabel_pauli] + · by_cases hj : k = j + · subst k + simp only [QMAXZTerm.word,hi,ite_true,ite_false,qmaXZLabel_pauli] + · simp only [QMAXZTerm.word,hi,hj,ite_false,qmaPauli_zero] + +theorem qmaXZWord_term {n : ℕ} (w : Fin n → Fin 4) + (hy : ∀ i, w i ≠ 2) (hw : (qmaPauliSupport w).card ≤ 2) : + ∃ t : QMAXZTerm n, t.word = w := by + have hout (i : Fin n) (hi : i ∉ qmaPauliSupport w) : w i = 0 := by + simpa only [qmaPauliSupport,Finset.mem_filter,Finset.mem_univ,true_and,not_not] using hi + have hin (i : Fin n) (hi : i ∈ qmaPauliSupport w) : w i ≠ 0 := + (Finset.mem_filter.mp hi).2 + have hcases : (qmaPauliSupport w).card = 0 ∨ (qmaPauliSupport w).card = 1 ∨ + (qmaPauliSupport w).card = 2 := by omega + rcases hcases with hzero | hone | htwo + · have hz := Finset.card_eq_zero.mp hzero + refine ⟨.scalar,?_⟩ + funext i + exact (hout i (by simp [hz])).symm + · obtain ⟨i,hi⟩ := Finset.card_eq_one.mp hone + obtain ⟨a,ha⟩ := qmaXZLabel_exists (w i) (hin i (by rw [hi]; exact Finset.mem_singleton_self i)) (hy i) + refine ⟨.field i a,?_⟩ + funext k + by_cases hk : k = i + · subst k + simpa only [QMAXZTerm.word,ite_true] using ha + · simpa only [QMAXZTerm.word,hk,ite_false] using + (hout k (by simpa only [hi,Finset.mem_singleton] using hk)).symm + · obtain ⟨i,j,hij,hijset⟩ := Finset.card_eq_two.mp htwo + obtain ⟨a,ha⟩ := qmaXZLabel_exists (w i) (hin i (by rw [hijset]; simp)) (hy i) + obtain ⟨b,hb⟩ := qmaXZLabel_exists (w j) (hin j (by rw [hijset]; simp)) (hy j) + refine ⟨.pair i j hij a b,?_⟩ + funext k + by_cases hki : k = i + · subst k + simpa only [QMAXZTerm.word,ite_true] using ha + · by_cases hkj : k = j + · subst k + simpa only [QMAXZTerm.word,Ne.symm hij,ite_false,ite_true] using hb + · simpa only [QMAXZTerm.word,hki,hkj,ite_false] using (hout k (by simp [hijset,hki,hkj])).symm + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZThird.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZThird.lean new file mode 100644 index 0000000000000000000000000000000000000000..ebfb2821e463b299669b769f3b7d2b723511d1da --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZThird.lean @@ -0,0 +1,90 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZSubdivision +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZTriple + +namespace OAI + +/-! Seven explicit X/Z words for the third-order three-to-two-local gadget. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +def qmaXZThirdWord (a b c v : ι → Fin 4) (e : κ) : Fin 7 → (ι ⊕ κ → Fin 4) := + ![fun _ => 0, Sum.elim (fun _ => 0) (qmaSinglePauliWord e 3), + Sum.elim v (fun _ => 0), Sum.elim c (fun _ => 0), + Sum.elim c (qmaSinglePauliWord e 3), + Sum.elim a (qmaSinglePauliWord e 1), Sum.elim b (qmaSinglePauliWord e 1)] + +def qmaXZThirdWeight (R j : ℝ) : Fin 7 → ℝ := + ![R^3/2+R*(1+(j/2)^2), -R^3/2, R*j, R^2/2-(1+(j/2)^2), + -R^2/2, R^2, R^2*j/2] + +omit [Fintype ι] [DecidableEq ι] in +theorem qmaJoinOccupation_expand (M : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (e : κ) : + qmaJoinMatrix M (qmaAncillaOccupation e) = (1/2:ℂ) • + (qmaJoinMatrix M 1-qmaJoinMatrix M (qmaPauliWord (qmaSinglePauliWord e 3))) := by + rw [qmaAncillaOccupation_pauli] + ext s t + simp only [qmaJoinMatrix,Matrix.submatrix_apply,Matrix.kroneckerMap_apply, + Matrix.smul_apply,Matrix.sub_apply,smul_eq_mul] + ring + +theorem qmaXZThird_sum (a b c v : ι → Fin 4) (e : κ) (R j : ℝ) + (hab : qmaPauliWord a*qmaPauliWord b = qmaPauliWord v) : + (∑ k, (qmaXZThirdWeight R j k : ℂ) • qmaPauliWord (qmaXZThirdWord a b c v e k)) = + ∑ k, qmaThirdLocalPiece (qmaPauliWord a) (qmaPauliWord b) (qmaPauliWord c) e R j k := by + have hI : qmaJoinMatrix (1 : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ) = 1 := by + simp [qmaJoinMatrix,Matrix.submatrix_one_equiv] + simp only [qmaXZThirdWord,qmaXZThirdWeight,qmaThirdLocalPiece, + Fin.sum_univ_succ,Fin.sum_univ_zero,Matrix.cons_val_zero,Matrix.cons_val_succ,add_zero, + qmaPauliWord_zero,← qmaPauliWord_join,qmaSinglePauliWord_X, + qmaJoinOccupation_expand,hI,hab] + have hr (r : ℝ) (M : Matrix (ι ⊕ κ → Fin 2) (ι ⊕ κ → Fin 2) ℂ) : + r • M = (r:ℂ) • M := rfl + simp only [hr] + push_cast + module + +omit [Fintype ι] [DecidableEq ι] [Fintype κ] in +theorem qmaXZThird_noY (a b c v : ι → Fin 4) (e : κ) + (ha : ∀ i, a i ≠ 2) (hb : ∀ i, b i ≠ 2) (hc : ∀ i, c i ≠ 2) (hv : ∀ i, v i ≠ 2) + (k : Fin 7) (x : ι ⊕ κ) : qmaXZThirdWord a b c v e k x ≠ 2 := by + fin_cases k <;> cases x <;> + simp [qmaXZThirdWord,qmaSinglePauliWord,ha,hb,hc,hv] <;> split_ifs <;> decide + +theorem qmaXZThird_support (a b c v : ι → Fin 4) (e : κ) + (ha : (qmaPauliSupport a).card ≤ 1) (hb : (qmaPauliSupport b).card ≤ 1) + (hc : (qmaPauliSupport c).card ≤ 1) (hv : (qmaPauliSupport v).card ≤ 2) (k : Fin 7) : + (qmaPauliSupport (qmaXZThirdWord a b c v e k)).card ≤ 2 := by + have hzι : (qmaPauliSupport (fun _ : ι => 0)).card = 0 := by simp [qmaPauliSupport] + have hzκ : (qmaPauliSupport (fun _ : κ => 0)).card = 0 := by simp [qmaPauliSupport] + have hs (i : Fin 4) : (qmaPauliSupport (qmaSinglePauliWord e i)).card ≤ 1 := + (Finset.card_le_card (qmaSinglePauliWord_support e i)).trans (by simp) + fin_cases k + · change (qmaPauliSupport (fun _ : ι ⊕ κ => 0)).card ≤ 2 + simp [qmaPauliSupport] + · change (qmaPauliSupport (Sum.elim (fun _ : ι => 0) (qmaSinglePauliWord e 3))).card ≤ 2 + rw [qmaPauliSupport_join_card,hzι] + simpa using (hs 3).trans (by norm_num : 1 ≤ 2) + · change (qmaPauliSupport (Sum.elim v (fun _ : κ => 0))).card ≤ 2 + simpa only [qmaPauliSupport_join_card,hzκ,add_zero] using hv + · change (qmaPauliSupport (Sum.elim c (fun _ : κ => 0))).card ≤ 2 + simpa only [qmaPauliSupport_join_card,hzκ,add_zero] using hc.trans (by norm_num : 1 ≤ 2) + · change (qmaPauliSupport (Sum.elim c (qmaSinglePauliWord e 3))).card ≤ 2 + rw [qmaPauliSupport_join_card] + exact (Nat.add_le_add hc (hs 3)).trans (by norm_num) + · change (qmaPauliSupport (Sum.elim a (qmaSinglePauliWord e 1))).card ≤ 2 + rw [qmaPauliSupport_join_card] + exact (Nat.add_le_add ha (hs 1)).trans (by norm_num) + · change (qmaPauliSupport (Sum.elim b (qmaSinglePauliWord e 1))).card ≤ 2 + rw [qmaPauliSupport_join_card] + exact (Nat.add_le_add hb (hs 1)).trans (by norm_num) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZThirdSupported.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZThirdSupported.lean new file mode 100644 index 0000000000000000000000000000000000000000..268572a5493eae2f4ccf45940abd2093ac1d1b71 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZThirdSupported.lean @@ -0,0 +1,64 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZReduction +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZSupportFactors +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZEnvelopes + +namespace OAI + +/-! X/Z third-order reduction preserves an explicit support envelope for every emitted term. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +theorem qmaXZThird_supported (w : κ → ι → Fin 4) (J : κ → ℝ) + (hw : ∀ e, (qmaPauliSupport (w e)).card ≤ 3) + (hy : ∀ e i, w e i ≠ 2) {N : ℝ} (hN : 1 ≤ N) : + ∃ (v : (κ × Fin 7) → (ι ⊕ κ → Fin 4)) (K : (κ × Fin 7) → ℝ), + (∀ p i, v p i ≠ 2) ∧ (∀ p, (qmaPauliSupport (v p)).card ≤ 2) ∧ + (∀ p, qmaPauliSupport (v p) ⊆ qmaMediatorSupport (qmaPauliSupport (w p.1)) p.1) ∧ + |MediatorGraph.normalizedBottom (∑ p, (K p:ℂ) • qmaPauliWord (v p)) - + MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • qmaPauliWord (w e))| ≤ 1/N := by + choose a b c v has hbs hcs hvs hay hby hcy hvy ha hb hc hv hab hvc habc hac hbc using + fun e => qmaXZTriple_supported (w e) (hw e) (hy e) + let A := fun e => qmaPauliWord (a e) + let B := fun e => qmaPauliWord (b e) + let C := fun e => qmaPauliWord (c e) + let R := 8*(qmaThirdBudget 0 J)^4*N + refine ⟨fun p => qmaXZThirdWord (a p.1) (b p.1) (c p.1) (v p.1) p.1 p.2, + fun p => qmaXZThirdWeight R (J p.1) p.2,?_,?_,?_,?_⟩ + · intro p i + exact qmaXZThird_noY _ _ _ _ _ (hay p.1) (hby p.1) (hcy p.1) (hvy p.1) _ _ + · intro p + exact qmaXZThird_support _ _ _ _ _ (ha p.1) (hb p.1) (hc p.1) (hv p.1) _ + · intro p + exact qmaXZThirdWord_envelope _ _ _ _ _ (has p.1) (hbs p.1) (hcs p.1) (hvs p.1) p.2 + · have hsum : (∑ p : κ × Fin 7, (qmaXZThirdWeight R (J p.1) p.2 : ℂ) • + qmaPauliWord (qmaXZThirdWord (a p.1) (b p.1) (c p.1) (v p.1) p.1 p.2)) = + (qmaThirdGadget 0 A B C R J).submatrix + (Equiv.sumArrowEquivProdArrow ι κ (Fin 2)) + (Equiv.sumArrowEquivProdArrow ι κ (Fin 2)) := by + rw [Fintype.sum_prod_type] + simp only [qmaXZThird_sum _ _ _ _ _ _ _ (hab _)] + rw [qmaThirdGadget_decomposition] + simp only [Matrix.zero_kronecker,zero_add,MediatorGraph.submatrix_sum,qmaThirdPiece_reindex,A,B,C] + have ht : qmaThirdSeriesTarget 0 A B C (fun e => (J e:ℂ)) = + ∑ e, (J e:ℂ) • qmaPauliWord (w e) := by + simp only [qmaThirdSeriesTarget,zero_add,A,B,C,hab,hvc] + rw [hsum,MediatorGraph.normalizedBottom_reindex,← ht] + apply qmaThirdGadget_polynomial_accuracy 0 A B C J (by norm_num) hN + Matrix.conjTranspose_zero (by simp) + (fun _ => qmaPauliWord_hermitian _) (fun _ => qmaPauliWord_hermitian _) + (fun _ => qmaPauliWord_hermitian _) + (fun _ => qmaPauliWord_square _) (fun _ => qmaPauliWord_square _) + (fun _ => qmaPauliWord_square _) habc hac hbc + (EuclideanSpace.single (fun _ : ι => (0:Fin 2)) (1:ℂ)) + simp [PiLp.norm_single] + + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZTriple.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZTriple.lean new file mode 100644 index 0000000000000000000000000000000000000000..b72d470e768fbffbaee0efcece9741e6821f5aac --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumXZTriple.lean @@ -0,0 +1,57 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliTripleSplit + +namespace OAI + +/-! Disjoint single-site X/Z factors, retaining their explicit two-site product. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +omit [Fintype ι] in +theorem qmaPauliRestrict_noY (S : Finset ι) (w : ι → Fin 4) (hw : ∀ i, w i ≠ 2) : + ∀ i, qmaPauliRestrict S w i ≠ 2 := by + intro i + simp only [qmaPauliRestrict] + split_ifs + · exact hw i + · decide + +theorem qmaXZTripleFactor (w : ι → Fin 4) (hw : (qmaPauliSupport w).card ≤ 3) + (hy : ∀ i, w i ≠ 2) : + ∃ a b c v : ι → Fin 4, + (∀ i, a i ≠ 2) ∧ (∀ i, b i ≠ 2) ∧ (∀ i, c i ≠ 2) ∧ (∀ i, v i ≠ 2) ∧ + (qmaPauliSupport a).card ≤ 1 ∧ (qmaPauliSupport b).card ≤ 1 ∧ + (qmaPauliSupport c).card ≤ 1 ∧ (qmaPauliSupport v).card ≤ 2 ∧ + qmaPauliWord a*qmaPauliWord b = qmaPauliWord v ∧ + qmaPauliWord v*qmaPauliWord c = qmaPauliWord w ∧ + qmaPauliWord a*qmaPauliWord b = qmaPauliWord b*qmaPauliWord a ∧ + qmaPauliWord a*qmaPauliWord c = qmaPauliWord c*qmaPauliWord a ∧ + qmaPauliWord b*qmaPauliWord c = qmaPauliWord c*qmaPauliWord b := by + have he : Even (qmaPauliYCount w) := by rw [qmaPauliYCount_zero w hy]; norm_num + obtain ⟨P,C,hP,hC,hPC,hcover,_⟩ := qmaThreeSupport_split w hw he + obtain ⟨L,T,hL,hT,hLT,hunion⟩ := qmaBalancedSupport P 1 (by omega) + have hLP : L ⊆ P := by rw [← hunion]; exact Finset.subset_union_left + have hTP : T ⊆ P := by rw [← hunion]; exact Finset.subset_union_right + refine ⟨qmaPauliRestrict L w,qmaPauliRestrict T w,qmaPauliRestrict C w, + qmaPauliRestrict P w,qmaPauliRestrict_noY _ _ hy,qmaPauliRestrict_noY _ _ hy, + qmaPauliRestrict_noY _ _ hy,qmaPauliRestrict_noY _ _ hy, + (Finset.card_le_card (qmaPauliRestrict_support L w)).trans hL, + (Finset.card_le_card (qmaPauliRestrict_support T w)).trans hT, + (Finset.card_le_card (qmaPauliRestrict_support C w)).trans hC, + (Finset.card_le_card (qmaPauliRestrict_support P w)).trans hP,?_,?_, + qmaPauliRestrict_commute L T w hLT, + qmaPauliRestrict_commute L C w (hPC.mono_left hLP), + qmaPauliRestrict_commute T C w (hPC.mono_left hTP)⟩ + · have h := qmaPauliRestrict_factor L T (qmaPauliRestrict P w) hLT + (by rw [hunion]; exact qmaPauliRestrict_support P w) + simpa only [qmaPauliRestrict_restrict L P w hLP,qmaPauliRestrict_restrict T P w hTP] using h + · exact qmaPauliRestrict_factor P C w hPC (by rw [hcover]) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumYYElimination.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumYYElimination.lean new file mode 100644 index 0000000000000000000000000000000000000000..28f0700940d5fe896b031c27a0ebaecd9757827b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumYYElimination.lean @@ -0,0 +1,87 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumYYFactor + +namespace OAI + +/-! The only Y-containing real two-local Pauli words are YY words. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +omit [DecidableEq ι] in +theorem qmaPauliWord_zero : qmaPauliWord (fun _ : ι => 0) = 1 := by + ext s t + simp only [qmaPauliWord,qmaPauli_zero,Matrix.one_apply] + by_cases h : s = t + · subst t + simp + · rw [ite_eq_right h] + obtain ⟨i,hi⟩ := Function.ne_iff.mp h + exact Finset.prod_eq_zero (Finset.mem_univ i) (ite_eq_right hi) + +theorem qmaTwoLocalEvenY_cases (w : ι → Fin 4) + (hw : (qmaPauliSupport w).card ≤ 2) (he : Even (qmaPauliYCount w)) : + (∀ i, w i ≠ 2) ∨ ∃ i j, i ≠ j ∧ w = qmaTwoPauliWord i j 2 2 := by + by_cases hnone : ∀ i, w i ≠ 2 + · exact Or.inl hnone + · right + push Not at hnone + obtain ⟨i,hi⟩ := hnone + let Y := Finset.univ.filter (fun k => w k = 2) + have hsub : Y ⊆ qmaPauliSupport w := by + intro k hk + have h := (Finset.mem_filter.mp hk).2 + simp [qmaPauliSupport,h] + have hpos : 0 < Y.card := Finset.card_pos.mpr ⟨i,by simp [Y,hi]⟩ + have hbound : Y.card ≤ 2 := (Finset.card_le_card hsub).trans hw + have hcard : Y.card = 2 := by + change Even Y.card at he + obtain ⟨k,hk⟩ := he + omega + obtain ⟨a,b,hab,hY⟩ := Finset.card_eq_two.mp hcard + have hsupport : Y = qmaPauliSupport w := + Finset.eq_of_subset_of_card_le hsub (by rw [hcard]; exact hw) + have ha : w a = 2 := (Finset.mem_filter.mp (show a ∈ Y by rw [hY]; simp)).2 + have hb : w b = 2 := (Finset.mem_filter.mp (show b ∈ Y by rw [hY]; simp)).2 + refine ⟨a,b,hab,?_⟩ + funext k + by_cases hka : k = a + · simp [qmaTwoPauliWord,hka,ha] + · by_cases hkb : k = b + · simp [qmaTwoPauliWord,hkb,hb,Ne.symm hab] + · have hz : w k = 0 := by + by_contra hn + have hk : k ∈ qmaPauliSupport w := by simp [qmaPauliSupport,hn] + rw [← hsupport,hY] at hk + simp [hka,hkb] at hk + simp [qmaTwoPauliWord,hka,hkb,hz] + +theorem qmaTwoLocalEvenXZFactor (w : ι → Fin 4) + (hw : (qmaPauliSupport w).card ≤ 2) (he : Even (qmaPauliYCount w)) : + ∃ a b : ι → Fin 4, (∀ i, a i ≠ 2) ∧ (∀ i, b i ≠ 2) ∧ + (qmaPauliSupport a).card ≤ 2 ∧ (qmaPauliSupport b).card ≤ 2 ∧ + qmaPauliWord a*qmaPauliWord b = qmaPauliWord w ∧ + qmaPauliWord a*qmaPauliWord b = qmaPauliWord b*qmaPauliWord a := by + rcases qmaTwoLocalEvenY_cases w hw he with h | ⟨i,j,hij,rfl⟩ + · refine ⟨w,fun _ => 0,h,by simp,hw,?_,?_,?_⟩ + · simp [qmaPauliSupport] + · rw [qmaPauliWord_zero,Matrix.mul_one] + · rw [qmaPauliWord_zero,Matrix.mul_one,Matrix.one_mul] + · refine ⟨qmaTwoPauliWord i j 1 3,qmaTwoPauliWord i j 3 1,?_,?_,?_,?_, + qmaYY_factor i j hij,qmaYY_factor_commute i j hij⟩ + · intro k + simp only [qmaTwoPauliWord] + split_ifs <;> decide + · intro k + simp only [qmaTwoPauliWord] + split_ifs <;> decide + · exact (Finset.card_le_card (qmaTwoPauliWord_support i j 1 3)).trans (Finset.card_insert_le _ _) + · exact (Finset.card_le_card (qmaTwoPauliWord_support i j 3 1)).trans (Finset.card_insert_le _ _) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumYYFactor.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumYYFactor.lean new file mode 100644 index 0000000000000000000000000000000000000000..fb28204e2a48e712286d223bb11fa416a9523f41 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumYYFactor.lean @@ -0,0 +1,69 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliProduct +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEntryParity + +namespace OAI + +/-! A YY term is a product of commuting real XZ and ZX involutions. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +def qmaTwoPauliWord (i j : ι) (a b : Fin 4) : ι → Fin 4 := + fun k => if k = i then a else if k = j then b else 0 + +theorem qmaTwoPauliWord_support (i j : ι) (a b : Fin 4) : + qmaPauliSupport (qmaTwoPauliWord i j a b) ⊆ {i,j} := by + intro k hk + by_contra hn + have hki : k ≠ i := fun h => hn (by simp [h]) + have hkj : k ≠ j := fun h => hn (by simp [h]) + have hz : qmaTwoPauliWord i j a b k ≠ 0 := (Finset.mem_filter.mp hk).2 + simp [qmaTwoPauliWord,hki,hkj] at hz + +theorem qmaTwoPauliWord_real (i j : ι) (a b : Fin 4) (ha : a ≠ 2) (hb : b ≠ 2) : + QMAEntryParity false (qmaPauliWord (qmaTwoPauliWord i j a b)) := by + apply qmaPauliWord_real_of_even + have hnoY (k : ι) : qmaTwoPauliWord i j a b k ≠ 2 := by + unfold qmaTwoPauliWord + split_ifs <;> simp_all + have hz : qmaPauliYCount (qmaTwoPauliWord i j a b) = 0 := by + simp [qmaPauliYCount,hnoY] + rw [hz] + norm_num + +theorem qmaYY_factor (i j : ι) (hij : i ≠ j) : + qmaPauliWord (qmaTwoPauliWord i j 1 3)*qmaPauliWord (qmaTwoPauliWord i j 3 1) = + qmaPauliWord (qmaTwoPauliWord i j 2 2) := by + rw [qmaPauliWord_product] + have hindex : (fun k => qmaPauliProductIndex (qmaTwoPauliWord i j 1 3 k) + (qmaTwoPauliWord i j 3 1 k)) = qmaTwoPauliWord i j 2 2 := by + funext k + by_cases hki : k = i <;> by_cases hkj : k = j <;> + simp [qmaTwoPauliWord,qmaPauliProductIndex,hki,hkj,Ne.symm hij] + rw [hindex] + have hphase : (∏ k, qmaPauliProductPhase (qmaTwoPauliWord i j 1 3 k) + (qmaTwoPauliWord i j 3 1 k)) = 1 := by + rw [← Finset.prod_subset (Finset.subset_univ ({i,j} : Finset ι))] + · simp [qmaTwoPauliWord,qmaPauliProductPhase,hij,Ne.symm hij] + · intro k _ hk + have hki : k ≠ i := fun h => hk (by simp [h]) + have hkj : k ≠ j := fun h => hk (by simp [h]) + simp [qmaTwoPauliWord,qmaPauliProductPhase,hki,hkj] + rw [hphase,one_smul] + +theorem qmaYY_factor_commute (i j : ι) (hij : i ≠ j) : + qmaPauliWord (qmaTwoPauliWord i j 1 3)*qmaPauliWord (qmaTwoPauliWord i j 3 1) = + qmaPauliWord (qmaTwoPauliWord i j 3 1)*qmaPauliWord (qmaTwoPauliWord i j 1 3) := by + have h := congrArg Matrix.conjTranspose (qmaYY_factor i j hij) + rw [Matrix.conjTranspose_mul,(qmaPauliWord_hermitian _).eq, + (qmaPauliWord_hermitian _).eq,(qmaPauliWord_hermitian _).eq] at h + exact (qmaYY_factor i j hij).trans h.symm + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumYYReduction.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumYYReduction.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d9590a62c6419cd69dd2678127572fa778df1a3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumYYReduction.lean @@ -0,0 +1,69 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZSubdivision + +namespace OAI + +/-! Elimination of all YY terms by an explicit three-local X/Z family. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +theorem qmaXZSubdivision_accuracy (a b : κ → ι → Fin 4) (J : κ → ℝ) + (hab : ∀ e, qmaPauliWord (a e)*qmaPauliWord (b e) = + qmaPauliWord (b e)*qmaPauliWord (a e)) {N : ℝ} (hN : 1 ≤ N) : + let R := 8*(qmaThirdBudget 0 J)^4*N + |MediatorGraph.normalizedBottom (∑ p : κ × Fin 4, + (qmaXZSubdivisionWeight R (J p.1) p.2 : ℂ) • + qmaPauliWord (qmaXZSubdivisionWord (a p.1) (b p.1) p.1 p.2)) - + MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • + (qmaPauliWord (a e)*qmaPauliWord (b e)))| ≤ 1/N := by + dsimp only + let A := fun e => qmaPauliWord (a e) + let B := fun e => qmaPauliWord (b e) + let R := 8*(qmaThirdBudget 0 J)^4*N + have hsum : (∑ p : κ × Fin 4, (qmaXZSubdivisionWeight R (J p.1) p.2 : ℂ) • + qmaPauliWord (qmaXZSubdivisionWord (a p.1) (b p.1) p.1 p.2)) = + qmaSubdivisionOnQubits 0 A B R J (fun _ => false) := by + rw [Fintype.sum_prod_type] + simp only [qmaXZSubdivision_sum] + unfold qmaSubdivisionOnQubits + rw [qmaSubdivisionPolarized_decomposition] + simp only [Matrix.zero_kronecker,zero_add,MediatorGraph.submatrix_sum, + qmaSubdivisionPiece_reindex,A,B] + have ht : qmaSubdivisionTarget 0 A B (fun e => (J e:ℂ)) = + ∑ e, (J e:ℂ) • (qmaPauliWord (a e)*qmaPauliWord (b e)) := by + simp [qmaSubdivisionTarget,A,B] + rw [hsum,qmaSubdivisionOnQubits_bottom,← ht] + apply qmaSubdivision_polynomial_accuracy 0 A B J (by norm_num) hN + Matrix.conjTranspose_zero (by simp) + (fun _ => qmaPauliWord_hermitian _) (fun _ => qmaPauliWord_hermitian _) + (fun _ => qmaPauliWord_square _) (fun _ => qmaPauliWord_square _) hab + (EuclideanSpace.single (fun _ : ι => (0:Fin 2)) (1:ℂ)) + simp [PiLp.norm_single] + +theorem qmaYYReduction_exists (w : κ → ι → Fin 4) (J : κ → ℝ) + (hw : ∀ e, (qmaPauliSupport (w e)).card ≤ 2) + (he : ∀ e, Even (qmaPauliYCount (w e))) {N : ℝ} (hN : 1 ≤ N) : + ∃ (v : (κ × Fin 4) → (ι ⊕ κ → Fin 4)) (K : (κ × Fin 4) → ℝ), + (∀ p i, v p i ≠ 2) ∧ (∀ p, (qmaPauliSupport (v p)).card ≤ 3) ∧ + |MediatorGraph.normalizedBottom (∑ p, (K p:ℂ) • qmaPauliWord (v p)) - + MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • qmaPauliWord (w e))| ≤ 1/N := by + choose a b ha hb hsa hsb hfactor hcomm using + fun e => qmaTwoLocalEvenXZFactor (w e) (hw e) (he e) + let R := 8*(qmaThirdBudget 0 J)^4*N + refine ⟨fun p => qmaXZSubdivisionWord (a p.1) (b p.1) p.1 p.2, + fun p => qmaXZSubdivisionWeight R (J p.1) p.2,?_,?_,?_⟩ + · intro p i + exact qmaXZSubdivision_noY _ _ _ (ha p.1) (hb p.1) _ _ + · intro p + exact qmaXZSubdivision_support _ _ _ (hsa p.1) (hsb p.1) _ + · have h := qmaXZSubdivision_accuracy a b J hcomm hN + simpa only [hfactor] using h + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumYYSupported.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumYYSupported.lean new file mode 100644 index 0000000000000000000000000000000000000000..bb3bc2d3c3201246dfe200c20ad93009df5bacd9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QuantumYYSupported.lean @@ -0,0 +1,42 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumYYReduction +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZSupportFactors +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumXZEnvelopes + +namespace OAI + +/-! YY elimination preserves an explicit support envelope for every emitted term. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +theorem qmaYYReduction_supported (w : κ → ι → Fin 4) (J : κ → ℝ) + (hw : ∀ e, (qmaPauliSupport (w e)).card ≤ 2) + (he : ∀ e, Even (qmaPauliYCount (w e))) {N : ℝ} (hN : 1 ≤ N) : + ∃ (v : (κ × Fin 4) → (ι ⊕ κ → Fin 4)) (K : (κ × Fin 4) → ℝ), + (∀ p i, v p i ≠ 2) ∧ (∀ p, (qmaPauliSupport (v p)).card ≤ 3) ∧ + (∀ p, qmaPauliSupport (v p) ⊆ qmaMediatorSupport (qmaPauliSupport (w p.1)) p.1) ∧ + |MediatorGraph.normalizedBottom (∑ p, (K p:ℂ) • qmaPauliWord (v p)) - + MediatorGraph.normalizedBottom (∑ e, (J e:ℂ) • qmaPauliWord (w e))| ≤ 1/N := by + choose a b hsa0 hsb0 ha hb hsa hsb hfactor hcomm using + fun e => qmaTwoLocalEvenXZ_supported (w e) (hw e) (he e) + let R := 8*(qmaThirdBudget 0 J)^4*N + refine ⟨fun p => qmaXZSubdivisionWord (a p.1) (b p.1) p.1 p.2, + fun p => qmaXZSubdivisionWeight R (J p.1) p.2,?_,?_,?_,?_⟩ + · intro p i + exact qmaXZSubdivision_noY _ _ _ (ha p.1) (hb p.1) _ _ + · intro p + exact qmaXZSubdivision_support _ _ _ (hsa p.1) (hsb p.1) _ + · intro p + exact qmaXZSubdivisionWord_envelope _ _ _ (hsa0 p.1) (hsb0 p.1) p.2 + · have h := qmaXZSubdivision_accuracy a b J hcomm hN + simpa only [hfactor] using h + + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorAncilla.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorAncilla.lean new file mode 100644 index 0000000000000000000000000000000000000000..048ebb1380582366ec2d3277b387b2d765beaa40 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorAncilla.lean @@ -0,0 +1,117 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalAction + +namespace OAI + +/-! Occupation coordinates for the parallel qubit mediator gadgets. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +variable {κ : Type*} [Fintype κ] [DecidableEq κ] + +def qmaAncillaVacuum : κ → Fin 2 := fun _ => 0 + +def qmaAncillaSingle (e : κ) : κ → Fin 2 := Function.update qmaAncillaVacuum e 1 + +omit [Fintype κ] in +theorem qmaAncillaSingle_apply (e f : κ) : + qmaAncillaSingle e f = if f = e then 1 else 0 := by + simp [qmaAncillaSingle,qmaAncillaVacuum,Function.update_apply] + +omit [Fintype κ] in +theorem qmaAncillaSingle_ne_vacuum (e : κ) : qmaAncillaSingle e ≠ qmaAncillaVacuum := by + intro h + have he := congrFun h e + simp [qmaAncillaSingle,qmaAncillaVacuum] at he + +omit [Fintype κ] in +theorem qmaAncillaSingle_injective : Function.Injective (qmaAncillaSingle (κ := κ)) := by + intro e f h + by_contra hef + have he := congrFun h e + simp [qmaAncillaSingle_apply,hef] at he + +omit [Fintype κ] in +theorem qmaBitFlip_vacuum (e : κ) : qmaBitFlip e qmaAncillaVacuum = qmaAncillaSingle e := by + simp [qmaBitFlip,qmaAncillaSingle,qmaAncillaVacuum] + +omit [Fintype κ] in +theorem qmaBitFlip_single_self (e : κ) : qmaBitFlip e (qmaAncillaSingle e) = qmaAncillaVacuum := by + rw [← qmaBitFlip_vacuum,qmaBitFlip_involutive] + +omit [Fintype κ] in +theorem qmaBitFlip_single_ne_single (e f d : κ) : + qmaAncillaSingle e ≠ qmaBitFlip f (qmaAncillaSingle d) := by + intro h + by_cases hfd : f = d + · subst f + rw [qmaBitFlip_single_self] at h + exact qmaAncillaSingle_ne_vacuum e h + · have hf := congrFun h f + have hd := congrFun h d + by_cases hef : e = f + · subst e + simp [qmaAncillaSingle_apply,qmaBitFlip,hfd,Ne.symm hfd] at hd + · simp [qmaAncillaSingle_apply,qmaBitFlip,Ne.symm hef,hfd] at hf + +def qmaAncillaNumber (a : κ → Fin 2) : ℕ := ∑ e, (a e).val + +omit [DecidableEq κ] in +@[simp] theorem qmaAncillaNumber_vacuum : + qmaAncillaNumber (qmaAncillaVacuum (κ := κ)) = 0 := by + simp [qmaAncillaNumber,qmaAncillaVacuum] + +@[simp] theorem qmaAncillaNumber_single (e : κ) : + qmaAncillaNumber (qmaAncillaSingle e) = 1 := by + simp [qmaAncillaNumber,qmaAncillaSingle_apply,apply_ite] + +omit [DecidableEq κ] in +theorem qmaAncillaNumber_pos (a : κ → Fin 2) (ha : a ≠ qmaAncillaVacuum) : + 0 < qmaAncillaNumber a := by + by_contra h + have hz : qmaAncillaNumber a = 0 := by omega + apply ha + funext e + have he : (a e).val ≤ qmaAncillaNumber a := + Finset.single_le_sum (f := fun i => (a i).val) (fun i _ => Nat.zero_le _) (Finset.mem_univ e) + apply Fin.ext + change (a e).val = 0 + omega + +def qmaAncillaOccupation (e : κ) : Matrix (κ → Fin 2) (κ → Fin 2) ℂ := + Matrix.diagonal (fun a => if a e = 1 then 1 else 0) + +theorem qmaAncillaOccupation_single (e f d : κ) : + qmaAncillaOccupation e (qmaAncillaSingle f) (qmaAncillaSingle d) = + if f = d ∧ e = d then 1 else 0 := by + unfold qmaAncillaOccupation + rw [Matrix.diagonal_apply] + by_cases hfd : f = d + · subst f + by_cases hed : e = d <;> simp [hed,qmaAncillaSingle_apply] + · have hn := (Function.Injective.ne qmaAncillaSingle_injective hfd) + simp [hfd,hn] + +theorem qmaBitFlipMatrix_single (e f d : κ) : + qmaBitFlipMatrix e (qmaAncillaSingle f) (qmaAncillaSingle d) = 0 := by + exact ite_eq_right (qmaBitFlip_single_ne_single f e d) + +theorem qmaBitFlipMatrix_vacuum_right (e : κ) (a : κ → Fin 2) : + qmaBitFlipMatrix e a qmaAncillaVacuum = if a = qmaAncillaSingle e then 1 else 0 := by + rw [qmaBitFlipMatrix,qmaBitFlip_vacuum] + +omit [DecidableEq κ] in +theorem qmaAncillaOccupation_vacuum_right (e : κ) (a : κ → Fin 2) : + qmaAncillaOccupation e a qmaAncillaVacuum = 0 := by + by_cases ha : a = qmaAncillaVacuum + · subst a + simp [qmaAncillaOccupation,qmaAncillaVacuum] + · simp [qmaAncillaOccupation,ha] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorBounds.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..9c0c1d4f7e48b21b7f96d06ad09eead47c19abf8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorBounds.lean @@ -0,0 +1,112 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorThirdForm + +namespace OAI + +/-! Applying the third-order estimate to the actual full qubit Hamiltonian. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators InnerProductSpace Classical +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + +theorem qmaComplementOperator_norm (C : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) : + ‖qmaComplementOperator C D V‖ ≤ ‖qmaPerturbationOperator C D V‖ := by + let Q := qmaMediatorHighProjection (σ := σ) (κ := κ) + let P := qmaPerturbationOperator C D V + have hQ : ‖Q‖ ≤ 1 := qmaMediatorHighProjection_norm + change ‖Q.comp (P.comp Q)‖ ≤ ‖P‖ + calc + _ ≤ ‖Q‖*‖P.comp Q‖ := ContinuousLinearMap.opNorm_comp_le _ _ + _ ≤ ‖Q‖*(‖P‖*‖Q‖) := mul_le_mul_of_nonneg_left + (ContinuousLinearMap.opNorm_comp_le _ _) (norm_nonneg _) + _ ≤ 1*(‖P‖*1) := mul_le_mul hQ + (mul_le_mul_of_nonneg_left hQ (norm_nonneg _)) (by positivity) zero_le_one + _ = _ := by ring + +theorem qmaComplementOperator_symmetric (C : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) + (hC : C.conjTranspose = C) (hD : ∀ e, (D e).conjTranspose = D e) + (hV : ∀ e, (V e).conjTranspose = V e) + (x y : EuclideanSpace ℂ (σ × (κ → Fin 2))) : + ⟪x,qmaComplementOperator C D V y⟫_ℝ = ⟪qmaComplementOperator C D V x,y⟫_ℝ := by + have hQ (u v : EuclideanSpace ℂ (σ × (κ → Fin 2))) : + ⟪u,qmaMediatorHighProjection v⟫_ℝ = ⟪qmaMediatorHighProjection u,v⟫_ℝ := + qmaMatrixOperator_real_symmetric _ qmaMediatorHigh_star u v + have hP (u v : EuclideanSpace ℂ (σ × (κ → Fin 2))) : + ⟪u,qmaPerturbationOperator C D V v⟫_ℝ = ⟪qmaPerturbationOperator C D V u,v⟫_ℝ := + qmaMatrixOperator_real_symmetric _ (qmaMediatorPerturbation_star C D V hC hD hV) u v + change ⟪x,qmaMediatorHighProjection (qmaPerturbationOperator C D V (qmaMediatorHighProjection y))⟫_ℝ = + ⟪qmaMediatorHighProjection (qmaPerturbationOperator C D V (qmaMediatorHighProjection x)),y⟫_ℝ + rw [hQ,hP,← hQ] + +theorem qmaInverseCoupling_bound (g : ℝ) (hg : 0 < g) (V : κ → Matrix σ σ ℂ) + {η : ℝ} (hV : ∑ e, ‖spinMatrixOperator (V e)‖ ≤ g*η) (p : EuclideanSpace ℂ σ) : + ‖qmaPaddedInverse g (qmaCouplingOperator V p)‖ ≤ η*‖p‖ := by + change ‖qmaPaddedInverse g (qmaMatrixOperator (qmaAncillaColumn V) p)‖ ≤ _ + rw [qmaPaddedInverse_column,norm_smul,Real.norm_eq_abs,abs_of_pos (inv_pos.mpr hg)] + have hnorm : ‖qmaMatrixOperator (qmaAncillaColumn V)‖ ≤ g*η := + (qmaAncillaColumn_operator_norm V).trans hV + have hpoint : ‖qmaMatrixOperator (qmaAncillaColumn V) p‖ ≤ + ‖qmaMatrixOperator (qmaAncillaColumn V)‖*‖p‖ := + ContinuousLinearMap.le_opNorm (qmaMatrixOperator (qmaAncillaColumn V)) p + have hb : ‖qmaMatrixOperator (qmaAncillaColumn V) p‖ ≤ (g*η)*‖p‖ := + hpoint.trans (mul_le_mul_of_nonneg_right hnorm (norm_nonneg p)) + calc + _ ≤ g⁻¹*((g*η)*‖p‖) := mul_le_mul_of_nonneg_left hb (inv_nonneg.mpr hg.le) + _ = _ := by field_simp + +private theorem extendBlock_lower (a b e μ ε : ℝ) + (hb : 0 ≤ ε*b) (hl : -ε*a ≤ e-μ*(a+b)) : (μ-ε)*(a+b) ≤ e := by + nlinarith + +theorem qmaPhysical_thirdOrder_lower (g : ℝ) (C : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) + (hg : 0 < g) (hC : C.conjTranspose = C) (hD : ∀ e, (D e).conjTranspose = D e) + (hV : ∀ e, (V e).conjTranspose = V e) {d m η μ : ℝ} + (hd : 0 ≤ d) (hm : 0 ≤ m) (hsmall : 2*d+4*m ≤ g) + (hPert : ‖qmaPerturbationOperator C D V‖ ≤ d) + (hCouple : ∑ e, ‖spinMatrixOperator (V e)‖ ≤ g*η) (hμ : μ ≤ m) + (hmin : ∀ p : EuclideanSpace ℂ σ, + μ*‖p‖^2 ≤ qmaQuadratic (qmaThirdMatrix C D V (g:ℂ)) (fun i => p i)) + (x : EuclideanSpace ℂ (σ × (κ → Fin 2))) : + (μ-(2*d^2/g+2*m)*η^2)*‖x‖^2 ≤ ⟪x,qmaPhysicalOperator g C D V x⟫_ℝ := by + have hAT (z : EuclideanSpace ℂ (σ × (κ → Fin 2))) : + qmaPaddedPenalty g (qmaPaddedInverse g z) = z := + qmaPaddedPenalty_inverse (σ := σ) (κ := κ) hg z + have hAsym (z w : EuclideanSpace ℂ (σ × (κ → Fin 2))) : + ⟪z,qmaPaddedPenalty g w⟫_ℝ = ⟪qmaPaddedPenalty g z,w⟫_ℝ := + diagonalPenalty_symmetric (qmaPaddedWeight g) z w + have hgap (z : EuclideanSpace ℂ (σ × (κ → Fin 2))) : + g*‖z‖^2 ≤ Perturbation.penaltyForm (qmaPaddedPenalty g) z := + qmaPaddedPenalty_gap (σ := σ) (κ := κ) hg z + have hminForm (p : EuclideanSpace ℂ σ) : μ*‖p‖^2 ≤ + Perturbation.thirdOrderForm ((qmaMatrixOperator C).restrictScalars ℝ) + (qmaPaddedInverse g) (qmaComplementOperator C D V) (qmaCouplingOperator V) p := by + rw [qmaActual_thirdOrderForm] + exact hmin p + have hl : -(2*d^2/g+2*m)*η^2*‖qmaMediatorRestriction x‖^2 ≤ + Perturbation.lowBlockEnergy ((qmaMatrixOperator C).restrictScalars ℝ) + (qmaPaddedPenalty g) (qmaComplementOperator C D V) (qmaCouplingOperator V) + (qmaMediatorRestriction x) (qmaMediatorHighProjection x) - + μ*(‖qmaMediatorRestriction x‖^2+‖qmaMediatorHighProjection x‖^2) := by + apply Perturbation.thirdOrder_energy_lower + ((qmaMatrixOperator C).restrictScalars ℝ) (qmaPaddedPenalty g) (qmaPaddedInverse g) + (qmaComplementOperator C D V) (qmaCouplingOperator V) hg hd hm hsmall + · exact hAT + · exact hAsym + · exact qmaComplementOperator_symmetric C D V hC hD hV + · exact hgap + · exact qmaInverseCoupling_bound g hg V hCouple + · exact (qmaComplementOperator_norm C D V).trans hPert + · exact hμ + · exact hminForm + have hK : 0 ≤ (2*d^2/g+2*m)*η^2 := by positivity + have hextra := mul_nonneg hK (sq_nonneg ‖qmaMediatorHighProjection x‖) + rw [← qmaMediator_norm_decomposition, qmaPhysicalOperator_energy g C D V hC hD hV x] + apply extendBlock_lower _ _ _ _ _ hextra + simpa only [neg_mul] using hl + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorForms.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorForms.lean new file mode 100644 index 0000000000000000000000000000000000000000..7231de3affc4be59ff77b67d84be61770800a608 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorForms.lean @@ -0,0 +1,127 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorPhysical + +namespace OAI + +/-! The full physical energy equals the block energy on its genuine +vacuum/complement decomposition. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators InnerProductSpace Classical +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + +omit [DecidableEq σ] in +theorem qmaMatrixOperator_real_symmetric (M : Matrix σ σ ℂ) (hM : M.conjTranspose = M) + (x y : EuclideanSpace ℂ σ) : + ⟪x,qmaMatrixOperator M y⟫_ℝ = ⟪qmaMatrixOperator M x,y⟫_ℝ := by + rw [qmaEuclidean_real_inner,qmaEuclidean_real_inner] + have h := ContinuousLinearMap.adjoint_inner_right (qmaMatrixOperator M) x y + rw [← qmaMatrixOperator_star,hM] at h + exact congrArg Complex.re h + +theorem qmaMediatorRestriction_apply (x : EuclideanSpace ℂ (σ × (κ → Fin 2))) (s : σ) : + qmaMediatorRestriction x s = x (s,qmaAncillaVacuum) := by + change (∑ t, (qmaMediatorVacuumColumn (σ := σ) (κ := κ)).conjTranspose s t*x t) = _ + simp [Matrix.conjTranspose_apply,qmaMediatorVacuumColumn,qmaSliceColumn, + Fintype.sum_prod_type,Matrix.one_apply,apply_ite] + +def qmaPhysicalOperator (g : ℝ) (C : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) : + EuclideanSpace ℂ (σ × (κ → Fin 2)) →L[ℝ] EuclideanSpace ℂ (σ × (κ → Fin 2)) := + (qmaMatrixOperator (qmaPhysicalMediatorMatrix g C D V)).restrictScalars ℝ + +def qmaPerturbationOperator (C : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) : + EuclideanSpace ℂ (σ × (κ → Fin 2)) →L[ℝ] EuclideanSpace ℂ (σ × (κ → Fin 2)) := + (qmaMatrixOperator (qmaMediatorPerturbation C D V)).restrictScalars ℝ + +def qmaCouplingOperator (V : κ → Matrix σ σ ℂ) : + EuclideanSpace ℂ σ →L[ℝ] EuclideanSpace ℂ (σ × (κ → Fin 2)) := + (qmaMatrixOperator (qmaAncillaColumn V)).restrictScalars ℝ + +def qmaComplementOperator (C : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) : + EuclideanSpace ℂ (σ × (κ → Fin 2)) →L[ℝ] EuclideanSpace ℂ (σ × (κ → Fin 2)) := + qmaMediatorHighProjection.comp ((qmaPerturbationOperator C D V).comp qmaMediatorHighProjection) + +theorem qmaPhysicalOperator_low (g : ℝ) (C : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) + (p : EuclideanSpace ℂ σ) : + qmaPhysicalOperator g C D V (qmaMediatorInclusion p) = + qmaMediatorInclusion (qmaMatrixOperator C p)+qmaCouplingOperator V p := by + have hm := qmaPhysicalMediator_vacuum g C D V + have ho := congrArg (fun M : Matrix (σ × (κ → Fin 2)) σ ℂ => qmaMatrixOperator M p) hm + simp only [qmaMatrixOperator_mul,qmaMatrixOperator_add,ContinuousLinearMap.comp_apply, + _root_.add_apply] at ho + exact ho + +theorem qmaPhysicalPenalty_high (g : ℝ) (x : EuclideanSpace ℂ (σ × (κ → Fin 2))) + (hx : qmaMediatorRestriction x = 0) : + qmaMatrixOperator (qmaPhysicalPenaltyMatrix g) x = qmaPaddedPenalty g x := by + have he := qmaAncillaDiagonal_real_operator (σ := σ) (κ := κ) + (fun a => g*qmaAncillaNumber a) + have hp := congrArg (fun f : EuclideanSpace ℂ (σ × (κ → Fin 2)) →L[ℝ] + EuclideanSpace ℂ (σ × (κ → Fin 2)) => f x) he + change qmaMatrixOperator (qmaPhysicalPenaltyMatrix g) x = _ at hp + rw [hp] + ext p + by_cases ha : p.2 = qmaAncillaVacuum + · have hzero := congrArg (fun u : EuclideanSpace ℂ σ => u p.1) hx + rw [qmaMediatorRestriction_apply] at hzero + change x (p.1,qmaAncillaVacuum) = 0 at hzero + have hxp : x p = 0 := by + change x (p.1,p.2) = 0 + rw [ha] + exact hzero + simp [qmaPaddedPenalty,diagonalPenalty_apply,hxp] + · simp [qmaPaddedPenalty,diagonalPenalty_apply,qmaPaddedWeight,qmaPaddedExcitationNumber,ha] + +theorem qmaComplementOperator_form (C : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) + (x : EuclideanSpace ℂ (σ × (κ → Fin 2))) (hx : qmaMediatorRestriction x = 0) : + ⟪x,qmaComplementOperator C D V x⟫_ℝ = ⟪x,qmaPerturbationOperator C D V x⟫_ℝ := by + have hQx : qmaMediatorHighProjection x = x := by + rw [← qmaMediator_highPart] + simp [Perturbation.orthogonalHighPart,hx] + have hs := qmaMatrixOperator_real_symmetric + (qmaMediatorHighMatrix (σ := σ) (κ := κ)) qmaMediatorHigh_star x + (qmaPerturbationOperator C D V x) + change ⟪x,qmaMediatorHighProjection (qmaPerturbationOperator C D V + (qmaMediatorHighProjection x))⟫_ℝ = _ + rw [hQx] + change ⟪x,qmaMediatorHighProjection (qmaPerturbationOperator C D V x)⟫_ℝ = + ⟪qmaMediatorHighProjection x,qmaPerturbationOperator C D V x⟫_ℝ at hs + simpa only [hQx] using hs + +theorem qmaPhysicalOperator_high (g : ℝ) (C : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) + (x : EuclideanSpace ℂ (σ × (κ → Fin 2))) (hx : qmaMediatorRestriction x = 0) : + ⟪x,qmaPhysicalOperator g C D V x⟫_ℝ = + Perturbation.penaltyForm (qmaPaddedPenalty g) x+⟪x,qmaComplementOperator C D V x⟫_ℝ := by + have he : qmaPhysicalOperator g C D V x = + qmaMatrixOperator (qmaPhysicalPenaltyMatrix g) x+qmaPerturbationOperator C D V x := by + change qmaMatrixOperator (_+_) x = _ + rw [qmaMatrixOperator_add,_root_.add_apply] + rfl + rw [he,qmaPhysicalPenalty_high g x hx,inner_add_right,qmaComplementOperator_form C D V x hx] + rfl + +theorem qmaPhysicalOperator_energy (g : ℝ) (C : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) + (hC : C.conjTranspose = C) (hD : ∀ e, (D e).conjTranspose = D e) + (hV : ∀ e, (V e).conjTranspose = V e) (x : EuclideanSpace ℂ (σ × (κ → Fin 2))) : + ⟪x,qmaPhysicalOperator g C D V x⟫_ℝ = + Perturbation.lowBlockEnergy ((qmaMatrixOperator C).restrictScalars ℝ) (qmaPaddedPenalty g) + (qmaComplementOperator C D V) (qmaCouplingOperator V) (qmaMediatorRestriction x) + (qmaMediatorHighProjection x) := by + rw [← qmaMediator_highPart] + apply Perturbation.orthogonalBlock_full_energy + (qmaMediatorInclusion (σ := σ) (κ := κ)) (qmaMediatorRestriction (σ := σ) (κ := κ)) + (qmaPhysicalOperator g C D V) (qmaPaddedPenalty g) (qmaComplementOperator C D V) + ((qmaMatrixOperator C).restrictScalars ℝ) (qmaCouplingOperator V) + · exact qmaMediator_restrict_include + · exact qmaMediator_inclusion_adjoint + · exact qmaMatrixOperator_real_symmetric _ (qmaPhysicalMediator_star g C D V hC hD hV) + · exact qmaPhysicalOperator_low g C D V + · exact qmaMediatorRestriction_column V + · exact qmaPhysicalOperator_high g C D V + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorGround.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorGround.lean new file mode 100644 index 0000000000000000000000000000000000000000..4871f8ddaca79f64a066c5a8e2630960f526bde0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorGround.lean @@ -0,0 +1,70 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorTrial +import OAI.MathematicalPhysics.ContinuumCoulomb.ManyBody.MediatorGraph + +namespace OAI + +/-! A full-space ground-energy estimate for the explicit parallel gadget. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators InnerProductSpace Classical +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + +theorem qmaPhysical_thirdOrder_ground (g : ℝ) (C : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) + (hg : 0 < g) (hC : C.conjTranspose = C) (hD : ∀ e, (D e).conjTranspose = D e) + (hV : ∀ e, (V e).conjTranspose = V e) {d m η : ℝ} + (hd : 0 ≤ d) (hm : 0 ≤ m) (hsmall : 2*d+4*m ≤ g) + (hPert : ‖qmaPerturbationOperator C D V‖ ≤ d) + (hCouple : ∑ e, ‖spinMatrixOperator (V e)‖ ≤ g*η) + (hbound : ∀ p : EuclideanSpace ℂ σ, ‖p‖ = 1 → + |qmaQuadratic (qmaThirdMatrix C D V (g:ℂ)) (fun i => p i)| ≤ m) + (u : EuclideanSpace ℂ σ) (hu : ‖u‖ = 1) : + |MediatorGraph.normalizedBottom (qmaPhysicalMediatorMatrix g C D V)- + Perturbation.thirdOrderBottom ((qmaMatrixOperator C).restrictScalars ℝ) + (qmaPaddedInverse g) (qmaComplementOperator C D V) (qmaCouplingOperator V)| ≤ + (2*d^2/g+2*m)*η^2 := by + obtain ⟨p,hp,hmin⟩ := Perturbation.thirdOrderForm_minimizer + ((qmaMatrixOperator C).restrictScalars ℝ) (qmaPaddedInverse g) + (qmaComplementOperator C D V) (qmaCouplingOperator V) u hu + rw [Perturbation.thirdOrderBottom_eq _ _ _ _ p hp hmin,qmaActual_thirdOrderForm] + let μ := qmaQuadratic (qmaThirdMatrix C D V (g:ℂ)) (fun i => p i) + let ε := (2*d^2/g+2*m)*η^2 + have hμ : |μ| ≤ m := hbound p hp + have hmin' (v : EuclideanSpace ℂ σ) : + μ*‖v‖^2 ≤ qmaQuadratic (qmaThirdMatrix C D V (g:ℂ)) (fun i => v i) := by + simpa only [qmaActual_thirdOrderForm] using hmin v + have hl (x : EuclideanSpace ℂ (σ × (κ → Fin 2))) : + (μ-ε)*‖x‖^2 ≤ ⟪x,qmaPhysicalOperator g C D V x⟫_ℝ := + qmaPhysical_thirdOrder_lower g C D V hg hC hD hV hd hm hsmall hPert hCouple + (abs_le.mp hμ).2 hmin' x + have hu0 : ‖qmaMediatorInclusion (κ := κ) u‖ = 1 := + (Perturbation.orthogonalInclusion_norm + (qmaMediatorInclusion (σ := σ) (κ := κ)) (qmaMediatorRestriction (σ := σ) (κ := κ)) + qmaMediator_restrict_include qmaMediator_inclusion_adjoint u).trans hu + have hnon : {e | ∃ x : EuclideanSpace ℂ (σ × (κ → Fin 2)), ‖x‖ = 1 ∧ + e = ⟪x,qmaPhysicalOperator g C D V x⟫_ℝ}.Nonempty := ⟨_,_,hu0,rfl⟩ + have hlow : μ-ε ≤ MediatorGraph.normalizedBottom (qmaPhysicalMediatorMatrix g C D V) := by + apply le_csInf hnon + rintro e ⟨x,hx,rfl⟩ + simpa only [hx,one_pow,mul_one] using hl x + obtain ⟨ht,htrial⟩ := qmaPhysical_thirdOrder_trial g C D V hg hC hD hV hm hCouple + (abs_le.mp hμ).1 p hp rfl + have hb : BddBelow {e | ∃ x : EuclideanSpace ℂ (σ × (κ → Fin 2)), 0 < ‖x‖^2 ∧ + e = ⟪x,qmaPhysicalOperator g C D V x⟫_ℝ/‖x‖^2} := by + refine ⟨μ-ε,?_⟩ + rintro e ⟨x,hx,rfl⟩ + exact (le_div_iff₀ hx).mpr (hl x) + have hup : MediatorGraph.normalizedBottom (qmaPhysicalMediatorMatrix g C D V) ≤ μ+m*η^2 := by + rw [MediatorGraph.normalizedBottom_eq_rayleigh] + exact (csInf_le hb ⟨qmaThirdTrial g V p,ht,rfl⟩).trans htrial + have heps : m*η^2 ≤ ε := by + have hz : 0 ≤ 2*d^2/g := by positivity + exact mul_le_mul_of_nonneg_right (by linarith) (sq_nonneg η) + exact abs_le.mpr ⟨by linarith,by linarith⟩ + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorHilbert.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorHilbert.lean new file mode 100644 index 0000000000000000000000000000000000000000..3925fa8fd7e2efd4f084d93653701a2bcfa07751 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorHilbert.lean @@ -0,0 +1,82 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorPenalty +import OAI.MathematicalPhysics.ContinuumCoulomb.ManyBody.OrthogonalBlockDecomposition + +namespace OAI + +/-! Actual Hilbert-space low and complementary coordinates for qubit mediators. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators InnerProductSpace Classical +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + +def qmaMediatorInclusion : EuclideanSpace ℂ σ →L[ℝ] EuclideanSpace ℂ (σ × (κ → Fin 2)) := + (qmaMatrixOperator qmaMediatorVacuumColumn).restrictScalars ℝ + +def qmaMediatorRestriction : EuclideanSpace ℂ (σ × (κ → Fin 2)) →L[ℝ] EuclideanSpace ℂ σ := + (qmaMatrixOperator (qmaMediatorVacuumColumn (σ := σ) (κ := κ)).conjTranspose).restrictScalars ℝ + +def qmaMediatorHighProjection : EuclideanSpace ℂ (σ × (κ → Fin 2)) →L[ℝ] + EuclideanSpace ℂ (σ × (κ → Fin 2)) := + (spinMatrixOperator qmaMediatorHighMatrix).restrictScalars ℝ + +theorem qmaMediator_restrict_include (p : EuclideanSpace ℂ σ) : + qmaMediatorRestriction (κ := κ) (qmaMediatorInclusion p) = p := by + change qmaMatrixOperator _ (qmaMatrixOperator _ p) = p + rw [← ContinuousLinearMap.comp_apply,← qmaMatrixOperator_mul,qmaMediatorVacuum_gram, + qmaMatrixOperator_square,spinMatrixOperator_one] + rfl + +theorem qmaMediator_inclusion_adjoint (p : EuclideanSpace ℂ σ) + (x : EuclideanSpace ℂ (σ × (κ → Fin 2))) : + ⟪qmaMediatorInclusion p,x⟫_ℝ = ⟪p,qmaMediatorRestriction x⟫_ℝ := by + have h := ContinuousLinearMap.adjoint_inner_right + (qmaMatrixOperator (qmaMediatorVacuumColumn (σ := σ) (κ := κ))) p x + rw [← qmaMatrixOperator_star] at h + rw [qmaEuclidean_real_inner,qmaEuclidean_real_inner] + exact congrArg Complex.re h.symm + +theorem qmaMediator_highPart (x : EuclideanSpace ℂ (σ × (κ → Fin 2))) : + Perturbation.orthogonalHighPart qmaMediatorInclusion qmaMediatorRestriction x = + qmaMediatorHighProjection x := by + have hm := qmaMediator_projection_sum (σ := σ) (κ := κ) + have h := congrArg (fun M => qmaMatrixOperator M x) hm + rw [qmaMatrixOperator_add,qmaMatrixOperator_mul] at h + simp only [qmaMatrixOperator_square,spinMatrixOperator_one] at h + change qmaMediatorInclusion (qmaMediatorRestriction x)+qmaMediatorHighProjection x = x at h + unfold Perturbation.orthogonalHighPart + exact sub_eq_iff_eq_add.mpr (by simpa only [add_comm] using h.symm) + +theorem qmaMediator_norm_decomposition (x : EuclideanSpace ℂ (σ × (κ → Fin 2))) : + ‖qmaMediatorRestriction x‖^2+‖qmaMediatorHighProjection x‖^2 = ‖x‖^2 := by + rw [← qmaMediator_highPart] + exact Perturbation.orthogonalParts_norm qmaMediatorInclusion qmaMediatorRestriction + qmaMediator_restrict_include qmaMediator_inclusion_adjoint x + +theorem qmaMediatorHighProjection_norm : + ‖qmaMediatorHighProjection (σ := σ) (κ := κ)‖ ≤ 1 := by + rw [qmaMediatorHighProjection,ContinuousLinearMap.norm_restrictScalars] + exact qmaMediatorHigh_norm + +theorem qmaMediatorRestriction_high (x : EuclideanSpace ℂ (σ × (κ → Fin 2))) : + qmaMediatorRestriction (qmaMediatorHighProjection x) = 0 := by + change qmaMatrixOperator _ (qmaMatrixOperator _ x) = 0 + rw [← ContinuousLinearMap.comp_apply,← qmaMatrixOperator_mul,qmaMediatorVacuum_high] + ext p + simp [qmaMatrixOperator_apply] + +theorem qmaMediatorRestriction_column (V : κ → Matrix σ σ ℂ) (p : EuclideanSpace ℂ σ) : + qmaMediatorRestriction (qmaMatrixOperator (qmaAncillaColumn V) p) = 0 := by + have hQ := congrArg (fun M => qmaMatrixOperator M p) (qmaMediatorHigh_column V) + rw [qmaMatrixOperator_mul] at hQ + change qmaMediatorHighProjection (qmaMatrixOperator (qmaAncillaColumn V) p) = + qmaMatrixOperator (qmaAncillaColumn V) p at hQ + rw [← hQ] + exact qmaMediatorRestriction_high _ + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorMatrix.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorMatrix.lean new file mode 100644 index 0000000000000000000000000000000000000000..ed9c9c952d3f815b767f38591eafb325175ab5ea --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorMatrix.lean @@ -0,0 +1,106 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumAncillaCompression + +namespace OAI + +/-! The literal parallel mediator Hamiltonian and its exact first three +vacuum-compressed terms. Single flips have zero third-order compression. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + +def qmaMediatorFlips (V : κ → Matrix σ σ ℂ) : + Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ := + ∑ e, V e ⊗ₖ qmaBitFlipMatrix e + +def qmaMediatorOccupations (D : κ → Matrix σ σ ℂ) : + Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ := + ∑ e, D e ⊗ₖ qmaAncillaOccupation e + +def qmaMediatorPerturbation (C : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) : + Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ := + C ⊗ₖ 1 + qmaMediatorOccupations D + qmaMediatorFlips V + +theorem qmaMediatorFlips_vacuum (V : κ → Matrix σ σ ℂ) : + qmaMediatorFlips V*qmaSliceColumn (qmaAncillaVacuum (κ := κ)) 1 = qmaAncillaColumn V := by + unfold qmaMediatorFlips qmaAncillaColumn + rw [Matrix.sum_mul] + apply Finset.sum_congr rfl + intro e _ + ext s t + rcases s with ⟨s,a⟩ + rw [qmaSliceColumn_kronecker_apply,qmaBitFlipMatrix_vacuum_right,Matrix.mul_one] + simp only [qmaSliceColumn,ite_mul,one_mul,zero_mul] + +theorem qmaMediatorOccupations_vacuum (D : κ → Matrix σ σ ℂ) : + qmaMediatorOccupations D*qmaSliceColumn (qmaAncillaVacuum (κ := κ)) (1 : Matrix σ σ ℂ) = 0 := by + unfold qmaMediatorOccupations + rw [Matrix.sum_mul] + apply Finset.sum_eq_zero + intro e _ + ext s t + rcases s with ⟨s,a⟩ + rw [qmaSliceColumn_kronecker_apply,qmaAncillaOccupation_vacuum_right,zero_mul] + rfl + +omit [DecidableEq σ] in +theorem qmaAncillaColumn_identity (V W : κ → Matrix σ σ ℂ) (C : Matrix σ σ ℂ) : + (qmaAncillaColumn V).conjTranspose*(C ⊗ₖ 1)*qmaAncillaColumn W = + ∑ e, (V e).conjTranspose*C*W e := by + rw [qmaAncillaColumn_sandwich] + simp only [Matrix.one_apply,qmaAncillaSingle_injective.eq_iff,ite_smul,one_smul,zero_smul] + simp + +omit [DecidableEq σ] in +theorem qmaMediatorPerturbation_compression (C : Matrix σ σ ℂ) + (D V W Z : κ → Matrix σ σ ℂ) : + (qmaAncillaColumn W).conjTranspose*qmaMediatorPerturbation C D V*qmaAncillaColumn Z = + (∑ e, (W e).conjTranspose*C*Z e)+(∑ e, (W e).conjTranspose*D e*Z e) := by + unfold qmaMediatorPerturbation qmaMediatorOccupations qmaMediatorFlips + rw [Matrix.mul_add,Matrix.mul_add,Matrix.add_mul,Matrix.add_mul,qmaAncillaColumn_identity, + Matrix.mul_sum,Matrix.sum_mul,Matrix.mul_sum,Matrix.sum_mul] + simp only [qmaAncillaColumn_occupation,qmaAncillaColumn_flip,Finset.sum_const_zero,add_zero] + +def qmaAncillaDiagonal (w : (κ → Fin 2) → ℂ) : + Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ := + 1 ⊗ₖ Matrix.diagonal w + +theorem qmaAncillaDiagonal_slice (w : (κ → Fin 2) → ℂ) (a : κ → Fin 2) + (A : Matrix σ σ ℂ) : + qmaAncillaDiagonal w*qmaSliceColumn a A = w a • qmaSliceColumn a A := by + ext s t + rcases s with ⟨s,b⟩ + rw [qmaAncillaDiagonal,qmaSliceColumn_kronecker_apply,Matrix.one_mul] + by_cases h : b = a + · subst b + simp [qmaSliceColumn] + · simp [qmaSliceColumn,h] + +theorem qmaAncillaDiagonal_column (w : (κ → Fin 2) → ℂ) (V : κ → Matrix σ σ ℂ) + (c : ℂ) (hw : ∀ e, w (qmaAncillaSingle e) = c) : + qmaAncillaDiagonal w*qmaAncillaColumn V = c • qmaAncillaColumn V := by + unfold qmaAncillaColumn + rw [Matrix.mul_sum,Finset.smul_sum] + apply Finset.sum_congr rfl + intro e _ + rw [qmaAncillaDiagonal_slice,hw] + +def qmaAncillaInverseWeight (g : ℂ) (a : κ → Fin 2) : ℂ := + if a = qmaAncillaVacuum then 0 else (g*(qmaAncillaNumber a : ℂ))⁻¹ + +theorem qmaAncillaInverseWeight_single (g : ℂ) (e : κ) : + qmaAncillaInverseWeight g (qmaAncillaSingle e) = g⁻¹ := by + simp [qmaAncillaInverseWeight,qmaAncillaSingle_ne_vacuum] + +theorem qmaAncillaInverse_column (g : ℂ) (V : κ → Matrix σ σ ℂ) : + qmaAncillaDiagonal (qmaAncillaInverseWeight g)*qmaAncillaColumn V = + g⁻¹ • qmaAncillaColumn V := + qmaAncillaDiagonal_column _ _ _ (qmaAncillaInverseWeight_single g) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorNorm.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..e4a593731d8880cb6fa63a8c79c884c4f77b71dc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorNorm.lean @@ -0,0 +1,93 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorMatrix +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumPauliAlgebra +import OAI.MathematicalPhysics.ContinuumCoulomb.ManyBody.SpinMatrixNorm + +namespace OAI + +/-! Spectator-independent norm estimates for the physical mediator terms. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical +variable {ι κ σ α : Type*} [Fintype ι] [DecidableEq ι] + [Fintype κ] [DecidableEq κ] [Fintype σ] [DecidableEq σ] + [Fintype α] [DecidableEq α] + +theorem qmaPauliWord_operator_norm (w : ι → Fin 4) : + ‖spinMatrixOperator (qmaPauliWord w)‖ ≤ 1 := + spinMatrixOperator_unitary_norm _ (qmaPauliWord_gram w) + +theorem qmaBitFlipMatrix_square (e : κ) : qmaBitFlipMatrix e*qmaBitFlipMatrix e = 1 := by + ext s t + simp [qmaBitFlipMatrix,Matrix.mul_apply,mul_ite,qmaBitFlip_involutive e t,Matrix.one_apply] + +theorem qmaBitFlipMatrix_star (e : κ) : (qmaBitFlipMatrix e).conjTranspose = qmaBitFlipMatrix e := by + ext s t + have he : t = qmaBitFlip e s ↔ s = qmaBitFlip e t := by + constructor <;> intro h <;> rw [h,qmaBitFlip_involutive] + simp [Matrix.conjTranspose_apply,qmaBitFlipMatrix,he] + +theorem qmaKronecker_unitary_norm (M : Matrix σ σ ℂ) (N : Matrix α α ℂ) + (hM : M.conjTranspose*M = 1) (hN : N.conjTranspose*N = 1) : + ‖spinMatrixOperator (M ⊗ₖ N)‖ ≤ 1 := by + apply spinMatrixOperator_unitary_norm + rw [Matrix.conjTranspose_kronecker,← Matrix.mul_kronecker_mul,hM,hN,Matrix.one_kronecker_one] + +theorem qmaPauliFlip_operator_norm (w : ι → Fin 4) (e : κ) : + ‖spinMatrixOperator (qmaPauliWord w ⊗ₖ qmaBitFlipMatrix e)‖ ≤ 1 := by + apply qmaKronecker_unitary_norm _ _ (qmaPauliWord_gram w) + rw [qmaBitFlipMatrix_star,qmaBitFlipMatrix_square] + +omit [DecidableEq σ] in +theorem qmaOccupation_mulVec (M : Matrix σ σ ℂ) (e : κ) + (u : (σ × (κ → Fin 2)) → ℂ) (s : σ) (a : κ → Fin 2) : + (M ⊗ₖ qmaAncillaOccupation e).mulVec u (s,a) = + if a e = 1 then M.mulVec (fun t => u (t,a)) s else 0 := by + simp only [Matrix.mulVec,dotProduct,Fintype.sum_prod_type,Matrix.kronecker_apply, + qmaAncillaOccupation,Matrix.diagonal_apply] + by_cases ha : a e = 1 + · simp [ha] + · simp [ha] + +theorem qmaKronecker_occupation_norm (M : Matrix σ σ ℂ) (hM : M.conjTranspose*M = 1) + (e : κ) : ‖spinMatrixOperator (M ⊗ₖ qmaAncillaOccupation e)‖ ≤ 1 := by + apply ContinuousLinearMap.opNorm_le_bound _ zero_le_one + intro x + rw [one_mul] + apply (sq_le_sq₀ (norm_nonneg _) (norm_nonneg _)).mp + simp only [EuclideanSpace.norm_sq_eq,Fintype.sum_prod_type] + conv_lhs => rw [Finset.sum_comm] + conv_rhs => rw [Finset.sum_comm] + apply Finset.sum_le_sum + intro a _ + let y : EuclideanSpace ℂ σ := WithLp.toLp 2 (fun s => x (s,a)) + have heq : ∑ s, ‖(spinMatrixOperator M y) s‖^2 = ∑ s, ‖x (s,a)‖^2 := by + have h := congrArg (fun r : ℝ => r^2) (spinMatrixOperator_unitary_norm_map M hM y) + simpa only [EuclideanSpace.norm_sq_eq,y] using h + by_cases ha : a e = 1 + · convert le_of_eq heq using 1 + apply Finset.sum_congr rfl + intro s _ + change ‖(M ⊗ₖ qmaAncillaOccupation e).mulVec (fun t => x t) (s,a)‖^2 = + ‖(spinMatrixOperator M y) s‖^2 + rw [qmaOccupation_mulVec,ite_eq_left ha] + rfl + · have hz : ∑ s, ‖spinMatrixOperator (M ⊗ₖ qmaAncillaOccupation e) x (s,a)‖^2 = 0 := by + apply Finset.sum_eq_zero + intro s _ + change ‖(M ⊗ₖ qmaAncillaOccupation e).mulVec (fun t => x t) (s,a)‖^2 = 0 + rw [qmaOccupation_mulVec,ite_eq_right ha] + norm_num + rw [hz] + positivity + +theorem qmaPauliOccupation_operator_norm (w : ι → Fin 4) (e : κ) : + ‖spinMatrixOperator (qmaPauliWord w ⊗ₖ qmaAncillaOccupation e)‖ ≤ 1 := + qmaKronecker_occupation_norm _ (qmaPauliWord_gram w) e + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorNormBounds.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorNormBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..39952fe269068f6df7a922a0752a6fd913c060d0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorNormBounds.lean @@ -0,0 +1,87 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorForms + +namespace OAI + +/-! Norm bounds for arbitrary old-spin operators tensored with the actual +mediator identity, occupation projections, and flips. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical +variable {σ α κ : Type*} [Fintype σ] [DecidableEq σ] + [Fintype α] [DecidableEq α] [Fintype κ] [DecidableEq κ] + +theorem qmaKronecker_identity_apply (M : Matrix σ σ ℂ) + (x : EuclideanSpace ℂ (σ × α)) (s : σ) (a : α) : + spinMatrixOperator (M ⊗ₖ (1 : Matrix α α ℂ)) x (s,a) = + spinMatrixOperator M (WithLp.toLp 2 (fun t => x (t,a))) s := by + simp [spinMatrixOperator_apply,Matrix.one_apply, + Fintype.sum_prod_type] + +theorem qmaKronecker_identity_norm (M : Matrix σ σ ℂ) : + ‖spinMatrixOperator (M ⊗ₖ (1 : Matrix α α ℂ))‖ ≤ ‖spinMatrixOperator M‖ := by + apply ContinuousLinearMap.opNorm_le_bound _ (norm_nonneg _) + intro x + apply (sq_le_sq₀ (norm_nonneg _) (mul_nonneg (norm_nonneg _) (norm_nonneg _))).mp + rw [mul_pow] + simp only [EuclideanSpace.norm_sq_eq,Fintype.sum_prod_type] + rw [Finset.sum_comm] + calc + _ ≤ ∑ a : α, ‖spinMatrixOperator M‖^2*(∑ s : σ, ‖x (s,a)‖^2) := by + apply Finset.sum_le_sum + intro a _ + let y : EuclideanSpace ℂ σ := WithLp.toLp 2 (fun t => x (t,a)) + have h := pow_le_pow_left₀ (norm_nonneg _) ((spinMatrixOperator M).le_opNorm y) 2 + simpa only [mul_pow,EuclideanSpace.norm_sq_eq,qmaKronecker_identity_apply,y] using h + _ = _ := by rw [← Finset.mul_sum,Finset.sum_comm] + +theorem qmaKronecker_flip_norm (M : Matrix σ σ ℂ) (e : κ) : + ‖spinMatrixOperator (M ⊗ₖ qmaBitFlipMatrix e)‖ ≤ ‖spinMatrixOperator M‖ := by + have hfac : M ⊗ₖ qmaBitFlipMatrix e = + (M ⊗ₖ (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ))* + ((1 : Matrix σ σ ℂ) ⊗ₖ qmaBitFlipMatrix e) := by + rw [← Matrix.mul_kronecker_mul,mul_one,one_mul] + rw [hfac,spinMatrixOperator_mul] + have hflip : ‖spinMatrixOperator ((1 : Matrix σ σ ℂ) ⊗ₖ qmaBitFlipMatrix e)‖ ≤ 1 := by + apply qmaKronecker_unitary_norm + · simp + · rw [qmaBitFlipMatrix_star,qmaBitFlipMatrix_square] + exact (ContinuousLinearMap.opNorm_comp_le _ _).trans + ((mul_le_mul (qmaKronecker_identity_norm M) hflip (norm_nonneg _) (norm_nonneg _)).trans_eq + (mul_one _)) + +theorem qmaKronecker_occupation_norm_bound (M : Matrix σ σ ℂ) (e : κ) : + ‖spinMatrixOperator (M ⊗ₖ qmaAncillaOccupation e)‖ ≤ ‖spinMatrixOperator M‖ := by + have hfac : M ⊗ₖ qmaAncillaOccupation e = + (M ⊗ₖ (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ))* + ((1 : Matrix σ σ ℂ) ⊗ₖ qmaAncillaOccupation e) := by + rw [← Matrix.mul_kronecker_mul,mul_one,one_mul] + rw [hfac,spinMatrixOperator_mul] + have hocc : ‖spinMatrixOperator ((1 : Matrix σ σ ℂ) ⊗ₖ qmaAncillaOccupation e)‖ ≤ 1 := + qmaKronecker_occupation_norm _ (by simp) e + exact (ContinuousLinearMap.opNorm_comp_le _ _).trans + ((mul_le_mul (qmaKronecker_identity_norm M) hocc (norm_nonneg _) (norm_nonneg _)).trans_eq + (mul_one _)) + +theorem qmaPerturbationOperator_norm (C : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) : + ‖qmaPerturbationOperator C D V‖ ≤ ‖spinMatrixOperator C‖+ + ∑ e, ‖spinMatrixOperator (D e)‖+∑ e, ‖spinMatrixOperator (V e)‖ := by + change ‖(qmaMatrixOperator (qmaMediatorPerturbation C D V)).restrictScalars ℝ‖ ≤ _ + rw [ContinuousLinearMap.norm_restrictScalars,qmaMatrixOperator_square] + unfold qmaMediatorPerturbation qmaMediatorOccupations qmaMediatorFlips + simp only [spinMatrixOperator_add,spinMatrixOperator_sum] + have hD : ‖∑ e, spinMatrixOperator (D e ⊗ₖ qmaAncillaOccupation e)‖ ≤ + ∑ e, ‖spinMatrixOperator (D e)‖ := + (norm_sum_le _ _).trans (Finset.sum_le_sum (fun e _ => qmaKronecker_occupation_norm_bound _ e)) + have hV : ‖∑ e, spinMatrixOperator (V e ⊗ₖ qmaBitFlipMatrix e)‖ ≤ + ∑ e, ‖spinMatrixOperator (V e)‖ := + (norm_sum_le _ _).trans (Finset.sum_le_sum (fun e _ => qmaKronecker_flip_norm _ e)) + exact (norm_add_le _ _).trans (add_le_add + ((norm_add_le _ _).trans (add_le_add (qmaKronecker_identity_norm C) hD)) hV) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorPenalty.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorPenalty.lean new file mode 100644 index 0000000000000000000000000000000000000000..1bf9463bae18f80c01ddc66a3fe27cb0b4925fe7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorPenalty.lean @@ -0,0 +1,94 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorProjection + +namespace OAI + +/-! An invertible diagonal extension of the physical excitation penalty. +The extension agrees with the physical penalty on the actual complement. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators InnerProductSpace Classical +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + +def qmaPaddedExcitationNumber (a : κ → Fin 2) : ℕ := + if a = qmaAncillaVacuum then 1 else qmaAncillaNumber a + +omit [DecidableEq κ] in +theorem qmaPaddedExcitationNumber_pos (a : κ → Fin 2) : 0 < qmaPaddedExcitationNumber a := by + unfold qmaPaddedExcitationNumber + split_ifs with h + · exact Nat.zero_lt_one + · exact qmaAncillaNumber_pos a h + +theorem qmaPaddedExcitationNumber_single (e : κ) : + qmaPaddedExcitationNumber (qmaAncillaSingle e) = 1 := by + simp [qmaPaddedExcitationNumber,qmaAncillaSingle_ne_vacuum] + +def qmaPaddedWeight (g : ℝ) (p : σ × (κ → Fin 2)) : ℝ := + g*qmaPaddedExcitationNumber p.2 + +def qmaPaddedPenalty (g : ℝ) : EuclideanSpace ℂ (σ × (κ → Fin 2)) →L[ℝ] + EuclideanSpace ℂ (σ × (κ → Fin 2)) := diagonalPenalty (qmaPaddedWeight g) + +def qmaPaddedInverse (g : ℝ) : EuclideanSpace ℂ (σ × (κ → Fin 2)) →L[ℝ] + EuclideanSpace ℂ (σ × (κ → Fin 2)) := diagonalPenalty (fun p => (qmaPaddedWeight g p)⁻¹) + +omit [DecidableEq σ] in +theorem qmaPaddedPenalty_gap {g : ℝ} (hg : 0 < g) (x : EuclideanSpace ℂ (σ × (κ → Fin 2))) : + g*‖x‖^2 ≤ ⟪x,qmaPaddedPenalty g x⟫_ℝ := by + apply diagonalPenalty_gap + intro p + have hn : (1:ℝ) ≤ qmaPaddedExcitationNumber p.2 := by + exact_mod_cast qmaPaddedExcitationNumber_pos p.2 + exact (mul_one g).ge.trans (mul_le_mul_of_nonneg_left hn hg.le) + +omit [DecidableEq σ] in +theorem qmaPaddedPenalty_inverse {g : ℝ} (hg : 0 < g) + (x : EuclideanSpace ℂ (σ × (κ → Fin 2))) : qmaPaddedPenalty g (qmaPaddedInverse g x) = x := by + apply diagonalPenalty_inverse_right + intro p + have hn : (0:ℝ) < qmaPaddedExcitationNumber p.2 := by exact_mod_cast qmaPaddedExcitationNumber_pos p.2 + exact ne_of_gt (mul_pos hg hn) + +omit [DecidableEq σ] in +theorem qmaPaddedInverse_norm {g : ℝ} (hg : 0 < g) : + ‖qmaPaddedInverse (σ := σ) (κ := κ) g‖ ≤ 1/g := by + apply diagonalPenalty_inverse_norm hg + intro p + have hn : (1:ℝ) ≤ qmaPaddedExcitationNumber p.2 := by + exact_mod_cast qmaPaddedExcitationNumber_pos p.2 + exact (mul_one g).ge.trans (mul_le_mul_of_nonneg_left hn hg.le) + +theorem qmaAncillaDiagonal_real_operator (w : (κ → Fin 2) → ℝ) : + (qmaMatrixOperator (qmaAncillaDiagonal (σ := σ) (fun a => (w a : ℂ)))).restrictScalars ℝ = + diagonalPenalty (fun p : σ × (κ → Fin 2) => w p.2) := by + ext x p + change qmaMatrixOperator (qmaAncillaDiagonal (fun a => (w a : ℂ))) x p = w p.2 • x p + rw [qmaAncillaDiagonal_eq] + simp [qmaMatrixOperator_apply,Matrix.diagonal_apply,RCLike.real_smul_eq_coe_mul] + +theorem qmaPaddedInverse_column (g : ℝ) (V : κ → Matrix σ σ ℂ) (x : EuclideanSpace ℂ σ) : + qmaPaddedInverse g (qmaMatrixOperator (qmaAncillaColumn V) x) = + g⁻¹ • qmaMatrixOperator (qmaAncillaColumn V) x := by + have hw (e : κ) : ((g*qmaPaddedExcitationNumber (qmaAncillaSingle e) : ℝ)⁻¹ : ℂ) = + (g⁻¹ : ℝ) := by rw [qmaPaddedExcitationNumber_single]; simp + have hm := qmaAncillaDiagonal_column + (σ := σ) (fun a => ((g*qmaPaddedExcitationNumber a : ℝ)⁻¹ : ℂ)) V (g⁻¹ : ℝ) hw + have ho := congrArg (fun M : Matrix (σ × (κ → Fin 2)) σ ℂ => qmaMatrixOperator M x) hm + rw [qmaMatrixOperator_mul,qmaMatrixOperator_smul] at ho + have he := qmaAncillaDiagonal_real_operator (σ := σ) (κ := κ) + (fun a => (g*qmaPaddedExcitationNumber a : ℝ)⁻¹) + have heapp := congrArg (fun f : EuclideanSpace ℂ (σ × (κ → Fin 2)) →L[ℝ] + EuclideanSpace ℂ (σ × (κ → Fin 2)) => f (qmaMatrixOperator (qmaAncillaColumn V) x)) he + change qmaMatrixOperator _ (qmaMatrixOperator (qmaAncillaColumn V) x) = + qmaPaddedInverse g (qmaMatrixOperator (qmaAncillaColumn V) x) at heapp + simp only [Complex.ofReal_inv] at heapp + rw [ContinuousLinearMap.comp_apply,heapp,_root_.smul_apply] at ho + exact ho + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorPhysical.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorPhysical.lean new file mode 100644 index 0000000000000000000000000000000000000000..6395fb74460c4d30d493de6d61b6c073cd166746 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorPhysical.lean @@ -0,0 +1,94 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorHilbert +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorSeriesMatrix + +namespace OAI + +/-! The physical parallel-qubit Hamiltonian has the calculated vacuum column. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + +omit [DecidableEq σ] [DecidableEq κ] in +theorem qmaSliceColumn_right_mul (a : κ → Fin 2) (A B : Matrix σ σ ℂ) : + qmaSliceColumn a A*B = qmaSliceColumn a (A*B) := by + ext ⟨s,b⟩ t + by_cases h : b = a <;> simp [Matrix.mul_apply,qmaSliceColumn,h] + +def qmaPhysicalPenaltyMatrix (g : ℝ) : Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ := + qmaAncillaDiagonal (fun a => (g*qmaAncillaNumber a : ℝ)) + +def qmaPhysicalMediatorMatrix (g : ℝ) (C : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) : + Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ := + qmaPhysicalPenaltyMatrix g+qmaMediatorPerturbation C D V + +theorem qmaPhysicalPenalty_vacuum (g : ℝ) : + qmaPhysicalPenaltyMatrix (σ := σ) (κ := κ) g* + qmaMediatorVacuumColumn (σ := σ) (κ := κ) = 0 := by + rw [qmaPhysicalPenaltyMatrix,qmaMediatorVacuumColumn,qmaAncillaDiagonal_slice] + simp + +theorem qmaLiftedLow_vacuum (C : Matrix σ σ ℂ) : + (C ⊗ₖ (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ))*qmaMediatorVacuumColumn = + qmaMediatorVacuumColumn*C := by + rw [qmaMediatorVacuumColumn,qmaSliceColumn_right_mul,Matrix.one_mul] + ext ⟨s,a⟩ t + rw [qmaSliceColumn_kronecker_apply,Matrix.mul_one] + simp [qmaSliceColumn,Matrix.one_apply] + +theorem qmaPhysicalMediator_vacuum (g : ℝ) (C : Matrix σ σ ℂ) + (D V : κ → Matrix σ σ ℂ) : + qmaPhysicalMediatorMatrix g C D V*qmaMediatorVacuumColumn = + qmaMediatorVacuumColumn*C+qmaAncillaColumn V := by + have hd0 : qmaMediatorOccupations D*qmaMediatorVacuumColumn (σ := σ) (κ := κ) = 0 := by + simpa only [qmaMediatorVacuumColumn] using qmaMediatorOccupations_vacuum D + have hv : qmaMediatorFlips V*qmaMediatorVacuumColumn (σ := σ) (κ := κ) = qmaAncillaColumn V := by + simpa only [qmaMediatorVacuumColumn] using qmaMediatorFlips_vacuum V + unfold qmaPhysicalMediatorMatrix qmaMediatorPerturbation + rw [Matrix.add_mul,qmaPhysicalPenalty_vacuum,zero_add,Matrix.add_mul,Matrix.add_mul, + qmaLiftedLow_vacuum,hd0,hv,add_zero] + +omit [Fintype σ] [DecidableEq κ] in +theorem qmaAncillaDiagonal_real_star (w : (κ → Fin 2) → ℝ) : + (qmaAncillaDiagonal (σ := σ) (fun a => (w a : ℂ))).conjTranspose = + qmaAncillaDiagonal (fun a => (w a : ℂ)) := by + rw [qmaAncillaDiagonal_eq] + ext p q + by_cases hpq : p = q + · subst q + simp [Matrix.conjTranspose_apply] + · simp [Matrix.conjTranspose_apply,hpq,Ne.symm hpq] + +omit [DecidableEq κ] in +theorem qmaAncillaOccupation_star (e : κ) : + (qmaAncillaOccupation e).conjTranspose = qmaAncillaOccupation e := by + ext a b + by_cases hab : a = b + · subst b + by_cases ha : a e = 1 <;> simp [qmaAncillaOccupation,Matrix.conjTranspose_apply,ha] + · simp [qmaAncillaOccupation,Matrix.conjTranspose_apply,hab,Ne.symm hab] + +omit [Fintype σ] [DecidableEq σ] in +theorem qmaMediatorPerturbation_star (C : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) + (hC : C.conjTranspose = C) (hD : ∀ e, (D e).conjTranspose = D e) + (hV : ∀ e, (V e).conjTranspose = V e) : + (qmaMediatorPerturbation C D V).conjTranspose = qmaMediatorPerturbation C D V := by + simp only [qmaMediatorPerturbation,qmaMediatorOccupations,qmaMediatorFlips, + Matrix.conjTranspose_add,Matrix.conjTranspose_sum,Matrix.conjTranspose_kronecker, + Matrix.conjTranspose_one,qmaAncillaOccupation_star,qmaBitFlipMatrix_star,hC,hD,hV] + +omit [Fintype σ] in +theorem qmaPhysicalMediator_star (g : ℝ) (C : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) + (hC : C.conjTranspose = C) (hD : ∀ e, (D e).conjTranspose = D e) + (hV : ∀ e, (V e).conjTranspose = V e) : + (qmaPhysicalMediatorMatrix g C D V).conjTranspose = qmaPhysicalMediatorMatrix g C D V := by + rw [qmaPhysicalMediatorMatrix,Matrix.conjTranspose_add,qmaPhysicalPenaltyMatrix, + qmaAncillaDiagonal_real_star,qmaMediatorPerturbation_star C D V hC hD hV] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorProjection.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..151eb07e018141b8929bd6fb2f5f4c2efe0f26a7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorProjection.lean @@ -0,0 +1,99 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumRectangularOperator +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.DiagonalPenalty + +namespace OAI + +/-! The exact vacuum and complementary projections for the physical qubits. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker InnerProductSpace Classical +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + +def qmaMediatorVacuumColumn : Matrix (σ × (κ → Fin 2)) σ ℂ := + qmaSliceColumn qmaAncillaVacuum 1 + +def qmaMediatorHighMatrix : Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ := + qmaAncillaDiagonal (fun a => if a = qmaAncillaVacuum then 0 else 1) + +omit [Fintype σ] [DecidableEq κ] in +theorem qmaAncillaDiagonal_eq (w : (κ → Fin 2) → ℂ) : + (qmaAncillaDiagonal w : Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ) = + Matrix.diagonal (fun p => w p.2) := by + ext ⟨s,a⟩ ⟨t,b⟩ + by_cases hs : s = t <;> by_cases hab : a = b <;> + simp [qmaAncillaDiagonal,Prod.mk.injEq,hs,hab] + +theorem qmaMediatorVacuum_gram : + (qmaMediatorVacuumColumn (σ := σ) (κ := κ)).conjTranspose* + qmaMediatorVacuumColumn (σ := σ) (κ := κ) = 1 := by + rw [qmaMediatorVacuumColumn,qmaSliceColumn_gram] + simp + +theorem qmaMediatorHigh_column (V : κ → Matrix σ σ ℂ) : + qmaMediatorHighMatrix*qmaAncillaColumn V = qmaAncillaColumn V := by + unfold qmaMediatorHighMatrix + simpa only [one_smul] using qmaAncillaDiagonal_column + (fun a => if a = qmaAncillaVacuum then (0:ℂ) else 1) V 1 + (fun e => ite_eq_right (qmaAncillaSingle_ne_vacuum e)) + +theorem qmaMediatorHigh_vacuum : + (qmaMediatorHighMatrix (σ := σ) (κ := κ))*qmaMediatorVacuumColumn (σ := σ) (κ := κ) = 0 := by + rw [qmaMediatorHighMatrix,qmaMediatorVacuumColumn,qmaAncillaDiagonal_slice] + simp + +omit [Fintype σ] [DecidableEq κ] in +theorem qmaMediatorHigh_star : + (qmaMediatorHighMatrix (σ := σ) (κ := κ)).conjTranspose = qmaMediatorHighMatrix := by + rw [qmaMediatorHighMatrix,qmaAncillaDiagonal_eq] + ext p q + by_cases hpq : p = q + · subst q + by_cases hp : p.2 = qmaAncillaVacuum <;> + simp [Matrix.conjTranspose_apply,hp] + · simp [Matrix.conjTranspose_apply,hpq,Ne.symm hpq] + +theorem qmaMediatorHigh_square : + (qmaMediatorHighMatrix (σ := σ) (κ := κ))*qmaMediatorHighMatrix = qmaMediatorHighMatrix := by + simp only [qmaMediatorHighMatrix,qmaAncillaDiagonal_eq,Matrix.diagonal_mul_diagonal] + congr 1 + funext p + split_ifs <;> norm_num + +theorem qmaMediatorVacuum_high : + (qmaMediatorVacuumColumn (σ := σ) (κ := κ)).conjTranspose* + qmaMediatorHighMatrix (σ := σ) (κ := κ) = 0 := by + have h := congrArg Matrix.conjTranspose (qmaMediatorHigh_vacuum (σ := σ) (κ := κ)) + simpa only [Matrix.conjTranspose_mul,qmaMediatorHigh_star,Matrix.conjTranspose_zero] using h + +omit [DecidableEq κ] in +theorem qmaMediator_projection_sum : + (qmaMediatorVacuumColumn (σ := σ) (κ := κ))*qmaMediatorVacuumColumn.conjTranspose+ + qmaMediatorHighMatrix = 1 := by + rw [qmaMediatorHighMatrix,qmaAncillaDiagonal_eq] + ext ⟨s,a⟩ ⟨t,b⟩ + by_cases ha : a = qmaAncillaVacuum <;> by_cases hb : b = qmaAncillaVacuum <;> + simp [qmaMediatorVacuumColumn,qmaSliceColumn,Matrix.mul_apply,Matrix.conjTranspose_apply, + Matrix.one_apply,Matrix.diagonal_apply,ha,hb,eq_comm,Prod.mk.injEq] + +theorem qmaMediatorHigh_norm : + ‖spinMatrixOperator (qmaMediatorHighMatrix (σ := σ) (κ := κ))‖ ≤ 1 := by + have he : (spinMatrixOperator (qmaMediatorHighMatrix (σ := σ) (κ := κ))).restrictScalars ℝ = + diagonalPenalty (fun p : σ × (κ → Fin 2) => if p.2 = qmaAncillaVacuum then 0 else 1) := by + ext x p + change spinMatrixOperator qmaMediatorHighMatrix x p = _ + rw [qmaMediatorHighMatrix,qmaAncillaDiagonal_eq] + simp [spinMatrixOperator_apply,Matrix.diagonal_apply] + have hn := congrArg (fun f => ‖f‖) he + rw [ContinuousLinearMap.norm_restrictScalars] at hn + rw [hn] + apply diagonalPenalty_norm_le _ zero_le_one + intro p + split_ifs <;> norm_num + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorSeriesError.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorSeriesError.lean new file mode 100644 index 0000000000000000000000000000000000000000..8994d5c33cba7b1d57464c08cafdd8e83b884feb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorSeriesError.lean @@ -0,0 +1,53 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorSeriesMatrix +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorNorm + +namespace OAI + +/-! The common low Hamiltonian contributes only a decreasing residual +to the exact third-order compression. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] + +theorem qmaSandwich_operator_norm (P L : Matrix σ σ ℂ) : + ‖spinMatrixOperator (P*L*P)‖ ≤ ‖spinMatrixOperator P‖^2*‖spinMatrixOperator L‖ := by + rw [spinMatrixOperator_mul,spinMatrixOperator_mul] + calc + _ ≤ ‖(spinMatrixOperator P).comp (spinMatrixOperator L)‖*‖spinMatrixOperator P‖ := + ContinuousLinearMap.opNorm_comp_le _ _ + _ ≤ (‖spinMatrixOperator P‖*‖spinMatrixOperator L‖)*‖spinMatrixOperator P‖ := + mul_le_mul_of_nonneg_right (ContinuousLinearMap.opNorm_comp_le _ _) (norm_nonneg _) + _ = _ := by ring + +theorem qmaThirdResidual_norm (L : Matrix σ σ ℂ) (P : κ → Matrix σ σ ℂ) + (r : ℝ) (hr : 0 < r) : + ‖spinMatrixOperator (((r:ℂ)⁻¹)^2 • (∑ e, P e*L*P e))‖ ≤ + r⁻¹^2*((∑ e, ‖spinMatrixOperator (P e)‖^2)*‖spinMatrixOperator L‖) := by + rw [spinMatrixOperator_smul,norm_smul,norm_pow,norm_inv,Complex.norm_real,Real.norm_eq_abs, + abs_of_pos hr,spinMatrixOperator_sum] + apply mul_le_mul_of_nonneg_left _ (sq_nonneg _) + calc + _ ≤ ∑ e, ‖spinMatrixOperator (P e*L*P e)‖ := norm_sum_le _ _ + _ ≤ ∑ e, ‖spinMatrixOperator (P e)‖^2*‖spinMatrixOperator L‖ := + Finset.sum_le_sum (fun e _ => qmaSandwich_operator_norm _ _) + _ = _ := (Finset.sum_mul _ _ _).symm + +theorem qmaThirdResidual_polynomial_bound (L : Matrix σ σ ℂ) (P : κ → Matrix σ σ ℂ) + {r K : ℝ} (hr : 0 < r) (hK : 0 ≤ K) + (hP : ∑ e, ‖spinMatrixOperator (P e)‖^2 ≤ K) (hL : ‖spinMatrixOperator L‖ ≤ K*r) : + ‖spinMatrixOperator (((r:ℂ)⁻¹)^2 • (∑ e, P e*L*P e))‖ ≤ K^2/r := by + calc + _ ≤ r⁻¹^2*((∑ e, ‖spinMatrixOperator (P e)‖^2)*‖spinMatrixOperator L‖) := + qmaThirdResidual_norm L P r hr + _ ≤ r⁻¹^2*(K*(K*r)) := + mul_le_mul_of_nonneg_left (mul_le_mul hP hL (norm_nonneg _) hK) (sq_nonneg _) + _ = _ := by field_simp + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorSeriesMatrix.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorSeriesMatrix.lean new file mode 100644 index 0000000000000000000000000000000000000000..d19487b1c423f651513eae83bdd5288b05d2219e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorSeriesMatrix.lean @@ -0,0 +1,83 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumThirdCounterterm +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorMatrix + +namespace OAI + +/-! Exact simultaneous cancellation for the polynomial third-order gadgets. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] + +def qmaThirdSeriesLow (H : Matrix σ σ ℂ) (A B C : κ → Matrix σ σ ℂ) + (r : ℂ) (J : κ → ℂ) : Matrix σ σ ℂ := + H+∑ e, qmaThirdSeriesCounter (A e) (B e) (C e) r (J e) + +def qmaThirdSeriesTarget (H : Matrix σ σ ℂ) (A B C : κ → Matrix σ σ ℂ) + (J : κ → ℂ) : Matrix σ σ ℂ := H+∑ e, J e • (A e*B e*C e) + +theorem qmaThirdSeries_sum_effective (H : Matrix σ σ ℂ) (A B C : κ → Matrix σ σ ℂ) + (r : ℂ) (J : κ → ℂ) (hA : ∀ e, A e*A e = 1) (hB : ∀ e, B e*B e = 1) + (hAB : ∀ e, A e*B e = B e*A e) (hAC : ∀ e, A e*C e = C e*A e) + (hBC : ∀ e, B e*C e = C e*B e) : + qmaThirdSeriesLow H A B C r J- + ∑ e, r • (qmaThirdSeriesPair (A e) (B e) (J e)*qmaThirdSeriesPair (A e) (B e) (J e))+ + ∑ e, qmaThirdSeriesPair (A e) (B e) (J e)*C e*qmaThirdSeriesPair (A e) (B e) (J e) = + qmaThirdSeriesTarget H A B C J := by + calc + _ = H+∑ e, (qmaThirdSeriesCounter (A e) (B e) (C e) r (J e)- + r • (qmaThirdSeriesPair (A e) (B e) (J e)*qmaThirdSeriesPair (A e) (B e) (J e))+ + qmaThirdSeriesPair (A e) (B e) (J e)*C e*qmaThirdSeriesPair (A e) (B e) (J e)) := by + simp only [qmaThirdSeriesLow,Finset.sum_add_distrib,Finset.sum_sub_distrib] + abel + _ = _ := by + unfold qmaThirdSeriesTarget + congr 1 + apply Finset.sum_congr rfl + intro e _ + exact qmaThirdSeries_effective _ _ _ _ _ (hA e) (hB e) (hAB e) (hAC e) (hBC e) + +def qmaThirdMatrix (L : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) (g : ℂ) : Matrix σ σ ℂ := + L-g⁻¹ • (∑ e, (V e).conjTranspose*V e)+ + (g⁻¹)^2 • ((∑ e, (V e).conjTranspose*L*V e)+(∑ e, (V e).conjTranspose*D e*V e)) + +theorem qmaThirdMatrix_scaled (L : Matrix σ σ ℂ) (P C : κ → Matrix σ σ ℂ) + (r : ℝ) (hr : r ≠ 0) (hP : ∀ e, (P e).conjTranspose = P e) : + qmaThirdMatrix L (fun e => (r^2 : ℝ) • C e) (fun e => (r^2 : ℝ) • P e) (r^3 : ℝ) = + L-(r : ℂ) • (∑ e, P e*P e)+(∑ e, P e*C e*P e)+ + ((r : ℂ)⁻¹)^2 • (∑ e, P e*L*P e) := by + have hrc : (r : ℂ) ≠ 0 := by exact_mod_cast hr + have hfirst : ((r:ℂ)^3)⁻¹*((r:ℂ)^2*(r:ℂ)^2) = r := by field_simp + have hthird : (((r:ℂ)^3)⁻¹)^2*((r:ℂ)^2*((r:ℂ)^2*(r:ℂ)^2)) = 1 := by field_simp + have hremain : (((r:ℂ)^3)⁻¹)^2*((r:ℂ)^2*(r:ℂ)^2) = ((r:ℂ)⁻¹)^2 := by field_simp + have hs (s : ℝ) (M : Matrix σ σ ℂ) : s • M = (s:ℂ) • M := rfl + unfold qmaThirdMatrix + simp only [hs,Complex.ofReal_pow,Matrix.conjTranspose_smul,star_pow,Complex.star_def,Complex.conj_ofReal, + hP,smul_mul_assoc,mul_smul_comm,smul_smul,← Finset.smul_sum, + smul_add,hfirst,hthird,hremain,one_smul] + abel + +theorem qmaThirdMatrix_target (H : Matrix σ σ ℂ) (A B C : κ → Matrix σ σ ℂ) + (r : ℝ) (J : κ → ℂ) (hr : r ≠ 0) + (hA : ∀ e, A e*A e = 1) (hB : ∀ e, B e*B e = 1) + (hAB : ∀ e, A e*B e = B e*A e) (hAC : ∀ e, A e*C e = C e*A e) + (hBC : ∀ e, B e*C e = C e*B e) + (hP : ∀ e, (qmaThirdSeriesPair (A e) (B e) (J e)).conjTranspose = + qmaThirdSeriesPair (A e) (B e) (J e)) : + let L := qmaThirdSeriesLow H A B C r J + let P := fun e => qmaThirdSeriesPair (A e) (B e) (J e) + qmaThirdMatrix L (fun e => (r^2 : ℝ) • C e) (fun e => (r^2 : ℝ) • P e) (r^3 : ℝ) = + qmaThirdSeriesTarget H A B C J+((r:ℂ)⁻¹)^2 • (∑ e, P e*L*P e) := by + dsimp only + rw [qmaThirdMatrix_scaled _ _ _ r hr hP] + have h := qmaThirdSeries_sum_effective H A B C (r:ℂ) J hA hB hAB hAC hBC + rw [← Finset.smul_sum] at h + rw [h] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorTargetGround.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorTargetGround.lean new file mode 100644 index 0000000000000000000000000000000000000000..cb79fbd4587cc4dae228134f58d1b75f18a2b124 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorTargetGround.lean @@ -0,0 +1,104 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorGround +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumGroundComparison +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.ThirdOrderScale + +namespace OAI + +/-! The actual parallel gadget approximates its intended finite Hamiltonian, +including the residual left by the common counterterm. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators InnerProductSpace Classical +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + +theorem qmaThirdOrderBottom_eq (g : ℝ) (L : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) : + Perturbation.thirdOrderBottom ((qmaMatrixOperator L).restrictScalars ℝ) + (qmaPaddedInverse g) (qmaComplementOperator L D V) (qmaCouplingOperator V) = + MediatorGraph.normalizedBottom (qmaThirdMatrix L D V (g:ℂ)) := by + unfold Perturbation.thirdOrderBottom MediatorGraph.normalizedBottom + congr 1 + ext e + constructor <;> rintro ⟨p,hp,he⟩ <;> refine ⟨p,hp,?_⟩ + · rw [qmaActual_thirdOrderForm] at he + simpa only [qmaQuadratic_operator,qmaMatrixOperator_square] using he + · rw [qmaActual_thirdOrderForm] + simpa only [qmaQuadratic_operator,qmaMatrixOperator_square] using he + +theorem qmaThirdSeries_target_ground (H : Matrix σ σ ℂ) (A B C : κ → Matrix σ σ ℂ) + (J : κ → ℂ) {R K : ℝ} (hK : 1 ≤ K) (hR : 4*K ≤ R) + (hA : ∀ e, A e*A e = 1) (hB : ∀ e, B e*B e = 1) + (hAB : ∀ e, A e*B e = B e*A e) (hAC : ∀ e, A e*C e = C e*A e) + (hBC : ∀ e, B e*C e = C e*B e) + (hC : ∀ e, (C e).conjTranspose = C e) + (hP : ∀ e, (qmaThirdSeriesPair (A e) (B e) (J e)).conjTranspose = + qmaThirdSeriesPair (A e) (B e) (J e)) + (hLstar : (qmaThirdSeriesLow H A B C R J).conjTranspose = qmaThirdSeriesLow H A B C R J) + (hL : ‖spinMatrixOperator (qmaThirdSeriesLow H A B C R J)‖ ≤ K*R) + (hPsq : ∑ e, ‖spinMatrixOperator (qmaThirdSeriesPair (A e) (B e) (J e))‖^2 ≤ K) + (hTarget : ‖spinMatrixOperator (qmaThirdSeriesTarget H A B C J)‖ ≤ K) + (hPert : ‖qmaPerturbationOperator (qmaThirdSeriesLow H A B C R J) + (fun e => (R^2 : ℝ) • C e) + (fun e => (R^2 : ℝ) • qmaThirdSeriesPair (A e) (B e) (J e))‖ ≤ K*R^2) + (hCouple : ∑ e, ‖spinMatrixOperator ((R^2 : ℝ) • + qmaThirdSeriesPair (A e) (B e) (J e))‖ ≤ R^3*(K/R)) + (u : EuclideanSpace ℂ σ) (hu : ‖u‖ = 1) : + |MediatorGraph.normalizedBottom (qmaPhysicalMediatorMatrix (R^3) + (qmaThirdSeriesLow H A B C R J) (fun e => (R^2 : ℝ) • C e) + (fun e => (R^2 : ℝ) • qmaThirdSeriesPair (A e) (B e) (J e)))- + MediatorGraph.normalizedBottom (qmaThirdSeriesTarget H A B C J)| ≤ 5*K^4/R := by + let L := qmaThirdSeriesLow H A B C R J + let P := fun e => qmaThirdSeriesPair (A e) (B e) (J e) + let D := fun e => (R^2 : ℝ) • C e + let V := fun e => (R^2 : ℝ) • P e + let M := qmaThirdMatrix L D V (R^3 : ℝ) + let T := qmaThirdSeriesTarget H A B C J + let E := ((R:ℂ)⁻¹)^2 • (∑ e, P e*L*P e) + have hRp : 0 < R := by linarith + have hKp : 0 ≤ K := by linarith + have hident : M = T+E := qmaThirdMatrix_target H A B C R J hRp.ne' hA hB hAB hAC hBC hP + have hE : ‖spinMatrixOperator E‖ ≤ K^2/R := + qmaThirdResidual_polynomial_bound L P hRp hKp hPsq hL + have hsmallE : K^2/R ≤ K := by + apply (div_le_iff₀ hRp).mpr + nlinarith + have hM : ‖spinMatrixOperator M‖ ≤ 2*K := by + rw [hident,spinMatrixOperator_add] + exact (norm_add_le _ _).trans ((add_le_add hTarget (hE.trans hsmallE)).trans_eq (by ring)) + have hDstar (e : κ) : (D e).conjTranspose = D e := by + change ((R^2 : ℝ) • C e).conjTranspose = (R^2 : ℝ) • C e + simp only [Matrix.conjTranspose_smul,star_trivial,hC] + have hVstar (e : κ) : (V e).conjTranspose = V e := by + change ((R^2 : ℝ) • P e).conjTranspose = (R^2 : ℝ) • P e + have hPe : (P e).conjTranspose = P e := hP e + rw [Matrix.conjTranspose_smul,star_trivial,hPe] + have hbound (p : EuclideanSpace ℂ σ) (hp : ‖p‖ = 1) : + |qmaQuadratic M (fun i => p i)| ≤ 2*K := by + have hb := (qmaQuadratic_norm_bound M p).trans + (mul_le_mul_of_nonneg_right hM (sq_nonneg ‖p‖)) + simpa only [hp,one_pow,mul_one] using hb + have hg : 0 < R^3 := pow_pos hRp 3 + have hground := qmaPhysical_thirdOrder_ground (R^3) L D V hg hLstar hDstar hVstar + (show 0 ≤ K*R^2 by positivity) (show 0 ≤ 2*K by positivity) + (Perturbation.thirdOrder_scale_small hK hR) hPert hCouple hbound u hu + rw [qmaThirdOrderBottom_eq] at hground + have hMT : |MediatorGraph.normalizedBottom M-MediatorGraph.normalizedBottom T| ≤ K^2/R := by + apply qmaNormalizedBottom_norm_error M T u hu + simpa only [hident,add_sub_cancel_left] using hE + have hK24 : K^2 ≤ K^4 := by + exact pow_le_pow_right₀ hK (by omega : (2:ℕ) ≤ 4) + calc + _ ≤ |MediatorGraph.normalizedBottom (qmaPhysicalMediatorMatrix (R^3) L D V)- + MediatorGraph.normalizedBottom M|+ + |MediatorGraph.normalizedBottom M-MediatorGraph.normalizedBottom T| := abs_sub_le _ _ _ + _ ≤ (2*(K*R^2)^2/R^3+2*(2*K))*(K/R)^2+K^2/R := add_le_add hground hMT + _ ≤ 4*K^4/R+K^4/R := add_le_add (Perturbation.thirdOrder_scale_error hK hR) + (div_le_div_of_nonneg_right hK24 hRp.le) + _ = _ := by ring + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorThirdForm.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorThirdForm.lean new file mode 100644 index 0000000000000000000000000000000000000000..8996bbd919d071bb96fe7e5c2c33ddc83e09fc16 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorThirdForm.lean @@ -0,0 +1,57 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorForms +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorSeriesError +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumOperatorQuadratic + +namespace OAI + +/-! The actual third-order Hilbert form is the computed finite matrix. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators InnerProductSpace Classical +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + +omit [DecidableEq σ] in +theorem qmaThirdMatrix_compressed (g : ℝ) (C : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) : + qmaThirdMatrix C D V (g:ℂ) = + C-(g⁻¹:ℝ) • ((qmaAncillaColumn V).conjTranspose*qmaAncillaColumn V)+ + (g⁻¹^2:ℝ) • ((qmaAncillaColumn V).conjTranspose* + qmaMediatorPerturbation C D V*qmaAncillaColumn V) := by + have hs (s : ℝ) (M : Matrix σ σ ℂ) : s • M = (s:ℂ) • M := rfl + simp only [hs,Complex.ofReal_pow,Complex.ofReal_inv,qmaThirdMatrix, + qmaAncillaColumn_gram,qmaMediatorPerturbation_compression] + +theorem qmaActual_thirdOrderForm (g : ℝ) (C : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) + (p : EuclideanSpace ℂ σ) : + Perturbation.thirdOrderForm ((qmaMatrixOperator C).restrictScalars ℝ) + (qmaPaddedInverse g) (qmaComplementOperator C D V) (qmaCouplingOperator V) p = + qmaQuadratic (qmaThirdMatrix C D V (g:ℂ)) (fun i => p i) := by + have hgram : qmaQuadratic ((qmaAncillaColumn V).conjTranspose*qmaAncillaColumn V) + (fun i => p i) = ⟪qmaMatrixOperator (qmaAncillaColumn V) p, + qmaMatrixOperator (qmaAncillaColumn V) p⟫_ℝ := by + have h := qmaQuadratic_sandwich (qmaAncillaColumn V) + (1 : Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ) p + simpa only [Matrix.mul_one,qmaMatrixOperator_square,spinMatrixOperator_one, + one_apply_eq_self] using h + have hcompress := qmaQuadratic_sandwich (qmaAncillaColumn V) (qmaMediatorPerturbation C D V) p + rw [qmaThirdMatrix_compressed,qmaQuadratic_add,qmaQuadratic_sub,qmaQuadratic_real_smul, + qmaQuadratic_real_smul,qmaQuadratic_operator C p,hgram,hcompress] + unfold Perturbation.thirdOrderForm Perturbation.effectiveForm Perturbation.inverseForm + change ⟪p,qmaMatrixOperator C p⟫_ℝ- + ⟪qmaMatrixOperator (qmaAncillaColumn V) p,qmaPaddedInverse g (qmaMatrixOperator (qmaAncillaColumn V) p)⟫_ℝ+ + ⟪qmaPaddedInverse g (qmaMatrixOperator (qmaAncillaColumn V) p), + qmaComplementOperator C D V (qmaPaddedInverse g (qmaMatrixOperator (qmaAncillaColumn V) p))⟫_ℝ = _ + rw [qmaPaddedInverse_column] + simp only [map_smul,real_inner_smul_left,real_inner_smul_right] + rw [qmaComplementOperator_form C D V _ (qmaMediatorRestriction_column V p)] + have he : qmaPerturbationOperator C D V (qmaMatrixOperator (qmaAncillaColumn V) p) = + qmaMatrixOperator (qmaMediatorPerturbation C D V) (qmaMatrixOperator (qmaAncillaColumn V) p) := rfl + rw [he] + ring + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorTrial.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorTrial.lean new file mode 100644 index 0000000000000000000000000000000000000000..8de54fb5bfb0bcd491132df83b7b218f5fc552fc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitMediatorTrial.lean @@ -0,0 +1,82 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorBounds + +namespace OAI + +/-! The third-order trial vector lies in the genuine physical spin space. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators InnerProductSpace Classical +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + +def qmaThirdTrial (g : ℝ) (V : κ → Matrix σ σ ℂ) (p : EuclideanSpace ℂ σ) : + EuclideanSpace ℂ (σ × (κ → Fin 2)) := + qmaMediatorInclusion p+(-(qmaPaddedInverse g (qmaCouplingOperator V p))) + +theorem qmaThirdTrial_high_kernel (g : ℝ) (V : κ → Matrix σ σ ℂ) (p : EuclideanSpace ℂ σ) : + qmaMediatorRestriction (-(qmaPaddedInverse g (qmaCouplingOperator V p))) = 0 := by + change qmaMediatorRestriction (-(qmaPaddedInverse g (qmaMatrixOperator (qmaAncillaColumn V) p))) = 0 + rw [qmaPaddedInverse_column,map_neg,map_smul,qmaMediatorRestriction_column,smul_zero,neg_zero] + +theorem qmaThirdTrial_norm (g : ℝ) (V : κ → Matrix σ σ ℂ) (p : EuclideanSpace ℂ σ) : + ‖qmaThirdTrial g V p‖^2 = ‖p‖^2+‖qmaPaddedInverse g (qmaCouplingOperator V p)‖^2 := by + have h := Perturbation.orthogonalAssemble_norm + (qmaMediatorInclusion (σ := σ) (κ := κ)) (qmaMediatorRestriction (σ := σ) (κ := κ)) + qmaMediator_restrict_include qmaMediator_inclusion_adjoint p + (-(qmaPaddedInverse g (qmaCouplingOperator V p))) (qmaThirdTrial_high_kernel g V p) + simpa only [qmaThirdTrial,norm_neg] using h + +theorem qmaThirdTrial_energy (g : ℝ) (C : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) + (hC : C.conjTranspose = C) (hD : ∀ e, (D e).conjTranspose = D e) + (hV : ∀ e, (V e).conjTranspose = V e) (p : EuclideanSpace ℂ σ) : + ⟪qmaThirdTrial g V p,qmaPhysicalOperator g C D V (qmaThirdTrial g V p)⟫_ℝ = + Perturbation.lowBlockEnergy ((qmaMatrixOperator C).restrictScalars ℝ) + (qmaPaddedPenalty g) (qmaComplementOperator C D V) (qmaCouplingOperator V) p + (-(qmaPaddedInverse g (qmaCouplingOperator V p))) := by + exact Perturbation.orthogonalBlock_energy + (qmaMediatorInclusion (σ := σ) (κ := κ)) (qmaMediatorRestriction (σ := σ) (κ := κ)) + (qmaPhysicalOperator g C D V) (qmaPaddedPenalty g) (qmaComplementOperator C D V) + ((qmaMatrixOperator C).restrictScalars ℝ) (qmaCouplingOperator V) + qmaMediator_restrict_include qmaMediator_inclusion_adjoint + (qmaMatrixOperator_real_symmetric _ (qmaPhysicalMediator_star g C D V hC hD hV)) + (qmaPhysicalOperator_low g C D V) (qmaMediatorRestriction_column V) + (qmaPhysicalOperator_high g C D V) p _ (qmaThirdTrial_high_kernel g V p) + +theorem qmaPhysical_thirdOrder_trial (g : ℝ) (C : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) + (hg : 0 < g) (hC : C.conjTranspose = C) (hD : ∀ e, (D e).conjTranspose = D e) + (hV : ∀ e, (V e).conjTranspose = V e) {m η μ : ℝ} (hm : 0 ≤ m) + (hCouple : ∑ e, ‖spinMatrixOperator (V e)‖ ≤ g*η) (hμ : -m ≤ μ) + (p : EuclideanSpace ℂ σ) (hp : ‖p‖ = 1) + (he : qmaQuadratic (qmaThirdMatrix C D V (g:ℂ)) (fun i => p i) = μ) : + 0 < ‖qmaThirdTrial g V p‖^2 ∧ + ⟪qmaThirdTrial g V p,qmaPhysicalOperator g C D V (qmaThirdTrial g V p)⟫_ℝ / + ‖qmaThirdTrial g V p‖^2 ≤ μ+m*η^2 := by + constructor + · rw [qmaThirdTrial_norm,hp] + positivity + · rw [qmaThirdTrial_energy g C D V hC hD hV,qmaThirdTrial_norm] + have hAT (z : EuclideanSpace ℂ (σ × (κ → Fin 2))) : + qmaPaddedPenalty g (qmaPaddedInverse g z) = z := + qmaPaddedPenalty_inverse (σ := σ) (κ := κ) hg z + have heForm : Perturbation.thirdOrderForm ((qmaMatrixOperator C).restrictScalars ℝ) + (qmaPaddedInverse g) (qmaComplementOperator C D V) (qmaCouplingOperator V) p = μ := by + rw [qmaActual_thirdOrderForm] + exact he + have h : Perturbation.lowBlockRayleigh ((qmaMatrixOperator C).restrictScalars ℝ) + (qmaPaddedPenalty g) (qmaComplementOperator C D V) (qmaCouplingOperator V) p + (-(qmaPaddedInverse g (qmaCouplingOperator V p))) ≤ μ+m*η^2 := by + apply Perturbation.thirdOrder_trial_upper ((qmaMatrixOperator C).restrictScalars ℝ) + (qmaPaddedPenalty g) (qmaPaddedInverse g) (qmaComplementOperator C D V) (qmaCouplingOperator V) hm + · exact hAT + · exact qmaInverseCoupling_bound g hg V hCouple + · exact hμ + · exact hp + · exact heForm + simpa only [Perturbation.lowBlockRayleigh,norm_neg] using h + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitPhase.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitPhase.lean new file mode 100644 index 0000000000000000000000000000000000000000..ad92229fe8510abc188c6346d743d1c4f874c903 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitPhase.lean @@ -0,0 +1,100 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumUnitaryGround +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalJoin +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorNorm + +namespace OAI + +/-! A diagonal unitary rotates any chosen mediator X couplings to Y. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical +variable {κ : Type*} [Fintype κ] [DecidableEq κ] + +def qmaPhaseFactor (m : Bool) (a : Fin 2) : ℂ := + if m = true ∧ a = 1 then -Complex.I else 1 + +theorem qmaPhaseFactor_gram (m : Bool) (a : Fin 2) : + star (qmaPhaseFactor m a)*qmaPhaseFactor m a = 1 := by + cases m <;> fin_cases a <;> norm_num [qmaPhaseFactor] + +theorem qmaPhaseFactor_flip (m : Bool) (a : Fin 2) : + star (qmaPhaseFactor m (Equiv.swap (0:Fin 2) 1 a))*qmaPhaseFactor m a = + if m = true then (if a = 1 then -Complex.I else Complex.I) else 1 := by + cases m <;> fin_cases a <;> norm_num [qmaPhaseFactor] + +def qmaAncillaPhase (m : κ → Bool) (a : κ → Fin 2) : ℂ := ∏ e, qmaPhaseFactor (m e) (a e) + +omit [DecidableEq κ] in +theorem qmaAncillaPhase_gram (m : κ → Bool) (a : κ → Fin 2) : + star (qmaAncillaPhase m a)*qmaAncillaPhase m a = 1 := by + simp only [qmaAncillaPhase,star_prod,← Finset.prod_mul_distrib,qmaPhaseFactor_gram,Finset.prod_const_one] + +def qmaPhaseMatrix (m : κ → Bool) : Matrix (κ → Fin 2) (κ → Fin 2) ℂ := + Matrix.diagonal (qmaAncillaPhase m) + +theorem qmaPhaseMatrix_gram (m : κ → Bool) : (qmaPhaseMatrix m).conjTranspose*qmaPhaseMatrix m = 1 := by + ext a b + by_cases h : a = b + · subst b + simp [qmaPhaseMatrix,Matrix.mul_apply,Matrix.diagonal_apply] + exact qmaAncillaPhase_gram m a + · simp [qmaPhaseMatrix,Matrix.mul_apply,Matrix.diagonal_apply,h] + +theorem qmaPhaseMatrix_cogram (m : κ → Bool) : qmaPhaseMatrix m*(qmaPhaseMatrix m).conjTranspose = 1 := by + ext a b + by_cases h : a = b + · subst b + simpa [qmaPhaseMatrix,Matrix.mul_apply,Matrix.conjTranspose_apply,Matrix.diagonal_apply, + mul_comm] using qmaAncillaPhase_gram m a + · simp [qmaPhaseMatrix,Matrix.mul_apply,Matrix.diagonal_apply,h] + +theorem qmaAncillaPhase_flip (m : κ → Bool) (e : κ) (b : κ → Fin 2) : + star (qmaAncillaPhase m (qmaBitFlip e b))*qmaAncillaPhase m b = + if m e = true then (if b e = 1 then -Complex.I else Complex.I) else 1 := by + unfold qmaAncillaPhase + rw [star_prod,← Finset.prod_mul_distrib,Finset.prod_eq_single e] + · simpa only [qmaBitFlip,Function.update_self] using qmaPhaseFactor_flip (m e) (b e) + · intro f _ hfe + simp only [qmaBitFlip,Function.update_of_ne hfe] + exact qmaPhaseFactor_gram (m f) (b f) + · intro h + exact False.elim (h (Finset.mem_univ e)) + +def qmaPolarizedFlip (m : κ → Bool) (e : κ) : Matrix (κ → Fin 2) (κ → Fin 2) ℂ := + fun a b => if a = qmaBitFlip e b then + (if m e = true then (if b e = 1 then -Complex.I else Complex.I) else 1) else 0 + +theorem qmaDiagonal_sandwich {α : Type*} [Fintype α] [DecidableEq α] + (f : α → ℂ) (M : Matrix α α ℂ) (a b : α) : + ((Matrix.diagonal f).conjTranspose*M*Matrix.diagonal f) a b = star (f a)*M a b*f b := by + simp [Matrix.mul_apply,Matrix.diagonal_apply] + +theorem qmaPhaseMatrix_flip (m : κ → Bool) (e : κ) : + (qmaPhaseMatrix m).conjTranspose*qmaBitFlipMatrix e*qmaPhaseMatrix m = qmaPolarizedFlip m e := by + ext a b + rw [qmaPhaseMatrix,qmaDiagonal_sandwich] + by_cases h : a = qmaBitFlip e b + · subst a + simp only [qmaBitFlipMatrix,qmaPolarizedFlip,ite_true,mul_one] + exact qmaAncillaPhase_flip m e b + · simp [qmaBitFlipMatrix,qmaPolarizedFlip,h] + +theorem qmaPhaseMatrix_diagonal (m : κ → Bool) (d : (κ → Fin 2) → ℂ) : + (qmaPhaseMatrix m).conjTranspose*Matrix.diagonal d*qmaPhaseMatrix m = Matrix.diagonal d := by + ext a b + rw [qmaPhaseMatrix,qmaDiagonal_sandwich] + by_cases h : a = b + · subst b + simp only [Matrix.diagonal_apply_eq] + calc + _ = (star (qmaAncillaPhase m a)*qmaAncillaPhase m a)*d a := by ring + _ = _ := by rw [qmaAncillaPhase_gram,one_mul] + · simp [h] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitPhaseLocal.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitPhaseLocal.lean new file mode 100644 index 0000000000000000000000000000000000000000..e9044fff5755e328a89ccb16cebeb89acac9edde --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitPhaseLocal.lean @@ -0,0 +1,71 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitPhase + +namespace OAI + +/-! Rotated mediator couplings are still one-local and have the required +entry parity to keep the physical Hamiltonian real. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical +variable {κ : Type*} [Fintype κ] [DecidableEq κ] + +def qmaBitZ (e : κ) : Matrix (κ → Fin 2) (κ → Fin 2) ℂ := + Matrix.diagonal (fun a => if a e = 1 then -1 else 1) + +theorem qmaBitZ_local (e : κ) : QMALocalOn {e} (qmaBitZ e) := by + apply qmaLocalOn_diagonal + intro s t h + rw [h e (Finset.mem_singleton_self e)] + +theorem qmaPolarizedFlip_eq (m : κ → Bool) (e : κ) : + qmaPolarizedFlip m e = if m e = true then + Complex.I • (qmaBitFlipMatrix e*qmaBitZ e) else qmaBitFlipMatrix e := by + ext a b + have hdiag : (qmaBitFlipMatrix e*qmaBitZ e) a b = + qmaBitFlipMatrix e a b*(if b e = 1 then -1 else 1) := by + simp [qmaBitZ,Matrix.mul_apply,Matrix.diagonal_apply] + by_cases hm : m e = true + · simp only [hm,ite_true,Matrix.smul_apply,smul_eq_mul,hdiag,qmaBitFlipMatrix,qmaPolarizedFlip] + split_ifs <;> ring + · simp [qmaPolarizedFlip,qmaBitFlipMatrix,hm] + +theorem qmaPolarizedFlip_local (m : κ → Bool) (e : κ) : QMALocalOn {e} (qmaPolarizedFlip m e) := by + rw [qmaPolarizedFlip_eq] + split_ifs + · exact ((qmaBitFlipMatrix_local e).mul (qmaBitZ_local e)).smul Complex.I + · exact qmaBitFlipMatrix_local e + +theorem qmaPolarizedFlip_im_zero (m : κ → Bool) (e : κ) (h : m e = false) + (a b : κ → Fin 2) : (qmaPolarizedFlip m e a b).im = 0 := by + simp only [qmaPolarizedFlip,h,Bool.false_eq_true,ite_false] + split_ifs <;> norm_num + +theorem qmaPolarizedFlip_re_zero (m : κ → Bool) (e : κ) (h : m e = true) + (a b : κ → Fin 2) : (qmaPolarizedFlip m e a b).re = 0 := by + simp only [qmaPolarizedFlip,h,ite_true] + split_ifs <;> norm_num + +variable {σ : Type*} [Fintype σ] [DecidableEq σ] + +omit [Fintype σ] [DecidableEq σ] in +theorem qmaPolarizedTensor_real (m : κ → Bool) (e : κ) (M : Matrix σ σ ℂ) + (hM : if m e = true then ∀ s t, (M s t).re = 0 else ∀ s t, (M s t).im = 0) + (p q : σ × (κ → Fin 2)) : ((M ⊗ₖ qmaPolarizedFlip m e) p q).im = 0 := by + rcases p with ⟨s,a⟩ + rcases q with ⟨t,b⟩ + simp only [Matrix.kronecker_apply,Complex.mul_im] + cases he : m e + · simp only [he,Bool.false_eq_true,ite_false] at hM + rw [hM s t,qmaPolarizedFlip_im_zero m e he] + ring + · simp only [he,ite_true] at hM + rw [hM s t,qmaPolarizedFlip_re_zero m e he] + ring + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitPhasePhysical.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitPhasePhysical.lean new file mode 100644 index 0000000000000000000000000000000000000000..6cbd784242eb8a0cdc53b41aceb53f90c8167da7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitPhasePhysical.lean @@ -0,0 +1,84 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitPhaseLocal +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorPhysical + +namespace OAI + +/-! Independent mediator phase rotations preserve the full physical spectrum. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + +def qmaPhaseLift (m : κ → Bool) : Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ := + (1 : Matrix σ σ ℂ) ⊗ₖ qmaPhaseMatrix m + +theorem qmaPhaseLift_gram (m : κ → Bool) : + (qmaPhaseLift (σ := σ) m).conjTranspose*qmaPhaseLift m = 1 := by + unfold qmaPhaseLift + rw [Matrix.conjTranspose_kronecker,← Matrix.mul_kronecker_mul, + Matrix.conjTranspose_one,one_mul,qmaPhaseMatrix_gram,Matrix.one_kronecker_one] + +theorem qmaPhaseLift_cogram (m : κ → Bool) : + qmaPhaseLift (σ := σ) m*(qmaPhaseLift m).conjTranspose = 1 := by + unfold qmaPhaseLift + rw [Matrix.conjTranspose_kronecker,← Matrix.mul_kronecker_mul, + Matrix.conjTranspose_one,one_mul,qmaPhaseMatrix_cogram,Matrix.one_kronecker_one] + +theorem qmaPhaseLift_sandwich (m : κ → Bool) (M : Matrix σ σ ℂ) + (N : Matrix (κ → Fin 2) (κ → Fin 2) ℂ) : + (qmaPhaseLift m).conjTranspose*(M ⊗ₖ N)*qmaPhaseLift m = + M ⊗ₖ ((qmaPhaseMatrix m).conjTranspose*N*qmaPhaseMatrix m) := by + unfold qmaPhaseLift + rw [Matrix.conjTranspose_kronecker,← Matrix.mul_kronecker_mul,← Matrix.mul_kronecker_mul, + Matrix.conjTranspose_one,one_mul,mul_one] + +theorem qmaPhaseLift_diagonal (m : κ → Bool) (M : Matrix σ σ ℂ) + (d : (κ → Fin 2) → ℂ) : + (qmaPhaseLift m).conjTranspose*(M ⊗ₖ Matrix.diagonal d)*qmaPhaseLift m = M ⊗ₖ Matrix.diagonal d := by + rw [qmaPhaseLift_sandwich,qmaPhaseMatrix_diagonal] + +theorem qmaPhaseLift_old (m : κ → Bool) (M : Matrix σ σ ℂ) : + (qmaPhaseLift m).conjTranspose*(M ⊗ₖ (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ))*qmaPhaseLift m = + M ⊗ₖ (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ) := by + rw [qmaPhaseLift_sandwich,mul_one,qmaPhaseMatrix_gram] + +theorem qmaPhaseLift_flip (m : κ → Bool) (M : Matrix σ σ ℂ) (e : κ) : + (qmaPhaseLift m).conjTranspose*(M ⊗ₖ qmaBitFlipMatrix e)*qmaPhaseLift m = + M ⊗ₖ qmaPolarizedFlip m e := by + rw [qmaPhaseLift_sandwich,qmaPhaseMatrix_flip] + +def qmaPolarizedPhysical (g : ℝ) (L : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) + (m : κ → Bool) : Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ := + qmaPhysicalPenaltyMatrix g+(L ⊗ₖ (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ)+ + qmaMediatorOccupations D+∑ e, V e ⊗ₖ qmaPolarizedFlip m e) + +theorem qmaPhaseLift_physical (g : ℝ) (L : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) + (m : κ → Bool) : + (qmaPhaseLift m).conjTranspose*qmaPhysicalMediatorMatrix g L D V*qmaPhaseLift m = + qmaPolarizedPhysical g L D V m := by + have hpen : (qmaPhaseLift m).conjTranspose*qmaPhysicalPenaltyMatrix (σ := σ) g*qmaPhaseLift m = + qmaPhysicalPenaltyMatrix g := qmaPhaseLift_diagonal m 1 _ + have hocc (e : κ) : + (qmaPhaseLift m).conjTranspose*(D e ⊗ₖ qmaAncillaOccupation e)*qmaPhaseLift m = + D e ⊗ₖ qmaAncillaOccupation e := qmaPhaseLift_diagonal m (D e) _ + unfold qmaPhysicalMediatorMatrix qmaMediatorPerturbation qmaMediatorOccupations qmaMediatorFlips + qmaPolarizedPhysical + simp only [Matrix.mul_add,Matrix.add_mul,Matrix.mul_sum,Matrix.sum_mul, + hpen,hocc,qmaPhaseLift_old,qmaPhaseLift_flip] + rfl + +theorem qmaPolarizedPhysical_bottom (g : ℝ) (L : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) + (m : κ → Bool) : + MediatorGraph.normalizedBottom (qmaPolarizedPhysical g L D V m) = + MediatorGraph.normalizedBottom (qmaPhysicalMediatorMatrix g L D V) := by + rw [← qmaPhaseLift_physical] + exact qmaNormalizedBottom_unitary (qmaPhaseLift m) (qmaPhysicalMediatorMatrix g L D V) + (qmaPhaseLift_gram m) (qmaPhaseLift_cogram m) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitPhysicalComparison.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitPhysicalComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..6f38df7d896b7ae9fb84fb4460882121c129490a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitPhysicalComparison.lean @@ -0,0 +1,40 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorTargetGround + +namespace OAI + +/-! Turning an exact compressed-matrix identity into a physical target-energy +comparison, for the subdivision and third-order constructions. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators InnerProductSpace Classical +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + +theorem qmaPhysical_target_error (g : ℝ) (L T : Matrix σ σ ℂ) (D V : κ → Matrix σ σ ℂ) + (hg : 0 < g) (hL : L.conjTranspose = L) (hD : ∀ e, (D e).conjTranspose = D e) + (hV : ∀ e, (V e).conjTranspose = V e) {d m η δ : ℝ} + (hd : 0 ≤ d) (hm : 0 ≤ m) (hsmall : 2*d+4*m ≤ g) + (hPert : ‖qmaPerturbationOperator L D V‖ ≤ d) + (hCouple : ∑ e, ‖spinMatrixOperator (V e)‖ ≤ g*η) + (hM : ‖spinMatrixOperator (qmaThirdMatrix L D V (g:ℂ))‖ ≤ m) + (hError : ‖spinMatrixOperator (qmaThirdMatrix L D V (g:ℂ)-T)‖ ≤ δ) + (u : EuclideanSpace ℂ σ) (hu : ‖u‖ = 1) : + |MediatorGraph.normalizedBottom (qmaPhysicalMediatorMatrix g L D V)- + MediatorGraph.normalizedBottom T| ≤ (2*d^2/g+2*m)*η^2+δ := by + have hbound (p : EuclideanSpace ℂ σ) (hp : ‖p‖ = 1) : + |qmaQuadratic (qmaThirdMatrix L D V (g:ℂ)) (fun i => p i)| ≤ m := by + have h := (qmaQuadratic_norm_bound _ p).trans + (mul_le_mul_of_nonneg_right hM (sq_nonneg ‖p‖)) + simpa only [hp,one_pow,mul_one] using h + have hground := qmaPhysical_thirdOrder_ground g L D V hg hL hD hV hd hm hsmall + hPert hCouple hbound u hu + rw [qmaThirdOrderBottom_eq] at hground + have htarget := qmaNormalizedBottom_norm_error (qmaThirdMatrix L D V (g:ℂ)) T u hu hError + exact (abs_sub_le _ _ _).trans (add_le_add hground htarget) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionCalibration.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionCalibration.lean new file mode 100644 index 0000000000000000000000000000000000000000..166e0b975cac60abd5f0aa2bf0551997a7af131d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionCalibration.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionNorm + +namespace OAI + +/-! One explicit coefficient budget discharges the subdivision norm bounds. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + +theorem qmaSubdivision_calibration (H : Matrix σ σ ℂ) (A B : κ → Matrix σ σ ℂ) + (J : κ → ℝ) {b R : ℝ} (hb : 0 ≤ b) (hR : 1 ≤ R) + (hH : ‖spinMatrixOperator H‖ ≤ b) + (hA : ∀ e, ‖spinMatrixOperator (A e)‖ ≤ 1) (hB : ∀ e, ‖spinMatrixOperator (B e)‖ ≤ 1) : + let K := qmaThirdBudget b J + let L := qmaSubdivisionLow H (fun e => J e) + let P := fun e => qmaThirdSeriesPair (A e) (B e) (-J e) + ‖spinMatrixOperator L‖ ≤ K ∧ + (∑ e, ‖spinMatrixOperator (P e)‖^2 ≤ K) ∧ + ‖spinMatrixOperator (qmaSubdivisionTarget H A B (fun e => J e))‖ ≤ K ∧ + ‖qmaPerturbationOperator L (fun _ : κ => 0) (fun e => (R:ℝ) • P e)‖ ≤ K*R ∧ + (∑ e, ‖spinMatrixOperator ((R:ℝ) • P e)‖ ≤ R^2*(K/R)) := by + let S := ∑ e, qmaThirdWeight (J e) + let W := 1+b+S + let L := qmaSubdivisionLow H (fun e => J e) + let P := fun e => qmaThirdSeriesPair (A e) (B e) (-J e) + have hS : 0 ≤ S := Finset.sum_nonneg (fun e _ => sq_nonneg _) + have hSW : S ≤ W := by dsimp [W]; linarith + have hW : 0 ≤ W := by dsimp [W]; linarith + have hR0 : 0 ≤ R := by linarith + have hRp : 0 < R := by linarith + have hp0 := qmaThirdPair_sum_bounds A B (fun e => -J e) hA hB + simp only [qmaThirdWeight_neg, Complex.ofReal_neg] at hp0 + have hpair : (∑ e, ‖spinMatrixOperator (P e)‖ ≤ S) ∧ + (∑ e, ‖spinMatrixOperator (P e)‖^2 ≤ S) := by + exact hp0 + have hL : ‖spinMatrixOperator L‖ ≤ W := by + apply (qmaSubdivisionLow_norm H J hH).trans + dsimp [W] + linarith + have hLbig : ‖spinMatrixOperator L‖ ≤ 4*W := hL.trans (by linarith) + have hPsq : ∑ e, ‖spinMatrixOperator (P e)‖^2 ≤ 4*W := hpair.2.trans (by linarith) + have htarget : ‖spinMatrixOperator (qmaSubdivisionTarget H A B (fun e => J e))‖ ≤ 4*W := by + apply (qmaSubdivisionTarget_norm H A B J hH hA hB).trans + dsimp [W] + linarith + have hpert : ‖qmaPerturbationOperator L (fun _ : κ => 0) (fun e => (R:ℝ) • P e)‖ ≤ (4*W)*R := by + have hn := qmaPerturbationOperator_norm L (fun _ : κ => 0) (fun e => (R:ℝ) • P e) + simp only [qmaSpinMatrix_zero,norm_zero,Finset.sum_const_zero,add_zero, + qmaScalarCoupling_sum P hR0] at hn + have hp := mul_le_mul_of_nonneg_left (hpair.1.trans hSW) hR0 + have hrw : W ≤ R*W := by nlinarith + nlinarith + have hcouple : ∑ e, ‖spinMatrixOperator ((R:ℝ) • P e)‖ ≤ R^2*((4*W)/R) := by + rw [qmaScalarCoupling_sum P hR0] + calc + _ ≤ R*(4*W) := mul_le_mul_of_nonneg_left (hpair.1.trans (by linarith)) hR0 + _ = _ := by field_simp + exact ⟨hLbig,hPsq,htarget,hpert,hcouple⟩ + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionDecomposition.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionDecomposition.lean new file mode 100644 index 0000000000000000000000000000000000000000..fe0759f66dd08dca6a38ebcf8a4f9f064df005d5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionDecomposition.lean @@ -0,0 +1,69 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionGadget +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdDecomposition +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitPhasePhysical + +namespace OAI + +/-! An exact four-term output family for a phase-rotated subdivision gadget. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + +def qmaSubdivisionPolarized (H : Matrix σ σ ℂ) (A B : κ → Matrix σ σ ℂ) + (R : ℝ) (J : κ → ℝ) (m : κ → Bool) : + Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ := + qmaPolarizedPhysical (R^2) (qmaSubdivisionLow H (fun e => J e)) (fun _ => 0) + (fun e => (R:ℝ) • qmaThirdSeriesPair (A e) (B e) (-J e)) m + +def qmaSubdivisionPiece (A B : Matrix σ σ ℂ) (e : κ) (R j : ℝ) (m : κ → Bool) : + Fin 4 → Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ := + ![(R^2:ℝ) • ((1 : Matrix σ σ ℂ) ⊗ₖ qmaAncillaOccupation e), + (1+(j/2)^2:ℝ) • (1 : Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ), + (R:ℝ) • (A ⊗ₖ qmaPolarizedFlip m e), + (-R*j/2:ℝ) • (B ⊗ₖ qmaPolarizedFlip m e)] + +omit [Fintype σ] in +theorem qmaSubdivisionPiece_sum (A B : Matrix σ σ ℂ) (e : κ) (R j : ℝ) (m : κ → Bool) : + (∑ k, qmaSubdivisionPiece A B e R j m k) = + (R^2:ℝ) • ((1 : Matrix σ σ ℂ) ⊗ₖ qmaAncillaOccupation e)+ + qmaSubdivisionCounter (j:ℂ) ⊗ₖ (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ)+ + ((R:ℝ) • qmaThirdSeriesPair A B (-j)) ⊗ₖ qmaPolarizedFlip m e := by + have hr (r : ℝ) (M : Matrix σ σ ℂ) : r • M = (r:ℂ) • M := rfl + have hp (r : ℝ) (M : Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ) : + r • M = (r:ℂ) • M := rfl + simp only [qmaSubdivisionPiece,Fin.sum_univ_succ,Fin.sum_univ_zero,add_zero, + Matrix.cons_val_zero,Matrix.cons_val_succ,qmaSubdivisionCounter,qmaThirdSeriesPair, + hr,hp,Matrix.add_kronecker,Matrix.smul_kronecker,Matrix.one_kronecker_one, + smul_add,smul_smul] + push_cast + module + +omit [Fintype σ] in +theorem qmaSubdivisionPolarized_decomposition (H : Matrix σ σ ℂ) (A B : κ → Matrix σ σ ℂ) + (R : ℝ) (J : κ → ℝ) (m : κ → Bool) : + qmaSubdivisionPolarized H A B R J m = + H ⊗ₖ (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ)+ + ∑ e, ∑ k, qmaSubdivisionPiece (A e) (B e) e R (J e) m k := by + simp only [qmaSubdivisionPolarized,qmaPolarizedPhysical,qmaSubdivisionLow, + qmaPhysicalPenalty_sum,qmaMediatorOccupations,qmaSubdivisionPiece_sum, + Matrix.add_kronecker,MediatorGraph.sum_kronecker,Matrix.zero_kronecker, + Finset.sum_const_zero,add_zero,Finset.sum_add_distrib] + have hs (r : ℝ) (M : Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ) : + r • M = (r:ℂ) • M := rfl + simp only [hs] + abel + +theorem qmaSubdivisionPolarized_bottom (H : Matrix σ σ ℂ) (A B : κ → Matrix σ σ ℂ) + (R : ℝ) (J : κ → ℝ) (m : κ → Bool) : + MediatorGraph.normalizedBottom (qmaSubdivisionPolarized H A B R J m) = + MediatorGraph.normalizedBottom (qmaSubdivisionGadget H A B R J) := + qmaPolarizedPhysical_bottom _ _ _ _ _ + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionEnvelope.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionEnvelope.lean new file mode 100644 index 0000000000000000000000000000000000000000..45824bf9260f509c40968e31a7e2b07a3277cfe2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionEnvelope.lean @@ -0,0 +1,65 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionHermitian + +namespace OAI + +/-! Explicit small supports for each subdivision piece remain inside its source envelope. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped Classical +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +def qmaMediatorSupport (S : Finset ι) (e : κ) : Finset (ι ⊕ κ) := + S.map Function.Embedding.inl ∪ ({e} : Finset κ).map Function.Embedding.inr + +omit [Fintype ι] [Fintype κ] in +theorem qmaMediatorSupport_card (S : Finset ι) (e : κ) : + (qmaMediatorSupport S e).card ≤ S.card+1 := by + have h := Finset.card_union_le (S.map (Function.Embedding.inl : ι ↪ ι ⊕ κ)) + (({e} : Finset κ).map Function.Embedding.inr) + simpa only [qmaMediatorSupport,Finset.card_map,Finset.card_singleton] using h + +omit [Fintype ι] [Fintype κ] in +theorem qmaMediatorSupport_mono {S T : Finset ι} (h : S ⊆ T) (e : κ) : + qmaMediatorSupport S e ⊆ qmaMediatorSupport T e := + Finset.union_subset_union (Finset.map_subset_map.mpr h) (Finset.Subset.refl _) + +def qmaSubdivisionPieceSites (SA SB : Finset ι) (e : κ) : Fin 4 → Finset (ι ⊕ κ) := + ![qmaMediatorSupport ∅ e,∅,qmaMediatorSupport SA e,qmaMediatorSupport SB e] + +theorem qmaSubdivisionPieceSites_local (A B : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (e : κ) (R j : ℝ) (m : κ → Bool) {SA SB : Finset ι} + (hA : QMALocalOn SA A) (hB : QMALocalOn SB B) (k : Fin 4) : + QMALocalOn (qmaSubdivisionPieceSites SA SB e k) (qmaSubdivisionLocalPiece A B e R j m k) := by + fin_cases k + · exact ((qmaLocal_identity (∅ : Finset ι)).join (qmaOccupation_local e)).real_smul (R^2) + · exact (qmaLocal_identity (∅ : Finset (ι ⊕ κ))).real_smul (1+(j/2)^2) + · exact (hA.join (qmaPolarizedFlip_local m e)).real_smul R + · exact (hB.join (qmaPolarizedFlip_local m e)).real_smul (-R*j/2) + +omit [Fintype ι] [Fintype κ] in +theorem qmaSubdivisionPieceSites_card {SA SB : Finset ι} {d : ℕ} + (hA : SA.card ≤ d) (hB : SB.card ≤ d) (e : κ) (k : Fin 4) : + (qmaSubdivisionPieceSites SA SB e k).card ≤ d+1 := by + fin_cases k + · exact (qmaMediatorSupport_card ∅ e).trans (by simp) + · simp [qmaSubdivisionPieceSites] + · exact (qmaMediatorSupport_card SA e).trans (Nat.add_le_add_right hA 1) + · exact (qmaMediatorSupport_card SB e).trans (Nat.add_le_add_right hB 1) + +omit [Fintype ι] [Fintype κ] in +theorem qmaSubdivisionPieceSites_subset {SA SB S : Finset ι} + (hA : SA ⊆ S) (hB : SB ⊆ S) (e : κ) (k : Fin 4) : + qmaSubdivisionPieceSites SA SB e k ⊆ qmaMediatorSupport S e := by + fin_cases k + · exact qmaMediatorSupport_mono (Finset.empty_subset S) e + · exact Finset.empty_subset _ + · exact qmaMediatorSupport_mono hA e + · exact qmaMediatorSupport_mono hB e + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionGadget.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionGadget.lean new file mode 100644 index 0000000000000000000000000000000000000000..61b0203daf7b0d3de63fa57d4444bfb77f688175 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionGadget.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionGround +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionCalibration + +namespace OAI + +/-! The actual simultaneous subdivision gadget has inverse-polynomial error +at an explicit polynomial choice of rational coefficients. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators InnerProductSpace Classical +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + +theorem qmaSubdivision_polynomial_accuracy (H : Matrix σ σ ℂ) (A B : κ → Matrix σ σ ℂ) + (J : κ → ℝ) {b N : ℝ} (hb : 0 ≤ b) (hN : 1 ≤ N) + (hH : H.conjTranspose = H) (hHnorm : ‖spinMatrixOperator H‖ ≤ b) + (hAstar : ∀ e, (A e).conjTranspose = A e) (hBstar : ∀ e, (B e).conjTranspose = B e) + (hA : ∀ e, A e*A e = 1) (hB : ∀ e, B e*B e = 1) + (hAB : ∀ e, A e*B e = B e*A e) (u : EuclideanSpace ℂ σ) (hu : ‖u‖ = 1) : + let R := 8*(qmaThirdBudget b J)^4*N + |MediatorGraph.normalizedBottom (qmaSubdivisionGadget H A B R J)- + MediatorGraph.normalizedBottom (qmaSubdivisionTarget H A B (fun e => J e))| ≤ 1/N := by + let K := qmaThirdBudget b J + have hK : 1 ≤ K := qmaThirdBudget_pos hb J + have hR := (Perturbation.thirdOrder_polynomial_schedule hK hN).1 + have hr : 1 ≤ 8*K^4*N := by linarith + have hAnorm (e : κ) : ‖spinMatrixOperator (A e)‖ ≤ 1 := by + apply spinMatrixOperator_unitary_norm + rw [hAstar,hA] + have hBnorm (e : κ) : ‖spinMatrixOperator (B e)‖ ≤ 1 := by + apply spinMatrixOperator_unitary_norm + rw [hBstar,hB] + obtain ⟨hL,hPsq,hTarget,hPert,hCouple⟩ := + qmaSubdivision_calibration H A B J hb hr hHnorm hAnorm hBnorm + have he := qmaSubdivision_target_ground H A B J hK hR hA hB hAB + (fun e => by simpa only [Complex.ofReal_neg] using + qmaThirdPair_star (A e) (B e) (-J e) (hAstar e) (hBstar e)) + (qmaSubdivisionLow_star H J hH) hL hPsq hTarget hPert hCouple u hu + apply he.trans + have hNp : 0 < N := by linarith + have hKp : 0 < K := by linarith + change 7*K^4/(8*K^4*N) ≤ 1/N + have heq : 7*K^4/(8*K^4*N) = (7/8:ℝ)/N := by field_simp + rw [heq] + exact div_le_div_of_nonneg_right (by norm_num) hNp.le + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionGround.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionGround.lean new file mode 100644 index 0000000000000000000000000000000000000000..7372fa0142b3288c9793f024d9c11c5beeefaff8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionGround.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionScale +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitPhysicalComparison + +namespace OAI + +/-! Full-space error of the simultaneous subdivision gadget. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators InnerProductSpace Classical +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + +omit [DecidableEq κ] in +theorem qmaSubdivisionResidual_norm (L : Matrix σ σ ℂ) (P : κ → Matrix σ σ ℂ) + {R K : ℝ} (hR : 0 < R) (hK : 0 ≤ K) + (hP : ∑ e, ‖spinMatrixOperator (P e)‖^2 ≤ K) (hL : ‖spinMatrixOperator L‖ ≤ K) : + ‖spinMatrixOperator (((R:ℂ)⁻¹)^2 • (∑ e, P e*L*P e))‖ ≤ K^2/R^2 := by + calc + _ ≤ R⁻¹^2*((∑ e, ‖spinMatrixOperator (P e)‖^2)*‖spinMatrixOperator L‖) := + qmaThirdResidual_norm L P R hR + _ ≤ R⁻¹^2*(K*K) := mul_le_mul_of_nonneg_left + (mul_le_mul hP hL (norm_nonneg _) hK) (sq_nonneg _) + _ = _ := by field_simp + +theorem qmaSubdivision_target_ground (H : Matrix σ σ ℂ) (A B : κ → Matrix σ σ ℂ) + (J : κ → ℝ) {R K : ℝ} (hK : 1 ≤ K) (hR : 4*K ≤ R) + (hA : ∀ e, A e*A e = 1) (hB : ∀ e, B e*B e = 1) + (hAB : ∀ e, A e*B e = B e*A e) + (hP : ∀ e, (qmaThirdSeriesPair (A e) (B e) (-J e)).conjTranspose = + qmaThirdSeriesPair (A e) (B e) (-J e)) + (hLstar : (qmaSubdivisionLow H (fun e => J e)).conjTranspose = + qmaSubdivisionLow H (fun e => J e)) + (hL : ‖spinMatrixOperator (qmaSubdivisionLow H (fun e => J e))‖ ≤ K) + (hPsq : ∑ e, ‖spinMatrixOperator (qmaThirdSeriesPair (A e) (B e) (-J e))‖^2 ≤ K) + (hTarget : ‖spinMatrixOperator (qmaSubdivisionTarget H A B (fun e => J e))‖ ≤ K) + (hPert : ‖qmaPerturbationOperator (qmaSubdivisionLow H (fun e => J e)) (fun _ : κ => 0) + (fun e => (R:ℝ) • qmaThirdSeriesPair (A e) (B e) (-J e))‖ ≤ K*R) + (hCouple : ∑ e, ‖spinMatrixOperator ((R:ℝ) • qmaThirdSeriesPair (A e) (B e) (-J e))‖ ≤ + R^2*(K/R)) (u : EuclideanSpace ℂ σ) (hu : ‖u‖ = 1) : + |MediatorGraph.normalizedBottom (qmaSubdivisionGadget H A B R J)- + MediatorGraph.normalizedBottom (qmaSubdivisionTarget H A B (fun e => J e))| ≤ 7*K^4/R := by + let L := qmaSubdivisionLow H (fun e => J e) + let P := fun e => qmaThirdSeriesPair (A e) (B e) (-J e) + let V := fun e => (R:ℝ) • P e + let M := qmaThirdMatrix L (fun _ : κ => 0) V (R^2:ℝ) + let T := qmaSubdivisionTarget H A B (fun e => J e) + let E := ((R:ℂ)⁻¹)^2 • (∑ e, P e*L*P e) + have hRp : 0 < R := by linarith + have hK0 : 0 ≤ K := by linarith + have hR1 : 1 ≤ R := by linarith + have hR2 : K ≤ R^2 := by nlinarith + have hident : M = T+E := qmaSubdivisionThirdMatrix_target H A B J R hRp.ne' hA hB hAB hP + have hE : ‖spinMatrixOperator E‖ ≤ K^2/R^2 := qmaSubdivisionResidual_norm L P hRp hK0 hPsq hL + have hsmallE : K^2/R^2 ≤ K := by + apply (div_le_iff₀ (sq_pos_of_pos hRp)).mpr + simpa only [pow_two] using mul_le_mul_of_nonneg_left hR2 hK0 + have hM : ‖spinMatrixOperator M‖ ≤ 2*K := by + rw [hident,spinMatrixOperator_add] + exact (norm_add_le _ _).trans ((add_le_add hTarget (hE.trans hsmallE)).trans_eq (by ring)) + have hError : ‖spinMatrixOperator (M-T)‖ ≤ K^2/R^2 := by + simpa only [hident,add_sub_cancel_left] using hE + have hVstar (e : κ) : (V e).conjTranspose = V e := by + change ((R:ℝ) • P e).conjTranspose = (R:ℝ) • P e + have hPe : (P e).conjTranspose = P e := hP e + rw [Matrix.conjTranspose_smul,star_trivial,hPe] + have he := qmaPhysical_target_error (R^2) L T (fun _ : κ => 0) V + (sq_pos_of_pos hRp) hLstar (by intro e; simp) hVstar + (show 0 ≤ K*R by positivity) (show 0 ≤ 2*K by positivity) + (qmaSubdivision_scale_small hK hR) hPert hCouple hM hError u hu + exact he.trans (qmaSubdivision_total_error hK hR) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionHermitian.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionHermitian.lean new file mode 100644 index 0000000000000000000000000000000000000000..b26499bcfeb05f48e642e2cc9d6e729be5929c88 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionHermitian.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionReal + +namespace OAI + +/-! Each real subdivision summand is Hermitian, as needed for its next Pauli expansion. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical +variable {ι κ α : Type*} [Fintype ι] [DecidableEq ι] + [Fintype κ] [DecidableEq κ] [Fintype α] + +theorem qmaPolarizedFlip_star (m : κ → Bool) (e : κ) : + (qmaPolarizedFlip m e).conjTranspose = qmaPolarizedFlip m e := by + rw [← qmaPhaseMatrix_flip] + exact (Matrix.isHermitian_conjTranspose_mul_mul (qmaPhaseMatrix m) + (show (qmaBitFlipMatrix e).IsHermitian from qmaBitFlipMatrix_star e)).eq + +omit [Fintype ι] [DecidableEq ι] in +theorem qmaJoinMatrix_star (M : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (N : Matrix (κ → Fin 2) (κ → Fin 2) ℂ) + (hM : M.conjTranspose = M) (hN : N.conjTranspose = N) : + (qmaJoinMatrix M N).conjTranspose = qmaJoinMatrix M N := by + simp only [qmaJoinMatrix,Matrix.conjTranspose_submatrix,Matrix.conjTranspose_kronecker,hM,hN] + +omit [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] in +theorem qmaMatrix_real_smul_star {σ : Type*} (M : Matrix σ σ ℂ) (r : ℝ) + (hM : M.conjTranspose = M) : (r • M).conjTranspose = r • M := by + rw [Matrix.conjTranspose_smul,star_trivial,hM] + +omit [Fintype α] [DecidableEq ι] in +theorem qmaSubdivisionLocalPiece_star (A B : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (e : κ) (R j : ℝ) (m : κ → Bool) + (hA : A.conjTranspose = A) (hB : B.conjTranspose = B) (k : Fin 4) : + (qmaSubdivisionLocalPiece A B e R j m k).conjTranspose = + qmaSubdivisionLocalPiece A B e R j m k := by + fin_cases k + · exact qmaMatrix_real_smul_star _ _ (qmaJoinMatrix_star _ _ + Matrix.conjTranspose_one (qmaAncillaOccupation_star e)) + · exact qmaMatrix_real_smul_star _ _ Matrix.conjTranspose_one + · exact qmaMatrix_real_smul_star _ _ (qmaJoinMatrix_star _ _ hA (qmaPolarizedFlip_star m e)) + · exact qmaMatrix_real_smul_star _ _ (qmaJoinMatrix_star _ _ hB (qmaPolarizedFlip_star m e)) + +omit [Fintype α] [DecidableEq ι] in +theorem qmaSubdivisionLocalFamily_star (F : α → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (A B : κ → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (R : ℝ) (J : κ → ℝ) (m : κ → Bool) + (hF : ∀ a, (F a).conjTranspose = F a) + (hA : ∀ e, (A e).conjTranspose = A e) (hB : ∀ e, (B e).conjTranspose = B e) + (a : α ⊕ (κ × Fin 4)) : + (qmaSubdivisionLocalFamily F A B R J m a).conjTranspose = qmaSubdivisionLocalFamily F A B R J m a := by + cases a with + | inl a => exact qmaJoinMatrix_star _ _ (hF a) Matrix.conjTranspose_one + | inr p => exact qmaSubdivisionLocalPiece_star _ _ _ _ _ _ (hA p.1) (hB p.1) p.2 + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionLocalFamily.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionLocalFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..c63f0027660ae18602ae8f536f77fbfc318c2987 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionLocalFamily.lean @@ -0,0 +1,110 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionDecomposition +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdLocality + +namespace OAI + +/-! Subdivision increases each factor's support by at most its one fresh mediator. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical +variable {ι κ α : Type*} [Fintype ι] [DecidableEq ι] + [Fintype κ] [DecidableEq κ] [Fintype α] + +def qmaSubdivisionLocalPiece (A B : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (e : κ) (R j : ℝ) (m : κ → Bool) : + Fin 4 → Matrix (ι ⊕ κ → Fin 2) (ι ⊕ κ → Fin 2) ℂ := + ![(R^2:ℝ) • qmaJoinMatrix (1 : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (qmaAncillaOccupation e), + (1+(j/2)^2:ℝ) • (1 : Matrix (ι ⊕ κ → Fin 2) (ι ⊕ κ → Fin 2) ℂ), + (R:ℝ) • qmaJoinMatrix A (qmaPolarizedFlip m e), + (-R*j/2:ℝ) • qmaJoinMatrix B (qmaPolarizedFlip m e)] + +omit [DecidableEq ι] in +theorem qmaSubdivisionPiece_reindex (A B : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (e : κ) (R j : ℝ) (m : κ → Bool) (k : Fin 4) : + (qmaSubdivisionPiece A B e R j m k).submatrix (Equiv.sumArrowEquivProdArrow ι κ (Fin 2)) + (Equiv.sumArrowEquivProdArrow ι κ (Fin 2)) = qmaSubdivisionLocalPiece A B e R j m k := by + fin_cases k <;> simp [qmaSubdivisionPiece,qmaSubdivisionLocalPiece,qmaJoinMatrix, + Matrix.submatrix_smul,Matrix.submatrix_one_equiv] + +def qmaSubdivisionOnQubits (H : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (A B : κ → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (R : ℝ) (J : κ → ℝ) (m : κ → Bool) : + Matrix (ι ⊕ κ → Fin 2) (ι ⊕ κ → Fin 2) ℂ := + (qmaSubdivisionPolarized H A B R J m).submatrix (Equiv.sumArrowEquivProdArrow ι κ (Fin 2)) + (Equiv.sumArrowEquivProdArrow ι κ (Fin 2)) + +def qmaSubdivisionLocalFamily (F : α → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (A B : κ → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (R : ℝ) (J : κ → ℝ) (m : κ → Bool) : + α ⊕ (κ × Fin 4) → Matrix (ι ⊕ κ → Fin 2) (ι ⊕ κ → Fin 2) ℂ + | .inl a => qmaJoinMatrix (F a) 1 + | .inr (e,k) => qmaSubdivisionLocalPiece (A e) (B e) e R (J e) m k + +omit [DecidableEq ι] in +theorem qmaSubdivisionLocalFamily_sum (F : α → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (A B : κ → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (R : ℝ) (J : κ → ℝ) (m : κ → Bool) : + (∑ a, qmaSubdivisionLocalFamily F A B R J m a) = qmaSubdivisionOnQubits (∑ a, F a) A B R J m := by + unfold qmaSubdivisionOnQubits + rw [qmaSubdivisionPolarized_decomposition,MediatorGraph.submatrix_add_apply] + simp only [MediatorGraph.submatrix_sum,qmaSubdivisionPiece_reindex,MediatorGraph.sum_kronecker] + simp only [Fintype.sum_sum_type,Fintype.sum_prod_type,qmaSubdivisionLocalFamily,qmaJoinMatrix] + +omit [DecidableEq κ] in +theorem qmaSubdivisionLocalFamily_count : Fintype.card (α ⊕ (κ × Fin 4)) = + Fintype.card α+4*Fintype.card κ := by + simp only [Fintype.card_sum,Fintype.card_prod,Fintype.card_fin] + omega + +omit [Fintype α] in +theorem qmaSubdivisionLocalPiece_local (A B : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (e : κ) (R j : ℝ) (m : κ → Bool) {SA SB : Finset ι} {d : ℕ} + (hA : QMALocalOn SA A) (hB : QMALocalOn SB B) + (hSA : SA.card ≤ d) (hSB : SB.card ≤ d) (k : Fin 4) : + ∃ U : Finset (ι ⊕ κ), U.card ≤ d+1 ∧ QMALocalOn U (qmaSubdivisionLocalPiece A B e R j m k) := by + have hjoin {S : Finset ι} {T : Finset κ} + {M : Matrix (ι → Fin 2) (ι → Fin 2) ℂ} {N : Matrix (κ → Fin 2) (κ → Fin 2) ℂ} + (hM : QMALocalOn S M) (hN : QMALocalOn T N) (hS : S.card ≤ d) (hT : T.card ≤ 1) : + ∃ U : Finset (ι ⊕ κ), U.card ≤ d+1 ∧ QMALocalOn U (qmaJoinMatrix M N) := by + refine ⟨_,?_,hM.join hN⟩ + have hc := Finset.card_union_le (S.map (Function.Embedding.inl : ι ↪ ι ⊕ κ)) + (T.map (Function.Embedding.inr : κ ↪ ι ⊕ κ)) + simp only [Finset.card_map] at hc + omega + fin_cases k + · obtain ⟨U,hU,hM⟩ := hjoin (qmaLocal_identity (∅ : Finset ι)) + (qmaOccupation_local e) (by simp) (by simp) + exact ⟨U,hU,hM.real_smul (R^2)⟩ + · exact ⟨∅,by simp,(qmaLocal_identity (∅ : Finset (ι ⊕ κ))).real_smul (1+(j/2)^2)⟩ + · obtain ⟨U,hU,hM⟩ := hjoin hA (qmaPolarizedFlip_local m e) hSA (by simp) + exact ⟨U,hU,hM.real_smul R⟩ + · obtain ⟨U,hU,hM⟩ := hjoin hB (qmaPolarizedFlip_local m e) hSB (by simp) + exact ⟨U,hU,hM.real_smul (-R*j/2)⟩ + +omit [Fintype α] in +theorem qmaSubdivisionLocalFamily_local (F : α → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (A B : κ → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (R : ℝ) (J : κ → ℝ) (m : κ → Bool) + (SF : α → Finset ι) (SA SB : κ → Finset ι) {d : ℕ} + (hF : ∀ a, QMALocalOn (SF a) (F a)) (hSF : ∀ a, (SF a).card ≤ d+1) + (hA : ∀ e, QMALocalOn (SA e) (A e)) (hB : ∀ e, QMALocalOn (SB e) (B e)) + (hSA : ∀ e, (SA e).card ≤ d) (hSB : ∀ e, (SB e).card ≤ d) + (a : α ⊕ (κ × Fin 4)) : + ∃ U : Finset (ι ⊕ κ), U.card ≤ d+1 ∧ QMALocalOn U (qmaSubdivisionLocalFamily F A B R J m a) := by + cases a with + | inl a => + refine ⟨(SF a).map (Function.Embedding.inl : ι ↪ ι ⊕ κ),?_,(hF a).joinLeft⟩ + simpa only [Finset.card_map] using hSF a + | inr p => + exact qmaSubdivisionLocalPiece_local (A p.1) (B p.1) p.1 R (J p.1) m + (hA p.1) (hB p.1) (hSA p.1) (hSB p.1) p.2 + +theorem qmaSubdivisionOnQubits_bottom (H : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (A B : κ → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (R : ℝ) (J : κ → ℝ) (m : κ → Bool) : + MediatorGraph.normalizedBottom (qmaSubdivisionOnQubits H A B R J m) = + MediatorGraph.normalizedBottom (qmaSubdivisionGadget H A B R J) := by + rw [qmaSubdivisionOnQubits,MediatorGraph.normalizedBottom_reindex,qmaSubdivisionPolarized_bottom] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionMatrix.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionMatrix.lean new file mode 100644 index 0000000000000000000000000000000000000000..702930e36604c041a45c4993b1d8a6991b79cce2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionMatrix.lean @@ -0,0 +1,85 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdGadget + +namespace OAI + +/-! The simultaneous subdivision gadget has only a scalar counterterm. +Its exact third-order compression retains the common low-block residual. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + +def qmaSubdivisionLow (H : Matrix σ σ ℂ) (J : κ → ℂ) : Matrix σ σ ℂ := + H+∑ e, qmaSubdivisionCounter (J e) + +def qmaSubdivisionTarget (H : Matrix σ σ ℂ) (A B : κ → Matrix σ σ ℂ) + (J : κ → ℂ) : Matrix σ σ ℂ := H+∑ e, J e • (A e*B e) + +def qmaSubdivisionGadget (H : Matrix σ σ ℂ) (A B : κ → Matrix σ σ ℂ) + (R : ℝ) (J : κ → ℝ) : Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ := + qmaPhysicalMediatorMatrix (R^2) (qmaSubdivisionLow H (fun e => J e)) (fun _ => 0) + (fun e => (R:ℝ) • qmaThirdSeriesPair (A e) (B e) (-J e)) + +theorem qmaSubdivision_pair_effective (A B : Matrix σ σ ℂ) (J : ℂ) + (hA : A*A = 1) (hB : B*B = 1) (hAB : A*B = B*A) : + qmaSubdivisionCounter J- + qmaThirdSeriesPair A B (-J)*qmaThirdSeriesPair A B (-J) = J • (A*B) := by + unfold qmaSubdivisionCounter qmaThirdSeriesPair + rw [qmaGadget_pair_square A B (-J/2) hA hB hAB] + module + +omit [DecidableEq κ] in +theorem qmaSubdivision_sum_effective (H : Matrix σ σ ℂ) (A B : κ → Matrix σ σ ℂ) + (J : κ → ℂ) (hA : ∀ e, A e*A e = 1) (hB : ∀ e, B e*B e = 1) + (hAB : ∀ e, A e*B e = B e*A e) : + qmaSubdivisionLow H J- + (∑ e, qmaThirdSeriesPair (A e) (B e) (-J e)*qmaThirdSeriesPair (A e) (B e) (-J e)) = + qmaSubdivisionTarget H A B J := by + calc + _ = H+∑ e, (qmaSubdivisionCounter (J e)- + qmaThirdSeriesPair (A e) (B e) (-J e)*qmaThirdSeriesPair (A e) (B e) (-J e)) := by + simp only [qmaSubdivisionLow,Finset.sum_sub_distrib] + abel + _ = _ := by + unfold qmaSubdivisionTarget + congr 1 + apply Finset.sum_congr rfl + intro e _ + exact qmaSubdivision_pair_effective (A e) (B e) (J e) (hA e) (hB e) (hAB e) + +omit [DecidableEq κ] in +theorem qmaSubdivisionThirdMatrix_scaled (L : Matrix σ σ ℂ) (P : κ → Matrix σ σ ℂ) + (R : ℝ) (hR : R ≠ 0) (hP : ∀ e, (P e).conjTranspose = P e) : + qmaThirdMatrix L (fun _ : κ => 0) (fun e => (R:ℝ) • P e) (R^2:ℝ) = + L-(∑ e, P e*P e)+((R:ℂ)⁻¹)^2 • (∑ e, P e*L*P e) := by + have hRc : (R:ℂ) ≠ 0 := by exact_mod_cast hR + have hfirst : ((R:ℂ)^2)⁻¹*((R:ℂ)*(R:ℂ)) = 1 := by field_simp + have hremain : (((R:ℂ)^2)⁻¹)^2*((R:ℂ)*(R:ℂ)) = ((R:ℂ)⁻¹)^2 := by field_simp + have hs (r : ℝ) (M : Matrix σ σ ℂ) : r • M = (r:ℂ) • M := rfl + unfold qmaThirdMatrix + simp only [hs,Complex.ofReal_pow,Matrix.conjTranspose_smul,Complex.star_def,Complex.conj_ofReal, + hP,smul_mul_assoc,mul_smul_comm,smul_smul,← Finset.smul_sum, + mul_zero,zero_mul,Finset.sum_const_zero,smul_zero,add_zero,hfirst,hremain,one_smul] + +omit [DecidableEq κ] in +theorem qmaSubdivisionThirdMatrix_target (H : Matrix σ σ ℂ) (A B : κ → Matrix σ σ ℂ) + (J : κ → ℝ) (R : ℝ) (hR : R ≠ 0) + (hA : ∀ e, A e*A e = 1) (hB : ∀ e, B e*B e = 1) + (hAB : ∀ e, A e*B e = B e*A e) + (hP : ∀ e, (qmaThirdSeriesPair (A e) (B e) (-J e)).conjTranspose = + qmaThirdSeriesPair (A e) (B e) (-J e)) : + let L := qmaSubdivisionLow H (fun e => J e) + let P := fun e => qmaThirdSeriesPair (A e) (B e) (-J e) + qmaThirdMatrix L (fun _ : κ => 0) (fun e => (R:ℝ) • P e) (R^2:ℝ) = + qmaSubdivisionTarget H A B (fun e => J e)+((R:ℂ)⁻¹)^2 • (∑ e, P e*L*P e) := by + dsimp only + rw [qmaSubdivisionThirdMatrix_scaled _ _ R hR hP, + qmaSubdivision_sum_effective H A B (fun e => J e) hA hB hAB] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionNorm.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..a34e2249d0f41c0f59369c68d4789ce550b96695 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionNorm.lean @@ -0,0 +1,80 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionMatrix + +namespace OAI + +/-! The subdivision counterterm is scalar, Hermitian and polynomially bounded. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + +omit [Fintype σ] in +theorem qmaSubdivisionCounter_real (j : ℝ) : qmaSubdivisionCounter (ι := σ) (j:ℂ) = + (1+(j/2)^2:ℝ) • (1 : Matrix σ σ ℂ) := by + unfold qmaSubdivisionCounter + change (1+(-(j:ℂ)/2)^2) • (1 : Matrix σ σ ℂ) = ((1+(j/2)^2:ℝ):ℂ) • 1 + congr 1 + push_cast + ring + +omit [Fintype σ] in +theorem qmaSubdivisionCounter_star (j : ℝ) : + (qmaSubdivisionCounter (ι := σ) (j:ℂ)).conjTranspose = qmaSubdivisionCounter (j:ℂ) := by + rw [qmaSubdivisionCounter_real] + simp only [Matrix.conjTranspose_smul,star_trivial,Matrix.conjTranspose_one] + +omit [Fintype σ] [DecidableEq κ] in +theorem qmaSubdivisionLow_star (H : Matrix σ σ ℂ) (J : κ → ℝ) (hH : H.conjTranspose = H) : + (qmaSubdivisionLow H (fun e => J e)).conjTranspose = qmaSubdivisionLow H (fun e => J e) := by + simp only [qmaSubdivisionLow,Matrix.conjTranspose_add,Matrix.conjTranspose_sum,hH, + qmaSubdivisionCounter_star] + +theorem qmaSubdivisionCounter_norm (j : ℝ) : + ‖spinMatrixOperator (qmaSubdivisionCounter (ι := σ) (j:ℂ))‖ ≤ qmaThirdWeight j := by + rw [qmaSubdivisionCounter_real,qmaMatrix_real_smul_norm,abs_of_nonneg (by positivity)] + have hI : ‖spinMatrixOperator (1 : Matrix σ σ ℂ)‖ ≤ 1 := + spinMatrixOperator_unitary_norm _ (by simp) + have h := mul_le_mul_of_nonneg_left hI (show (0:ℝ) ≤ 1+(j/2)^2 by positivity) + have hw := (qmaThirdWeight_bounds j).2.2.1 + simp only [mul_one] at h + linarith [abs_nonneg j] + +omit [DecidableEq κ] in +theorem qmaSubdivisionLow_norm (H : Matrix σ σ ℂ) (J : κ → ℝ) + {b : ℝ} (hH : ‖spinMatrixOperator H‖ ≤ b) : + ‖spinMatrixOperator (qmaSubdivisionLow H (fun e => J e))‖ ≤ b+∑ e, qmaThirdWeight (J e) := by + unfold qmaSubdivisionLow + rw [spinMatrixOperator_add,spinMatrixOperator_sum] + apply (norm_add_le _ _).trans + apply add_le_add hH + exact (norm_sum_le _ _).trans (Finset.sum_le_sum (fun e _ => qmaSubdivisionCounter_norm (σ := σ) (J e))) + +omit [DecidableEq κ] in +theorem qmaSubdivisionTarget_norm (H : Matrix σ σ ℂ) (A B : κ → Matrix σ σ ℂ) (J : κ → ℝ) + {b : ℝ} (hH : ‖spinMatrixOperator H‖ ≤ b) + (hA : ∀ e, ‖spinMatrixOperator (A e)‖ ≤ 1) (hB : ∀ e, ‖spinMatrixOperator (B e)‖ ≤ 1) : + ‖spinMatrixOperator (qmaSubdivisionTarget H A B (fun e => J e))‖ ≤ b+∑ e, qmaThirdWeight (J e) := by + have hc (e : κ) : ‖spinMatrixOperator (1 : Matrix σ σ ℂ)‖ ≤ 1 := + spinMatrixOperator_unitary_norm _ (by simp) + simpa only [qmaThirdSeriesTarget,qmaSubdivisionTarget,mul_one] using + qmaThirdTarget_norm H A B (fun _ => 1) J hH hA hB hc + +omit [DecidableEq κ] in +theorem qmaScalarCoupling_sum (V : κ → Matrix σ σ ℂ) {r : ℝ} (hr : 0 ≤ r) : + (∑ e, ‖spinMatrixOperator ((r:ℝ) • V e)‖) = r*∑ e, ‖spinMatrixOperator (V e)‖ := by + simp only [qmaMatrix_real_smul_norm,abs_of_nonneg hr,Finset.mul_sum] + +theorem qmaSpinMatrix_zero : spinMatrixOperator (0 : Matrix σ σ ℂ) = 0 := by + ext x i + simp + +theorem qmaThirdWeight_neg (j : ℝ) : qmaThirdWeight (-j) = qmaThirdWeight j := by + simp only [qmaThirdWeight,abs_neg] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionReal.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionReal.lean new file mode 100644 index 0000000000000000000000000000000000000000..ac93677d8ea31c940cf2b831bed0c88520760d00 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionReal.lean @@ -0,0 +1,102 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumEntryParity +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionLocalFamily + +namespace OAI + +/-! The selected phases make every subdivision output term a real matrix. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical +variable {σ τ κ ι α : Type*} + +theorem QMAEntryParity.sum {β : Type*} [Fintype β] {p : Bool} (M : β → Matrix σ σ ℂ) + (hM : ∀ b, QMAEntryParity p (M b)) : QMAEntryParity p (∑ b, M b) := by + cases p <;> simp only [QMAEntryParity,Bool.false_eq_true,ite_false,ite_true] at * + · intro s t + simp only [Matrix.sum_apply] + change Complex.imAddGroupHom (∑ b, M b s t) = 0 + rw [map_sum] + exact Finset.sum_eq_zero (fun b _ => hM b s t) + · intro s t + simp only [Matrix.sum_apply] + change Complex.reAddGroupHom (∑ b, M b s t) = 0 + rw [map_sum] + exact Finset.sum_eq_zero (fun b _ => hM b s t) + +theorem qmaIdentity_real [DecidableEq σ] : QMAEntryParity false (1 : Matrix σ σ ℂ) := by + intro s t + simp only [Matrix.one_apply] + split_ifs <;> norm_num + +theorem QMAEntryParity.kronecker {M : Matrix σ σ ℂ} {N : Matrix τ τ ℂ} + (hM : QMAEntryParity false M) (hN : QMAEntryParity false N) : + QMAEntryParity false (M ⊗ₖ N) := by + rintro ⟨s,a⟩ ⟨t,b⟩ + simp only [Matrix.kronecker_apply,Complex.mul_im,hM s t,hN a b,mul_zero,zero_mul,add_zero] + +theorem QMAEntryParity.submatrix {p : Bool} {M : Matrix σ σ ℂ} + (hM : QMAEntryParity p M) (f : τ → σ) : QMAEntryParity p (M.submatrix f f) := by + cases p <;> exact fun s t => hM (f s) (f t) + +variable [Fintype κ] [DecidableEq κ] + +omit [DecidableEq κ] in +theorem qmaOccupation_real (e : κ) : QMAEntryParity false (qmaAncillaOccupation e) := by + intro a b + simp only [qmaAncillaOccupation,Matrix.diagonal_apply] + split_ifs <;> norm_num + +variable [Fintype ι] [DecidableEq ι] [Fintype α] + +omit [Fintype ι] [DecidableEq ι] in +theorem qmaJoinMatrix_real {M : Matrix (ι → Fin 2) (ι → Fin 2) ℂ} + {N : Matrix (κ → Fin 2) (κ → Fin 2) ℂ} + (hM : QMAEntryParity false M) (hN : QMAEntryParity false N) : + QMAEntryParity false (qmaJoinMatrix M N) := + (hM.kronecker hN).submatrix _ + +omit [Fintype ι] [DecidableEq ι] in +theorem qmaPolarizedJoin_real (M : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (m : κ → Bool) (e : κ) (hM : QMAEntryParity (m e) M) : + QMAEntryParity false (qmaJoinMatrix M (qmaPolarizedFlip m e)) := by + exact (show QMAEntryParity false (M ⊗ₖ qmaPolarizedFlip m e) from + qmaPolarizedTensor_real m e M hM).submatrix _ + +omit [Fintype α] [DecidableEq ι] in +theorem qmaSubdivisionLocalPiece_real (A B : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (e : κ) (R j : ℝ) (m : κ → Bool) + (hA : QMAEntryParity (m e) A) (hB : QMAEntryParity (m e) B) (k : Fin 4) : + QMAEntryParity false (qmaSubdivisionLocalPiece A B e R j m k) := by + fin_cases k + · exact (qmaJoinMatrix_real qmaIdentity_real (qmaOccupation_real e)).real_smul (R^2) + · exact qmaIdentity_real.real_smul (1+(j/2)^2) + · exact (qmaPolarizedJoin_real A m e hA).real_smul R + · exact (qmaPolarizedJoin_real B m e hB).real_smul (-R*j/2) + +omit [Fintype α] [DecidableEq ι] in +theorem qmaSubdivisionLocalFamily_real (F : α → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (A B : κ → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (R : ℝ) (J : κ → ℝ) (m : κ → Bool) + (hF : ∀ a, QMAEntryParity false (F a)) + (hA : ∀ e, QMAEntryParity (m e) (A e)) (hB : ∀ e, QMAEntryParity (m e) (B e)) + (a : α ⊕ (κ × Fin 4)) : + QMAEntryParity false (qmaSubdivisionLocalFamily F A B R J m a) := by + cases a with + | inl a => exact qmaJoinMatrix_real (hF a) qmaIdentity_real + | inr p => exact qmaSubdivisionLocalPiece_real _ _ _ _ _ _ (hA p.1) (hB p.1) p.2 + +omit [DecidableEq ι] in +theorem qmaSubdivisionOnQubits_real (F : α → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (A B : κ → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (R : ℝ) (J : κ → ℝ) (m : κ → Bool) + (hF : ∀ a, QMAEntryParity false (F a)) + (hA : ∀ e, QMAEntryParity (m e) (A e)) (hB : ∀ e, QMAEntryParity (m e) (B e)) : + QMAEntryParity false (qmaSubdivisionOnQubits (∑ a, F a) A B R J m) := by + rw [← qmaSubdivisionLocalFamily_sum] + exact QMAEntryParity.sum _ (qmaSubdivisionLocalFamily_real F A B R J m hF hA hB) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionScale.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionScale.lean new file mode 100644 index 0000000000000000000000000000000000000000..d64326d0727ead19f0d8d0494cde1496b325eb70 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitSubdivisionScale.lean @@ -0,0 +1,41 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionMatrix + +namespace OAI + +/-! Polynomial scales for simultaneous subdivision. -/ + +namespace ContinuumCoulomb + +theorem qmaSubdivision_scale_small {K R : ℝ} (hK : 1 ≤ K) (hR : 4*K ≤ R) : + 2*(K*R)+4*(2*K) ≤ R^2 := by + have hRp : 0 ≤ R := by linarith + have h4 : 4 ≤ R := by linarith + have ha := mul_le_mul_of_nonneg_right hR hRp + have hb : 4*R ≤ R^2 := by nlinarith + nlinarith + +theorem qmaSubdivision_scale_error {K R : ℝ} (hK : 1 ≤ K) (hR : 4*K ≤ R) : + (2*(K*R)^2/R^2+2*(2*K))*(K/R)^2 ≤ 6*K^4/R^2 := by + have hRp : 0 < R := by linarith + have hK34 : K^3 ≤ K^4 := pow_le_pow_right₀ hK (by norm_num) + apply (le_div_iff₀ (sq_pos_of_pos hRp)).mpr + have he : ((2*(K*R)^2/R^2+2*(2*K))*(K/R)^2)*R^2 = 2*K^4+4*K^3 := by + field_simp + ring + rw [he] + nlinarith + +theorem qmaSubdivision_total_error {K R : ℝ} (hK : 1 ≤ K) (hR : 4*K ≤ R) : + (2*(K*R)^2/R^2+2*(2*K))*(K/R)^2+K^2/R^2 ≤ 7*K^4/R := by + have hRp : 0 < R := by linarith + have hR1 : 1 ≤ R := by linarith + have hK24 : K^2 ≤ K^4 := pow_le_pow_right₀ hK (by norm_num) + calc + _ ≤ 6*K^4/R^2+K^4/R^2 := add_le_add (qmaSubdivision_scale_error hK hR) + (div_le_div_of_nonneg_right hK24 (sq_nonneg R)) + _ = 7*K^4/R^2 := by ring + _ ≤ _ := div_le_div_of_nonneg_left (by positivity) hRp (by nlinarith) + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdCalibration.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdCalibration.lean new file mode 100644 index 0000000000000000000000000000000000000000..0aa706f305d717bc3e1ec67838f8b5fe75d5f830 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdCalibration.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdFamilyBounds + +namespace OAI + +/-! All norm hypotheses of the physical third-order comparison follow from +one explicit polynomial in the original real coefficients. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + +theorem qmaThirdFamily_calibration (H : Matrix σ σ ℂ) (A B C : κ → Matrix σ σ ℂ) + (J : κ → ℝ) {b R : ℝ} (hb : 0 ≤ b) (hR : 1 ≤ R) + (hH : ‖spinMatrixOperator H‖ ≤ b) + (hA : ∀ e, ‖spinMatrixOperator (A e)‖ ≤ 1) + (hB : ∀ e, ‖spinMatrixOperator (B e)‖ ≤ 1) + (hC : ∀ e, ‖spinMatrixOperator (C e)‖ ≤ 1) : + let K := qmaThirdBudget b J + let L := qmaThirdSeriesLow H A B C R (fun e => J e) + let P := fun e => qmaThirdSeriesPair (A e) (B e) (J e) + ‖spinMatrixOperator L‖ ≤ K*R ∧ + (∑ e, ‖spinMatrixOperator (P e)‖^2 ≤ K) ∧ + ‖spinMatrixOperator (qmaThirdSeriesTarget H A B C (fun e => J e))‖ ≤ K ∧ + ‖qmaPerturbationOperator L (fun e => (R^2:ℝ) • C e) + (fun e => (R^2:ℝ) • P e)‖ ≤ K*R^2 ∧ + (∑ e, ‖spinMatrixOperator ((R^2:ℝ) • P e)‖ ≤ R^3*(K/R)) := by + let S := ∑ e, qmaThirdWeight (J e) + let W := 1+b+S + let L := qmaThirdSeriesLow H A B C R (fun e => J e) + let P := fun e => qmaThirdSeriesPair (A e) (B e) (J e) + have hS : 0 ≤ S := Finset.sum_nonneg (fun e _ => sq_nonneg _) + have hSW : S ≤ W := by dsimp [W]; linarith + have hW : 0 ≤ W := by dsimp [W]; linarith + have hR0 : 0 ≤ R := by linarith + have hRp : 0 < R := by linarith + have hpair := qmaThirdPair_sum_bounds A B J hA hB + have hnormL : ‖spinMatrixOperator L‖ ≤ b+(R+1)*S := qmaThirdLow_norm H A B C J hR0 hH hA hB hC + have hL : ‖spinMatrixOperator L‖ ≤ 2*W*R := by + apply hnormL.trans + have hbr : b ≤ b*R := by nlinarith + have hsr : S ≤ S*R := by nlinarith + dsimp [W] + nlinarith + have hsumC : ∑ e, ‖spinMatrixOperator (C e)‖ ≤ W := by + apply le_trans (Finset.sum_le_sum (fun e _ => (hC e).trans (qmaThirdWeight_bounds (J e)).1)) + exact hSW + have hsumP : ∑ e, ‖spinMatrixOperator (P e)‖ ≤ W := hpair.1.trans hSW + have hLbig : ‖spinMatrixOperator L‖ ≤ (4*W)*R := by + apply hL.trans + nlinarith + have hPsq : ∑ e, ‖spinMatrixOperator (P e)‖^2 ≤ 4*W := by + apply hpair.2.trans + nlinarith + have htarget : ‖spinMatrixOperator (qmaThirdSeriesTarget H A B C (fun e => J e))‖ ≤ 4*W := by + apply (qmaThirdTarget_norm H A B C J hH hA hB hC).trans + dsimp [W] + linarith + have hpert := qmaScaledPerturbation_norm L C P hR hW hL hsumC hsumP + have hcouple : ∑ e, ‖spinMatrixOperator ((R^2:ℝ) • P e)‖ ≤ R^3*((4*W)/R) := by + rw [qmaScaledCoupling_sum] + calc + _ ≤ R^2*W := mul_le_mul_of_nonneg_left hsumP (sq_nonneg R) + _ ≤ R^2*(4*W) := mul_le_mul_of_nonneg_left (by linarith) (sq_nonneg R) + _ = _ := by field_simp + exact ⟨hLbig,hPsq,htarget,hpert,hcouple⟩ + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdDecomposition.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdDecomposition.lean new file mode 100644 index 0000000000000000000000000000000000000000..3d921944c6c36cca1d77cf9d61b72f0e8b91f846 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdDecomposition.lean @@ -0,0 +1,89 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdGadget + +namespace OAI + +/-! The physical gadget is a sum of seven explicit terms per mediator. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + +theorem qmaFinTwo_cast (a : Fin 2) : (a.val : ℂ) = if a = 1 then 1 else 0 := by + fin_cases a <;> norm_num + +omit [Fintype σ] [DecidableEq κ] in +theorem qmaPhysicalPenalty_sum (g : ℝ) : qmaPhysicalPenaltyMatrix (σ := σ) (κ := κ) g = + ∑ e, (g:ℂ) • ((1 : Matrix σ σ ℂ) ⊗ₖ qmaAncillaOccupation e) := by + ext p q + rcases p with ⟨s,a⟩ + rcases q with ⟨t,b⟩ + simp only [qmaPhysicalPenaltyMatrix,qmaAncillaDiagonal,Matrix.kronecker_apply, + qmaAncillaOccupation,Matrix.diagonal_apply,Matrix.one_apply,Matrix.sum_apply, + Matrix.smul_apply,smul_eq_mul] + by_cases hst : s = t <;> by_cases hab : a = b + · subst t + subst b + simp only [ite_true,one_mul,qmaAncillaNumber,Nat.cast_sum] + push_cast + rw [Finset.mul_sum] + simp only [qmaFinTwo_cast] + · simp [hst,hab] + · simp [hst,hab] + · simp [hst,hab] + +def qmaThirdPiece (A B C : Matrix σ σ ℂ) (e : κ) (R j : ℝ) : + Fin 7 → Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ := + ![(R^3:ℝ) • ((1 : Matrix σ σ ℂ) ⊗ₖ qmaAncillaOccupation e), + (R*(1+(j/2)^2):ℝ) • (1 : Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ), + (R*j:ℝ) • ((A*B) ⊗ₖ (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ)), + (-(1+(j/2)^2):ℝ) • (C ⊗ₖ (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ)), + (R^2:ℝ) • (C ⊗ₖ qmaAncillaOccupation e), + (R^2:ℝ) • (A ⊗ₖ qmaBitFlipMatrix e), + (R^2*j/2:ℝ) • (B ⊗ₖ qmaBitFlipMatrix e)] + +theorem qmaThirdPiece_sum (A B C : Matrix σ σ ℂ) (e : κ) (R j : ℝ) : + (∑ k, qmaThirdPiece A B C e R j k) = + (R^3:ℝ) • ((1 : Matrix σ σ ℂ) ⊗ₖ qmaAncillaOccupation e)+ + qmaThirdSeriesCounter A B C R j ⊗ₖ (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ)+ + ((R^2:ℝ) • C) ⊗ₖ qmaAncillaOccupation e+ + ((R^2:ℝ) • qmaThirdSeriesPair A B j) ⊗ₖ qmaBitFlipMatrix e := by + have hr (r : ℝ) (M : Matrix σ σ ℂ) : r • M = (r:ℂ) • M := rfl + have hp (r : ℝ) (M : Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ) : + r • M = (r:ℂ) • M := rfl + have hk (M N : Matrix σ σ ℂ) : + (M-N) ⊗ₖ (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ) = + M ⊗ₖ (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ)- + N ⊗ₖ (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ) := by + ext p q + rcases p with ⟨s,a⟩ + rcases q with ⟨t,b⟩ + simp only [Matrix.kronecker_apply,Matrix.sub_apply,sub_mul] + simp only [qmaThirdPiece,Fin.sum_univ_succ,Fin.sum_univ_zero,add_zero, + Matrix.cons_val_zero,Matrix.cons_val_succ, + qmaThirdSeriesCounter,qmaThirdSeriesPair, + hr,hp,Matrix.add_kronecker,hk,Matrix.smul_kronecker, + Matrix.one_kronecker_one,smul_add,smul_smul] + push_cast + module + +theorem qmaThirdGadget_decomposition (H : Matrix σ σ ℂ) (A B C : κ → Matrix σ σ ℂ) + (R : ℝ) (J : κ → ℝ) : + qmaThirdGadget H A B C R J = + H ⊗ₖ (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ)+ + ∑ e, ∑ k, qmaThirdPiece (A e) (B e) (C e) e R (J e) k := by + simp only [qmaThirdGadget,qmaPhysicalMediatorMatrix,qmaMediatorPerturbation, + qmaMediatorOccupations,qmaMediatorFlips,qmaThirdSeriesLow,qmaPhysicalPenalty_sum, + Matrix.add_kronecker,MediatorGraph.sum_kronecker,qmaThirdPiece_sum, + Finset.sum_add_distrib] + have hs (r : ℝ) (M : Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ) : + r • M = (r:ℂ) • M := rfl + simp only [hs] + abel + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdEnvelope.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdEnvelope.lean new file mode 100644 index 0000000000000000000000000000000000000000..6a0ac314bf60fc836db0dbef0d8675d06baa4678 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdEnvelope.lean @@ -0,0 +1,71 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdPhasedLocal +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionEnvelope + +namespace OAI + +/-! Explicit two-site supports for the seven third-order pieces. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped Classical +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +def qmaThirdPieceSites (SA SB SC : Finset ι) (e : κ) : Fin 7 → Finset (ι ⊕ κ) := + ![qmaMediatorSupport ∅ e,∅,(SA ∪ SB).map Function.Embedding.inl, + SC.map Function.Embedding.inl,qmaMediatorSupport SC e, + qmaMediatorSupport SA e,qmaMediatorSupport SB e] + +theorem qmaThirdPieceSites_local (A B C : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (e : κ) (R j : ℝ) (m : κ → Bool) {SA SB SC : Finset ι} + (hA : QMALocalOn SA A) (hB : QMALocalOn SB B) (hC : QMALocalOn SC C) (k : Fin 7) : + QMALocalOn (qmaThirdPieceSites SA SB SC e k) (qmaThirdPhasedLocalPiece A B C e R j m k) := by + rw [qmaThirdPhasedLocalPiece_eq] + fin_cases k + · exact ((qmaLocal_identity (∅ : Finset ι)).join (qmaOccupation_local e)).real_smul (R^3) + · exact (qmaLocal_identity (∅ : Finset (ι ⊕ κ))).real_smul (R*(1+(j/2)^2)) + · exact ((hA.mono Finset.subset_union_left).mul + (hB.mono Finset.subset_union_right)).joinLeft.real_smul (R*j) + · exact hC.joinLeft.real_smul (-(1+(j/2)^2)) + · exact (hC.join (qmaOccupation_local e)).real_smul (R^2) + · exact (hA.join (qmaPolarizedFlip_local m e)).real_smul (R^2) + · exact (hB.join (qmaPolarizedFlip_local m e)).real_smul (R^2*j/2) + +omit [Fintype ι] [Fintype κ] in +theorem qmaThirdPieceSites_card {SA SB SC : Finset ι} + (hA : SA.card ≤ 1) (hB : SB.card ≤ 1) (hC : SC.card ≤ 1) (e : κ) (k : Fin 7) : + (qmaThirdPieceSites SA SB SC e k).card ≤ 2 := by + fin_cases k + · exact (qmaMediatorSupport_card ∅ e).trans (by simp) + · simp [qmaThirdPieceSites] + · change ((SA ∪ SB).map (Function.Embedding.inl : ι ↪ ι ⊕ κ)).card ≤ 2 + rw [Finset.card_map] + exact (Finset.card_union_le SA SB).trans (by omega) + · change (SC.map (Function.Embedding.inl : ι ↪ ι ⊕ κ)).card ≤ 2 + rw [Finset.card_map] + omega + · exact (qmaMediatorSupport_card SC e).trans (by omega) + · exact (qmaMediatorSupport_card SA e).trans (by omega) + · exact (qmaMediatorSupport_card SB e).trans (by omega) + +omit [Fintype ι] [Fintype κ] in +theorem qmaThirdPieceSites_subset {SA SB SC S : Finset ι} + (hA : SA ⊆ S) (hB : SB ⊆ S) (hC : SC ⊆ S) (e : κ) (k : Fin 7) : + qmaThirdPieceSites SA SB SC e k ⊆ qmaMediatorSupport S e := by + have hm {T : Finset ι} (hT : T ⊆ S) : + T.map (Function.Embedding.inl : ι ↪ ι ⊕ κ) ⊆ qmaMediatorSupport S e := + (Finset.map_subset_map.mpr hT).trans Finset.subset_union_left + fin_cases k + · exact qmaMediatorSupport_mono (Finset.empty_subset S) e + · exact Finset.empty_subset _ + · exact hm (Finset.union_subset hA hB) + · exact hm hC + · exact qmaMediatorSupport_mono hC e + · exact qmaMediatorSupport_mono hA e + · exact qmaMediatorSupport_mono hB e + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdFamilyBounds.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdFamilyBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..3e70eae6a15bbad3df65ee640e20cda5d72edca5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdFamilyBounds.lean @@ -0,0 +1,106 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdNormBudget +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorSeriesMatrix + +namespace OAI + +/-! Summed polynomial coefficient bounds for an actual parallel gadget family. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + +def qmaThirdBudget (b : ℝ) (J : κ → ℝ) : ℝ := 4*(1+b+∑ e, qmaThirdWeight (J e)) + +theorem qmaThirdWeight_pair (j : ℝ) : 1+|j| ≤ qmaThirdWeight j := by + have hj := abs_nonneg j + dsimp [qmaThirdWeight] + nlinarith + +omit [DecidableEq κ] in +theorem qmaThirdBudget_pos {b : ℝ} (hb : 0 ≤ b) (J : κ → ℝ) : 1 ≤ qmaThirdBudget b J := by + have hs : 0 ≤ ∑ e, qmaThirdWeight (J e) := Finset.sum_nonneg (fun e _ => sq_nonneg _) + unfold qmaThirdBudget + linarith + +omit [DecidableEq κ] in +theorem qmaThirdPair_sum_bounds (A B : κ → Matrix σ σ ℂ) (J : κ → ℝ) + (hA : ∀ e, ‖spinMatrixOperator (A e)‖ ≤ 1) + (hB : ∀ e, ‖spinMatrixOperator (B e)‖ ≤ 1) : + (∑ e, ‖spinMatrixOperator (qmaThirdSeriesPair (A e) (B e) (J e))‖ ≤ + ∑ e, qmaThirdWeight (J e)) ∧ + (∑ e, ‖spinMatrixOperator (qmaThirdSeriesPair (A e) (B e) (J e))‖^2 ≤ + ∑ e, qmaThirdWeight (J e)) := by + constructor + · exact Finset.sum_le_sum (fun e _ => + (qmaThirdPair_norm (A e) (B e) (J e) (hA e) (hB e)).trans (qmaThirdWeight_pair (J e))) + · apply Finset.sum_le_sum + intro e _ + exact pow_le_pow_left₀ (norm_nonneg _) (qmaThirdPair_norm (A e) (B e) (J e) (hA e) (hB e)) 2 + +omit [DecidableEq κ] in +theorem qmaThirdLow_norm (H : Matrix σ σ ℂ) (A B C : κ → Matrix σ σ ℂ) (J : κ → ℝ) + {r b : ℝ} (hr : 0 ≤ r) (hH : ‖spinMatrixOperator H‖ ≤ b) + (hA : ∀ e, ‖spinMatrixOperator (A e)‖ ≤ 1) + (hB : ∀ e, ‖spinMatrixOperator (B e)‖ ≤ 1) + (hC : ∀ e, ‖spinMatrixOperator (C e)‖ ≤ 1) : + ‖spinMatrixOperator (qmaThirdSeriesLow H A B C r (fun e => J e))‖ ≤ + b+(r+1)*(∑ e, qmaThirdWeight (J e)) := by + unfold qmaThirdSeriesLow + rw [spinMatrixOperator_add,spinMatrixOperator_sum] + calc + _ ≤ ‖spinMatrixOperator H‖+∑ e, ‖spinMatrixOperator + (qmaThirdSeriesCounter (A e) (B e) (C e) r (J e))‖ := + (norm_add_le _ _).trans (add_le_add le_rfl (norm_sum_le _ _)) + _ ≤ b+∑ e, (r+1)*qmaThirdWeight (J e) := add_le_add hH + (Finset.sum_le_sum (fun e _ => qmaThirdCounter_norm _ _ _ r (J e) hr (hA e) (hB e) (hC e))) + _ = _ := by rw [Finset.mul_sum] + +omit [DecidableEq κ] in +theorem qmaThirdTarget_norm (H : Matrix σ σ ℂ) (A B C : κ → Matrix σ σ ℂ) (J : κ → ℝ) + {b : ℝ} (hH : ‖spinMatrixOperator H‖ ≤ b) + (hA : ∀ e, ‖spinMatrixOperator (A e)‖ ≤ 1) + (hB : ∀ e, ‖spinMatrixOperator (B e)‖ ≤ 1) + (hC : ∀ e, ‖spinMatrixOperator (C e)‖ ≤ 1) : + ‖spinMatrixOperator (qmaThirdSeriesTarget H A B C (fun e => J e))‖ ≤ + b+∑ e, qmaThirdWeight (J e) := by + unfold qmaThirdSeriesTarget + rw [spinMatrixOperator_add,spinMatrixOperator_sum] + apply (norm_add_le _ _).trans + apply add_le_add hH + apply (norm_sum_le _ _).trans + apply Finset.sum_le_sum + intro e _ + rw [spinMatrixOperator_smul,norm_smul,Complex.norm_real,Real.norm_eq_abs] + have hp := qmaMatrix_product_norm (A e*B e) (C e) + (qmaMatrix_product_norm (A e) (B e) (hA e) (hB e)) (hC e) + exact (mul_le_mul_of_nonneg_left hp (abs_nonneg _)).trans + (by simpa only [mul_one] using (qmaThirdWeight_bounds (J e)).2.1) + +omit [DecidableEq κ] in +theorem qmaScaledCoupling_sum (V : κ → Matrix σ σ ℂ) (r : ℝ) : + (∑ e, ‖spinMatrixOperator ((r^2:ℝ) • V e)‖) = r^2*∑ e, ‖spinMatrixOperator (V e)‖ := by + simp only [qmaMatrix_real_smul_norm,abs_of_nonneg (sq_nonneg r),Finset.mul_sum] + +theorem qmaScaledPerturbation_norm (L : Matrix σ σ ℂ) (C P : κ → Matrix σ σ ℂ) + {r w : ℝ} (hr : 1 ≤ r) (hw : 0 ≤ w) + (hL : ‖spinMatrixOperator L‖ ≤ 2*w*r) + (hC : ∑ e, ‖spinMatrixOperator (C e)‖ ≤ w) + (hP : ∑ e, ‖spinMatrixOperator (P e)‖ ≤ w) : + ‖qmaPerturbationOperator L (fun e => (r^2:ℝ) • C e) + (fun e => (r^2:ℝ) • P e)‖ ≤ (4*w)*r^2 := by + have hn := qmaPerturbationOperator_norm L (fun e => (r^2:ℝ) • C e) + (fun e => (r^2:ℝ) • P e) + rw [qmaScaledCoupling_sum,qmaScaledCoupling_sum] at hn + have hc := mul_le_mul_of_nonneg_left hC (sq_nonneg r) + have hp := mul_le_mul_of_nonneg_left hP (sq_nonneg r) + have hr2 : r ≤ r^2 := by nlinarith + have hwr := mul_le_mul_of_nonneg_left hr2 (show 0 ≤ 2*w by positivity) + nlinarith + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdGadget.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdGadget.lean new file mode 100644 index 0000000000000000000000000000000000000000..9660389f210fca688f69b35045cdab4b5e40d98a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdGadget.lean @@ -0,0 +1,83 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdCalibration +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdHermitian +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorTargetGround + +namespace OAI + +/-! An explicit parallel third-order gadget with a polynomial accuracy scale. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators InnerProductSpace Classical +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] [DecidableEq κ] + +def qmaThirdGadget (H : Matrix σ σ ℂ) (A B C : κ → Matrix σ σ ℂ) + (R : ℝ) (J : κ → ℝ) : Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ := + qmaPhysicalMediatorMatrix (R^3) (qmaThirdSeriesLow H A B C R (fun e => J e)) + (fun e => (R^2:ℝ) • C e) + (fun e => (R^2:ℝ) • qmaThirdSeriesPair (A e) (B e) (J e)) + +theorem qmaThirdGadget_error (H : Matrix σ σ ℂ) (A B C : κ → Matrix σ σ ℂ) + (J : κ → ℝ) {b R : ℝ} (hb : 0 ≤ b) + (hR : 4*qmaThirdBudget b J ≤ R) + (hH : H.conjTranspose = H) (hHnorm : ‖spinMatrixOperator H‖ ≤ b) + (hAstar : ∀ e, (A e).conjTranspose = A e) + (hBstar : ∀ e, (B e).conjTranspose = B e) + (hCstar : ∀ e, (C e).conjTranspose = C e) + (hA : ∀ e, A e*A e = 1) (hB : ∀ e, B e*B e = 1) (hC : ∀ e, C e*C e = 1) + (hAB : ∀ e, A e*B e = B e*A e) (hAC : ∀ e, A e*C e = C e*A e) + (hBC : ∀ e, B e*C e = C e*B e) + (u : EuclideanSpace ℂ σ) (hu : ‖u‖ = 1) : + |MediatorGraph.normalizedBottom (qmaThirdGadget H A B C R J)- + MediatorGraph.normalizedBottom (qmaThirdSeriesTarget H A B C (fun e => J e))| ≤ + 5*(qmaThirdBudget b J)^4/R := by + have hK : 1 ≤ qmaThirdBudget b J := qmaThirdBudget_pos hb J + have hr : 1 ≤ R := by linarith + have hAnorm (e : κ) : ‖spinMatrixOperator (A e)‖ ≤ 1 := by + apply spinMatrixOperator_unitary_norm + rw [hAstar,hA] + have hBnorm (e : κ) : ‖spinMatrixOperator (B e)‖ ≤ 1 := by + apply spinMatrixOperator_unitary_norm + rw [hBstar,hB] + have hCnorm (e : κ) : ‖spinMatrixOperator (C e)‖ ≤ 1 := by + apply spinMatrixOperator_unitary_norm + rw [hCstar,hC] + obtain ⟨hL,hPsq,hTarget,hPert,hCouple⟩ := + qmaThirdFamily_calibration H A B C J hb hr hHnorm hAnorm hBnorm hCnorm + exact qmaThirdSeries_target_ground H A B C (fun e => J e) hK hR hA hB hAB hAC hBC + hCstar (fun e => qmaThirdPair_star (A e) (B e) (J e) (hAstar e) (hBstar e)) + (qmaThirdLow_star H A B C R J hH hAstar hBstar hCstar hAB) + hL hPsq hTarget hPert hCouple u hu + +theorem qmaThirdGadget_polynomial_accuracy (H : Matrix σ σ ℂ) + (A B C : κ → Matrix σ σ ℂ) (J : κ → ℝ) {b N : ℝ} (hb : 0 ≤ b) (hN : 1 ≤ N) + (hH : H.conjTranspose = H) (hHnorm : ‖spinMatrixOperator H‖ ≤ b) + (hAstar : ∀ e, (A e).conjTranspose = A e) + (hBstar : ∀ e, (B e).conjTranspose = B e) + (hCstar : ∀ e, (C e).conjTranspose = C e) + (hA : ∀ e, A e*A e = 1) (hB : ∀ e, B e*B e = 1) (hC : ∀ e, C e*C e = 1) + (hAB : ∀ e, A e*B e = B e*A e) (hAC : ∀ e, A e*C e = C e*A e) + (hBC : ∀ e, B e*C e = C e*B e) + (u : EuclideanSpace ℂ σ) (hu : ‖u‖ = 1) : + let R := 8*(qmaThirdBudget b J)^4*N + |MediatorGraph.normalizedBottom (qmaThirdGadget H A B C R J)- + MediatorGraph.normalizedBottom (qmaThirdSeriesTarget H A B C (fun e => J e))| ≤ 1/N := by + let K := qmaThirdBudget b J + have hK : 1 ≤ K := qmaThirdBudget_pos hb J + have hR := (Perturbation.thirdOrder_polynomial_schedule hK hN).1 + have he := qmaThirdGadget_error H A B C J hb hR hH hHnorm hAstar hBstar hCstar + hA hB hC hAB hAC hBC u hu + apply he.trans + have hNp : 0 < N := by linarith + have hKp : 0 < K := by linarith + change 5*K^4/(8*K^4*N) ≤ 1/N + have heq : 5*K^4/(8*K^4*N) = (5/8:ℝ)/N := by field_simp + rw [heq] + exact div_le_div_of_nonneg_right (by norm_num) hNp.le + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdHermitian.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdHermitian.lean new file mode 100644 index 0000000000000000000000000000000000000000..23962da542be20d307e348a881bfd5f1df857471 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdHermitian.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorSeriesMatrix + +namespace OAI + +/-! The polynomial counterterms preserve Hermiticity for real couplings. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators +variable {σ κ : Type*} [Fintype σ] [DecidableEq σ] [Fintype κ] + +omit [Fintype σ] [DecidableEq σ] in +theorem qmaThirdPair_star (A B : Matrix σ σ ℂ) (j : ℝ) + (hA : A.conjTranspose = A) (hB : B.conjTranspose = B) : + (qmaThirdSeriesPair A B j).conjTranspose = qmaThirdSeriesPair A B j := by + have hj : (j:ℂ)/2 = ((j/2:ℝ):ℂ) := by push_cast; rfl + unfold qmaThirdSeriesPair + rw [hj] + change (A+(j/2:ℝ) • B).conjTranspose = A+(j/2:ℝ) • B + rw [Matrix.conjTranspose_add,Matrix.conjTranspose_smul,star_trivial,hA,hB] + +theorem qmaThirdCounter_star (A B C : Matrix σ σ ℂ) (r j : ℝ) + (hA : A.conjTranspose = A) (hB : B.conjTranspose = B) (hC : C.conjTranspose = C) + (hAB : A*B = B*A) : + (qmaThirdSeriesCounter A B C r j).conjTranspose = qmaThirdSeriesCounter A B C r j := by + have hc : 1+((j:ℂ)/2)^2 = ((1+(j/2)^2:ℝ):ℂ) := by push_cast; rfl + unfold qmaThirdSeriesCounter + rw [hc] + change ((r:ℝ) • ((1+(j/2)^2:ℝ) • (1 : Matrix σ σ ℂ)+(j:ℝ) • (A*B))- + (1+(j/2)^2:ℝ) • C).conjTranspose = _ + simp only [Matrix.conjTranspose_sub,Matrix.conjTranspose_add,Matrix.conjTranspose_smul, + Matrix.conjTranspose_mul,Matrix.conjTranspose_one,star_trivial,hA,hB,hC,← hAB] + rfl + +theorem qmaThirdLow_star (H : Matrix σ σ ℂ) (A B C : κ → Matrix σ σ ℂ) + (r : ℝ) (J : κ → ℝ) (hH : H.conjTranspose = H) + (hA : ∀ e, (A e).conjTranspose = A e) (hB : ∀ e, (B e).conjTranspose = B e) + (hC : ∀ e, (C e).conjTranspose = C e) (hAB : ∀ e, A e*B e = B e*A e) : + (qmaThirdSeriesLow H A B C r (fun e => J e)).conjTranspose = + qmaThirdSeriesLow H A B C r (fun e => J e) := by + simp only [qmaThirdSeriesLow,Matrix.conjTranspose_add,Matrix.conjTranspose_sum,hH] + congr 1 + apply Finset.sum_congr rfl + intro e _ + exact qmaThirdCounter_star (A e) (B e) (C e) r (J e) (hA e) (hB e) (hC e) (hAB e) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdLocalFamily.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdLocalFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..0b1a777c5972e2d6cfc1aca880706c69bfa38ce3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdLocalFamily.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdLocality + +namespace OAI + +/-! The actual output family has seven new two-local terms per mediator. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical +variable {ι κ α : Type*} [Fintype ι] [DecidableEq ι] + [Fintype κ] [DecidableEq κ] [Fintype α] + +def qmaThirdOnQubits (H : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (A B C : κ → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (R : ℝ) (J : κ → ℝ) : + Matrix (ι ⊕ κ → Fin 2) (ι ⊕ κ → Fin 2) ℂ := + (qmaThirdGadget H A B C R J).submatrix (Equiv.sumArrowEquivProdArrow ι κ (Fin 2)) + (Equiv.sumArrowEquivProdArrow ι κ (Fin 2)) + +def qmaThirdLocalFamily (F : α → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (A B C : κ → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (R : ℝ) (J : κ → ℝ) : + α ⊕ (κ × Fin 7) → Matrix (ι ⊕ κ → Fin 2) (ι ⊕ κ → Fin 2) ℂ + | .inl a => qmaJoinMatrix (F a) 1 + | .inr (e,k) => qmaThirdLocalPiece (A e) (B e) (C e) e R (J e) k + +theorem qmaThirdLocalFamily_sum (F : α → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (A B C : κ → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (R : ℝ) (J : κ → ℝ) : + (∑ a, qmaThirdLocalFamily F A B C R J a) = qmaThirdOnQubits (∑ a, F a) A B C R J := by + unfold qmaThirdOnQubits + rw [qmaThirdGadget_decomposition,MediatorGraph.submatrix_add_apply] + simp only [MediatorGraph.submatrix_sum,qmaThirdPiece_reindex,MediatorGraph.sum_kronecker] + simp only [Fintype.sum_sum_type,Fintype.sum_prod_type,qmaThirdLocalFamily,qmaJoinMatrix] + +omit [DecidableEq κ] in +theorem qmaThirdLocalFamily_count : Fintype.card (α ⊕ (κ × Fin 7)) = + Fintype.card α+7*Fintype.card κ := by + simp only [Fintype.card_sum,Fintype.card_prod,Fintype.card_fin] + omega + +omit [Fintype α] in +theorem qmaThirdLocalFamily_two_local (F : α → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (A B C : κ → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (R : ℝ) (J : κ → ℝ) + (SF : α → Finset ι) (SA SB SC : κ → Finset ι) + (hF : ∀ a, QMALocalOn (SF a) (F a)) (hSF : ∀ a, (SF a).card ≤ 2) + (hA : ∀ e, QMALocalOn (SA e) (A e)) (hB : ∀ e, QMALocalOn (SB e) (B e)) + (hC : ∀ e, QMALocalOn (SC e) (C e)) + (hSA : ∀ e, (SA e).card ≤ 1) (hSB : ∀ e, (SB e).card ≤ 1) (hSC : ∀ e, (SC e).card ≤ 1) + (a : α ⊕ (κ × Fin 7)) : + ∃ U : Finset (ι ⊕ κ), U.card ≤ 2 ∧ QMALocalOn U (qmaThirdLocalFamily F A B C R J a) := by + cases a with + | inl a => + refine ⟨(SF a).map (Function.Embedding.inl : ι ↪ ι ⊕ κ),?_,(hF a).joinLeft⟩ + simpa only [Finset.card_map] using hSF a + | inr p => + exact qmaThirdLocalPiece_two_local (A p.1) (B p.1) (C p.1) p.1 R (J p.1) + (hA p.1) (hB p.1) (hC p.1) (hSA p.1) (hSB p.1) (hSC p.1) p.2 + +theorem qmaThirdOnQubits_bottom (H : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (A B C : κ → Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (R : ℝ) (J : κ → ℝ) : + MediatorGraph.normalizedBottom (qmaThirdOnQubits H A B C R J) = + MediatorGraph.normalizedBottom (qmaThirdGadget H A B C R J) := + MediatorGraph.normalizedBottom_reindex (Equiv.sumArrowEquivProdArrow ι κ (Fin 2)) _ + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdLocality.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdLocality.lean new file mode 100644 index 0000000000000000000000000000000000000000..c6633b3351b9063a43ca2af678c03e3803d3ec91 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdLocality.lean @@ -0,0 +1,72 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdDecomposition +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumLocalJoin + +namespace OAI + +/-! Every explicit third-order term acts on at most two qubits when its +three input factors each act on a single old qubit. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +theorem qmaLocal_identity (S : Finset ι) : QMALocalOn S (1 : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) := + ⟨1,(qmaLocalLift_one S).symm⟩ + +theorem QMALocalOn.real_smul {S : Finset ι} {A : Matrix (ι → Fin 2) (ι → Fin 2) ℂ} + (hA : QMALocalOn S A) (r : ℝ) : QMALocalOn S (r • A) := hA.smul (r:ℂ) + +theorem qmaOccupation_local (e : κ) : QMALocalOn {e} (qmaAncillaOccupation e) := by + apply qmaLocalOn_diagonal + intro s t h + rw [h e (Finset.mem_singleton_self e)] + +def qmaThirdLocalPiece (A B C : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (e : κ) (R j : ℝ) : + Fin 7 → Matrix (ι ⊕ κ → Fin 2) (ι ⊕ κ → Fin 2) ℂ := + ![(R^3:ℝ) • qmaJoinMatrix (1 : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (qmaAncillaOccupation e), + (R*(1+(j/2)^2):ℝ) • (1 : Matrix (ι ⊕ κ → Fin 2) (ι ⊕ κ → Fin 2) ℂ), + (R*j:ℝ) • qmaJoinMatrix (A*B) (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ), + (-(1+(j/2)^2):ℝ) • qmaJoinMatrix C (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ), + (R^2:ℝ) • qmaJoinMatrix C (qmaAncillaOccupation e), + (R^2:ℝ) • qmaJoinMatrix A (qmaBitFlipMatrix e), + (R^2*j/2:ℝ) • qmaJoinMatrix B (qmaBitFlipMatrix e)] + +theorem qmaThirdPiece_reindex (A B C : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (e : κ) (R j : ℝ) (k : Fin 7) : + (qmaThirdPiece A B C e R j k).submatrix (Equiv.sumArrowEquivProdArrow ι κ (Fin 2)) + (Equiv.sumArrowEquivProdArrow ι κ (Fin 2)) = qmaThirdLocalPiece A B C e R j k := by + fin_cases k <;> simp [qmaThirdPiece,qmaThirdLocalPiece,qmaJoinMatrix, + Matrix.submatrix_smul,Matrix.submatrix_one_equiv] + +theorem qmaThirdLocalPiece_two_local (A B C : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (e : κ) (R j : ℝ) {SA SB SC : Finset ι} + (hA : QMALocalOn SA A) (hB : QMALocalOn SB B) (hC : QMALocalOn SC C) + (hSA : SA.card ≤ 1) (hSB : SB.card ≤ 1) (hSC : SC.card ≤ 1) (k : Fin 7) : + ∃ U : Finset (ι ⊕ κ), U.card ≤ 2 ∧ QMALocalOn U (qmaThirdLocalPiece A B C e R j k) := by + have hOcc := qmaOccupation_local e + have hFlip := qmaBitFlipMatrix_local e + have hsingle : ({e} : Finset κ).card ≤ 1 := by simp + fin_cases k + · obtain ⟨U,hU,hM⟩ := qmaJoin_two_local (qmaLocal_identity (∅ : Finset ι)) hOcc (by simp) hsingle + exact ⟨U,hU,hM.real_smul (R^3)⟩ + · exact ⟨∅,by simp,(qmaLocal_identity (∅ : Finset (ι ⊕ κ))).real_smul (R*(1+(j/2)^2))⟩ + · have hAB := (hA.mono Finset.subset_union_left).mul (hB.mono Finset.subset_union_right) + refine ⟨(SA ∪ SB).map (Function.Embedding.inl : ι ↪ ι ⊕ κ),?_,hAB.joinLeft.real_smul (R*j)⟩ + rw [Finset.card_map] + exact (Finset.card_union_le SA SB).trans (by omega) + · refine ⟨SC.map (Function.Embedding.inl : ι ↪ ι ⊕ κ),?_,hC.joinLeft.real_smul (-(1+(j/2)^2))⟩ + simpa only [Finset.card_map] using hSC.trans (by norm_num : (1:ℕ) ≤ 2) + · obtain ⟨U,hU,hM⟩ := qmaJoin_two_local hC hOcc hSC hsingle + exact ⟨U,hU,hM.real_smul (R^2)⟩ + · obtain ⟨U,hU,hM⟩ := qmaJoin_two_local hA hFlip hSA hsingle + exact ⟨U,hU,hM.real_smul (R^2)⟩ + · obtain ⟨U,hU,hM⟩ := qmaJoin_two_local hB hFlip hSB hsingle + exact ⟨U,hU,hM.real_smul (R^2*j/2)⟩ + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdNormBudget.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdNormBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..e3fc32c5f694bae2b5caed8a2775f0c1ff36d4fa --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdNormBudget.lean @@ -0,0 +1,106 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitMediatorNormBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumThirdCounterterm + +namespace OAI + +/-! A rational polynomial budget for the third-order counterterms. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical +variable {σ : Type*} [Fintype σ] [DecidableEq σ] + +def qmaThirdWeight (j : ℝ) : ℝ := (1+|j|)^2 + +theorem qmaThirdWeight_bounds (j : ℝ) : + 1 ≤ qmaThirdWeight j ∧ |j| ≤ qmaThirdWeight j ∧ + 1+(j/2)^2+|j| ≤ qmaThirdWeight j ∧ + 1+|j|/2 ≤ 1+|j| := by + have hj := abs_nonneg j + have hs := sq_abs j + dsimp [qmaThirdWeight] + constructor + · nlinarith + constructor + · nlinarith + constructor <;> nlinarith + +theorem qmaMatrix_real_smul_norm (r : ℝ) (M : Matrix σ σ ℂ) : + ‖spinMatrixOperator (r • M)‖ = |r| * ‖spinMatrixOperator M‖ := by + change ‖spinMatrixOperator ((r:ℂ) • M)‖ = _ + rw [spinMatrixOperator_smul,norm_smul,Complex.norm_real,Real.norm_eq_abs] + +theorem qmaMatrix_product_norm (A B : Matrix σ σ ℂ) + (hA : ‖spinMatrixOperator A‖ ≤ 1) (hB : ‖spinMatrixOperator B‖ ≤ 1) : + ‖spinMatrixOperator (A*B)‖ ≤ 1 := by + rw [spinMatrixOperator_mul] + exact (ContinuousLinearMap.opNorm_comp_le _ _).trans + ((mul_le_mul hA hB (norm_nonneg _) zero_le_one).trans_eq (one_mul _)) + +theorem qmaMatrixOperator_neg (A : Matrix σ σ ℂ) : + spinMatrixOperator (-A) = -spinMatrixOperator A := by + unfold spinMatrixOperator + rw [map_neg,map_neg] + +theorem qmaThirdPair_norm (A B : Matrix σ σ ℂ) (j : ℝ) + (hA : ‖spinMatrixOperator A‖ ≤ 1) (hB : ‖spinMatrixOperator B‖ ≤ 1) : + ‖spinMatrixOperator (qmaThirdSeriesPair A B j)‖ ≤ 1+|j| := by + have he : (j:ℂ)/2 = ((j/2:ℝ):ℂ) := by push_cast; rfl + unfold qmaThirdSeriesPair + rw [he,spinMatrixOperator_add,spinMatrixOperator_smul] + calc + _ ≤ ‖spinMatrixOperator A‖+‖((j/2:ℝ):ℂ) • spinMatrixOperator B‖ := norm_add_le _ _ + _ = ‖spinMatrixOperator A‖+(|j|/2)*‖spinMatrixOperator B‖ := by + rw [norm_smul,Complex.norm_real,Real.norm_eq_abs,abs_div, + abs_of_pos (by norm_num : (0:ℝ) < 2)] + _ ≤ 1+|j|/2 := by + simpa only [mul_one] using add_le_add hA (mul_le_mul_of_nonneg_left hB (by positivity)) + _ ≤ 1+|j| := (qmaThirdWeight_bounds j).2.2.2 + +theorem qmaThirdCounter_norm (A B C : Matrix σ σ ℂ) (r j : ℝ) (hr : 0 ≤ r) + (hA : ‖spinMatrixOperator A‖ ≤ 1) (hB : ‖spinMatrixOperator B‖ ≤ 1) + (hC : ‖spinMatrixOperator C‖ ≤ 1) : + ‖spinMatrixOperator (qmaThirdSeriesCounter A B C r j)‖ ≤ (r+1)*qmaThirdWeight j := by + let c : ℝ := 1+(j/2)^2 + have hc : 0 ≤ c := by dsimp [c]; positivity + have hcast : (1+((j:ℂ)/2)^2) = (c:ℂ) := by dsimp [c]; push_cast; rfl + have hI : ‖spinMatrixOperator (1 : Matrix σ σ ℂ)‖ ≤ 1 := by + exact spinMatrixOperator_unitary_norm _ (by simp) + have hAB := qmaMatrix_product_norm A B hA hB + have he : qmaThirdSeriesCounter A B C r j = + (r:ℝ) • ((c:ℝ) • (1 : Matrix σ σ ℂ)+(j:ℝ) • (A*B))-(c:ℝ) • C := by + simp only [qmaThirdSeriesCounter,hcast] + rfl + rw [he] + have hfirst : ‖spinMatrixOperator ((c:ℝ) • (1 : Matrix σ σ ℂ)+(j:ℝ) • (A*B))‖ ≤ c+|j| := by + rw [spinMatrixOperator_add] + apply (norm_add_le _ _).trans + rw [qmaMatrix_real_smul_norm,qmaMatrix_real_smul_norm,abs_of_nonneg hc] + simpa only [mul_one] using add_le_add + (mul_le_mul_of_nonneg_left hI hc) (mul_le_mul_of_nonneg_left hAB (abs_nonneg j)) + have hnormsub : ‖spinMatrixOperator (r • (c • (1 : Matrix σ σ ℂ)+j • (A*B))-c • C)‖ ≤ + ‖spinMatrixOperator (r • (c • (1 : Matrix σ σ ℂ)+j • (A*B)))‖+ + ‖spinMatrixOperator (c • C)‖ := by + rw [sub_eq_add_neg] + rw [spinMatrixOperator_add] + rw [qmaMatrixOperator_neg] + simpa only [norm_neg] using norm_add_le (spinMatrixOperator (r • (c • (1 : Matrix σ σ ℂ)+j • (A*B)))) + (-(spinMatrixOperator (c • C))) + apply hnormsub.trans + rw [qmaMatrix_real_smul_norm,qmaMatrix_real_smul_norm,abs_of_nonneg hr,abs_of_nonneg hc] + calc + _ ≤ r*(c+|j|)+c := by + simpa only [mul_one] using add_le_add (mul_le_mul_of_nonneg_left hfirst hr) + (mul_le_mul_of_nonneg_left hC hc) + _ ≤ (r+1)*qmaThirdWeight j := by + have hb := (qmaThirdWeight_bounds j).2.2.1 + change c+|j| ≤ qmaThirdWeight j at hb + have hm := mul_le_mul_of_nonneg_left hb hr + nlinarith [abs_nonneg j] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdPhased.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdPhased.lean new file mode 100644 index 0000000000000000000000000000000000000000..4f9db0112215e8884a4aeecb6246fd4ecc1f9419 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdPhased.lean @@ -0,0 +1,98 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdLocalFamily +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitSubdivisionHermitian + +namespace OAI + +/-! The third-order family with the real-preserving mediator phases. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Kronecker Classical +variable {σ ι κ : Type*} [Fintype σ] [DecidableEq σ] + [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +def qmaThirdPhasedPiece (A B C : Matrix σ σ ℂ) (e : κ) (R j : ℝ) (m : κ → Bool) : + Fin 7 → Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ := + ![(R^3:ℝ) • ((1 : Matrix σ σ ℂ) ⊗ₖ qmaAncillaOccupation e), + (R*(1+(j/2)^2):ℝ) • (1 : Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ), + (R*j:ℝ) • ((A*B) ⊗ₖ (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ)), + (-(1+(j/2)^2):ℝ) • (C ⊗ₖ (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ)), + (R^2:ℝ) • (C ⊗ₖ qmaAncillaOccupation e), + (R^2:ℝ) • (A ⊗ₖ qmaPolarizedFlip m e), + (R^2*j/2:ℝ) • (B ⊗ₖ qmaPolarizedFlip m e)] + +theorem qmaThirdPhasedPiece_sum (A B C : Matrix σ σ ℂ) (e : κ) (R j : ℝ) (m : κ → Bool) : + (∑ k, qmaThirdPhasedPiece A B C e R j m k) = + (R^3:ℝ) • ((1 : Matrix σ σ ℂ) ⊗ₖ qmaAncillaOccupation e)+ + qmaThirdSeriesCounter A B C R j ⊗ₖ (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ)+ + ((R^2:ℝ) • C) ⊗ₖ qmaAncillaOccupation e+ + ((R^2:ℝ) • qmaThirdSeriesPair A B j) ⊗ₖ qmaPolarizedFlip m e := by + have hr (r : ℝ) (M : Matrix σ σ ℂ) : r • M = (r:ℂ) • M := rfl + have hp (r : ℝ) (M : Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ) : + r • M = (r:ℂ) • M := rfl + have hk (M N : Matrix σ σ ℂ) : + (M-N) ⊗ₖ (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ) = + M ⊗ₖ (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ)- + N ⊗ₖ (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ) := by + ext p q + rcases p with ⟨s,a⟩ + rcases q with ⟨t,b⟩ + simp only [Matrix.kronecker_apply,Matrix.sub_apply,sub_mul] + simp only [qmaThirdPhasedPiece,Fin.sum_univ_succ,Fin.sum_univ_zero,add_zero, + Matrix.cons_val_zero,Matrix.cons_val_succ,qmaThirdSeriesCounter,qmaThirdSeriesPair, + hr,hp,Matrix.add_kronecker,hk,Matrix.smul_kronecker,Matrix.one_kronecker_one, + smul_add,smul_smul] + push_cast + module + +def qmaThirdPhased (H : Matrix σ σ ℂ) (A B C : κ → Matrix σ σ ℂ) + (R : ℝ) (J : κ → ℝ) (m : κ → Bool) : + Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ := + qmaPolarizedPhysical (R^3) (qmaThirdSeriesLow H A B C R (fun e => J e)) + (fun e => (R^2:ℝ) • C e) (fun e => (R^2:ℝ) • qmaThirdSeriesPair (A e) (B e) (J e)) m + +theorem qmaThirdPhased_decomposition (H : Matrix σ σ ℂ) (A B C : κ → Matrix σ σ ℂ) + (R : ℝ) (J : κ → ℝ) (m : κ → Bool) : + qmaThirdPhased H A B C R J m = + H ⊗ₖ (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ)+ + ∑ e, ∑ k, qmaThirdPhasedPiece (A e) (B e) (C e) e R (J e) m k := by + simp only [qmaThirdPhased,qmaPolarizedPhysical,qmaMediatorOccupations,qmaThirdSeriesLow, + qmaPhysicalPenalty_sum,Matrix.add_kronecker,MediatorGraph.sum_kronecker, + qmaThirdPhasedPiece_sum,Finset.sum_add_distrib] + have hs (r : ℝ) (M : Matrix (σ × (κ → Fin 2)) (σ × (κ → Fin 2)) ℂ) : + r • M = (r:ℂ) • M := rfl + simp only [hs] + abel + +theorem qmaThirdPhased_bottom (H : Matrix σ σ ℂ) (A B C : κ → Matrix σ σ ℂ) + (R : ℝ) (J : κ → ℝ) (m : κ → Bool) : + MediatorGraph.normalizedBottom (qmaThirdPhased H A B C R J m) = + MediatorGraph.normalizedBottom (qmaThirdGadget H A B C R J) := + qmaPolarizedPhysical_bottom _ _ _ _ _ + +def qmaThirdPhasedLocalPiece (A B C : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (e : κ) (R j : ℝ) (m : κ → Bool) (k : Fin 7) : + Matrix (ι ⊕ κ → Fin 2) (ι ⊕ κ → Fin 2) ℂ := + (qmaThirdPhasedPiece A B C e R j m k).submatrix + (Equiv.sumArrowEquivProdArrow ι κ (Fin 2)) (Equiv.sumArrowEquivProdArrow ι κ (Fin 2)) + +theorem qmaThirdPhasedLocalPiece_eq (A B C : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (e : κ) (R j : ℝ) (m : κ → Bool) : + qmaThirdPhasedLocalPiece A B C e R j m = + ![(R^3:ℝ) • qmaJoinMatrix (1 : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) (qmaAncillaOccupation e), + (R*(1+(j/2)^2):ℝ) • (1 : Matrix (ι ⊕ κ → Fin 2) (ι ⊕ κ → Fin 2) ℂ), + (R*j:ℝ) • qmaJoinMatrix (A*B) (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ), + (-(1+(j/2)^2):ℝ) • qmaJoinMatrix C (1 : Matrix (κ → Fin 2) (κ → Fin 2) ℂ), + (R^2:ℝ) • qmaJoinMatrix C (qmaAncillaOccupation e), + (R^2:ℝ) • qmaJoinMatrix A (qmaPolarizedFlip m e), + (R^2*j/2:ℝ) • qmaJoinMatrix B (qmaPolarizedFlip m e)] := by + funext k + fin_cases k <;> simp [qmaThirdPhasedLocalPiece,qmaThirdPhasedPiece,qmaJoinMatrix, + Matrix.submatrix_smul,Matrix.submatrix_one_equiv] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdPhasedLocal.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdPhasedLocal.lean new file mode 100644 index 0000000000000000000000000000000000000000..15fd39b7d82339934977df9ed8033863bebf2ef1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Quantum/QubitThirdPhasedLocal.lean @@ -0,0 +1,92 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QubitThirdPhased + +namespace OAI + +/-! The seven phase-corrected terms are real Hermitian two-local matrices. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators Classical + +variable {σ : Type*} [Fintype σ] + +theorem QMAEntryParity.mul_same {p : Bool} {M N : Matrix σ σ ℂ} + (hM : QMAEntryParity p M) (hN : QMAEntryParity p N) : QMAEntryParity false (M*N) := by + intro s t + change Complex.imAddGroupHom (∑ i, M s i*N i t) = 0 + rw [map_sum] + apply Finset.sum_eq_zero + intro i _ + cases p <;> simp only [QMAEntryParity,Bool.false_eq_true,ite_false,ite_true] at hM hN + · change (M s i*N i t).im = 0 + simp only [Complex.mul_im,hM s i,hN i t,mul_zero,zero_mul,add_zero] + · change (M s i*N i t).im = 0 + simp only [Complex.mul_im,hM s i,hN i t,mul_zero,zero_mul,add_zero] + +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +theorem qmaThirdPhasedLocalPiece_two_local (A B C : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (e : κ) (R j : ℝ) (m : κ → Bool) {SA SB SC : Finset ι} + (hA : QMALocalOn SA A) (hB : QMALocalOn SB B) (hC : QMALocalOn SC C) + (hSA : SA.card ≤ 1) (hSB : SB.card ≤ 1) (hSC : SC.card ≤ 1) (k : Fin 7) : + ∃ U : Finset (ι ⊕ κ), U.card ≤ 2 ∧ QMALocalOn U (qmaThirdPhasedLocalPiece A B C e R j m k) := by + rw [qmaThirdPhasedLocalPiece_eq] + have hOcc := qmaOccupation_local e + have hFlip := qmaPolarizedFlip_local m e + have hsingle : ({e} : Finset κ).card ≤ 1 := by simp + fin_cases k + · obtain ⟨U,hU,hM⟩ := qmaJoin_two_local (qmaLocal_identity (∅ : Finset ι)) hOcc (by simp) hsingle + exact ⟨U,hU,hM.real_smul (R^3)⟩ + · exact ⟨∅,by simp,(qmaLocal_identity (∅ : Finset (ι ⊕ κ))).real_smul (R*(1+(j/2)^2))⟩ + · have hAB := (hA.mono Finset.subset_union_left).mul (hB.mono Finset.subset_union_right) + refine ⟨(SA ∪ SB).map (Function.Embedding.inl : ι ↪ ι ⊕ κ),?_,hAB.joinLeft.real_smul (R*j)⟩ + rw [Finset.card_map] + exact (Finset.card_union_le SA SB).trans (by omega) + · refine ⟨SC.map (Function.Embedding.inl : ι ↪ ι ⊕ κ),?_,hC.joinLeft.real_smul (-(1+(j/2)^2))⟩ + simpa only [Finset.card_map] using hSC.trans (by norm_num : (1:ℕ) ≤ 2) + · obtain ⟨U,hU,hM⟩ := qmaJoin_two_local hC hOcc hSC hsingle + exact ⟨U,hU,hM.real_smul (R^2)⟩ + · obtain ⟨U,hU,hM⟩ := qmaJoin_two_local hA hFlip hSA hsingle + exact ⟨U,hU,hM.real_smul (R^2)⟩ + · obtain ⟨U,hU,hM⟩ := qmaJoin_two_local hB hFlip hSB hsingle + exact ⟨U,hU,hM.real_smul (R^2*j/2)⟩ + +theorem qmaThirdPhasedLocalPiece_real (A B C : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (e : κ) (R j : ℝ) (m : κ → Bool) + (hA : QMAEntryParity (m e) A) (hB : QMAEntryParity (m e) B) + (hC : QMAEntryParity false C) (k : Fin 7) : + QMAEntryParity false (qmaThirdPhasedLocalPiece A B C e R j m k) := by + rw [qmaThirdPhasedLocalPiece_eq] + fin_cases k + · exact (qmaJoinMatrix_real qmaIdentity_real (qmaOccupation_real e)).real_smul (R^3) + · exact qmaIdentity_real.real_smul (R*(1+(j/2)^2)) + · exact (qmaJoinMatrix_real (hA.mul_same hB) qmaIdentity_real).real_smul (R*j) + · exact (qmaJoinMatrix_real hC qmaIdentity_real).real_smul (-(1+(j/2)^2)) + · exact (qmaJoinMatrix_real hC (qmaOccupation_real e)).real_smul (R^2) + · exact (qmaPolarizedJoin_real A m e hA).real_smul (R^2) + · exact (qmaPolarizedJoin_real B m e hB).real_smul (R^2*j/2) + +theorem qmaThirdPhasedLocalPiece_star (A B C : Matrix (ι → Fin 2) (ι → Fin 2) ℂ) + (e : κ) (R j : ℝ) (m : κ → Bool) + (hA : A.conjTranspose = A) (hB : B.conjTranspose = B) (hC : C.conjTranspose = C) + (hAB : A*B = B*A) (k : Fin 7) : + (qmaThirdPhasedLocalPiece A B C e R j m k).conjTranspose = + qmaThirdPhasedLocalPiece A B C e R j m k := by + have hab : (A*B).conjTranspose = A*B := by rw [Matrix.conjTranspose_mul,hA,hB,hAB] + rw [qmaThirdPhasedLocalPiece_eq] + fin_cases k + · exact qmaMatrix_real_smul_star _ _ (qmaJoinMatrix_star _ _ + Matrix.conjTranspose_one (qmaAncillaOccupation_star e)) + · exact qmaMatrix_real_smul_star _ _ Matrix.conjTranspose_one + · exact qmaMatrix_real_smul_star _ _ (qmaJoinMatrix_star _ _ hab Matrix.conjTranspose_one) + · exact qmaMatrix_real_smul_star _ _ (qmaJoinMatrix_star _ _ hC Matrix.conjTranspose_one) + · exact qmaMatrix_real_smul_star _ _ (qmaJoinMatrix_star _ _ hC (qmaAncillaOccupation_star e)) + · exact qmaMatrix_real_smul_star _ _ (qmaJoinMatrix_star _ _ hA (qmaPolarizedFlip_star m e)) + · exact qmaMatrix_real_smul_star _ _ (qmaJoinMatrix_star _ _ hB (qmaPolarizedFlip_star m e)) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction.lean new file mode 100644 index 0000000000000000000000000000000000000000..7c4aa6c4c7f05679c945a29487cced95b861e5c5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction.lean @@ -0,0 +1,85 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.ActualOneBodyParameters +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.ActualOneBodyScale +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.ActualResidualParameters +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.AutomaticCalibrationCorrectness +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.AutomaticCalibrationList +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.AutomaticCalibrationNormalization +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.AutomaticCalibrationParameters +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.BinaryAmplification +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.BinaryEncoding +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.BinaryWellCharges +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.CompatibleSlabMesh +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.ComputableAmplification +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.ComputableHopping +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.ComputableResolvent +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.ConditionalHardness +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.Dilation +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.FormStability +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.Hardness +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.HardnessComposition +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.LastTensorFiber +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.Model +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.OneInputHardness +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.Perturbation +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.PhysicalGroundComparison +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.PhysicalOneElectronLower +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.PhysicalThreshold +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.PhysicalThresholdOutput +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.PublishedFlowInput +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.PublishedInputs +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.Rationalization +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.RemainingInputsHardness +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceBondLists +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceCalibratedGeometry +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceCalibrationBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceCloudComparison +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceCoefficientRounding +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceConditionalReduction +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceContactCorrectness +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceContactMatrix +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceContactTransport +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceEncodingSize +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceExceptionalVolume +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceFinalGraph +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceFiniteBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceGeometryBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceGraphIndex +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceGridGeometry +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceHamiltonian +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceHardness +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceHoppingBudget +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceHubbardEnergy +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceHubbardPromise +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceIndexedGeometry +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceIndexedSites +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceMatrix +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceNormalizationCorrectness +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceNormalizedLattice +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceNormalizedPromise +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceNormalizedSpectrum +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceParameterSchedule +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourcePauli +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourcePhysicalPromise +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourcePhysicalThreshold +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourcePositiveBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourcePositiveCorrectness +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourcePositiveMargin +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourcePromise +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourcePromiseBudget +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceSpectrum +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceTargetHubbard +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceThresholdGap +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceUnitCoulomb +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceZeroFilter +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.TargetHubbardParameters +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.ThreeInputsHardness +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.Thresholds +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.TwoInputsHardness +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.UniformAbsoluteNuclearForm +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.UniformHubbardParameters +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.UniformNuclearForm +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.UniformQuadrature +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.UniformReciprocal +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.UniformSamples +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.UniformSamplesOn +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.UniformTransformedGauss diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/ActualOneBodyParameters.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/ActualOneBodyParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..6b4e95585876c45513fde9330560eecd67efbb53 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/ActualOneBodyParameters.lean @@ -0,0 +1,115 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.ActualOneBodyScale +import OAI.MathematicalPhysics.ContinuumCoulomb.ManyBody.FiniteBoxScale +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.ScalarScaleBudgets + +namespace OAI + +/-! A fixed exponent closes the actual one-body matrix error, including +finite slab, nuclear quadrature, counterterms and orthonormalization. -/ + +noncomputable section +open MeasureTheory +namespace ContinuumCoulomb + +theorem exists_actual_oneBody_parameters {rho freq a E : ℝ} + (hrho : 0 ≤ rho) (hf : 0 < freq) (ha : 0 < a) (hE : 0 ≤ E) : + ∃ k₀ : ℕ, 1 ≤ k₀ ∧ ∀ r s p k : ℕ, k₀+5*r+72*s+p ≤ k → + ∀ N H S D : ℝ, 2 ≤ N → + (N^k)^50 ≤ H → H ≤ 2*(N^k)^50 → + (N^k)^5 ≤ S → S ≤ 2*(N^k)^5 → 25*(k:ℝ)*Real.log N ≤ D → + ∀ (m : ℕ) (u : Fin m → PlanarPosition), (m:ℝ) ≤ N^r → + (∀ j, ‖u j‖ ≤ N^s) → (∀ i j, i ≠ j → D ≤ ‖u i-u j‖) → + ∀ F : Position → ℝ, + (∀ i j, Integrable (fun x => F x*continuumLocalizedMode freq (u i) x* + continuumLocalizedMode freq (u j) x)) → + (∀ i j, |∫ x, F x*continuumLocalizedMode freq (u i) x*continuumLocalizedMode freq (u j) x| ≤ + E*((m:ℝ)+1)/(N^k)^32) → ∀ i j, + |(a*(N^k)^30)*correctedNuclearOneBodyMatrix rho H S freq (a*(N^k)^30) u F i j- + localizedOneBodyTarget (a*(N^k)^30) freq u i j| ≤ (N^p)⁻¹ := by + let d := localizedCountertermBound freq + let P := planarWellMatrixConstant + let O := planarOverlapConstant + let W := PlanarSobolev.wellBound + let C := 4*a+8*a*E+8*a*W*O^2+8*a*O*P+8*d*O*P+a*P+d*P+d*W*O + have hd : 0 ≤ d := localizedCountertermBound_nonnegative freq + have hP : 0 ≤ P := planarWellMatrixConstant_nonnegative + have hO : 0 ≤ O := planarOverlapConstant_nonnegative + have hW : 0 ≤ W := PlanarSobolev.wellBound_nonnegative + have hC : 0 ≤ C := by dsimp [C]; positivity + obtain ⟨qB,hqB,hbox⟩ := exists_finiteBoxResidual_parameter_offset hf hrho + obtain ⟨qδ,hqδ,hδbound⟩ := exists_polynomial_ratio_offset (d/a) (by norm_num : (0:ℝ)<1) + obtain ⟨qG,hqG,hgram⟩ := exists_polynomial_ratio_offset O (by norm_num : (0:ℝ)<1/2) + obtain ⟨qE,hqE,herr⟩ := exists_polynomial_ratio_offset (32*C) (by norm_num : (0:ℝ)<1) + refine ⟨qB+qδ+qG+qE+1,by omega,?_⟩ + intro r s p k hk N H S D hN hHlo hHhi hSlo hShi hD m u hm hu hsep F hI hF i j + have hN0 : 0 < N := by linarith + have hN1 : 1 ≤ N := by linarith + have hR : 2 ≤ N^k := hN.trans (le_self_pow₀ hN1 (by omega)) + have hR0 : 0 < N^k := by positivity + have hR1 : 1 ≤ N^k := one_le_pow₀ hN1 + have hH : 0 < H := (pow_pos hR0 50).trans_le hHlo + have hS : 0 < S := (pow_pos hR0 5).trans_le hSlo + have hD0 : 0 ≤ D := (mul_nonneg (by positivity : 0 ≤ 25*(k:ℝ)) + (Real.log_nonneg hN1)).trans hD + have hscale : 0 < a*(N^k)^30 := by positivity + let δ := d*(m:ℝ)/(a*(N^k)^30) + have hδ : 0 ≤ δ := by dsimp [δ]; positivity + have hδ1 : δ ≤ 1 := by + calc + _ ≤ (d/a)*N^r/(N^k)^2 := by + dsimp [δ] + calc + _ = (d/a)*(m:ℝ)/(N^k)^30 := by ring + _ ≤ (d/a)*N^r/(N^k)^2 := by + gcongr + decide + _ ≤ 1 := by simpa only [pow_zero,div_one] using hδbound r 0 k (by omega) N hN + have hcoeff (i : Fin m) : 0 ≤ localizedCounterterm freq u i/(a*(N^k)^30) ∧ + localizedCounterterm freq u i/(a*(N^k)^30) ≤ δ := by + refine ⟨div_nonneg (localizedCounterterm_nonnegative freq u i) hscale.le,?_⟩ + apply div_le_div_of_nonneg_right _ hscale.le + simpa only [d,mul_comm] using localizedCounterterm_bound hf u i + have h19 : Real.exp (-(19/10:ℝ)*D) ≤ 1/(N^k)^40 := + by simpa only [one_div] using logarithmic_separation_residual hN k hD + have h9 : Real.exp (-(9/10:ℝ)*D) ≤ 1/(N^k)^22 := + by simpa only [one_div] using logarithmic_separation_overlap hN k hD + have hs : (m:ℝ)*localizedOverlapBound D ≤ 1/2 := by + calc + _ ≤ O*N^r/(N^k)^22 := by + unfold localizedOverlapBound + calc + _ ≤ (m:ℝ)*(O*(1/(N^k)^22)) := mul_le_mul_of_nonneg_left + (mul_le_mul_of_nonneg_left h9 hO) (Nat.cast_nonneg m) + _ = O*(m:ℝ)/(N^k)^22 := by ring + _ ≤ _ := by gcongr + _ ≤ O*N^r/(N^k)^2 := div_le_div_of_nonneg_left (by positivity) (by positivity) + (pow_le_pow_right₀ hR1 (by decide : 2 ≤ 22)) + _ ≤ 1/2 := by simpa only [pow_zero,div_one] using hgram r 0 k (by omega) N hN + have hhalf : (N^k)^5 ≤ H/2 := by + have h2 : 2*(N^k)^5 ≤ (N^k)^50 := by + calc + _ ≤ (N^k)*(N^k)^5 := mul_le_mul_of_nonneg_right hR (by positivity) + _ = (N^k)^6 := by ring + _ ≤ _ := pow_le_pow_right₀ hR1 (by decide) + linarith [h2.trans hHlo] + have hb (j : Fin m) : + (∫ x, finiteBoxOrbitalResidual rho H S freq (a*(N^k)^30) u j x^2) ≤ (1/(N^k)^32)^2 := by + apply (finiteBoxOrbitalResidual_square_bound hrho hH hS hf + (pow_pos hR0 5) hhalf hSlo (a*(N^k)^30) u hδ hcoeff j).trans + simpa only [one_div] using hbox r s k (by omega) N H S δ hN + hHlo hHhi hSlo hShi hδ hδ1 m u hm hu j + have hmat := correctedNuclearOneBodyMatrix_physical_scale hrho hH hS hf hD0 hR ha hE + u hsep hs h19 h9 hcoeff hb F hI hF i j + change _ ≤ C*((m:ℝ)+1)^5/(N^k)^2 at hmat + apply hmat.trans + have hm1 : (m:ℝ)+1 ≤ 2*N^r := by linarith [one_le_pow₀ hN1 (n := r)] + calc + C*((m:ℝ)+1)^5/(N^k)^2 ≤ C*(2*N^r)^5/(N^k)^2 := by gcongr + _ = (32*C)*N^(5*r)/(N^k)^2 := by ring + _ ≤ _ := by simpa only [one_div,one_mul] using herr (5*r) p k (by omega) N hN + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/ActualOneBodyScale.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/ActualOneBodyScale.lean new file mode 100644 index 0000000000000000000000000000000000000000..772ac9ac305dc901047039092bd48290a132e762 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/ActualOneBodyScale.lean @@ -0,0 +1,89 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.LocalizedMatrixDecayBound +import OAI.MathematicalPhysics.ContinuumCoulomb.ManyBody.FiniteOneBodyCorrection +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.OneBodyScaleBudget + +namespace OAI + +/-! Actual corrected nuclear entries at the physical amplification. The +Gram error uses the decaying shifted matrix, not a uniform operator bound. -/ + +noncomputable section +open MeasureTheory +namespace ContinuumCoulomb + +theorem correctedNuclearOneBodyMatrix_physical_scale + {rho H S freq D R a E : ℝ} (hrho : 0 ≤ rho) (hH : 0 < H) + (hS : 0 < S) (hf : 0 < freq) (hD : 0 ≤ D) (hR : 2 ≤ R) + (ha : 0 < a) (hE : 0 ≤ E) {m : ℕ} (u : Fin m → PlanarPosition) + (hsep : ∀ i j, i ≠ j → D ≤ ‖u i-u j‖) + (hs : m*localizedOverlapBound D ≤ 1/2) + (h19 : Real.exp (-(19/10:ℝ)*D) ≤ 1/R^40) + (h9 : Real.exp (-(9/10:ℝ)*D) ≤ 1/R^22) + (hcoeff : ∀ i, 0 ≤ localizedCounterterm freq u i/(a*R^30) ∧ + localizedCounterterm freq u i/(a*R^30) ≤ localizedCountertermBound freq*m/(a*R^30)) + (hbox : ∀ j, (∫ x, finiteBoxOrbitalResidual rho H S freq (a*R^30) u j x^2) ≤ (1/R^32)^2) + (F : Position → ℝ) + (hI : ∀ i j, Integrable (fun x => F x*continuumLocalizedMode freq (u i) x* + continuumLocalizedMode freq (u j) x)) + (hF : ∀ i j, |∫ x, F x*continuumLocalizedMode freq (u i) x* + continuumLocalizedMode freq (u j) x| ≤ E*((m:ℝ)+1)/R^32) (i j : Fin m) : + |(a*R^30)*correctedNuclearOneBodyMatrix rho H S freq (a*R^30) u F i j- + localizedOneBodyTarget (a*R^30) freq u i j| ≤ + (4*a+8*a*E+8*a*PlanarSobolev.wellBound*planarOverlapConstant^2+ + 8*a*planarOverlapConstant*planarWellMatrixConstant+ + 8*localizedCountertermBound freq*planarOverlapConstant*planarWellMatrixConstant+ + a*planarWellMatrixConstant+localizedCountertermBound freq*planarWellMatrixConstant+ + localizedCountertermBound freq*PlanarSobolev.wellBound*planarOverlapConstant)* + ((m:ℝ)+1)^5/R^2 := by + have hR0 : 0 < R := by linarith + have hR1 : 1 ≤ R := by linarith + have hscale : 0 < a*R^30 := by positivity + have hd := localizedCountertermBound_nonnegative freq + have hP := planarWellMatrixConstant_nonnegative + have hO := planarOverlapConstant_nonnegative + have hW := PlanarSobolev.wellBound_nonnegative + let δ := localizedCountertermBound freq*(m:ℝ)/(a*R^30) + let B := (PlanarSobolev.wellBound*planarOverlapConstant+(m:ℝ)*planarWellMatrixConstant)/R^22+ + (m:ℝ)*δ*planarWellMatrixConstant + have hδ : 0 ≤ δ := by dsimp [δ]; positivity + have hB : 0 ≤ B := by dsimp [B]; positivity + have hb (p q : Fin m) : |localizedCorrectedOneBodyMatrix freq (a*R^30) u p q| ≤ B := by + apply (localizedCorrectedOneBodyMatrix_decay hf hD hδ (a*R^30) u hsep hcoeff p q).trans + dsimp only [B] + have h := mul_le_mul_of_nonneg_left h9 + (show 0 ≤ PlanarSobolev.wellBound*planarOverlapConstant+(m:ℝ)*planarWellMatrixConstant by positivity) + exact add_le_add (by simpa only [mul_one_div] using h) le_rfl + have hg : localizedOverlapBound D ≤ planarOverlapConstant/R^22 := by + unfold localizedOverlapBound + simpa only [mul_one_div] using mul_le_mul_of_nonneg_left h9 hO + have he := correctedNuclearOneBodyMatrix_error hrho hH hS hf (ne_of_gt hscale) u hδ hcoeff + hsep hs (show 0 ≤ 1/R^32 by positivity) hbox hB hb F hI hF i j + apply he.trans + apply le_trans _ (one_body_scale_bound hR1 ha hd hE hP hO hW (Nat.cast_nonneg m)) + dsimp only [B,δ] + rw [abs_of_pos hscale] + have hgm : (m:ℝ)^2*(4*(2*m*localizedOverlapBound D)*B) ≤ + (m:ℝ)^2*(4*(2*m*(planarOverlapConstant/R^22))*B) := by gcongr + have hn := add_le_add (add_le_add + (show 4*(m:ℝ)^2*(1/R^32) ≤ 4*(m:ℝ)^2/R^32 by exact le_of_eq (by ring)) hgm) + (le_refl (4*(m:ℝ)^2*(E*((m:ℝ)+1)/R^32))) + have ht := mul_le_mul_of_nonneg_left hn hscale.le + have he19 := mul_le_mul_of_nonneg_left h19 + (show 0 ≤ a*R^30*m*planarWellMatrixConstant+(m:ℝ)^2*localizedCountertermBound freq*planarWellMatrixConstant by positivity) + have he9 := mul_le_mul_of_nonneg_left h9 + (show 0 ≤ (m:ℝ)^2*localizedCountertermBound freq*(PlanarSobolev.wellBound*planarOverlapConstant) by positivity) + have he19' : (a*R^30*m*planarWellMatrixConstant+(m:ℝ)^2*localizedCountertermBound freq*planarWellMatrixConstant)* + Real.exp (-(19/10:ℝ)*D) ≤ + (a*R^30*m*planarWellMatrixConstant+(m:ℝ)^2*localizedCountertermBound freq*planarWellMatrixConstant)/R^40 := by + simpa only [mul_one_div] using he19 + have he9' : ((m:ℝ)^2*localizedCountertermBound freq*(PlanarSobolev.wellBound*planarOverlapConstant))* + Real.exp (-(9/10:ℝ)*D) ≤ + ((m:ℝ)^2*localizedCountertermBound freq*(PlanarSobolev.wellBound*planarOverlapConstant))/R^22 := by + simpa only [mul_one_div] using he9 + exact add_le_add (add_le_add ht he19') he9' + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/ActualResidualParameters.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/ActualResidualParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..70489b5ee8ca0fd0d1a244c279b91cb17ee504f2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/ActualResidualParameters.lean @@ -0,0 +1,51 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.ManufacturedResidualParameters +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.LocalizedCounterterms + +namespace OAI + +/-! The counterterm size in the residual theorem is computed from the +actual orbital Coulomb sums; no independent coefficient bound is assumed. -/ + +noncomputable section +open scoped BigOperators +namespace ContinuumCoulomb + +theorem actual_counterterm_scale_bound {freq N a : ℝ} (hf : 0 < freq) + (hN : 0 < N) (ha : 0 < a) (r k : ℕ) {m : ℕ} + (u : Fin m → PlanarPosition) (hm : (m:ℝ) ≤ N^r) (i : Fin m) : + 0 ≤ localizedCounterterm freq u i/(a*(N^k)^30) ∧ + localizedCounterterm freq u i/(a*(N^k)^30) ≤ + localizedCountertermBound freq*N^r/(a*(N^k)^30) := by + refine ⟨div_nonneg (localizedCounterterm_nonnegative freq u i) (by positivity),?_⟩ + apply div_le_div_of_nonneg_right _ (by positivity) + exact (localizedCounterterm_bound hf u i).trans (by + simpa only [mul_comm] using mul_le_mul_of_nonneg_right hm (localizedCountertermBound_nonnegative freq)) + +theorem exists_actual_manufactured_residual_parameters {freq rho a : ℝ} + (hf : 0 < freq) (hrho : 0 ≤ rho) (ha : 0 < a) : + ∃ k₀ : ℕ, 1 ≤ k₀ ∧ ∀ r s k : ℕ, k₀+7*r+72*s ≤ k → ∀ N : ℝ, 2 ≤ N → + ∀ H S D : ℝ, (N^k)^50 ≤ H → H ≤ 2*(N^k)^50 → + (N^k)^5 ≤ S → S ≤ 2*(N^k)^5 → 25*(k:ℝ)*Real.log N ≤ D → + ∀ (m : ℕ) (u : Fin m → PlanarPosition), (m:ℝ) ≤ N^r → (∀ j, ‖u j‖ ≤ N^s) → + let η := localizedCountertermBound freq*N^r/(a*(N^k)^30) + (∀ i, 0 ≤ localizedCounterterm freq u i/(a*(N^k)^30) ∧ + localizedCounterterm freq u i/(a*(N^k)^30) ≤ η) ∧ + 0 ≤ η ∧ η ≤ 1 ∧ 4*(m:ℝ)^2*(∑ j, + manufacturedOrbitalSquaredError rho H S freq η D ((N^k)^5) u j) ≤ + ((N^k)^19)⁻¹^2 := by + obtain ⟨k₀,hk₀,hbound⟩ := exists_manufactured_residual_parameter_offset hf hrho ha + (localizedCountertermBound_nonnegative freq) + refine ⟨k₀,hk₀,?_⟩ + intro r s k hk N hN H S D hHlo hHhi hSlo hShi hD m u hm hu + have hN0 : 0 < N := by linarith + dsimp only + have hη : 0 ≤ localizedCountertermBound freq*N^r/(a*(N^k)^30) := + div_nonneg (mul_nonneg (localizedCountertermBound_nonnegative freq) (by positivity)) (by positivity) + have hb := hbound r s k hk N hN H S D _ hHlo hHhi hSlo hShi hD hη le_rfl m u hm hu + exact ⟨actual_counterterm_scale_bound hf hN0 ha r k u hm,hη,hb⟩ + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/AutomaticCalibrationCorrectness.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/AutomaticCalibrationCorrectness.lean new file mode 100644 index 0000000000000000000000000000000000000000..a0e9fc38fd24c81f0aeb6b2c99545b1b746699c1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/AutomaticCalibrationCorrectness.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.AutomaticCalibrationProgram + +namespace OAI + +/-! The fixed polynomial-time distance program has the true Coulomb +calibration residual and geometric length bounds. All interval signs and +evaluation precision are discharged by the constructed program. -/ + +noncomputable section +namespace ContinuumCoulomb.AutomaticCalibration + +theorem exists_automatic_calibration (rho : ℕ) (hrho : 0 < rho) + (ε : ℚ) (hε : 0 < ε) (hε1 : ε < 1) (A B : ℕ) (kmin : ℝ) : + ∃ (c : ℚ) (k : ℕ), 0 < c ∧ 0 < k ∧ kmin ≤ (k : ℝ) ∧ + ∀ (N P : ℕ) (K : ℚ), 2 ≤ N → ((N : ℝ) ^ A)⁻¹ ≤ K → (K : ℝ) ≤ (N : ℝ) ^ A → + let d := value rho ε c k A B (N, (P, K)) + let D := (k : ℝ) * Real.log (N : ℝ) + (1 - (ε : ℝ)) * D ≤ d ∧ (d : ℝ) ≤ (1 + (ε : ℝ)) * D ∧ + localizedGramConstant (GaussianFrequency.frequency rho) ≤ + localizedCoulombProfile (GaussianFrequency.frequency rho) 0 - + localizedCoulombProfile (GaussianFrequency.frequency rho) d ∧ + |(N : ℝ) ^ k * planarHopping d - + coulombHoppingTarget (GaussianFrequency.frequency rho) ((N : ℝ) ^ B)⁻¹ K d| ≤ + ((P : ℝ) + 1)⁻¹ := by + have hfreq : 0 < GaussianFrequency.frequency rho := Real.sqrt_pos.mpr (by + change 0 < 4 * Real.pi * (rho : ℝ) + positivity) + obtain ⟨c, k, hc, hk, hkmin, hbracket⟩ := + CalibrationRationalBracket.exists_coulomb_brackets hfreq ε hε hε1 A B kmin + refine ⟨c, k, hc, hk, hkmin, ?_⟩ + intro N P K hN hKlo hKhi + let x : Input := (N, (P, K)) + let e := environment k A B x + let p := interval ε c k N + obtain ⟨ha, hb, _, hgap, hsign⟩ := hbracket N hN + have hmem := value_mem (rho := rho) (k := k) (A := A) (B := B) + x hε.le hc.le + have hleft : (p.1 : ℝ) ≤ value rho ε c k A B x := by exact_mod_cast hmem.1 + have hright : (value rho ε c k A B x : ℝ) ≤ p.2 := by exact_mod_cast hmem.2 + have hK0 : (0 : ℝ) ≤ K := (inv_nonneg.mpr (by positivity)).trans hKlo + have hKQ : (0 : ℚ) ≤ K := by exact_mod_cast hK0 + have hKbound : (K : ℝ) ≤ queryBound k A N := queryBound_coefficients k A N hKhi + have hτ : (0 : ℚ) ≤ ((N ^ B : ℕ) : ℚ)⁻¹ := by positivity + have hNB : (1 : ℚ) ≤ ((N ^ B : ℕ) : ℚ) := by + exact_mod_cast (one_le_pow₀ (show 1 ≤ N by omega) : 1 ≤ N ^ B) + have hτ1 : (((N ^ B : ℕ) : ℚ)⁻¹) ≤ 1 := inv_le_one_of_one_le₀ hNB + have hab : p.1 ≤ p.2 := interval_order hε.le hc.le k N + have hquery := interval_query_bound hε1.le k A N ha hb hN + have hs := hsign K hKlo hKhi + have hsignA : 0 ≤ CalibratedEvaluation.residual rho e p.1 := by + simpa only [CalibratedEvaluation.residual, e, environment, x, p, interval, + Rat.cast_inv, Rat.cast_natCast, Rat.cast_pow, Nat.cast_pow] using hs.1 + have hsignB : CalibratedEvaluation.residual rho e p.2 ≤ 0 := by + simpa only [CalibratedEvaluation.residual, e, environment, x, p, interval, + Rat.cast_inv, Rat.cast_natCast, Rat.cast_pow, Nat.cast_pow] using hs.2 + have herr := CalibratedEvaluation.scheduled_residual rho hrho e p.1 p.2 + hKQ hKbound hτ hτ1 hab hquery.1 hquery.2 hsignA hsignB + (fun r hr => hgap r hr.1) + refine ⟨ha.trans hleft, hright.trans hb, hgap _ hleft, ?_⟩ + simpa only [value, CalibratedEvaluation.residual, e, environment, x, p, interval, + Rat.cast_inv, Rat.cast_natCast, Rat.cast_pow, Nat.cast_pow] using herr + +end ContinuumCoulomb.AutomaticCalibration + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/AutomaticCalibrationList.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/AutomaticCalibrationList.lean new file mode 100644 index 0000000000000000000000000000000000000000..77eb0dbc6d13e555588c778bb6768ebf848fe221 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/AutomaticCalibrationList.lean @@ -0,0 +1,58 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.AutomaticCalibrationNormalization +import OAI.Computability.QuantumFactoring.BitStackListMapWith + +namespace OAI + +/-! All edges share one fixed calibration program and one rational +spacing. Mapping that program over the edge coefficients retains a +polynomial running time in the complete encoded input. -/ + +noncomputable section +namespace ContinuumCoulomb.AutomaticCalibrationList +open ExactQuantumFactoring.BitStackProgram + +abbrev Environment := ℕ × ℕ +abbrev Input := Environment × List ℚ + +def environmentCode : Environment → List Bool := prodCode unaryCode unaryCode + +def inputCode : Input → List Bool := prodCode environmentCode (listCode ratCode) + +def value (rho : ℕ) (ε c : ℚ) (k A B : ℕ) (x : Input) : List ℚ := + x.2.map (fun K => AutomaticCalibration.normalizedValue rho ε c k A B (x.1.1, (x.1.2, K))) + +noncomputable opaque elementProgram (rho : ℕ) (ε c : ℚ) (k A B : ℕ) : + Procedure (prodCode environmentCode ratCode) ratCode + (fun x => AutomaticCalibration.normalizedValue rho ε c k A B (x.1.1, (x.1.2, x.2))) := by + let env := Procedure.first environmentCode ratCode + let n := (Procedure.first unaryCode unaryCode).comp env + let p := (Procedure.second unaryCode unaryCode).comp env + let coefficient := Procedure.second environmentCode ratCode + exact (AutomaticCalibration.normalizedProgram rho ε c k A B).comp + (n.pair (p.pair coefficient)) + +noncomputable opaque program (rho : ℕ) (ε c : ℚ) (k A B : ℕ) : + Procedure inputCode (listCode ratCode) (value rho ε c k A B) := + Procedure.listMapWith (ea := environmentCode) (eb := ratCode) (ec := ratCode) + (f := fun e K => AutomaticCalibration.normalizedValue rho ε c k A B (e.1, (e.2, K))) + 0 0 (elementProgram rho ε c k A B) + +noncomputable def certificate (rho : ℕ) (ε c : ℚ) (k A B : ℕ) : + Turing.TM2ComputableInPolyTime inputCode (listCode ratCode) (value rho ε c k A B) := + (program rho ε c k A B).toTM2 + +theorem value_near_one (rho : ℕ) {ε c : ℚ} (hε : 0 ≤ ε) (hc : 0 < c) + (k A B : ℕ) (x : Input) (hN : 0 < x.1.1) : + ∀ q ∈ value rho ε c k A B x, q ∈ Set.Icc (1 - ε / 2) (1 + ε / 2) := by + intro q hq + obtain ⟨K, _, rfl⟩ := List.mem_map.mp hq + exact AutomaticCalibration.normalizedValue_mem rho hε hc k A B _ hN + +theorem value_length (rho : ℕ) (ε c : ℚ) (k A B : ℕ) (x : Input) : + (value rho ε c k A B x).length = x.2.length := by simp [value] + +end ContinuumCoulomb.AutomaticCalibrationList + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/AutomaticCalibrationNormalization.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/AutomaticCalibrationNormalization.lean new file mode 100644 index 0000000000000000000000000000000000000000..3f3c246bfc9a6d8fd0f9720ada9ac3f299a363d3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/AutomaticCalibrationNormalization.lean @@ -0,0 +1,54 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.AutomaticCalibrationCorrectness + +namespace OAI + +/-! The very same rational scale used by the search gives the rational +near-unit lengths supplied to the contact-coordinate program. -/ + +noncomputable section +namespace ContinuumCoulomb.AutomaticCalibration +open ExactQuantumFactoring.BitStackProgram + +def spacing (c : ℚ) (k N : ℕ) : ℚ := RationalLogScale.value c k N + +def normalizedValue (rho : ℕ) (ε c : ℚ) (k A B : ℕ) (x : Input) : ℚ := + value rho ε c k A B x / spacing c k x.1 + +theorem spacing_positive {c : ℚ} (hc : 0 < c) (k N : ℕ) (hN : 0 < N) : + 0 < spacing c k N := by + have hb : 0 < (N ^ k).bits.length := by + rw [Nat.size_eq_bits_len] + exact Nat.size_pos.mpr (pow_pos hN k) + exact mul_pos hc (by exact_mod_cast hb) + +theorem normalizedValue_mem (rho : ℕ) {ε c : ℚ} (hε : 0 ≤ ε) (hc : 0 < c) + (k A B : ℕ) (x : Input) (hN : 0 < x.1) : + normalizedValue rho ε c k A B x ∈ Set.Icc (1 - ε / 2) (1 + ε / 2) := by + have hq := spacing_positive hc k x.1 hN + have hm := value_mem (rho := rho) (k := k) (A := A) (B := B) x hε hc.le + change (1 - ε / 2) ≤ value rho ε c k A B x / spacing c k x.1 ∧ + value rho ε c k A B x / spacing c k x.1 ≤ (1 + ε / 2) + constructor + · apply (le_div_iff₀ hq).mpr + exact hm.1 + · apply (div_le_iff₀ hq).mpr + exact hm.2 + +noncomputable opaque spacingProgram (c : ℚ) (k : ℕ) : Procedure inputCode ratCode + (fun x => spacing c k x.1) := (RationalLogScale.program c k).comp baseProgram + +noncomputable opaque normalizedProgram (rho : ℕ) (ε c : ℚ) (k A B : ℕ) : + Procedure inputCode ratCode (normalizedValue rho ε c k A B) := + (Procedure.ratMul.comp ((program rho ε c k A B).pair + (Procedure.ratInv.comp (spacingProgram c k)))).congrFun + (by intro x; simp only [Function.comp_apply, normalizedValue, div_eq_mul_inv]) + +noncomputable def normalizedCertificate (rho : ℕ) (ε c : ℚ) (k A B : ℕ) : + Turing.TM2ComputableInPolyTime inputCode ratCode (normalizedValue rho ε c k A B) := + (normalizedProgram rho ε c k A B).toTM2 + +end ContinuumCoulomb.AutomaticCalibration + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/AutomaticCalibrationParameters.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/AutomaticCalibrationParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..b2c90d76ec0d9f8ecfc1b233c6071b7c69ffd17f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/AutomaticCalibrationParameters.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.CalibrationCoulombBrackets +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.CalibrationRationalBracketProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.CalibratedBisectionProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.CalibratedBisectionLocation + +namespace OAI + +/-! Input and query bounds for the automatic calibrated-distance program. +The unary evaluator range is a fixed polynomial in the source size. -/ + +noncomputable section +namespace ContinuumCoulomb.AutomaticCalibration + +abbrev Input := ℕ × (ℕ × ℚ) + +def queryBound (k A N : ℕ) : ℕ := 2 * k * N + N ^ A + 1 + +def environment (k A B : ℕ) (x : Input) : CalibratedEvaluation.Environment := + ((queryBound k A x.1, x.2.1), (x.1 ^ k, (((x.1 ^ B : ℕ) : ℚ)⁻¹, x.2.2))) + +def interval (ε c : ℚ) (k N : ℕ) : ℚ × ℚ := + CalibrationRationalBracket.endpoints ε (RationalLogScale.value c k N) + +def value (rho : ℕ) (ε c : ℚ) (k A B : ℕ) (x : Input) : ℚ := + CalibratedEvaluation.scheduledValue rho (environment k A B x) + (interval ε c k x.1).1 (interval ε c k x.1).2 + +theorem interval_order {ε c : ℚ} (hε : 0 ≤ ε) (hc : 0 ≤ c) (k N : ℕ) : + (interval ε c k N).1 ≤ (interval ε c k N).2 := by + have hq : (0 : ℚ) ≤ RationalLogScale.value c k N := + mul_nonneg hc (Nat.cast_nonneg _) + dsimp only [interval, CalibrationRationalBracket.endpoints] + nlinarith [mul_nonneg hε hq] + +theorem queryBound_coefficients (k A : ℕ) (N : ℕ) {K : ℚ} + (hK : (K : ℝ) ≤ (N : ℝ) ^ A) : (K : ℝ) ≤ queryBound k A N := by + have hcast : (N : ℝ) ^ A ≤ (queryBound k A N : ℝ) := by + exact_mod_cast (show N ^ A ≤ queryBound k A N by unfold queryBound; omega) + exact hK.trans hcast + +theorem interval_query_bound {ε c : ℚ} (hε1 : ε ≤ 1) (k A N : ℕ) + (ha : (1 - (ε : ℝ)) * ((k : ℝ) * Real.log N) ≤ (interval ε c k N).1) + (hb : ((interval ε c k N).2 : ℝ) ≤ (1 + (ε : ℝ)) * ((k : ℝ) * Real.log N)) + (hN : 2 ≤ N) : + -(queryBound k A N : ℝ) ≤ (interval ε c k N).1 ∧ + ((interval ε c k N).2 : ℝ) ≤ queryBound k A N := by + have hNR : (2 : ℝ) ≤ N := by exact_mod_cast hN + have hεR1 : (ε : ℝ) ≤ 1 := by exact_mod_cast hε1 + have hlog : 0 ≤ Real.log (N : ℝ) := Real.log_nonneg (by linarith) + have hD : 0 ≤ (k : ℝ) * Real.log N := mul_nonneg (Nat.cast_nonneg _) hlog + have hlow : (0 : ℝ) ≤ (interval ε c k N).1 := + (mul_nonneg (sub_nonneg.mpr hεR1) hD).trans ha + have hupper : ((interval ε c k N).2 : ℝ) ≤ 2 * k * N := by + calc + _ ≤ (1 + (ε : ℝ)) * ((k : ℝ) * Real.log N) := hb + _ ≤ 2 * ((k : ℝ) * Real.log N) := by gcongr; linarith + _ ≤ 2 * ((k : ℝ) * N) := by + gcongr + exact Real.log_le_self (by positivity) + _ = _ := by ring + have hbound : 2 * (k : ℝ) * N ≤ (queryBound k A N : ℝ) := by + exact_mod_cast (show 2 * k * N ≤ queryBound k A N by unfold queryBound; omega) + exact ⟨(neg_nonpos.mpr (Nat.cast_nonneg _)).trans hlow, hupper.trans hbound⟩ + +theorem value_mem {ε c : ℚ} (rho k A B : ℕ) (x : Input) + (hε : 0 ≤ ε) (hc : 0 ≤ c) : + value rho ε c k A B x ∈ Set.Icc (interval ε c k x.1).1 (interval ε c k x.1).2 := + CalibratedEvaluation.scheduledValue_mem rho (environment k A B x) + (interval ε c k x.1).1 (interval ε c k x.1).2 (interval_order hε hc k x.1) + +end ContinuumCoulomb.AutomaticCalibration + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/BinaryAmplification.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/BinaryAmplification.lean new file mode 100644 index 0000000000000000000000000000000000000000..25205a0d7c3ffe8cf7185c913c552c68862a3200 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/BinaryAmplification.lean @@ -0,0 +1,97 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.ComputableAmplification +import Mathlib.Analysis.Complex.ExponentialBounds +import Mathlib.Data.Nat.Size +import Mathlib.Algebra.Order.Round +import Mathlib.Data.Rat.Floor +import Mathlib.Tactic + +namespace OAI + +/-! +# Binary charge amplification and integer rounding + +An integer within a constant factor of `exp D` has binary length linear in +`D`. Rational Taylor sums compute this scale with explicit positive-integer +charge rounding bounds. +-/ + +namespace ContinuumCoulomb + +def binaryAmplification (D : ℕ) : ℕ := taylorAmplification D + +theorem binaryAmplification_pos (D : ℕ) : 0 < binaryAmplification D := by + exact taylorAmplification_pos D + +theorem binaryAmplification_ge_scale (D : ℕ) : D + 1 ≤ binaryAmplification D := + taylorAmplification_ge_scale D + +theorem binaryAmplification_bounds (D : ℕ) : + Real.exp (D : ℝ) / 2 ≤ (binaryAmplification D : ℝ) ∧ + (binaryAmplification D : ℝ) ≤ 2 * Real.exp (D : ℝ) := by + exact taylorAmplification_bounds D + +/-- Exponentially large charges still have only linearly many binary digits. -/ +theorem binaryAmplification_bit_length (D : ℕ) : + Nat.size (binaryAmplification D) ≤ 2 * D + 2 := by + apply Nat.size_le.mpr + have hexp : Real.exp (D : ℝ) ≤ (4 : ℝ) ^ D := by + have h : Real.exp (D : ℝ) = Real.exp 1 ^ D := by + simpa only [mul_one] using Real.exp_nat_mul 1 D + rw [h] + exact pow_le_pow_left₀ (Real.exp_pos _).le + (Real.exp_one_lt_three.le.trans (by norm_num)) D + have hscale := (binaryAmplification_bounds D).2 + have hpow : (0 : ℝ) < (4 : ℝ) ^ D := by positivity + have heq : (2 : ℝ) ^ (2 * D + 2) = 4 * (4 : ℝ) ^ D := by + rw [pow_add, pow_mul] + norm_num + ring + have hbound : (binaryAmplification D : ℝ) < (2 : ℝ) ^ (2 * D + 2) := by + rw [heq] + linarith + exact_mod_cast hbound + +/-- Rational rounding used by the charge-output algorithm. -/ +def rationalRoundedScaledCharge (Z : ℕ) (q : ℚ) : ℕ := (round ((Z : ℚ) * q)).toNat + +noncomputable def roundedScaledCharge (Z : ℕ) (q : ℝ) : ℕ := + (round ((Z : ℝ) * q)).toNat + +theorem rationalRoundedScaledCharge_eq (Z : ℕ) (q : ℚ) : + rationalRoundedScaledCharge Z q = roundedScaledCharge Z (q : ℝ) := by + simp only [rationalRoundedScaledCharge, roundedScaledCharge, + ← Rat.cast_natCast (α := ℝ) Z, ← Rat.cast_mul, Rat.round_cast] + +theorem roundedScaledCharge_pos {Z : ℕ} {q : ℝ} (hscale : 1 ≤ (Z : ℝ) * q) : + 0 < roundedScaledCharge Z q := by + have h := (abs_le.mp (abs_sub_round ((Z : ℝ) * q))).2 + have hr : (0 : ℝ) < (round ((Z : ℝ) * q) : ℝ) := by linarith + have hrInt : (0 : ℤ) < round ((Z : ℝ) * q) := by exact_mod_cast hr + exact Int.pos_iff_toNat_pos.mp hrInt + +/-- Rounding the physical charge first incurs only inverse-amplification +error in the dilated one-particle potential. -/ +theorem roundedScaledCharge_error {Z : ℕ} (hZ : 0 < Z) {q : ℝ} + (hscale : 1 ≤ (Z : ℝ) * q) : + |(roundedScaledCharge Z q : ℝ) / (Z : ℝ) - q| ≤ 1 / (2 * (Z : ℝ)) := by + have hz : (0 : ℝ) < Z := by exact_mod_cast hZ + have hr : (0 : ℤ) ≤ round ((Z : ℝ) * q) := by + have h := (abs_le.mp (abs_sub_round ((Z : ℝ) * q))).2 + have hreal : (0 : ℝ) ≤ (round ((Z : ℝ) * q) : ℝ) := by linarith + exact_mod_cast hreal + have hcast : (roundedScaledCharge Z q : ℝ) = (round ((Z : ℝ) * q) : ℝ) := by + exact_mod_cast Int.toNat_of_nonneg hr + have heq : (roundedScaledCharge Z q : ℝ) / (Z : ℝ) - q = + ((round ((Z : ℝ) * q) : ℝ) - (Z : ℝ) * q) / (Z : ℝ) := by + rw [hcast] + field_simp + rw [heq, abs_div, abs_of_pos hz] + have h : |(round ((Z : ℝ) * q) : ℝ) - (Z : ℝ) * q| ≤ (1 / 2 : ℝ) := by + simpa only [abs_sub_comm] using abs_sub_round ((Z : ℝ) * q) + have hdiv := div_le_div_of_nonneg_right h hz.le + convert hdiv using 1 + ring + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/BinaryEncoding.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/BinaryEncoding.lean new file mode 100644 index 0000000000000000000000000000000000000000..d261897c009a38af48b2f6c7d6b90d0b1f7f3c8c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/BinaryEncoding.lean @@ -0,0 +1,158 @@ +import Mathlib.Data.Nat.Size +import Mathlib.Data.List.Basic +import Mathlib.Tactic + +namespace OAI + +/-! Explicit prefix-free binary encodings for finite source and circuit data. +Natural numbers use their binary digits, with one marker bit per digit. +Pairs concatenate; lists have a binary length header. In particular, list +serialization does not repeatedly pair large natural-number codes. -/ + +namespace ContinuumCoulomb +namespace BinaryEncoding + +abbrev BitString := List Bool + +structure Codec (α : Type*) where + encode : α → BitString + read : BitString → α × BitString + read_encode : ∀ x tail, read (encode x ++ tail) = (x, tail) + +theorem Codec.encode_injective {α : Type*} (c : Codec α) : Function.Injective c.encode := by + intro x y h + have hread := congrArg c.read (congrArg (fun s => s ++ []) h) + rw [c.read_encode, c.read_encode] at hread + exact congrArg Prod.fst hread + +def encodeDigits : BitString → BitString + | [] => [false] + | b :: bs => true :: b :: encodeDigits bs + +def readDigits : BitString → BitString × BitString + | true :: b :: bs => let (digits, tail) := readDigits bs; (b :: digits, tail) + | false :: bs => ([], bs) + | _ => ([], []) + +theorem readDigits_encode (digits tail : BitString) : + readDigits (encodeDigits digits ++ tail) = (digits, tail) := by + induction digits with + | nil => rfl + | cons b digits ih => simp only [encodeDigits, List.cons_append, readDigits, ih] + +def decodeDigits : BitString → ℕ + | [] => 0 + | b :: bs => Nat.bit b (decodeDigits bs) + +theorem decodeDigits_bits (n : ℕ) : decodeDigits n.bits = n := by + induction n using Nat.binaryRec' with + | zero => rfl + | bit b n h ih => simp only [Nat.bits_append_bit n b h, decodeDigits, ih] + +def natural : Codec ℕ where + encode n := encodeDigits n.bits + read s := let (digits, tail) := readDigits s; (decodeDigits digits, tail) + read_encode n tail := by simp only [readDigits_encode, decodeDigits_bits] + +theorem encodeDigits_length (digits : BitString) : + (encodeDigits digits).length = 2 * digits.length + 1 := by + induction digits with + | nil => rfl + | cons b digits ih => simp only [encodeDigits, List.length_cons, ih]; omega + +/-- The code of a natural has linear overhead in its binary bit length. -/ +theorem natural_length (n : ℕ) : (natural.encode n).length = 2 * n.size + 1 := by + change (encodeDigits n.bits).length = _ + rw [encodeDigits_length, Nat.size_eq_bits_len] + +/-- Unary electron counts use one true bit per electron and a false terminator. -/ +def encodeUnary : ℕ → BitString + | 0 => [false] + | n + 1 => true :: encodeUnary n + +def readUnary : BitString → ℕ × BitString + | true :: s => let (n, tail) := readUnary s; (n + 1, tail) + | false :: s => (0, s) + | [] => (0, []) + +theorem readUnary_encode (n : ℕ) (tail : BitString) : + readUnary (encodeUnary n ++ tail) = (n, tail) := by + induction n with + | zero => rfl + | succ n ih => simp only [encodeUnary, List.cons_append, readUnary, ih] + +def unary : Codec ℕ where + encode := encodeUnary + read := readUnary + read_encode := readUnary_encode + +theorem unary_length (n : ℕ) : (unary.encode n).length = n + 1 := by + change (encodeUnary n).length = n + 1 + induction n with + | zero => rfl + | succ n ih => simp only [encodeUnary, List.length_cons, ih] + +def integer : Codec ℤ where + encode + | Int.ofNat n => false :: natural.encode n + | Int.negSucc n => true :: natural.encode n + read + | false :: s => let (n, tail) := natural.read s; (Int.ofNat n, tail) + | true :: s => let (n, tail) := natural.read s; (Int.negSucc n, tail) + | [] => (0, []) + read_encode z tail := by + cases z <;> simp only [List.cons_append, natural.read_encode] + +def pair {α β : Type*} (a : Codec α) (b : Codec β) : Codec (α × β) where + encode x := a.encode x.1 ++ b.encode x.2 + read s := let (x, t) := a.read s; let (y, u) := b.read t; ((x, y), u) + read_encode x tail := by + rcases x with ⟨x, y⟩ + simp only [List.append_assoc, a.read_encode, b.read_encode] + +def readCount {α : Type*} (a : Codec α) : ℕ → BitString → List α × BitString + | 0, s => ([], s) + | n + 1, s => let (x, t) := a.read s; let (xs, u) := readCount a n t; (x :: xs, u) + +theorem readCount_encode {α : Type*} (a : Codec α) (xs : List α) (tail : BitString) : + readCount a xs.length (xs.flatMap a.encode ++ tail) = (xs, tail) := by + induction xs with + | nil => rfl + | cons x xs ih => + simp only [List.length_cons, List.flatMap_cons, List.append_assoc, readCount, a.read_encode, ih] + +def list {α : Type*} (a : Codec α) : Codec (List α) where + encode xs := natural.encode xs.length ++ xs.flatMap a.encode + read s := let (n, t) := natural.read s; readCount a n t + read_encode xs tail := by + simp only [List.append_assoc, natural.read_encode, readCount_encode] + +def equiv {α β : Type*} (a : Codec α) (e : β ≃ α) : Codec β where + encode x := a.encode (e x) + read s := let (x, t) := a.read s; (e.symm x, t) + read_encode x tail := by simp only [a.read_encode, e.symm_apply_apply] + +def sum {α β : Type*} (a : Codec α) (b : Codec β) : Codec (α ⊕ β) where + encode + | Sum.inl x => false :: a.encode x + | Sum.inr y => true :: b.encode y + read + | false :: s => let (x, t) := a.read s; (Sum.inl x, t) + | true :: s => let (y, t) := b.read s; (Sum.inr y, t) + | [] => let (x, t) := a.read []; (Sum.inl x, t) + read_encode x tail := by + cases x <;> simp only [List.cons_append, a.read_encode, b.read_encode] + +theorem pair_length {α β : Type*} (a : Codec α) (b : Codec β) (x : α × β) : + ((pair a b).encode x).length = (a.encode x.1).length + (b.encode x.2).length := + List.length_append + +theorem list_length {α : Type*} (a : Codec α) (xs : List α) : + ((list a).encode xs).length = 2 * xs.length.size + 1 + + (xs.map (fun x => (a.encode x).length)).sum := by + simp only [list, List.length_append, natural_length, List.length_flatMap] + +end BinaryEncoding +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/BinaryWellCharges.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/BinaryWellCharges.lean new file mode 100644 index 0000000000000000000000000000000000000000..c05cde63a4c00d29e9cbc3bc904ebe9e0ae132b3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/BinaryWellCharges.lean @@ -0,0 +1,158 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.BinaryAmplification +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.IsolatedPerturbation + +namespace OAI + +/-! +# The actual rounded binary-well charges + +The integer charges are fixed before the secondary displacement is tuned. +Their normalized values satisfy explicit uniform smallness bounds, and their +binary lengths remain linear in the geometric scale. This is analytic and +encoding-size correctness. The charges themselves are computed by rational +arithmetic. The isolated-energy tuning algorithm is separate. +-/ + +open MeasureTheory +open scoped BigOperators +namespace ContinuumCoulomb + +def binaryPrimaryCharge (D m : ℕ) : ℕ := + rationalRoundedScaledCharge (binaryAmplification D) (1 - 500 * m / (D : ℚ)) + +def binarySecondaryCharge (D m : ℕ) : ℕ := + rationalRoundedScaledCharge (binaryAmplification D) (1000 * m / (D : ℚ)) + +noncomputable section + +theorem binaryPrimaryCharge_eq (D m : ℕ) : binaryPrimaryCharge D m = + roundedScaledCharge (binaryAmplification D) (1 - 500 * m / (D : ℝ)) := by + simp only [binaryPrimaryCharge, rationalRoundedScaledCharge_eq, Rat.cast_sub, + Rat.cast_one, Rat.cast_div, Rat.cast_mul, Rat.cast_ofNat, Rat.cast_natCast] + +theorem binarySecondaryCharge_eq (D m : ℕ) : binarySecondaryCharge D m = + roundedScaledCharge (binaryAmplification D) (1000 * m / (D : ℝ)) := by + simp only [binarySecondaryCharge, rationalRoundedScaledCharge_eq, + Rat.cast_div, Rat.cast_mul, Rat.cast_ofNat, Rat.cast_natCast] + +def binaryPrimaryRatio (D m : ℕ) : ℝ := + (binaryPrimaryCharge D m : ℝ) / binaryAmplification D + +def binarySecondaryRatio (D m : ℕ) : ℝ := + (binarySecondaryCharge D m : ℝ) / binaryAmplification D + +theorem binaryWellCharges_spec {D m : ℕ} (hm : 0 < m) (hscale : 2002 * m ≤ D) : + 0 < binaryPrimaryCharge D m ∧ 0 < binarySecondaryCharge D m ∧ + 0 ≤ binaryPrimaryRatio D m ∧ binaryPrimaryRatio D m ≤ 1 ∧ + |1 - binaryPrimaryRatio D m| ≤ 501 * m / (D : ℝ) ∧ + 999 * m / (D : ℝ) ≤ binarySecondaryRatio D m ∧ + binarySecondaryRatio D m ≤ 1001 * m / (D : ℝ) ∧ + binarySecondaryRatio D m ≤ 1 := by + let Z : ℝ := binaryAmplification D + let r : ℝ := m / (D : ℝ) + have hm1 : (1 : ℝ) ≤ m := by exact_mod_cast hm + have hDlarge : (2002 : ℝ) * m ≤ D := by exact_mod_cast hscale + have hD : (0 : ℝ) < D := by linarith + have hZpos : 0 < Z := by + change (0 : ℝ) < binaryAmplification D + exact_mod_cast binaryAmplification_pos D + have hZlarge : (D : ℝ) + 1 ≤ Z := by + change (D : ℝ) + 1 ≤ (binaryAmplification D : ℝ) + exact_mod_cast binaryAmplification_ge_scale D + have hrpos : 0 ≤ r := by dsimp [r]; positivity + have hrsmall : r ≤ 1 / 2002 := by + dsimp [r] + apply (div_le_iff₀ hD).mpr + linarith + have hZr : 1 ≤ Z * r := by + have h := mul_le_mul_of_nonneg_right (show (D : ℝ) ≤ Z by linarith) hrpos + have heq : (D : ℝ) * r = m := by dsimp [r]; field_simp + rw [heq] at h + linarith + have hpbase : 1 / 2 ≤ 1 - 500 * r := by linarith + have hp : 1 ≤ Z * (1 - 500 * r) := by + have hZ2 : 2 ≤ Z := by linarith + calc + (1 : ℝ) = 2 * (1 / 2) := by norm_num + _ ≤ Z * (1 - 500 * r) := mul_le_mul hZ2 hpbase (by norm_num) hZpos.le + have hs : 1 ≤ Z * (1000 * r) := by nlinarith + have hp' : 1 ≤ (binaryAmplification D : ℝ) * (1 - 500 * m / (D : ℝ)) := by + simpa only [Z, r, mul_div_assoc] using hp + have hs' : 1 ≤ (binaryAmplification D : ℝ) * (1000 * m / (D : ℝ)) := by + simpa only [Z, r, mul_div_assoc] using hs + have hchargep := roundedScaledCharge_pos hp' + have hcharges := roundedScaledCharge_pos hs' + rw [← binaryPrimaryCharge_eq] at hchargep + rw [← binarySecondaryCharge_eq] at hcharges + have herror : 1 / (2 * Z) ≤ r := by + apply (div_le_iff₀ (by positivity : 0 < 2 * Z)).mpr + nlinarith + have hep := (roundedScaledCharge_error (binaryAmplification_pos D) hp').trans herror + have hes := (roundedScaledCharge_error (binaryAmplification_pos D) hs').trans herror + rw [← binaryPrimaryCharge_eq] at hep + rw [← binarySecondaryCharge_eq] at hes + change |binaryPrimaryRatio D m - (1 - 500 * m / (D : ℝ))| ≤ r at hep + change |binarySecondaryRatio D m - (1000 * m / (D : ℝ))| ≤ r at hes + have hep' : |binaryPrimaryRatio D m - (1 - 500 * r)| ≤ r := by + simpa only [r, mul_div_assoc] using hep + have hes' : |binarySecondaryRatio D m - 1000 * r| ≤ r := by + simpa only [r, mul_div_assoc] using hes + obtain ⟨hpl, hpu⟩ := abs_le.mp hep' + obtain ⟨hsl, hsu⟩ := abs_le.mp hes' + refine ⟨hchargep, hcharges, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · dsimp [binaryPrimaryRatio] + positivity + · linarith + · rw [show (501 : ℝ) * m / D = 501 * r by dsimp [r]; ring] + apply abs_le.mpr + constructor <;> linarith + · rw [show (999 : ℝ) * m / D = 999 * r by dsimp [r]; ring] + linarith + · rw [show (1001 : ℝ) * m / D = 1001 * r by dsimp [r]; ring] + linarith + · linarith + +theorem binaryWellCharges_bit_length {D m : ℕ} (hm : 0 < m) (hscale : 2002 * m ≤ D) : + Nat.size (binaryPrimaryCharge D m) ≤ 2 * D + 2 ∧ + Nat.size (binarySecondaryCharge D m) ≤ 2 * D + 2 := by + have h := binaryWellCharges_spec hm hscale + have hZ : (0 : ℝ) < binaryAmplification D := by exact_mod_cast binaryAmplification_pos D + have hp : binaryPrimaryCharge D m ≤ binaryAmplification D := by + have hr : (binaryPrimaryCharge D m : ℝ) ≤ binaryAmplification D := + (div_le_one hZ).mp h.2.2.2.1 + exact_mod_cast hr + have hs : binarySecondaryCharge D m ≤ binaryAmplification D := by + have hr : (binarySecondaryCharge D m : ℝ) ≤ binaryAmplification D := + (div_le_one hZ).mp h.2.2.2.2.2.2.2 + exact_mod_cast hr + exact ⟨(Nat.size_le_size hp).trans (binaryAmplification_bit_length D), + (Nat.size_le_size hs).trans (binaryAmplification_bit_length D)⟩ + +/-- Integer rounding of both actual physical charges preserves the +isolated-well operator estimate uniformly throughout displacement tuning. -/ +theorem binary_isolatedPerturbation_bound {D m : ℕ} (hm : 0 < m) + (hscale : 2002 * m ≤ D) (center displacement : Fin m → Position) + (hdisp : ∀ j, ‖displacement j‖ ≤ 4) (site : Fin m) (state : Coulomb.H1Vector 1) : + (∑ spin, ∫ x, ‖(isolatedPerturbation (D : ℝ) (binaryPrimaryRatio D m) + (binarySecondaryRatio D m) center displacement site (Coulomb.position x 0) : ℂ) * + state.value spin x‖ ^ 2) ≤ + 48 * (1001 * m / (D : ℝ)) ^ 2 * (Coulomb.kinetic state + Coulomb.mass state) := by + have h := binaryWellCharges_spec hm hscale + have hm1 : (1 : ℝ) ≤ m := by exact_mod_cast hm + have hDlarge : (2002 : ℝ) * m ≤ D := by exact_mod_cast hscale + have hD : (0 : ℝ) < D := by linarith + have hr : 0 ≤ (m : ℝ) / D := by positivity + have hs0 : 0 ≤ binarySecondaryRatio D m := + (by positivity : (0 : ℝ) ≤ 999 * m / D).trans h.2.2.2.2.2.1 + apply isolatedPerturbation_small_norm_bound (by linarith : (128 : ℝ) ≤ D) + h.2.2.1 h.2.2.2.1 hs0 h.2.2.2.2.2.2.2 + (h.2.2.2.2.1.trans _) h.2.2.2.2.2.2.1 _ center displacement hdisp site state + · simpa only [mul_div_assoc] using + mul_le_mul_of_nonneg_right (by norm_num : (501 : ℝ) ≤ 1001) hr + · simpa only [mul_div_assoc] using + mul_le_mul_of_nonneg_right (by norm_num : (48 : ℝ) ≤ 1001) hr + +end +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/CompatibleSlabMesh.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/CompatibleSlabMesh.lean new file mode 100644 index 0000000000000000000000000000000000000000..3d2e606d679ba9da8a14d5b2a11a3cfd26bf9c1e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/CompatibleSlabMesh.lean @@ -0,0 +1,66 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Nuclei.SlabHighAspectRatio +import OAI.MathematicalPhysics.ContinuumCoulomb.ManyBody.FiniteBoxMatrix +import OAI.MathematicalPhysics.ContinuumCoulomb.Nuclei.NuclearMeshBalance + +namespace OAI + +/-! Compatible polynomial choices for the finite slab and nuclear mesh. +The horizontal radius may grow as the tenth power of the slab height. -/ + +noncomputable section +open MeasureTheory +namespace ContinuumCoulomb + +theorem finiteBoxOrbitalResidual_tenthPower_bound {rho T freq : ℝ} + (hrho : 0 ≤ rho) (hT : 2 ≤ T) (hfreq : 0 < freq) + (scale : ℝ) {m : ℕ} (u : Fin m → PlanarPosition) {δ : ℝ} (hδ : 0 ≤ δ) + (hcoeff : ∀ i, 0 ≤ localizedCounterterm freq u i/scale ∧ localizedCounterterm freq u i/scale ≤ δ) + (j : Fin m) : + (∫ x, finiteBoxOrbitalResidual rho (T^10) T freq scale u j x^2) ≤ + 2*(slabResidualSeventySecondBound rho freq (u j)/T^14+ + ((m:ℝ)*(δ+1)*PlanarSobolev.wellBound)^2/(T/2)^24* + (∫ x, ‖x‖^24*continuumLocalizedMode freq 0 x^2)) := by + have hT0 : 0 < T := by linarith + have hs := slabOrbitalResidual_square_integrable hrho (pow_nonneg hT0.le 10) hT0.le hfreq (u j) + obtain ⟨hw,hwb⟩ := finiteWellOrbitalResidual_square_bound hfreq hT0 scale u hδ hcoeff j + have h := integral_mono + (finiteBoxOrbitalResidual_memLp hrho (pow_nonneg hT0.le 10) hT0 hfreq scale u hδ hcoeff j).integrable_sq + ((hs.add hw).const_mul 2) (fun x => show + finiteBoxOrbitalResidual rho (T^10) T freq scale u j x^2 ≤ + 2*(slabOrbitalResidual rho (T^10) T freq (u j) x^2+ + finiteWellOrbitalResidual freq scale T u j x^2) from by + dsimp [finiteBoxOrbitalResidual] + nlinarith [sq_nonneg (slabOrbitalResidual rho (T^10) T freq (u j) x- + finiteWellOrbitalResidual freq scale T u j x)]) + rw [integral_const_mul] at h + simp only [Pi.add_apply] at h + rw [integral_add hs hw] at h + have hb := slabOrbitalResidual_tenthPower_bound hrho hT hfreq (u j) + linarith + +theorem nuclear_mesh_tenthPower_balance {R a b c q p rho : ℝ} (hR : 1 ≤ R) + (hb : 0 ≤ b) (hc : 0 ≤ c) (hrho : 0 ≤ rho) : + (8/rho)*R^30*((a*p*R^8+b*R^6+c*R^3)*(1/R^10)^4+q*(1/R^10)^2/R^12) ≤ + (8/rho)*(a*p+b+c+q)/R^2 := by + have hR0 : 0 < R := lt_of_lt_of_le zero_lt_one hR + have he : R^30*((a*p*R^8+b*R^6+c*R^3)*(1/R^10)^4+q*(1/R^10)^2/R^12) = + a*p/R^2+b/R^4+c/R^7+q/R^2 := by + field_simp [ne_of_gt hR0] + have hb' := div_le_div_of_nonneg_left hb (pow_pos hR0 2) + (pow_le_pow_right₀ hR (by decide : 2 ≤ 4)) + have hc' := div_le_div_of_nonneg_left hc (pow_pos hR0 2) + (pow_le_pow_right₀ hR (by decide : 2 ≤ 7)) + have h : R^30*((a*p*R^8+b*R^6+c*R^3)*(1/R^10)^4+q*(1/R^10)^2/R^12) ≤ + (a*p+b+c+q)/R^2 := by + rw [he] + calc + _ ≤ a*p/R^2+b/R^2+c/R^2+q/R^2 := by linarith + _ = _ := by ring + have hh := mul_le_mul_of_nonneg_left h (show 0 ≤ 8/rho by positivity) + convert hh using 1 <;> ring + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/ComputableAmplification.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/ComputableAmplification.lean new file mode 100644 index 0000000000000000000000000000000000000000..1572f6cdf8c0a3e76499993c5961ade22188bd50 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/ComputableAmplification.lean @@ -0,0 +1,117 @@ +import Mathlib.Analysis.Complex.Exponential +import Mathlib.Data.Nat.Size +import Mathlib.Tactic + +namespace OAI + +/-! +# Rational Taylor construction of the large charge scale + +Only `4D²+4` rational Taylor terms are used. The absolute exponential error +is at most one half, so rounding this explicit rational number gives the +constant-factor amplification required by the construction. No real-number +floor operation or unknown spectral quantity occurs in the algorithm. +-/ + +open scoped BigOperators +namespace ContinuumCoulomb + +def amplificationOrder (D : ℕ) : ℕ := 2 * (2 * D ^ 2 + 2) + +def amplificationTaylor (D : ℕ) : ℚ := + ∑ k ∈ Finset.range (amplificationOrder D), (D : ℚ) ^ k / (k.factorial : ℚ) + +def taylorAmplification (D : ℕ) : ℕ := Nat.ceil (amplificationTaylor D) + +private theorem amplification_factorial_bound (D : ℕ) : + 4 * D ^ amplificationOrder D ≤ (amplificationOrder D).factorial := by + let N := 2 * D ^ 2 + 2 + have hN : 2 ≤ N := by dsimp [N]; omega + have hfour : 4 ≤ 2 ^ N := by + calc + 4 = 2 ^ 2 := by norm_num + _ ≤ 2 ^ N := Nat.pow_le_pow_right (by norm_num) hN + have hpow : 2 ^ N * D ^ (2 * N) ≤ N ^ N := by + rw [pow_mul, ← mul_pow] + apply Nat.pow_le_pow_left + dsimp [N] + omega + have hfac : N ^ N ≤ (2 * N).factorial := by + have h1 : N ^ N ≤ (N + 1) ^ N := Nat.pow_le_pow_left (Nat.le_succ N) N + have h2 := Nat.mul_le_mul_right ((N + 1) ^ N) + (show 1 ≤ N.factorial from Nat.factorial_pos N) + have h3 := @Nat.factorial_mul_pow_le_factorial N N + have heq : N + N = 2 * N := by omega + rw [heq] at h3 + have h2' : (N + 1) ^ N ≤ N.factorial * (N + 1) ^ N := by + simpa only [one_mul] using h2 + exact h1.trans (h2'.trans h3) + exact (Nat.mul_le_mul_right (D ^ (2 * N)) hfour).trans (hpow.trans hfac) + +theorem amplificationTaylor_error (D : ℕ) : + |Real.exp (D : ℝ) - (amplificationTaylor D : ℝ)| ≤ 1 / 2 := by + let n := amplificationOrder D + have hn : 0 < n := by dsimp [n, amplificationOrder]; omega + have hx : ‖(D : ℂ)‖ / (n + 1 : ℕ) ≤ (1 / 2 : ℝ) := by + simp only [Complex.norm_natCast] + apply (div_le_iff₀ (by positivity : (0 : ℝ) < (n + 1 : ℕ))).mpr + dsimp [n, amplificationOrder] + push_cast + nlinarith [sq_nonneg ((D : ℝ) - 1 / 4)] + have hc := Complex.exp_bound' (x := (D : ℂ)) (n := n) hx + have hr : |Real.exp (D : ℝ) - (amplificationTaylor D : ℝ)| ≤ + (D : ℝ) ^ n / (n.factorial : ℝ) * 2 := by + simpa only [Complex.norm_natCast, ← Complex.ofReal_natCast, ← Complex.ofReal_exp, + ← Complex.ofReal_pow, ← Complex.ofReal_div, ← Complex.ofReal_sum, + ← Complex.ofReal_sub, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (show (0 : ℝ) ≤ (D : ℝ) from Nat.cast_nonneg D), + amplificationTaylor, Rat.cast_sum, Rat.cast_div, Rat.cast_pow, Rat.cast_natCast, n] using hc + have hfac : 4 * (D : ℝ) ^ n ≤ (n.factorial : ℝ) := by + exact_mod_cast amplification_factorial_bound D + have hratio : (D : ℝ) ^ n / (n.factorial : ℝ) ≤ 1 / 4 := by + apply (div_le_iff₀ (by positivity : (0 : ℝ) < n.factorial)).mpr + linarith + exact hr.trans (by linarith) + +theorem amplificationTaylor_ge_scale (D : ℕ) : (D : ℚ) + 1 ≤ amplificationTaylor D := by + have hn : 2 ≤ amplificationOrder D := by unfold amplificationOrder; omega + have h := Finset.sum_le_sum_of_subset_of_nonneg (Finset.range_mono hn) + (f := fun k => (D : ℚ) ^ k / (k.factorial : ℚ)) + (by intro k _ _; positivity) + simpa only [Finset.sum_range_succ, Finset.sum_range_zero, pow_zero, Nat.factorial_zero, + Nat.cast_one, div_one, zero_add, pow_one, Nat.factorial_one, add_comm, + amplificationTaylor] using h + +theorem taylorAmplification_ge_scale (D : ℕ) : D + 1 ≤ taylorAmplification D := by + have h : (D : ℚ) + 1 ≤ (taylorAmplification D : ℚ) := + (amplificationTaylor_ge_scale D).trans (Nat.le_ceil _) + exact_mod_cast h + +theorem taylorAmplification_pos (D : ℕ) : 0 < taylorAmplification D := by + have h := taylorAmplification_ge_scale D + omega + +theorem taylorAmplification_bounds (D : ℕ) : + Real.exp (D : ℝ) / 2 ≤ (taylorAmplification D : ℝ) ∧ + (taylorAmplification D : ℝ) ≤ 2 * Real.exp (D : ℝ) := by + have herr := abs_le.mp (amplificationTaylor_error D) + have hApos : (0 : ℚ) < amplificationTaylor D := by + have h := amplificationTaylor_ge_scale D + exact (by positivity : (0 : ℚ) < D + 1).trans_le h + have hl : (amplificationTaylor D : ℝ) ≤ (taylorAmplification D : ℝ) := by + exact_mod_cast (Nat.le_ceil (amplificationTaylor D)) + have hu : (taylorAmplification D : ℝ) ≤ (amplificationTaylor D : ℝ) + 1 := by + exact_mod_cast (Nat.ceil_lt_add_one hApos.le).le + have hexp : 1 ≤ Real.exp (D : ℝ) := Real.one_le_exp (by positivity) + constructor + · linarith + · by_cases hD : D = 0 + · subst D + norm_num [taylorAmplification, amplificationTaylor, amplificationOrder] + · have hD1 : (1 : ℝ) ≤ D := by exact_mod_cast Nat.one_le_iff_ne_zero.mpr hD + have hexp2 : 2 ≤ Real.exp (D : ℝ) := by linarith [Real.add_one_le_exp (D : ℝ)] + linarith + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/ComputableHopping.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/ComputableHopping.lean new file mode 100644 index 0000000000000000000000000000000000000000..75a3aad7d992d385299111af3c4b195cca05366d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/ComputableHopping.lean @@ -0,0 +1,111 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.HoppingProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.ContactQuotientBounds + +namespace OAI + +/-! The actual normalized hopping coefficient has a polynomial TM2 +approximation. The sole fixed guard is chosen from the already proved +positive normalization integral; it is independent of every input. -/ + +noncomputable section +open MeasureTheory +namespace ContinuumCoulomb.ComputableHopping +open ExactQuantumFactoring.BitStackProgram + +abbrev Input := HoppingSchedule.Input + +def precision (P : ℕ) : ℕ := 16 * contactNormalizationGuard ^ 2 * (P + 1) + +def argument (x : Input) : HoppingSchedule.Input := ((x.1.1, precision x.1.2), x.2) + +def approximate (x : Input) : ℚ := + HoppingSchedule.approximate (argument x) / + (2 * NormalizationSchedule.approximate (precision x.1.2)) + +theorem precision_cast (P : ℕ) : + (precision P : ℝ) = 16 * (contactNormalizationGuard : ℝ) ^ 2 * ((P : ℝ) + 1) := by + simp only [precision, Nat.cast_mul, Nat.cast_ofNat, Nat.cast_pow, Nat.cast_add, Nat.cast_one] + +theorem precision_budget (P : ℕ) : + (contactNormalizationGuard : ℝ) * ((precision P : ℝ) + 1)⁻¹ ≤ 1 ∧ + 3 * (contactNormalizationGuard : ℝ) ^ 2 * ((precision P : ℝ) + 1)⁻¹ ≤ + ((P : ℝ) + 1)⁻¹ := by + let C := (contactNormalizationGuard : ℝ) + let S := (P : ℝ) + 1 + have hC : 1 ≤ C := by + dsimp only [C] + have hc : (1 : ℕ) ≤ contactNormalizationGuard := contactNormalizationGuard_positive + exact_mod_cast hc + have hS : 1 ≤ S := by + dsimp only [S] + linarith [show (0 : ℝ) ≤ (P : ℝ) from Nat.cast_nonneg _] + have hC0 : 0 < C := by linarith + have hS0 : 0 < S := by linarith + have hC2 : C ≤ C ^ 2 := by nlinarith + have hCs : C ^ 2 ≤ C ^ 2 * S := by nlinarith [sq_nonneg C] + rw [precision_cast] + change C * (16 * C ^ 2 * S + 1)⁻¹ ≤ 1 ∧ + 3 * C ^ 2 * (16 * C ^ 2 * S + 1)⁻¹ ≤ S⁻¹ + constructor + · exact (mul_inv_le_iff₀ (by positivity)).mpr (by nlinarith) + · apply (mul_inv_le_iff₀ (by positivity)).mpr + rw [show S⁻¹ * (16 * C ^ 2 * S + 1) = (16 * C ^ 2 * S + 1) / S by ring] + exact (le_div_iff₀ hS0).mpr (by nlinarith) + +theorem approximation_error (x : Input) (hd : |(x.2 : ℝ)| ≤ (x.1.1 : ℝ)) : + |(approximate x : ℝ) - planarHopping (x.2 : ℝ)| ≤ ((x.1.2 : ℝ) + 1)⁻¹ := by + let A := ∫ r, planarResolventMode r ^ 2 + let ε := ((precision x.1.2 : ℝ) + 1)⁻¹ + have ha : 0 < A := planarResolventMode_square_integral_positive + have hC : (1 : ℝ) ≤ contactNormalizationGuard := by + have hc : (1 : ℕ) ≤ contactNormalizationGuard := contactNormalizationGuard_positive + exact_mod_cast hc + have hn := NormalizationSchedule.approximation_error (precision x.1.2) + have hb := HoppingSchedule.approximation_error (argument x) hd + have hq := contact_quotient_error hC ha contactNormalizationGuard_bound + (show 0 ≤ ε by dsimp [ε]; positivity) (precision_budget x.1.2).1 + (planarHoppingNumerator_abs_le_four (x.2 : ℝ)) hn hb + have hq' : |(approximate x : ℝ) - planarHopping (x.2 : ℝ)| ≤ + 3 * (contactNormalizationGuard : ℝ) ^ 2 * ε := by + simpa only [approximate, argument, planarHopping_eq_numerator, + Rat.cast_div, Rat.cast_mul, Rat.cast_ofNat, A, ε] using hq + exact hq'.trans (precision_budget x.1.2).2 + +noncomputable opaque precisionFactorsProgram : + Procedure unaryCode (prodCode unaryCode unaryCode) + (fun P => (16 * contactNormalizationGuard ^ 2, P + 1)) := + (Procedure.constant unaryCode unaryCode (16 * contactNormalizationGuard ^ 2)).pair + Procedure.unarySuccessor + +noncomputable opaque precisionRawProgram : Procedure unaryCode unaryCode + (fun P => (16 * contactNormalizationGuard ^ 2) * (P + 1)) := + ResolventSchedule.mulProgram.comp precisionFactorsProgram + +noncomputable opaque precisionProgram : Procedure unaryCode unaryCode precision := + precisionRawProgram.congrFun (by intro P; rfl) + +noncomputable opaque argumentProgram : + Procedure HoppingSchedule.inputCode HoppingSchedule.inputCode argument := by + let rp := Procedure.first (prodCode unaryCode unaryCode) ratCode + let r := (Procedure.first unaryCode unaryCode).comp rp + let p := (Procedure.second unaryCode unaryCode).comp rp + let d := Procedure.second (prodCode unaryCode unaryCode) ratCode + exact ((r.pair (precisionProgram.comp p)).pair d).congrFun (by intro x; rfl) + +noncomputable opaque program : Procedure HoppingSchedule.inputCode ratCode approximate := by + let rp := Procedure.first (prodCode unaryCode unaryCode) ratCode + let p := (Procedure.second unaryCode unaryCode).comp rp + let n := HoppingSchedule.program.comp argumentProgram + let a := NormalizationSchedule.program.comp (precisionProgram.comp p) + let two := Procedure.constant HoppingSchedule.inputCode ratCode (2 : ℚ) + let den := Procedure.ratMul.comp (two.pair a) + exact (Procedure.ratDiv.comp (n.pair den)).congrFun (by intro x; rfl) + +noncomputable def certificate : + Turing.TM2ComputableInPolyTime HoppingSchedule.inputCode ratCode approximate := program.toTM2 + +end ContinuumCoulomb.ComputableHopping + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/ComputableResolvent.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/ComputableResolvent.lean new file mode 100644 index 0000000000000000000000000000000000000000..198d9e0621e75b400eec02002e1d9c94ff1c280b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/ComputableResolvent.lean @@ -0,0 +1,84 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.ResolventNumericalBounds + +namespace OAI + +/-! The explicit rational machine approximates the actual planar +resolvent to inverse-polynomial accuracy. No numerical oracle occurs in +the statement or the program. -/ + +noncomputable section +namespace ContinuumCoulomb.ResolventSchedule + +theorem scheduled_error_bound (x : Input) + (hR : ‖PlanarForcingProgram.position x.2‖ ≤ (x.1.1 : ℝ)) : + RationalHeatBox.resolventErrorBound (argument x) ≤ 4 * (scale x.1.2 : ℝ)⁻¹ := by + let r := PlanarForcingProgram.position x.2 + let R := (x.1.1 : ℝ) + let Q := (scale x.1.2 : ℝ) + let N := (count x.1.1 x.1.2 : ℝ) + let w := Q - Q⁻¹ + let e := (2 ^ precision x.1.2 : ℝ)⁻¹ + have hQnat : 1 ≤ scale x.1.2 := Nat.succ_le_iff.mpr (scale_positive x.1.2) + have hQ : 1 ≤ Q := by + dsimp only [Q] + exact_mod_cast hQnat + have hQ0 : 0 < Q := by linarith + have hA : 1 ≤ R + 3 := by + have hR0 : 0 ≤ R := Nat.cast_nonneg _ + linarith + have hN : N = 4096 * (R + 3) ^ 4 * Q ^ 8 := by + dsimp only [N, R, Q, count, countPrefix] + push_cast + rfl + have hw0 : 0 ≤ w := by + have hi : Q⁻¹ ≤ 1 := (inv_le_one₀ hQ0).mpr hQ + dsimp only [w] + linarith + have hw : w ≤ Q := by + have hi : 0 ≤ Q⁻¹ := by positivity + dsimp only [w] + linarith + have he0 : 0 ≤ e := by dsimp only [e]; positivity + have he : Q ^ 2 * e ≤ Q⁻¹ := taylor_precision_bound (scale x.1.2) hQnat + have h := scalar_error_bound hA hQ hN hw0 hw + (time_constant_bound r hR hQ) (spatial_constant_bound r hR hQ) he0 he + have hid : RationalHeatBox.resolventErrorBound (argument x) = + N * (4 * planarBoxTimeConstant r Q⁻¹ * (w / N) ^ 2 + (w / N) * + (4 * (2 * planarBoxSpatialConstant r Q⁻¹ * (2 / N) + + (e + 8 / N) / (4 * Q⁻¹)))) + Q⁻¹ + Real.exp (-Q) := by + rw [RationalHeatBox.resolventErrorBound, argument_endpoint] + simp only [argument, RationalHeatBox.planeErrorBound, RationalHeatBox.spatialStep, + Rat.cast_inv, Rat.cast_natCast, Rat.cast_div, Rat.cast_sub, Rat.cast_ofNat] + rfl + rw [hid] + exact h + +theorem approximation_error (x : Input) + (hR : ‖PlanarForcingProgram.position x.2‖ ≤ (x.1.1 : ℝ)) : + |(approximate x : ℝ) - planarResolventMode (PlanarForcingProgram.position x.2)| ≤ + ((x.1.2 : ℝ) + 1)⁻¹ := by + let r := PlanarForcingProgram.position x.2 + have hQ : (0 : ℝ) < scale x.1.2 := by exact_mod_cast scale_positive x.1.2 + have hM : (RationalHeatBox.timeEndpoint (argument x) : ℝ) + + (‖PlanarForcingProgram.position (argument x).2.1.2.1‖ + 2) ^ 2 / + (4 * ((argument x).2.2.1 : ℝ)) ≤ (argument x).2.1.1.1 := by + rw [argument_endpoint] + simp only [argument, Rat.cast_inv, Rat.cast_natCast, magnitude, Nat.cast_mul, Nat.cast_pow, + Nat.cast_add, Nat.cast_ofNat] + exact magnitude_bound r hR hQ + have h := RationalHeatBox.resolvent_error (argument x) (argument_start_positive x) + (argument_step_nonnegative x) (count_positive x.1.1 x.1.2) (count_positive x.1.1 x.1.2) hM + have h' := h.trans (scheduled_error_bound x hR) + have hlast : 4 * (scale x.1.2 : ℝ)⁻¹ ≤ ((x.1.2 : ℝ) + 1)⁻¹ := by + have hp : (0 : ℝ) < (x.1.2 : ℝ) + 1 := by positivity + simp only [scale, Nat.cast_mul, Nat.cast_add, Nat.cast_one, Nat.cast_ofNat] + apply (mul_le_mul_iff_left₀ hp).mp + field_simp + norm_num + exact h'.trans hlast + +end ContinuumCoulomb.ResolventSchedule + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/ConditionalHardness.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/ConditionalHardness.lean new file mode 100644 index 0000000000000000000000000000000000000000..b4bf0e6c5e34a5c218236e1282eb652a6b0c9fc5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/ConditionalHardness.lean @@ -0,0 +1,34 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceConditionalReduction + +namespace OAI + +/-! +Continuum Coulomb hardness under explicit analytic hypotheses, for the +full spinful weak-H1 infimum and the encoded unit- and binary-charge promises. +-/ + +noncomputable section +namespace ContinuumCoulomb + +theorem conditional_unit_coulomb_qmaHard + (hcmp : PublishedCMPHardness) (hh : PublishedHydrogenBottom) + (hp : PlanarSobolev.PublishedNegativePlanarGroundGap) + (hv : PublishedVerticalOscillatorGap) (hdensity : PublishedSobolevSmoothDensity) + (hflow : PublishedC4FlowInput) : QMAHard unitCoulombCodec.encode unitCoulombPromise := by + obtain ⟨s,_hs,hsource⟩ := hcmp + obtain ⟨reduction⟩ := exists_source_unit_reduction hflow hp hv hdensity hh s + exact hsource.of_reduction reduction + +theorem conditional_binary_coulomb_qmaHard + (hcmp : PublishedCMPHardness) (hh : PublishedHydrogenBottom) + (hp : PlanarSobolev.PublishedNegativePlanarGroundGap) + (hv : PublishedVerticalOscillatorGap) (hdensity : PublishedSobolevSmoothDensity) + (hflow : PublishedC4FlowInput) : QMAHard binaryCoulombCodec.encode binaryCoulombPromise := + UnitBinaryProgram.binary_hard_of_unit + (conditional_unit_coulomb_qmaHard hcmp hh hp hv hdensity hflow) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/Dilation.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/Dilation.lean new file mode 100644 index 0000000000000000000000000000000000000000..8a692492a429b59630ac217ad1c6c819aa0af7d2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/Dilation.lean @@ -0,0 +1,360 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.Model + +namespace OAI + +/-! +# Spatial dilation on the actual weak H¹ domain + +The physical-energy amplification in both manuscripts changes coordinates +on the full fermionic form domain. Here weak derivatives are transformed +by changing variables in the compact-test identity, rather than assuming +pointwise differentiability of an arbitrary state. +-/ + +noncomputable section +open MeasureTheory +open scoped BigOperators +namespace ContinuumCoulomb + +theorem memLp_comp_dilation {n : ℕ} {f : Configuration n → ℂ} + (hf : MemLp f 2) {scale : ℝ} (hscale : scale ≠ 0) : + MemLp (fun x => f (scale • x)) 2 := by + have hm : MemLp f 2 (Measure.map (fun x => scale • x) volume) := by + rw [Measure.map_addHaar_smul volume hscale] + exact hf.smul_measure (by simp) + exact hm.comp_of_map (measurable_const_smul scale).aemeasurable + +theorem weak_partial_dilation {n : ℕ} (u g : Configuration n → ℂ) + (a : Fin n × Fin 3) {scale : ℝ} (hscale : scale ≠ 0) + (hweak : ∀ (phi : Configuration n → ℝ), ContDiff ℝ (⊤ : ℕ∞) phi → + HasCompactSupport phi → + (∫ x, u x * (fderiv ℝ phi x (EuclideanSpace.single a 1) : ℂ)) = + -(∫ x, g x * (phi x : ℂ))) + (phi : Configuration n → ℝ) (hphi : ContDiff ℝ (⊤ : ℕ∞) phi) + (hcompact : HasCompactSupport phi) : + (∫ x, u (scale • x) * (fderiv ℝ phi x (EuclideanSpace.single a 1) : ℂ)) = + -(∫ x, (scale : ℂ) * g (scale • x) * (phi x : ℂ)) := by + let test : Configuration n → ℝ := fun y => phi (scale⁻¹ • y) + have htest : ContDiff ℝ (⊤ : ℕ∞) test := by dsimp [test]; fun_prop + have hderiv (y : Configuration n) : + fderiv ℝ test y (EuclideanSpace.single a 1) = + scale⁻¹ * fderiv ℝ phi (scale⁻¹ • y) (EuclideanSpace.single a 1) := by + have hlin : HasFDerivAt (fun z : Configuration n => scale⁻¹ • z) + (scale⁻¹ • ContinuousLinearMap.id ℝ (Configuration n)) y := + (hasFDerivAt_id y).const_smul scale⁻¹ + have h := (hphi.differentiable (by simp)).differentiableAt.hasFDerivAt.comp y hlin + change fderiv ℝ (phi ∘ fun z => scale⁻¹ • z) y _ = _ + rw [h.fderiv] + simp + have hw := hweak test htest (hcompact.comp_smul (inv_ne_zero hscale)) + have hleft : (∫ y, u y * (fderiv ℝ test y (EuclideanSpace.single a 1) : ℂ)) = + (scale⁻¹ : ℂ) * ∫ y, u y * + (fderiv ℝ phi (scale⁻¹ • y) (EuclideanSpace.single a 1) : ℂ) := by + rw [← integral_const_mul] + apply integral_congr_ae + exact Filter.Eventually.of_forall fun y => by + dsimp only + rw [hderiv] + push_cast + ring + rw [hleft] at hw + have hsC : (scale : ℂ) ≠ 0 := by exact_mod_cast hscale + have hwscaled := congrArg (fun z : ℂ => (scale : ℂ) * z) hw + simp only [← mul_assoc, mul_inv_cancel₀ hsC, one_mul] at hwscaled + let jacobian : ℝ := |(scale ^ Module.finrank ℝ (Configuration n))⁻¹| + have hchangeLeft : + (∫ x, u (scale • x) * (fderiv ℝ phi x (EuclideanSpace.single a 1) : ℂ)) = + jacobian • ∫ y, u y * + (fderiv ℝ phi (scale⁻¹ • y) (EuclideanSpace.single a 1) : ℂ) := by + simpa only [inv_smul_smul₀ hscale] using Measure.integral_comp_smul volume + (fun y => u y * (fderiv ℝ phi (scale⁻¹ • y) (EuclideanSpace.single a 1) : ℂ)) scale + have hchangeRight : (∫ x, g (scale • x) * (phi x : ℂ)) = + jacobian • ∫ y, g y * (test y : ℂ) := by + simpa only [test, inv_smul_smul₀ hscale] using Measure.integral_comp_smul volume + (fun y => g y * (phi (scale⁻¹ • y) : ℂ)) scale + have hright : (∫ x, (scale : ℂ) * g (scale • x) * (phi x : ℂ)) = + (scale : ℂ) * (jacobian • ∫ y, g y * (test y : ℂ)) := by + calc + _ = (scale : ℂ) * ∫ x, g (scale • x) * (phi x : ℂ) := by + rw [← integral_const_mul] + apply integral_congr_ae + exact Filter.Eventually.of_forall fun _ => by ring + _ = _ := by rw [hchangeRight] + rw [hchangeLeft, hright, hwscaled] + simp only [Complex.real_smul] + ring + +def dilateState {n : ℕ} (state : Coulomb.H1Vector n) (scale : ℝ) (hscale : scale ≠ 0) : + Coulomb.H1Vector n where + value spin x := state.value spin (scale • x) + gradient spin a x := (scale : ℂ) * state.gradient spin a (scale • x) + value_L2 spin := memLp_comp_dilation (state.value_L2 spin) hscale + partial_L2 spin a := (memLp_comp_dilation (state.partial_L2 spin a) hscale).const_mul _ + weak_partial spin a := weak_partial_dilation (state.value spin) (state.gradient spin a) + a hscale (state.weak_partial spin a) + +theorem dilateState_antisymmetric {n : ℕ} (state : Coulomb.H1Vector n) + (hstate : Coulomb.Antisymmetric state) (scale : ℝ) (hscale : scale ≠ 0) : + Coulomb.Antisymmetric (dilateState state scale hscale) := by + intro p spin + have h := (Measure.quasiMeasurePreserving_smul volume hscale).ae (hstate p spin) + filter_upwards [h] with x hx + have hperm : Coulomb.permute p (scale • x) = scale • Coulomb.permute p x := by + ext a + rfl + simpa only [dilateState, hperm] using hx + +theorem integral_dilation {n : ℕ} (f : Configuration n → ℝ) (scale : ℝ) : + (∫ x, f (scale • x)) = + |scale ^ Module.finrank ℝ (Configuration n)|⁻¹ * ∫ x, f x := by + simpa only [abs_inv, smul_eq_mul] using + Measure.integral_comp_smul volume f scale + +theorem mass_dilateState {n : ℕ} (state : Coulomb.H1Vector n) + (scale : ℝ) (hscale : scale ≠ 0) : + Coulomb.mass (dilateState state scale hscale) = + |scale ^ Module.finrank ℝ (Configuration n)|⁻¹ * Coulomb.mass state := by + change (∑ spin, ∫ x, ‖state.value spin (scale • x)‖ ^ 2) = _ + rw [Coulomb.mass, Finset.mul_sum] + apply Finset.sum_congr rfl + intro spin _ + exact integral_dilation (fun x => ‖state.value spin x‖ ^ 2) scale + +theorem kinetic_dilateState {n : ℕ} (state : Coulomb.H1Vector n) + (scale : ℝ) (hscale : scale ≠ 0) : + Coulomb.kinetic (dilateState state scale hscale) = + scale ^ 2 * |scale ^ Module.finrank ℝ (Configuration n)|⁻¹ * + Coulomb.kinetic state := by + change (1 / 2 : ℝ) * (∑ spin, ∑ a, ∫ x, + ‖(scale : ℂ) * state.gradient spin a (scale • x)‖ ^ 2) = _ + have hI (spin : SpinConfiguration n) (a : Fin n × Fin 3) : + (∫ x, ‖state.gradient spin a (scale • x)‖ ^ 2) = + |scale ^ Module.finrank ℝ (Configuration n)|⁻¹ * + ∫ x, ‖state.gradient spin a x‖ ^ 2 := + integral_dilation (fun x => ‖state.gradient spin a x‖ ^ 2) scale + simp_rw [Coulomb.norm_real_mul_sq, integral_const_mul, hI] + simp only [← Finset.mul_sum, Coulomb.kinetic] + ring + +/-- The Jacobian factor makes spatial dilation preserve the physical norm. -/ +def normalizedDilation {n : ℕ} (state : Coulomb.H1Vector n) + (scale : ℝ) (hscale : scale ≠ 0) : Coulomb.H1Vector n := + (dilateState state scale hscale).rsmul + (Real.sqrt |scale ^ Module.finrank ℝ (Configuration n)|) + +theorem mass_normalizedDilation {n : ℕ} (state : Coulomb.H1Vector n) + (scale : ℝ) (hscale : scale ≠ 0) : + Coulomb.mass (normalizedDilation state scale hscale) = Coulomb.mass state := by + rw [normalizedDilation, Coulomb.mass_rsmul, mass_dilateState, + Real.sq_sqrt (abs_nonneg _), ← mul_assoc, + mul_inv_cancel₀ (abs_ne_zero.mpr (pow_ne_zero _ hscale)), one_mul] + +theorem kinetic_normalizedDilation {n : ℕ} (state : Coulomb.H1Vector n) + (scale : ℝ) (hscale : scale ≠ 0) : + Coulomb.kinetic (normalizedDilation state scale hscale) = + scale ^ 2 * Coulomb.kinetic state := by + rw [normalizedDilation, Coulomb.kinetic_rsmul, kinetic_dilateState, + Real.sq_sqrt (abs_nonneg _)] + have h := mul_inv_cancel₀ (abs_ne_zero.mpr + (pow_ne_zero (Module.finrank ℝ (Configuration n)) hscale)) + calc + _ = scale ^ 2 * (|scale ^ Module.finrank ℝ (Configuration n)| * + |scale ^ Module.finrank ℝ (Configuration n)|⁻¹) * Coulomb.kinetic state := by ring + _ = _ := by rw [h, mul_one] + +theorem normalizedDilation_antisymmetric {n : ℕ} (state : Coulomb.H1Vector n) + (hstate : Coulomb.Antisymmetric state) (scale : ℝ) (hscale : scale ≠ 0) : + Coulomb.Antisymmetric (normalizedDilation state scale hscale) := + (dilateState_antisymmetric state hstate scale hscale).rsmul _ + +theorem h1Vector_ext {n : ℕ} {u v : Coulomb.H1Vector n} + (hvalue : u.value = v.value) (hgradient : u.gradient = v.gradient) : u = v := by + cases u + cases v + cases hvalue + cases hgradient + rfl + +/-- Inverse dilation acts on every weak-H¹ state, so lower energy estimates +can be transferred back from the entire physical form domain. -/ +theorem normalizedDilation_inverse {n : ℕ} (state : Coulomb.H1Vector n) + (scale : ℝ) (hscale : scale ≠ 0) : + normalizedDilation (normalizedDilation state scale hscale) scale⁻¹ + (inv_ne_zero hscale) = state := by + have hroot : Real.sqrt |scale ^ Module.finrank ℝ (Configuration n)| ≠ 0 := + Real.sqrt_ne_zero'.mpr (abs_pos.mpr (pow_ne_zero _ hscale)) + have hamp : Real.sqrt |scale⁻¹ ^ Module.finrank ℝ (Configuration n)| * + Real.sqrt |scale ^ Module.finrank ℝ (Configuration n)| = 1 := by + rw [inv_pow, abs_inv, Real.sqrt_inv, inv_mul_cancel₀ hroot] + have hampC : (Real.sqrt |scale⁻¹ ^ Module.finrank ℝ (Configuration n)| : ℂ) * + (Real.sqrt |scale ^ Module.finrank ℝ (Configuration n)| : ℂ) = 1 := by + exact_mod_cast hamp + have hscaleC : (scale : ℂ) * ((scale⁻¹ : ℝ) : ℂ) = 1 := by + exact_mod_cast (mul_inv_cancel₀ hscale) + apply h1Vector_ext + · funext spin x + change (Real.sqrt |scale⁻¹ ^ Module.finrank ℝ (Configuration n)| : ℂ) * + ((Real.sqrt |scale ^ Module.finrank ℝ (Configuration n)| : ℂ) * + state.value spin (scale • scale⁻¹ • x)) = _ + rw [smul_inv_smul₀ hscale, ← mul_assoc, hampC, one_mul] + · funext spin a x + change (Real.sqrt |scale⁻¹ ^ Module.finrank ℝ (Configuration n)| : ℂ) * + (((scale⁻¹ : ℝ) : ℂ) * + ((Real.sqrt |scale ^ Module.finrank ℝ (Configuration n)| : ℂ) * + ((scale : ℂ) * state.gradient spin a (scale • scale⁻¹ • x)))) = _ + rw [smul_inv_smul₀ hscale] + calc + _ = ((Real.sqrt |scale⁻¹ ^ Module.finrank ℝ (Configuration n)| : ℂ) * + (Real.sqrt |scale ^ Module.finrank ℝ (Configuration n)| : ℂ)) * + ((scale : ℂ) * ((scale⁻¹ : ℝ) : ℂ)) * state.gradient spin a x := by ring + _ = _ := by rw [hampC, hscaleC, one_mul, one_mul] + +theorem position_smul {n : ℕ} (x : Configuration n) (i : Fin n) (scale : ℝ) : + Coulomb.position (scale • x) i = scale • Coulomb.position x i := by + ext a + rfl + +theorem coulombKernel_smul (x : Position) {scale : ℝ} (hscale : 0 < scale) : + Coulomb.coulombKernel (scale • x) = scale⁻¹ * Coulomb.coulombKernel x := by + simp only [Coulomb.coulombKernel, norm_smul, Real.norm_eq_abs, + abs_of_pos hscale, mul_inv_rev] + ring + +/-- Rescaling the nuclear positions leaves all nuclear charges unchanged. -/ +def dilatedNuclei {M : ℕ} (S : Coulomb.Nuclei M) (scale : ℝ) + (hscale : scale ≠ 0) : Coulomb.Nuclei M where + nonempty := S.nonempty + position a := scale⁻¹ • S.position a + distinct := by + intro a b hab + apply S.distinct + have h := congrArg (fun x : Position => scale • x) hab + simpa only [smul_inv_smul₀ hscale] using h + charge := S.charge + charge_ge_one := S.charge_ge_one + +theorem attraction_dilatedNuclei {M : ℕ} (S : Coulomb.Nuclei M) + {scale : ℝ} (hscale : 0 < scale) (x : Position) : + Coulomb.attraction (dilatedNuclei S scale hscale.ne') x = + scale * Coulomb.attraction S (scale • x) := by + have hpos (a : Fin M) : x - scale⁻¹ • S.position a = + scale⁻¹ • (scale • x - S.position a) := by + rw [smul_sub, inv_smul_smul₀ hscale.ne'] + simp only [Coulomb.attraction, dilatedNuclei, hpos, + coulombKernel_smul _ (inv_pos.mpr hscale), inv_inv, Finset.mul_sum] + apply Finset.sum_congr rfl + intro a _ + ring + +theorem nuclearEnergy_dilateState {M n : ℕ} (S : Coulomb.Nuclei M) + (state : Coulomb.H1Vector n) {scale : ℝ} (hscale : 0 < scale) : + Coulomb.nuclearEnergy (dilatedNuclei S scale hscale.ne') + (dilateState state scale hscale.ne') = + scale * |scale ^ Module.finrank ℝ (Configuration n)|⁻¹ * + Coulomb.nuclearEnergy S state := by + have hspin (spin : SpinConfiguration n) : + (∫ x, (∑ i, Coulomb.attraction (dilatedNuclei S scale hscale.ne') + (Coulomb.position x i)) * ‖state.value spin (scale • x)‖ ^ 2) = + scale * |scale ^ Module.finrank ℝ (Configuration n)|⁻¹ * + ∫ x, (∑ i, Coulomb.attraction S (Coulomb.position x i)) * + ‖state.value spin x‖ ^ 2 := by + simp_rw [attraction_dilatedNuclei S hscale, ← position_smul, + ← Finset.mul_sum, mul_assoc, integral_const_mul] + have hi := integral_dilation (fun x => + (∑ i, Coulomb.attraction S (Coulomb.position x i)) * + ‖state.value spin x‖ ^ 2) scale + simpa only [mul_assoc] using congrArg (fun z : ℝ => scale * z) hi + change (∑ spin, ∫ x, (∑ i, Coulomb.attraction + (dilatedNuclei S scale hscale.ne') (Coulomb.position x i)) * + ‖state.value spin (scale • x)‖ ^ 2) = _ + rw [Coulomb.nuclearEnergy, Finset.mul_sum] + apply Finset.sum_congr rfl + intro spin _ + exact hspin spin + +theorem nuclearEnergy_normalizedDilation {M n : ℕ} (S : Coulomb.Nuclei M) + (state : Coulomb.H1Vector n) {scale : ℝ} (hscale : 0 < scale) : + Coulomb.nuclearEnergy (dilatedNuclei S scale hscale.ne') + (normalizedDilation state scale hscale.ne') = + scale * Coulomb.nuclearEnergy S state := by + rw [normalizedDilation, Coulomb.nuclearEnergy_rsmul, + nuclearEnergy_dilateState S state hscale, Real.sq_sqrt (abs_nonneg _)] + have h := mul_inv_cancel₀ (abs_ne_zero.mpr + (pow_ne_zero (Module.finrank ℝ (Configuration n)) hscale.ne')) + calc + _ = scale * (|scale ^ Module.finrank ℝ (Configuration n)| * + |scale ^ Module.finrank ℝ (Configuration n)|⁻¹) * + Coulomb.nuclearEnergy S state := by ring + _ = _ := by rw [h, mul_one] + +theorem pairPotential_dilation {n : ℕ} (x : Configuration n) + {scale : ℝ} (hscale : 0 < scale) : + (∑ i : Fin n, ∑ j : Fin n, if i < j then + Coulomb.coulombKernel (Coulomb.position x i - Coulomb.position x j) else 0) = + scale * (∑ i : Fin n, ∑ j : Fin n, if i < j then + Coulomb.coulombKernel (Coulomb.position (scale • x) i - + Coulomb.position (scale • x) j) else 0) := by + simp only [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + split_ifs with hij + · rw [position_smul, position_smul, ← smul_sub, coulombKernel_smul _ hscale] + rw [← mul_assoc, mul_inv_cancel₀ hscale.ne', one_mul] + · exact (mul_zero _).symm + +theorem pairEnergy_dilateState {n : ℕ} (state : Coulomb.H1Vector n) + {scale : ℝ} (hscale : 0 < scale) : + Coulomb.pairEnergy (dilateState state scale hscale.ne') = + scale * |scale ^ Module.finrank ℝ (Configuration n)|⁻¹ * + Coulomb.pairEnergy state := by + have hspin (spin : SpinConfiguration n) : + (∫ x, (∑ i : Fin n, ∑ j : Fin n, if i < j then + Coulomb.coulombKernel (Coulomb.position x i - Coulomb.position x j) else 0) * + ‖state.value spin (scale • x)‖ ^ 2) = + scale * |scale ^ Module.finrank ℝ (Configuration n)|⁻¹ * + ∫ x, (∑ i : Fin n, ∑ j : Fin n, if i < j then + Coulomb.coulombKernel (Coulomb.position x i - Coulomb.position x j) else 0) * + ‖state.value spin x‖ ^ 2 := by + conv_lhs => enter [2, x, 1]; rw [pairPotential_dilation x hscale] + simp_rw [mul_assoc, integral_const_mul] + have hi := integral_dilation (fun x => + (∑ i : Fin n, ∑ j : Fin n, if i < j then + Coulomb.coulombKernel (Coulomb.position x i - Coulomb.position x j) else 0) * + ‖state.value spin x‖ ^ 2) scale + simpa only [mul_assoc] using congrArg (fun z : ℝ => scale * z) hi + change (∑ spin, ∫ x, _ * ‖state.value spin (scale • x)‖ ^ 2) = _ + simp_rw [hspin] + exact (Finset.mul_sum _ _ _).symm + +theorem pairEnergy_normalizedDilation {n : ℕ} (state : Coulomb.H1Vector n) + {scale : ℝ} (hscale : 0 < scale) : + Coulomb.pairEnergy (normalizedDilation state scale hscale.ne') = + scale * Coulomb.pairEnergy state := by + rw [normalizedDilation, Coulomb.pairEnergy_rsmul, + pairEnergy_dilateState state hscale, Real.sq_sqrt (abs_nonneg _)] + have h := mul_inv_cancel₀ (abs_ne_zero.mpr + (pow_ne_zero (Module.finrank ℝ (Configuration n)) hscale.ne')) + calc + _ = scale * (|scale ^ Module.finrank ℝ (Configuration n)| * + |scale ^ Module.finrank ℝ (Configuration n)|⁻¹) * Coulomb.pairEnergy state := by ring + _ = _ := by rw [h, mul_one] + +/-- Full electronic form under physical coordinate scaling; no projected +sector or differentiability beyond weak H¹ is used. -/ +theorem form_normalizedDilation {M n : ℕ} (S : Coulomb.Nuclei M) + (state : Coulomb.H1Vector n) {scale : ℝ} (hscale : 0 < scale) : + Coulomb.form (dilatedNuclei S scale hscale.ne') + (normalizedDilation state scale hscale.ne') = + scale ^ 2 * Coulomb.kinetic state - scale * Coulomb.nuclearEnergy S state + + scale * Coulomb.pairEnergy state := by + rw [Coulomb.form, kinetic_normalizedDilation, + nuclearEnergy_normalizedDilation S state hscale, + pairEnergy_normalizedDilation state hscale] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/FormStability.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/FormStability.lean new file mode 100644 index 0000000000000000000000000000000000000000..3b2a804fb893961db4c6b7c3e9effe444d796c1c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/FormStability.lean @@ -0,0 +1,238 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.Model +import OAI.MathematicalPhysics.ContinuumCoulomb.Nuclei.NuclearRounding + +namespace OAI + +/-! +# Stability of the full variational bottom under nuclear rounding + +The Hardy estimate is combined with coercivity of the actual Coulomb form. +Consequently rational rounding is controlled on the unrestricted fermionic +ground-energy infimum, without assuming a minimizing eigenvector or an +independent kinetic-energy bound. +-/ + +noncomputable section +open MeasureTheory +open scoped BigOperators + +namespace ContinuumCoulomb + +/-- Keeping half of the kinetic form gives a uniform coercive lower bound. -/ +theorem coulomb_form_coercive {m n : ℕ} (S : Coulomb.Nuclei m) + (state : Coulomb.H1Vector n) : + Coulomb.kinetic state / 2 - + 4 * (n : ℝ) * Coulomb.totalCharge S ^ 2 * Coulomb.mass state ≤ + Coulomb.form S state := by + let eta : ℝ := 1 / (16 * Coulomb.totalCharge S) + have hZ := Coulomb.totalCharge_pos S + have heta : 0 < eta := by dsimp [eta]; positivity + have h := Coulomb.nuclearEnergy_bound S state heta + have hfactor : 8 * eta * Coulomb.totalCharge S = 1 / 2 := by + dsimp [eta] + field_simp + norm_num + have hconstant : (n : ℝ) * Coulomb.totalCharge S / (4 * eta) = + 4 * (n : ℝ) * Coulomb.totalCharge S ^ 2 := by + dsimp [eta] + field_simp + ring + rw [hfactor, hconstant] at h + have hpair := Coulomb.pairEnergy_nonneg state + unfold Coulomb.form + linarith + +/-- The rounding estimate includes arbitrary positive nuclear charges, with +their total mass rather than their maximum charge in the error budget. -/ +theorem coulomb_form_position_error {m n : ℕ} (S T : Coulomb.Nuclei m) + (state : Coulomb.H1Vector n) {delta : ℝ} + (hcharge : S.charge = T.charge) + (hmove : ∀ a, ‖S.position a - T.position a‖ ≤ delta) : + |Coulomb.form S state - Coulomb.form T state| ≤ + 16 * delta * Coulomb.totalCharge S * Coulomb.kinetic state := by + let I := fun (R : Coulomb.Nuclei m) (s : Coulomb.Spins n) (i : Fin n) (a : Fin m) => + ∫ x, Coulomb.coulombKernel (Coulomb.position x i - R.position a) * + ‖state.value s x‖ ^ 2 + let G := fun (s : Coulomb.Spins n) (i : Fin n) => + ∑ k : Fin 3, ∫ x, ‖state.gradient s (i, k) x‖ ^ 2 + have hG : ∀ s i, 0 ≤ G s i := by + intro s i + exact Finset.sum_nonneg fun k _ => integral_nonneg fun x => sq_nonneg _ + have hI (R : Coulomb.Nuclei m) (s : Coulomb.Spins n) (i : Fin n) (a : Fin m) : + Integrable (fun x => Coulomb.coulombKernel (Coulomb.position x i - R.position a) * + ‖state.value s x‖ ^ 2) := + (state.nuclear_coulomb_integrable_bound s i (R.position a) + (by norm_num : (0 : ℝ) < 1)).1 + have hdiff (s : Coulomb.Spins n) (i : Fin n) (a : Fin m) : + I S s i a - I T s i a = ∫ x, + (Coulomb.coulombKernel (Coulomb.position x i - S.position a) - + Coulomb.coulombKernel (Coulomb.position x i - T.position a)) * + ‖state.value s x‖ ^ 2 := by + simp only [sub_mul, integral_sub (hI S s i a) (hI T s i a), I] + have hterm (s : Coulomb.Spins n) (i : Fin n) (a : Fin m) : + |S.charge a * (I S s i a - I T s i a)| ≤ + S.charge a * (8 * delta * G s i) := by + have hz : 0 ≤ S.charge a := (by norm_num : (0 : ℝ) ≤ 1).trans (S.charge_ge_one a) + rw [abs_mul, abs_of_nonneg hz, hdiff] + apply mul_le_mul_of_nonneg_left _ hz + exact (nuclear_position_rounding_bound state s i (S.position a) (T.position a)).trans + (mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_left (hmove a) (by norm_num)) (hG s i)) + have hnuclear : Coulomb.nuclearEnergy S state - Coulomb.nuclearEnergy T state = + ∑ s, ∑ i, ∑ a, S.charge a * (I S s i a - I T s i a) := by + rw [Coulomb.nuclearEnergy_eq_sum, Coulomb.nuclearEnergy_eq_sum, ← hcharge] + simp only [← Finset.sum_sub_distrib, ← mul_sub, I] + have hsum : |Coulomb.nuclearEnergy S state - Coulomb.nuclearEnergy T state| ≤ + ∑ s, ∑ i, ∑ a, S.charge a * (8 * delta * G s i) := by + rw [hnuclear] + apply (Finset.abs_sum_le_sum_abs _ _).trans + apply Finset.sum_le_sum + intro s _ + apply (Finset.abs_sum_le_sum_abs _ _).trans + apply Finset.sum_le_sum + intro i _ + exact (Finset.abs_sum_le_sum_abs _ _).trans + (Finset.sum_le_sum fun a _ => hterm s i a) + have htotal : (∑ s, ∑ i, ∑ a, S.charge a * (8 * delta * G s i)) = + 16 * delta * Coulomb.totalCharge S * Coulomb.kinetic state := by + simp only [← Finset.sum_mul] + unfold G Coulomb.kinetic Coulomb.totalCharge + simp only [Fintype.sum_prod_type, ← Finset.mul_sum] + ring + have heq : Coulomb.form S state - Coulomb.form T state = + -(Coulomb.nuclearEnergy S state - Coulomb.nuclearEnergy T state) := by + unfold Coulomb.form + ring + rw [heq, abs_neg] + exact hsum.trans_eq htotal + +/-- The same full fermionic bottom for real positions, prior to rationalization. -/ +def formGroundEnergy {m : ℕ} (S : Coulomb.Nuclei m) (n : ℕ) : EReal := + sInf {e | ∃ state : FormState n, + normSq state = 1 ∧ e = (Coulomb.form S state.val : EReal)} + +theorem groundEnergy_eq_formGroundEnergy (d : NuclearData) : + groundEnergy d = formGroundEnergy d.toNuclei d.electrons := rfl + +theorem formGroundEnergy_le_trial {m n : ℕ} (S : Coulomb.Nuclei m) + (state : FormState n) (hnorm : normSq state = 1) : + formGroundEnergy S n ≤ (Coulomb.form S state.val : EReal) := + sInf_le ⟨state, hnorm, rfl⟩ + +theorem formGroundEnergy_lower_of_forall {m n : ℕ} (S : Coulomb.Nuclei m) (a : ℝ) + (ha : ∀ state : FormState n, normSq state = 1 → a ≤ Coulomb.form S state.val) : + (a : EReal) ≤ formGroundEnergy S n := by + apply le_sInf + rintro e ⟨state, hnorm, rfl⟩ + exact EReal.coe_le_coe (ha state hnorm) + +theorem formGroundEnergy_finite {m n : ℕ} (S : Coulomb.Nuclei m) + (trial : FormState n) (htrial : normSq trial = 1) : + formGroundEnergy S n ≠ ⊤ ∧ formGroundEnergy S n ≠ ⊥ := by + constructor + · exact ne_of_lt ((formGroundEnergy_le_trial S trial htrial).trans_lt (EReal.coe_lt_top _)) + · apply ne_of_gt + apply (EReal.bot_lt_coe (-(2 * (n : ℝ) * Coulomb.totalCharge S ^ 2))).trans_le + apply formGroundEnergy_lower_of_forall + intro state hnorm + have h := Coulomb.form_lower_bound S state.val + change _ * normSq state ≤ _ at h + simpa only [hnorm, mul_one] using h + +/-- A quantitative change of the full bottom under nuclear movement. The +single normalized trial proves both bottoms finite; it need not minimize. +The factor in parentheses is automatically nonnegative by coercivity. -/ +theorem formGroundEnergy_position_stability {m n : ℕ} (S T : Coulomb.Nuclei m) + (trial : FormState n) (htrial : normSq trial = 1) {delta : ℝ} + (hdelta : 0 ≤ delta) (hcharge : S.charge = T.charge) + (hmove : ∀ a, ‖S.position a - T.position a‖ ≤ delta) + (hsmall : 32 * delta * Coulomb.totalCharge S ≤ 1) : + |(formGroundEnergy T n).toReal - (formGroundEnergy S n).toReal| ≤ + 32 * delta * Coulomb.totalCharge S * + ((formGroundEnergy S n).toReal + 4 * (n : ℝ) * Coulomb.totalCharge S ^ 2) := by + let theta : ℝ := 16 * delta * Coulomb.totalCharge S + let C : ℝ := 4 * (n : ℝ) * Coulomb.totalCharge S ^ 2 + let E : ℝ := (formGroundEnergy S n).toReal + let F : ℝ := (formGroundEnergy T n).toReal + have htheta : 0 ≤ theta := by + dsimp [theta] + exact mul_nonneg (mul_nonneg (by norm_num) hdelta) (Coulomb.totalCharge_pos S).le + have hslower : 0 ≤ 1 - 2 * theta := by dsimp [theta]; nlinarith + have hsupper : 0 < 1 + 2 * theta := by linarith + have hEcoe : (E : EReal) = formGroundEnergy S n := + EReal.coe_toReal (formGroundEnergy_finite S trial htrial).1 + (formGroundEnergy_finite S trial htrial).2 + have hFcoe : (F : EReal) = formGroundEnergy T n := + EReal.coe_toReal (formGroundEnergy_finite T trial htrial).1 + (formGroundEnergy_finite T trial htrial).2 + have hEtrial (u : FormState n) (hu : normSq u = 1) : E ≤ Coulomb.form S u.val := by + apply EReal.coe_le_coe_iff.mp + rw [hEcoe] + exact formGroundEnergy_le_trial S u hu + have hFtrial (u : FormState n) (hu : normSq u = 1) : F ≤ Coulomb.form T u.val := by + apply EReal.coe_le_coe_iff.mp + rw [hFcoe] + exact formGroundEnergy_le_trial T u hu + have hpoint (u : FormState n) (hu : normSq u = 1) : + (1 - 2 * theta) * Coulomb.form S u.val - 2 * theta * C ≤ Coulomb.form T u.val ∧ + Coulomb.form T u.val ≤ (1 + 2 * theta) * Coulomb.form S u.val + 2 * theta * C := by + have hcoercive := coulomb_form_coercive S u.val + change Coulomb.kinetic u.val / 2 - C * normSq u ≤ Coulomb.form S u.val at hcoercive + rw [hu, mul_one] at hcoercive + have hk := mul_le_mul_of_nonneg_left hcoercive (mul_nonneg (by norm_num : (0 : ℝ) ≤ 2) htheta) + have he := coulomb_form_position_error S T u.val hcharge hmove + change |Coulomb.form S u.val - Coulomb.form T u.val| ≤ theta * Coulomb.kinetic u.val at he + obtain ⟨hl, hr⟩ := abs_le.mp he + constructor <;> nlinarith + have hlower : (1 - 2 * theta) * E - 2 * theta * C ≤ F := by + apply EReal.coe_le_coe_iff.mp + rw [hFcoe] + apply formGroundEnergy_lower_of_forall + intro u hu + have h := mul_le_mul_of_nonneg_left (hEtrial u hu) hslower + have hp := (hpoint u hu).1 + linarith + have hupper : F ≤ (1 + 2 * theta) * E + 2 * theta * C := by + have haux : (F - 2 * theta * C) / (1 + 2 * theta) ≤ E := by + apply EReal.coe_le_coe_iff.mp + rw [hEcoe] + apply formGroundEnergy_lower_of_forall + intro u hu + apply (div_le_iff₀ hsupper).2 + have h := hFtrial u hu + have hp := (hpoint u hu).2 + nlinarith + have h := (div_le_iff₀ hsupper).mp haux + nlinarith + change |F - E| ≤ _ + have hbound : |F - E| ≤ 2 * theta * (E + C) := by + apply abs_le.mpr + constructor <;> nlinarith + convert hbound using 1 + dsimp [theta, E, C] + ring + +/-- An explicit trial energy supplies a computable rounding budget, without +requiring the exact real ground energy as input. -/ +theorem formGroundEnergy_position_stability_trial {m n : ℕ} (S T : Coulomb.Nuclei m) + (trial : FormState n) (htrial : normSq trial = 1) {delta : ℝ} + (hdelta : 0 ≤ delta) (hcharge : S.charge = T.charge) + (hmove : ∀ a, ‖S.position a - T.position a‖ ≤ delta) + (hsmall : 32 * delta * Coulomb.totalCharge S ≤ 1) : + |(formGroundEnergy T n).toReal - (formGroundEnergy S n).toReal| ≤ + 32 * delta * Coulomb.totalCharge S * + (Coulomb.form S trial.val + 4 * (n : ℝ) * Coulomb.totalCharge S ^ 2) := by + apply (formGroundEnergy_position_stability S T trial htrial hdelta hcharge hmove hsmall).trans + apply mul_le_mul_of_nonneg_left + · apply add_le_add _ le_rfl + apply EReal.coe_le_coe_iff.mp + rw [EReal.coe_toReal (formGroundEnergy_finite S trial htrial).1 + (formGroundEnergy_finite S trial htrial).2] + exact formGroundEnergy_le_trial S trial htrial + · exact mul_nonneg (mul_nonneg (by norm_num) hdelta) (Coulomb.totalCharge_pos S).le + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/Hardness.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/Hardness.lean new file mode 100644 index 0000000000000000000000000000000000000000..89e66252aab11bea3b02553d397098d7212bd235 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/Hardness.lean @@ -0,0 +1,24 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceHardness +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.OneInputHardness + +namespace OAI + +/-! +QMA hardness of continuum Coulomb energy with unit nuclear charges +and with binary-encoded positive integer nuclear charges. +-/ + +noncomputable section +namespace ContinuumCoulomb + +theorem unit_coulomb_qmaHard : QMAHard unitCoulombCodec.encode unitCoulombPromise := + unit_coulomb_qmaHard_of_cmp publishedCMPHardness + +theorem binary_coulomb_qmaHard : QMAHard binaryCoulombCodec.encode binaryCoulombPromise := + binary_coulomb_qmaHard_of_cmp publishedCMPHardness + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/HardnessComposition.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/HardnessComposition.lean new file mode 100644 index 0000000000000000000000000000000000000000..68220a1dcaf7acaf5989ed8b7f453e3b96de55fe --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/HardnessComposition.lean @@ -0,0 +1,34 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.TM2Composition + +namespace OAI + +/-! Promise-hardness transport through actual polynomial-time machine +composition, with both yes and no promise maps retained. -/ + +noncomputable section +namespace ContinuumCoulomb +open BinaryEncoding + +def PolynomialManyOne.comp {α β γ : Type} + {ea : α → BitString} {eb : β → BitString} {ec : γ → BitString} + {P : PromiseProblem α} {Q : PromiseProblem β} {R : PromiseProblem γ} + (F : PolynomialManyOne ea eb P Q) (G : PolynomialManyOne eb ec Q R) : + PolynomialManyOne ea ec P R where + map := G.map ∘ F.map + polynomialTime := TM2Composition.computable (f := F.map) (g := G.map) F.polynomialTime G.polynomialTime + maps_yes x hx := G.maps_yes (F.map x) (F.maps_yes x hx) + maps_no x hx := G.maps_no (F.map x) (F.maps_no x hx) + +theorem QMAHard.of_reduction {α β : Type} + {ea : α → BitString} {eb : β → BitString} + {P : PromiseProblem α} {Q : PromiseProblem β} + (hP : QMAHard ea P) (F : PolynomialManyOne ea eb P Q) : QMAHard eb Q := by + intro R hR + rcases hP R hR with ⟨G⟩ + exact ⟨G.comp F⟩ + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/LastTensorFiber.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/LastTensorFiber.lean new file mode 100644 index 0000000000000000000000000000000000000000..9e56971171b566525b0fdb1f94073f0866232c6d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/LastTensorFiber.lean @@ -0,0 +1,71 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.ManyBody.FiniteOrbitalComplement + +namespace OAI + +/-! Moving the contracted electron from the first to the last coordinate +preserves occupation for an antisymmetric full-product wave function. -/ + +noncomputable section +open MeasureTheory +open scoped BigOperators Classical +namespace ContinuumCoulomb + +def lastTensorFiber {A : Type*} {n : ℕ} (f : (Fin (n+1) → A) → ℂ) + (z : (Fin n → A) × A) : ℂ := f (Fin.snoc z.1 z.2) + +theorem last_first_fiber_norm_integral {A : Type*} [MeasurableSpace A] + {μ : Measure A} [SigmaFinite μ] {n : ℕ} + (f : (Fin (n+1) → A) → ℂ) (ha : Coulomb.ProductAntisymmetric (μ := μ) f) + (v : A → ℂ) : + (∫ y, ‖Coulomb.fiberContract (μ := μ) v (lastTensorFiber f) y‖^2 + ∂(Measure.pi fun _ : Fin n => μ)) = + ∫ y, ‖Coulomb.fiberContract (μ := μ) v (Coulomb.firstFiber f) y‖^2 + ∂(Measure.pi fun _ : Fin n => μ) := by + let e := (MeasurableEquiv.piFinSuccAbove (fun _ : Fin (n+1) => A) 0).trans + (MeasurableEquiv.prodComm : A × (Fin n → A) ≃ᵐ (Fin n → A) × A) + have he : MeasurePreserving e (Measure.pi fun _ => μ) + ((Measure.pi fun _ : Fin n => μ).prod μ) := + (measurePreserving_piFinSuccAbove (fun _ => μ) 0).trans Measure.measurePreserving_swap + have hcons (z : (Fin n → A) × A) : e.symm z = Fin.cons z.2 z.1 := by + ext i + refine Fin.cases ?_ (fun j => ?_) i <;> + simp [e,MeasurableEquiv.piFinSuccAbove,MeasurableEquiv.prodComm] + have hp := (he.symm e).quasiMeasurePreserving.ae (ha Fin.revPerm) + have hc : ∀ᵐ y ∂(Measure.pi fun _ : Fin n => μ), + ‖Coulomb.fiberContract (μ := μ) v (lastTensorFiber f) (y ∘ Fin.rev)‖^2 = + ‖Coulomb.fiberContract (μ := μ) v (Coulomb.firstFiber f) y‖^2 := by + filter_upwards [Measure.ae_ae_of_ae_prod hp] with y hy + have hcontract : Coulomb.fiberContract (μ := μ) v (lastTensorFiber f) (y ∘ Fin.rev) = + (((Fin.revPerm : Equiv.Perm (Fin (n+1))).sign : ℤ):ℂ)* + Coulomb.fiberContract (μ := μ) v (Coulomb.firstFiber f) y := by + unfold Coulomb.fiberContract + rw [← integral_const_mul] + apply integral_congr_ae + filter_upwards [hy] with z hz + simp only [hcons] at hz + change f (Fin.cons z y ∘ Fin.rev) = _ at hz + rw [Fin.cons_comp_rev] at hz + change star (v z)*f (Fin.snoc (y ∘ Fin.rev) z) = + _*(star (v z)*f (Fin.cons z y)) + rw [hz] + ring + rw [hcontract,norm_mul,Coulomb.sign_complex_norm,one_mul] + have hr := (measurePreserving_piCongrLeft (fun _ : Fin n => μ) Fin.revPerm).integral_comp' + (fun y => ‖Coulomb.fiberContract (μ := μ) v (lastTensorFiber f) y‖^2) + have hrev (y : Fin n → A) : + (MeasurableEquiv.piCongrLeft (fun _ : Fin n => A) Fin.revPerm) y = y ∘ Fin.rev := by + funext i + have h := MeasurableEquiv.piCongrLeft_apply_apply (β := fun _ : Fin n => A) Fin.revPerm y i.rev + change (MeasurableEquiv.piCongrLeft (fun _ : Fin n => A) Fin.revPerm) y i.rev.rev = y i.rev at h + simpa only [Fin.rev_rev,Function.comp_apply] using h + simp only [hrev] at hr + calc + _ = ∫ y, ‖Coulomb.fiberContract (μ := μ) v (lastTensorFiber f) (y ∘ Fin.rev)‖^2 + ∂(Measure.pi fun _ : Fin n => μ) := hr.symm + _ = _ := integral_congr_ae hc + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/Model.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/Model.lean new file mode 100644 index 0000000000000000000000000000000000000000..076bacb4f3a34dd198112a0b4374b6a88f33a46e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/Model.lean @@ -0,0 +1,171 @@ +import OAI.Analysis.CoulombRadii.FormDomain.Add + +namespace OAI + +/-! +# Full spinful continuum Coulomb energy + +Nuclear data and electronic states use the weak H¹ domain and translated +Hardy bounds. Antisymmetry +permutes spin and position together. No orbital projection or spin sector is +imposed. The bottom takes values in `EReal` so its definition does not assume +existence of a normalized state or a minimizing eigenvector. +-/ + +noncomputable section + +open MeasureTheory +open scoped BigOperators + +namespace ContinuumCoulomb + +abbrev Position := Coulomb.Space +abbrev Configuration := Coulomb.Configuration +abbrev SpinConfiguration := Coulomb.Spins + +/-- Finite clamped-nucleus data for binary-encoded positive integer charges. -/ +structure NuclearData where + nuclei : ℕ + nuclei_pos : 0 < nuclei + position : Fin nuclei → Fin 3 → ℚ + distinct : Function.Injective position + charge : Fin nuclei → ℕ + charge_pos : ∀ a, 0 < charge a + electrons : ℕ + electrons_pos : 0 < electrons + +/-- Unit-charge inputs carry no independently chosen charge parameters. -/ +structure UnitNuclearData where + nuclei : ℕ + nuclei_pos : 0 < nuclei + position : Fin nuclei → Fin 3 → ℚ + distinct : Function.Injective position + electrons : ℕ + electrons_pos : 0 < electrons + +def UnitNuclearData.toNuclearData (d : UnitNuclearData) : NuclearData where + nuclei := d.nuclei + nuclei_pos := d.nuclei_pos + position := d.position + distinct := d.distinct + charge := fun _ => 1 + charge_pos := fun _ => Nat.zero_lt_one + electrons := d.electrons + electrons_pos := d.electrons_pos + +section + +theorem realPosition_atLeastTwo : Nat.AtLeastTwo (1 + 1) := + @Nat.instAtLeastTwoHAddOfNat 1 (@Nat.instNeZeroSucc 0) + +attribute [local instance] realPosition_atLeastTwo + +def realPosition (r : Fin 3 → ℚ) : Position := + WithLp.toLp 2 (fun a => (r a : ℝ)) + +end + +theorem realPosition_injective : Function.Injective realPosition := by + intro r s hrs + funext a + have h := congrArg (fun p : Position => p a) hrs + change (r a : ℝ) = (s a : ℝ) at h + exact_mod_cast h + +/-- Integer positive charges satisfy the real-charge library interface. -/ +def NuclearData.toNuclei (d : NuclearData) : Coulomb.Nuclei d.nuclei where + nonempty := d.nuclei_pos + position := fun a => realPosition (d.position a) + distinct := realPosition_injective.comp d.distinct + charge := fun a => (d.charge a : ℝ) + charge_ge_one := by + intro a + exact_mod_cast d.charge_pos a + +/-- Every normalized state ranges over the full weak H¹ fermionic space. -/ +abbrev FormState (n : ℕ) := {state : Coulomb.H1Vector n // Coulomb.Antisymmetric state} + +abbrev normSq {n : ℕ} (state : FormState n) := Coulomb.mass state.val +abbrev kineticEnergy {n : ℕ} (state : FormState n) := Coulomb.kinetic state.val + +/-- Electronic form with kinetic coefficient `1/2`; nuclear repulsion omitted. -/ +def coulombForm (d : NuclearData) (state : FormState d.electrons) : ℝ := + Coulomb.form d.toNuclei state.val + +def unitCoulombForm (d : UnitNuclearData) (state : FormState d.electrons) : ℝ := + coulombForm d.toNuclearData state + +/-- Variational bottom over every normalized spinful fermionic H¹ state. -/ +def groundEnergy (d : NuclearData) : EReal := + sInf {e | ∃ state : FormState d.electrons, + normSq state = 1 ∧ e = (coulombForm d state : EReal)} + +def unitGroundEnergy (d : UnitNuclearData) : EReal := + sInf {e | ∃ state : FormState d.electrons, + normSq state = 1 ∧ e = (unitCoulombForm d state : EReal)} + +/-- The unit-to-binary inclusion preserves the entire variational energy. -/ +theorem unit_groundEnergy_eq (d : UnitNuclearData) : + groundEnergy d.toNuclearData = unitGroundEnergy d := rfl + +/-- Nuclear singularities are integrable on the full declared form domain. -/ +theorem nuclear_integrable (d : NuclearData) (state : FormState d.electrons) + (spin : SpinConfiguration d.electrons) : + Integrable (fun x => + (∑ i, Coulomb.attraction d.toNuclei (Coulomb.position x i)) * + ‖state.val.value spin x‖ ^ 2) := + state.val.nuclear_integrable d.toNuclei spin + +/-- Pair singularities are integrable too; no extra domain hypothesis is used. -/ +theorem pair_integrable {n : ℕ} (state : FormState n) (spin : SpinConfiguration n) : + Integrable (fun x => + (∑ i : Fin n, ∑ j : Fin n, + if i < j then Coulomb.coulombKernel (Coulomb.position x i - Coulomb.position x j) + else 0) * ‖state.val.value spin x‖ ^ 2) := + state.val.pair_integrable spin + +/-- Explicit instance-dependent lower bound on every normalized state. -/ +theorem normalized_form_lower_bound (d : NuclearData) (state : FormState d.electrons) + (hnorm : normSq state = 1) : + -(2 * (d.electrons : ℝ) * Coulomb.totalCharge d.toNuclei ^ 2) ≤ + coulombForm d state := by + have h := Coulomb.form_lower_bound d.toNuclei state.val + change _ * normSq state ≤ coulombForm d state at h + simpa only [hnorm, mul_one] using h + +/-- The continuum infimum is never minus infinity. This does not assert +attainment, binding, or a molecular excitation gap. -/ +theorem groundEnergy_lower_bound (d : NuclearData) : + (-(2 * (d.electrons : ℝ) * Coulomb.totalCharge d.toNuclei ^ 2) : ℝ) ≤ + groundEnergy d := by + apply le_sInf + rintro e ⟨state, hnorm, rfl⟩ + exact EReal.coe_le_coe (normalized_form_lower_bound d state hnorm) + +/-- Restricting admissible states supplies an upper bound on the full bottom. -/ +theorem groundEnergy_le_trial (d : NuclearData) (state : FormState d.electrons) + (hnorm : normSq state = 1) : + groundEnergy d ≤ (coulombForm d state : EReal) := + sInf_le ⟨state, hnorm, rfl⟩ + +/-- The lower form bound excludes minus infinity without any binding promise. -/ +theorem groundEnergy_ne_bot (d : NuclearData) : groundEnergy d ≠ ⊥ := by + exact ne_of_gt ((EReal.bot_lt_coe _).trans_le (groundEnergy_lower_bound d)) + +/-- Any normalized trial state excludes plus infinity; attainment is unnecessary. -/ +theorem groundEnergy_ne_top (d : NuclearData) (state : FormState d.electrons) + (hnorm : normSq state = 1) : groundEnergy d ≠ ⊤ := by + exact ne_of_lt ((groundEnergy_le_trial d state hnorm).trans_lt (EReal.coe_lt_top _)) + +/-- Once a normalized trial state is provided, ordinary real threshold +accounting applies to the same continuum infimum. -/ +theorem groundEnergy_coe_toReal (d : NuclearData) (state : FormState d.electrons) + (hnorm : normSq state = 1) : + ((groundEnergy d).toReal : EReal) = groundEnergy d := + EReal.coe_toReal (groundEnergy_ne_top d state hnorm) (groundEnergy_ne_bot d) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/OneInputHardness.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/OneInputHardness.lean new file mode 100644 index 0000000000000000000000000000000000000000..761ba2a699641691c3c0dda326eb5463d73bec77 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/OneInputHardness.lean @@ -0,0 +1,26 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.TwoInputsHardness +import OAI.MathematicalPhysics.ContinuumCoulomb.Nuclei.FlowUniform + +namespace OAI + +/-! +Continuum Coulomb hardness follows from hardness of the field-free +signed square-lattice Heisenberg energy problem. +-/ + +noncomputable section +namespace ContinuumCoulomb + +theorem unit_coulomb_qmaHard_of_cmp (hcmp : PublishedCMPHardness) : + QMAHard unitCoulombCodec.encode unitCoulombPromise := + unit_coulomb_qmaHard_of_two_inputs hcmp publishedC4FlowInput + +theorem binary_coulomb_qmaHard_of_cmp (hcmp : PublishedCMPHardness) : + QMAHard binaryCoulombCodec.encode binaryCoulombPromise := + binary_coulomb_qmaHard_of_two_inputs hcmp publishedC4FlowInput + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/Perturbation.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/Perturbation.lean new file mode 100644 index 0000000000000000000000000000000000000000..98c2d199a5b6d5ee5e0472140fad52c107c4c6c8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/Perturbation.lean @@ -0,0 +1,508 @@ +import Mathlib.Analysis.InnerProductSpace.Basic +import Mathlib.Analysis.InnerProductSpace.Continuous +import Mathlib.Analysis.Normed.Module.FiniteDimension +import Mathlib.Analysis.Normed.Operator.Basic +import Mathlib.Analysis.RCLike.Lemmas +import Mathlib.Topology.Order.Compact +import Mathlib.Tactic.FieldSimp +import Mathlib.Tactic.GCongr +import Mathlib.Tactic.Linarith +import Mathlib.Tactic.Positivity +import Mathlib.Tactic.Ring + +namespace OAI + +/-! +# Second-order block estimates + +The finite reductions use the bottom-energy estimate from the binary +manuscript's `lem:second-order` and the unit manuscript's `lem:perturbation`. +Explicit positivity and operator norm bounds give vector and variational +estimates for the penalty, inverse, coupling and high perturbation blocks. + +Real inner products also express the real quadratic forms of complex spin +Hilbert spaces by restriction of scalars. +-/ + +noncomputable section + +open scoped InnerProductSpace + +namespace ContinuumCoulomb +namespace Perturbation + +variable {L H : Type*} +variable [NormedAddCommGroup L] [InnerProductSpace ℝ L] +variable [NormedAddCommGroup H] [InnerProductSpace ℝ H] + +def penaltyForm (A : H →L[ℝ] H) (q : H) : ℝ := ⟪q, A q⟫_ℝ + +def inverseForm (T : H →L[ℝ] H) (B : L →L[ℝ] H) (p : L) : ℝ := + ⟪B p, T (B p)⟫_ℝ + +/-- Full block energy when the low-low perturbation block vanishes. -/ +def blockEnergy (A D : H →L[ℝ] H) (B : L →L[ℝ] H) (p : L) (q : H) : ℝ := + penaltyForm A q + 2 * ⟪q, B p⟫_ℝ + ⟪q, D q⟫_ℝ + +theorem inverseForm_nonneg (A T : H →L[ℝ] H) (B : L →L[ℝ] H) + (hAT : ∀ x, A (T x) = x) (hA : ∀ q, 0 ≤ penaltyForm A q) (p : L) : + 0 ≤ inverseForm T B p := by + have h := hA (T (B p)) + simpa only [penaltyForm, hAT, real_inner_comm, inverseForm] using h + +/-- The precise square-completion identity, before any estimates. -/ +theorem penalty_square_identity (A T : H →L[ℝ] H) (B : L →L[ℝ] H) + (hAT : ∀ x, A (T x) = x) + (hAsymm : ∀ x y, ⟪x, A y⟫_ℝ = ⟪A x, y⟫_ℝ) + (p : L) (q : H) {σ : ℝ} (hσ : σ ≠ 0) : + σ * penaltyForm A q + 2 * ⟪q, B p⟫_ℝ = + σ * penaltyForm A (q + σ⁻¹ • T (B p)) - σ⁻¹ * inverseForm T B p := by + have hcross : ⟪T (B p), A q⟫_ℝ = ⟪q, B p⟫_ℝ := by + rw [hAsymm, hAT, real_inner_comm] + simp only [penaltyForm, inverseForm, map_add, map_smul, inner_add_left, + inner_add_right, real_inner_smul_left, real_inner_smul_right, hAT, hcross] + rw [real_inner_comm (T (B p)) (B p)] + field_simp + ring + +/-- The trial vector used in the second-order variational upper bound. -/ +theorem blockEnergy_trial_identity (A T D : H →L[ℝ] H) (B : L →L[ℝ] H) + (hAT : ∀ x, A (T x) = x) (p : L) : + blockEnergy A D B p (-(T (B p))) = + -inverseForm T B p + ⟪-(T (B p)), D (-(T (B p)))⟫_ℝ := by + simp only [blockEnergy, penaltyForm, inverseForm, map_neg, hAT, + inner_neg_left, inner_neg_right] + rw [real_inner_comm (T (B p)) (B p)] + ring + +theorem inverse_coupling_norm_le (T : H →L[ℝ] H) (B : L →L[ℝ] H) + {g ε : ℝ} (hg : 0 < g) (_hε : 0 ≤ ε) + (hT : ‖T‖ ≤ 1 / g) (hB : ‖B‖ ≤ ε * g) (p : L) : + ‖T (B p)‖ ≤ ε * ‖p‖ := by + have hBp : ‖B p‖ ≤ ε * g * ‖p‖ := + (B.le_opNorm p).trans (mul_le_mul_of_nonneg_right hB (norm_nonneg _)) + calc + ‖T (B p)‖ ≤ ‖T‖ * ‖B p‖ := T.le_opNorm _ + _ ≤ (1 / g) * (ε * g * ‖p‖) := by + exact mul_le_mul hT hBp (norm_nonneg _) (by positivity) + _ = ε * ‖p‖ := by field_simp + +theorem inverseForm_le (T : H →L[ℝ] H) (B : L →L[ℝ] H) + {g ε : ℝ} (hg : 0 < g) (hε : 0 ≤ ε) + (hT : ‖T‖ ≤ 1 / g) (hB : ‖B‖ ≤ ε * g) (p : L) : + inverseForm T B p ≤ g * ε ^ 2 * ‖p‖ ^ 2 := by + have hBp : ‖B p‖ ≤ ε * g * ‖p‖ := + (B.le_opNorm p).trans (mul_le_mul_of_nonneg_right hB (norm_nonneg _)) + have hTBp := inverse_coupling_norm_le T B hg hε hT hB p + calc + inverseForm T B p ≤ ‖B p‖ * ‖T (B p)‖ := real_inner_le_norm _ _ + _ ≤ (ε * g * ‖p‖) * (ε * ‖p‖) := + mul_le_mul hBp hTBp (norm_nonneg _) (by positivity) + _ = g * ε ^ 2 * ‖p‖ ^ 2 := by ring + +theorem highPerturbation_abs_le (D : H →L[ℝ] H) + {g ε : ℝ} (hD : ‖D‖ ≤ ε * g) (q : H) : + |⟪q, D q⟫_ℝ| ≤ ε * g * ‖q‖ ^ 2 := by + calc + |⟪q, D q⟫_ℝ| ≤ ‖q‖ * ‖D q‖ := abs_real_inner_le_norm _ _ + _ ≤ ‖q‖ * (ε * g * ‖q‖) := by + exact mul_le_mul_of_nonneg_left + ((D.le_opNorm q).trans (mul_le_mul_of_nonneg_right hD (norm_nonneg _))) + (norm_nonneg _) + _ = ε * g * ‖q‖ ^ 2 := by ring + +theorem highPerturbation_relative_lower (A D : H →L[ℝ] H) + {g ε : ℝ} (hε : 0 ≤ ε) (hD : ‖D‖ ≤ ε * g) + (hgap : ∀ q, g * ‖q‖ ^ 2 ≤ penaltyForm A q) (q : H) : + -(ε * penaltyForm A q) ≤ ⟪q, D q⟫_ℝ := by + have h := (abs_le.mp (highPerturbation_abs_le D hD q)).1 + have hgap' := mul_le_mul_of_nonneg_left (hgap q) hε + nlinarith + +/-- Completing a square lowers the full form by the inverse coupling form. -/ +theorem blockEnergy_lower (A T D : H →L[ℝ] H) (B : L →L[ℝ] H) + {g ε : ℝ} (hε : 0 ≤ ε) (hε1 : ε < 1) + (hAT : ∀ x, A (T x) = x) + (hAsymm : ∀ x y, ⟪x, A y⟫_ℝ = ⟪A x, y⟫_ℝ) + (hA : ∀ q, 0 ≤ penaltyForm A q) + (hgap : ∀ q, g * ‖q‖ ^ 2 ≤ penaltyForm A q) + (hD : ‖D‖ ≤ ε * g) (p : L) (q : H) : + -inverseForm T B p / (1 - ε) ≤ blockEnergy A D B p q := by + have hσ : 0 < 1 - ε := by linarith + have hid := penalty_square_identity A T B hAT hAsymm p q (ne_of_gt hσ) + have hsquare := mul_nonneg (le_of_lt hσ) (hA (q + (1 - ε)⁻¹ • T (B p))) + have hDq := highPerturbation_relative_lower A D hε hD hgap q + unfold blockEnergy + rw [div_eq_mul_inv] + nlinarith + +def blockRayleigh (A D : H →L[ℝ] H) (B : L →L[ℝ] H) (p : L) (q : H) : ℝ := + blockEnergy A D B p q / (‖p‖ ^ 2 + ‖q‖ ^ 2) + +def blockBottom (A D : H →L[ℝ] H) (B : L →L[ℝ] H) : ℝ := + sInf {e | ∃ (p : L) (q : H), 0 < ‖p‖ ^ 2 + ‖q‖ ^ 2 ∧ + e = blockRayleigh A D B p q} + +/-- Pointwise inverse-form control gives the lower Rayleigh bound. -/ +theorem blockRayleigh_lower (A T D : H →L[ℝ] H) (B : L →L[ℝ] H) + {g ε κ : ℝ} (hε : 0 ≤ ε) (hε1 : ε < 1) (hκ : 0 ≤ κ) + (hAT : ∀ x, A (T x) = x) + (hAsymm : ∀ x y, ⟪x, A y⟫_ℝ = ⟪A x, y⟫_ℝ) + (hA : ∀ q, 0 ≤ penaltyForm A q) + (hgap : ∀ q, g * ‖q‖ ^ 2 ≤ penaltyForm A q) + (hD : ‖D‖ ≤ ε * g) + (hK : ∀ p, inverseForm T B p ≤ κ * ‖p‖ ^ 2) + (p : L) (q : H) (hnorm : 0 < ‖p‖ ^ 2 + ‖q‖ ^ 2) : + -κ / (1 - ε) ≤ blockRayleigh A D B p q := by + have hσ : 0 < 1 - ε := by linarith + have he := blockEnergy_lower A T D B hε hε1 hAT hAsymm hA hgap hD p q + have hK' := div_le_div_of_nonneg_right (neg_le_neg (hK p)) (le_of_lt hσ) + have hq : 0 ≤ κ * (1 - ε)⁻¹ * ‖q‖ ^ 2 := by positivity + unfold blockRayleigh + apply (le_div_iff₀ hnorm).mpr + simp only [div_eq_mul_inv] at he hK' ⊢ + nlinarith + +theorem cubic_lower_error {g ε κ : ℝ} (hg : 0 < g) + (hε : 0 ≤ ε) (hεhalf : ε < 1 / 2) (hκ : κ ≤ g * ε ^ 2) : + -κ - 2 * g * ε ^ 3 ≤ -κ / (1 - ε) := by + have hσ : 0 < 1 - ε := by linarith + have hsmall : 0 ≤ g * ε ^ 3 * (1 - 2 * ε) := + mul_nonneg (by positivity) (by linarith) + have hκ' := mul_le_mul_of_nonneg_left hκ hε + apply (le_div_iff₀ hσ).mpr + nlinarith + +/-- The explicit second-order trial vector gives a cubic upper error. -/ +theorem blockRayleigh_trial_upper (A T D : H →L[ℝ] H) (B : L →L[ℝ] H) + {g ε κ : ℝ} (hg : 0 < g) (hε : 0 ≤ ε) (hεhalf : ε < 1 / 2) + (hAT : ∀ x, A (T x) = x) + (hT : ‖T‖ ≤ 1 / g) (hB : ‖B‖ ≤ ε * g) (hD : ‖D‖ ≤ ε * g) + (hκ : κ ≤ g * ε ^ 2) + (p : L) (hp : ‖p‖ = 1) (hattain : inverseForm T B p = κ) : + blockRayleigh A D B p (-(T (B p))) ≤ -κ + 2 * g * ε ^ 3 := by + have hnorm : ‖-(T (B p))‖ ≤ ε := by + simpa only [norm_neg, hp, mul_one] using inverse_coupling_norm_le T B hg hε hT hB p + have hr : ‖-(T (B p))‖ ^ 2 ≤ ε ^ 2 := by nlinarith [norm_nonneg (-(T (B p)))] + have hr0 : 0 ≤ ‖-(T (B p))‖ ^ 2 := sq_nonneg _ + have hd := (abs_le.mp (highPerturbation_abs_le D hD (-(T (B p))))).2 + have hd' : ⟪-(T (B p)), D (-(T (B p)))⟫_ℝ ≤ g * ε ^ 3 := by + have h := mul_le_mul_of_nonneg_left hr (show 0 ≤ ε * g by positivity) + nlinarith + have hκr : κ * ‖-(T (B p))‖ ^ 2 ≤ g * ε ^ 4 := by + have h1 := mul_le_mul_of_nonneg_right hκ hr0 + have h2 := mul_le_mul_of_nonneg_left hr (show 0 ≤ g * ε ^ 2 by positivity) + nlinarith + have hε4 : g * ε ^ 4 ≤ g * ε ^ 3 := by + have h := mul_nonneg (show 0 ≤ g * ε ^ 3 by positivity) + (show 0 ≤ 1 - ε by linarith) + nlinarith + have hden : 0 < 1 + ‖-(T (B p))‖ ^ 2 := by positivity + unfold blockRayleigh + rw [blockEnergy_trial_identity A T D B hAT p, hattain, hp, one_pow] + apply (div_le_iff₀ hden).mpr + have hcost : 0 ≤ 2 * g * ε ^ 3 * ‖-(T (B p))‖ ^ 2 := by positivity + nlinarith + +/-- Supporting variational second-order estimate for the zero low-low +block case. The effective positive inverse form is bounded by `κ` and +attains it at the supplied unit vector, exactly as for the maximum +eigenvector of the finite positive matrix `PBA⁻¹BP` in the manuscript. -/ +theorem blockBottom_second_order (A T D : H →L[ℝ] H) (B : L →L[ℝ] H) + {g ε κ : ℝ} (hg : 0 < g) (hε : 0 ≤ ε) (hεhalf : ε < 1 / 2) + (hAT : ∀ x, A (T x) = x) + (hAsymm : ∀ x y, ⟪x, A y⟫_ℝ = ⟪A x, y⟫_ℝ) + (hA : ∀ q, 0 ≤ penaltyForm A q) + (hgap : ∀ q, g * ‖q‖ ^ 2 ≤ penaltyForm A q) + (hT : ‖T‖ ≤ 1 / g) (hB : ‖B‖ ≤ ε * g) (hD : ‖D‖ ≤ ε * g) + (hK : ∀ p, inverseForm T B p ≤ κ * ‖p‖ ^ 2) + (p₀ : L) (hp₀ : ‖p₀‖ = 1) (hattain : inverseForm T B p₀ = κ) : + |blockBottom A D B + κ| ≤ 2 * g * ε ^ 3 := by + have hκ0 : 0 ≤ κ := by + rw [← hattain] + exact inverseForm_nonneg A T B hAT hA p₀ + have hκ : κ ≤ g * ε ^ 2 := by + have h := inverseForm_le T B hg hε hT hB p₀ + simpa only [hattain, hp₀, one_pow, mul_one] using h + have hnorm : 0 < ‖p₀‖ ^ 2 + ‖-(T (B p₀))‖ ^ 2 := by rw [hp₀]; positivity + have hnonempty : + {e | ∃ (p : L) (q : H), 0 < ‖p‖ ^ 2 + ‖q‖ ^ 2 ∧ + e = blockRayleigh A D B p q}.Nonempty := + ⟨_, p₀, -(T (B p₀)), hnorm, rfl⟩ + have hlower (e : ℝ) + (he : ∃ (p : L) (q : H), 0 < ‖p‖ ^ 2 + ‖q‖ ^ 2 ∧ + e = blockRayleigh A D B p q) : -κ - 2 * g * ε ^ 3 ≤ e := by + obtain ⟨p, q, hpq, rfl⟩ := he + exact (cubic_lower_error hg hε hεhalf hκ).trans + (blockRayleigh_lower A T D B hε (by linarith) hκ0 hAT hAsymm hA hgap hD hK p q hpq) + have hbdd : BddBelow + {e | ∃ (p : L) (q : H), 0 < ‖p‖ ^ 2 + ‖q‖ ^ 2 ∧ + e = blockRayleigh A D B p q} := ⟨_, hlower⟩ + have hbottomLower : -κ - 2 * g * ε ^ 3 ≤ blockBottom A D B := + le_csInf hnonempty hlower + have hbottomUpper : blockBottom A D B ≤ -κ + 2 * g * ε ^ 3 := + (csInf_le hbdd ⟨p₀, -(T (B p₀)), hnorm, rfl⟩).trans + (blockRayleigh_trial_upper A T D B hg hε hεhalf hAT hT hB hD hκ p₀ hp₀ hattain) + apply abs_le.mpr + constructor <;> linarith + +/-- First-order low compression together with its second-order inverse term. -/ +def effectiveForm (C : L →L[ℝ] L) (T : H →L[ℝ] H) (B : L →L[ℝ] H) + (p : L) : ℝ := ⟪p, C p⟫_ℝ - inverseForm T B p + +theorem effectiveForm_smul (C : L →L[ℝ] L) (T : H →L[ℝ] H) + (B : L →L[ℝ] H) (r : ℝ) (p : L) : + effectiveForm C T B (r • p) = r ^ 2 * effectiveForm C T B p := by + simp only [effectiveForm, inverseForm, map_smul, real_inner_smul_left, + real_inner_smul_right] + ring + +/-- Finite dimensionality supplies the effective ground vector; this +is not an additional simulation assumption. -/ +theorem effectiveForm_minimizer [FiniteDimensional ℝ L] + (C : L →L[ℝ] L) (T : H →L[ℝ] H) (B : L →L[ℝ] H) + (u : L) (hu : ‖u‖ = 1) : + ∃ p : L, ‖p‖ = 1 ∧ + ∀ x : L, effectiveForm C T B p * ‖x‖ ^ 2 ≤ effectiveForm C T B x := by + have := FiniteDimensional.proper_rclike ℝ L + have hc : Continuous (effectiveForm C T B) := + (continuous_id.inner C.continuous).sub + (B.continuous.inner (T.continuous.comp B.continuous)) + have hnonempty : (Metric.sphere (0 : L) 1).Nonempty := ⟨u, by simpa using hu⟩ + obtain ⟨p, hp, hmin⟩ := + (isCompact_sphere (0 : L) 1).exists_isMinOn hnonempty hc.continuousOn + refine ⟨p, by simpa using hp, ?_⟩ + intro x + by_cases hx : x = 0 + · simp [hx, effectiveForm, inverseForm] + have hxn : ‖x‖ ≠ 0 := norm_ne_zero_iff.mpr hx + have hunit : ‖(‖x‖⁻¹ : ℝ) • x‖ = 1 := norm_smul_inv_norm hx + have h := hmin (show (‖x‖⁻¹ : ℝ) • x ∈ Metric.sphere (0 : L) 1 by simpa using hunit) + change effectiveForm C T B p ≤ effectiveForm C T B ((‖x‖⁻¹ : ℝ) • x) at h + rw [effectiveForm_smul] at h + calc + effectiveForm C T B p * ‖x‖ ^ 2 ≤ + (‖x‖⁻¹ ^ 2 * effectiveForm C T B x) * ‖x‖ ^ 2 := + mul_le_mul_of_nonneg_right h (sq_nonneg _) + _ = effectiveForm C T B x := by field_simp + +def effectiveBottom (C : L →L[ℝ] L) (T : H →L[ℝ] H) (B : L →L[ℝ] H) : ℝ := + sInf {e | ∃ p : L, ‖p‖ = 1 ∧ e = effectiveForm C T B p} + +theorem effectiveBottom_eq (C : L →L[ℝ] L) (T : H →L[ℝ] H) (B : L →L[ℝ] H) + (p : L) (hp : ‖p‖ = 1) + (hmin : ∀ x : L, effectiveForm C T B p * ‖x‖ ^ 2 ≤ effectiveForm C T B x) : + effectiveBottom C T B = effectiveForm C T B p := by + have hlower (e : ℝ) (he : ∃ x : L, ‖x‖ = 1 ∧ e = effectiveForm C T B x) : + effectiveForm C T B p ≤ e := by + obtain ⟨x, hx, rfl⟩ := he + simpa only [hx, one_pow, mul_one] using hmin x + exact le_antisymm (csInf_le ⟨_, hlower⟩ ⟨p, hp, rfl⟩) + (le_csInf ⟨_, p, hp, rfl⟩ hlower) + +def lowBlockEnergy (C : L →L[ℝ] L) (A D : H →L[ℝ] H) + (B : L →L[ℝ] H) (p : L) (q : H) : ℝ := + ⟪p, C p⟫_ℝ + blockEnergy A D B p q + +def lowBlockRayleigh (C : L →L[ℝ] L) (A D : H →L[ℝ] H) + (B : L →L[ℝ] H) (p : L) (q : H) : ℝ := + lowBlockEnergy C A D B p q / (‖p‖ ^ 2 + ‖q‖ ^ 2) + +def lowBlockBottom (C : L →L[ℝ] L) (A D : H →L[ℝ] H) + (B : L →L[ℝ] H) : ℝ := + sInf {e | ∃ (p : L) (q : H), 0 < ‖p‖ ^ 2 + ‖q‖ ^ 2 ∧ + e = lowBlockRayleigh C A D B p q} + +theorem effectiveForm_bounds (C : L →L[ℝ] L) (A T : H →L[ℝ] H) + (B : L →L[ℝ] H) {g ε : ℝ} (hg : 0 < g) (hε : 0 ≤ ε) + (hAT : ∀ x, A (T x) = x) (hA : ∀ q, 0 ≤ penaltyForm A q) + (hT : ‖T‖ ≤ 1 / g) (hB : ‖B‖ ≤ ε * g) (hC : ‖C‖ ≤ ε * g) + (p : L) : + -(ε * g + g * ε ^ 2) * ‖p‖ ^ 2 ≤ effectiveForm C T B p ∧ + effectiveForm C T B p ≤ ε * g * ‖p‖ ^ 2 := by + have hCp := abs_le.mp (highPerturbation_abs_le C hC p) + have hK0 := inverseForm_nonneg A T B hAT hA p + have hK := inverseForm_le T B hg hε hT hB p + unfold effectiveForm + constructor <;> nlinarith + +theorem first_order_inverse_cubic_loss {g ε k r : ℝ} + (hg : 0 < g) (hε : 0 ≤ ε) (hεquarter : ε ≤ 1 / 4) + (hr : 0 ≤ r) (hk : k ≤ g * ε ^ 2 * r) : + -4 * g * ε ^ 3 * r ≤ k - (1 - 2 * ε)⁻¹ * k := by + have hσ : 0 < 1 - 2 * ε := by linarith + have hid : k - (1 - 2 * ε)⁻¹ * k = (-2 * ε * k) / (1 - 2 * ε) := by + field_simp + ring + rw [hid] + apply (le_div_iff₀ hσ).mpr + have h := mul_le_mul_of_nonneg_left hk hε + have hsmall : 0 ≤ g * ε ^ 3 * r * (1 - 4 * ε) := + mul_nonneg (by positivity) (by linarith) + nlinarith + +/-- A shifted square gives the lower bound even when the first-order +compression is nonzero. The effective form is only assumed bounded +below pointwise; the full-energy conclusion is proved here. -/ +theorem lowBlockEnergy_shift_lower (C : L →L[ℝ] L) (A T D : H →L[ℝ] H) + (B : L →L[ℝ] H) {g ε μ : ℝ} + (hg : 0 < g) (hε : 0 ≤ ε) (hεquarter : ε ≤ 1 / 4) + (hAT : ∀ x, A (T x) = x) + (hAsymm : ∀ x y, ⟪x, A y⟫_ℝ = ⟪A x, y⟫_ℝ) + (hA : ∀ q, 0 ≤ penaltyForm A q) + (hgap : ∀ q, g * ‖q‖ ^ 2 ≤ penaltyForm A q) + (hT : ‖T‖ ≤ 1 / g) (hB : ‖B‖ ≤ ε * g) (hD : ‖D‖ ≤ ε * g) + (hμupper : μ ≤ ε * g) + (hmin : ∀ p, μ * ‖p‖ ^ 2 ≤ effectiveForm C T B p) + (p : L) (q : H) : + -4 * g * ε ^ 3 * ‖p‖ ^ 2 ≤ + lowBlockEnergy C A D B p q - μ * (‖p‖ ^ 2 + ‖q‖ ^ 2) := by + have hσ : 0 < 1 - 2 * ε := by linarith + have hid := penalty_square_identity A T B hAT hAsymm p q (ne_of_gt hσ) + have hsquare := mul_nonneg (le_of_lt hσ) (hA (q + (1 - 2 * ε)⁻¹ • T (B p))) + have hDq := (abs_le.mp (highPerturbation_abs_le D hD q)).1 + have hμq := mul_le_mul_of_nonneg_right hμupper (sq_nonneg ‖q‖) + have hgap' := mul_le_mul_of_nonneg_left (hgap q) (show 0 ≤ 2 * ε by positivity) + have hminp := hmin p + have hK := inverseForm_le T B hg hε hT hB p + have hloss := first_order_inverse_cubic_loss hg hε hεquarter (sq_nonneg ‖p‖) hK + unfold effectiveForm at hminp + unfold lowBlockEnergy blockEnergy + nlinarith + +theorem lowBlockRayleigh_lower (C : L →L[ℝ] L) (A T D : H →L[ℝ] H) + (B : L →L[ℝ] H) {g ε μ : ℝ} + (hg : 0 < g) (hε : 0 ≤ ε) (hεquarter : ε ≤ 1 / 4) + (hAT : ∀ x, A (T x) = x) + (hAsymm : ∀ x y, ⟪x, A y⟫_ℝ = ⟪A x, y⟫_ℝ) + (hA : ∀ q, 0 ≤ penaltyForm A q) + (hgap : ∀ q, g * ‖q‖ ^ 2 ≤ penaltyForm A q) + (hT : ‖T‖ ≤ 1 / g) (hB : ‖B‖ ≤ ε * g) (hD : ‖D‖ ≤ ε * g) + (hμupper : μ ≤ ε * g) + (hmin : ∀ p, μ * ‖p‖ ^ 2 ≤ effectiveForm C T B p) + (p : L) (q : H) (hnorm : 0 < ‖p‖ ^ 2 + ‖q‖ ^ 2) : + μ - 4 * g * ε ^ 3 ≤ lowBlockRayleigh C A D B p q := by + have hlower := lowBlockEnergy_shift_lower C A T D B hg hε hεquarter hAT hAsymm + hA hgap hT hB hD hμupper hmin p q + have hcost : 0 ≤ 4 * g * ε ^ 3 * ‖q‖ ^ 2 := by positivity + unfold lowBlockRayleigh + apply (le_div_iff₀ hnorm).mpr + nlinarith + +/-- The same inverse-coupling trial vector works with the unreplaced +low-block terms retained. -/ +theorem lowBlockRayleigh_trial_upper (C : L →L[ℝ] L) (A T D : H →L[ℝ] H) + (B : L →L[ℝ] H) {g ε μ : ℝ} + (hg : 0 < g) (hε : 0 ≤ ε) + (hAT : ∀ x, A (T x) = x) + (hT : ‖T‖ ≤ 1 / g) (hB : ‖B‖ ≤ ε * g) (hD : ‖D‖ ≤ ε * g) + (hμlower : -2 * ε * g ≤ μ) + (p : L) (hp : ‖p‖ = 1) (hattain : effectiveForm C T B p = μ) : + lowBlockRayleigh C A D B p (-(T (B p))) ≤ μ + 3 * g * ε ^ 3 := by + have hnorm : ‖-(T (B p))‖ ≤ ε := by + simpa only [norm_neg, hp, mul_one] using inverse_coupling_norm_le T B hg hε hT hB p + have hr : ‖-(T (B p))‖ ^ 2 ≤ ε ^ 2 := by nlinarith [norm_nonneg (-(T (B p)))] + have hr0 : 0 ≤ ‖-(T (B p))‖ ^ 2 := sq_nonneg _ + have hd := (abs_le.mp (highPerturbation_abs_le D hD (-(T (B p))))).2 + have hμr := mul_le_mul_of_nonneg_right hμlower hr0 + have hr' := mul_le_mul_of_nonneg_left hr (show 0 ≤ 3 * ε * g by positivity) + have hden : 0 < 1 + ‖-(T (B p))‖ ^ 2 := by positivity + have hcost : 0 ≤ 3 * g * ε ^ 3 * ‖-(T (B p))‖ ^ 2 := by positivity + unfold lowBlockRayleigh lowBlockEnergy + rw [blockEnergy_trial_identity A T D B hAT p, hp, one_pow] + unfold effectiveForm at hattain + apply (div_le_iff₀ hden).mpr + nlinarith + +/-- Quantitative version of the unit manuscript's `lem:perturbation`, +retaining the nonzero first-order compression. `μ` is the attained +variational minimum of `C - B* T B`; the full variational bottom is +proved within `4 g ε³` of it. -/ +theorem lowBlockBottom_second_order (C : L →L[ℝ] L) (A T D : H →L[ℝ] H) + (B : L →L[ℝ] H) {g ε μ : ℝ} + (hg : 0 < g) (hε : 0 ≤ ε) (hεquarter : ε ≤ 1 / 4) + (hAT : ∀ x, A (T x) = x) + (hAsymm : ∀ x y, ⟪x, A y⟫_ℝ = ⟪A x, y⟫_ℝ) + (hA : ∀ q, 0 ≤ penaltyForm A q) + (hgap : ∀ q, g * ‖q‖ ^ 2 ≤ penaltyForm A q) + (hT : ‖T‖ ≤ 1 / g) (hB : ‖B‖ ≤ ε * g) + (hC : ‖C‖ ≤ ε * g) (hD : ‖D‖ ≤ ε * g) + (hmin : ∀ p, μ * ‖p‖ ^ 2 ≤ effectiveForm C T B p) + (p₀ : L) (hp₀ : ‖p₀‖ = 1) (hattain : effectiveForm C T B p₀ = μ) : + |lowBlockBottom C A D B - μ| ≤ 4 * g * ε ^ 3 := by + have hbounds := effectiveForm_bounds C A T B hg hε hAT hA hT hB hC p₀ + simp only [hattain, hp₀, one_pow, mul_one] at hbounds + have hμupper : μ ≤ ε * g := hbounds.2 + have hμlower : -2 * ε * g ≤ μ := by + have hsmall : 0 ≤ g * ε * (1 - ε) := + mul_nonneg (by positivity) (by linarith) + nlinarith [hbounds.1] + have hnorm : 0 < ‖p₀‖ ^ 2 + ‖-(T (B p₀))‖ ^ 2 := by rw [hp₀]; positivity + have hnonempty : + {e | ∃ (p : L) (q : H), 0 < ‖p‖ ^ 2 + ‖q‖ ^ 2 ∧ + e = lowBlockRayleigh C A D B p q}.Nonempty := + ⟨_, p₀, -(T (B p₀)), hnorm, rfl⟩ + have hlower (e : ℝ) + (he : ∃ (p : L) (q : H), 0 < ‖p‖ ^ 2 + ‖q‖ ^ 2 ∧ + e = lowBlockRayleigh C A D B p q) : μ - 4 * g * ε ^ 3 ≤ e := by + obtain ⟨p, q, hpq, rfl⟩ := he + exact lowBlockRayleigh_lower C A T D B hg hε hεquarter hAT hAsymm hA hgap + hT hB hD hμupper hmin p q hpq + have hbdd : BddBelow + {e | ∃ (p : L) (q : H), 0 < ‖p‖ ^ 2 + ‖q‖ ^ 2 ∧ + e = lowBlockRayleigh C A D B p q} := ⟨_, hlower⟩ + have hbottomLower : μ - 4 * g * ε ^ 3 ≤ lowBlockBottom C A D B := + le_csInf hnonempty hlower + have hbottomUpper : lowBlockBottom C A D B ≤ μ + 3 * g * ε ^ 3 := + (csInf_le hbdd ⟨p₀, -(T (B p₀)), hnorm, rfl⟩).trans + (lowBlockRayleigh_trial_upper C A T D B hg hε hAT hT hB hD hμlower p₀ hp₀ hattain) + apply abs_le.mpr + constructor <;> nlinarith [show 0 ≤ g * ε ^ 3 by positivity] + +/-- The finite-dimensional, nonzero-low-block perturbation estimate +compares the two actual variational infima. -/ +theorem finite_lowBlockBottom_second_order [FiniteDimensional ℝ L] + (C : L →L[ℝ] L) (A T D : H →L[ℝ] H) (B : L →L[ℝ] H) + {g ε : ℝ} (hg : 0 < g) (hε : 0 ≤ ε) (hεquarter : ε ≤ 1 / 4) + (hAT : ∀ x, A (T x) = x) + (hAsymm : ∀ x y, ⟪x, A y⟫_ℝ = ⟪A x, y⟫_ℝ) + (hA : ∀ q, 0 ≤ penaltyForm A q) + (hgap : ∀ q, g * ‖q‖ ^ 2 ≤ penaltyForm A q) + (hT : ‖T‖ ≤ 1 / g) (hB : ‖B‖ ≤ ε * g) + (hC : ‖C‖ ≤ ε * g) (hD : ‖D‖ ≤ ε * g) + (u : L) (hu : ‖u‖ = 1) : + |lowBlockBottom C A D B - effectiveBottom C T B| ≤ 4 * g * ε ^ 3 := by + obtain ⟨p, hp, hmin⟩ := effectiveForm_minimizer C T B u hu + rw [effectiveBottom_eq C T B p hp hmin] + exact lowBlockBottom_second_order C A T D B hg hε hεquarter hAT hAsymm hA hgap + hT hB hC hD hmin p hp rfl + +/-- The sharper zero-low-block estimate also compares actual variational +infima without a separately supplied effective maximizing vector. -/ +theorem finite_blockBottom_second_order [FiniteDimensional ℝ L] + (A T D : H →L[ℝ] H) (B : L →L[ℝ] H) + {g ε : ℝ} (hg : 0 < g) (hε : 0 ≤ ε) (hεhalf : ε < 1 / 2) + (hAT : ∀ x, A (T x) = x) + (hAsymm : ∀ x y, ⟪x, A y⟫_ℝ = ⟪A x, y⟫_ℝ) + (hA : ∀ q, 0 ≤ penaltyForm A q) + (hgap : ∀ q, g * ‖q‖ ^ 2 ≤ penaltyForm A q) + (hT : ‖T‖ ≤ 1 / g) (hB : ‖B‖ ≤ ε * g) (hD : ‖D‖ ≤ ε * g) + (u : L) (hu : ‖u‖ = 1) : + |blockBottom A D B - effectiveBottom (0 : L →L[ℝ] L) T B| ≤ 2 * g * ε ^ 3 := by + obtain ⟨p, hp, hmin⟩ := effectiveForm_minimizer (0 : L →L[ℝ] L) T B u hu + have hK (x : L) : inverseForm T B x ≤ inverseForm T B p * ‖x‖ ^ 2 := by + have h := hmin x + simp only [effectiveForm, zero_apply, inner_zero_right, zero_sub] at h + nlinarith + have hvalue := effectiveBottom_eq (0 : L →L[ℝ] L) T B p hp hmin + simp only [effectiveForm, zero_apply, inner_zero_right, zero_sub] at hvalue + rw [hvalue, sub_neg_eq_add] + exact blockBottom_second_order A T D B hg hε hεhalf hAT hAsymm hA hgap + hT hB hD hK p hp rfl + +end Perturbation +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/PhysicalGroundComparison.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/PhysicalGroundComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..90308a893f16b87bd72d8f005d96f952c9cc4e6e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/PhysicalGroundComparison.lean @@ -0,0 +1,96 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.ShiftedPhysicalForm +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.RayleighGround + +namespace OAI + +/-! Transfer manufactured-form estimates to the actual full-domain physical +ground energy. Inverse dilation covers every weak-H1 state; upper bounds use +positive-mass trial states and do not assume an attained continuum minimum. -/ + +noncomputable section +open scoped BigOperators +namespace ContinuumCoulomb + +section PhysicalComparison +variable {M n : ℕ} (nuc : Coulomb.Nuclei M) (W F : Position → ℝ) + {scale : ℝ} (hscale : 0 < scale) (offset : ℝ) + (hsplit : ∀ y, W y+F y = -scale⁻¹*Coulomb.attraction nuc y-offset) + (hI : ∀ w : Coulomb.H1Vector n, nuclearFormIntegrable F w) + +include hsplit hI + +theorem formGroundEnergy_dilated_lower (a : ℝ) + (hbound : ∀ w : Coulomb.H1Vector n, Coulomb.Antisymmetric w → + a*Coulomb.mass w ≤ + nuclearPerturbedForm (fun x => ∑ i, W (Coulomb.position x i)) F w+ + scale⁻¹*Coulomb.pairEnergy w) : + ((scale^2*(a+(n:ℝ)*offset):ℝ):EReal) ≤ + formGroundEnergy (dilatedNuclei nuc scale hscale.ne') n := by + apply formGroundEnergy_lower_of_forall + intro state hnorm + change Coulomb.mass state.val=1 at hnorm + let w := normalizedDilation state.val scale⁻¹ (inv_ne_zero hscale.ne') + have hw : Coulomb.Antisymmetric w := + normalizedDilation_antisymmetric state.val state.property _ _ + have hm : Coulomb.mass w=1 := + (mass_normalizedDilation state.val _ _).trans hnorm + have hinv : normalizedDilation w scale hscale.ne'=state.val := by + simpa only [w,inv_inv] using + normalizedDilation_inverse state.val scale⁻¹ (inv_ne_zero hscale.ne') + have hb := mul_le_mul_of_nonneg_left (hbound w hw) (sq_nonneg scale) + rw [hm,mul_one] at hb + have he := dilated_physicalForm_shift nuc W F hscale offset hsplit w (hI w) + rw [hinv,hm,mul_one] at he + nlinarith only [hb,he] + +theorem formGroundEnergy_dilated_trial (a : ℝ) (w : Coulomb.H1Vector n) + (hw : Coulomb.Antisymmetric w) (hm : 0 < Coulomb.mass w) + (hbound : nuclearPerturbedForm (fun x => ∑ i, W (Coulomb.position x i)) F w+ + scale⁻¹*Coulomb.pairEnergy w ≤ a*Coulomb.mass w) : + formGroundEnergy (dilatedNuclei nuc scale hscale.ne') n ≤ + ((scale^2*(a+(n:ℝ)*offset):ℝ):EReal) := by + let v := normalizedDilation w scale hscale.ne' + have hv := normalizedDilation_antisymmetric w hw scale hscale.ne' + have hmass : Coulomb.mass v=Coulomb.mass w := mass_normalizedDilation w _ _ + have hmv : 0 < Coulomb.mass v := by rw [hmass]; exact hm + apply (formGroundEnergy_le_rayleigh _ v hv hmv).trans + apply EReal.coe_le_coe + apply (div_le_iff₀ hmv).mpr + have he := dilated_physicalForm_shift nuc W F hscale offset hsplit w (hI w) + have hb := mul_le_mul_of_nonneg_left hbound (sq_nonneg scale) + change Coulomb.form _ v = _ at he + rw [hmass] + nlinarith only [hb,he] + +theorem formGroundEnergy_dilated_upper (a : ℝ) + (hnear : ∀ ε : ℝ, 0 < ε → ∃ w : Coulomb.H1Vector n, + Coulomb.Antisymmetric w ∧ 0 < Coulomb.mass w ∧ + nuclearPerturbedForm (fun x => ∑ i, W (Coulomb.position x i)) F w+ + scale⁻¹*Coulomb.pairEnergy w ≤ (a+ε)*Coulomb.mass w) : + formGroundEnergy (dilatedNuclei nuc scale hscale.ne') n ≤ + ((scale^2*(a+(n:ℝ)*offset):ℝ):EReal) := by + obtain ⟨w,hw,hm,_⟩ := hnear 1 zero_lt_one + have hfin := formGroundEnergy_finite_of_positive_mass + (dilatedNuclei nuc scale hscale.ne') (normalizedDilation w scale hscale.ne') + (normalizedDilation_antisymmetric w hw _ _) (by + rw [mass_normalizedDilation]; exact hm) + have hcoe := EReal.coe_toReal hfin.1 hfin.2 + rw [← hcoe] + apply EReal.coe_le_coe + apply le_of_forall_pos_le_add + intro ε hε + obtain ⟨v,hv,hmv,hb⟩ := hnear (ε/scale^2) (div_pos hε (sq_pos_of_pos hscale)) + have hu := formGroundEnergy_dilated_trial nuc W F hscale offset hsplit hI + (a+ε/scale^2) v hv hmv hb + have he : scale^2*(a+ε/scale^2+(n:ℝ)*offset) = scale^2*(a+(n:ℝ)*offset)+ε := by + field_simp [ne_of_gt hscale] + ring + rw [he,← hcoe] at hu + exact EReal.coe_le_coe_iff.mp hu + +end PhysicalComparison +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/PhysicalOneElectronLower.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/PhysicalOneElectronLower.lean new file mode 100644 index 0000000000000000000000000000000000000000..0fb25701bbf39707912b31ccf5445242dd07a3b9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/PhysicalOneElectronLower.lean @@ -0,0 +1,121 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.SplitIntegratedBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.ComplexFormSplit +import OAI.MathematicalPhysics.ContinuumCoulomb.Nuclei.SlabRegularity + +namespace OAI + +/-! +A finite-rank lower bound for the manufactured one-electron Coulomb +field, obtained from the planar and vertical spectral estimates. +-/ + +noncomputable section +open MeasureTheory +open scoped BigOperators +namespace ContinuumCoulomb + +def planarSpectralLevel (γ : ℝ) (m : ℕ) (D η : ℝ) : ℝ := + -1/2+γ-planarSiteDerivativeBound D^2- + γ*(1+η⁻¹)*m*planarSiteTailConstant*Real.exp (-(19/20:ℝ)*(D/8)) + +def verticalSpectralLevel (freq S η : ℝ) : ℝ := + 3*freq/2-verticalCutoffDerivativeBound S^2/2- + freq*(1+η⁻¹)*verticalCutoffTailConstant freq*Real.exp (-freq*S^2/8) + +def physicalSeparablePotential {m : ℕ} (u : Fin m → PlanarPosition) + (freq S : ℝ) (x : Position) : ℝ := + splitSeparablePotential u freq S (positionSplitCoordinates x) + +theorem physicalSeparablePotential_continuous {m : ℕ} (u : Fin m → PlanarPosition) + (freq S : ℝ) : Continuous (physicalSeparablePotential u freq S) := by + unfold physicalSeparablePotential splitSeparablePotential verticalCapPotential + exact (((planarWellSum_continuous u).comp positionSplitCoordinates.continuous.fst).add + ((continuous_const.mul ((positionSplitCoordinates.continuous.snd.pow 2).min continuous_const)))) + +theorem positionRealForm_mono_shift {V W : Position → ℝ} {ε : ℝ} + (hV : Continuous V) (hW : Continuous W) (hVW : ∀ x, W x-ε ≤ V x) + {f : Position → ℝ} (hf : ContDiff ℝ 1 f) (hc : HasCompactSupport f) : + positionRealForm W f-ε*(∫ x, f x^2) ≤ positionRealForm V f := by + have hsqc : HasCompactSupport (fun x => f x^2) := + hc.comp_left (g := fun t : ℝ => t^2) (by simp) + have hsq : Integrable (fun x => f x^2) := + (hf.continuous.pow 2).integrable_of_hasCompactSupport hsqc + have hi (U : Position → ℝ) (hU : Continuous U) : Integrable (fun x => U x*f x^2) := by + have hcU : HasCompactSupport (fun x => U x*f x^2) := hsqc.mul_left + exact (hU.mul (hf.continuous.pow 2)).integrable_of_hasCompactSupport hcU + have h := integral_mono ((hi W hW).sub (hsq.const_mul ε)) (hi V hV) + (fun x => by + change W x*f x^2-ε*f x^2 ≤ V x*f x^2 + nlinarith [mul_le_mul_of_nonneg_right (hVW x) (sq_nonneg (f x))]) + simp only [Pi.sub_apply] at h + rw [integral_sub (hi W hW) (hsq.const_mul ε),integral_const_mul] at h + unfold positionRealForm + linarith + +theorem physicalSeparable_test_lower + (hp : PlanarSobolev.ManufacturedPlanarGroundGap) + (hv : PublishedVerticalOscillatorGap) : + ∃ γ : ℝ, 0 < γ ∧ γ ≤ 1/4 ∧ ∀ (m : ℕ) (D η freq S : ℝ), + 8 ≤ D → 0 < η → 0 < freq → 0 < S → 3*freq/2 ≤ freq^2*S^2/8 → + ∀ u : Fin m → PlanarPosition, (∀ i j, i ≠ j → D ≤ ‖u i-u j‖) → + γ*(1+η)*(1+m*localizedOverlapBound D) ≤ freq*(1+η) → + ∀ f : Position → ℝ, ContDiff ℝ 1 f → HasCompactSupport f → + (planarSpectralLevel γ m D η+verticalSpectralLevel freq S η-freq*(1+η))*(∫ x, f x^2) - + γ*(1+η)*(∑ i, (∫ x, f x*continuumLocalizedMode freq (u i) x)^2) ≤ + positionRealForm (physicalSeparablePotential u freq S) f := by + obtain ⟨γ,hγ,hsmall,hbound⟩ := split_test_spectral_lower hp hv + refine ⟨γ,hγ,hsmall,fun m D η freq S hD hη hfreq hS hbarrier u hsep hdom f hf hc => ?_⟩ + have h := hbound m D η freq S hD hη hfreq hS hbarrier u hsep hdom + (splitPullback f) (splitPullback_contDiff hf) (splitPullback_compact hc) + rw [← splitSeparableForm_eq u freq S (splitPullback_contDiff hf) (splitPullback_compact hc)] at h + have hpot : (fun p => physicalSeparablePotential u freq S (positionSplitCoordinates.symm p)) = + splitSeparablePotential u freq S := by + funext p + simp only [physicalSeparablePotential,ContinuousLinearEquiv.apply_symm_apply] + rw [← hpot,splitPullback_form _ hf] at h + have hm : (∫ p, splitPullback f p^2) = ∫ x, f x^2 := splitPullback_integral (fun x => f x^2) + have ho (i : Fin m) : (∫ p, splitPullback f p*localizedMode freq (u i) p) = + ∫ x, f x*continuumLocalizedMode freq (u i) x := by + rw [← positionSplitCoordinates_integral (fun p => splitPullback f p*localizedMode freq (u i) p)] + simp only [splitPullback,ContinuousLinearEquiv.symm_apply_apply,continuumLocalizedMode] + rw [hm] at h + simp_rw [ho] at h + exact h + +/-- The actual Coulomb slab and compact counterterm well field have the +same lower bound, up to the proved finite-slab and counterterm errors. -/ +theorem manufacturedSlab_test_lower + (hp : PlanarSobolev.ManufacturedPlanarGroundGap) + (hv : PublishedVerticalOscillatorGap) : + ∃ γ : ℝ, 0 < γ ∧ γ ≤ 1/4 ∧ ∀ (m : ℕ) (D η freq S rho H scale δ : ℝ), + 8 ≤ D → 0 < η → 0 < freq → 0 < S → 0 ≤ rho → 0 < H → 0 ≤ scale → 0 ≤ δ → + freq^2 = 4*Real.pi*rho → 3*freq/2 ≤ freq^2*S^2/8 → + ∀ u : Fin m → PlanarPosition, (∀ i j, i ≠ j → D ≤ ‖u i-u j‖) → + (∀ i, 0 ≤ localizedCounterterm freq u i/scale ∧ localizedCounterterm freq u i/scale ≤ δ) → + γ*(1+η)*(1+m*localizedOverlapBound D) ≤ freq*(1+η) → + ∀ f : Position → ℂ, ContDiff ℝ 1 f → HasCompactSupport f → + (planarSpectralLevel γ m D η+verticalSpectralLevel freq S η-freq*(1+η)- + (δ*PlanarSobolev.wellBound+6*Real.pi*rho*S^3/H))*(∫ x, ‖f x‖^2) - + γ*(1+η)*(∑ i, ‖∫ x, f x*(continuumLocalizedMode freq (u i) x : ℂ)‖^2) ≤ + positionComplexForm (manufacturedSlabPotential rho H S freq scale u) f := by + obtain ⟨γ,hγ,hsmall,hbound⟩ := physicalSeparable_test_lower hp hv + refine ⟨γ,hγ,hsmall,fun m D η freq S rho H scale δ hD hη hfreq hS hrho hH hscale hδ + hrelation hbarrier u hsep hcoeff hdom f hf hc => ?_⟩ + have hseparate (i j : Fin m) (hij : i ≠ j) : 2 ≤ ‖u i-u j‖ := by + linarith [hsep i j hij] + apply real_form_lower_to_complex _ (manufacturedSlabPotential_continuous hrho hH.le hS.le _ _ u) + (fun i => continuumLocalizedMode freq (u i)) + (fun i => continuumLocalizedMode_memLp hfreq (u i)) _ _ ?_ f hf hc + intro g hg hgc + have hs := hbound m D η freq S hD hη hfreq hS hbarrier u hsep hdom g hg hgc + have hvw := positionRealForm_mono_shift + (manufacturedSlabPotential_continuous hrho hH.le hS.le _ _ u) + (physicalSeparablePotential_continuous u freq S) + (manufacturedSlabPotential_lower hrho hH hS.le hscale hrelation u hseparate hδ hcoeff) hg hgc + nlinarith + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/PhysicalThreshold.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/PhysicalThreshold.lean new file mode 100644 index 0000000000000000000000000000000000000000..27870cc5218e2187498678a48c40fac8a459e6bb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/PhysicalThreshold.lean @@ -0,0 +1,118 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.SlabOriginProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.GaussianFrequencyProgram + +namespace OAI + +/-! Canonical rational thresholds with the physical energy offset. The +finite-model threshold is multiplied by lambda, while the one-particle +reference energy is multiplied by lambda squared times the electron count. -/ + +noncomputable section +namespace ContinuumCoulomb.PhysicalThreshold + +abbrev Geometry := ℕ × (ℕ × ℕ) +abbrev Input := Geometry × (ℕ × (ℕ × (ℚ × ℚ))) + +def amplification (rho mesh : ℕ) : ℚ := 8*(mesh:ℚ)^3/rho + +def precision (x : Input) : ℕ := + 8*(8*x.1.1^3+1)^2*(x.2.1+1)*(x.2.2.1+1) + +def reference (rho : ℕ) (x : Input) : ℚ := + SlabOriginSchedule.value rho (precision x,x.1.2)+ + (GaussianFrequency.approximate rho (precision x)-1)/2 + +def offset (rho : ℕ) (x : Input) : ℚ := + amplification rho x.1.1^2*x.2.1*reference rho x + +def value (rho : ℕ) (x : Input) : ℚ×ℚ := + (offset rho x+amplification rho x.1.1*x.2.2.2.1, + offset rho x+amplification rho x.1.1*x.2.2.2.2) + +def actualReference (rho H S : ℕ) : ℝ := + slabPotential (rho:ℝ) (H:ℝ) (S:ℝ) 0+(GaussianFrequency.frequency rho-1)/2 + +def actualOffset (rho : ℕ) (x : Input) : ℝ := + (amplification rho x.1.1:ℝ)^2*(x.2.1:ℝ)*actualReference rho x.1.2.1 x.1.2.2 + +theorem reference_error (rho : ℕ) (x : Input) : + |(reference rho x:ℝ)-actualReference rho x.1.2.1 x.1.2.2| ≤ + 2/(precision x+1:ℝ) := by + have hs := SlabOriginSchedule.error rho (precision x,x.1.2) + have hf := GaussianFrequency.approximation_error rho (precision x) + have he : (reference rho x:ℝ)-actualReference rho x.1.2.1 x.1.2.2 = + ((SlabOriginSchedule.value rho (precision x,x.1.2):ℝ)- + slabPotential (rho:ℝ) (x.1.2.1:ℝ) (x.1.2.2:ℝ) 0)+ + ((GaussianFrequency.approximate rho (precision x):ℝ)-GaussianFrequency.frequency rho)/2 := by + simp only [reference,actualReference,Rat.cast_add,Rat.cast_sub,Rat.cast_div,Rat.cast_one, + Rat.cast_ofNat] + ring + rw [he] + apply (abs_add_le _ _).trans + rw [abs_div,abs_of_pos (by norm_num : (0:ℝ) < 2)] + have hn : 0 ≤ ((precision x:ℝ)+1)⁻¹ := by positivity + dsimp only [Prod.fst,Prod.snd] at hs + simp only [div_eq_mul_inv] at hs ⊢ + nlinarith + +theorem amplification_bound (rho mesh : ℕ) (hrho : 0 < rho) : + 0 ≤ (amplification rho mesh:ℝ) ∧ (amplification rho mesh:ℝ) ≤ 8*(mesh:ℝ)^3 := by + have hp : 0 < (rho:ℝ) := by exact_mod_cast hrho + have h1 : 1 ≤ (rho:ℝ) := by exact_mod_cast (Nat.succ_le_iff.mpr hrho) + simp only [amplification,Rat.cast_div,Rat.cast_mul,Rat.cast_ofNat,Rat.cast_pow,Rat.cast_natCast] + constructor + · positivity + · exact div_le_self (by positivity) h1 + +theorem offset_error (rho : ℕ) (hrho : 0 < rho) (x : Input) : + |(offset rho x:ℝ)-actualOffset rho x| ≤ 1/(x.2.2.1+1:ℝ) := by + have he := reference_error rho x + have ha := amplification_bound rho x.1.1 hrho + have hsq : (amplification rho x.1.1:ℝ)^2 ≤ (8*(x.1.1:ℝ)^3+1)^2 := by + nlinarith + have hcoef : (amplification rho x.1.1:ℝ)^2*(x.2.1:ℝ)*2 ≤ + 8*(8*(x.1.1:ℝ)^3+1)^2*((x.2.1:ℝ)+1) := by + have ht := mul_le_mul_of_nonneg_right hsq (Nat.cast_nonneg x.2.1) + nlinarith [sq_nonneg (8*(x.1.1:ℝ)^3+1)] + have hprec : (precision x:ℝ) = + 8*(8*(x.1.1:ℝ)^3+1)^2*((x.2.1:ℝ)+1)*((x.2.2.1:ℝ)+1) := by + simp [precision] + have hden : 0 < (precision x:ℝ)+1 := by positivity + have hp : 0 < (x.2.2.1:ℝ)+1 := by positivity + have hprod : (amplification rho x.1.1:ℝ)^2*(x.2.1:ℝ)*2*((x.2.2.1:ℝ)+1) ≤ + (precision x:ℝ)+1 := by + rw [hprec] + nlinarith [mul_le_mul_of_nonneg_right hcoef hp.le] + have hid : (offset rho x:ℝ)-actualOffset rho x = + (amplification rho x.1.1:ℝ)^2*(x.2.1:ℝ)* + ((reference rho x:ℝ)-actualReference rho x.1.2.1 x.1.2.2) := by + simp only [offset,actualOffset,Rat.cast_mul,Rat.cast_pow,Rat.cast_natCast] + ring + rw [hid,abs_mul,abs_of_nonneg (by positivity : 0 ≤ (amplification rho x.1.1:ℝ)^2*(x.2.1:ℝ))] + apply (mul_le_mul_of_nonneg_left he (by positivity)).trans + apply (le_div_iff₀ hp).mpr + calc + _ = ((amplification rho x.1.1:ℝ)^2*(x.2.1:ℝ)*2* + ((x.2.2.1:ℝ)+1))/((precision x:ℝ)+1) := by ring + _ ≤ 1 := (div_le_one hden).mpr hprod + +theorem lower_error (rho : ℕ) (hrho : 0 < rho) (x : Input) : + |((value rho x).1:ℝ)-(actualOffset rho x+ + (amplification rho x.1.1:ℝ)*(x.2.2.2.1:ℝ))| ≤ 1/(x.2.2.1+1:ℝ) := by + simpa only [value,Rat.cast_add,Rat.cast_mul,add_sub_add_right_eq_sub] using offset_error rho hrho x + +theorem upper_error (rho : ℕ) (hrho : 0 < rho) (x : Input) : + |((value rho x).2:ℝ)-(actualOffset rho x+ + (amplification rho x.1.1:ℝ)*(x.2.2.2.2:ℝ))| ≤ 1/(x.2.2.1+1:ℝ) := by + simpa only [value,Rat.cast_add,Rat.cast_mul,add_sub_add_right_eq_sub] using offset_error rho hrho x + +theorem gap (rho : ℕ) (x : Input) : + (value rho x).2-(value rho x).1 = amplification rho x.1.1*(x.2.2.2.2-x.2.2.2.1) := by + unfold value + ring + +end ContinuumCoulomb.PhysicalThreshold + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/PhysicalThresholdOutput.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/PhysicalThresholdOutput.lean new file mode 100644 index 0000000000000000000000000000000000000000..d3538096788242ca5f28f417a1054f8eabd94108 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/PhysicalThresholdOutput.lean @@ -0,0 +1,64 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.PhysicalThresholdProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.UnitCoulombProgram + +namespace OAI + +/-! Composition of the actual physical-nucleus generator with the computed +slab/reference threshold shift, using the continuum promise's canonical codec. -/ + +namespace ContinuumCoulomb.PhysicalThresholdOutput +open ExactQuantumFactoring.BitStackProgram + +abbrev Input := PhysicalNuclearProgram.Input × PhysicalThreshold.Input + +def inputCode : Input → List Bool := + prodCode PhysicalNuclearProgram.inputCode PhysicalThreshold.inputCode + +def argument (rho : ℕ) (x : Input) : UnitCoulombProgram.Input := + (x.1,(x.2.2.1,PhysicalThreshold.value rho x.2)) + +noncomputable def value (rho U C K : ℕ) (x : Input) : UnitCoulomb := + UnitCoulombProgram.value rho U C K (argument rho x) + +noncomputable opaque argumentProgram (rho : ℕ) : + Procedure inputCode UnitCoulombProgram.inputCode (argument rho) := by + let geom := Procedure.first PhysicalNuclearProgram.inputCode PhysicalThreshold.inputCode + let numbers := Procedure.second PhysicalNuclearProgram.inputCode PhysicalThreshold.inputCode + let count := PhysicalThreshold.electronsProgram.comp numbers + let endpoints := (PhysicalThreshold.program rho).comp numbers + exact geom.pair (count.pair endpoints) + +noncomputable opaque program (rho U C K : ℕ) : + Procedure inputCode unitCoulombCodec.encode (value rho U C K) := + (UnitCoulombProgram.program rho U C K).comp (argumentProgram rho) + +noncomputable def certificate (rho U C K : ℕ) : + Turing.TM2ComputableInPolyTime inputCode unitCoulombCodec.encode (value rho U C K) := + (program rho U C K).toTM2 + +theorem electrons (rho U C K : ℕ) (x : Input) : + (value rho U C K x).electrons = x.2.2.1 := rfl + +theorem nuclei (rho U C K : ℕ) (x : Input) : + (value rho U C K x).nuclei = PhysicalNuclearProgram.nuclei rho U C K x.1 := rfl + +theorem lower (rho U C K : ℕ) (x : Input) : + (value rho U C K x).lower.value = (PhysicalThreshold.value rho x.2).1 := + NuclearCoordinateOutput.rational_value _ + +theorem upper (rho U C K : ℕ) (x : Input) : + (value rho U C K x).upper.value = (PhysicalThreshold.value rho x.2).2 := + NuclearCoordinateOutput.rational_value _ + +theorem valid (rho U C K : ℕ) (x : Input) (hne : 0 < x.2.2.1) + (hpositions : ((PhysicalNuclearProgram.nuclei rho U C K x.1).map BinaryPosition.value).Nodup) + (hgap : (1:ℚ) ≤ PhysicalThreshold.amplification rho x.2.1.1* + (x.2.2.2.2.2-x.2.2.2.2.1)) : (value rho U C K x).Valid := by + apply UnitCoulombProgram.valid rho U C K (argument rho x) hne hpositions + change (1:ℚ) ≤ (PhysicalThreshold.value rho x.2).2-(PhysicalThreshold.value rho x.2).1 + rw [PhysicalThreshold.gap] + exact hgap + +end ContinuumCoulomb.PhysicalThresholdOutput + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/PublishedFlowInput.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/PublishedFlowInput.lean new file mode 100644 index 0000000000000000000000000000000000000000..a7f862b569d90ca20134e11956857344484939df --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/PublishedFlowInput.lean @@ -0,0 +1,57 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Nuclei.MoserDerivatives +import Mathlib.Topology.Algebra.Module.Determinant + +namespace OAI + +/-! The finite-dimensional ODE input used by the transport step. + +Gerald Teschl, Ordinary Differential Equations and Dynamical Systems, +AMS GSM 140 (2012), Theorem 2.10, equations (2.49)--(2.51), Lemma 2.7, +and Lemma 3.11. We retain only dimension three, four spatial derivatives, +and the closed time interval [0,1]. Uniform derivative bounds follow by +applying Gronwall to the four variational equations. +-/ + +noncomputable section +open scoped BigOperators +namespace ContinuumCoulomb + +def flowJacobian (G : Position → ℝ → Position) (t : ℝ) (x : Position) : ℝ := + (fderiv ℝ (fun y => G y t) x).det + +def fieldDivergence (v : Position → Position) (x : Position) : ℝ := + ∑ a : Fin 3, NeutralAtom.dirPartial (fun y => v y a) (NeutralAtom.axis a) x + +def IsUnitTimeFlow (v : ℝ → Position → Position) (G : Position → ℝ → Position) : Prop := + (∀ x, G x 0 = x) ∧ + ∀ x t, t ∈ Set.Icc (0 : ℝ) 1 → + HasDerivWithinAt (G x) (v t (G x t)) (Set.Icc (0 : ℝ) 1) t + +/-- Smooth dependence, Liouville's equation and a uniform finite-order variational estimate. -/ +structure PublishedC4FlowInput : Prop where + regularity : ∀ (U : Set (ℝ × Position)), IsOpen U → + Set.Icc (0 : ℝ) 1 ×ˢ (Set.univ : Set Position) ⊆ U → + ∀ v : ℝ → Position → Position, + ContDiffOn ℝ 4 (fun p : ℝ × Position => v p.1 p.2) U → + ∀ G : Position → ℝ → Position, IsUnitTimeFlow v G → + (∀ t ∈ Set.Icc (0 : ℝ) 1, ContDiff ℝ 4 (fun x => G x t)) ∧ + (∀ x t, t ∈ Set.Icc (0 : ℝ) 1 → + HasDerivWithinAt (fun s => flowJacobian G s x) + (fieldDivergence (v t) (G x t) * flowJacobian G t x) + (Set.Icc (0 : ℝ) 1) t) + uniform : ∀ B : ℝ, 0 ≤ B → ∃ C : ℝ, 0 < C ∧ + ∀ (U : Set (ℝ × Position)), IsOpen U → + Set.Icc (0 : ℝ) 1 ×ˢ (Set.univ : Set Position) ⊆ U → + ∀ v : ℝ → Position → Position, + ContDiffOn ℝ 4 (fun p : ℝ × Position => v p.1 p.2) U → + (∀ r ≤ 4, ∀ t ∈ Set.Icc (0 : ℝ) 1, ∀ x, + ‖iteratedFDeriv ℝ r (fun p : ℝ × Position => v p.1 p.2) (t,x)‖ ≤ B) → + ∀ G : Position → ℝ → Position, IsUnitTimeFlow v G → + ∀ r : ℕ, 1 ≤ r → r ≤ 4 → ∀ t ∈ Set.Icc (0 : ℝ) 1, ∀ x, + ‖iteratedFDeriv ℝ r (fun y => G y t) x‖ ≤ C + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/PublishedInputs.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/PublishedInputs.lean new file mode 100644 index 0000000000000000000000000000000000000000..4ee0b600afda346b4dba43f4cc803ae2e567e2ca --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/PublishedInputs.lean @@ -0,0 +1,126 @@ +import Mathlib.Basic.Real.Basic +import Mathlib.Tactic.FieldSimp +import Mathlib.Tactic.Linarith +import Mathlib.Tactic.Positivity +import Mathlib.Tactic.Ring + +namespace OAI + +/-! +# Rational normalization and complement square completion + +Both continuum Coulomb manuscripts use the field-free signed square-lattice +Heisenberg problem of Cubitt, Montanaro and Piddock, *Universal quantum +Hamiltonians*, PNAS 115 (2018), 9497–9502; the theorem identifiers are +Theorem 48, Lemma 47 and Section 10.1 of arXiv:1701.05182v4 (2019). +Rational normalization transfers coefficient approximation bounds to its +thresholds. Scalar square completion bounds the continuum complement. +-/ + +namespace ContinuumCoulomb + +/-- Lower threshold after rounding and removing a scalar identity term. -/ +def normalizedSourceLower (aRound cRound ε : ℝ) : ℝ := + aRound - cRound + 5 * ε + +/-- Upper threshold after rounding and removing a scalar identity term. -/ +def normalizedSourceUpper (bRound cRound ε : ℝ) : ℝ := + bRound - cRound - 5 * ε + +/-- The `3ε` Hamiltonian error and two scalar rounding errors preserve YES. -/ +theorem normalizedSource_yes + {energy roundedEnergy a c aRound cRound ε : ℝ} + (henergy : |roundedEnergy - (energy - c)| ≤ 3 * ε) + (ha : |aRound - a| ≤ ε) (hc : |cRound - c| ≤ ε) + (hyes : energy ≤ a) : + roundedEnergy ≤ normalizedSourceLower aRound cRound ε := by + obtain ⟨_, henergy'⟩ := abs_le.mp henergy + obtain ⟨ha', _⟩ := abs_le.mp ha + obtain ⟨_, hc'⟩ := abs_le.mp hc + unfold normalizedSourceLower + linarith + +/-- The same errors preserve NO with the inward-adjusted upper threshold. -/ +theorem normalizedSource_no + {energy roundedEnergy b c bRound cRound ε : ℝ} + (henergy : |roundedEnergy - (energy - c)| ≤ 3 * ε) + (hb : |bRound - b| ≤ ε) (hc : |cRound - c| ≤ ε) + (hno : b ≤ energy) : + normalizedSourceUpper bRound cRound ε ≤ roundedEnergy := by + obtain ⟨henergy', _⟩ := abs_le.mp henergy + obtain ⟨_, hb'⟩ := abs_le.mp hb + obtain ⟨hc', _⟩ := abs_le.mp hc + unfold normalizedSourceUpper + linarith + +/-- The rounded source gap loses at most `12ε`. -/ +theorem normalizedSource_gap + {a b aRound bRound cRound ε : ℝ} + (ha : |aRound - a| ≤ ε) (hb : |bRound - b| ≤ ε) : + b - a - 12 * ε ≤ + normalizedSourceUpper bRound cRound ε - + normalizedSourceLower aRound cRound ε := by + obtain ⟨_, ha'⟩ := abs_le.mp ha + obtain ⟨hb', _⟩ := abs_le.mp hb + unfold normalizedSourceLower normalizedSourceUpper + linarith + +/-- The manuscripts' choice `ε = δ / 100` retains at least `22δ/25`. -/ +theorem normalizedSource_gap_fraction + {a b aRound bRound cRound δ : ℝ} + (hgap : δ ≤ b - a) + (ha : |aRound - a| ≤ δ / 100) + (hb : |bRound - b| ≤ δ / 100) : + 22 * δ / 25 ≤ + normalizedSourceUpper bRound cRound (δ / 100) - + normalizedSourceLower aRound cRound (δ / 100) := by + have h := normalizedSource_gap (cRound := cRound) ha hb + linarith + +/-- In particular the rational source normalization leaves a positive gap. -/ +theorem normalizedSource_gap_pos + {a b aRound bRound cRound δ : ℝ} + (hδ : 0 < δ) (hgap : δ ≤ b - a) + (ha : |aRound - a| ≤ δ / 100) + (hb : |bRound - b| ≤ δ / 100) : + normalizedSourceLower aRound cRound (δ / 100) < + normalizedSourceUpper bRound cRound (δ / 100) := by + have h := normalizedSource_gap_fraction (cRound := cRound) hgap ha hb + linarith + +/-- Exact scalar square completion in the continuum-complement estimate. -/ +theorem complement_square_completion + (c β p q : ℝ) (hc : 0 < c) : + -(2 * β ^ 2 / c) * p ^ 2 + c / 2 * q ^ 2 ≤ + c * q ^ 2 - 2 * β * p * q := by + have hsq : 0 ≤ (c * q - 2 * β * p) ^ 2 / (2 * c) := + div_nonneg (sq_nonneg _) (by positivity) + have hid : + c * q ^ 2 - 2 * β * p * q - + (-(2 * β ^ 2 / c) * p ^ 2 + c / 2 * q ^ 2) = + (c * q - 2 * β * p) ^ 2 / (2 * c) := by + field_simp + ring + linarith + +/-- The square completion gives the lower energy bound on a normalized +decomposition, once its low block, high block and mixed term are controlled. +This is the scalar step of `lem:continuum-elimination` in the binary-charge +manuscript and `prop:complement` in the unit-charge manuscript. -/ +theorem complement_energy_lower + {c β p q E low high mixed : ℝ} + (hc : 0 < c) (hE : E ≤ c / 2) + (hnorm : p ^ 2 + q ^ 2 = 1) + (hlow : E * p ^ 2 ≤ low) + (hhigh : c * q ^ 2 ≤ high) + (hmixed : -(2 * β * p * q) ≤ mixed) : + E - 2 * β ^ 2 / c ≤ low + high + mixed := by + have hs := complement_square_completion c β p q hc + have hβ : 0 ≤ 2 * β ^ 2 / c := by positivity + have hq : 0 ≤ (c / 2 - E + 2 * β ^ 2 / c) * q ^ 2 := + mul_nonneg (by linarith) (sq_nonneg _) + nlinarith + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/Rationalization.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/Rationalization.lean new file mode 100644 index 0000000000000000000000000000000000000000..80aa8ef37d05e011677c477b54d30c3e1661cb49 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/Rationalization.lean @@ -0,0 +1,111 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Nuclei.NuclearCoordinates +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.FormStability + +namespace OAI + +/-! +# Rational nuclear output with a ground-energy error budget + +Coordinate rounding controls the full Coulomb variational infimum while +retaining the nuclear charges, nuclei count and electron number. +-/ + +noncomputable section +namespace ContinuumCoulomb + +/-- Rational nuclear data produced from real centers and integral charges. -/ +def rationalizeNuclei {m : ℕ} (S : Coulomb.Nuclei m) (n : ℕ) (hn : 0 < n) + (charge : Fin m → ℕ) (hcharge : ∀ a, (charge a : ℝ) = S.charge a) + (denominator : ℕ) (hdenom : 0 < denominator) + (hsep : ∀ i j, i ≠ j → 6 / (denominator : ℝ) < ‖S.position i - S.position j‖) : + NuclearData where + nuclei := m + nuclei_pos := S.nonempty + position := fun a => roundPosition denominator (S.position a) + distinct := roundPosition_injective hdenom S.position hsep + charge := charge + charge_pos := by + intro a + have h : (0 : ℝ) < (charge a : ℝ) := by + rw [hcharge] + exact lt_of_lt_of_le (by norm_num) (S.charge_ge_one a) + exact_mod_cast h + electrons := n + electrons_pos := hn + +theorem rationalizeNuclei_charge {m n denominator : ℕ} (S : Coulomb.Nuclei m) + (hn : 0 < n) (charge : Fin m → ℕ) (hcharge : ∀ a, (charge a : ℝ) = S.charge a) + (hdenom : 0 < denominator) + (hsep : ∀ i j, i ≠ j → 6 / (denominator : ℝ) < ‖S.position i - S.position j‖) : + (rationalizeNuclei S n hn charge hcharge denominator hdenom hsep).toNuclei.charge = + S.charge := by + funext a + exact hcharge a + +theorem rationalizeNuclei_position_error {m n denominator : ℕ} (S : Coulomb.Nuclei m) + (hn : 0 < n) (charge : Fin m → ℕ) (hcharge : ∀ a, (charge a : ℝ) = S.charge a) + (hdenom : 0 < denominator) + (hsep : ∀ i j, i ≠ j → 6 / (denominator : ℝ) < ‖S.position i - S.position j‖) + (a : Fin m) : + ‖S.position a - + (rationalizeNuclei S n hn charge hcharge denominator hdenom hsep).toNuclei.position a‖ ≤ + 3 / (denominator : ℝ) := by + rw [norm_sub_rev] + exact roundPosition_error hdenom (S.position a) + +/-- The rounded output has distinct rational positions and the same integer +charges, and its true fermionic bottom changes by at most the stated budget. -/ +theorem rationalizeNuclei_groundEnergy_error {m n denominator : ℕ} (S : Coulomb.Nuclei m) + (hn : 0 < n) (charge : Fin m → ℕ) (hcharge : ∀ a, (charge a : ℝ) = S.charge a) + (hdenom : 0 < denominator) + (hsep : ∀ i j, i ≠ j → 6 / (denominator : ℝ) < ‖S.position i - S.position j‖) + (trial : FormState n) (htrial : normSq trial = 1) + (hsmall : 96 * Coulomb.totalCharge S / (denominator : ℝ) ≤ 1) : + |(groundEnergy (rationalizeNuclei S n hn charge hcharge denominator hdenom hsep)).toReal - + (formGroundEnergy S n).toReal| ≤ + 96 * Coulomb.totalCharge S / (denominator : ℝ) * + (Coulomb.form S trial.val + 4 * (n : ℝ) * Coulomb.totalCharge S ^ 2) := by + have hfactor : 32 * (3 / (denominator : ℝ)) * Coulomb.totalCharge S = + 96 * Coulomb.totalCharge S / (denominator : ℝ) := by ring + rw [groundEnergy_eq_formGroundEnergy] + change |(formGroundEnergy + (rationalizeNuclei S n hn charge hcharge denominator hdenom hsep).toNuclei n).toReal - + (formGroundEnergy S n).toReal| ≤ _ + have h := formGroundEnergy_position_stability_trial S + (rationalizeNuclei S n hn charge hcharge denominator hdenom hsep).toNuclei + trial htrial (by positivity : (0 : ℝ) ≤ 3 / (denominator : ℝ)) + (rationalizeNuclei_charge S hn charge hcharge hdenom hsep).symm + (rationalizeNuclei_position_error S hn charge hcharge hdenom hsep) + (by simpa only [hfactor] using hsmall) + rw [hfactor] at h + exact h + +/-- In the unit-charge case the output uses the unit-charge input structure. -/ +def rationalizeUnitNuclei {m : ℕ} (S : Coulomb.Nuclei m) (n : ℕ) (hn : 0 < n) + (denominator : ℕ) (hdenom : 0 < denominator) + (hsep : ∀ i j, i ≠ j → 6 / (denominator : ℝ) < ‖S.position i - S.position j‖) : + UnitNuclearData where + nuclei := m + nuclei_pos := S.nonempty + position := fun a => roundPosition denominator (S.position a) + distinct := roundPosition_injective hdenom S.position hsep + electrons := n + electrons_pos := hn + +theorem rationalizeUnitNuclei_groundEnergy_error {m n denominator : ℕ} (S : Coulomb.Nuclei m) + (hn : 0 < n) (hunit : ∀ a, S.charge a = 1) (hdenom : 0 < denominator) + (hsep : ∀ i j, i ≠ j → 6 / (denominator : ℝ) < ‖S.position i - S.position j‖) + (trial : FormState n) (htrial : normSq trial = 1) + (hsmall : 96 * Coulomb.totalCharge S / (denominator : ℝ) ≤ 1) : + |(unitGroundEnergy (rationalizeUnitNuclei S n hn denominator hdenom hsep)).toReal - + (formGroundEnergy S n).toReal| ≤ + 96 * Coulomb.totalCharge S / (denominator : ℝ) * + (Coulomb.form S trial.val + 4 * (n : ℝ) * Coulomb.totalCharge S ^ 2) := by + exact rationalizeNuclei_groundEnergy_error S hn (fun _ => 1) + (fun a => by simpa using (hunit a).symm) hdenom hsep trial htrial hsmall + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/RemainingInputsHardness.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/RemainingInputsHardness.lean new file mode 100644 index 0000000000000000000000000000000000000000..e7586092e732366635d0a5c112f2066a030e2d21 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/RemainingInputsHardness.lean @@ -0,0 +1,36 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.ConditionalHardness +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.SobolevDensity + +namespace OAI + +/-! +Continuum Coulomb hardness under the planar spectral, vertical +spectral, flow and finite-spin hardness hypotheses. +-/ + +noncomputable section +namespace ContinuumCoulomb + +theorem unit_coulomb_qmaHard_of_remaining_inputs + (hcmp : PublishedCMPHardness) + (hp : PlanarSobolev.PublishedNegativePlanarGroundGap) + (hv : PublishedVerticalOscillatorGap) (hflow : PublishedC4FlowInput) : + QMAHard unitCoulombCodec.encode unitCoulombPromise := by + obtain ⟨s,_hs,hsource⟩ := hcmp + obtain ⟨reduction⟩ := exists_source_unit_reduction_without_hydrogen hflow hp hv + publishedSobolevSmoothDensity s + exact hsource.of_reduction reduction + +theorem binary_coulomb_qmaHard_of_remaining_inputs + (hcmp : PublishedCMPHardness) + (hp : PlanarSobolev.PublishedNegativePlanarGroundGap) + (hv : PublishedVerticalOscillatorGap) (hflow : PublishedC4FlowInput) : + QMAHard binaryCoulombCodec.encode binaryCoulombPromise := + UnitBinaryProgram.binary_hard_of_unit + (unit_coulomb_qmaHard_of_remaining_inputs hcmp hp hv hflow) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceBondLists.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceBondLists.lean new file mode 100644 index 0000000000000000000000000000000000000000..763aab058d4c022c3edfaf603132a681154c3ad4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceBondLists.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceZeroFilter +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceMatrix + +namespace OAI + +/-! Complete matrix semantics for the literal bond registers. Removing zero +terms preserves the actual Hamiltonian, while valid bounded indices give +the exact finite family used in the mediator comparison. -/ + +noncomputable section +namespace ContinuumCoulomb.SourceBondLists +open Matrix MediatorIteration MediatorListProgram +open scoped BigOperators + +def bondMatrix (n : ℕ) (e : Bond) : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ := + if h : e.1 < n ∧ e.2.1 < n then (e.2.2 : ℂ) • + sourceHeisenbergMatrix n ⟨e.1, h.1⟩ ⟨e.2.1, h.2⟩ else 0 + +def matrix (n : ℕ) (xs : List Bond) : Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ := + (xs.map (bondMatrix n)).sum + +theorem bondMatrix_zero (n : ℕ) (e : Bond) (he : e.2.2 = 0) : bondMatrix n e = 0 := by + unfold bondMatrix + split <;> simp only [he, Rat.cast_zero, zero_smul] + +theorem filter_matrix (n : ℕ) (xs : List Bond) : + matrix n (xs.filter SourceZeroFilter.keep) = matrix n xs := by + induction xs with + | nil => rfl + | cons e xs ih => + by_cases h : e.2.2 = 0 + · have hk : ¬SourceZeroFilter.keep e := by simp [SourceZeroFilter.keep, h] + rw [List.filter_cons_of_neg hk] + simp only [matrix, List.map_cons, List.sum_cons, bondMatrix_zero n e h, zero_add] at * + exact ih + · have hk : SourceZeroFilter.keep e := by simp [SourceZeroFilter.keep, h] + rw [List.filter_cons_of_pos hk] + simp only [matrix, List.map_cons, List.sum_cons] at * + rw [ih] + +def bounded (n : ℕ) (xs : List Bond) : Prop := ∀ e ∈ xs, e.1 < n ∧ e.2.1 < n + +def bonds (n : ℕ) (xs : List Bond) (h : bounded n xs) : Bonds n xs.length where + left i := ⟨(xs.get i).1, (h _ (List.get_mem xs i)).1⟩ + right i := ⟨(xs.get i).2.1, (h _ (List.get_mem xs i)).2⟩ + weight i := (xs.get i).2.2 + +theorem matrix_bonds (n : ℕ) (xs : List Bond) (h : bounded n xs) : + matrix n xs = (bonds n xs h).matrix := by + have hlist : xs.map (bondMatrix n) = List.ofFn (fun i : Fin xs.length => bondMatrix n (xs.get i)) := by + simpa only [List.get_eq_getElem] using (List.ofFn_getElem_eq_map xs (bondMatrix n)).symm + rw [matrix, hlist, List.sum_ofFn] + unfold Bonds.matrix sourceGraphMatrix + apply Finset.sum_congr rfl + intro i _ + rw [bondMatrix, dite_eq_left (h _ (List.get_mem xs i))] + simp only [bonds, Complex.ofReal_ratCast] + +theorem filter_bounded (n : ℕ) (xs : List Bond) (h : bounded n xs) : + bounded n (xs.filter SourceZeroFilter.keep) := by + intro e he + exact h e (List.mem_filter.mp he).1 + +theorem bonds_noLoops (n : ℕ) (xs : List Bond) (h : bounded n xs) + (hloop : ∀ e ∈ xs, e.1 ≠ e.2.1) : (bonds n xs h).NoLoops := by + intro i hi + exact hloop _ (List.get_mem xs i) (congrArg Fin.val hi) + +end ContinuumCoulomb.SourceBondLists + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceCalibratedGeometry.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceCalibratedGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..2af7e74fbca1e6b70a4a46a3f07266f1f2831cee --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceCalibratedGeometry.lean @@ -0,0 +1,69 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.ContactCalibration +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceGeometryBounds + +namespace OAI + +/-! The literal rounded source, rather than an arbitrary bounded graph, +admits one common polynomial calibration scale and polynomial coordinate +extent. The scale exponent may also meet any fixed analytic lower bound. -/ + +noncomputable section +open scoped BigOperators +namespace ContinuumCoulomb.SourceMetadataProgram +open ContactMediator MediatorIteration + +def calibrationSize (d : BinaryHeisenberg) : ℝ := + (binaryHeisenbergCodec.encode d).length + 2 + +abbrev geometricWeight (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) := + (finalGraph (geometricSource k d h).bonds + (roundingDenominator k d + size d ^ k + 1) (size d ^ k)).weight + +abbrev geometricGraph (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) := + finalGraph (geometricSource k d h).bonds + (roundingDenominator k d + size d ^ k + 1) (size d ^ k) + +theorem exists_source_calibration {freq : ℝ} (hfreq : 0 < freq) + (k B : ℕ) (minimum : ℝ) : + ∃ exponent : ℕ, 0 < exponent ∧ minimum ≤ (exponent : ℝ) ∧ + ∀ (d : BinaryHeisenberg) (h : d.Valid), d.PolynomialPromise k → + ∃ u : GlobalSite (geometricSource k d h) → PlanarPosition, + (∀ a, calibrationSize d ^ exponent * + planarHopping ‖u ((geometricGraph k d h).left a) - + u ((geometricGraph k d h).right a)‖ = + coulombHoppingTarget freq (calibrationSize d ^ B)⁻¹ (geometricWeight k d h a) + ‖u ((geometricGraph k d h).left a) - u ((geometricGraph k d h).right a)‖) ∧ + (∀ x y, x ≠ y → + (1 - contactLengthTolerance) * ((exponent : ℝ) * Real.log (calibrationSize d)) ≤ + ‖u x - u y‖) ∧ + (∀ x y, x ≠ y → Nonedge (geometricSource k d h) + (roundingDenominator k d + size d ^ k + 1) (size d ^ k) x y → + (6 / 5) * ((exponent : ℝ) * Real.log (calibrationSize d)) < ‖u x - u y‖) ∧ + (∀ c : GlobalSite (geometricSource k d h) → ℝ, + localizedGramConstant freq * ∑ i, c i ^ 2 ≤ + ∑ i, ∑ j, localizedCoulombCoeff freq (u i) (u j) * c i * c j) ∧ + Function.Injective u ∧ + (∀ x i, |u x i| ≤ calibrationSize d ^ (exponent + k + 7)) := by + obtain ⟨A, _, hweight⟩ := geometricSource_weight_range k + obtain ⟨exponent, he, hminimum, hcal⟩ := + exists_calibrated_finalGraph_above hfreq A B 6 minimum + refine ⟨exponent, he, hminimum, fun d h hp => ?_⟩ + have hN : 2 ≤ calibrationSize d := by + unfold calibrationSize + exact le_add_of_nonneg_left (Nat.cast_nonneg _) + have hw := hweight d h hp + obtain ⟨u, hlink, hsep, hnon, hgram, hinj, hext⟩ := + (hcal (calibrationSize d) hN).2 (geometricSource k d h) + (roundingDenominator k d + size d ^ k + 1) (size d ^ k) + (fun a => (geometricWeight k d h a : ℝ)) (geometricSource_count k d h) + (fun a => (hw a).1) (fun a => (hw a).2) + refine ⟨u, hlink, hsep, hnon, hgram, hinj, ?_⟩ + intro x i + exact (hext (calibrationSize d ^ k) (geometricSource_coordinates k d h hp) x i).trans + (logarithmic_extent_polynomial exponent k hN) + +end ContinuumCoulomb.SourceMetadataProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceCalibrationBounds.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceCalibrationBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..5048e2fa166daaf923baaf6ee31be36f2fc458eb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceCalibrationBounds.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.PrefactorSourceCalibration +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.PrefactorSpacing + +namespace OAI + +/-! One fixed calibration retains both the source edge residuals and the +uniform shared spacing, including for source graphs with no retained edges. -/ + +noncomputable section +namespace ContinuumCoulomb.PrefactorSourceContactProgram +open ContactMediator + +theorem exists_source_calibration (rho : ℕ) (hrho : 0 < rho) + (eps : ℚ) (heps : 0 < eps) (hepsSmall : eps ≤ 1/1000) + (s B : ℕ) (kmin : ℝ) : + ∃ (C A : ℕ) (c : ℚ) (k : ℕ), 0 < C ∧ 0 < c ∧ 0 < k ∧ kmin ≤ (k:ℝ) ∧ + ∀ (d : BinaryHeisenberg) (hd : d.Valid), d.PolynomialPromise s → + ((59/2:ℝ)*(k:ℝ)*Real.log (SourceContactProgram.size d) ≤ + AutomaticCalibration.spacing c k (CalibrationMesh.base (SourceContactProgram.size d)) ∧ + (AutomaticCalibration.spacing c k (CalibrationMesh.base (SourceContactProgram.size d)):ℝ) ≤ + 31*(k:ℝ)*Real.log (SourceContactProgram.size d)) ∧ + ∀ (p : ℕ) (e : GlobalEdge (SourceMetadataProgram.geometricSource s d hd)), + let r := nominalDistance rho (CalibrationMesh.prefactor rho) C eps c s p k A B d hd e + let N := CalibrationMesh.base (SourceContactProgram.size d) + let D := (k:ℝ)*Real.log N + (1-(eps:ℝ))*D ≤ r ∧ (r:ℝ) ≤ (1+(eps:ℝ))*D ∧ + localizedGramConstant (GaussianFrequency.frequency rho) ≤ + localizedCoulombProfile (GaussianFrequency.frequency rho) 0- + localizedCoulombProfile (GaussianFrequency.frequency rho) r ∧ + |(CalibrationMesh.amplification rho (SourceContactProgram.size d) k:ℝ)*planarHopping r- + coulombHoppingTarget (GaussianFrequency.frequency rho) ((N:ℝ)^B)⁻¹ + (SourceContactProgram.weights s d hd e) r| ≤ + ((SourceContactProgram.size d:ℝ)^p+1)⁻¹ := by + have heps1 : eps < 1 := lt_of_le_of_lt hepsSmall (by norm_num) + obtain ⟨A,hA,hweights⟩ := source_weight_range s + obtain ⟨C,L,c,k,hC,_hL,hc,hk,hkmin,hcal⟩ := PrefactorCalibration.exists_calibration + rho hrho (CalibrationMesh.prefactor rho) (CalibrationMesh.prefactor_positive hrho) + eps heps heps1 A B kmin + refine ⟨C,A+L,c,k,hC,hc,hk,hkmin,fun d hd hp => ?_⟩ + have hN := SourceContactProgram.size_ge_two d + have hbase := CalibrationMesh.base_ge_two hN + have hpwr : (1:ℝ) ≤ (CalibrationMesh.base (SourceContactProgram.size d):ℝ)^A := + one_le_pow₀ (by exact_mod_cast (show 1 ≤ CalibrationMesh.base (SourceContactProgram.size d) by omega)) + have hone := hcal (CalibrationMesh.base (SourceContactProgram.size d)) 0 1 hbase + (by simpa only [Rat.cast_one] using inv_le_one_of_one_le₀ hpwr) + (by simpa only [Rat.cast_one] using hpwr) + refine ⟨PrefactorCalibration.spacing_bounds rho (CalibrationMesh.prefactor rho) C + heps.le hepsSmall hc k (A+L) B (SourceContactProgram.size d) 0 hN ⟨hone.1,hone.2.1⟩,?_⟩ + intro p e + obtain ⟨hlo,hhi⟩ := hweights d hd hp e + have hm := hcal (CalibrationMesh.base (SourceContactProgram.size d)) + (SourceContactProgram.size d^p) (SourceContactProgram.weights s d hd e) hbase hlo hhi + simpa only [nominalDistance,CalibrationMesh.amplification,Rat.cast_mul,Rat.cast_pow, + Rat.cast_natCast,Nat.cast_pow] using hm + +end ContinuumCoulomb.PrefactorSourceContactProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceCloudComparison.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceCloudComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..3a620e0df8f1f5d874aed53bbd77924411b29a86 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceCloudComparison.lean @@ -0,0 +1,161 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.ManufacturedPolynomialComparison +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.ManufacturedScaleThreshold +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceGridGeometry +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceUnitCoulomb +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.UnitProgramGroundInterval + +namespace OAI + +/-! The actual source nuclear program has the manufactured Hubbard ground +interval. The remaining premises concern only its finite calibrated sites +and hopping matrix, not any continuum energy comparison. -/ + +noncomputable section +open scoped BigOperators Classical NNReal +namespace ContinuumCoulomb +open HubbardGlobal + +theorem source_cloud_comparison + (hflow : PublishedC4FlowInput) + (hp : PlanarSobolev.ManufacturedPlanarGroundGap) + (hv : PublishedVerticalOscillatorGap) (hdensity : PublishedSobolevSmoothDensity) : + ∃ (rho : ℕ) (_hrho : 0 < rho) (U F K q : ℕ), 1 ≤ q ∧ + ∀ (r s v p k ap calC srcS pc h A B qt : ℕ) (eps c : ℚ) (d : BinaryHeisenberg), + q+9*r+72*s+v+p ≤ k → q+465*k+2*r+v+p+34 ≤ ap → + ∀ (m n : ℕ) (u : Fin (m+1) → ℚ×ℚ), n+2=m+1 → + (SourcePositiveProgram.output srcS d).vertices=n+2 → + SourceNuclearProgram.sites rho calC eps c srcS pc h k A B d=List.ofFn u → + (m+1:ℝ) ≤ (SourceContactProgram.size d:ℝ)^r → + (∀ i, ‖PlanarForcingProgram.position (u i)‖ ≤ (SourceContactProgram.size d:ℝ)^s) → + ∀ D : ℝ, 25*(k:ℝ)*Real.log (SourceContactProgram.size d) ≤ D → + (∀ i j, i ≠ j → D ≤ ‖PlanarForcingProgram.position (u i)-PlanarForcingProgram.position (u j)‖) → + ∀ {Edge : Type} [Fintype Edge] (left right : Edge → Fin (m+1)) (t : Edge → ℝ), + (∑ e, |t e|) ≤ (SourceContactProgram.size d:ℝ)^v → + (∀ i j, ‖((SourceNuclearProgram.amplification rho k d:ℝ):ℂ)* + (planarHoppingMatrix (fun a => PlanarForcingProgram.position (u a)) i j:ℂ)- + graphHoppingMatrix m left right (fun e => (t e:ℂ)) i j‖ ≤ + ((SourceContactProgram.size d:ℝ)^(2*r+p+7))⁻¹) → + (1:ℚ) ≤ (SourcePhysicalThreshold.value rho calC eps c srcS pc h k A B qt d).2- + (SourcePhysicalThreshold.value rho calC eps c srcS pc h k A B qt d).1 → + let freq := GaussianFrequency.frequency rho + let scale := (SourceNuclearProgram.amplification rho k d:ℝ) + let center := scale^2*(n+2:ℝ)* + (slabPotential rho (SourcePhysicalThreshold.slabHorizontal k d) + (SourcePhysicalThreshold.slabVertical k d) 0+((-1/2:ℝ)+freq/2))+ + scale*(hubbardFermionBottom m (localizedCoulombProfile freq 0) + (localizedOffsiteCoulomb freq (fun a => PlanarForcingProgram.position (u a))) left right t- + (1/2:ℝ)*(∑ i, ∑ j, localizedOffsiteCoulomb freq (fun a => PlanarForcingProgram.position (u a)) i j)) + let output := SourceUnitCoulomb.value rho calC U F K eps c srcS pc h k A B qt ap d + ∃ ho : output.Valid, + ((center-scale*((SourceContactProgram.size d:ℝ)^p)⁻¹:ℝ):EReal) ≤ unitGroundEnergy (output.toData ho) ∧ + unitGroundEnergy (output.toData ho) ≤ ((center+scale*((SourceContactProgram.size d:ℝ)^p)⁻¹:ℝ):EReal) := by + obtain ⟨rho,hrho,L,J,hL,hJ,q₀,hq₀,hpoly⟩ := manufactured_polynomial_comparison hflow hp hv hdensity + let freq := GaussianFrequency.frequency rho + have hf : 1 ≤ freq := manufactured_frequency_ge_one hrho + have hr : (0:ℝ) < rho := by exact_mod_cast hrho + have ha : (0:ℝ) < 8/(rho:ℝ) := by positivity + obtain ⟨U,F,_hU,_hF,hnum⟩ := TransformedGauss.exists_uniform_constants rho hrho + obtain ⟨K,hK⟩ := exists_nat_ge (L:ℝ) + obtain ⟨qS,_hqS,hscale⟩ := exists_manufactured_scale_threshold ha + obtain ⟨qU,_hqU,hupper⟩ := exists_grid_ground_upper_exponent hf hr.le ha + obtain ⟨qJ,_hqJ,hprecision⟩ := exists_grid_node_separation_offset J + obtain ⟨qD,_hqD,hthree⟩ := exists_logarithmic_scale_threshold 3 + refine ⟨rho,hrho,U,F,K,q₀+qS+qU+qJ+qD+4,by omega,?_⟩ + intro r s v p k ap calC srcS pc h A B qt eps c d hk hap m n u hNe helectrons hsites hm hu D hD hsep + Edge _ left right t ht hgraph hgap + dsimp only + let N := SourceContactProgram.size d + let uu := fun i => PlanarForcingProgram.position (u i) + let scale := (SourceNuclearProgram.amplification rho k d:ℝ) + let H := (SourcePhysicalThreshold.slabHorizontal k d:ℝ) + let S := (SourcePhysicalThreshold.slabVertical k d:ℝ) + let center := scale^2*(n+2:ℝ)*(slabPotential rho H S 0+((-1/2:ℝ)+freq/2))+ + scale*(hubbardFermionBottom m (localizedCoulombProfile freq 0) (localizedOffsiteCoulomb freq uu) left right t- + (1/2:ℝ)*(∑ i, ∑ j, localizedOffsiteCoulomb freq uu i j)) + have hN : (2:ℝ) ≤ N := by exact_mod_cast SourceContactProgram.size_ge_two d + have hN0 : (0:ℝ) < N := by linarith + have hN1 : (1:ℝ) ≤ N := by linarith + have hscaleEq : scale=(8/(rho:ℝ))*((N:ℝ)^k)^30 := SourceNuclearProgram.amplification_real rho k d + have hs1 : 1 ≤ scale := by rw [hscaleEq]; exact hscale k (by omega) N hN + have hs : 0 < scale := lt_of_lt_of_le zero_lt_one hs1 + have hmesh := SourcePhysicalThreshold.mesh_positive k d + have hH := SourceNuclearProgram.horizontal_bounds k d + have hS := SourceNuclearProgram.vertical_bounds k d + let rad := SourceNuclearProgram.radii k d + let index := fun j : {j // j ∈ centeredGridIndices (CenteredGaussLabels.radiiVector rad)} => j.val + have hgraph' : ∀ i j, ‖((((8/(rho:ℝ))*((N:ℝ)^k)^30)*planarHoppingMatrix uu i j:ℝ):ℂ)- + graphHoppingMatrix m left right (fun e => (t e:ℂ)) i j‖ ≤ ((N:ℝ)^(2*r+(p+1)+6))⁻¹ := by + simpa only [← hscaleEq,Complex.ofReal_mul,uu,scale,N,show 2*r+(p+1)+6=2*r+p+7 by omega] using hgraph + obtain ⟨G,hbij,hGflow,hLip,hAnti,hfix,hcharge,hreg,hjets,hcounter,hlo,hhi⟩ := + hpoly r s v (p+1) k (by omega) N H S D hN hH.1 hH.2 hS.1 hS.2 hD + m n uu hNe hm hu hsep left right t ht hgraph' index Subtype.val_injective + (SourceNuclearProgram.grid_cover k d) + have hthreeD : 3 ≤ D := (hthree k (by omega) N hN).trans hD + have huinj : Function.Injective u := by + intro i j hij + by_contra hne + have hh := hthreeD.trans (hsep i j hne) + rw [hij,sub_self,norm_zero] at hh + norm_num at hh + have hSp : 1 ≤ S := (one_le_pow₀ (one_le_pow₀ hN1 : (1:ℝ) ≤ (N:ℝ)^k)).trans hS.1 + have hnum' := hnum K (N^ap) (SourcePhysicalThreshold.mesh k d) hmesh + (SourceNuclearProgram.amplification rho k d) (SourcePhysicalThreshold.slabVertical k d) + hs1 hSp (m+1) u huinj (fun i j hij => hthreeD.trans (hsep i j hij)) + (by simpa only [uu,← hscaleEq] using hcounter) (by simpa only [uu,← hscaleEq] using hcharge) + G (by simpa only [uu,← hscaleEq] using hGflow) L hLip hK + have hNpow : (N:ℝ)^ap ≤ (N^ap:ℕ) := by simp only [Nat.cast_pow]; exact le_rfl + have hprec := hprecision k ap (by omega) N (N^ap) hN hNpow + rw [← SourceNuclearProgram.inverse_mesh_real k d] at hprec + have hNeR : (n+2:ℝ)=(m+1:ℝ) := by exact_mod_cast hNe + have hupper' : center+scale*((N:ℝ)^(p+1))⁻¹ ≤ (N:ℝ)^(qU+60*k+r+v) := by + have hh := hupper r v (p+1) k N H S hN m uu left right t hm ht + simpa only [center,hNeR,hscaleEq] using hh + have hcount := SourceNuclearProgram.grid_count k d + have hbudget := grid_node_rounding_budget hN hs1 (q := qU) (r := r) (v := v) (p := p+1) + (k := k) (a := ap) (P := N^ap) (by omega) hNpow (Q := (CenteredGaussLabels.labels rad).length) + (by positivity) hcount (M := (n+2:ℝ)) (by positivity) (by simpa only [hNeR] using hm) hupper' + have hhlo : ((center-scale*((N:ℝ)^(p+1))⁻¹:ℝ):EReal) ≤ formGroundEnergy + (dilatedNuclei (CenteredGaussLabels.nuclei rad (fun x => G x 1) hbij.injective + (by positivity : 0 < (SourcePhysicalThreshold.mesh k d:ℝ)⁻¹)) scale hs.ne') (n+2) := by + rw [CenteredGaussLabels.dilated_nuclei_ground (hs := hs)] + simpa only [SourceNuclearProgram.inverse_mesh_real,center,hscaleEq,H,S,N,uu,index,rad] using hlo + have hhhi : formGroundEnergy + (dilatedNuclei (CenteredGaussLabels.nuclei rad (fun x => G x 1) hbij.injective + (by positivity : 0 < (SourcePhysicalThreshold.mesh k d:ℝ)⁻¹)) scale hs.ne') (n+2) ≤ + ((center+scale*((N:ℝ)^(p+1))⁻¹:ℝ):EReal) := by + rw [CenteredGaussLabels.dilated_nuclei_ground (hs := hs)] + simpa only [SourceNuclearProgram.inverse_mesh_real,center,hscaleEq,H,S,N,uu,index,rad] using hhi + let x := AffinePhysicalOutput.argument rho (SourceUnitCoulomb.input rho calC eps c srcS pc h k A B qt ap d) + have hn : 0 < x.2.1 := by change 0 < (SourcePositiveProgram.output srcS d).vertices; omega + have hNx : 0 < x.1.1.1.2 := hmesh + have hnumx : ∀ l : TransformedGauss.Label, + ‖CappedKernelProgram.position (TransformedGauss.value rho U F K x.1.1.1.1 x.1.1.1.2 + x.1.1.2.1.1 x.1.1.2.1.2 x.1.1.2.2 l.1 l.2)- + G (gaussLatticePoint (x.1.1.1.2:ℝ)⁻¹ (RationalGaussNodes.index l.1 l.2)) 1‖ ≤ + ((x.1.1.1.1:ℝ)+1)⁻¹ := by + intro l + simpa only [x,AffinePhysicalOutput.argument,SourceUnitCoulomb.input,SourceNuclearProgram.input,hsites,N] using hnum' l.1 l.2 + have hxs : x.2.1=n+2 := helectrons + obtain ⟨ho,hl,hh⟩ := UnitCoulombProgram.ground_interval (center := center) (error := scale*((N:ℝ)^(p+1))⁻¹) (roundError := ((N:ℝ)^(p+1))⁻¹) rho U F K hrho x hNx hn hgap + (fun x => G x 1) hbij.injective hAnti hnumx hprec hs (SourceNuclearProgram.factor_amplification hrho k d) + (by simpa only [hxs,x,AffinePhysicalOutput.argument,SourceUnitCoulomb.input, + SourceNuclearProgram.input,SourcePhysicalThreshold.input,helectrons,rad,SourceNuclearProgram.radii] using hhlo) + (by simpa only [hxs,x,AffinePhysicalOutput.argument,SourceUnitCoulomb.input, + SourceNuclearProgram.input,SourcePhysicalThreshold.input,helectrons,rad,SourceNuclearProgram.radii] using hhhi) + hbudget.1 (by simpa only [hxs,x,AffinePhysicalOutput.argument,SourceUnitCoulomb.input, + SourceNuclearProgram.input,SourcePhysicalThreshold.input,helectrons,rad,SourceNuclearProgram.radii,Nat.cast_add,Nat.cast_ofNat] using hbudget.2) + have hsum : scale*((N:ℝ)^(p+1))⁻¹+((N:ℝ)^(p+1))⁻¹ ≤ scale*((N:ℝ)^p)⁻¹ := by + have hmul := mul_le_mul_of_nonneg_right hs1 (by positivity : 0 ≤ ((N:ℝ)^(p+1))⁻¹) + have hdouble := mul_le_mul_of_nonneg_left (double_inverse_power_le hN p) hs.le + nlinarith only [hmul,hdouble] + refine ⟨ho,?_,?_⟩ + · have he : center-scale*((N:ℝ)^p)⁻¹ ≤ center-scale*((N:ℝ)^(p+1))⁻¹-((N:ℝ)^(p+1))⁻¹ := by linarith only [hsum] + exact (EReal.coe_le_coe_iff.mpr he).trans hl + · have he : center+scale*((N:ℝ)^(p+1))⁻¹+((N:ℝ)^(p+1))⁻¹ ≤ center+scale*((N:ℝ)^p)⁻¹ := by linarith only [hsum] + exact hh.trans (EReal.coe_le_coe_iff.mpr he) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceCoefficientRounding.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceCoefficientRounding.lean new file mode 100644 index 0000000000000000000000000000000000000000..c26a49315abd0385d63dd2c1c1e06432822384e1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceCoefficientRounding.lean @@ -0,0 +1,81 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.MediatorListProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.ChargePrograms + +namespace OAI + +/-! Exact common-denominator source coefficient rounding, implemented by +actual integer/rational machine arithmetic. Nonzero rounded weights have +an inverse-polynomial lower bound without assuming one for the source. -/ + +namespace ContinuumCoulomb.SourceCoefficientRounding +open ExactQuantumFactoring.BitStackProgram MediatorListProgram + +def coefficient (M : ℕ) (q : ℚ) : ℚ := (round ((M : ℚ) * q) : ℚ) / M + +theorem coefficient_error {M : ℕ} (hM : 0 < M) (q : ℚ) : + |q - coefficient M q| ≤ 1 / (2 * (M : ℚ)) := by + have hm : (0 : ℚ) < M := by exact_mod_cast hM + have heq : q - coefficient M q = ((M : ℚ) * q - round ((M : ℚ) * q)) / M := by + unfold coefficient + field_simp + rw [heq, abs_div, abs_of_pos hm] + calc + _ ≤ (1 / 2 : ℚ) / M := div_le_div_of_nonneg_right (abs_sub_round ((M : ℚ) * q)) hm.le + _ = _ := by ring + +theorem coefficient_nonzero_lower {M : ℕ} (hM : 0 < M) (q : ℚ) + (hq : coefficient M q ≠ 0) : 1 / (M : ℚ) ≤ |coefficient M q| := by + have hm : (0 : ℚ) < M := by exact_mod_cast hM + have hk : round ((M : ℚ) * q) ≠ 0 := by + intro hk + apply hq + simp only [coefficient, hk, Int.cast_zero, zero_div] + have ha : (1 : ℤ) ≤ |round ((M : ℚ) * q)| := by + have hp := abs_nonneg (round ((M : ℚ) * q)) + have hn := abs_ne_zero.mpr hk + omega + have ha' : (1 : ℚ) ≤ |(round ((M : ℚ) * q) : ℚ)| := by exact_mod_cast ha + rw [coefficient, abs_div, abs_of_pos hm] + exact div_le_div_of_nonneg_right ha' hm.le + +theorem coefficient_upper {M W : ℕ} (hM : 0 < M) (q : ℚ) (hq : |q| ≤ W) : + |coefficient M q| ≤ W + 1 := by + have hm : (1 : ℚ) ≤ M := by exact_mod_cast hM + have he := coefficient_error hM q + have hhalf : (1 : ℚ) / (2 * M) ≤ 1 := by apply (div_le_one (by positivity)).mpr; linarith + have h := abs_add_le (coefficient M q - q) q + rw [sub_add_cancel] at h + rw [abs_sub_comm] at he + linarith + +abbrev Input := ℕ × Bond + +def inputCode : Input → List Bool := prodCode unaryCode bondCode + +noncomputable def mProgram : Procedure inputCode ratCode (fun x => (x.1 : ℚ)) := + Procedure.natToRat.comp (Procedure.unaryToBits.comp (Procedure.first _ _)) +noncomputable def weightProgram : Procedure inputCode ratCode (fun x => x.2.2.2) := + ((Procedure.second _ _).comp (Procedure.second _ _)).comp (Procedure.second _ _) +noncomputable def roundedProgram : Procedure inputCode intCode + (fun x => round ((x.1 : ℚ) * x.2.2.2)) := + ChargePrograms.rationalRoundProgram.comp (Procedure.ratMul.comp (mProgram.pair weightProgram)) +noncomputable def coefficientProgram : Procedure inputCode ratCode + (fun x => coefficient x.1 x.2.2.2) := + Procedure.ratDiv.comp ((Procedure.intToRat.comp roundedProgram).pair mProgram) + +noncomputable def bondProgram : Procedure inputCode bondCode + (fun x => (x.2.1, x.2.2.1, coefficient x.1 x.2.2.2)) := by + let bond := Procedure.second unaryCode bondCode + let left := (Procedure.first Nat.bits (prodCode Nat.bits ratCode)).comp bond + let right := ((Procedure.first Nat.bits ratCode).comp (Procedure.second Nat.bits _)).comp bond + exact left.pair (right.pair coefficientProgram) + +noncomputable def listProgram : Procedure (prodCode unaryCode (listCode bondCode)) + (listCode bondCode) (fun x => x.2.map (fun e => (e.1, e.2.1, coefficient x.1 e.2.2))) := + Procedure.listMapWith (ea := unaryCode) (eb := bondCode) (ec := bondCode) + (f := fun (M : ℕ) (e : Bond) => (e.1, e.2.1, coefficient M e.2.2)) + zeroBond zeroBond bondProgram + +end ContinuumCoulomb.SourceCoefficientRounding + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceConditionalReduction.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceConditionalReduction.lean new file mode 100644 index 0000000000000000000000000000000000000000..817b706073c8b2f1b96bb4cd4e8c38c31cee8752 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceConditionalReduction.lean @@ -0,0 +1,186 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceCloudComparison +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceTargetHubbard +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceContactMatrix +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceCalibrationBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceParameterSchedule +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceHubbardPromise +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceThresholdGap +import OAI.MathematicalPhysics.ContinuumCoulomb.ManyBody.FiniteSourceBranch + +namespace OAI + +/-! +A polynomial-time source-to-unit-Coulomb reduction under explicit +analytic hypotheses. +-/ + +noncomputable section +open scoped BigOperators +namespace ContinuumCoulomb +open SourcePositiveProgram SourceNuclearProgram HubbardGlobal + +theorem exists_source_unit_reduction_with_planar_gap + (hflow : PublishedC4FlowInput) + (hp : PlanarSobolev.ManufacturedPlanarGroundGap) + (hv : PublishedVerticalOscillatorGap) (hdensity : PublishedSobolevSmoothDensity) + (s : ℕ) : + Nonempty (PolynomialManyOne binaryHeisenbergCodec.encode unitCoulombCodec.encode + (sourceHeisenbergPromise s) unitCoulombPromise) := by + obtain ⟨rho,hrho,U,Fnum,Knum,qCloud,_hqCloud,hcloud⟩ := + source_cloud_comparison hflow hp hv hdensity + have ha : (0:ℝ) < 8/(rho:ℝ) := div_pos (by norm_num) (by exact_mod_cast hrho) + have hfreq := manufactured_frequency_positive hrho + obtain ⟨Aweight,B,v,qTarget,_hAw,_hB,_hv,_hqTarget,htarget⟩ := + exists_source_target_parameters rho hrho s (s+14) + obtain ⟨qLeak,_hqLeak,hleak⟩ := exists_source_leakage_threshold hfreq 6 + obtain ⟨qN,qC,_hqN,_hqC,hmat⟩ := exists_indexed_matrix_offsets rho hrho + obtain ⟨qGap,_hqGap,hgap⟩ := exists_source_gap_offset ha + obtain ⟨qScale,_hqScale,hscale⟩ := exists_manufactured_scale_threshold ha + obtain ⟨kmin,hmin,hthreshold⟩ := + exists_source_exponent_threshold qCloud qN qGap (qTarget+qLeak) qScale 6 s v B + let eps : ℚ := 1/100000000 + have heps : 0 < eps := by norm_num [eps] + have hepsSmall : eps ≤ 1/1000 := by norm_num [eps] + have htol : (eps:ℝ)/2 ≤ contactLengthTolerance := by norm_num [eps,contactLengthTolerance] + obtain ⟨C,A,c,k,_hC,hc,_hk,hkmin,hcal⟩ := + PrefactorSourceContactProgram.exists_source_calibration rho hrho eps heps hepsSmall s B kmin + have hkminN : kmin ≤ k := by exact_mod_cast hkmin + have hkBig : 1100 ≤ k := hmin.trans hkminN + have hconstraints := hthreshold k hkminN + let extent := s+k/100+13 + let p := 60*B+s+14 + let pc := 12+p+9 + let h := qC+30*k+30*Aweight+extent+(12+p+7)+15 + let ap := qCloud+465*k+12+v+p+34 + let f := SourceUnitCoulomb.value rho C U Fnum Knum eps c s pc h k A B p ap + have hcorrect (d : BinaryHeisenberg) (hd : d.Valid) (hpoly : d.PolynomialPromise s) + (hvertices : 2 ≤ d.coordinate.length) : + (realSourceGroundEnergy (d.toSource hd) ≤ d.lower.value → f d ∈ unitCoulombPromise.yes) ∧ + ((d.upper.value:ℝ) ≤ realSourceGroundEnergy (d.toSource hd) → f d ∈ unitCoulombPromise.no) := by + have hMtwo := SourceBranchProgram.positive_output_vertices s d hd hvertices + obtain ⟨n,hn⟩ := Nat.exists_eq_add_of_le hMtwo + let m := n+1 + have hm : (output s d).vertices=m+1 := by dsimp only [m]; omega + let N := SourceContactProgram.size d + let u := indexedCoordinates rho C eps c s pc h k A B d hd hm + let uu := fun i => PlanarForcingProgram.position (u i) + let graph := indexedGraph s d hd hm + let τ := ((N:ℝ)^(30*B))⁻¹ + let t := fun e => -coulombHoppingTarget (GaussianFrequency.frequency rho) τ (graph.weight e) + ‖uu (graph.left e)-uu (graph.right e)‖ + let D := 25*(k:ℝ)*Real.log N + have hN : 2 ≤ N := SourceContactProgram.size_ge_two d + have hNR : (2:ℝ) ≤ N := by exact_mod_cast hN + have hN0 : (0:ℝ) < N := lt_of_lt_of_le (by norm_num) hNR + have hN1 : (1:ℝ) ≤ N := le_trans (by norm_num) hNR + have hhk : qCloud+9*6+72*extent+v+p ≤ k := by + simpa only [extent,p] using hconstraints.1 + have hhP : 13 ≤ h := by dsimp [h]; omega + have hP : 7200 ≤ N^h := ContactCalibratedGeometry.precision_ge_7200 hN hhP + have hspacing := (hcal d hd hpoly).1 + have hsites : sites rho C eps c s pc h k A B d=List.ofFn u := + sites_eq_indexed rho C eps c s pc h k A B d hd hm + have hcount : (m+1:ℕ) ≤ (N:ℝ)^6 := by + rw [← hm] + exact source_graph_site_count s d hd + have hnorm (i : Fin (m+1)) : ‖uu i‖ ≤ (N:ℝ)^extent := by + have hn := indexed_norm_bound rho C heps.le hc htol s pc h k A B d hd hpoly hkBig hP hspacing.2 hm i + simpa only [uu,u,extent,N,Nat.add_comm s (k/100)] using hn + have hsep (i j : Fin (m+1)) (hij : i ≠ j) : D ≤ ‖uu i-uu j‖ := + indexed_separation rho C heps.le hc htol s pc h k A B d hd hP hspacing.1 hm i j hij + have hqLeak : qLeak ≤ k := by omega + obtain ⟨hD,hleakM⟩ := hleak k hqLeak N D hNR le_rfl (m+1) hcount + have hleakTwo : 2*localLeakageBound (GaussianFrequency.frequency rho) D ≤ + localDualMass (GaussianFrequency.frequency rho)/2 := by + have hMtwoR : (2:ℝ) ≤ (m+1:ℕ) := by exact_mod_cast (show 2 ≤ m+1 by dsimp [m]; omega) + exact (mul_le_mul_of_nonneg_right hMtwoR + (localLeakageBound_nonnegative (GaussianFrequency.frequency rho) D)).trans hleakM + have hqTarget : qTarget ≤ k := by omega + obtain ⟨hweights,ht,hfinite⟩ := htarget d hd hpoly m k hm hqTarget D uu le_rfl hsep + have hFweight : graph.weight=SourceContactProgram.weights s d hd := indexedGraph_weight s d hd hm + have hKw (e : ContactMediator.GlobalEdge (SourceMetadataProgram.geometricSource s d hd)) : + 0 ≤ (SourceContactProgram.weights s d hd e:ℝ) ∧ + (SourceContactProgram.weights s d hd e:ℝ) ≤ (N:ℝ)^(30*Aweight) := by + have hw := hweights e + rw [hFweight] at hw + exact ⟨(inv_nonneg.mpr (pow_nonneg hN0.le _)).trans hw.1,hw.2⟩ + have hnom (e : ContactMediator.GlobalEdge (SourceMetadataProgram.geometricSource s d hd)) : + let r := PrefactorSourceContactProgram.nominalDistance rho (CalibrationMesh.prefactor rho) + C eps c s pc k A B d hd e + |(amplification rho k d:ℝ)*planarHopping r- + coulombHoppingTarget (GaussianFrequency.frequency rho) ((N:ℝ)^(30*B))⁻¹ + (SourceContactProgram.weights s d hd e) r| ≤ ((N:ℝ)^pc+1)⁻¹ := by + have hh := ((hcal d hd hpoly).2 pc e).2.2.2 + simpa only [amplification_calibration,calibration_base_power] using hh + have hknMatrix : qN+extent+(12+p+8) ≤ 5*k := by + simpa only [extent,p] using hconstraints.2.1 + have hmatrix := hmat C s pc h k A B (30*Aweight) (12+p+7) eps c d hd hpoly heps.le hc htol + hkBig hhP (by dsimp only [extent] at hknMatrix ⊢; omega) (by dsimp [h,extent]; omega) + (by dsimp [pc]; omega) hD hspacing hleakTwo hKw hnom m hm + have hs : 1 ≤ (amplification rho k d:ℝ) := by + rw [amplification_real] + exact hscale k (by omega) N hNR + have hMN : (SourceMetadataProgram.size d:ℝ) ≤ N := by + dsimp only [N,SourceContactProgram.size] + rw [Nat.cast_add,Nat.cast_one] + linarith + have hgapScale := hgap s B k (by omega) N (SourceMetadataProgram.size d) hNR + (Nat.cast_nonneg _) hMN + have houtputGap := SourcePhysicalThreshold.gap_ge_one rho C eps c s pc h k A B p d hd hpoly + (by simpa only [amplification_real,Nat.cast_pow] using hgapScale) + obtain ⟨ho,hlo,hhi⟩ := hcloud 6 extent v p k ap C s pc h A B p eps c d hhk + (by dsimp [ap]; omega) m n u (by dsimp [m]) (by omega) + hsites (by simpa only [Nat.cast_add,Nat.cast_one] using hcount) hnorm D le_rfl hsep graph.left graph.right t ht + (by simpa only [Complex.ofReal_mul] using hmatrix) houtputGap + have hu : Function.Injective u := by + intro i j hij + by_contra hne + have hdistance := hD.trans (hsep i j hne) + simp only [uu,hij,sub_self,norm_zero] at hdistance + norm_num at hdistance + have hground : + ((SourcePhysicalThreshold.exactHubbardEnergy rho C eps c s pc h k A B p d u graph t- + (amplification rho k d:ℝ)*((N:ℝ)^p)⁻¹:ℝ):EReal) ≤ + unitGroundEnergy ((f d).toData ho) ∧ + unitGroundEnergy ((f d).toData ho) ≤ + ((SourcePhysicalThreshold.exactHubbardEnergy rho C eps c s pc h k A B p d u graph t+ + (amplification rho k d:ℝ)*((N:ℝ)^p)⁻¹:ℝ):EReal) := by + simp only [SourcePhysicalThreshold.exactHubbardEnergy_eq rho C eps c s pc h k A B p d u graph t hm] + have hnR : (n+2:ℝ)=(m+1:ℝ) := by dsimp only [m]; push_cast; ring + simpa only [hnR] using And.intro hlo hhi + exact SourceUnitCoulomb.promise_of_hubbard_interval rho C U Fnum Knum hrho eps c + s pc h k A B p ap p (s+14) d hd hpoly u hu hsites graph hm + (indexedGraph_toList s d hd hm) t ho hs (by rfl) le_rfl (by rfl) + (by simpa only [Nat.cast_pow] using hfinite) hground + obtain ⟨yesOutput,noOutput,hyesOutput,hnoOutput⟩ := exists_atomic_yes_no + exact ⟨FiniteSourceBranch.reduction yesOutput noOutput hyesOutput hnoOutput s f + (SourceUnitCoulomb.program rho C U Fnum Knum eps c s pc h k A B p ap) + (fun d hd hp hv hy => (hcorrect d hd hp hv).1 hy) + (fun d hd hp hv hn => (hcorrect d hd hp hv).2 hn)⟩ + +/-- The planar spectral hypothesis implies the estimate for the manufactured well. -/ +theorem exists_source_unit_reduction_without_hydrogen + (hflow : PublishedC4FlowInput) + (hp : PlanarSobolev.PublishedNegativePlanarGroundGap) + (hv : PublishedVerticalOscillatorGap) (hdensity : PublishedSobolevSmoothDensity) + (s : ℕ) : + Nonempty (PolynomialManyOne binaryHeisenbergCodec.encode unitCoulombCodec.encode + (sourceHeisenbergPromise s) unitCoulombPromise) := + exists_source_unit_reduction_with_planar_gap hflow + (PlanarSobolev.manufacturedPlanarWell_gap hp) hv hdensity s + +/-- A six-hypothesis form of the reduction, including the hydrogen spectral hypothesis. -/ +theorem exists_source_unit_reduction + (hflow : PublishedC4FlowInput) + (hp : PlanarSobolev.PublishedNegativePlanarGroundGap) + (hv : PublishedVerticalOscillatorGap) (hdensity : PublishedSobolevSmoothDensity) + (_hh : PublishedHydrogenBottom) (s : ℕ) : + Nonempty (PolynomialManyOne binaryHeisenbergCodec.encode unitCoulombCodec.encode + (sourceHeisenbergPromise s) unitCoulombPromise) := + exists_source_unit_reduction_without_hydrogen hflow hp hv hdensity s + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceContactCorrectness.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceContactCorrectness.lean new file mode 100644 index 0000000000000000000000000000000000000000..4e12460690b63b893d3c4c3f17503a4d49afcbc1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceContactCorrectness.lean @@ -0,0 +1,59 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.SourceContactProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourcePositiveCorrectness +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceGeometryBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.CalibratedContactCorrectness + +namespace OAI + +/-! The raw-source program has exactly the normalized lattice geometry and +the full three-stage positive weights, including their original order. -/ + +noncomputable section +namespace ContinuumCoulomb.SourceContactProgram +open ContactMediator + +def weights (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) : + GlobalEdge (SourceMetadataProgram.geometricSource s d hd) → ℚ := + (MediatorIteration.finalGraph (SourceMetadataProgram.geometricSource s d hd).bonds + (SourcePositiveProgram.sourceBound s d) (SourceMetadataProgram.size d ^ s)).weight + +theorem coordinates_eq (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) : + d.coordinate = List.ofFn (SourceMetadataProgram.geometricSource s d hd).coordinate := by + exact (List.ofFn_get d.coordinate).symm + +theorem signedBonds_eq (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) : + (SourcePositiveProgram.normalized s d).2 = + (SourceMetadataProgram.geometricSource s d hd).bonds.toList := by + rw [SourcePositiveProgram.normalized_literal s d hd] + rfl + +theorem weights_eq (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) : + (SourcePositiveProgram.output s d).bonds.map (fun e => e.2.2) = + List.ofFn (weights s d hd) := by + rw [SourcePositiveProgram.bonds_eq s d hd] + simp only [MediatorIteration.Bonds.toList,List.map_ofFn,Function.comp_def] + rfl + +theorem input_eq_graphInput (s p h : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) : + input s p h d = CalibratedContactProgram.graphInput + (SourceMetadataProgram.geometricSource s d hd) (size d) (size d ^ p) (size d ^ h) + (weights s d hd) := by + unfold input CalibratedContactProgram.graphInput + rw [coordinates_eq s d hd,signedBonds_eq s d hd,weights_eq s d hd] + +theorem value_eq_array (rho : ℕ) (ε c : ℚ) (s p h k A B : ℕ) + (d : BinaryHeisenberg) (hd : d.Valid) : + value rho ε c s p h k A B d = List.ofFn (fun x => + ContactCalibratedGeometry.position (SourceMetadataProgram.geometricSource s d hd) + (size d ^ h) (AutomaticCalibration.spacing c k (size d)) + (CalibratedContactProgram.graphLengths rho ε c k A B (size d) (size d ^ p) + (SourceMetadataProgram.geometricSource s d hd) (weights s d hd)) x) := by + unfold value + rw [input_eq_graphInput] + exact CalibratedContactProgram.value_graphInput _ _ _ _ _ _ _ _ _ _ _ + +end ContinuumCoulomb.SourceContactProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceContactMatrix.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceContactMatrix.lean new file mode 100644 index 0000000000000000000000000000000000000000..d3b2a1af5fea9b63939e59e454fdb1fbe60c58a8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceContactMatrix.lean @@ -0,0 +1,90 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceContactTransport +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.RationalContactBudget +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceGridGeometry +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.ManufacturedFrequency + +namespace OAI + +/-! The literal source sites and literal source graph satisfy the full +matrix hypothesis used by the continuum cloud comparison. -/ + +noncomputable section +namespace ContinuumCoulomb.SourceNuclearProgram +open SourceMetadataProgram SourcePositiveProgram ContactMediator HubbardGlobal + +theorem exists_indexed_matrix_offsets (rho : ℕ) (hrho : 0 < rho) : + ∃ qN qC : ℕ, 1 ≤ qN ∧ 1 ≤ qC ∧ + ∀ (C s pc h k A B aK p : ℕ) (eps c : ℚ) (d : BinaryHeisenberg) (hd : d.Valid), + d.PolynomialPromise s → 0 ≤ eps → 0 < c → (eps:ℝ)/2 ≤ contactLengthTolerance → + 1100 ≤ k → 13 ≤ h → + qN+(s+k/100+13)+p+1 ≤ 5*k → qC+30*k+aK+(s+k/100+13)+p+2 ≤ h → p+2 ≤ pc → + 5 ≤ 25*(k:ℝ)*Real.log (SourceContactProgram.size d) → + ((59/2:ℝ)*(k:ℝ)*Real.log (SourceContactProgram.size d) ≤ contactSpacing c k d ∧ + (contactSpacing c k d:ℝ) ≤ 31*(k:ℝ)*Real.log (SourceContactProgram.size d)) → + 2*localLeakageBound (GaussianFrequency.frequency rho) + (25*(k:ℝ)*Real.log (SourceContactProgram.size d)) ≤ + localDualMass (GaussianFrequency.frequency rho)/2 → + (∀ e : GlobalEdge (geometricSource s d hd), + 0 ≤ (SourceContactProgram.weights s d hd e:ℝ) ∧ + (SourceContactProgram.weights s d hd e:ℝ) ≤ (SourceContactProgram.size d:ℝ)^aK) → + (∀ e : GlobalEdge (geometricSource s d hd), + let r := PrefactorSourceContactProgram.nominalDistance rho (CalibrationMesh.prefactor rho) + C eps c s pc k A B d hd e + |(amplification rho k d:ℝ)*planarHopping r- + coulombHoppingTarget (GaussianFrequency.frequency rho) + ((SourceContactProgram.size d:ℝ)^(30*B))⁻¹ (SourceContactProgram.weights s d hd e) r| ≤ + ((SourceContactProgram.size d:ℝ)^pc+1)⁻¹) → + ∀ (m : ℕ) (hm : (output s d).vertices=m+1), + let F := indexedGraph s d hd hm + let u := fun i => PlanarForcingProgram.position (indexedCoordinates rho C eps c s pc h k A B d hd hm i) + let τ := ((SourceContactProgram.size d:ℝ)^(30*B))⁻¹ + ∀ i j : Fin (m+1), + ‖(((amplification rho k d:ℝ)*planarHoppingMatrix u i j:ℝ):ℂ)- + graphHoppingMatrix m F.left F.right + (fun e => (-(coulombHoppingTarget (GaussianFrequency.frequency rho) τ (F.weight e) + ‖u (F.left e)-u (F.right e)‖):ℝ)) i j‖ ≤ ((SourceContactProgram.size d:ℝ)^p)⁻¹ := by + have ha : (0:ℝ) < 8/(rho:ℝ) := div_pos (by norm_num) (by exact_mod_cast hrho) + have hf := manufactured_frequency_positive hrho + obtain ⟨qN,qC,hqN,hqC,hbound⟩ := ContactCalibratedGeometry.exists_full_matrix_offsets ha hf + refine ⟨qN,qC,hqN,hqC,?_⟩ + intro C s pc h k A B aK p eps c d hd hp heps hc htol hk hh hkn hkh hpc hD hspacing hleak hweights hcal m hm + dsimp only + let N := SourceContactProgram.size d + let σ := indexedSites s d hd hm + let ell := contactLengths rho C eps c s pc k A B d hd + have hN : 2 ≤ N := SourceContactProgram.size_ge_two d + have hNR : (2:ℝ) ≤ N := by exact_mod_cast hN + have hN0 : (0:ℝ) < N := lt_of_lt_of_le (by norm_num) hNR + have hN1 : (1:ℝ) ≤ N := le_trans (by norm_num) hNR + have hx : 0 ≤ (k:ℝ)*Real.log N := mul_nonneg (Nat.cast_nonneg _) (Real.log_nonneg hN1) + have hfar : 2 ≤ 35*(k:ℝ)*Real.log N := by nlinarith only [hD,hx] + have hDq : 25*(k:ℝ)*Real.log N ≤ (9/10:ℝ)*contactSpacing c k d := by nlinarith [hspacing.1] + have hfarq : 35*(k:ℝ)*Real.log N ≤ (6/5:ℝ)*contactSpacing c k d := by nlinarith [hspacing.1] + have hP : 7200 ≤ N^h := ContactCalibratedGeometry.precision_ge_7200 hN hh + have hell := contactLengths_near_one rho C heps hc htol s pc k A B d hd + have hQ := contactSpacing_positive hc k d + have hQS : (contactSpacing c k d:ℝ) ≤ (N:ℝ)^(k/100+s+13) := + ContactCalibratedGeometry.spacing_polynomial (s := s) hN hk hspacing.2 + have hdiam := raw_diameter_bound rho C heps hc htol s pc h k A B d hd hp hk hP hspacing.2 + have hres (e : GlobalEdge (geometricSource s d hd)) : + |((8/(rho:ℝ))*((N:ℝ)^k)^30)*planarHopping ((contactSpacing c k d:ℝ)*ell e)- + coulombHoppingTarget (GaussianFrequency.frequency rho) ((N:ℝ)^(30*B))⁻¹ + (SourceContactProgram.weights s d hd e) ((contactSpacing c k d:ℝ)*ell e)| ≤ + 1/((N:ℝ)^pc+1) := by + simpa only [one_div] using nominal_residual_transport rho C eps hc s pc k A B d hd e (hcal e) + have hqS : (contactSpacing c k d:ℝ) ≤ (N:ℝ)^(s+k/100+13) := by + simpa only [Nat.add_comm (k/100) s] using hQS + have hs := hbound N k aK (s+k/100+13) p pc h hN hkn hkh hpc (geometricSource s d hd) + (sourceBound s d) (size d^s) m σ (contactSpacing c k d) hQ hqS ell hP hell + (25*(k:ℝ)*Real.log N) (35*(k:ℝ)*Real.log N) ((N:ℝ)^(30*B))⁻¹ + hD hfar le_rfl hDq hfarq hleak + (inv_nonneg.mpr (pow_nonneg hN0.le _)) (inv_le_one_of_one_le₀ (one_le_pow₀ hN1)) + (fun e => (SourceContactProgram.weights s d hd e:ℝ)) + (fun e => (hweights e).1) (fun e => (hweights e).2) hdiam hres + exact matrix_bound_transport rho C eps c s pc h k A B d hd hm hs + +end ContinuumCoulomb.SourceNuclearProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceContactTransport.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceContactTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..f9d74798ed5fff294a1f651ccdaf5f53b352dee6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceContactTransport.lean @@ -0,0 +1,105 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceIndexedGeometry +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceGridGeometry +import OAI.MathematicalPhysics.ContinuumCoulomb.ManyBody.FockGraphEntries + +namespace OAI + +/-! Exact transport of nominal distances and hopping matrices to the +literal source's common vertex order. -/ + +noncomputable section +namespace ContinuumCoulomb.SourceNuclearProgram +open SourceMetadataProgram SourcePositiveProgram ContactMediator HubbardGlobal + +theorem amplification_calibration (rho k : ℕ) (d : BinaryHeisenberg) : + amplification rho k d=CalibrationMesh.amplification rho (SourceContactProgram.size d) k := by + rw [amplification,CalibrationMesh.amplification_eq_mesh] + rfl + +theorem calibration_base_power (B : ℕ) (d : BinaryHeisenberg) : + (CalibrationMesh.base (SourceContactProgram.size d):ℝ)^B= + (SourceContactProgram.size d:ℝ)^(30*B) := by + simp only [CalibrationMesh.base,Nat.cast_pow,← pow_mul] + +theorem nominal_residual_transport (rho C : ℕ) (eps : ℚ) {c : ℚ} (hc : 0 < c) + (s pc k A B : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) + (e : GlobalEdge (geometricSource s d hd)) {err : ℝ} + (hcal : let r := PrefactorSourceContactProgram.nominalDistance rho (CalibrationMesh.prefactor rho) C eps c s pc k A B d hd e + |(amplification rho k d:ℝ)*planarHopping r- + coulombHoppingTarget (GaussianFrequency.frequency rho) + ((SourceContactProgram.size d:ℝ)^(30*B))⁻¹ (SourceContactProgram.weights s d hd e) r| ≤ err) : + |((8/(rho:ℝ))*((SourceContactProgram.size d:ℝ)^k)^30)* + planarHopping ((contactSpacing c k d:ℝ)*contactLengths rho C eps c s pc k A B d hd e)- + coulombHoppingTarget (GaussianFrequency.frequency rho) + ((SourceContactProgram.size d:ℝ)^(30*B))⁻¹ (SourceContactProgram.weights s d hd e) + ((contactSpacing c k d:ℝ)*contactLengths rho C eps c s pc k A B d hd e)| ≤ err := by + rw [lengths_scale rho C eps hc s pc k A B d hd e] + simpa only [amplification_real] using hcal + +theorem matrix_bound_transport (rho C : ℕ) (eps c : ℚ) (s pc h k A B : ℕ) + (d : BinaryHeisenberg) (hd : d.Valid) {m : ℕ} (hm : (output s d).vertices=m+1) + {err : ℝ} + (hraw : + let σ := indexedSites s d hd hm + let F := MediatorIteration.finalGraph (geometricSource s d hd).bonds (sourceBound s d) (size d^s) + let u := fun i => ContactCalibratedGeometry.point (geometricSource s d hd) (SourceContactProgram.size d^h) + (contactSpacing c k d) (contactLengths rho C eps c s pc k A B d hd) (σ.symm i) + ∀ i j, ‖(((8/(rho:ℝ))*((SourceContactProgram.size d:ℝ)^k)^30*planarHoppingMatrix u i j:ℝ):ℂ)- + graphHoppingMatrix m (fun e => σ (F.left e)) (fun e => σ (F.right e)) + (fun e => (-(coulombHoppingTarget (GaussianFrequency.frequency rho) + ((SourceContactProgram.size d:ℝ)^(30*B))⁻¹ (SourceContactProgram.weights s d hd e) + ‖u (σ (F.left e))-u (σ (F.right e))‖):ℝ)) i j‖ ≤ err) : + let F := indexedGraph s d hd hm + let u := fun i => PlanarForcingProgram.position (indexedCoordinates rho C eps c s pc h k A B d hd hm i) + ∀ i j, ‖(((amplification rho k d:ℝ)*planarHoppingMatrix u i j:ℝ):ℂ)- + graphHoppingMatrix m F.left F.right + (fun e => (-(coulombHoppingTarget (GaussianFrequency.frequency rho) + ((SourceContactProgram.size d:ℝ)^(30*B))⁻¹ (F.weight e) + ‖u (F.left e)-u (F.right e)‖):ℝ)) i j‖ ≤ err := by + dsimp only + let σ := indexedSites s d hd hm + let F := indexedGraph s d hd hm + let rawF := MediatorIteration.finalGraph (geometricSource s d hd).bonds (sourceBound s d) (size d^s) + let u := fun i => PlanarForcingProgram.position (indexedCoordinates rho C eps c s pc h k A B d hd hm i) + have hleft : (fun e => σ (rawF.left e))=F.left := by + funext e + exact (indexedGraph_left s d hd hm e).symm + have hright : (fun e => σ (rawF.right e))=F.right := by + funext e + exact (indexedGraph_right s d hd hm e).symm + have hu : (fun x => ContactCalibratedGeometry.point (geometricSource s d hd) (SourceContactProgram.size d^h) + (contactSpacing c k d) (contactLengths rho C eps c s pc k A B d hd) (σ.symm x))=u := by + funext i + exact (indexed_position rho C eps c s pc h k A B d hd hm i).symm + intro i j + have hij := hraw i j + dsimp only at hij + change ‖(((8/(rho:ℝ))*((SourceContactProgram.size d:ℝ)^k)^30*planarHoppingMatrix _ i j:ℝ):ℂ)-_‖ ≤ _ at hij + rw [hu,hleft,hright] at hij + have hup (a) : ContactCalibratedGeometry.point (geometricSource s d hd) (SourceContactProgram.size d^h) + (contactSpacing c k d) (contactLengths rho C eps c s pc k A B d hd) (σ.symm a)=u a := congrFun hu a + have hleftp (e) : σ (rawF.left e)=F.left e := congrFun hleft e + have hrightp (e) : σ (rawF.right e)=F.right e := congrFun hright e + have hcoef : + (fun e : GlobalEdge (geometricSource s d hd) => + ((-coulombHoppingTarget (GaussianFrequency.frequency rho) + ((SourceContactProgram.size d:ℝ)^(30*B))⁻¹ (SourceContactProgram.weights s d hd e) + ‖ContactCalibratedGeometry.point (geometricSource s d hd) (SourceContactProgram.size d^h) + (contactSpacing c k d) (contactLengths rho C eps c s pc k A B d hd) (σ.symm (σ (rawF.left e)))- + ContactCalibratedGeometry.point (geometricSource s d hd) (SourceContactProgram.size d^h) + (contactSpacing c k d) (contactLengths rho C eps c s pc k A B d hd) (σ.symm (σ (rawF.right e)))‖:ℝ):ℂ)) = + (fun e : GlobalEdge (geometricSource s d hd) => + ((-coulombHoppingTarget (GaussianFrequency.frequency rho) + ((SourceContactProgram.size d:ℝ)^(30*B))⁻¹ (SourceContactProgram.weights s d hd e) + ‖u (F.left e)-u (F.right e)‖:ℝ):ℂ)) := by + funext e + rw [hup,hup,hleftp,hrightp] + rw [hcoef] at hij + rw [amplification_real,indexedGraph_weight] + exact hij + +end ContinuumCoulomb.SourceNuclearProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceEncodingSize.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceEncodingSize.lean new file mode 100644 index 0000000000000000000000000000000000000000..6874bd397616828d5e080711d9f26be3416cc79c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceEncodingSize.lean @@ -0,0 +1,82 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourcePromise + +namespace OAI + +/-! Size bounds for the actual binary source serialization. In particular, +the number of sites and edges is bounded by the input bit length. -/ + +namespace ContinuumCoulomb +open BinaryEncoding + +namespace BinaryEncoding + +theorem natural_length_pos (n : ℕ) : 0 < (natural.encode n).length := by + rw [natural_length] + omega + +theorem integer_length_pos (z : ℤ) : 0 < (integer.encode z).length := by + cases z <;> simp only [integer, List.length_cons] <;> omega + +theorem list_count_le {α : Type*} (a : Codec α) (ha : ∀ x, 0 < (a.encode x).length) + (xs : List α) : xs.length ≤ ((list a).encode xs).length := by + have hsum : xs.length ≤ (xs.map (fun x => (a.encode x).length)).sum := by + induction xs with + | nil => rfl + | cons x xs ih => + simp only [List.length_cons, List.map_cons, List.sum_cons] + have hx := ha x + omega + rw [list_length] + omega + +end BinaryEncoding + +theorem binaryRational_length_pos (q : BinaryRational) : + 0 < (binaryRationalCodec.encode q).length := by + change 0 < (integer.encode q.numerator ++ natural.encode q.denominator).length + rw [List.length_append] + have h := integer_length_pos q.numerator + omega + +theorem binaryHeisenbergEdge_length_pos (e : BinaryHeisenbergEdge) : + 0 < (binaryHeisenbergEdgeCodec.encode e).length := by + change 0 < (natural.encode e.left ++ + (natural.encode e.right ++ binaryRationalCodec.encode e.coefficient)).length + simp only [List.length_append] + have h := natural_length_pos e.left + omega + +theorem binaryHeisenberg_count_le_length (d : BinaryHeisenberg) : + d.coordinate.length + d.edges.length ≤ (binaryHeisenbergCodec.encode d).length := by + have hc := list_count_le (pair integer integer) + (fun p => by rw [pair_length]; have h := integer_length_pos p.1; omega) d.coordinate + have he := list_count_le binaryHeisenbergEdgeCodec binaryHeisenbergEdge_length_pos d.edges + change d.coordinate.length + d.edges.length ≤ + ((BinaryEncoding.list (pair integer integer)).encode d.coordinate ++ + ((BinaryEncoding.list binaryHeisenbergEdgeCodec).encode d.edges ++ + (binaryRationalCodec.encode d.lower ++ binaryRationalCodec.encode d.upper))).length + simp only [List.length_append] + omega + +theorem binaryHeisenberg_vertices_le_length (d : BinaryHeisenberg) (h : d.Valid) : + (d.toSource h).vertices ≤ (binaryHeisenbergCodec.encode d).length := by + have hs := binaryHeisenberg_count_le_length d + change d.coordinate.length ≤ _ + omega + +theorem binaryHeisenberg_edges_le_length (d : BinaryHeisenberg) (h : d.Valid) : + (d.toSource h).edges ≤ (binaryHeisenbergCodec.encode d).length := by + have hs := binaryHeisenberg_count_le_length d + change d.edges.length ≤ _ + omega + +/-- The promised polynomial extent holds for every actual decoded lattice site. -/ +theorem binaryHeisenberg_decoded_extent (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) + (hp : d.PolynomialPromise k) (i : Fin (d.toSource h).vertices) : + |(((d.toSource h).coordinate i).1 : ℝ)| ≤ ((binaryHeisenbergCodec.encode d).length + 1 : ℝ) ^ k ∧ + |(((d.toSource h).coordinate i).2 : ℝ)| ≤ ((binaryHeisenbergCodec.encode d).length + 1 : ℝ) ^ k := by + exact hp.coordinate_bound (d.coordinate.get i) (List.get_mem d.coordinate i) + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceExceptionalVolume.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceExceptionalVolume.lean new file mode 100644 index 0000000000000000000000000000000000000000..33817b46777cee9be9567682017218a827ef26ea --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceExceptionalVolume.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.CompactSourceGrid +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.OrbitalCellVolume +import OAI.MathematicalPhysics.ContinuumCoulomb.Nuclei.TransportedFarQuadrature + +namespace OAI + +/-! The exceptional cells for a compact orbital source consist of the +manufactured well support together with one neighborhood of the orbital. -/ + +noncomputable section +open MeasureTheory +open scoped Classical +namespace ContinuumCoulomb + +theorem source_exceptional_volume {ι : Type*} [Fintype ι] + (index : ι → Fin 3 → ℤ) (hindex : Function.Injective index) + {h R S : ℝ} (hh : 0 < h) (hh1 : h ≤ 1) (hR : 0 ≤ R) (hS : 1 ≤ S) + (freq scale : ℝ) {m : ℕ} (u : Fin m → PlanarPosition) (v : PlanarPosition) : + (Fintype.card {i // sourceExceptionalCell (tsupport (manufacturedWellField freq scale S u)) + v R (gaussCellCenter h (index i)) h}:ℝ)*h^3 ≤ + 216*m*S+8*(4*R+2*h)^3 := by + let a : ι → Prop := fun i => ∃ z ∈ positionCube (gaussCellCenter h (index i)) h, + z ∈ tsupport (manufacturedWellField freq scale S u) + let b : ι → Prop := fun i => ‖planarCenter v-gaussCellCenter h (index i)‖ ≤ 4*R + have ha := exceptional_cell_volume_bound (fun i : {i // a i} => index i.val) + (fun i j he => Subtype.ext (hindex he)) hh hh1 hS freq scale u (fun i => i.property) + have hb := orbital_near_cell_volume (fun i : {i // b i} => index i.val) + (fun i j he => Subtype.ext (hindex he)) (R := 4*R) hh (mul_nonneg (by norm_num) hR) v + (fun i => by simpa only [b,norm_sub_rev] using i.property) + have hcard : Fintype.card {i // a i ∨ b i} ≤ + Fintype.card {i // a i}+Fintype.card {i // b i} := by + simp only [Fintype.card_subtype] + have he : (Finset.univ.filter (fun i => a i ∨ b i)) = + (Finset.univ.filter a) ∪ (Finset.univ.filter b) := by + ext i + simp only [Finset.mem_filter,Finset.mem_univ,true_and,Finset.mem_union] + rw [he] + exact Finset.card_union_le _ _ + have hcardR : (Fintype.card {i // a i ∨ b i}:ℝ) ≤ + (Fintype.card {i // a i}:ℝ)+(Fintype.card {i // b i}:ℝ) := by exact_mod_cast hcard + have hs := mul_le_mul_of_nonneg_right hcardR (pow_nonneg hh.le 3) + have he : Fintype.card {i // sourceExceptionalCell (tsupport (manufacturedWellField freq scale S u)) + v R (gaussCellCenter h (index i)) h} = Fintype.card {i // a i ∨ b i} := + Fintype.card_congr (Equiv.subtypeEquivRight (fun _ => Iff.rfl)) + rw [he] + nlinarith only [hs,ha,hb] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceFinalGraph.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceFinalGraph.lean new file mode 100644 index 0000000000000000000000000000000000000000..060b517315fc7245df0c3976a7f8613a831635b8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceFinalGraph.lean @@ -0,0 +1,82 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceContactCorrectness +import OAI.MathematicalPhysics.ContinuumCoulomb.ManyBody.MediatorSimple + +namespace OAI + +/-! The exact final graph indexed by the literal output vertex count. +Changing only the proof of that count preserves every bond and weight. -/ + +noncomputable section +namespace ContinuumCoulomb.MediatorIteration + +def Bonds.castSites {n n' r : ℕ} (h : n=n') (F : Bonds n r) : Bonds n' r := h ▸ F + +@[simp] theorem Bonds.castSites_toList {n n' r : ℕ} (h : n=n') (F : Bonds n r) : + (F.castSites h).toList=F.toList := by cases h; rfl + +@[simp] theorem Bonds.castSites_weight {n n' r : ℕ} (h : n=n') (F : Bonds n r) : + (F.castSites h).weight=F.weight := by cases h; rfl + +@[simp] theorem Bonds.castSites_left {n n' r : ℕ} (h : n=n') (F : Bonds n r) (e : Fin r) : + (F.castSites h).left e=Fin.cast h (F.left e) := by cases h; rfl + +@[simp] theorem Bonds.castSites_right {n n' r : ℕ} (h : n=n') (F : Bonds n r) (e : Fin r) : + (F.castSites h).right e=Fin.cast h (F.right e) := by cases h; rfl + +theorem Bonds.castSites_noLoops {n n' r : ℕ} (h : n=n') (F : Bonds n r) (hF : F.NoLoops) : + (F.castSites h).NoLoops := by cases h; exact hF + +theorem Bonds.castSites_simple {n n' r : ℕ} (h : n=n') (F : Bonds n r) (hF : F.Simple) : + (F.castSites h).Simple := by cases h; exact hF + +end ContinuumCoulomb.MediatorIteration + +namespace ContinuumCoulomb.SourcePositiveProgram +open MediatorIteration SourceMetadataProgram ContactMediator + +abbrev graphEdgeCount (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) : ℕ := + (geometricSource s d hd).edges + + (((geometricSource s d hd).edges * 2 + (geometricSource s d hd).edges * 2 * 2) + + ((geometricSource s d hd).edges * 2 + (geometricSource s d hd).edges * 2 * 2) * 2) + +def graph (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) : + Bonds (output s d).vertices (graphEdgeCount s d hd) := + (finalGraph (sourceFamily s d hd) (sourceBound s d) (size d^s)).castSites + (by simpa only [BinaryHeisenberg.toSource] using (vertices_eq s d hd).symm) + +theorem graph_toList (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) : + (graph s d hd).toList=(output s d).bonds := by + unfold graph + erw [Bonds.castSites_toList] + exact (bonds_eq s d hd).symm + +theorem graph_weight (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) : + (graph s d hd).weight=SourceContactProgram.weights s d hd := by + unfold graph + erw [Bonds.castSites_weight] + rfl + +theorem graph_noLoops (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) : + (graph s d hd).NoLoops := + Bonds.castSites_noLoops _ _ (finalGraph_noLoops _ _ _) + +theorem graph_simple (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) : + (graph s d hd).Simple := + Bonds.castSites_simple _ _ (finalGraph_simple _ _ _) + +theorem hubbardGraph_exists (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) + {m : ℕ} (hm : (output s d).vertices=m+1) : + ∃ F : Bonds (m+1) (graphEdgeCount s d hd), + F.toList=(output s d).bonds ∧ F.NoLoops ∧ F.Simple ∧ + F.weight=SourceContactProgram.weights s d hd := by + refine ⟨(graph s d hd).castSites hm,?_,?_,?_,?_⟩ + · rw [Bonds.castSites_toList,graph_toList] + · exact Bonds.castSites_noLoops hm _ (graph_noLoops s d hd) + · exact Bonds.castSites_simple hm _ (graph_simple s d hd) + · rw [Bonds.castSites_weight,graph_weight] + +end ContinuumCoulomb.SourcePositiveProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceFiniteBounds.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceFiniteBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..d89416e2dcb454c247835445d2c049b13ea88074 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceFiniteBounds.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.TargetHubbardParameters +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.LocalizedGramSpacing + +namespace OAI + +/-! Uniform finite-Hamiltonian bounds used before selecting the source +geometry and numerical precision. -/ + +noncomputable section +open scoped BigOperators +namespace ContinuumCoulomb + +theorem exists_target_hopping_exponent (freq : ℝ) (R A : ℕ) : + ∃ v : ℕ, 1 ≤ v ∧ ∀ (N τ : ℝ), 2 ≤ N → 0 ≤ τ → τ ≤ 1 → + ∀ {Edge : Type*} [Fintype Edge], (Fintype.card Edge : ℝ) ≤ N^R → + ∀ (distance K : Edge → ℝ), (∀ e, 0 ≤ K e) → (∀ e, K e ≤ N^A) → + (∑ e, |coulombHoppingTarget freq τ (K e) (distance e)|) ≤ N^v := by + obtain ⟨q,hq,hconst⟩ := exists_polynomial_constant_bounds (by norm_num : (0:ℝ)<1) + (Real.sqrt (localizedCoulombProfile freq 0)) + refine ⟨R+A+q,by omega,?_⟩ + intro N τ hN hτ hτ1 Edge _ hcard distance K hK hKhi + have hN1 : 1 ≤ N := by linarith + have hsqrt : Real.sqrt (N^A*localizedCoulombProfile freq 0) ≤ N^(A+q) := by + rw [Real.sqrt_mul (by positivity : (0:ℝ) ≤ N^A),pow_add] + apply mul_le_mul ?_ (hconst N hN).2 (Real.sqrt_nonneg _) (by positivity) + apply Real.sqrt_le_iff.mpr + refine ⟨by positivity,?_⟩ + nlinarith [one_le_pow₀ hN1 (n := A)] + have hτsqrt : τ*Real.sqrt (N^A*localizedCoulombProfile freq 0) ≤ N^(A+q) := + (mul_le_mul_of_nonneg_right hτ1 (Real.sqrt_nonneg _)).trans (by simpa using hsqrt) + have hcardmul := mul_le_mul hcard hτsqrt + (mul_nonneg hτ (Real.sqrt_nonneg _)) (by positivity : (0:ℝ) ≤ N^R) + rw [← pow_add] at hcardmul + have ht := target_hopping_sum_bound freq τ (N^A) hτ distance K hK hKhi + have h4 := mul_le_mul_of_nonneg_left hcardmul (by norm_num : (0:ℝ) ≤ 4) + have he : R+(A+q)=R+A+q := by omega + rw [he] at h4 + nlinarith only [ht,h4] + +theorem localLeakageBound_antitone (freq : ℝ) {a b : ℝ} (hab : a ≤ b) : + localLeakageBound freq b ≤ localLeakageBound freq a := by + unfold localLeakageBound + exact mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr (by linarith)) + (localizedTailConstant_nonnegative freq)) + (MeasureTheory.integral_nonneg (fun _ => abs_nonneg _)) + +theorem exists_source_leakage_threshold {freq : ℝ} (hfreq : 0 < freq) (R : ℕ) : + ∃ q : ℕ, 1 ≤ q ∧ ∀ (k : ℕ), q ≤ k → ∀ (N D : ℝ), 2 ≤ N → + 25*(k:ℝ)*Real.log N ≤ D → ∀ M : ℕ, (M:ℝ) ≤ N^R → + 5 ≤ D ∧ (M:ℝ)*localLeakageBound freq D ≤ localDualMass freq/2 := by + obtain ⟨q,hq,hspacing⟩ := exists_localizedGram_spacing hfreq R + refine ⟨q,by omega,fun k hk N D hN hD M hM => ?_⟩ + have hlog : 0 ≤ Real.log N := Real.log_nonneg (by linarith) + have hqk : (q:ℝ) ≤ 25*(k:ℝ) := by + have hh : (q:ℝ) ≤ k := by exact_mod_cast hk + nlinarith [Nat.cast_nonneg k (α := ℝ)] + have hqd : (q:ℝ)*Real.log N ≤ D := (mul_le_mul_of_nonneg_right hqk hlog).trans hD + obtain ⟨hfive,hleak⟩ := hspacing N hN + refine ⟨hfive.trans hqd,?_⟩ + exact (mul_le_mul hM (localLeakageBound_antitone freq hqd) + (localLeakageBound_nonnegative freq D) (by positivity)).trans hleak + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceGeometryBounds.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceGeometryBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..bc83721f6a323d21bacf867f8931c28b71fb299b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceGeometryBounds.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceNormalizedLattice +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourcePositiveBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.ContactExtent + +namespace OAI + +/-! Polynomial site counts, coordinate extent and coefficient ranges for +the literal normalized source passed to the contact realization. -/ + +noncomputable section +namespace ContinuumCoulomb.SourceMetadataProgram +open ContactMediator + +def geometricSource (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) : SquareLatticeHeisenberg := + SourceNormalizedSpectrum.lattice (d.toSource h) (roundingDenominator k d) + +@[simp] theorem geometricSource_bonds (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) : + (geometricSource k d h).bonds = + SourceNormalizedSpectrum.family (d.toSource h) (roundingDenominator k d) := rfl + +private theorem nineteen_mul_le_sixth (L : ℕ) : 19 * L ≤ (L + 2) ^ 6 := by + have h19 : 19 ≤ (L + 2) ^ 5 := + (by norm_num : 19 ≤ 2 ^ 5).trans (Nat.pow_le_pow_left (by omega) 5) + calc + 19 * L ≤ (L + 2) ^ 5 * (L + 2) := Nat.mul_le_mul h19 (by omega) + _ = (L + 2) ^ 6 := by ring + +theorem geometricSource_count (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) : + (Fintype.card (GlobalSite (geometricSource k d h)) : ℝ) ≤ + ((binaryHeisenbergCodec.encode d).length + 2 : ℝ) ^ 6 := by + have hc := (positive_graph_count_bound k d h).1 + have hp := hc.trans (nineteen_mul_le_sixth (binaryHeisenbergCodec.encode d).length) + rw [globalSite_card] + change ((d.coordinate.length + 18 * + (SourceNormalizedSpectrum.retained (d.toSource h) (roundingDenominator k d)).length : ℕ) : ℝ) ≤ _ + exact_mod_cast hp + +theorem geometricSource_coordinates (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) + (hp : d.PolynomialPromise k) (j : Fin (geometricSource k d h).vertices) (i : Fin 2) : + |(contactGridAxis ((geometricSource k d h).coordinate j) i : ℝ)| ≤ + ((binaryHeisenbergCodec.encode d).length + 2 : ℝ) ^ k := by + have he := binaryHeisenberg_decoded_extent k d h hp j + have hpow : ((binaryHeisenbergCodec.encode d).length + 1 : ℝ) ^ k ≤ + ((binaryHeisenbergCodec.encode d).length + 2 : ℝ) ^ k := + pow_le_pow_left₀ (by positivity) (by linarith) k + change |(contactGridAxis ((d.toSource h).coordinate j) i : ℝ)| ≤ _ + fin_cases i + · exact he.1.trans hpow + · exact he.2.trans hpow + +theorem geometricSource_weight_range (k : ℕ) : + ∃ A : ℕ, 0 < A ∧ ∀ (d : BinaryHeisenberg) (h : d.Valid), d.PolynomialPromise k → + ∀ e : GlobalEdge (geometricSource k d h), + (((binaryHeisenbergCodec.encode d).length + 2 : ℝ) ^ A)⁻¹ ≤ + ((MediatorIteration.finalGraph (geometricSource k d h).bonds + (roundingDenominator k d + size d ^ k + 1) (size d ^ k)).weight e : ℝ) ∧ + ((MediatorIteration.finalGraph (geometricSource k d h).bonds + (roundingDenominator k d + size d ^ k + 1) (size d ^ k)).weight e : ℝ) ≤ + ((binaryHeisenbergCodec.encode d).length + 2 : ℝ) ^ A := by + obtain ⟨A, hA, hweight⟩ := source_positive_weight_range k + exact ⟨A, hA, hweight⟩ + +end ContinuumCoulomb.SourceMetadataProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceGraphIndex.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceGraphIndex.lean new file mode 100644 index 0000000000000000000000000000000000000000..b4143ddbb0a57de008a48fb9da7a8042cbb15551 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceGraphIndex.lean @@ -0,0 +1,103 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceFinalGraph +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.PrefactorSourceContactCorrectness + +namespace OAI + +/-! The actual contact-site enumeration and the finite Hubbard graph use +one common electron index. Relabeling changes no bond or coordinate order. -/ + +noncomputable section +namespace ContinuumCoulomb.SourcePositiveProgram +open MediatorIteration ContactMediator SourceMetadataProgram + +private theorem rawSiteCount (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) : + (geometricSource s d hd).vertices+(geometricSource s d hd).edges*2+ + (geometricSource s d hd).edges*2*2+ + ((geometricSource s d hd).edges*2+(geometricSource s d hd).edges*2*2)*2 = + (output s d).vertices := by + simpa only [geometricSource,SourceNormalizedSpectrum.lattice,BinaryHeisenberg.toSource] + using (vertices_eq s d hd).symm + +def siteEquiv (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) : + GlobalSite (geometricSource s d hd) ≃ Fin (output s d).vertices := + finCongr (rawSiteCount s d hd) + +@[irreducible] def indexedGraph (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) {m : ℕ} + (hm : (output s d).vertices=m+1) : Bonds (m+1) (graphEdgeCount s d hd) := + (graph s d hd).castSites hm + +def indexedSites (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) {m : ℕ} + (hm : (output s d).vertices=m+1) : GlobalSite (geometricSource s d hd) ≃ Fin (m+1) := + (siteEquiv s d hd).trans (finCongr hm) + +theorem graph_left (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) + (a : GlobalEdge (geometricSource s d hd)) : + (graph s d hd).left a = siteEquiv s d hd + ((finalGraph (geometricSource s d hd).bonds (sourceBound s d) (size d^s)).left a) := by + unfold graph + erw [Bonds.castSites_left] + rfl + +theorem graph_right (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) + (a : GlobalEdge (geometricSource s d hd)) : + (graph s d hd).right a = siteEquiv s d hd + ((finalGraph (geometricSource s d hd).bonds (sourceBound s d) (size d^s)).right a) := by + unfold graph + erw [Bonds.castSites_right] + rfl + +theorem indexedGraph_left (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) {m : ℕ} + (hm : (output s d).vertices=m+1) (a : GlobalEdge (geometricSource s d hd)) : + (indexedGraph s d hd hm).left a = indexedSites s d hd hm + ((finalGraph (geometricSource s d hd).bonds (sourceBound s d) (size d^s)).left a) := by + unfold indexedGraph + erw [Bonds.castSites_left,graph_left] + rfl + +theorem indexedGraph_right (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) {m : ℕ} + (hm : (output s d).vertices=m+1) (a : GlobalEdge (geometricSource s d hd)) : + (indexedGraph s d hd hm).right a = indexedSites s d hd hm + ((finalGraph (geometricSource s d hd).bonds (sourceBound s d) (size d^s)).right a) := by + unfold indexedGraph + erw [Bonds.castSites_right,graph_right] + rfl + +theorem indexedGraph_toList (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) {m : ℕ} + (hm : (output s d).vertices=m+1) : + (indexedGraph s d hd hm).toList=(output s d).bonds := by + rw [indexedGraph,Bonds.castSites_toList,graph_toList] + +theorem indexedGraph_weight (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) {m : ℕ} + (hm : (output s d).vertices=m+1) : + (indexedGraph s d hd hm).weight=SourceContactProgram.weights s d hd := by + rw [indexedGraph,Bonds.castSites_weight,graph_weight] + +theorem indexedGraph_noLoops (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) {m : ℕ} + (hm : (output s d).vertices=m+1) : (indexedGraph s d hd hm).NoLoops := by + unfold indexedGraph + exact Bonds.castSites_noLoops hm _ (graph_noLoops s d hd) + +theorem indexedGraph_simple (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) {m : ℕ} + (hm : (output s d).vertices=m+1) : (indexedGraph s d hd hm).Simple := by + unfold indexedGraph + exact Bonds.castSites_simple hm _ (graph_simple s d hd) + +private theorem ofFn_finCongr {α : Type*} {n m : ℕ} (h : n=m) (f : Fin n → α) : + List.ofFn (fun i => f ((finCongr h).symm i)) = List.ofFn f := by + subst m + rfl + +theorem indexedSites_ofFn {α : Type*} (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) {m : ℕ} + (hm : (output s d).vertices=m+1) (f : GlobalSite (geometricSource s d hd) → α) : + List.ofFn (fun i => f ((indexedSites s d hd hm).symm i))=List.ofFn f := by + unfold indexedSites siteEquiv + change List.ofFn (fun i => f ((finCongr (rawSiteCount s d hd)).symm + ((finCongr hm).symm i)))=List.ofFn f + exact (ofFn_finCongr hm (fun i => f ((finCongr (rawSiteCount s d hd)).symm i))).trans + (ofFn_finCongr (rawSiteCount s d hd) f) + +end ContinuumCoulomb.SourcePositiveProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceGridGeometry.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceGridGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..4fecf2bf796d37fc5644dd7cf9bb3cd18b2e65fa --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceGridGeometry.lean @@ -0,0 +1,91 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.SourceNuclearProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.GridNodePrecision +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.EnumeratedGridNuclei + +namespace OAI + +/-! Exact scale and box identities for the existing source nuclear program. +The calibrated source-site geometry is handled separately. -/ + +noncomputable section +namespace ContinuumCoulomb.SourceNuclearProgram + +theorem amplification_real (rho k : ℕ) (d : BinaryHeisenberg) : + (amplification rho k d:ℝ) = (8/(rho:ℝ))*((SourceContactProgram.size d:ℝ)^k)^30 := by + simp only [amplification,CenteredPhysicalThreshold.amplification,SourcePhysicalThreshold.mesh, + Rat.cast_div,Rat.cast_mul,Rat.cast_pow,Rat.cast_natCast,Rat.cast_ofNat,Nat.cast_pow] + rw [← pow_mul,← pow_mul] + ring + +theorem inverse_mesh_real (k : ℕ) (d : BinaryHeisenberg) : + (SourcePhysicalThreshold.mesh k d:ℝ)⁻¹ = 1/((SourceContactProgram.size d:ℝ)^k)^10 := by + simp only [SourcePhysicalThreshold.mesh,Nat.cast_pow,one_div,← pow_mul] + congr 2 + omega + +theorem horizontal_bounds (k : ℕ) (d : BinaryHeisenberg) : + ((SourceContactProgram.size d:ℝ)^k)^50 ≤ (SourcePhysicalThreshold.slabHorizontal k d:ℝ) ∧ + (SourcePhysicalThreshold.slabHorizontal k d:ℝ) ≤ 2*((SourceContactProgram.size d:ℝ)^k)^50 := by + have h := SourcePhysicalThreshold.slabHorizontal_bounds k d + exact_mod_cast (show ((SourceContactProgram.size d:ℚ)^k)^50 ≤ SourcePhysicalThreshold.slabHorizontal k d ∧ + SourcePhysicalThreshold.slabHorizontal k d ≤ 2*((SourceContactProgram.size d:ℚ)^k)^50 by + simpa only [← pow_mul,Nat.cast_pow,show k*50=50*k by omega] using h) + +theorem vertical_bounds (k : ℕ) (d : BinaryHeisenberg) : + ((SourceContactProgram.size d:ℝ)^k)^5 ≤ (SourcePhysicalThreshold.slabVertical k d:ℝ) ∧ + (SourcePhysicalThreshold.slabVertical k d:ℝ) ≤ 2*((SourceContactProgram.size d:ℝ)^k)^5 := by + have h := SourcePhysicalThreshold.slabVertical_bounds k d + exact_mod_cast (show ((SourceContactProgram.size d:ℚ)^k)^5 ≤ SourcePhysicalThreshold.slabVertical k d ∧ + SourcePhysicalThreshold.slabVertical k d ≤ 2*((SourceContactProgram.size d:ℚ)^k)^5 by + simpa only [← pow_mul,Nat.cast_pow,show k*5=5*k by omega] using h) + +def radii (k : ℕ) (d : BinaryHeisenberg) : CenteredGaussLabels.Radii := + (SourcePhysicalThreshold.horizontalRadius k d, + (SourcePhysicalThreshold.horizontalRadius k d,SourcePhysicalThreshold.verticalRadius k d)) + +theorem grid_cover (k : ℕ) (d : BinaryHeisenberg) : + (⋃ j : {j // j ∈ centeredGridIndices (CenteredGaussLabels.radiiVector (radii k d))}, + positionCube (gaussCellCenter (1/((SourceContactProgram.size d:ℝ)^k)^10) j.val) + (1/((SourceContactProgram.size d:ℝ)^k)^10)) = + slabDomain (SourcePhysicalThreshold.slabHorizontal k d) (SourcePhysicalThreshold.slabVertical k d) := by + rw [← inverse_mesh_real] + rw [centeredGrid_covers (CenteredGaussLabels.radiiVector (radii k d)) (by + exact inv_pos.mpr (by exact_mod_cast SourcePhysicalThreshold.mesh_positive k d))] + ext y + change (∀ i, |y i| ≤ ((CenteredGaussLabels.radiiVector (radii k d) i:ℝ)+1/2)* + (SourcePhysicalThreshold.mesh k d:ℝ)⁻¹) ↔ _ + simp only [SourcePhysicalThreshold.slabHorizontal,SourcePhysicalThreshold.slabVertical, + SlabBoxSchedule.centeredWidth_real,slabDomain,Set.mem_ofPred_eq] + constructor + · intro h + exact ⟨by simpa [CenteredGaussLabels.radiiVector,radii,div_eq_mul_inv] using h 0, + by simpa [CenteredGaussLabels.radiiVector,radii,div_eq_mul_inv] using h 1, + by simpa [CenteredGaussLabels.radiiVector,radii,div_eq_mul_inv] using h 2⟩ + · rintro ⟨h0,h1,h2⟩ i + fin_cases i + · simpa [CenteredGaussLabels.radiiVector,radii,div_eq_mul_inv] using h0 + · simpa [CenteredGaussLabels.radiiVector,radii,div_eq_mul_inv] using h1 + · simpa [CenteredGaussLabels.radiiVector,radii,div_eq_mul_inv] using h2 + +theorem factor_amplification {rho : ℕ} (hrho : 0 < rho) (k : ℕ) (d : BinaryHeisenberg) : + (PhysicalNuclearProgram.factor rho (SourcePhysicalThreshold.mesh k d):ℝ)= + (amplification rho k d:ℝ)⁻¹ := by + have hm : (SourcePhysicalThreshold.mesh k d:ℝ) ≠ 0 := by + exact_mod_cast (SourcePhysicalThreshold.mesh_positive k d).ne' + have hr : (rho:ℝ) ≠ 0 := by exact_mod_cast hrho.ne' + rw [PhysicalNuclearProgram.factor_real] + simp only [amplification,CenteredPhysicalThreshold.amplification,Rat.cast_div,Rat.cast_mul, + Rat.cast_pow,Rat.cast_ofNat,Rat.cast_natCast] + field_simp + +theorem grid_count (k : ℕ) (d : BinaryHeisenberg) : + ((CenteredGaussLabels.labels (radii k d)).length:ℝ) ≤ + (SourceContactProgram.size d:ℝ)^(135*k+8) := by + apply centered_grid_count_power (by exact_mod_cast SourceContactProgram.size_ge_two d) k + all_goals simp only [radii,SourcePhysicalThreshold.horizontalRadius,SourcePhysicalThreshold.verticalRadius,Nat.cast_pow]; rfl + +end ContinuumCoulomb.SourceNuclearProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceHamiltonian.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceHamiltonian.lean new file mode 100644 index 0000000000000000000000000000000000000000..af7d9b1ae44b8f8a84fff07929f7a583f7453883 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceHamiltonian.lean @@ -0,0 +1,229 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.ManyBody.Spin +import Mathlib.Basic.Complex.BigOperators +import Mathlib.Data.EReal.Basic +import Mathlib.Data.Fintype.Pi +import Mathlib.Logic.Equiv.Prod +import Mathlib.Tactic.Positivity + +namespace OAI + +/-! +# Signed square-lattice Heisenberg source + +The finite source is the field-free Heisenberg problem of +Cubitt–Montanaro–Piddock, *Universal quantum Hamiltonians*, +arXiv:1701.05182v4, Theorem 48, Lemma 47 and Section 10.1. +The coordinate-swap action realizes `2 SWAP - I`. Coefficient-rounding +estimates hold for arbitrary many-spin states, including entangled states. +-/ + +noncomputable section + +namespace ContinuumCoulomb + +open scoped BigOperators + +abbrev SourceSpinBasis (n : ℕ) := Fin n → Fin 2 +abbrev SourceSpinVector (n : ℕ) := SourceSpinBasis n → ℂ + +def sourceSpinMass {n : ℕ} (u : SourceSpinVector n) : ℝ := + ∑ s, Complex.normSq (u s) + +/-- Swap the two selected spin coordinates, leaving every spectator fixed. -/ +def sourceSpinSwap {n : ℕ} (i j : Fin n) : + SourceSpinBasis n ≃ SourceSpinBasis n := + Equiv.arrowCongr (Equiv.swap i j) (Equiv.refl (Fin 2)) + +theorem sourceSpinSwap_apply {n : ℕ} (i j : Fin n) + (s : SourceSpinBasis n) (k : Fin n) : + sourceSpinSwap i j s k = s (Equiv.swap i j k) := by + simp [sourceSpinSwap, Equiv.arrowCongr_apply] + +theorem sourceSpinSwap_involutive {n : ℕ} (i j : Fin n) : + Function.Involutive (sourceSpinSwap i j) := by + intro s + funext k + simp [sourceSpinSwap_apply] + +theorem sourceSpinMass_nonneg {n : ℕ} (u : SourceSpinVector n) : + 0 ≤ sourceSpinMass u := + Finset.sum_nonneg fun _ _ => Complex.normSq_nonneg _ + +theorem sourceSpinMass_swap {n : ℕ} (i j : Fin n) (u : SourceSpinVector n) : + (∑ s, Complex.normSq (u (sourceSpinSwap i j s))) = sourceSpinMass u := + (sourceSpinSwap i j).sum_comp (fun s => Complex.normSq (u s)) + +/-- The expectation of coordinate exchange, taking its real part. -/ +def sourceSwapExpectation {n : ℕ} (i j : Fin n) (u : SourceSpinVector n) : ℝ := + ∑ s, (star (u s) * u (sourceSpinSwap i j s)).re + +theorem sourceSwapExpectation_add_identity {n : ℕ} + (i j : Fin n) (u : SourceSpinVector n) : + (∑ s, Complex.normSq (u s + u (sourceSpinSwap i j s))) = + 2 * sourceSpinMass u + 2 * sourceSwapExpectation i j u := by + have hpoint (s : SourceSpinBasis n) : + Complex.normSq (u s + u (sourceSpinSwap i j s)) = + Complex.normSq (u s) + Complex.normSq (u (sourceSpinSwap i j s)) + + 2 * (star (u s) * u (sourceSpinSwap i j s)).re := by + simp [Complex.normSq_apply, Complex.mul_re, Complex.star_def] + ring + simp_rw [hpoint] + rw [Finset.sum_add_distrib, Finset.sum_add_distrib, ← Finset.mul_sum, + sourceSpinMass_swap] + unfold sourceSpinMass sourceSwapExpectation + ring + +theorem sourceSwapExpectation_sub_identity {n : ℕ} + (i j : Fin n) (u : SourceSpinVector n) : + (∑ s, Complex.normSq (u s - u (sourceSpinSwap i j s))) = + 2 * sourceSpinMass u - 2 * sourceSwapExpectation i j u := by + have hpoint (s : SourceSpinBasis n) : + Complex.normSq (u s - u (sourceSpinSwap i j s)) = + Complex.normSq (u s) + Complex.normSq (u (sourceSpinSwap i j s)) - + 2 * (star (u s) * u (sourceSpinSwap i j s)).re := by + simp [Complex.normSq_apply, Complex.mul_re, Complex.star_def] + ring + simp_rw [hpoint] + rw [Finset.sum_sub_distrib, Finset.sum_add_distrib, ← Finset.mul_sum, + sourceSpinMass_swap] + unfold sourceSpinMass sourceSwapExpectation + ring + +theorem sourceSwapExpectation_bounds {n : ℕ} + (i j : Fin n) (u : SourceSpinVector n) : + -sourceSpinMass u ≤ sourceSwapExpectation i j u ∧ + sourceSwapExpectation i j u ≤ sourceSpinMass u := by + have hp := sourceSwapExpectation_add_identity i j u + have hm := sourceSwapExpectation_sub_identity i j u + have hp0 : 0 ≤ ∑ s, Complex.normSq (u s + u (sourceSpinSwap i j s)) := + Finset.sum_nonneg fun _ _ => Complex.normSq_nonneg _ + have hm0 : 0 ≤ ∑ s, Complex.normSq (u s - u (sourceSpinSwap i j s)) := + Finset.sum_nonneg fun _ _ => Complex.normSq_nonneg _ + constructor <;> linarith + +/-- The local Heisenberg action on the complete `n`-spin Hilbert space. -/ +def sourceHeisenbergAction {n : ℕ} (i j : Fin n) (u : SourceSpinVector n) : + SourceSpinVector n := + fun s => 2 * u (sourceSpinSwap i j s) - u s + +/-- The real quadratic form of the local Heisenberg interaction. -/ +def sourceHeisenbergForm {n : ℕ} (i j : Fin n) (u : SourceSpinVector n) : ℝ := + ∑ s, (star (u s) * sourceHeisenbergAction i j u s).re + +theorem sourceHeisenbergForm_eq {n : ℕ} + (i j : Fin n) (u : SourceSpinVector n) : + sourceHeisenbergForm i j u = + 2 * sourceSwapExpectation i j u - sourceSpinMass u := by + have hpoint (s : SourceSpinBasis n) : + (star (u s) * sourceHeisenbergAction i j u s).re = + 2 * (star (u s) * u (sourceSpinSwap i j s)).re - Complex.normSq (u s) := by + simp [sourceHeisenbergAction, Complex.mul_re, Complex.normSq_apply, Complex.star_def] + ring + simp only [sourceHeisenbergForm, hpoint, Finset.sum_sub_distrib, + ← Finset.mul_sum, sourceSwapExpectation, sourceSpinMass] + +theorem sourceHeisenbergForm_bounds {n : ℕ} + (i j : Fin n) (u : SourceSpinVector n) : + -3 * sourceSpinMass u ≤ sourceHeisenbergForm i j u ∧ + sourceHeisenbergForm i j u ≤ sourceSpinMass u := by + obtain ⟨hl, hu⟩ := sourceSwapExpectation_bounds i j u + rw [sourceHeisenbergForm_eq] + constructor <;> linarith + +theorem sourceHeisenbergForm_abs_le {n : ℕ} + (i j : Fin n) (u : SourceSpinVector n) : + |sourceHeisenbergForm i j u| ≤ 3 * sourceSpinMass u := by + obtain ⟨hl, hu⟩ := sourceHeisenbergForm_bounds i j u + have hn := sourceSpinMass_nonneg u + apply abs_le.mpr + constructor <;> linarith + +/-- The signed rational field-free square-lattice source input. Polynomial +size/weight bounds are properties of the published reduction, not extra +one-site terms or restrictions on the variational spin states. -/ +structure SquareLatticeHeisenberg where + vertices : ℕ + vertices_pos : 0 < vertices + coordinate : Fin vertices → ℤ × ℤ + coordinate_injective : Function.Injective coordinate + edges : ℕ + left : Fin edges → Fin vertices + right : Fin edges → Fin vertices + adjacent : ∀ e, + Int.natAbs ((coordinate (left e)).1 - (coordinate (right e)).1) + + Int.natAbs ((coordinate (left e)).2 - (coordinate (right e)).2) = 1 + edge_simple : ∀ e f, e ≠ f → + ¬(left e = left f ∧ right e = right f) ∧ + ¬(left e = right f ∧ right e = left f) + coefficient : Fin edges → ℚ + lower : ℚ + upper : ℚ + gap_pos : lower < upper + +theorem SquareLatticeHeisenberg.edge_ne (d : SquareLatticeHeisenberg) + (e : Fin d.edges) : d.left e ≠ d.right e := by + intro heq + have h := d.adjacent e + rw [heq] at h + simp at h + +/-- Complete finite Hamiltonian, with no magnetic or one-site terms. -/ +def sourceHamiltonian (d : SquareLatticeHeisenberg) + (u : SourceSpinVector d.vertices) : SourceSpinVector d.vertices := + fun s => ∑ e, (d.coefficient e : ℂ) * + sourceHeisenbergAction (d.left e) (d.right e) u s + +def sourceHamiltonianForm (d : SquareLatticeHeisenberg) + (u : SourceSpinVector d.vertices) : ℝ := + ∑ e, (d.coefficient e : ℝ) * sourceHeisenbergForm (d.left e) (d.right e) u + +/-- Real quadratic form of the explicitly defined complete Hamiltonian. -/ +theorem sourceHamiltonianForm_eq_expectation (d : SquareLatticeHeisenberg) + (u : SourceSpinVector d.vertices) : + sourceHamiltonianForm d u = + (∑ s, star (u s) * sourceHamiltonian d u s).re := by + unfold sourceHamiltonian sourceHamiltonianForm sourceHeisenbergForm + simp only [Finset.mul_sum, Complex.re_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro s _ + apply Finset.sum_congr rfl + intro e _ + simp [Complex.mul_re, Complex.star_def] + ring + +/-- Variational source energy over all normalized spin states. -/ +def sourceGroundEnergy (d : SquareLatticeHeisenberg) : EReal := + sInf {e | ∃ u : SourceSpinVector d.vertices, + sourceSpinMass u = 1 ∧ e = (sourceHamiltonianForm d u : EReal)} + +/-- Rounding arbitrary signed coefficients incurs the sum of the local +`3|ΔJ|` errors, for the actual complete many-spin state. -/ +theorem sourceHamiltonianForm_rounding + (d : SquareLatticeHeisenberg) (rounded : Fin d.edges → ℝ) + (u : SourceSpinVector d.vertices) (hu : sourceSpinMass u = 1) : + |sourceHamiltonianForm d u - + ∑ e, rounded e * sourceHeisenbergForm (d.left e) (d.right e) u| ≤ + 3 * ∑ e, |(d.coefficient e : ℝ) - rounded e| := by + unfold sourceHamiltonianForm + rw [← Finset.sum_sub_distrib] + calc + |∑ e, ((d.coefficient e : ℝ) * sourceHeisenbergForm (d.left e) (d.right e) u - + rounded e * sourceHeisenbergForm (d.left e) (d.right e) u)| ≤ + ∑ e, |(d.coefficient e : ℝ) * sourceHeisenbergForm (d.left e) (d.right e) u - + rounded e * sourceHeisenbergForm (d.left e) (d.right e) u| := + Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ e, 3 * |(d.coefficient e : ℝ) - rounded e| := by + apply Finset.sum_le_sum + intro e _ + rw [← sub_mul, abs_mul] + have h := sourceHeisenbergForm_abs_le (d.left e) (d.right e) u + rw [hu, mul_one] at h + nlinarith [abs_nonneg ((d.coefficient e : ℝ) - rounded e)] + _ = 3 * ∑ e, |(d.coefficient e : ℝ) - rounded e| := (Finset.mul_sum _ _ _).symm + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceHardness.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceHardness.lean new file mode 100644 index 0000000000000000000000000000000000000000..80a7f5175562f8c4a24facbf49de7fd3aaddc488 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceHardness.lean @@ -0,0 +1,37 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryLiteralPromise +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumHistoryLiteralCorrectness + +namespace OAI + +/-! +QMA hardness of the field-free signed square-lattice Heisenberg +problem through a polynomial circuit compiler and full-space energy bounds. +-/ + +noncomputable section +namespace ContinuumCoulomb + +theorem publishedCMPHardness : PublishedCMPHardness := by + obtain ⟨k,hk,hpromise⟩ := QuantumHistorySourceProgram.circuit_polynomialPromise + refine ⟨k,hk,?_⟩ + intro P hP + obtain ⟨V,hyes,hno⟩ := hP + refine ⟨{ + map := QuantumHistorySourceProgram.fromVerifier V + polynomialTime := QuantumHistorySourceProgram.fromVerifier_uniform V + maps_yes := ?_ + maps_no := ?_ + }⟩ + · intro x hx + obtain ⟨psi,hpsi,ha⟩ := hyes x hx + exact QuantumHistorySourceProgram.literal_accepting (V.generate x) (V.wellFormed x) + (hpromise _ (V.wellFormed x)) psi hpsi ha + · intro x hx + exact QuantumHistorySourceProgram.literal_rejecting (V.generate x) (V.wellFormed x) + (hpromise _ (V.wellFormed x)) (hno x hx) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceHoppingBudget.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceHoppingBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..05701ebb2d7fd1b6bacfadc618ddbd66b5ba8d81 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceHoppingBudget.lean @@ -0,0 +1,115 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.CalibratedMatrixError +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.PolynomialHoppingSmallness +import OAI.MathematicalPhysics.ContinuumCoulomb.Nuclei.RoundingPolynomialBudget + +namespace OAI + +/-! Polynomial budgets for the unwanted nonedge hopping and the finite +coordinate error of the rational contact realization. -/ + +noncomputable section +namespace ContinuumCoulomb + +theorem exists_nonedge_hopping_offset {a : ℝ} (ha : 0 < a) : + ∃ q : ℕ, 1 ≤ q ∧ ∀ s p k : ℕ, q+s+p ≤ 5*k → + ∀ N D : ℝ, 2 ≤ N → 35*(k:ℝ)*Real.log N ≤ D → + (a*(N^k)^30)*planarHoppingUpperConstant*(2*N^s+1)*Real.exp (-D) ≤ (N^p)⁻¹ := by + obtain ⟨q,hq,hbound⟩ := exists_polynomial_constant_bounds (by norm_num : (0:ℝ)<1) + (3*a*planarHoppingUpperConstant) + refine ⟨q,by omega,fun s p k hk N D hN hD => ?_⟩ + have hN0 : 0 < N := by linarith + have hN1 : 1 ≤ N := by linarith + have hU : 0 ≤ planarHoppingUpperConstant := planarHoppingUpperConstant_positive.le + have hexp : Real.exp (-D) ≤ (N^(35*k))⁻¹ := by + apply (Real.exp_le_exp.mpr (neg_le_neg hD)).trans_eq + rw [show -(35*(k:ℝ)*Real.log N) = -((35*k:ℕ):ℝ)*Real.log N by push_cast; ring, + neg_mul,Real.exp_neg,Real.exp_nat_mul,Real.exp_log hN0] + have hsize : 2*N^s+1 ≤ 3*N^s := by nlinarith [one_le_pow₀ hN1 (n := s)] + calc + _ ≤ (a*(N^k)^30)*planarHoppingUpperConstant*(3*N^s)*(N^(35*k))⁻¹ := by + gcongr + _ = (3*a*planarHoppingUpperConstant)*N^s*(N^(5*k))⁻¹ := by + rw [← pow_mul,show 35*k=k*30+5*k by omega,pow_add,mul_inv_rev] + field_simp + _ ≤ N^q*N^s*(N^(5*k))⁻¹ := by + gcongr + exact (hbound N hN).2 + _ = (N^(5*k))⁻¹*N^(q+s) := by rw [pow_add]; ring + _ ≤ _ := inverse_power_product_le hN1 hk + +theorem coulomb_target_lipschitz_power {N τ K : ℝ} (hN : 1 ≤ N) + (_hτ : 0 ≤ τ) (hτ1 : τ ≤ 1) (hK : 0 ≤ K) {A : ℕ} (hKA : K ≤ N^A) (freq : ℝ) : + coulombTargetLipschitzConstant freq τ K ≤ + (localizedCoulombLipschitzConstant freq/(2*Real.sqrt (localizedGramConstant freq)))*N^A := by + let C := localizedCoulombLipschitzConstant freq/(2*Real.sqrt (localizedGramConstant freq)) + have hC : 0 ≤ C := div_nonneg (localizedCoulombLipschitzConstant_nonnegative freq) (by positivity) + have hs : Real.sqrt K ≤ N^A := by + apply Real.sqrt_le_iff.mpr + refine ⟨by positivity,?_⟩ + have hp := one_le_pow₀ hN (n := A) + exact hKA.trans (by nlinarith) + have ht := mul_le_mul hτ1 hs (Real.sqrt_nonneg _) (by norm_num : (0:ℝ) ≤ 1) + calc + _ = C*(τ*Real.sqrt K) := by unfold coulombTargetLipschitzConstant C; ring + _ ≤ _ := by simpa only [one_mul,C] using mul_le_mul_of_nonneg_left ht hC + +theorem exists_contact_coordinate_offset {a : ℝ} (ha : 0 < a) (freq : ℝ) : + ∃ q : ℕ, 1 ≤ q ∧ ∀ k A s p h pc : ℕ, + q+30*k+A+s+p+1 ≤ h → p+1 ≤ pc → + ∀ N τ K Q : ℝ, 2 ≤ N → 0 ≤ τ → τ ≤ 1 → 0 ≤ K → K ≤ N^A → + 0 ≤ Q → Q ≤ N^s → + 1/(N^pc+1) + + ((a*(N^k)^30)*(planarHoppingLipschitzConstant : ℝ)+coulombTargetLipschitzConstant freq τ K)* + (Q*(72*(N^h+1)⁻¹)) ≤ (N^p)⁻¹ := by + let C := localizedCoulombLipschitzConstant freq/(2*Real.sqrt (localizedGramConstant freq)) + have hC : 0 ≤ C := div_nonneg (localizedCoulombLipschitzConstant_nonnegative freq) (by positivity) + obtain ⟨q,hq,hbound⟩ := exists_polynomial_constant_bounds (by norm_num : (0:ℝ)<1) + (72*(a*(planarHoppingLipschitzConstant : ℝ)+C)) + refine ⟨q,by omega,fun k A s p h pc hh hpc N τ K Q hN hτ hτ1 hK hKA hQ hQs => ?_⟩ + have hN0 : 0 < N := by linarith + have hN1 : 1 ≤ N := by linarith + have hL : 0 ≤ (planarHoppingLipschitzConstant : ℝ) := by positivity + have hcoef : (a*(N^k)^30)*(planarHoppingLipschitzConstant : ℝ)+ + coulombTargetLipschitzConstant freq τ K ≤ (a*(planarHoppingLipschitzConstant : ℝ)+C)*N^(30*k+A) := by + have ht := coulomb_target_lipschitz_power hN1 hτ hτ1 hK hKA freq + have h1 : (N^k)^30 ≤ N^(30*k+A) := by + rw [← pow_mul] + exact pow_le_pow_right₀ hN1 (by omega) + have h2 : N^A ≤ N^(30*k+A) := pow_le_pow_right₀ hN1 (by omega) + have hh1 := mul_le_mul_of_nonneg_left h1 (mul_nonneg ha.le hL) + have hh2 := mul_le_mul_of_nonneg_left h2 hC + change coulombTargetLipschitzConstant freq τ K ≤ C*N^A at ht + calc + _ ≤ (a*(planarHoppingLipschitzConstant : ℝ))*N^(30*k+A)+C*N^(30*k+A) := + add_le_add (by simpa only [mul_assoc,mul_comm,mul_left_comm] using hh1) (ht.trans hh2) + _ = _ := by ring + have hcoord : ((a*(N^k)^30)*(planarHoppingLipschitzConstant : ℝ)+ + coulombTargetLipschitzConstant freq τ K)*(Q*(72*(N^h+1)⁻¹)) ≤ (N^(p+1))⁻¹ := by + have hden : (N^h+1)⁻¹ ≤ (N^h)⁻¹ := inv_anti₀ (pow_pos hN0 h) (by linarith) + calc + _ ≤ ((a*(planarHoppingLipschitzConstant : ℝ)+C)*N^(30*k+A))*(N^s*(72*(N^h)⁻¹)) := by + gcongr + _ = (72*(a*(planarHoppingLipschitzConstant : ℝ)+C))*N^(30*k+A+s)*(N^h)⁻¹ := by + rw [pow_add]; ring + _ ≤ N^q*N^(30*k+A+s)*(N^h)⁻¹ := by + gcongr + exact (hbound N hN).2 + _ = (N^h)⁻¹*N^(q+30*k+A+s) := by rw [show q+30*k+A+s=q+(30*k+A+s) by omega,pow_add]; ring + _ ≤ _ := inverse_power_product_le hN1 (by omega) + have hnom : 1/(N^pc+1) ≤ (N^(p+1))⁻¹ := by + calc + _ ≤ (N^pc)⁻¹ := by simpa only [one_div] using + one_div_le_one_div_of_le (pow_pos hN0 pc) (show N^pc ≤ N^pc+1 by linarith) + _ ≤ _ := inv_anti₀ (pow_pos hN0 (p+1)) (pow_le_pow_right₀ hN1 hpc) + have htwo : 2*(N^(p+1))⁻¹ ≤ (N^p)⁻¹ := by + rw [pow_succ] + have hn := inv_anti₀ (by norm_num : (0:ℝ)<2) hN + rw [mul_inv_rev] + nlinarith [mul_le_mul_of_nonneg_right hn (by positivity : 0 ≤ (N^p)⁻¹)] + linarith + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceHubbardEnergy.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceHubbardEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..8cc4c6564ded3fdaf36da55b7c6350881ff29547 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceHubbardEnergy.lean @@ -0,0 +1,104 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourcePhysicalPromise +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.TargetHubbardParameters + +namespace OAI + +/-! Exact finite-spin and scalar-offset identities for the literal source +bond list. These identify the Hubbard center with the computed threshold center. -/ + +noncomputable section +open scoped BigOperators +namespace ContinuumCoulomb +open MediatorIteration HubbardGlobal + +theorem source_graph_bottom {m r : ℕ} (s : ℕ) (d : BinaryHeisenberg) + (F : Bonds (m+1) r) + (hvertices : (SourcePositiveProgram.output s d).vertices = m+1) + (hbonds : F.toList = (SourcePositiveProgram.output s d).bonds) (τ : ℝ) : + graphSourceBottom m F.left F.right (fun e => τ^2*(F.weight e : ℝ)) = + τ^2*(SourcePositiveProgram.energy (SourcePositiveProgram.output s d) - + (((SourcePositiveProgram.output s d).bonds.map (fun e => e.2.2)).sum : ℝ)) := by + rw [graphSourceBottom_bonds_smul F (sq_nonneg τ)] + have hm : sourceMatrixBottom (m+1) F.matrix = + SourcePositiveProgram.energy (SourcePositiveProgram.output s d) := by + unfold SourcePositiveProgram.energy + rw [hvertices,← hbonds,Bonds.matrix_toList] + have hs : (∑ e, (F.weight e : ℝ)) = + (((SourcePositiveProgram.output s d).bonds.map (fun e => e.2.2)).sum : ℝ) := by + rw [← hbonds] + simp only [Bonds.toList,List.map_ofFn,List.sum_ofFn,Function.comp_apply] + rw [hm,hs] + +namespace SourcePhysicalThreshold + +def exactHubbardEnergy (rho C : ℕ) (eps c : ℚ) (s p h k A B q : ℕ) + (d : BinaryHeisenberg) {m r : ℕ} (u : Fin (m+1) → CoulombPairSum.Point) + (F : Bonds (m+1) r) (t : Fin r → ℝ) : ℝ := + let x := input rho C eps c s p h k A B q d + CenteredPhysicalThreshold.actualOffset rho x.1 + + (SourceNuclearProgram.amplification rho k d : ℝ)* + (hubbardFermionBottom m (localizedCoulombProfile (GaussianFrequency.frequency rho) 0) + (localizedOffsiteCoulomb (GaussianFrequency.frequency rho) + (fun i => PlanarForcingProgram.position (u i))) F.left F.right t - + CoulombPairSum.exactTotal (GaussianFrequency.frequency rho) u) + +theorem hubbard_center_error (rho C : ℕ) (hrho : 0 < rho) (eps c : ℚ) + (s p h k A B q : ℕ) (d : BinaryHeisenberg) {m r : ℕ} + (u : Fin (m+1) → CoulombPairSum.Point) (F : Bonds (m+1) r) (t : Fin r → ℝ) + (hvertices : (SourcePositiveProgram.output s d).vertices = m+1) + (hbonds : F.toList = (SourcePositiveProgram.output s d).bonds) + {δ : ℝ} + (hfinite : |hubbardFermionBottom m (localizedCoulombProfile (GaussianFrequency.frequency rho) 0) + (localizedOffsiteCoulomb (GaussianFrequency.frequency rho) + (fun i => PlanarForcingProgram.position (u i))) F.left F.right t - + graphSourceBottom m F.left F.right (fun e => + ((((SourceContactProgram.size d^(30*B) : ℕ) : ℝ)⁻¹)^2)*(F.weight e : ℝ))| ≤ δ) : + |exactHubbardEnergy rho C eps c s p h k A B q d u F t - + exactSourceEnergy rho C eps c s p h k A B q d + (CoulombPairSum.exactTotal (GaussianFrequency.frequency rho) u)| ≤ + (SourceNuclearProgram.amplification rho k d : ℝ)*δ := by + have ha : 0 ≤ (SourceNuclearProgram.amplification rho k d : ℝ) := + (CenteredPhysicalThreshold.amplification_bound rho (SourcePhysicalThreshold.mesh k d) hrho).1 + rw [source_graph_bottom s d F hvertices hbonds] at hfinite + have he : exactHubbardEnergy rho C eps c s p h k A B q d u F t - + exactSourceEnergy rho C eps c s p h k A B q d + (CoulombPairSum.exactTotal (GaussianFrequency.frequency rho) u) = + (SourceNuclearProgram.amplification rho k d : ℝ) * + (hubbardFermionBottom m (localizedCoulombProfile (GaussianFrequency.frequency rho) 0) + (localizedOffsiteCoulomb (GaussianFrequency.frequency rho) + (fun i => PlanarForcingProgram.position (u i))) F.left F.right t - + (((SourceContactProgram.size d^(30*B) : ℕ) : ℝ)⁻¹)^2 * + (SourcePositiveProgram.energy (SourcePositiveProgram.output s d) - + (((SourcePositiveProgram.output s d).bonds.map (fun e => e.2.2)).sum : ℝ))) := by + simp only [exactHubbardEnergy,exactSourceEnergy,input,SourceNuclearProgram.amplification, + Rat.cast_inv,Rat.cast_natCast,Rat.cast_list_sum,List.map_map,Function.comp_def] + ring + rw [he,abs_mul,abs_of_nonneg ha] + exact mul_le_mul_of_nonneg_left hfinite ha + +theorem exactHubbardEnergy_eq (rho C : ℕ) (eps c : ℚ) (s p h k A B q : ℕ) + (d : BinaryHeisenberg) {m r : ℕ} (u : Fin (m+1) → CoulombPairSum.Point) + (F : Bonds (m+1) r) (t : Fin r → ℝ) + (hvertices : (SourcePositiveProgram.output s d).vertices = m+1) : + exactHubbardEnergy rho C eps c s p h k A B q d u F t = + (SourceNuclearProgram.amplification rho k d : ℝ)^2*(m+1:ℝ)* + (slabPotential rho (slabHorizontal k d) (slabVertical k d) 0+ + ((-1/2:ℝ)+GaussianFrequency.frequency rho/2)) + + (SourceNuclearProgram.amplification rho k d : ℝ)* + (hubbardFermionBottom m (localizedCoulombProfile (GaussianFrequency.frequency rho) 0) + (localizedOffsiteCoulomb (GaussianFrequency.frequency rho) + (fun i => PlanarForcingProgram.position (u i))) F.left F.right t - + (1/2:ℝ)*∑ i, ∑ j, localizedOffsiteCoulomb (GaussianFrequency.frequency rho) + (fun i => PlanarForcingProgram.position (u i)) i j) := by + simp only [exactHubbardEnergy,CenteredPhysicalThreshold.actualOffset, + CenteredPhysicalThreshold.actualReference,input,SourceNuclearProgram.amplification, + hvertices,Nat.cast_add,Nat.cast_one,CoulombPairSum.exactTotal,localizedOffsiteCoulomb, + slabHorizontal,slabVertical] + ring + +end SourcePhysicalThreshold +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceHubbardPromise.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceHubbardPromise.lean new file mode 100644 index 0000000000000000000000000000000000000000..d0c6df56d00c32f3cc5fcef1e1d007e865e8191f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceHubbardPromise.lean @@ -0,0 +1,65 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceHubbardEnergy +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourcePromiseBudget + +namespace OAI + +/-! End-to-end promise accounting from a Hubbard interval for the literal +source output. All errors use the actual fixed-power precision schedules. -/ + +noncomputable section +namespace ContinuumCoulomb.SourceUnitCoulomb +open HubbardGlobal MediatorIteration + +theorem promise_of_hubbard_interval (rho C U F K : ℕ) (hrho : 0 < rho) (eps c : ℚ) + (s pc h k A B q ap p g : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) + (hp : d.PolynomialPromise s) {m r : ℕ} (u : Fin (m+1) → CoulombPairSum.Point) + (hu : Function.Injective u) + (hsites : SourceNuclearProgram.sites rho C eps c s pc h k A B d = List.ofFn u) + (graph : Bonds (m+1) r) + (hvertices : (SourcePositiveProgram.output s d).vertices = m+1) + (hbonds : graph.toList = (SourcePositiveProgram.output s d).bonds) (t : Fin r → ℝ) + (ho : (value rho C U F K eps c s pc h k A B q ap d).Valid) + (hscale : 1 ≤ (SourceNuclearProgram.amplification rho k d:ℝ)) + (hpowers : 60*B+s+14 ≤ p) (hgpowers : s+14 ≤ g) (hqpowers : 60*B+s+14 ≤ q) + (hfinite : |hubbardFermionBottom m (localizedCoulombProfile (GaussianFrequency.frequency rho) 0) + (localizedOffsiteCoulomb (GaussianFrequency.frequency rho) + (fun i => PlanarForcingProgram.position (u i))) graph.left graph.right t - + graphSourceBottom m graph.left graph.right (fun e => + (((SourceContactProgram.size d^(30*B):ℕ):ℝ)⁻¹)^2*(graph.weight e:ℝ))| ≤ + ((SourceContactProgram.size d:ℝ)^g)⁻¹* + (((SourceContactProgram.size d^(30*B):ℕ):ℝ)⁻¹)^2) + (hground : + ((SourcePhysicalThreshold.exactHubbardEnergy rho C eps c s pc h k A B q d u graph t - + (SourceNuclearProgram.amplification rho k d:ℝ)*((SourceContactProgram.size d:ℝ)^p)⁻¹:ℝ):EReal) ≤ + unitGroundEnergy ((value rho C U F K eps c s pc h k A B q ap d).toData ho) ∧ + unitGroundEnergy ((value rho C U F K eps c s pc h k A B q ap d).toData ho) ≤ + ((SourcePhysicalThreshold.exactHubbardEnergy rho C eps c s pc h k A B q d u graph t + + (SourceNuclearProgram.amplification rho k d:ℝ)*((SourceContactProgram.size d:ℝ)^p)⁻¹:ℝ):EReal)) : + (realSourceGroundEnergy (d.toSource hd) ≤ d.lower.value → + value rho C U F K eps c s pc h k A B q ap d ∈ unitCoulombPromise.yes) ∧ + ((d.upper.value:ℝ) ≤ realSourceGroundEnergy (d.toSource hd) → + value rho C U F K eps c s pc h k A B q ap d ∈ unitCoulombPromise.no) := by + have hN : (2:ℝ) ≤ SourceContactProgram.size d := by + exact_mod_cast SourceContactProgram.size_ge_two d + have hM : (1:ℝ) ≤ SourceMetadataProgram.size d := by + exact_mod_cast SourceMetadataProgram.size_pos d + have hMN : (SourceMetadataProgram.size d:ℝ) ≤ SourceContactProgram.size d := by + simp only [SourceContactProgram.size,Nat.cast_add,Nat.cast_one] + linarith + have hbudget := physical_promise_error_budget hN hM hMN hscale s B p g q hpowers hgpowers hqpowers + have hcenter := SourcePhysicalThreshold.hubbard_center_error rho C hrho eps c s pc h k A B q d + u graph t hvertices hbonds hfinite + obtain ⟨hy,hn⟩ := promise_transfer rho C U F K hrho eps c s pc h k A B q ap d hd hp u hu hsites ho + (SourcePhysicalThreshold.exactHubbardEnergy rho C eps c s pc h k A B q d u graph t) + ((SourceNuclearProgram.amplification rho k d:ℝ)*((SourceContactProgram.size d:ℝ)^p)⁻¹) + ((SourceNuclearProgram.amplification rho k d:ℝ)*((SourceContactProgram.size d:ℝ)^g)⁻¹* + (((SourceContactProgram.size d^(30*B):ℕ):ℝ)⁻¹)^2) + hground (by simpa only [mul_assoc] using hcenter) + (by simpa only [Nat.cast_pow] using hbudget) + exact ⟨fun h => ⟨ho,hy h⟩,fun h => ⟨ho,hn h⟩⟩ + +end ContinuumCoulomb.SourceUnitCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceIndexedGeometry.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceIndexedGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..1126ee7f8a94074a9cb6b2252b6113c989cb0087 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceIndexedGeometry.lean @@ -0,0 +1,95 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceIndexedSites +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.ContactPolynomialGeometry + +namespace OAI + +/-! The actual indexed source array inherits the exact separation and +polynomial norm estimates of its rational contact construction. -/ + +noncomputable section +namespace ContinuumCoulomb.SourceNuclearProgram +open SourceMetadataProgram ContactMediator + +theorem contactSpacing_positive {c : ℚ} (hc : 0 < c) (k : ℕ) (d : BinaryHeisenberg) : + 0 < contactSpacing c k d := + AutomaticCalibration.spacing_positive hc k _ + (lt_of_lt_of_le (by decide : 0 < 2) (CalibrationMesh.base_ge_two (SourceContactProgram.size_ge_two d))) + +theorem contactLengths_near_one (rho C : ℕ) {eps c : ℚ} (heps : 0 ≤ eps) (hc : 0 < c) + (htol : (eps:ℝ)/2 ≤ contactLengthTolerance) (s p k A B : ℕ) + (d : BinaryHeisenberg) (hd : d.Valid) (e : GlobalEdge (geometricSource s d hd)) : + (contactLengths rho C eps c s p k A B d hd e:ℝ) ∈ + Set.Icc (1-contactLengthTolerance) (1+contactLengthTolerance) := + CalibratedContactProgram.graphLengths_near_one rho heps hc htol k A B + (CalibrationMesh.base (SourceContactProgram.size d)) + (PrefactorCalibration.precision C (SourceContactProgram.size d^p)) + (lt_of_lt_of_le (by decide : 0 < 2) (CalibrationMesh.base_ge_two (SourceContactProgram.size_ge_two d))) + (geometricSource s d hd) _ e + +private theorem source_coordinate_bound (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) + (hp : d.PolynomialPromise s) (j : Fin (geometricSource s d hd).vertices) (i : Fin 2) : + |(contactGridAxis ((geometricSource s d hd).coordinate j) i:ℝ)| ≤ + (SourceContactProgram.size d:ℝ)^s := by + have hN : (SourceContactProgram.size d:ℝ)=(binaryHeisenbergCodec.encode d).length+2 := by + unfold SourceContactProgram.size SourceMetadataProgram.size + push_cast + ring + rw [hN] + exact geometricSource_coordinates s d hd hp j i + +theorem raw_diameter_bound (rho C : ℕ) {eps c : ℚ} (heps : 0 ≤ eps) (hc : 0 < c) + (htol : (eps:ℝ)/2 ≤ contactLengthTolerance) (s p h k A B : ℕ) + (d : BinaryHeisenberg) (hd : d.Valid) (hp : d.PolynomialPromise s) + (hk : 1100 ≤ k) (hP : 7200 ≤ SourceContactProgram.size d^h) + (hqhi : (contactSpacing c k d:ℝ) ≤ 31*(k:ℝ)*Real.log (SourceContactProgram.size d)) + (x y : GlobalSite (geometricSource s d hd)) : + ‖ContactCalibratedGeometry.point (geometricSource s d hd) (SourceContactProgram.size d^h) + (contactSpacing c k d) (contactLengths rho C eps c s p k A B d hd) x- + ContactCalibratedGeometry.point (geometricSource s d hd) (SourceContactProgram.size d^h) + (contactSpacing c k d) (contactLengths rho C eps c s p k A B d hd) y‖ ≤ + 2*(SourceContactProgram.size d:ℝ)^(s+k/100+13) := by + have hn (j : GlobalSite (geometricSource s d hd)) := + ContactCalibratedGeometry.polynomial_norm (geometricSource s d hd) + (SourceContactProgram.size_ge_two d) hk (contactSpacing_positive hc k d) hqhi _ hP + (contactLengths_near_one rho C heps hc htol s p k A B d hd) + (source_coordinate_bound s d hd hp) j + have hs := (norm_sub_le _ _).trans (add_le_add (hn x) (hn y)) + simpa only [Nat.add_comm (k/100) s,two_mul] using hs + +theorem indexed_norm_bound (rho C : ℕ) {eps c : ℚ} (heps : 0 ≤ eps) (hc : 0 < c) + (htol : (eps:ℝ)/2 ≤ contactLengthTolerance) (s p h k A B : ℕ) + (d : BinaryHeisenberg) (hd : d.Valid) (hp : d.PolynomialPromise s) + (hk : 1100 ≤ k) (hP : 7200 ≤ SourceContactProgram.size d^h) + (hqhi : (contactSpacing c k d:ℝ) ≤ 31*(k:ℝ)*Real.log (SourceContactProgram.size d)) + {m : ℕ} (hm : (SourcePositiveProgram.output s d).vertices=m+1) (i : Fin (m+1)) : + ‖PlanarForcingProgram.position (indexedCoordinates rho C eps c s p h k A B d hd hm i)‖ ≤ + (SourceContactProgram.size d:ℝ)^(k/100+s+13) := by + rw [indexed_position] + exact ContactCalibratedGeometry.polynomial_norm (geometricSource s d hd) + (SourceContactProgram.size_ge_two d) hk (contactSpacing_positive hc k d) hqhi _ hP + (contactLengths_near_one rho C heps hc htol s p k A B d hd) + (source_coordinate_bound s d hd hp) _ + +theorem indexed_separation (rho C : ℕ) {eps c : ℚ} (heps : 0 ≤ eps) (hc : 0 < c) + (htol : (eps:ℝ)/2 ≤ contactLengthTolerance) (s p h k A B : ℕ) + (d : BinaryHeisenberg) (hd : d.Valid) + (hP : 7200 ≤ SourceContactProgram.size d^h) + (hqlo : (59/2:ℝ)*(k:ℝ)*Real.log (SourceContactProgram.size d) ≤ contactSpacing c k d) + {m : ℕ} (hm : (SourcePositiveProgram.output s d).vertices=m+1) + (i j : Fin (m+1)) (hij : i ≠ j) : + 25*(k:ℝ)*Real.log (SourceContactProgram.size d) ≤ + ‖PlanarForcingProgram.position (indexedCoordinates rho C eps c s p h k A B d hd hm i)- + PlanarForcingProgram.position (indexedCoordinates rho C eps c s p h k A B d hd hm j)‖ := by + rw [indexed_position,indexed_position] + exact ContactCalibratedGeometry.polynomial_separation (geometricSource s d hd) + (SourcePositiveProgram.sourceBound s d) (size d^s) (SourceContactProgram.size d^h) + (SourceContactProgram.size d) k (SourceContactProgram.size_ge_two d) + (contactSpacing_positive hc k d) hqlo _ hP + (contactLengths_near_one rho C heps hc htol s p k A B d hd) _ _ + (fun he => hij ((SourcePositiveProgram.indexedSites s d hd hm).symm.injective he)) + +end ContinuumCoulomb.SourceNuclearProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceIndexedSites.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceIndexedSites.lean new file mode 100644 index 0000000000000000000000000000000000000000..17e5b3d11aa44983a8735c37ee99710193147d30 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceIndexedSites.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceGraphIndex +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.SourceNuclearProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.PrefactorSourceCalibration + +namespace OAI + +/-! The literal nuclear program's planar sites, expressed in the same +index type as its finite Hubbard graph. -/ + +noncomputable section +namespace ContinuumCoulomb.SourceNuclearProgram +open SourceMetadataProgram ContactMediator + +def contactSpacing (c : ℚ) (k : ℕ) (d : BinaryHeisenberg) : ℚ := + AutomaticCalibration.spacing c k (CalibrationMesh.base (SourceContactProgram.size d)) + +def contactLengths (rho C : ℕ) (eps c : ℚ) (s p k A B : ℕ) + (d : BinaryHeisenberg) (hd : d.Valid) : GlobalEdge (geometricSource s d hd) → ℚ := + CalibratedContactProgram.graphLengths rho eps c k A B + (CalibrationMesh.base (SourceContactProgram.size d)) + (PrefactorCalibration.precision C (SourceContactProgram.size d^p)) + (geometricSource s d hd) + (PrefactorSourceContactProgram.weights (CalibrationMesh.prefactor rho) s d hd) + +def rawSites (rho C : ℕ) (eps c : ℚ) (s p h k A B : ℕ) + (d : BinaryHeisenberg) (hd : d.Valid) : GlobalSite (geometricSource s d hd) → ℚ×ℚ := + ContactCalibratedGeometry.position (geometricSource s d hd) (SourceContactProgram.size d^h) + (contactSpacing c k d) (contactLengths rho C eps c s p k A B d hd) + +def indexedCoordinates (rho C : ℕ) (eps c : ℚ) (s p h k A B : ℕ) + (d : BinaryHeisenberg) (hd : d.Valid) {m : ℕ} + (hm : (SourcePositiveProgram.output s d).vertices=m+1) : Fin (m+1) → ℚ×ℚ := + fun i => rawSites rho C eps c s p h k A B d hd + ((SourcePositiveProgram.indexedSites s d hd hm).symm i) + +theorem sites_eq_indexed (rho C : ℕ) (eps c : ℚ) (s p h k A B : ℕ) + (d : BinaryHeisenberg) (hd : d.Valid) {m : ℕ} + (hm : (SourcePositiveProgram.output s d).vertices=m+1) : + sites rho C eps c s p h k A B d = + List.ofFn (indexedCoordinates rho C eps c s p h k A B d hd hm) := by + unfold sites + rw [PrefactorSourceContactProgram.value_eq_array] + exact (SourcePositiveProgram.indexedSites_ofFn s d hd hm + (rawSites rho C eps c s p h k A B d hd)).symm + +theorem indexed_position (rho C : ℕ) (eps c : ℚ) (s p h k A B : ℕ) + (d : BinaryHeisenberg) (hd : d.Valid) {m : ℕ} + (hm : (SourcePositiveProgram.output s d).vertices=m+1) (i : Fin (m+1)) : + PlanarForcingProgram.position (indexedCoordinates rho C eps c s p h k A B d hd hm i) = + ContactCalibratedGeometry.point (geometricSource s d hd) (SourceContactProgram.size d^h) + (contactSpacing c k d) (contactLengths rho C eps c s p k A B d hd) + ((SourcePositiveProgram.indexedSites s d hd hm).symm i) := by + exact ContactCalibratedGeometry.position_cast _ _ _ _ _ + +theorem lengths_scale (rho C : ℕ) (eps : ℚ) {c : ℚ} (hc : 0 < c) (s p k A B : ℕ) + (d : BinaryHeisenberg) (hd : d.Valid) (e : GlobalEdge (geometricSource s d hd)) : + (contactSpacing c k d:ℝ)*contactLengths rho C eps c s p k A B d hd e = + PrefactorSourceContactProgram.nominalDistance rho (CalibrationMesh.prefactor rho) C eps c + s p k A B d hd e := + PrefactorSourceContactProgram.graphLengths_scale rho (CalibrationMesh.prefactor rho) C eps hc + s p k A B d hd e + +end ContinuumCoulomb.SourceNuclearProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceMatrix.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceMatrix.lean new file mode 100644 index 0000000000000000000000000000000000000000..77e2cb3a04928009910bbc5448c5605016c172ee --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceMatrix.lean @@ -0,0 +1,80 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.ManyBody.MediatorPromise + +namespace OAI + +/-! Identification of the encoded source's original swap-form variational +energy with the complete finite matrix used by all mediator stages. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators InnerProductSpace + +def SquareLatticeHeisenberg.bonds (d : SquareLatticeHeisenberg) : + MediatorIteration.Bonds d.vertices d.edges where + left := d.left + right := d.right + weight := d.coefficient + +theorem sourceSpinMass_norm_sq {n : ℕ} (p : MediatorLowSpace n) : + sourceSpinMass (fun s => p s) = ‖p‖ ^ 2 := by + rw [EuclideanSpace.norm_sq_eq] + simp only [sourceSpinMass, Complex.normSq_eq_norm_sq] + +theorem sourceGraphMatrix_action (d : SquareLatticeHeisenberg) + (u : SourceSpinVector d.vertices) : + d.bonds.matrix *ᵥ u = sourceHamiltonian d u := by + unfold MediatorIteration.Bonds.matrix SquareLatticeHeisenberg.bonds sourceGraphMatrix + simp only [Matrix.sum_mulVec, Matrix.smul_mulVec, sourceHeisenbergMatrix_mulVec, + ] + funext s + simp only [Finset.sum_apply, Pi.smul_apply, smul_eq_mul, Complex.ofReal_ratCast] + rfl + +theorem sourceGraphMatrix_form (d : SquareLatticeHeisenberg) + (p : MediatorLowSpace d.vertices) : + ⟪p, spinMatrixOperator d.bonds.matrix p⟫_ℝ = sourceHamiltonianForm d (fun s => p s) := by + rw [HubbardGlobal.euclidean_real_inner, sourceHamiltonianForm_eq_expectation] + have hact : spinMatrixOperator d.bonds.matrix p = + WithLp.toLp 2 (sourceHamiltonian d (fun s => p s)) := by + ext s + exact congrFun (sourceGraphMatrix_action d (fun s => p s)) s + rw [hact, PiLp.inner_apply] + congr 1 + apply Finset.sum_congr rfl + intro s _ + simp only [RCLike.inner_apply, mul_comm] + rfl + +/-- The mediator input is the actual source energy in the published promise. -/ +theorem sourceMatrixBottom_eq_realSource (d : SquareLatticeHeisenberg) : + sourceMatrixBottom d.vertices d.bonds.matrix = realSourceGroundEnergy d := by + obtain ⟨p, hp, hb, hmin⟩ := sourceMatrixBottom_minimizer d.vertices d.bonds.matrix + have hmass : sourceSpinMass (fun s => p s) = 1 := by rw [sourceSpinMass_norm_sq, hp]; norm_num + apply le_antisymm + · apply realSourceGroundEnergy_lower_of_forall + intro u hu + let q : MediatorLowSpace d.vertices := WithLp.toLp 2 u + have hq : ‖q‖ = 1 := by + have hs : ‖q‖ ^ 2 = 1 := (sourceSpinMass_norm_sq q).symm.trans hu + exact (sq_eq_sq₀ (norm_nonneg _) zero_le_one).mp (by simpa using hs) + rw [hb] + simpa only [sourceGraphMatrix_form, q] using hmin q hq + · rw [hb, sourceGraphMatrix_form] + exact realSourceGroundEnergy_le_trial d (fun s => p s) hmass + +theorem source_three_stage_bottom (d : SquareLatticeHeisenberg) {W G : ℕ} + (hW : 0 < W) (hG : 0 < G) (hJ : ∀ e, |(d.coefficient e : ℝ)| ≤ W) + (hJl : ∀ e, 1 / (W : ℝ) ≤ |(d.coefficient e : ℝ)|) : + |sourceMatrixBottom (d.vertices + d.edges * 2 + d.edges * 2 * 2 + + (d.edges * 2 + d.edges * 2 * 2) * 2) + (MediatorIteration.finalGraph d.bonds W G).matrix + + (MediatorIteration.offset d.bonds W G : ℝ) - realSourceGroundEnergy d| ≤ 3 / (512 * G) := by + rw [← sourceMatrixBottom_eq_realSource] + exact MediatorIteration.three_stage_bottom d.bonds d.edge_ne hW hG hJ hJl + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceNormalizationCorrectness.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceNormalizationCorrectness.lean new file mode 100644 index 0000000000000000000000000000000000000000..e716f9ccece5b044efd9331ae26edb7262a445a1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceNormalizationCorrectness.lean @@ -0,0 +1,66 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.SourceMetadataProgram + +namespace OAI + +/-! The machine-normalized source registers are the literal bond family +whose complete positive-spin spectral and promise estimates were proved. -/ + +namespace ContinuumCoulomb.SourceMetadataProgram +open MediatorListProgram + +def roundingDenominator (k : ℕ) (d : BinaryHeisenberg) : ℕ := + SourceNormalizedSpectrum.denominator d.edges.length (size d ^ k) + +theorem rounded_eq (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) : + SourceNormalizationProgram.rounded (input k d) = + SourceNormalizedSpectrum.rounded (d.toSource h) (roundingDenominator k d) := by + simp only [SourceNormalizationProgram.rounded, input, List.length_map, List.map_map] + change d.edges.map (fun e => (e.left, e.right, + SourceCoefficientRounding.coefficient (roundingDenominator k d) e.coefficient.value)) = + List.ofFn (fun e : Fin d.edges.length => ((d.edges.get e).left, (d.edges.get e).right, + SourceCoefficientRounding.coefficient (roundingDenominator k d) (d.edges.get e).coefficient.value)) + simpa only [List.get_eq_getElem] using (List.ofFn_getElem_eq_map d.edges + (fun e => (e.left, e.right, + SourceCoefficientRounding.coefficient (roundingDenominator k d) e.coefficient.value))).symm + +theorem retained_eq (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) : + SourceNormalizationProgram.retained (input k d) = + SourceNormalizedSpectrum.retained (d.toSource h) (roundingDenominator k d) := by + unfold SourceNormalizationProgram.retained SourceNormalizedSpectrum.retained + rw [rounded_eq k d h] + +theorem normalized_eq (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) : + SourceNormalizationProgram.normalized (input k d) = + (((SourceNormalizedSpectrum.retained (d.toSource h) (roundingDenominator k d)).length, + roundingDenominator k d + size d ^ k + 1, size d ^ k, d.coordinate.length), + SourceNormalizedSpectrum.retained (d.toSource h) (roundingDenominator k d)) := by + unfold SourceNormalizationProgram.normalized + rw [retained_eq k d h] + simp only [input, List.length_map, roundingDenominator] + +theorem size_pos (d : BinaryHeisenberg) : 0 < size d := by + unfold size + omega + +theorem polynomialPromise_weight (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) + (hp : d.PolynomialPromise k) : + ∀ e, |((d.toSource h).coefficient e : ℝ)| ≤ (size d ^ k : ℕ) := by + intro e + simpa only [size, Nat.cast_pow, Nat.cast_add, Nat.cast_one, BinaryHeisenberg.toSource] using + hp.weight_bound e + +theorem polynomialPromise_gap (k : ℕ) (d : BinaryHeisenberg) + (hp : d.PolynomialPromise k) : + 1 / ((size d ^ k : ℕ) : ℚ) ≤ d.upper.value - d.lower.value := by + have he : (1 : ℝ) / ((size d ^ k : ℕ) : ℝ) ≤ + ((d.upper.value : ℝ) - (d.lower.value : ℝ)) := by + simpa only [size, Nat.cast_pow, Nat.cast_add, Nat.cast_one, one_div] using hp.gap_bound + have hq := Rat.cast_le (K := ℝ).mp + (show (((1 / ((size d ^ k : ℕ) : ℚ)) : ℚ) : ℝ) ≤ + (((d.upper.value - d.lower.value) : ℚ) : ℝ) by + simpa only [Rat.cast_div, Rat.cast_one, Rat.cast_natCast, Rat.cast_sub] using he) + exact hq + +end ContinuumCoulomb.SourceMetadataProgram + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceNormalizedLattice.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceNormalizedLattice.lean new file mode 100644 index 0000000000000000000000000000000000000000..a0f30f808dfc0f6d8a1c7e7836a5e8eb330cb6c0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceNormalizedLattice.lean @@ -0,0 +1,95 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceNormalizedSpectrum +import Mathlib.Data.List.FinRange + +namespace OAI + +/-! Literal coefficient rounding and zero deletion preserve the original +square-lattice geometry and the simple unordered edge enumeration. -/ + +noncomputable section +namespace ContinuumCoulomb.SourceNormalizedSpectrum +open MediatorIteration MediatorListProgram SourceBondLists + +private theorem rounded_injective (d : SquareLatticeHeisenberg) (M : ℕ) : + Function.Injective (fun e : Fin d.edges => ((d.left e).val, (d.right e).val, + SourceCoefficientRounding.coefficient M (d.coefficient e))) := by + intro e f h + by_contra hne + apply (d.edge_simple e f hne).1 + exact ⟨Fin.ext (congrArg Prod.fst h), + Fin.ext (congrArg (fun b : Bond => b.2.1) h)⟩ + +theorem retained_nodup (d : SquareLatticeHeisenberg) (M : ℕ) : (retained d M).Nodup := + (List.nodup_ofFn_ofInjective (rounded_injective d M)).filter _ + +/-- Every retained bond has the same two endpoints as a definite original +source bond; only its coefficient has been rounded. -/ +theorem family_original_edge (d : SquareLatticeHeisenberg) (M : ℕ) + (e : Fin (retained d M).length) : + ∃ i : Fin d.edges, (family d M).left e = d.left i ∧ + (family d M).right e = d.right i ∧ + (retained d M).get e = ((d.left i).val, (d.right i).val, + SourceCoefficientRounding.coefficient M (d.coefficient i)) := by + obtain ⟨i, hi⟩ := List.mem_ofFn.mp (List.mem_filter.mp (List.get_mem (retained d M) e)).1 + refine ⟨i, ?_, ?_, hi.symm⟩ + · exact Fin.ext (congrArg Prod.fst hi.symm) + · exact Fin.ext (congrArg (fun b : Bond => b.2.1) hi.symm) + +theorem family_adjacent (d : SquareLatticeHeisenberg) (M : ℕ) + (e : Fin (retained d M).length) : + Int.natAbs ((d.coordinate ((family d M).left e)).1 - + (d.coordinate ((family d M).right e)).1) + + Int.natAbs ((d.coordinate ((family d M).left e)).2 - + (d.coordinate ((family d M).right e)).2) = 1 := by + obtain ⟨i, hi, hj, _⟩ := family_original_edge d M e + rw [hi, hj] + exact d.adjacent i + +theorem family_edge_simple (d : SquareLatticeHeisenberg) (M : ℕ) + (e f : Fin (retained d M).length) (hef : e ≠ f) : + ¬((family d M).left e = (family d M).left f ∧ + (family d M).right e = (family d M).right f) ∧ + ¬((family d M).left e = (family d M).right f ∧ + (family d M).right e = (family d M).left f) := by + obtain ⟨i, hei, hei', hgeti⟩ := family_original_edge d M e + obtain ⟨j, hfj, hfj', hgetj⟩ := family_original_edge d M f + have hij : i ≠ j := by + intro h + subst j + exact hef ((retained_nodup d M).injective_get (hgeti.trans hgetj.symm)) + have hs := d.edge_simple i j hij + constructor + · rintro ⟨hl, hr⟩ + exact hs.1 ⟨hei.symm.trans (hl.trans hfj), hei'.symm.trans (hr.trans hfj')⟩ + · rintro ⟨hl, hr⟩ + exact hs.2 ⟨hei.symm.trans (hl.trans hfj'), hei'.symm.trans (hr.trans hfj)⟩ + +/-- The normalized graph in the same geometric source type. Its thresholds +are inherited only to satisfy the record; all coefficient and matrix +normalization theorems continue to use the literal `family` definition. -/ +def lattice (d : SquareLatticeHeisenberg) (M : ℕ) : SquareLatticeHeisenberg where + vertices := d.vertices + vertices_pos := d.vertices_pos + coordinate := d.coordinate + coordinate_injective := d.coordinate_injective + edges := (retained d M).length + left := (family d M).left + right := (family d M).right + adjacent := family_adjacent d M + edge_simple := family_edge_simple d M + coefficient := (family d M).weight + lower := d.lower + upper := d.upper + gap_pos := d.gap_pos + +@[simp] theorem lattice_bonds (d : SquareLatticeHeisenberg) (M : ℕ) : + (lattice d M).bonds = family d M := rfl + +@[simp] theorem lattice_coordinate (d : SquareLatticeHeisenberg) (M : ℕ) : + (lattice d M).coordinate = d.coordinate := rfl + +end ContinuumCoulomb.SourceNormalizedSpectrum + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceNormalizedPromise.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceNormalizedPromise.lean new file mode 100644 index 0000000000000000000000000000000000000000..082947c346e1a56c40385b2078d16d6d9660a754 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceNormalizedPromise.lean @@ -0,0 +1,95 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceNormalizedSpectrum + +namespace OAI + +/-! A fixed polynomial common denominator absorbs both coefficient rounding +and all three mediator errors into one inverse-polynomial promise budget. -/ + +noncomputable section +namespace ContinuumCoulomb.SourceNormalizedSpectrum + +def denominator (r G : ℕ) : ℕ := 1024 * (r + 1) * G + +theorem denominator_pos (r : ℕ) {G : ℕ} (hG : 0 < G) : 0 < denominator r G := by + unfold denominator + positivity + +theorem normalization_budget (r : ℕ) {G : ℕ} (hG : 0 < G) : + 3 / (512 * (G : ℝ)) + 3 * r / (2 * (denominator r G : ℝ)) ≤ + 1 / (128 * (G : ℝ)) := by + have hg : (0 : ℝ) < G := by exact_mod_cast hG + have hden : (denominator r G : ℝ) = 1024 * ((r : ℝ) + 1) * G := by + simp only [denominator, Nat.cast_mul, Nat.cast_add, Nat.cast_one, Nat.cast_ofNat] + rw [hden] + have hround : 3 * (r : ℝ) / (2 * (1024 * (r + 1) * G)) ≤ 3 / (2048 * G) := by + apply (div_le_div_iff₀ (by positivity) (by positivity)).mpr + nlinarith + calc + _ ≤ 3 / (512 * (G : ℝ)) + 3 / (2048 * G) := add_le_add le_rfl hround + _ ≤ _ := by + field_simp + nlinarith + +/-- The original source permits arbitrarily small and zero rational +coefficients. This complete positive-spin comparison does too. -/ +theorem source_positive_bottom (d : SquareLatticeHeisenberg) {W G : ℕ} + (hG : 0 < G) (hW : ∀ e, |(d.coefficient e : ℝ)| ≤ W) : + |sourceMatrixBottom + (d.vertices + (retained d (denominator d.edges G)).length * 2 + + (retained d (denominator d.edges G)).length * 2 * 2 + + ((retained d (denominator d.edges G)).length * 2 + + (retained d (denominator d.edges G)).length * 2 * 2) * 2) + (MediatorIteration.finalGraph (family d (denominator d.edges G)) + (denominator d.edges G + W + 1) G).matrix + + (MediatorIteration.offset (family d (denominator d.edges G)) + (denominator d.edges G + W + 1) G : ℝ) - realSourceGroundEnergy d| ≤ + 1 / (128 * (G : ℝ)) := + (normalized_three_stage_bottom d (denominator_pos d.edges hG) hG hW).trans + (normalization_budget d.edges hG) + +def lowerThreshold (d : SquareLatticeHeisenberg) (W G : ℕ) (a : ℚ) : ℚ := + a - MediatorIteration.offset (family d (denominator d.edges G)) + (denominator d.edges G + W + 1) G + 1 / (128 * (G : ℚ)) + +def upperThreshold (d : SquareLatticeHeisenberg) (W G : ℕ) (b : ℚ) : ℚ := + b - MediatorIteration.offset (family d (denominator d.edges G)) + (denominator d.edges G + W + 1) G - 1 / (128 * (G : ℚ)) + +def positiveEnergy (d : SquareLatticeHeisenberg) (W G : ℕ) : ℝ := + sourceMatrixBottom _ + (MediatorIteration.finalGraph (family d (denominator d.edges G)) + (denominator d.edges G + W + 1) G).matrix + +theorem source_positive_yes (d : SquareLatticeHeisenberg) {W G : ℕ} + (hG : 0 < G) (hW : ∀ e, |(d.coefficient e : ℝ)| ≤ W) {a : ℚ} + (hyes : realSourceGroundEnergy d ≤ a) : + positiveEnergy d W G ≤ lowerThreshold d W G a := by + have he := (abs_le.mp (source_positive_bottom d hG hW)).2 + change positiveEnergy d W G + _ - realSourceGroundEnergy d ≤ _ at he + simp only [lowerThreshold, Rat.cast_add, Rat.cast_sub, Rat.cast_div, + Rat.cast_mul, Rat.cast_one, Rat.cast_ofNat, Rat.cast_natCast] + linarith + +theorem source_positive_no (d : SquareLatticeHeisenberg) {W G : ℕ} + (hG : 0 < G) (hW : ∀ e, |(d.coefficient e : ℝ)| ≤ W) {b : ℚ} + (hno : (b : ℝ) ≤ realSourceGroundEnergy d) : + (upperThreshold d W G b : ℝ) ≤ positiveEnergy d W G := by + have he := (abs_le.mp (source_positive_bottom d hG hW)).1 + change _ ≤ positiveEnergy d W G + _ - realSourceGroundEnergy d at he + simp only [upperThreshold, Rat.cast_sub, Rat.cast_div, Rat.cast_mul, + Rat.cast_one, Rat.cast_ofNat, Rat.cast_natCast] + linarith + +theorem positive_threshold_gap (d : SquareLatticeHeisenberg) (W G : ℕ) {a b : ℚ} + (hgap : 1 / (G : ℚ) ≤ b - a) : + 63 / 64 * (b - a) ≤ upperThreshold d W G b - lowerThreshold d W G a := by + have heq : 1 / (128 * (G : ℚ)) + 1 / (128 * (G : ℚ)) = + 1 / 64 * (1 / (G : ℚ)) := by ring + unfold upperThreshold lowerThreshold + linarith + +end ContinuumCoulomb.SourceNormalizedSpectrum + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceNormalizedSpectrum.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceNormalizedSpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..f6c0cf47deca095f1644b572fdf7bdf9c0b69e31 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceNormalizedSpectrum.lean @@ -0,0 +1,132 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceBondLists + +namespace OAI + +/-! Literal source rounding and zero deletion feed the complete three-stage +spin comparison. Only the source's upper coefficient and gap bounds are +needed; a nonzero lower coefficient bound is proved by rounding. -/ + +noncomputable section +namespace ContinuumCoulomb.SourceNormalizedSpectrum +open Matrix MediatorIteration MediatorListProgram SourceBondLists +open scoped BigOperators + +def rounded (d : SquareLatticeHeisenberg) (M : ℕ) : List Bond := + List.ofFn (fun e => ((d.left e).val, (d.right e).val, + SourceCoefficientRounding.coefficient M (d.coefficient e))) + +def retained (d : SquareLatticeHeisenberg) (M : ℕ) : List Bond := + (rounded d M).filter SourceZeroFilter.keep + +theorem rounded_bounded (d : SquareLatticeHeisenberg) (M : ℕ) : bounded d.vertices (rounded d M) := by + intro e he + obtain ⟨i, rfl⟩ := List.mem_ofFn.mp he + exact ⟨(d.left i).isLt, (d.right i).isLt⟩ + +theorem retained_bounded (d : SquareLatticeHeisenberg) (M : ℕ) : bounded d.vertices (retained d M) := + filter_bounded d.vertices (rounded d M) (rounded_bounded d M) + +def family (d : SquareLatticeHeisenberg) (M : ℕ) : Bonds d.vertices (retained d M).length := + bonds d.vertices (retained d M) (retained_bounded d M) + +theorem family_noLoops (d : SquareLatticeHeisenberg) (M : ℕ) : (family d M).NoLoops := by + apply bonds_noLoops + intro e he hloop + obtain ⟨i, rfl⟩ := List.mem_ofFn.mp (List.mem_filter.mp he).1 + exact d.edge_ne i (Fin.ext hloop) + +theorem rounded_matrix (d : SquareLatticeHeisenberg) (M : ℕ) : + matrix d.vertices (rounded d M) = + (d.withCoefficients (fun e => SourceCoefficientRounding.coefficient M (d.coefficient e))).bonds.matrix := by + unfold matrix rounded + rw [List.map_ofFn, List.sum_ofFn] + unfold Bonds.matrix SquareLatticeHeisenberg.bonds sourceGraphMatrix + apply Finset.sum_congr rfl + intro i _ + simp only [Function.comp_apply] + rw [bondMatrix, dite_eq_left ⟨(d.left i).isLt, (d.right i).isLt⟩] + simp only [SquareLatticeHeisenberg.withCoefficients, Complex.ofReal_ratCast] + rfl + +theorem family_matrix (d : SquareLatticeHeisenberg) (M : ℕ) : + (family d M).matrix = + (d.withCoefficients (fun e => SourceCoefficientRounding.coefficient M (d.coefficient e))).bonds.matrix := by + exact (matrix_bonds d.vertices (retained d M) (retained_bounded d M)).symm.trans + ((filter_matrix d.vertices (rounded d M)).trans (rounded_matrix d M)) + +theorem family_bottom_error (d : SquareLatticeHeisenberg) {M : ℕ} (hM : 0 < M) : + |sourceMatrixBottom d.vertices (family d M).matrix - realSourceGroundEnergy d| ≤ + 3 * d.edges / (2 * (M : ℝ)) := by + rw [family_matrix] + change |sourceMatrixBottom + (d.withCoefficients (fun e => SourceCoefficientRounding.coefficient M (d.coefficient e))).vertices + (d.withCoefficients (fun e => SourceCoefficientRounding.coefficient M (d.coefficient e))).bonds.matrix - + realSourceGroundEnergy d| ≤ _ + rw [sourceMatrixBottom_eq_realSource] + have h := realSourceGroundEnergy_rounding d + (fun e => SourceCoefficientRounding.coefficient M (d.coefficient e)) + have hp : ∀ e, |(d.coefficient e : ℝ) - + (SourceCoefficientRounding.coefficient M (d.coefficient e) : ℝ)| ≤ 1 / (2 * (M : ℝ)) := by + intro e + have hq := Rat.cast_le (K := ℝ).mpr + (SourceCoefficientRounding.coefficient_error hM (d.coefficient e)) + simpa only [Rat.cast_abs, Rat.cast_sub, Rat.cast_div, Rat.cast_one, + Rat.cast_mul, Rat.cast_ofNat, Rat.cast_natCast] using hq + have hs := Finset.sum_le_sum (fun e (_ : e ∈ (Finset.univ : Finset (Fin d.edges))) => hp e) + simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] at hs + exact h.trans ((mul_le_mul_of_nonneg_left hs (by norm_num : (0 : ℝ) ≤ 3)).trans_eq (by ring)) + +theorem family_bounds (d : SquareLatticeHeisenberg) {M W : ℕ} (hM : 0 < M) + (hW : ∀ e, |(d.coefficient e : ℝ)| ≤ W) : + ∀ e, 1 / ((M + W + 1 : ℕ) : ℝ) ≤ |((family d M).weight e : ℝ)| ∧ + |((family d M).weight e : ℝ)| ≤ (M + W + 1 : ℕ) := by + intro e + have he := List.get_mem (retained d M) e + have hz := SourceZeroFilter.nonzero_mem (rounded d M) _ he + obtain ⟨i, hi⟩ := List.mem_ofFn.mp (List.mem_filter.mp he).1 + have hw : (family d M).weight e = SourceCoefficientRounding.coefficient M (d.coefficient i) := by + exact congrArg (fun a : Bond => a.2.2) hi.symm + have hz' : SourceCoefficientRounding.coefficient M (d.coefficient i) ≠ 0 := by simpa only [← hi] using hz + have hl : 1 / (M : ℝ) ≤ |(SourceCoefficientRounding.coefficient M (d.coefficient i) : ℝ)| := by + have hq := Rat.cast_le (K := ℝ).mpr + (SourceCoefficientRounding.coefficient_nonzero_lower hM (d.coefficient i) hz') + simpa only [Rat.cast_div, Rat.cast_one, Rat.cast_natCast, Rat.cast_abs] using hq + have hq : |d.coefficient i| ≤ (W : ℚ) := by exact_mod_cast hW i + have hu : |(SourceCoefficientRounding.coefficient M (d.coefficient i) : ℝ)| ≤ W + 1 := by + exact_mod_cast SourceCoefficientRounding.coefficient_upper hM (d.coefficient i) hq + rw [hw] + constructor + · exact (one_div_le_one_div_of_le (by exact_mod_cast hM) + (by norm_cast; omega : (M : ℝ) ≤ (M + W + 1 : ℕ))).trans hl + · have hm : (0 : ℝ) ≤ M := Nat.cast_nonneg M + push_cast + linarith + +/-- Full three-stage error after genuine source normalization, with no +lower-weight hypothesis on the original published source. -/ +theorem normalized_three_stage_bottom (d : SquareLatticeHeisenberg) {M W G : ℕ} + (hM : 0 < M) (hG : 0 < G) (hW : ∀ e, |(d.coefficient e : ℝ)| ≤ W) : + |sourceMatrixBottom + (d.vertices + (retained d M).length * 2 + (retained d M).length * 2 * 2 + + ((retained d M).length * 2 + (retained d M).length * 2 * 2) * 2) + (finalGraph (family d M) (M + W + 1) G).matrix + + (MediatorIteration.offset (family d M) (M + W + 1) G : ℝ) - realSourceGroundEnergy d| ≤ + 3 / (512 * (G : ℝ)) + 3 * d.edges / (2 * (M : ℝ)) := by + have hB := family_bounds d hM hW + have h := three_stage_bottom (family d M) (family_noLoops d M) + (by omega : 0 < M + W + 1) hG (fun e => (hB e).2) (fun e => (hB e).1) + have he := family_bottom_error d hM + have ht := (abs_add_le + (sourceMatrixBottom _ (finalGraph (family d M) (M + W + 1) G).matrix + + (MediatorIteration.offset (family d M) (M + W + 1) G : ℝ) - + sourceMatrixBottom d.vertices (family d M).matrix) + (sourceMatrixBottom d.vertices (family d M).matrix - realSourceGroundEnergy d)).trans (add_le_add h he) + convert ht using 1 + congr 1 + ring + +end ContinuumCoulomb.SourceNormalizedSpectrum + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceParameterSchedule.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceParameterSchedule.lean new file mode 100644 index 0000000000000000000000000000000000000000..c75d12b4a4a2ca9f21010ec4efa01f9e91e4d73a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceParameterSchedule.lean @@ -0,0 +1,30 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.SlowLogarithmicExtent + +namespace OAI + +/-! A simultaneous exponent choice for the actual source construction. +The spatial extent depends on the chosen calibration exponent, but only +through its hundredth; all numerical precisions are chosen afterwards. -/ + +namespace ContinuumCoulomb + +theorem exists_source_exponent_threshold + (qCloud qNonedge qGap qLeak qScale r s v B : ℕ) : + ∃ kmin : ℕ, 1100 ≤ kmin ∧ ∀ k : ℕ, kmin ≤ k → + let extent := s+k/100+13 + let p := 60*B+s+14 + qCloud+9*r+72*extent+v+p ≤ k ∧ + qNonedge+extent+(2*r+p+8) ≤ 5*k ∧ + qGap+2*B+s ≤ k ∧ qLeak ≤ k ∧ qScale ≤ k := by + let C := qCloud+qNonedge+qGap+qLeak+qScale+9*r+72*(s+13)+v+ + (60*B+s+14)+2*B+8 + refine ⟨4*C+1100,by omega,fun k hk => ?_⟩ + have hC : 4*C ≤ k := by omega + have hslow := ContactMediator.slow_extent_parameter_closure C k hC + dsimp only + dsimp only [C] at hslow + omega + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourcePauli.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourcePauli.lean new file mode 100644 index 0000000000000000000000000000000000000000..2a042a87c105faf3b87971741db497cc3d4280cd --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourcePauli.lean @@ -0,0 +1,191 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceHamiltonian +import OAI.MathematicalPhysics.ContinuumCoulomb.ManyBody.Singlet + +namespace OAI + +/-! Actual one-site Pauli matrices on the complete source spin basis. -/ + +noncomputable section +namespace ContinuumCoulomb +open Matrix +open scoped BigOperators + +def sourceTensor (n : ℕ) (M : Fin n → Matrix (Fin 2) (Fin 2) ℂ) : + Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ := fun s t => ∏ i, M i (s i) (t i) + +theorem sourceTensor_one (n : ℕ) : sourceTensor n (fun _ => 1) = 1 := by + classical + ext s t + by_cases hst : s = t + · subst t + simp [sourceTensor] + · obtain ⟨i, hi⟩ := Function.ne_iff.mp hst + simp only [Matrix.one_apply, ite_eq_right hst, sourceTensor] + exact Finset.prod_eq_zero (Finset.mem_univ i) (by simp [hi]) + +theorem sourceTensor_mul (n : ℕ) (M N : Fin n → Matrix (Fin 2) (Fin 2) ℂ) : + sourceTensor n M * sourceTensor n N = sourceTensor n (fun i => M i * N i) := by + ext s t + simp only [Matrix.mul_apply, sourceTensor, ← Finset.prod_mul_distrib] + exact (Fintype.prod_sum (fun i a => M i (s i) a * N i a (t i))).symm + +def sourceLocalPauli (n : ℕ) (i : Fin n) (μ : Fin 3) : + Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ := + sourceTensor n (fun k => if k = i then pauli μ else 1) + +theorem pauli_sq (μ : Fin 3) : pauli μ * pauli μ = 1 := by + fin_cases μ <;> ext a b <;> fin_cases a <;> fin_cases b <;> + norm_num [pauli, pauliX, pauliY, pauliZ, Matrix.mul_apply, Fin.sum_univ_succ] + +theorem sourceLocalPauli_sq (n : ℕ) (i : Fin n) (μ : Fin 3) : + sourceLocalPauli n i μ * sourceLocalPauli n i μ = 1 := by + unfold sourceLocalPauli + rw [sourceTensor_mul] + have h (k : Fin n) : + (if k = i then pauli μ else 1) * (if k = i then pauli μ else 1) = 1 := by + by_cases hki : k = i <;> simp [hki, pauli_sq] + simp_rw [h] + exact sourceTensor_one n + +theorem sourceLocalPauli_commute (n : ℕ) (i j : Fin n) (hij : i ≠ j) (μ ν : Fin 3) : + sourceLocalPauli n i μ * sourceLocalPauli n j ν = + sourceLocalPauli n j ν * sourceLocalPauli n i μ := by + unfold sourceLocalPauli + rw [sourceTensor_mul, sourceTensor_mul] + congr 1 + funext k + by_cases hki : k = i + · subst k + simp [hij] + · by_cases hkj : k = j + · subst k + simp [hij.symm] + · simp [hki, hkj] + +/-- The Pauli contraction on two actual two-state spins. -/ +theorem pauli_entry_sum (a b c d : Fin 2) : + (∑ μ : Fin 3, pauli μ a c * pauli μ b d) = + 2 * (if a = d ∧ b = c then (1 : ℂ) else 0) - + (if a = c ∧ b = d then 1 else 0) := by + fin_cases a <;> fin_cases b <;> fin_cases c <;> fin_cases d <;> + norm_num [pauli, pauliX, pauliY, pauliZ, Fin.sum_univ_succ] + +def sourceSpectatorDelta (n : ℕ) (i j : Fin n) (s t : SourceSpinBasis n) : ℂ := + ∏ k ∈ (Finset.univ.erase i).erase j, if s k = t k then (1 : ℂ) else 0 + +theorem sourceSpectatorDelta_eq_one (n : ℕ) (i j : Fin n) (s t : SourceSpinBasis n) + (hst : ∀ k, k ≠ i → k ≠ j → s k = t k) : sourceSpectatorDelta n i j s t = 1 := by + classical + apply Finset.prod_eq_one + intro k hk + exact ite_eq_left (hst k (Finset.mem_erase.mp (Finset.mem_erase.mp hk).2).1 + (Finset.mem_erase.mp hk).1) + +theorem sourceSpectatorDelta_eq_zero (n : ℕ) (i j : Fin n) (s t : SourceSpinBasis n) + (hst : ¬∀ k, k ≠ i → k ≠ j → s k = t k) : sourceSpectatorDelta n i j s t = 0 := by + classical + push Not at hst + obtain ⟨k, hki, hkj, hne⟩ := hst + apply Finset.prod_eq_zero (Finset.mem_erase.mpr ⟨hkj, + Finset.mem_erase.mpr ⟨hki, Finset.mem_univ k⟩⟩) + simp [hne] + +theorem sourceLocalPauli_product_entry (n : ℕ) (i j : Fin n) (hij : i ≠ j) + (μ ν : Fin 3) (s t : SourceSpinBasis n) : + (sourceLocalPauli n i μ * sourceLocalPauli n j ν) s t = + pauli μ (s i) (t i) * pauli ν (s j) (t j) * sourceSpectatorDelta n i j s t := by + classical + unfold sourceLocalPauli + rw [sourceTensor_mul] + unfold sourceTensor + rw [← Finset.mul_prod_erase _ _ (Finset.mem_univ i)] + rw [← Finset.mul_prod_erase _ _ (Finset.mem_erase.mpr ⟨hij.symm, Finset.mem_univ j⟩)] + simp only [ite_true, ite_eq_right hij, ite_eq_right hij.symm, mul_one, one_mul] + rw [← mul_assoc] + congr 1 + unfold sourceSpectatorDelta + apply Finset.prod_congr rfl + intro k hk + have hkj := (Finset.mem_erase.mp hk).1 + have hki := (Finset.mem_erase.mp (Finset.mem_erase.mp hk).2).1 + simp only [ite_eq_right hki, ite_eq_right hkj, one_mul, Matrix.one_apply] + +theorem sourceSpinSwap_eq_iff {n : ℕ} (i j : Fin n) (_hij : i ≠ j) + (s t : SourceSpinBasis n) : + sourceSpinSwap i j s = t ↔ s j = t i ∧ s i = t j ∧ + ∀ k, k ≠ i → k ≠ j → s k = t k := by + constructor + · intro h + refine ⟨?_, ?_, ?_⟩ + · simpa [sourceSpinSwap_apply] using congrFun h i + · simpa [sourceSpinSwap_apply] using congrFun h j + · intro k hki hkj + simpa [sourceSpinSwap_apply, Equiv.swap_apply_of_ne_of_ne hki hkj] using congrFun h k + · rintro ⟨hi, hj, hrest⟩ + funext k + by_cases hki : k = i + · subst k + simpa [sourceSpinSwap_apply] using hi + · by_cases hkj : k = j + · subst k + simpa [sourceSpinSwap_apply] using hj + · simpa [sourceSpinSwap_apply, Equiv.swap_apply_of_ne_of_ne hki hkj] using hrest k hki hkj + +def sourceHeisenbergMatrix (n : ℕ) (i j : Fin n) : + Matrix (SourceSpinBasis n) (SourceSpinBasis n) ℂ := fun s t => + 2 * (if sourceSpinSwap i j s = t then 1 else 0) - (if s = t then 1 else 0) + +/-- The Pauli sum on distinct sites equals the complete source Hamiltonian +matrix, with every other spin acting as an untouched spectator. -/ +theorem sourceLocalPauli_sum (n : ℕ) (i j : Fin n) (hij : i ≠ j) : + (∑ μ : Fin 3, sourceLocalPauli n i μ * sourceLocalPauli n j μ) = + sourceHeisenbergMatrix n i j := by + classical + ext s t + rw [Matrix.sum_apply] + simp_rw [sourceLocalPauli_product_entry n i j hij] + rw [← Finset.sum_mul, pauli_entry_sum] + by_cases hrest : ∀ k, k ≠ i → k ≠ j → s k = t k + · rw [sourceSpectatorDelta_eq_one n i j s t hrest, mul_one] + have hsame : s = t ↔ s i = t i ∧ s j = t j := by + constructor + · intro h + exact ⟨congrFun h i, congrFun h j⟩ + · rintro ⟨hi, hj⟩ + funext k + by_cases hki : k = i + · simpa [hki] using hi + · by_cases hkj : k = j + · simpa [hkj] using hj + · exact hrest k hki hkj + have hswap : sourceSpinSwap i j s = t ↔ s i = t j ∧ s j = t i := by + rw [sourceSpinSwap_eq_iff i j hij] + exact ⟨fun h => ⟨h.2.1, h.1⟩, fun h => ⟨h.2, h.1, hrest⟩⟩ + change _ = 2 * (if sourceSpinSwap i j s = t then (1 : ℂ) else 0) - + (if s = t then 1 else 0) + simp only [hswap, hsame] + · rw [sourceSpectatorDelta_eq_zero n i j s t hrest, mul_zero] + have hswap : sourceSpinSwap i j s ≠ t := by + intro h + exact hrest ((sourceSpinSwap_eq_iff i j hij s t).mp h).2.2 + have hsame : s ≠ t := by + intro h + apply hrest + intro k _ _ + exact congrFun h k + simp [sourceHeisenbergMatrix, hswap, hsame] + +/-- Matrix multiplication agrees with the swap-based Heisenberg action. -/ +theorem sourceHeisenbergMatrix_mulVec (n : ℕ) (i j : Fin n) (u : SourceSpinVector n) : + sourceHeisenbergMatrix n i j *ᵥ u = sourceHeisenbergAction i j u := by + classical + funext s + simp only [sourceHeisenbergMatrix, Matrix.mulVec, dotProduct, sub_mul, + Finset.sum_sub_distrib, mul_assoc, ← Finset.mul_sum, ite_mul, one_mul, zero_mul] + simp [sourceHeisenbergAction] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourcePhysicalPromise.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourcePhysicalPromise.lean new file mode 100644 index 0000000000000000000000000000000000000000..13b99a5291b69534dd80ca047a60ed757a4faa78 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourcePhysicalPromise.lean @@ -0,0 +1,97 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourcePositiveMargin +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceUnitCoulomb + +namespace OAI + +/-! Promise transfer for the literal physical thresholds. The retained +source margin absorbs the finite, continuum, and scalar-evaluation errors. -/ + +noncomputable section +namespace ContinuumCoulomb.SourcePhysicalThreshold + +def exactSourceEnergy (rho C : ℕ) (eps c : ℚ) (s p h k A B q : ℕ) + (d : BinaryHeisenberg) (v : ℝ) : ℝ := + let x := input rho C eps c s p h k A B q d + CenteredPhysicalThreshold.actualOffset rho x.1 + + (CenteredPhysicalThreshold.amplification rho x.1.1.1 : ℝ) * + ((x.2.1 : ℝ)^2 * (SourcePositiveProgram.energy (SourcePositiveProgram.output s d) - + (x.2.2.2.sum : ℝ)) - v) + +theorem exact_endpoint_differences (rho C : ℕ) (eps c : ℚ) (s p h k A B q : ℕ) + (d : BinaryHeisenberg) (v : ℝ) : + let x := input rho C eps c s p h k A B q d + let a := (SourceNuclearProgram.amplification rho k d : ℝ) * + (((SourceContactProgram.size d^(30*B) : ℕ) : ℝ)⁻¹)^2 + (AffinePhysicalThreshold.exactValue rho x v).1 - exactSourceEnergy rho C eps c s p h k A B q d v = + a * ((SourcePositiveProgram.output s d).lower - SourcePositiveProgram.energy (SourcePositiveProgram.output s d)) ∧ + exactSourceEnergy rho C eps c s p h k A B q d v - (AffinePhysicalThreshold.exactValue rho x v).2 = + a * (SourcePositiveProgram.energy (SourcePositiveProgram.output s d) - (SourcePositiveProgram.output s d).upper) := by + dsimp only + simp only [AffinePhysicalThreshold.exactValue,AffinePhysicalThreshold.exactFinite, + exactSourceEnergy,input,SourceNuclearProgram.amplification,Rat.cast_inv,Rat.cast_natCast] + constructor <;> ring + +end ContinuumCoulomb.SourcePhysicalThreshold + +namespace ContinuumCoulomb.SourceUnitCoulomb + +theorem promise_transfer (rho C U F K : ℕ) (hrho : 0 < rho) (eps c : ℚ) + (s p h k A B q ap : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) + (hp : d.PolynomialPromise s) {m : ℕ} (u : Fin m → CoulombPairSum.Point) + (hu : Function.Injective u) + (hsites : SourceNuclearProgram.sites rho C eps c s p h k A B d = List.ofFn u) + (ho : (value rho C U F K eps c s p h k A B q ap d).Valid) + (center continuumError finiteError : ℝ) + (hground : ((center-continuumError : ℝ) : EReal) ≤ + unitGroundEnergy ((value rho C U F K eps c s p h k A B q ap d).toData ho) ∧ + unitGroundEnergy ((value rho C U F K eps c s p h k A B q ap d).toData ho) ≤ + ((center+continuumError : ℝ) : EReal)) + (hfinite : |center - SourcePhysicalThreshold.exactSourceEnergy rho C eps c s p h k A B q d + (CoulombPairSum.exactTotal (GaussianFrequency.frequency rho) u)| ≤ finiteError) + (hbudget : continuumError + finiteError + 1 / (((SourceContactProgram.size d^q : ℕ) : ℝ)+1) ≤ + (SourceNuclearProgram.amplification rho k d : ℝ) * + (((SourceContactProgram.size d^(30*B) : ℕ) : ℝ)⁻¹)^2 * + (1 / (2048 * ((SourceMetadataProgram.size d^s : ℕ) : ℝ)))) : + (realSourceGroundEnergy (d.toSource hd) ≤ d.lower.value → + unitGroundEnergy ((value rho C U F K eps c s p h k A B q ap d).toData ho) ≤ + (((value rho C U F K eps c s p h k A B q ap d).lower.value : ℝ) : EReal)) ∧ + ((d.upper.value : ℝ) ≤ realSourceGroundEnergy (d.toSource hd) → + (((value rho C U F K eps c s p h k A B q ap d).upper.value : ℝ) : EReal) ≤ + unitGroundEnergy ((value rho C U F K eps c s p h k A B q ap d).toData ho)) := by + let v := CoulombPairSum.exactTotal (GaussianFrequency.frequency rho) u + let x := SourcePhysicalThreshold.input rho C eps c s p h k A B q d + let a := (SourceNuclearProgram.amplification rho k d : ℝ) * + (((SourceContactProgram.size d^(30*B) : ℕ) : ℝ)⁻¹)^2 + have ha : 0 ≤ a := by + apply mul_nonneg _ (sq_nonneg _) + exact (CenteredPhysicalThreshold.amplification_bound rho _ hrho).1 + have herr := actual_threshold_error rho C U F K hrho eps c s p h k A B q ap d u hu hsites + have hdiff := SourcePhysicalThreshold.exact_endpoint_differences rho C eps c s p h k A B q d v + change (AffinePhysicalThreshold.exactValue rho x v).1 - + SourcePhysicalThreshold.exactSourceEnergy rho C eps c s p h k A B q d v = + a * ((SourcePositiveProgram.output s d).lower - SourcePositiveProgram.energy (SourcePositiveProgram.output s d)) ∧ + SourcePhysicalThreshold.exactSourceEnergy rho C eps c s p h k A B q d v - + (AffinePhysicalThreshold.exactValue rho x v).2 = + a * (SourcePositiveProgram.energy (SourcePositiveProgram.output s d) - (SourcePositiveProgram.output s d).upper) at hdiff + have hfe := abs_le.mp hfinite + have hlow := abs_le.mp herr.1 + have hhigh := abs_le.mp herr.2 + constructor + · intro hy + have hm := mul_le_mul_of_nonneg_left (SourcePositiveProgram.output_yes_margin s d hd hp hy) ha + have hl : center+continuumError ≤ (value rho C U F K eps c s p h k A B q ap d).lower.value := by + dsimp only [a] at hm + nlinarith only [hm,hdiff.1,hbudget,hfe.2,hlow.1] + exact hground.2.trans (EReal.coe_le_coe_iff.mpr hl) + · intro hn + have hm := mul_le_mul_of_nonneg_left (SourcePositiveProgram.output_no_margin s d hd hp hn) ha + have hh : ((value rho C U F K eps c s p h k A B q ap d).upper.value : ℝ) ≤ center-continuumError := by + dsimp only [a] at hm + nlinarith only [hm,hdiff.2,hbudget,hfe.1,hhigh.2] + exact (EReal.coe_le_coe_iff.mpr hh).trans hground.1 + +end ContinuumCoulomb.SourceUnitCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourcePhysicalThreshold.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourcePhysicalThreshold.lean new file mode 100644 index 0000000000000000000000000000000000000000..d81ec1eef429a7aa9dae9a032ffe9d5022cfd707 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourcePhysicalThreshold.lean @@ -0,0 +1,122 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.AffinePhysicalThresholdProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.PrefactorSourceContactProgram + +namespace OAI + +/-! Literal raw-source assembly of the complete physical threshold pair. +The same fixed powers determine the calibration amplification, the centered +nuclear mesh, and the rational slab dimensions. -/ + +namespace ContinuumCoulomb.SourcePhysicalThreshold +open ExactQuantumFactoring.BitStackProgram + +def mesh (k : ℕ) (d : BinaryHeisenberg) : ℕ := SourceContactProgram.size d^(10*k) +def horizontalRadius (k : ℕ) (d : BinaryHeisenberg) : ℕ := SourceContactProgram.size d^(60*k) +def verticalRadius (k : ℕ) (d : BinaryHeisenberg) : ℕ := SourceContactProgram.size d^(15*k) +def slabHorizontal (k : ℕ) (d : BinaryHeisenberg) : ℚ := + SlabBoxSchedule.centeredWidth (horizontalRadius k d) (mesh k d) +def slabVertical (k : ℕ) (d : BinaryHeisenberg) : ℚ := + SlabBoxSchedule.centeredWidth (verticalRadius k d) (mesh k d) + +theorem horizontal_product (k : ℕ) (d : BinaryHeisenberg) : + horizontalRadius k d = SourceContactProgram.size d^(50*k)*mesh k d := by + dsimp [horizontalRadius,mesh] + rw [← pow_add] + congr 1 + omega + +theorem vertical_product (k : ℕ) (d : BinaryHeisenberg) : + verticalRadius k d = SourceContactProgram.size d^(5*k)*mesh k d := by + dsimp [verticalRadius,mesh] + rw [← pow_add] + congr 1 + omega + +theorem mesh_positive (k : ℕ) (d : BinaryHeisenberg) : 0 < mesh k d := by + apply pow_pos + exact lt_of_lt_of_le (by decide : 0 < 2) (SourceContactProgram.size_ge_two d) + +theorem slabHorizontal_bounds (k : ℕ) (d : BinaryHeisenberg) : + ((SourceContactProgram.size d^(50*k):ℕ):ℚ) ≤ slabHorizontal k d ∧ + slabHorizontal k d ≤ 2*((SourceContactProgram.size d^(50*k):ℕ):ℚ) := by + rw [slabHorizontal,horizontal_product] + exact SlabBoxSchedule.centeredWidth_product_bounds _ _ + (pow_pos (lt_of_lt_of_le (by decide : 0 < 2) (SourceContactProgram.size_ge_two d)) _) + (mesh_positive k d) + +theorem slabVertical_bounds (k : ℕ) (d : BinaryHeisenberg) : + ((SourceContactProgram.size d^(5*k):ℕ):ℚ) ≤ slabVertical k d ∧ + slabVertical k d ≤ 2*((SourceContactProgram.size d^(5*k):ℕ):ℚ) := by + rw [slabVertical,vertical_product] + exact SlabBoxSchedule.centeredWidth_product_bounds _ _ + (pow_pos (lt_of_lt_of_le (by decide : 0 < 2) (SourceContactProgram.size_ge_two d)) _) + (mesh_positive k d) + +noncomputable def input (rho C : ℕ) (ε c : ℚ) (s p h k A B q : ℕ) + (d : BinaryHeisenberg) : AffinePhysicalThreshold.Input := + (((mesh k d, + (horizontalRadius k d,verticalRadius k d)), + ((SourcePositiveProgram.output s d).vertices, + (SourceContactProgram.size d^q, + ((SourcePositiveProgram.output s d).lower,(SourcePositiveProgram.output s d).upper)))), + (((SourceContactProgram.size d^(30*B):ℕ):ℚ)⁻¹, + (PrefactorSourceContactProgram.value rho (CalibrationMesh.prefactor rho) C ε c + s p h k A B d, + (SourcePositiveProgram.output s d).bonds.map (fun e => e.2.2)))) + +noncomputable def value (rho C : ℕ) (ε c : ℚ) (s p h k A B q : ℕ) + (d : BinaryHeisenberg) : ℚ×ℚ := + AffinePhysicalThreshold.value rho (input rho C ε c s p h k A B q d) + +noncomputable opaque tauProgram (B : ℕ) : Procedure binaryHeisenbergCodec.encode ratCode + (fun d => (((SourceContactProgram.size d^(30*B):ℕ):ℚ)⁻¹)) := + Procedure.ratInv.comp (Procedure.natToRat.comp + (Procedure.unaryToBits.comp (SourceContactProgram.powerProgram (30*B)))) + +noncomputable opaque inputProgram (rho C : ℕ) (ε c : ℚ) (s p h k A B q : ℕ) : + Procedure binaryHeisenbergCodec.encode AffinePhysicalThreshold.inputCode + (input rho C ε c s p h k A B q) := by + let geometry := (SourceContactProgram.powerProgram (10*k)).pair + ((SourceContactProgram.powerProgram (60*k)).pair (SourceContactProgram.powerProgram (15*k))) + let bounds := (SourcePositiveProgram.lowerProgram s).pair (SourcePositiveProgram.upperProgram s) + let metadata := (SourcePositiveProgram.verticesProgram s).pair + ((SourceContactProgram.powerProgram q).pair bounds) + let sites := PrefactorSourceContactProgram.program rho (CalibrationMesh.prefactor rho) C ε c + s p h k A B + let weights := SourceContactProgram.coefficientsProgram s + exact (geometry.pair metadata).pair ((tauProgram B).pair (sites.pair weights)) + +noncomputable opaque program (rho C : ℕ) (ε c : ℚ) (s p h k A B q : ℕ) : + Procedure binaryHeisenbergCodec.encode (prodCode ratCode ratCode) + (value rho C ε c s p h k A B q) := + (AffinePhysicalThreshold.program rho).comp (inputProgram rho C ε c s p h k A B q) + +noncomputable def certificate (rho C : ℕ) (ε c : ℚ) (s p h k A B q : ℕ) : + Turing.TM2ComputableInPolyTime binaryHeisenbergCodec.encode (prodCode ratCode ratCode) + (value rho C ε c s p h k A B q) := (program rho C ε c s p h k A B q).toTM2 + +theorem actual_error (rho C : ℕ) (hrho : 0 < rho) (ε c : ℚ) + (s p h k A B q : ℕ) (d : BinaryHeisenberg) {m : ℕ} + (u : Fin m → CoulombPairSum.Point) (hu : Function.Injective u) + (hsites : PrefactorSourceContactProgram.value rho (CalibrationMesh.prefactor rho) + C ε c s p h k A B d = List.ofFn u) : + let v := CoulombPairSum.exactTotal (GaussianFrequency.frequency rho) u + |((value rho C ε c s p h k A B q d).1:ℝ)- + (AffinePhysicalThreshold.exactValue rho (input rho C ε c s p h k A B q d) v).1| ≤ + 1/(((SourceContactProgram.size d^q:ℕ):ℝ)+1) ∧ + |((value rho C ε c s p h k A B q d).2:ℝ)- + (AffinePhysicalThreshold.exactValue rho (input rho C ε c s p h k A B q d) v).2| ≤ + 1/(((SourceContactProgram.size d^q:ℕ):ℝ)+1) := by + exact AffinePhysicalThreshold.actual_error rho hrho (input rho C ε c s p h k A B q d) + (mesh_positive k d) u hu hsites + +theorem gap (rho C : ℕ) (ε c : ℚ) (s p h k A B q : ℕ) (d : BinaryHeisenberg) : + (value rho C ε c s p h k A B q d).2-(value rho C ε c s p h k A B q d).1 = + CenteredPhysicalThreshold.amplification rho (SourceContactProgram.size d^(10*k))* + (((SourceContactProgram.size d^(30*B):ℕ):ℚ)⁻¹)^2* + ((SourcePositiveProgram.output s d).upper-(SourcePositiveProgram.output s d).lower) := by + exact AffinePhysicalThreshold.gap rho (input rho C ε c s p h k A B q d) + +end ContinuumCoulomb.SourcePhysicalThreshold + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourcePositiveBounds.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourcePositiveBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..5eeeac574e40b2a4af51c9feb7f681cb83ffe64d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourcePositiveBounds.lean @@ -0,0 +1,117 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.MediatorUnaryProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.PolynomialUnaryBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceNormalizationCorrectness +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceEncodingSize + +namespace OAI + +/-! The actual source normalization and metadata programs give one fixed +polynomial coefficient exponent for the final positive-spin graph. -/ + +noncomputable section +namespace ContinuumCoulomb.SourceMetadataProgram +open ExactQuantumFactoring.BitStackProgram MediatorListProgram + +attribute [local irreducible] MediatorParameters.finalWeight + +abbrev finalBound (k : ℕ) (d : BinaryHeisenberg) : ℕ := + MediatorParameters.finalWeight + (SourceNormalizationProgram.normalized (input k d)).1.1 + (SourceNormalizationProgram.normalized (input k d)).1.2.1 + (SourceNormalizationProgram.normalized (input k d)).1.2.2.1 + +noncomputable opaque normalizedEnvironmentProgram (k : ℕ) : Procedure binaryHeisenbergCodec.encode + envCode (fun d => (SourceNormalizationProgram.normalized (input k d)).1) := + (Procedure.first envCode (listCode bondCode)).comp (normalizedProgram k) + +noncomputable opaque finalBoundProgram (k : ℕ) : Procedure binaryHeisenbergCodec.encode + unaryCode ((fun x : Env => MediatorParameters.finalWeight x.1 x.2.1 x.2.2.1) ∘ + (fun d => (SourceNormalizationProgram.normalized (input k d)).1)) := + MediatorUnaryProgram.finalWeight.comp (normalizedEnvironmentProgram k) + +theorem finalBound_power (k : ℕ) : + ∃ A : ℕ, ∀ d, finalBound k d ≤ ((binaryHeisenbergCodec.encode d).length + 2) ^ A := + unaryProcedure_power_bound (finalBoundProgram k) + +private theorem envWeight_congr (x : Env) (r W G n : ℕ) (h : x = (r, W, G, n)) : + MediatorParameters.finalWeight x.1 x.2.1 x.2.2.1 = + MediatorParameters.finalWeight r W G := by + cases h + rfl + +private theorem finalBound_of_env (k : ℕ) (d : BinaryHeisenberg) (r W G n : ℕ) + (he : (SourceNormalizationProgram.normalized (input k d)).1 = (r, W, G, n)) : + finalBound k d = MediatorParameters.finalWeight r W G := by + exact envWeight_congr ((SourceNormalizationProgram.normalized (input k d)).1) r W G n he + +theorem finalBound_eq (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) : + finalBound k d = MediatorParameters.finalWeight + (SourceNormalizedSpectrum.retained (d.toSource h) (roundingDenominator k d)).length + (roundingDenominator k d + size d ^ k + 1) (size d ^ k) := by + have he : (SourceNormalizationProgram.normalized (input k d)).1 = + ((SourceNormalizedSpectrum.retained (d.toSource h) (roundingDenominator k d)).length, + roundingDenominator k d + size d ^ k + 1, size d ^ k, d.coordinate.length) := + congrArg Prod.fst (normalized_eq k d h) + exact finalBound_of_env k d + (SourceNormalizedSpectrum.retained (d.toSource h) (roundingDenominator k d)).length + (roundingDenominator k d + size d ^ k + 1) (size d ^ k) d.coordinate.length he + +theorem retained_count_le (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) : + (SourceNormalizedSpectrum.retained (d.toSource h) (roundingDenominator k d)).length ≤ + d.edges.length := by + have hf := List.length_filter_le SourceZeroFilter.keep + (SourceNormalizedSpectrum.rounded (d.toSource h) (roundingDenominator k d)) + simpa only [SourceNormalizedSpectrum.retained, SourceNormalizedSpectrum.rounded, + List.length_ofFn, BinaryHeisenberg.toSource] using hf + +theorem positive_graph_count_bound (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) : + d.coordinate.length + 18 * + (SourceNormalizedSpectrum.retained (d.toSource h) (roundingDenominator k d)).length ≤ + 19 * (binaryHeisenbergCodec.encode d).length ∧ + 19 * (SourceNormalizedSpectrum.retained (d.toSource h) (roundingDenominator k d)).length ≤ + 19 * (binaryHeisenbergCodec.encode d).length := by + have hr := retained_count_le k d h + have hc := binaryHeisenberg_count_le_length d + constructor <;> omega + +/-- One fixed exponent controls every final coefficient, even when the +original source contains zero or exponentially tiny rational coefficients. -/ +theorem source_positive_weight_range (k : ℕ) : + ∃ A : ℕ, 0 < A ∧ ∀ (d : BinaryHeisenberg) (h : d.Valid), + d.PolynomialPromise k → ∀ e, + (((binaryHeisenbergCodec.encode d).length + 2 : ℝ) ^ A)⁻¹ ≤ + ((MediatorIteration.finalGraph + (SourceNormalizedSpectrum.family (d.toSource h) (roundingDenominator k d)) + (roundingDenominator k d + size d ^ k + 1) (size d ^ k)).weight e : ℝ) ∧ + ((MediatorIteration.finalGraph + (SourceNormalizedSpectrum.family (d.toSource h) (roundingDenominator k d)) + (roundingDenominator k d + size d ^ k + 1) (size d ^ k)).weight e : ℝ) ≤ + ((binaryHeisenbergCodec.encode d).length + 2 : ℝ) ^ A := by + obtain ⟨A, hA⟩ := finalBound_power k + refine ⟨A + 1, by omega, fun d h hp e => ?_⟩ + have hG : 0 < size d ^ k := pow_pos (size_pos d) k + have hM : 0 < roundingDenominator k d := + SourceNormalizedSpectrum.denominator_pos d.edges.length hG + have hW : 0 < roundingDenominator k d + size d ^ k + 1 := by omega + have hB := SourceNormalizedSpectrum.family_bounds (d.toSource h) hM + (polynomialPromise_weight k d h hp) + have hlo := MediatorIteration.finalGraph_lower _ hW hG (fun i => (hB i).2) (fun i => (hB i).1) e + have hhi := MediatorIteration.finalGraph_upper _ hW hG (fun i => (hB i).2) (fun i => (hB i).1) e + have hsize : 2 ≤ (binaryHeisenbergCodec.encode d).length + 2 := by omega + have hpow : (2 : ℝ) ≤ ((binaryHeisenbergCodec.encode d).length + 2 : ℝ) ^ (A + 1) := by + exact_mod_cast hsize.trans (Nat.le_self_pow (by omega : A + 1 ≠ 0) _) + constructor + · have hi := one_div_le_one_div_of_le (by norm_num : (0 : ℝ) < 2) hpow + norm_num only [one_div] at hi + exact hi.trans hlo + · apply hhi.trans + rw [← finalBound_eq k d h] + have hn := (hA d).trans (Nat.pow_le_pow_right (by omega : 1 ≤ + (binaryHeisenbergCodec.encode d).length + 2) (by omega : A ≤ A + 1)) + exact_mod_cast hn + +end ContinuumCoulomb.SourceMetadataProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourcePositiveCorrectness.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourcePositiveCorrectness.lean new file mode 100644 index 0000000000000000000000000000000000000000..9a50812edb44ac6db00bddefad52a22b9f23f4d4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourcePositiveCorrectness.lean @@ -0,0 +1,102 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.SourcePositiveProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.ManyBody.MediatorFullListCorrectness + +namespace OAI + +/-! Exact semantics of the computed positive-spin source reduction: the +literal output has the full three-stage matrix and the proved rational +thresholds, including the common coefficient-rounding error. -/ + +noncomputable section +namespace ContinuumCoulomb.SourcePositiveProgram +open MediatorIteration SourceMetadataProgram + +abbrev sourceFamily (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) := + SourceNormalizedSpectrum.family (d.toSource h) (roundingDenominator k d) + +abbrev sourceBound (k : ℕ) (d : BinaryHeisenberg) := + roundingDenominator k d + size d ^ k + 1 + +theorem normalized_literal (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) : + normalized k d = literalInput (sourceFamily k d h) (sourceBound k d) (size d ^ k) := by + rw [normalized, normalized_eq k d h] + unfold literalInput sourceFamily SourceNormalizedSpectrum.family + rw [bonds_toList] + rfl + +theorem bonds_eq (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) : + (output k d).bonds = + (finalGraph (sourceFamily k d h) (sourceBound k d) (size d ^ k)).toList := by + change MediatorThreeStageProgram.finalBonds (normalized k d) = _ + rw [normalized_literal] + exact (finalGraph_toList _ _ _).symm + +theorem offset_eq (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) : + offset k d = MediatorIteration.offset (sourceFamily k d h) (sourceBound k d) (size d ^ k) := by + unfold offset + rw [normalized_literal, offset_toList] + +theorem vertices_eq (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) : + (output k d).vertices = d.coordinate.length + + (SourceNormalizedSpectrum.retained (d.toSource h) (roundingDenominator k d)).length * 2 + + (SourceNormalizedSpectrum.retained (d.toSource h) (roundingDenominator k d)).length * 2 * 2 + + ((SourceNormalizedSpectrum.retained (d.toSource h) (roundingDenominator k d)).length * 2 + + (SourceNormalizedSpectrum.retained (d.toSource h) (roundingDenominator k d)).length * 2 * 2) * 2 := by + change (normalized k d).1.2.2.2 + 18 * (normalized k d).1.1 = _ + rw [normalized, normalized_eq k d h] + dsimp only + omega + +def energy (x : Registers) : ℝ := sourceMatrixBottom x.vertices (SourceBondLists.matrix x.vertices x.bonds) + +theorem energy_eq (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) : + energy (output k d) = SourceNormalizedSpectrum.positiveEnergy (d.toSource h) (size d ^ k) (size d ^ k) := by + unfold energy + rw [bonds_eq k d h, vertices_eq k d h] + change sourceMatrixBottom _ (SourceBondLists.matrix _ + (finalGraph (sourceFamily k d h) (sourceBound k d) (size d ^ k)).toList) = + sourceMatrixBottom _ (finalGraph (sourceFamily k d h) (sourceBound k d) (size d ^ k)).matrix + exact congrArg (sourceMatrixBottom _) + (Bonds.matrix_toList (finalGraph (sourceFamily k d h) (sourceBound k d) (size d ^ k))) + +theorem lower_eq (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) : + (output k d).lower = SourceNormalizedSpectrum.lowerThreshold + (d.toSource h) (size d ^ k) (size d ^ k) d.lower.value := by + change d.lower.value - offset k d + error k d = _ + rw [offset_eq] + rfl + +theorem upper_eq (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) : + (output k d).upper = SourceNormalizedSpectrum.upperThreshold + (d.toSource h) (size d ^ k) (size d ^ k) d.upper.value := by + change d.upper.value - offset k d - error k d = _ + rw [offset_eq] + rfl + +theorem output_yes (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) + (hp : d.PolynomialPromise k) + (hyes : realSourceGroundEnergy (d.toSource h) ≤ d.lower.value) : + energy (output k d) ≤ (output k d).lower := by + rw [energy_eq k d h, lower_eq k d h] + exact SourceNormalizedSpectrum.source_positive_yes _ (pow_pos (size_pos d) k) + (polynomialPromise_weight k d h hp) hyes + +theorem output_no (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) + (hp : d.PolynomialPromise k) + (hno : (d.upper.value : ℝ) ≤ realSourceGroundEnergy (d.toSource h)) : + ((output k d).upper : ℝ) ≤ energy (output k d) := by + rw [energy_eq k d h, upper_eq k d h] + exact SourceNormalizedSpectrum.source_positive_no _ (pow_pos (size_pos d) k) + (polynomialPromise_weight k d h hp) hno + +theorem output_gap (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) + (hp : d.PolynomialPromise k) : + 63 / 64 * (d.upper.value - d.lower.value) ≤ (output k d).upper - (output k d).lower := by + rw [upper_eq k d h, lower_eq k d h] + exact SourceNormalizedSpectrum.positive_threshold_gap _ _ _ (polynomialPromise_gap k d hp) + +end ContinuumCoulomb.SourcePositiveProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourcePositiveMargin.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourcePositiveMargin.lean new file mode 100644 index 0000000000000000000000000000000000000000..75ba26617a6ac3c59638ad51c0b6327d59ed3c52 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourcePositiveMargin.lean @@ -0,0 +1,85 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourcePositiveCorrectness + +namespace OAI + +/-! The literal positive-spin thresholds retain a quantitative part of the +rounding budget. This margin pays for the later Hubbard and continuum errors. -/ + +noncomputable section +namespace ContinuumCoulomb.SourceNormalizedSpectrum + +theorem normalization_margin (r : ℕ) {G : ℕ} (hG : 0 < G) : + 3 / (512 * (G : ℝ)) + 3 * r / (2 * (denominator r G : ℝ)) + + 1 / (2048 * (G : ℝ)) ≤ 1 / (128 * (G : ℝ)) := by + have hg : (0 : ℝ) < G := by exact_mod_cast hG + have hden : (denominator r G : ℝ) = 1024 * ((r : ℝ) + 1) * G := by + simp only [denominator,Nat.cast_mul,Nat.cast_add,Nat.cast_one,Nat.cast_ofNat] + rw [hden] + have hr : 3 * (r : ℝ) / (2 * (1024 * (r + 1) * G)) ≤ 3 / (2048 * G) := by + apply (div_le_div_iff₀ (by positivity) (by positivity)).mpr + nlinarith + have he : 3 / (512 * (G : ℝ)) + 3 / (2048 * G) + 1 / (2048 * G) = + 1 / (128 * G) := by field_simp; ring + linarith + +theorem source_positive_margin (d : SquareLatticeHeisenberg) {W G : ℕ} + (hG : 0 < G) (hW : ∀ e, |(d.coefficient e : ℝ)| ≤ W) : + |positiveEnergy d W G + + (MediatorIteration.offset (family d (denominator d.edges G)) + (denominator d.edges G + W + 1) G : ℝ) - realSourceGroundEnergy d| + + 1 / (2048 * (G : ℝ)) ≤ 1 / (128 * (G : ℝ)) := by + have h := normalized_three_stage_bottom d (denominator_pos d.edges hG) hG hW + exact (add_le_add h le_rfl).trans (normalization_margin d.edges hG) + +theorem source_positive_yes_margin (d : SquareLatticeHeisenberg) {W G : ℕ} + (hG : 0 < G) (hW : ∀ e, |(d.coefficient e : ℝ)| ≤ W) {a : ℚ} + (hyes : realSourceGroundEnergy d ≤ a) : + positiveEnergy d W G + 1 / (2048 * (G : ℝ)) ≤ lowerThreshold d W G a := by + have hm := source_positive_margin d hG hW + have ha := le_abs_self (positiveEnergy d W G + + (MediatorIteration.offset (family d (denominator d.edges G)) + (denominator d.edges G + W + 1) G : ℝ) - realSourceGroundEnergy d) + simp only [lowerThreshold,Rat.cast_add,Rat.cast_sub,Rat.cast_div, + Rat.cast_mul,Rat.cast_one,Rat.cast_ofNat,Rat.cast_natCast] + linarith + +theorem source_positive_no_margin (d : SquareLatticeHeisenberg) {W G : ℕ} + (hG : 0 < G) (hW : ∀ e, |(d.coefficient e : ℝ)| ≤ W) {b : ℚ} + (hno : (b : ℝ) ≤ realSourceGroundEnergy d) : + (upperThreshold d W G b : ℝ) + 1 / (2048 * (G : ℝ)) ≤ positiveEnergy d W G := by + have hm := source_positive_margin d hG hW + have ha := neg_abs_le (positiveEnergy d W G + + (MediatorIteration.offset (family d (denominator d.edges G)) + (denominator d.edges G + W + 1) G : ℝ) - realSourceGroundEnergy d) + simp only [upperThreshold,Rat.cast_sub,Rat.cast_div, + Rat.cast_mul,Rat.cast_one,Rat.cast_ofNat,Rat.cast_natCast] + linarith + +end ContinuumCoulomb.SourceNormalizedSpectrum + +namespace ContinuumCoulomb.SourcePositiveProgram +open SourceMetadataProgram + +theorem output_yes_margin (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) + (hp : d.PolynomialPromise k) + (hyes : realSourceGroundEnergy (d.toSource h) ≤ d.lower.value) : + energy (output k d) + 1 / (2048 * ((size d ^ k : ℕ) : ℝ)) ≤ + (output k d).lower := by + rw [energy_eq k d h,lower_eq k d h] + exact SourceNormalizedSpectrum.source_positive_yes_margin _ (pow_pos (size_pos d) k) + (polynomialPromise_weight k d h hp) hyes + +theorem output_no_margin (k : ℕ) (d : BinaryHeisenberg) (h : d.Valid) + (hp : d.PolynomialPromise k) + (hno : (d.upper.value : ℝ) ≤ realSourceGroundEnergy (d.toSource h)) : + ((output k d).upper : ℝ) + 1 / (2048 * ((size d ^ k : ℕ) : ℝ)) ≤ + energy (output k d) := by + rw [energy_eq k d h,upper_eq k d h] + exact SourceNormalizedSpectrum.source_positive_no_margin _ (pow_pos (size_pos d) k) + (polynomialPromise_weight k d h hp) hno + +end ContinuumCoulomb.SourcePositiveProgram + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourcePromise.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourcePromise.lean new file mode 100644 index 0000000000000000000000000000000000000000..30302ea923006acddd03d0406173fca6ed45438c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourcePromise.lean @@ -0,0 +1,149 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Quantum.QuantumVerifier +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceSpectrum +import Mathlib.Data.List.GetD +import Mathlib.Data.List.Nodup + +namespace OAI + +/-! Finite binary input and promise language for the published signed, +field-free square-lattice Heisenberg problem. Invalid encodings and inputs +outside the energy promise belong to neither promise set. -/ + +namespace ContinuumCoulomb +open BinaryEncoding + +structure BinaryRational where + numerator : ℤ + denominator : ℕ + deriving DecidableEq, Repr + +def BinaryRational.value (q : BinaryRational) : ℚ := + (q.numerator : ℚ) / q.denominator + +def binaryRationalEquiv : BinaryRational ≃ (ℤ × ℕ) where + toFun q := (q.numerator, q.denominator) + invFun q := ⟨q.1, q.2⟩ + left_inv q := by cases q; rfl + right_inv q := by cases q; rfl + +def binaryRationalCodec : Codec BinaryRational := BinaryEncoding.equiv (pair integer natural) binaryRationalEquiv + +def BinaryRational.ofRat (q : ℚ) : BinaryRational := ⟨q.num, q.den⟩ + +@[simp] theorem BinaryRational.value_ofRat (q : ℚ) : (BinaryRational.ofRat q).value = q := by + exact Rat.num_div_den q + +structure BinaryHeisenbergEdge where + left : ℕ + right : ℕ + coefficient : BinaryRational + deriving DecidableEq, Repr + +def binaryHeisenbergEdgeEquiv : BinaryHeisenbergEdge ≃ (ℕ × (ℕ × BinaryRational)) where + toFun e := (e.left, e.right, e.coefficient) + invFun e := ⟨e.1, e.2.1, e.2.2⟩ + left_inv e := by cases e; rfl + right_inv e := by rcases e with ⟨i, j, q⟩; rfl + +def binaryHeisenbergEdgeCodec : Codec BinaryHeisenbergEdge := BinaryEncoding.equiv + (pair natural (pair natural binaryRationalCodec)) binaryHeisenbergEdgeEquiv + +structure BinaryHeisenberg where + coordinate : List (ℤ × ℤ) + edges : List BinaryHeisenbergEdge + lower : BinaryRational + upper : BinaryRational + deriving DecidableEq, Repr + +def binaryHeisenbergEquiv : BinaryHeisenberg ≃ + (List (ℤ × ℤ) × (List BinaryHeisenbergEdge × (BinaryRational × BinaryRational))) where + toFun d := (d.coordinate, d.edges, d.lower, d.upper) + invFun d := ⟨d.1, d.2.1, d.2.2.1, d.2.2.2⟩ + left_inv d := by cases d; rfl + right_inv d := by rcases d with ⟨cs, es, a, b⟩; rfl + +def binaryHeisenbergCodec : Codec BinaryHeisenberg := BinaryEncoding.equiv + (pair (BinaryEncoding.list (pair integer integer)) + (pair (BinaryEncoding.list binaryHeisenbergEdgeCodec) (pair binaryRationalCodec binaryRationalCodec))) + binaryHeisenbergEquiv + +structure BinaryHeisenberg.Valid (d : BinaryHeisenberg) : Prop where + vertices_pos : 0 < d.coordinate.length + coordinate_nodup : d.coordinate.Nodup + bounds : ∀ e : Fin d.edges.length, + (d.edges.get e).left < d.coordinate.length ∧ (d.edges.get e).right < d.coordinate.length + denominators : ∀ e : Fin d.edges.length, 0 < (d.edges.get e).coefficient.denominator + adjacent : ∀ e : Fin d.edges.length, + Int.natAbs ((d.coordinate.getD (d.edges.get e).left (0, 0)).1 - + (d.coordinate.getD (d.edges.get e).right (0, 0)).1) + + Int.natAbs ((d.coordinate.getD (d.edges.get e).left (0, 0)).2 - + (d.coordinate.getD (d.edges.get e).right (0, 0)).2) = 1 + simple : ∀ e f : Fin d.edges.length, e ≠ f → + ¬((d.edges.get e).left = (d.edges.get f).left ∧ (d.edges.get e).right = (d.edges.get f).right) ∧ + ¬((d.edges.get e).left = (d.edges.get f).right ∧ (d.edges.get e).right = (d.edges.get f).left) + lower_denominator : 0 < d.lower.denominator + upper_denominator : 0 < d.upper.denominator + gap : d.lower.value < d.upper.value + +/-- Decode valid finite data into the existing actual spin Hamiltonian. -/ +def BinaryHeisenberg.toSource (d : BinaryHeisenberg) (h : d.Valid) : SquareLatticeHeisenberg where + vertices := d.coordinate.length + vertices_pos := h.vertices_pos + coordinate := d.coordinate.get + coordinate_injective := h.coordinate_nodup.injective_get + edges := d.edges.length + left e := ⟨(d.edges.get e).left, (h.bounds e).1⟩ + right e := ⟨(d.edges.get e).right, (h.bounds e).2⟩ + adjacent e := by + have ha := h.adjacent e + rw [List.getD_eq_get d.coordinate (0, 0) ⟨(d.edges.get e).left, (h.bounds e).1⟩, + List.getD_eq_get d.coordinate (0, 0) ⟨(d.edges.get e).right, (h.bounds e).2⟩] at ha + exact ha + edge_simple e f hne := by + have hs := h.simple e f hne + constructor + · rintro ⟨hl, hr⟩ + exact hs.1 ⟨congrArg Fin.val hl, congrArg Fin.val hr⟩ + · rintro ⟨hl, hr⟩ + exact hs.2 ⟨congrArg Fin.val hl, congrArg Fin.val hr⟩ + coefficient e := (d.edges.get e).coefficient.value + lower := d.lower.value + upper := d.upper.value + gap_pos := h.gap + +/-- A single fixed exponent bounds lattice extent, source weights and inverse +gap, as in the polynomial-weight spatially sparse source branch. -/ +structure BinaryHeisenberg.PolynomialPromise (k : ℕ) (d : BinaryHeisenberg) : Prop where + coordinate_bound : ∀ p ∈ d.coordinate, + |(p.1 : ℝ)| ≤ ((binaryHeisenbergCodec.encode d).length + 1 : ℝ) ^ k ∧ + |(p.2 : ℝ)| ≤ ((binaryHeisenbergCodec.encode d).length + 1 : ℝ) ^ k + weight_bound : ∀ e : Fin d.edges.length, |((d.edges.get e).coefficient.value : ℝ)| ≤ + ((binaryHeisenbergCodec.encode d).length + 1 : ℝ) ^ k + gap_bound : (((binaryHeisenbergCodec.encode d).length + 1 : ℝ) ^ k)⁻¹ ≤ + (d.upper.value : ℝ) - d.lower.value + +noncomputable section + +def sourceHeisenbergPromise (k : ℕ) : PromiseProblem BinaryHeisenberg where + yes := {d | ∃ h : d.Valid, d.PolynomialPromise k ∧ + sourceGroundEnergy (d.toSource h) ≤ ((d.lower.value : ℝ) : EReal)} + no := {d | ∃ h : d.Valid, d.PolynomialPromise k ∧ + ((d.upper.value : ℝ) : EReal) ≤ sourceGroundEnergy (d.toSource h)} + disjoint := by + apply Set.disjoint_left.mpr + rintro d ⟨h, _, hyes⟩ ⟨h', _, hno⟩ + have hab : ((d.upper.value : ℝ) : EReal) ≤ ((d.lower.value : ℝ) : EReal) := hno.trans hyes + have hgap : ((d.lower.value : ℝ) : EReal) < ((d.upper.value : ℝ) : EReal) := by + exact_mod_cast h.gap + exact (not_le_of_gt hgap) hab + +/-- Field-free signed square-lattice Heisenberg hardness of +Cubitt–Montanaro–Piddock, arXiv:1701.05182v4, Theorem 48 and Section 10.1, +with the polynomial-weight sparse construction of Lemma 47. -/ +def PublishedCMPHardness : Prop := + ∃ k : ℕ, 0 < k ∧ QMAHard binaryHeisenbergCodec.encode (sourceHeisenbergPromise k) + +end +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourcePromiseBudget.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourcePromiseBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..ba54c106f1fd1101f60003b1c401c56ca089d485 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourcePromiseBudget.lean @@ -0,0 +1,61 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Nuclei.RoundingPolynomialBudget + +namespace OAI + +/-! Fixed exponent choices absorb all three physical simulation errors +inside the margin retained by the positive-spin source program. -/ + +noncomputable section +namespace ContinuumCoulomb + +theorem physical_promise_error_budget {N M scale : ℝ} + (hN : 2 ≤ N) (hM : 1 ≤ M) (hMN : M ≤ N) (hscale : 1 ≤ scale) + (s B p g q : ℕ) (hp : 60*B+s+14 ≤ p) (hg : s+14 ≤ g) + (hq : 60*B+s+14 ≤ q) : + scale*(N^p)⁻¹ + scale*(N^g)⁻¹*((N^(30*B))⁻¹)^2 + 1/(N^q+1) ≤ + scale*((N^(30*B))⁻¹)^2*(1/(2048*M^s)) := by + have hN0 : 0 < N := by linarith + have hN1 : 1 ≤ N := by linarith + have hM0 : 0 < M := by linarith + have hscale0 : 0 ≤ scale := by linarith + have hi {a b : ℕ} (hab : b ≤ a) : (N^a)⁻¹ ≤ (N^b)⁻¹ := by + exact inv_anti₀ (pow_pos hN0 b) (pow_le_pow_right₀ hN1 hab) + have hid : (N^(60*B+s+14))⁻¹ = ((N^(30*B))⁻¹)^2*(N^(s+14))⁻¹ := by + rw [show 60*B+s+14=(30*B)*2+(s+14) by omega,pow_add,pow_mul,mul_inv_rev,inv_pow] + ring + have hcont : scale*(N^p)⁻¹ ≤ scale*((N^(30*B))⁻¹)^2*(N^(s+14))⁻¹ := by + have hh := mul_le_mul_of_nonneg_left (hi hp) hscale0 + simpa only [hid,mul_assoc] using hh + have hfinite : scale*(N^g)⁻¹*((N^(30*B))⁻¹)^2 ≤ + scale*((N^(30*B))⁻¹)^2*(N^(s+14))⁻¹ := by + have hh := mul_le_mul_of_nonneg_left (hi hg) + (mul_nonneg hscale0 (sq_nonneg ((N^(30*B))⁻¹))) + simpa only [mul_assoc,mul_comm,mul_left_comm] using hh + have hnum : 1/(N^q+1) ≤ scale*((N^(30*B))⁻¹)^2*(N^(s+14))⁻¹ := by + have hfirst : 1/(N^q+1) ≤ (N^q)⁻¹ := by + simpa only [one_div] using one_div_le_one_div_of_le (pow_pos hN0 q) + (show N^q ≤ N^q+1 by linarith) + have hsecond := (hi hq).trans (le_mul_of_one_le_left (by positivity) hscale) + exact hfirst.trans (by simpa only [hid,mul_assoc] using hsecond) + have htail : 3*(N^(s+14))⁻¹ ≤ 1/(2048*M^s) := by + have hpow : (6144:ℝ) ≤ N^14 := by + have hh := pow_le_pow_left₀ (by norm_num : (0:ℝ) ≤ 2) hN 14 + norm_num at hh + linarith + have hproduct : 3*(2048*M^s) ≤ N^(s+14) := by + rw [pow_add] + calc + _ = M^s*6144 := by ring + _ ≤ N^s*N^14 := mul_le_mul (pow_le_pow_left₀ hM0.le hMN s) hpow + (by norm_num) (pow_nonneg hN0.le s) + exact (div_le_div_iff₀ (pow_pos hN0 (s+14)) (by positivity : 0 < 2048*M^s)).mpr + (by simpa only [one_mul] using hproduct) + have ht := mul_le_mul_of_nonneg_left htail + (mul_nonneg hscale0 (sq_nonneg ((N^(30*B))⁻¹))) + nlinarith only [hcont,hfinite,hnum,ht] + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceSpectrum.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceSpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..84e6d2786a91c385009b2795fa9e5fd8eac6f2e5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceSpectrum.lean @@ -0,0 +1,191 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceHamiltonian +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.PublishedInputs + +namespace OAI + +/-! +# Source spectral bottom and rational normalization + +The bottom ranges over every normalized many-spin vector. Uniform +coefficient error controls that variational bottom and the YES/NO +thresholds of the square-lattice Heisenberg problem. +-/ + +noncomputable section + +namespace ContinuumCoulomb + +open scoped BigOperators + +def allUpSourceBasis (n : ℕ) : SourceSpinBasis n := fun _ => 0 + +def allUpSourceVector (n : ℕ) : SourceSpinVector n := + fun s => if s = allUpSourceBasis n then 1 else 0 + +theorem allUpSourceVector_mass (n : ℕ) : sourceSpinMass (allUpSourceVector n) = 1 := by + classical + simp [sourceSpinMass, allUpSourceVector] + +/-- Uniform form bound for the complete signed source Hamiltonian. -/ +theorem sourceHamiltonianForm_abs_le (d : SquareLatticeHeisenberg) + (u : SourceSpinVector d.vertices) : + |sourceHamiltonianForm d u| ≤ + (3 * ∑ e, |(d.coefficient e : ℝ)|) * sourceSpinMass u := by + unfold sourceHamiltonianForm + calc + |∑ e, (d.coefficient e : ℝ) * sourceHeisenbergForm (d.left e) (d.right e) u| ≤ + ∑ e, |(d.coefficient e : ℝ) * sourceHeisenbergForm (d.left e) (d.right e) u| := + Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ e, |(d.coefficient e : ℝ)| * (3 * sourceSpinMass u) := by + apply Finset.sum_le_sum + intro e _ + rw [abs_mul] + exact mul_le_mul_of_nonneg_left + (sourceHeisenbergForm_abs_le (d.left e) (d.right e) u) (abs_nonneg _) + _ = (3 * ∑ e, |(d.coefficient e : ℝ)|) * sourceSpinMass u := by + rw [← Finset.sum_mul] + ring + +theorem sourceGroundEnergy_le_trial (d : SquareLatticeHeisenberg) + (u : SourceSpinVector d.vertices) (hu : sourceSpinMass u = 1) : + sourceGroundEnergy d ≤ (sourceHamiltonianForm d u : EReal) := + sInf_le ⟨u, hu, rfl⟩ + +theorem sourceGroundEnergy_lower_of_forall (d : SquareLatticeHeisenberg) + (a : ℝ) + (ha : ∀ u : SourceSpinVector d.vertices, sourceSpinMass u = 1 → + a ≤ sourceHamiltonianForm d u) : + (a : EReal) ≤ sourceGroundEnergy d := by + apply le_sInf + rintro e ⟨u, hu, rfl⟩ + exact EReal.coe_le_coe (ha u hu) + +theorem sourceGroundEnergy_lower_bound (d : SquareLatticeHeisenberg) : + (-(3 * ∑ e, |(d.coefficient e : ℝ)|) : ℝ) ≤ sourceGroundEnergy d := by + apply sourceGroundEnergy_lower_of_forall + intro u hu + have h := (abs_le.mp (sourceHamiltonianForm_abs_le d u)).1 + simpa only [hu, mul_one] using h + +theorem sourceGroundEnergy_ne_bot (d : SquareLatticeHeisenberg) : + sourceGroundEnergy d ≠ ⊥ := + ne_bot_of_le_ne_bot (EReal.coe_ne_bot _) (sourceGroundEnergy_lower_bound d) + +theorem sourceGroundEnergy_ne_top (d : SquareLatticeHeisenberg) : + sourceGroundEnergy d ≠ ⊤ := + ne_top_of_le_ne_top (EReal.coe_ne_top _) + (sourceGroundEnergy_le_trial d (allUpSourceVector d.vertices) + (allUpSourceVector_mass d.vertices)) + +/-- The finite source bottom, now known to be a real number. -/ +def realSourceGroundEnergy (d : SquareLatticeHeisenberg) : ℝ := + (sourceGroundEnergy d).toReal + +theorem realSourceGroundEnergy_coe (d : SquareLatticeHeisenberg) : + (realSourceGroundEnergy d : EReal) = sourceGroundEnergy d := + EReal.coe_toReal (sourceGroundEnergy_ne_top d) (sourceGroundEnergy_ne_bot d) + +theorem realSourceGroundEnergy_le_trial (d : SquareLatticeHeisenberg) + (u : SourceSpinVector d.vertices) (hu : sourceSpinMass u = 1) : + realSourceGroundEnergy d ≤ sourceHamiltonianForm d u := by + apply EReal.coe_le_coe_iff.mp + rw [realSourceGroundEnergy_coe] + exact sourceGroundEnergy_le_trial d u hu + +theorem realSourceGroundEnergy_lower_of_forall (d : SquareLatticeHeisenberg) + (a : ℝ) + (ha : ∀ u : SourceSpinVector d.vertices, sourceSpinMass u = 1 → + a ≤ sourceHamiltonianForm d u) : + a ≤ realSourceGroundEnergy d := by + apply EReal.coe_le_coe_iff.mp + rw [realSourceGroundEnergy_coe] + exact sourceGroundEnergy_lower_of_forall d a ha + +def SquareLatticeHeisenberg.withCoefficients (d : SquareLatticeHeisenberg) + (coefficient : Fin d.edges → ℚ) : SquareLatticeHeisenberg := + { d with coefficient := coefficient } + +/-- Uniform perturbation of every state controls both variational bottoms. -/ +theorem realSourceGroundEnergy_rounding (d : SquareLatticeHeisenberg) + (rounded : Fin d.edges → ℚ) : + |realSourceGroundEnergy (d.withCoefficients rounded) - realSourceGroundEnergy d| ≤ + 3 * ∑ e, |(d.coefficient e : ℝ) - (rounded e : ℝ)| := by + let ε : ℝ := 3 * ∑ e, |(d.coefficient e : ℝ) - (rounded e : ℝ)| + have hpoint (u : SourceSpinVector d.vertices) (hu : sourceSpinMass u = 1) : + |sourceHamiltonianForm d u - sourceHamiltonianForm (d.withCoefficients rounded) u| ≤ + ε := + sourceHamiltonianForm_rounding d (fun e => (rounded e : ℝ)) u hu + have hl : realSourceGroundEnergy (d.withCoefficients rounded) - ε ≤ + realSourceGroundEnergy d := by + apply realSourceGroundEnergy_lower_of_forall + intro u hu + have h := (abs_le.mp (hpoint u hu)).1 + have htrial := realSourceGroundEnergy_le_trial (d.withCoefficients rounded) u hu + linarith + have hu : realSourceGroundEnergy d - ε ≤ + realSourceGroundEnergy (d.withCoefficients rounded) := by + apply realSourceGroundEnergy_lower_of_forall + intro u hu + have h := (abs_le.mp (hpoint u hu)).2 + have htrial := realSourceGroundEnergy_le_trial d u hu + linarith + apply abs_le.mpr + constructor <;> dsimp [ε] at * <;> linarith + +/-- The smallest useful energy consequence of coefficient rounding and +scalar-term removal for the source normalization. -/ +theorem sourceNormalization_energy_error (d : SquareLatticeHeisenberg) + (rounded : Fin d.edges → ℚ) (c ε : ℝ) + (hcoeff : (∑ e, |(d.coefficient e : ℝ) - (rounded e : ℝ)|) ≤ ε) : + |realSourceGroundEnergy (d.withCoefficients rounded) - + ((realSourceGroundEnergy d + c) - c)| ≤ 3 * ε := by + have h := realSourceGroundEnergy_rounding d rounded + simp only [add_sub_cancel_right] + linarith + +/-- Actual spectral-bottom rounding preserves the source YES implication. -/ +theorem sourceNormalization_yes (d : SquareLatticeHeisenberg) + (rounded : Fin d.edges → ℚ) {c a aRound cRound ε : ℝ} + (hcoeff : (∑ e, |(d.coefficient e : ℝ) - (rounded e : ℝ)|) ≤ ε) + (ha : |aRound - a| ≤ ε) (hc : |cRound - c| ≤ ε) + (hyes : realSourceGroundEnergy d + c ≤ a) : + realSourceGroundEnergy (d.withCoefficients rounded) ≤ + normalizedSourceLower aRound cRound ε := + normalizedSource_yes (sourceNormalization_energy_error d rounded c ε hcoeff) ha hc hyes + +/-- Actual spectral-bottom rounding preserves the source NO implication. -/ +theorem sourceNormalization_no (d : SquareLatticeHeisenberg) + (rounded : Fin d.edges → ℚ) {c b bRound cRound ε : ℝ} + (hcoeff : (∑ e, |(d.coefficient e : ℝ) - (rounded e : ℝ)|) ≤ ε) + (hb : |bRound - b| ≤ ε) (hc : |cRound - c| ≤ ε) + (hno : b ≤ realSourceGroundEnergy d + c) : + normalizedSourceUpper bRound cRound ε ≤ + realSourceGroundEnergy (d.withCoefficients rounded) := + normalizedSource_no (sourceNormalization_energy_error d rounded c ε hcoeff) hb hc hno + +/-- Source normalization with the papers' error allocation, retaining the +two promise implications and at least `22δ/25` threshold separation. -/ +theorem sourceNormalization (d : SquareLatticeHeisenberg) + (rounded : Fin d.edges → ℚ) {c a b aRound bRound cRound δ : ℝ} + (hgap : δ ≤ b - a) + (hcoeff : (∑ e, |(d.coefficient e : ℝ) - (rounded e : ℝ)|) ≤ δ / 100) + (ha : |aRound - a| ≤ δ / 100) + (hb : |bRound - b| ≤ δ / 100) + (hc : |cRound - c| ≤ δ / 100) : + (realSourceGroundEnergy d + c ≤ a → + realSourceGroundEnergy (d.withCoefficients rounded) ≤ + normalizedSourceLower aRound cRound (δ / 100)) ∧ + (b ≤ realSourceGroundEnergy d + c → + normalizedSourceUpper bRound cRound (δ / 100) ≤ + realSourceGroundEnergy (d.withCoefficients rounded)) ∧ + 22 * δ / 25 ≤ normalizedSourceUpper bRound cRound (δ / 100) - + normalizedSourceLower aRound cRound (δ / 100) := by + exact ⟨sourceNormalization_yes d rounded hcoeff ha hc, + sourceNormalization_no d rounded hcoeff hb hc, + normalizedSource_gap_fraction hgap ha hb⟩ + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceTargetHubbard.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceTargetHubbard.lean new file mode 100644 index 0000000000000000000000000000000000000000..4789b191cfd5b5dc2d4077dd0223d1f87a547aa7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceTargetHubbard.lean @@ -0,0 +1,151 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceGraphIndex +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceFiniteBounds +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.ManufacturedFrequency + +namespace OAI + +/-! The literal positive source graph satisfies the finite Hubbard +approximation with uniform exponents fixed before its coordinates are chosen. -/ + +noncomputable section +open scoped BigOperators +namespace ContinuumCoulomb +open SourcePositiveProgram SourceMetadataProgram ContactMediator HubbardGlobal + +private theorem source_size_cast (d : BinaryHeisenberg) : + (SourceContactProgram.size d:ℝ)=(binaryHeisenbergCodec.encode d).length+2 := by + unfold SourceContactProgram.size SourceMetadataProgram.size + push_cast + ring + +theorem source_graph_site_count (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) : + ((output s d).vertices:ℝ) ≤ (SourceContactProgram.size d:ℝ)^6 := by + rw [PrefactorSourceContactProgram.electron_count s d hd,source_size_cast] + exact geometricSource_count s d hd + +theorem source_graph_edge_count (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) : + (graphEdgeCount s d hd:ℝ) ≤ (SourceContactProgram.size d:ℝ)^7 := by + have hN : (2:ℝ) ≤ SourceContactProgram.size d := by + exact_mod_cast SourceContactProgram.size_ge_two d + have hnat : graphEdgeCount s d hd ≤ 2*(output s d).vertices := by + rw [PrefactorSourceContactProgram.electron_count s d hd,globalSite_card] + unfold graphEdgeCount + omega + have hr : (graphEdgeCount s d hd:ℝ) ≤ 2*((output s d).vertices:ℝ) := by exact_mod_cast hnat + calc + _ ≤ 2*(SourceContactProgram.size d:ℝ)^6 := + hr.trans (mul_le_mul_of_nonneg_left (source_graph_site_count s d hd) (by norm_num)) + _ ≤ (SourceContactProgram.size d:ℝ)^7 := by + calc + _ ≤ (SourceContactProgram.size d:ℝ)*(SourceContactProgram.size d:ℝ)^6 := + mul_le_mul_of_nonneg_right hN (by positivity) + _ = _ := by rw [pow_succ]; ring + +theorem exists_source_hopping_exponent (freq : ℝ) (A : ℕ) : + ∃ v : ℕ, 1 ≤ v ∧ ∀ (s : ℕ) (d : BinaryHeisenberg) (hd : d.Valid) + (m : ℕ) (hm : (output s d).vertices=m+1) (B : ℕ), + let F := indexedGraph s d hd hm + let N : ℝ := SourceContactProgram.size d + (∀ e, (N^(30*A))⁻¹ ≤ (F.weight e:ℝ) ∧ (F.weight e:ℝ) ≤ N^(30*A)) → + ∀ u : Fin (m+1) → PlanarPosition, + (∑ e, |-coulombHoppingTarget freq (N^(30*B))⁻¹ (F.weight e) + ‖u (F.left e)-u (F.right e)‖|) ≤ N^v := by + obtain ⟨v,hv,hbound⟩ := exists_target_hopping_exponent freq 7 (30*A) + refine ⟨v,hv,fun s d hd m hm B => ?_⟩ + dsimp only + intro hweights u + let N : ℝ := SourceContactProgram.size d + let F := indexedGraph s d hd hm + have hN : (2:ℝ) ≤ N := by + change (2:ℝ) ≤ (SourceContactProgram.size d:ℝ) + exact_mod_cast SourceContactProgram.size_ge_two d + have hN0 : 0 < N := lt_of_lt_of_le (by norm_num) hN + have hN1 : 1 ≤ N := le_trans (by norm_num) hN + have hK (e : Fin (graphEdgeCount s d hd)) : 0 ≤ (F.weight e:ℝ) := + (inv_nonneg.mpr (pow_nonneg hN0.le _)).trans (hweights e).1 + have hcard : (Fintype.card (Fin (graphEdgeCount s d hd)):ℝ) ≤ N^7 := by + simpa only [Fintype.card_fin] using source_graph_edge_count s d hd + have hs := hbound N (N^(30*B))⁻¹ hN + (inv_nonneg.mpr (pow_nonneg hN0.le _)) + (inv_le_one_of_one_le₀ (one_le_pow₀ hN1)) + (Edge := Fin (graphEdgeCount s d hd)) hcard + (fun e => ‖u (F.left e)-u (F.right e)‖) (fun e => (F.weight e:ℝ)) hK + (fun e => (hweights e).2) + apply le_trans _ hs + apply Finset.sum_le_sum + intro e _ + exact (abs_neg _).le + +theorem exists_source_target_parameters (rho : ℕ) (hrho : 0 < rho) (s g : ℕ) : + ∃ A B v q : ℕ, 0 < A ∧ 0 < B ∧ 1 ≤ v ∧ 1 ≤ q ∧ + ∀ (d : BinaryHeisenberg) (hd : d.Valid), d.PolynomialPromise s → + ∀ (m k : ℕ) (hm : (output s d).vertices=m+1), q ≤ k → + ∀ (D : ℝ) (u : Fin (m+1) → PlanarPosition), + 25*(k:ℝ)*Real.log (SourceContactProgram.size d) ≤ D → + (∀ i j, i ≠ j → D ≤ ‖u i-u j‖) → + let F := indexedGraph s d hd hm + let N : ℝ := SourceContactProgram.size d + let τ := (N^(30*B))⁻¹ + let freq := GaussianFrequency.frequency rho + let t := fun e => -coulombHoppingTarget freq τ (F.weight e) ‖u (F.left e)-u (F.right e)‖ + (∀ e, (N^(30*A))⁻¹ ≤ (F.weight e:ℝ) ∧ (F.weight e:ℝ) ≤ N^(30*A)) ∧ + (∑ e, |t e|) ≤ N^v ∧ + |hubbardFermionBottom m (localizedCoulombProfile freq 0) (localizedOffsiteCoulomb freq u) + F.left F.right t- + graphSourceBottom m F.left F.right (fun e => τ^2*(F.weight e:ℝ))| ≤ (N^g)⁻¹*τ^2 := by + have hf := manufactured_frequency_positive hrho + obtain ⟨A,hA,hweights⟩ := PrefactorSourceContactProgram.source_weight_range s + obtain ⟨E,B,_hE,hB,hfinite⟩ := exists_uniform_target_hubbard_parameters hf 7 A g + obtain ⟨v,hv,hvbound⟩ := exists_source_hopping_exponent (GaussianFrequency.frequency rho) A + obtain ⟨q,hq,hqbound⟩ := exists_source_leakage_threshold hf 6 + refine ⟨A,B,v,q,hA,hB,hv,hq,?_⟩ + intro d hd hp m k hm hk D u hD hsep + dsimp only + let F := indexedGraph s d hd hm + let N : ℝ := SourceContactProgram.size d + let M : ℝ := CalibrationMesh.base (SourceContactProgram.size d) + have hN : 2 ≤ N := by + change (2:ℝ) ≤ (SourceContactProgram.size d:ℝ) + exact_mod_cast SourceContactProgram.size_ge_two d + have hM : 2 ≤ M := by + change (2:ℝ) ≤ (CalibrationMesh.base (SourceContactProgram.size d):ℝ) + exact_mod_cast CalibrationMesh.base_ge_two (SourceContactProgram.size_ge_two d) + have hN0 : 0 < N := lt_of_lt_of_le (by norm_num : (0:ℝ) < 2) hN + have hN1 : 1 ≤ N := le_trans (by norm_num : (1:ℝ) ≤ 2) hN + have hNM : N ≤ M := by + dsimp [M,CalibrationMesh.base,N] + rw [Nat.cast_pow] + exact le_self_pow₀ hN1 (by decide) + have hMpow (a : ℕ) : M^a=N^(30*a) := by + dsimp only [M,CalibrationMesh.base,N] + rw [Nat.cast_pow,← pow_mul] + have hFweight : F.weight=SourceContactProgram.weights s d hd := indexedGraph_weight s d hd hm + have hKr (e : Fin (graphEdgeCount s d hd)) : (M^A)⁻¹ ≤ (F.weight e:ℝ) ∧ (F.weight e:ℝ) ≤ M^A := by + rw [hFweight] + exact hweights d hd hp e + have hK (e : Fin (graphEdgeCount s d hd)) : 0 ≤ (F.weight e:ℝ) := + (inv_nonneg.mpr (pow_nonneg (le_trans (by norm_num : (0:ℝ) ≤ 2) hM) A)).trans (hKr e).1 + have hcount : (m+1:ℕ) ≤ N^6 := by + rw [← hm] + exact source_graph_site_count s d hd + obtain ⟨hfive,hleak⟩ := hqbound k hk N D hN hD (m+1) hcount + have heN : (graphEdgeCount s d hd:ℝ) ≤ N^7 := source_graph_edge_count s d hd + have heM : (graphEdgeCount s d hd:ℝ) ≤ M^7 := + heN.trans (pow_le_pow_left₀ hN0.le hNM 7) + have hloop := indexedGraph_noLoops s d hd hm + have hsimple := (indexedGraph_simple s d hd hm).hypothesis + have herr := hfinite M hM _ heM D hfive m u hsep hleak F.left F.right + (fun e => (F.weight e:ℝ)) hK (fun e => (hKr e).2) hloop hsimple + have hKpower (e : Fin (graphEdgeCount s d hd)) : + (N^(30*A))⁻¹ ≤ (F.weight e:ℝ) ∧ (F.weight e:ℝ) ≤ N^(30*A) := by + simpa only [hMpow] using hKr e + refine ⟨hKpower,hvbound s d hd m hm B hKpower u,?_⟩ + rw [hMpow B] at herr + exact herr.trans (mul_le_mul_of_nonneg_right + (inv_anti₀ (pow_pos hN0 g) (pow_le_pow_left₀ hN0.le hNM g)) (sq_nonneg _)) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceThresholdGap.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceThresholdGap.lean new file mode 100644 index 0000000000000000000000000000000000000000..05afddeba4cd85f8f17bf4b05bd4539e22c9caa5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceThresholdGap.lean @@ -0,0 +1,87 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourcePositiveCorrectness +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceGridGeometry +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.ScalarScaleBudgets + +namespace OAI + +/-! The actual rational output gap is at least one at a fixed polynomial +amplification. The same scale also dominates the numerical error budget. -/ + +noncomputable section +namespace ContinuumCoulomb + +theorem exists_source_gap_offset {a : ℝ} (ha : 0 < a) : + ∃ q : ℕ, 1 ≤ q ∧ ∀ s B k : ℕ, q+2*B+s ≤ k → + ∀ N M : ℝ, 2 ≤ N → 0 ≤ M → M ≤ N → + 2*M^s ≤ (a*(N^k)^30)*((N^(30*B))⁻¹)^2 := by + obtain ⟨q,hq,hbounds⟩ := exists_polynomial_constant_bounds (by positivity : 0 < a/2) 1 + refine ⟨q,by omega,fun s B k hk N M hN hM hMN => ?_⟩ + have hN0 : 0 < N := by linarith + have hN1 : 1 ≤ N := by linarith + have hratio := (hbounds N hN).1 + have hconst : 2 ≤ a*N^q := by + have he := (inv_le_iff_one_le_mul₀ (pow_pos hN0 q)).mp hratio + nlinarith + rw [inv_pow] + apply (le_mul_inv_iff₀ (sq_pos_of_pos (pow_pos hN0 (30*B)))).mpr + calc + 2*M^s*(N^(30*B))^2 ≤ (a*N^q)*N^s*(N^(30*B))^2 := by + gcongr + _ = a*N^(q+s+60*B) := by + rw [pow_add N (q+s) (60*B),pow_add N q s, + show 60*B=(30*B)*2 by omega,pow_mul] + ring + _ ≤ a*(N^k)^30 := by + rw [← pow_mul] + exact mul_le_mul_of_nonneg_left (pow_le_pow_right₀ hN1 (by omega)) ha.le + +namespace SourcePhysicalThreshold + +theorem gap_ge_one (rho C : ℕ) (eps c : ℚ) (s p h k A B q : ℕ) + (d : BinaryHeisenberg) (hd : d.Valid) (hp : d.PolynomialPromise s) + (hscale : 2*((SourceMetadataProgram.size d:ℝ)^s) ≤ + (SourceNuclearProgram.amplification rho k d:ℝ)* + (((SourceContactProgram.size d^(30*B):ℕ):ℝ)⁻¹)^2) : + (1:ℚ) ≤ (value rho C eps c s p h k A B q d).2- + (value rho C eps c s p h k A B q d).1 := by + have hsource := SourcePositiveProgram.output_gap s d hd hp + have hgap := SourceMetadataProgram.polynomialPromise_gap s d hp + have hG0 : (0:ℚ) < (SourceMetadataProgram.size d:ℚ)^s := + pow_pos (by exact_mod_cast SourceMetadataProgram.size_pos d) s + have hpos : (0:ℝ) < (SourceMetadataProgram.size d:ℝ)^s := by exact_mod_cast hG0 + have hlow : (63:ℝ)/(64*((SourceMetadataProgram.size d:ℝ)^s)) ≤ + ((SourcePositiveProgram.output s d).upper:ℝ)-(SourcePositiveProgram.output s d).lower := by + have hh : (63:ℚ)/64*(1/(SourceMetadataProgram.size d:ℚ)^s) ≤ + (SourcePositiveProgram.output s d).upper-(SourcePositiveProgram.output s d).lower := by + simpa only [Nat.cast_pow] using + (mul_le_mul_of_nonneg_left hgap (by norm_num : (0:ℚ) ≤ 63/64)).trans hsource + have hhR : (63:ℝ)/64*(1/(SourceMetadataProgram.size d:ℝ)^s) ≤ + ((SourcePositiveProgram.output s d).upper:ℝ)-(SourcePositiveProgram.output s d).lower := by + simpa only [Rat.cast_mul,Rat.cast_div,Rat.cast_one,Rat.cast_ofNat,Rat.cast_pow, + Rat.cast_natCast,Rat.cast_sub] using (Rat.cast_le (K := ℝ)).mpr hh + convert hhR using 1; ring + let scale := (SourceNuclearProgram.amplification rho k d:ℝ)* + (((SourceContactProgram.size d^(30*B):ℕ):ℝ)⁻¹)^2 + have hs : 0 ≤ scale := (by positivity : (0:ℝ) ≤ 2*(SourceMetadataProgram.size d:ℝ)^s).trans hscale + have hprod := mul_le_mul hscale hlow (by positivity : (0:ℝ) ≤ 63/(64*(SourceMetadataProgram.size d:ℝ)^s)) hs + have hone : (1:ℝ) ≤ scale* + (((SourcePositiveProgram.output s d).upper:ℝ)-(SourcePositiveProgram.output s d).lower) := by + have he : 2*(SourceMetadataProgram.size d:ℝ)^s*(63/(64*(SourceMetadataProgram.size d:ℝ)^s)) = 63/32 := by + field_simp [hpos.ne'] + ring + rw [he] at hprod + linarith + rw [gap] + change (1:ℚ) ≤ SourceNuclearProgram.amplification rho k d * + (((SourceContactProgram.size d^(30*B):ℕ):ℚ)⁻¹)^2 * + ((SourcePositiveProgram.output s d).upper-(SourcePositiveProgram.output s d).lower) + dsimp only [scale] at hone + apply (Rat.cast_le (K := ℝ)).mp + simpa only [Rat.cast_one,Rat.cast_mul,Rat.cast_inv,Rat.cast_pow,Rat.cast_natCast,Rat.cast_sub] using hone + +end SourcePhysicalThreshold +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceUnitCoulomb.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceUnitCoulomb.lean new file mode 100644 index 0000000000000000000000000000000000000000..eabc526ea5ce1510a85e404174c1ddc1dd04fb91 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceUnitCoulomb.lean @@ -0,0 +1,99 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.SourceNuclearProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.AffinePhysicalOutput + +namespace OAI + +/-! Literal source-to-unit-Coulomb packaging. The physical nuclei and the +full affine threshold pair use the same calibrated sites, amplification, +mesh and exact rational slab dimensions. -/ + +namespace ContinuumCoulomb.SourceUnitCoulomb +open ExactQuantumFactoring.BitStackProgram + +noncomputable def input (rho C : ℕ) (ε c : ℚ) (s p h k A B q r : ℕ) + (d : BinaryHeisenberg) : AffinePhysicalOutput.Input := + (SourceNuclearProgram.input rho C ε c s p h k A B r d, + SourcePhysicalThreshold.input rho C ε c s p h k A B q d) + +noncomputable def value (rho C U F K : ℕ) (ε c : ℚ) (s p h k A B q r : ℕ) + (d : BinaryHeisenberg) : UnitCoulomb := + AffinePhysicalOutput.value rho U F K (input rho C ε c s p h k A B q r d) + +noncomputable opaque inputProgram (rho C : ℕ) (ε c : ℚ) (s p h k A B q r : ℕ) : + Procedure binaryHeisenbergCodec.encode AffinePhysicalOutput.inputCode + (input rho C ε c s p h k A B q r) := + (SourceNuclearProgram.inputProgram rho C ε c s p h k A B r).pair + (SourcePhysicalThreshold.inputProgram rho C ε c s p h k A B q) + +noncomputable opaque program (rho C U F K : ℕ) (ε c : ℚ) (s p h k A B q r : ℕ) : + Procedure binaryHeisenbergCodec.encode unitCoulombCodec.encode + (value rho C U F K ε c s p h k A B q r) := + (AffinePhysicalOutput.program rho U F K).comp (inputProgram rho C ε c s p h k A B q r) + +noncomputable def certificate (rho C U F K : ℕ) (ε c : ℚ) (s p h k A B q r : ℕ) : + Turing.TM2ComputableInPolyTime binaryHeisenbergCodec.encode unitCoulombCodec.encode + (value rho C U F K ε c s p h k A B q r) := + (program rho C U F K ε c s p h k A B q r).toTM2 + +theorem nuclei (rho C U F K : ℕ) (ε c : ℚ) (s p h k A B q r : ℕ) (d : BinaryHeisenberg) : + (value rho C U F K ε c s p h k A B q r d).nuclei = + SourceNuclearProgram.nuclei rho C U F K ε c s p h k A B r d := rfl + +theorem electrons (rho C U F K : ℕ) (ε c : ℚ) (s p h k A B q r : ℕ) (d : BinaryHeisenberg) : + (value rho C U F K ε c s p h k A B q r d).electrons = + (SourcePositiveProgram.output s d).vertices := rfl + +theorem lower (rho C U F K : ℕ) (ε c : ℚ) (s p h k A B q r : ℕ) (d : BinaryHeisenberg) : + (value rho C U F K ε c s p h k A B q r d).lower.value = + (SourcePhysicalThreshold.value rho C ε c s p h k A B q d).1 := + NuclearCoordinateOutput.rational_value _ + +theorem upper (rho C U F K : ℕ) (ε c : ℚ) (s p h k A B q r : ℕ) (d : BinaryHeisenberg) : + (value rho C U F K ε c s p h k A B q r d).upper.value = + (SourcePhysicalThreshold.value rho C ε c s p h k A B q d).2 := + NuclearCoordinateOutput.rational_value _ + +theorem nuclei_length (rho C U F K : ℕ) (ε c : ℚ) (s p h k A B q r : ℕ) + (d : BinaryHeisenberg) : + (value rho C U F K ε c s p h k A B q r d).nuclei.length = + 8*((2*SourcePhysicalThreshold.horizontalRadius k d+1)^2* + (2*SourcePhysicalThreshold.verticalRadius k d+1)) := + SourceNuclearProgram.nuclei_length rho C U F K ε c s p h k A B r d + +theorem actual_threshold_error (rho C U F K : ℕ) (hrho : 0 < rho) (ε c : ℚ) + (s p h k A B q r : ℕ) (d : BinaryHeisenberg) {m : ℕ} + (u : Fin m → CoulombPairSum.Point) (hu : Function.Injective u) + (hsites : SourceNuclearProgram.sites rho C ε c s p h k A B d = List.ofFn u) : + let v := CoulombPairSum.exactTotal (GaussianFrequency.frequency rho) u + |((value rho C U F K ε c s p h k A B q r d).lower.value:ℝ)- + (AffinePhysicalThreshold.exactValue rho + (SourcePhysicalThreshold.input rho C ε c s p h k A B q d) v).1| ≤ + 1/(((SourceContactProgram.size d^q:ℕ):ℝ)+1) ∧ + |((value rho C U F K ε c s p h k A B q r d).upper.value:ℝ)- + (AffinePhysicalThreshold.exactValue rho + (SourcePhysicalThreshold.input rho C ε c s p h k A B q d) v).2| ≤ + 1/(((SourceContactProgram.size d^q:ℕ):ℝ)+1) := by + dsimp only + rw [lower,upper] + exact SourcePhysicalThreshold.actual_error rho C hrho ε c s p h k A B q d u hu hsites + +theorem valid_of_nodes (rho C U F K : ℕ) (hrho : 0 < rho) (ε c : ℚ) + (s p h k A B q r : ℕ) (d : BinaryHeisenberg) + (hne : 0 < (SourcePositiveProgram.output s d).vertices) + (hnodes : (TransformedGauss.nodes rho U F K + ((SourceNuclearProgram.input rho C ε c s p h k A B r d).1, + CenteredGaussLabels.labels (SourceNuclearProgram.input rho C ε c s p h k A B r d).2)).Nodup) + (hgap : (1:ℚ) ≤ CenteredPhysicalThreshold.amplification rho (SourcePhysicalThreshold.mesh k d)* + (((SourceContactProgram.size d^(30*B):ℕ):ℚ)⁻¹)^2* + ((SourcePositiveProgram.output s d).upper-(SourcePositiveProgram.output s d).lower)) : + (value rho C U F K ε c s p h k A B q r d).Valid := by + apply UnitCoulombProgram.valid_of_nodes rho U F K + (SourceNuclearProgram.input rho C ε c s p h k A B r d, + ((SourcePositiveProgram.output s d).vertices,SourcePhysicalThreshold.value rho C ε c s p h k A B q d)) + hrho (SourcePhysicalThreshold.mesh_positive k d) hne hnodes + rw [SourcePhysicalThreshold.gap] + exact hgap + +end ContinuumCoulomb.SourceUnitCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceZeroFilter.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceZeroFilter.lean new file mode 100644 index 0000000000000000000000000000000000000000..4013b843849b02d0fe1d0ec47d8259ac31e8a25b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/SourceZeroFilter.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.SourceCoefficientRounding + +namespace OAI + +/-! Actual deletion of zero source bonds after common-denominator rounding. -/ + +namespace ContinuumCoulomb.SourceZeroFilter +open ExactQuantumFactoring.BitStackProgram MediatorListProgram + +def keep (e : Bond) : Bool := decide (e.2.2 ≠ 0) + +def step (acc : List Bond) (e : Bond) : List Bond := if keep e then e :: acc else acc + +theorem fold_step (xs acc : List Bond) : + xs.foldl step acc = (xs.filter keep).reverse ++ acc := by + induction xs generalizing acc with + | nil => simp + | cons e xs ih => + rw [List.foldl_cons, ih] + by_cases h : keep e = true + · simp only [step, h, ite_true, List.filter_cons_of_pos h, List.reverse_cons, List.append_assoc, + List.singleton_append] + · have hn : keep e = false := Bool.eq_false_iff.mpr h + simp only [step, hn, Bool.false_eq_true, ite_false, List.filter_cons_of_neg h] + +theorem filter_code_le (xs : List Bond) : + (listCode bondCode (xs.filter keep)).length ≤ (listCode bondCode xs).length := by + induction xs with + | nil => simp + | cons e xs ih => + by_cases h : keep e = true + · rw [List.filter_cons_of_pos h] + simp only [listCode_length_cons] + omega + · rw [List.filter_cons_of_neg h] + simp only [listCode_length_cons] + omega + +noncomputable def isZero : Procedure bondCode Procedure.boolCode (fun e => decide (e.2.2 = 0)) := + (Procedure.binaryZero.comp (Procedure.intAbs.comp (Procedure.ratNum.comp + ((Procedure.second _ _).comp (Procedure.second _ _))))).congrFun (by + intro e + simp only [Function.comp_apply, Int.natAbs_eq_zero, Rat.num_eq_zero]) + +noncomputable def stepProgram : Procedure (prodCode bondCode (listCode bondCode)) (listCode bondCode) + (fun x => step x.2 x.1) := by + let test := isZero.comp (Procedure.first bondCode (listCode bondCode)) + let acc := Procedure.second bondCode (listCode bondCode) + exact (Procedure.conditional test acc (Procedure.listCons bondCode)).congrFun (by + intro x + unfold step keep + by_cases h : x.1.2.2 = 0 <;> simp [h]) + +noncomputable def foldProgram : Procedure (prodCode (listCode bondCode) (listCode bondCode)) + (listCode bondCode) (fun x => x.1.foldl step x.2) := + Procedure.foldList zeroBond stepProgram Polynomial.X (by + intro xs acc i + rw [fold_step] + have h := listCode_length_append bondCode ((xs.take i).filter keep).reverse acc + rw [listCode_length_rev] at h + have ht := (filter_code_le (xs.take i)).trans (listCode_length_take_le bondCode i xs) + simp only [Polynomial.eval_X] + omega) + +noncomputable def filterProgram : Procedure (listCode bondCode) (listCode bondCode) + (fun xs => xs.filter keep) := + ((Procedure.listReverse bondCode zeroBond).comp (foldProgram.comp + ((Procedure.identity (listCode bondCode)).pair + (Procedure.constant (listCode bondCode) (listCode bondCode) [])))).congrFun + (by intro xs; simp only [Function.comp_apply, id_eq, fold_step, List.append_nil, List.reverse_reverse]) + +theorem nonzero_mem (xs : List Bond) (e : Bond) (he : e ∈ xs.filter keep) : e.2.2 ≠ 0 := by + exact of_decide_eq_true (List.mem_filter.mp he).2 + +end ContinuumCoulomb.SourceZeroFilter + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/TargetHubbardParameters.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/TargetHubbardParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..22d1e07136f8fe77cb7b977e063e44f7e41a1310 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/TargetHubbardParameters.lean @@ -0,0 +1,120 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.UniformHubbardParameters + +namespace OAI + +/-! The finite Hubbard approximation uses exact Coulomb target amplitudes; +the negative sign agrees with the manufactured well matrix. Its spatial +implementation can then be approximated entrywise. -/ + +noncomputable section +open scoped BigOperators +namespace ContinuumCoulomb + +theorem target_hopping_sum_bound {Edge : Type*} [Fintype Edge] + (freq τ B : ℝ) (hτ : 0 ≤ τ) (distance K : Edge → ℝ) + (hK : ∀ e, 0 ≤ K e) (hB : ∀ e, K e ≤ B) : + 4 * ∑ e, |coulombHoppingTarget freq τ (K e) (distance e)| ≤ + 4 * (Fintype.card Edge : ℝ) * (τ * Real.sqrt (B * localizedCoulombProfile freq 0)) := by + have hpoint (e : Edge) : |coulombHoppingTarget freq τ (K e) (distance e)| ≤ + τ * Real.sqrt (B * localizedCoulombProfile freq 0) := by + rw [coulombHoppingTarget, abs_of_nonneg (mul_nonneg hτ (Real.sqrt_nonneg _))] + apply mul_le_mul_of_nonneg_left (Real.sqrt_le_sqrt ?_) hτ + calc + _ ≤ K e * localizedCoulombProfile freq 0 := mul_le_mul_of_nonneg_left + (sub_le_self _ (localizedCoulombProfile_nonnegative freq (distance e))) (hK e) + _ ≤ _ := mul_le_mul_of_nonneg_right (hB e) (localizedCoulombProfile_nonnegative freq 0) + have h := mul_le_mul_of_nonneg_left + (Finset.sum_le_sum (s := Finset.univ) (fun e _ => hpoint e)) (by norm_num : (0 : ℝ) ≤ 4) + simpa only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, mul_assoc] using h + +theorem polynomial_target_hopping_smallness {Edge : Type*} [Fintype Edge] + {freq N : ℝ} (hN : 2 ≤ N) (R A L E : ℕ) + (hc : (N ^ L)⁻¹ ≤ localizedGramConstant freq) + (hU : Real.sqrt (localizedCoulombProfile freq 0) ≤ N ^ L) + (hr : (Fintype.card Edge : ℝ) ≤ N ^ R) (distance K : Edge → ℝ) + (hK : ∀ e, 0 ≤ K e) (hKhi : ∀ e, K e ≤ N ^ A) : + 4 * ∑ e, |coulombHoppingTarget freq (N ^ (E + (R + A + 2 * L + 2)))⁻¹ (K e) (distance e)| ≤ (N ^ E)⁻¹ * localizedGramConstant freq := by + have hNp : 0 < N := by linarith + have hN₁ : 1 ≤ N := by linarith + let B := E + (R + A + 2 * L + 2) + have hτ : 0 ≤ (N ^ B)⁻¹ := inv_nonneg.mpr (pow_nonneg hNp.le B) + have hsqrt : Real.sqrt (N ^ A * localizedCoulombProfile freq 0) ≤ N ^ (A + L) := by + rw [Real.sqrt_mul (pow_nonneg hNp.le A), pow_add] + apply mul_le_mul ?_ hU (Real.sqrt_nonneg _) (pow_nonneg hNp.le A) + apply Real.sqrt_le_iff.mpr + have hp : 1 ≤ N ^ A := one_le_pow₀ hN₁ + exact ⟨by positivity, by nlinarith only [hp]⟩ + have hb := target_hopping_sum_bound freq (N ^ B)⁻¹ (N ^ A) hτ distance K hK hKhi + have hbound : 4 * (Fintype.card Edge : ℝ) * ((N ^ B)⁻¹ * + Real.sqrt (N ^ A * localizedCoulombProfile freq 0)) ≤ 4 * (N ^ (E + L + 2))⁻¹ := by + calc + _ ≤ 4 * N ^ R * ((N ^ B)⁻¹ * N ^ (A + L)) := + mul_le_mul (mul_le_mul_of_nonneg_left hr (by norm_num)) + (mul_le_mul_of_nonneg_left hsqrt hτ) + (mul_nonneg hτ (Real.sqrt_nonneg _)) (by positivity) + _ = 4 * (N ^ (R + (A + L)) * (N ^ B)⁻¹) := by rw [pow_add]; ring + _ = _ := by + rw [show B = (R + (A + L)) + (E + L + 2) by dsimp [B]; omega, + pow_mul_inverse_add hNp] + have hfour : 4 * (N ^ (E + L + 2))⁻¹ ≤ (N ^ (E + L))⁻¹ := by + have hsq : (4 : ℝ) ≤ N ^ 2 := by nlinarith + have h := mul_le_mul_of_nonneg_left hsq (pow_nonneg hNp.le (E + L)) + have hratio : 4 / N ^ (E + L + 2) ≤ 1 / N ^ (E + L) := + (div_le_div_iff₀ (pow_pos hNp (E + L + 2)) (pow_pos hNp (E + L))).mpr + (by simpa only [pow_add, one_mul, mul_one, mul_comm] using h) + simpa only [div_eq_mul_inv, one_mul] using hratio + have hlast : (N ^ (E + L))⁻¹ ≤ (N ^ E)⁻¹ * localizedGramConstant freq := by + have h := mul_le_mul_of_nonneg_left hc (inv_nonneg.mpr (pow_nonneg hNp.le E)) + simpa only [pow_add, mul_inv_rev, mul_comm] using h + exact hb.trans (hbound.trans (hfour.trans hlast)) + +theorem exists_uniform_target_hubbard_parameters {freq : ℝ} (hfreq : 0 < freq) (R A g : ℕ) : + ∃ E B : ℕ, 2 ≤ E ∧ 0 < B ∧ ∀ N : ℝ, 2 ≤ N → ∀ (r : ℕ), (r:ℝ) ≤ N^R → + ∀ D : ℝ, 5 ≤ D → ∀ (m : ℕ) (u : Fin (m+1) → PlanarPosition), + (∀ i j, i ≠ j → D ≤ ‖u i-u j‖) → + (m+1:ℕ)*localLeakageBound freq D ≤ localDualMass freq/2 → + ∀ (left right : Fin r → Fin (m+1)) (K : Fin r → ℝ), + (∀ e, 0 ≤ K e) → (∀ e, K e ≤ N^A) → + (∀ e, left e ≠ right e) → + (∀ e f, e ≠ f → ¬(left e=left f ∧ right e=right f) ∧ ¬(left e=right f ∧ right e=left f)) → + |HubbardGlobal.hubbardFermionBottom m (localizedCoulombProfile freq 0) (localizedOffsiteCoulomb freq u) + left right (fun e => -coulombHoppingTarget freq (N^B)⁻¹ (K e) ‖u (left e)-u (right e)‖)- + HubbardGlobal.graphSourceBottom m left right (fun e => ((N^B)⁻¹)^2*K e)| ≤ + (N^g)⁻¹*((N^B)⁻¹)^2 := by + obtain ⟨L,_,hconstants⟩ := exists_polynomial_constant_bounds (localizedGramConstant_positive hfreq) + (max (2*localizedGramConstant freq) (Real.sqrt (localizedCoulombProfile freq 0))) + let C := R+A+2*L+2 + let E := g+2*C+L + let B := E+C + have hE : 2 ≤ E := by dsimp [E,C]; omega + refine ⟨E,B,hE,by dsimp [B,E,C]; omega,?_⟩ + intro N hN r hr D hD m u hsep hleak left right K hK hKhi hloop hsimple + have hNp : 0 < N := by linarith + obtain ⟨hc,hupper⟩ := hconstants N hN + have hc₂ : 2*localizedGramConstant freq ≤ N^L := (le_max_left _ _).trans hupper + have hU : Real.sqrt (localizedCoulombProfile freq 0) ≤ N^L := (le_max_right _ _).trans hupper + have ht := polynomial_target_hopping_smallness hN R A L E hc hU (by simpa using hr) + (fun e => ‖u (left e)-u (right e)‖) K hK hKhi + have hcal (e : Fin r) : + (-coulombHoppingTarget freq (N^B)⁻¹ (K e) ‖u (left e)-u (right e)‖)^2 = + (((N^B)⁻¹)^2*K e)*(localizedCoulombProfile freq 0-localizedCoulombCoeff freq (u (left e)) (u (right e))) := by + have hg := chargeTransfer_Gram_denominator (localizedCoulombProfile freq 0) + (localizedGramConstant freq) (localizedOffsiteCoulomb freq u) + (localizedCoulomb_charge_condition hfreq hD u hsep hleak) (left e) (right e) (hloop e) + (localizedOffsiteCoulomb_symmetric hfreq u) (localizedOffsiteCoulomb_diagonal freq u) + simp only [localizedOffsiteCoulomb,ite_eq_right (hloop e)] at hg + have hn := (localizedGramConstant_positive hfreq).le.trans hg + rw [localizedCoulombCoeff_distance] at hn ⊢ + rw [neg_sq,coulombHoppingTarget,mul_pow,Real.sq_sqrt (mul_nonneg (hK e) hn)] + ring + have he := HubbardGlobal.localized_hubbard_Heisenberg hfreq hD m u hsep hleak left right + (fun e => -coulombHoppingTarget freq (N^B)⁻¹ (K e) ‖u (left e)-u (right e)‖) + (fun e => ((N^B)⁻¹)^2*K e) hloop hsimple hcal (by positivity : 0 ≤ (N^E)⁻¹) + (inverse_power_lt_half hN hE) (by simpa only [abs_neg] using ht) + exact he.trans (polynomial_hubbard_error_budget hNp R A L g hc₂) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/ThreeInputsHardness.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/ThreeInputsHardness.lean new file mode 100644 index 0000000000000000000000000000000000000000..360f32fe8ac670b3898813ff10d266abc5663558 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/ThreeInputsHardness.lean @@ -0,0 +1,32 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.RemainingInputsHardness +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.VerticalOscillatorGap + +namespace OAI + +/-! +Continuum Coulomb hardness under the planar spectral, flow and +finite-spin hardness hypotheses. +-/ + +noncomputable section +namespace ContinuumCoulomb + +theorem unit_coulomb_qmaHard_of_three_inputs + (hcmp : PublishedCMPHardness) + (hp : PlanarSobolev.PublishedNegativePlanarGroundGap) + (hflow : PublishedC4FlowInput) : + QMAHard unitCoulombCodec.encode unitCoulombPromise := + unit_coulomb_qmaHard_of_remaining_inputs hcmp hp publishedVerticalOscillatorGap hflow + +theorem binary_coulomb_qmaHard_of_three_inputs + (hcmp : PublishedCMPHardness) + (hp : PlanarSobolev.PublishedNegativePlanarGroundGap) + (hflow : PublishedC4FlowInput) : + QMAHard binaryCoulombCodec.encode binaryCoulombPromise := + binary_coulomb_qmaHard_of_remaining_inputs hcmp hp publishedVerticalOscillatorGap hflow + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/Thresholds.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/Thresholds.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd89bc46c11f00074e866f30c555cb75a2d6427b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/Thresholds.lean @@ -0,0 +1,94 @@ +import Mathlib.Basic.Real.Basic +import Mathlib.Tactic + +namespace OAI + +/-! +# Promise transfer for continuum Coulomb energy + +The numerical energy comparisons give rational threshold maps preserving +both source promises and an output threshold gap of at least one. +-/ + +namespace ContinuumCoulomb + +/-- The rational affine thresholds in 271-01, §6, equations +`rounded-affine-error` and `output-gap`, preserve the source promises. -/ +theorem binary_threshold_transfer + {sourceEnergy physicalEnergy sourceYes sourceNo slope offset : ℝ} + (hslope : 0 < slope) (hgap : sourceYes < sourceNo) + (herror : |physicalEnergy - (slope * sourceEnergy + offset)| ≤ + (5 / 64 : ℝ) * slope * (sourceNo - sourceYes)) : + (sourceEnergy ≤ sourceYes → + physicalEnergy < slope * (sourceYes + (sourceNo - sourceYes) / 4) + offset) ∧ + (sourceNo ≤ sourceEnergy → + slope * (sourceNo - (sourceNo - sourceYes) / 4) + offset < physicalEnergy) := by + obtain ⟨hlower, hupper⟩ := abs_le.mp herror + have hscale : 0 < slope * (sourceNo - sourceYes) := + mul_pos hslope (sub_pos.mpr hgap) + constructor + · intro hyes + have hmono := mul_le_mul_of_nonneg_left hyes hslope.le + nlinarith + · intro hno + have hmono := mul_le_mul_of_nonneg_left hno hslope.le + nlinarith + +/-- The binary-charge output loses exactly half of the scaled source gap. -/ +theorem binary_output_gap (sourceYes sourceNo slope offset : ℝ) : + (slope * (sourceNo - (sourceNo - sourceYes) / 4) + offset) - + (slope * (sourceYes + (sourceNo - sourceYes) / 4) + offset) = + slope * (sourceNo - sourceYes) / 2 := by + ring + +/-- The unit-charge manuscript, §7, equation (10): the energy error and +rounding errors have distinct budgets. The thresholds may be any rational +approximations satisfying the stated real error bounds. -/ +theorem unit_threshold_transfer + {sourceEnergy physicalEnergy sourceYes sourceNo slope offset gamma + outputYes outputNo : ℝ} + (hslope : 0 < slope) (hgamma : 0 < gamma) + (hgap : gamma ≤ sourceNo - sourceYes) + (herror : |physicalEnergy - (slope * sourceEnergy + offset)| ≤ + slope * gamma / 8) + (hroundYes : |outputYes - (slope * (sourceYes + gamma / 4) + offset)| ≤ + slope * gamma / 32) + (hroundNo : |outputNo - (slope * (sourceNo - gamma / 4) + offset)| ≤ + slope * gamma / 32) : + (sourceEnergy ≤ sourceYes → physicalEnergy < outputYes) ∧ + (sourceNo ≤ sourceEnergy → outputNo < physicalEnergy) ∧ + (7 / 16 : ℝ) * slope * gamma ≤ outputNo - outputYes := by + obtain ⟨hel, heu⟩ := abs_le.mp herror + obtain ⟨hal, hau⟩ := abs_le.mp hroundYes + obtain ⟨hbl, hbu⟩ := abs_le.mp hroundNo + have hscale : 0 < slope * gamma := mul_pos hslope hgamma + have hscaledGap := mul_le_mul_of_nonneg_left hgap hslope.le + refine ⟨?_, ?_, ?_⟩ + · intro hyes + have hmono := mul_le_mul_of_nonneg_left hyes hslope.le + nlinarith + · intro hno + have hmono := mul_le_mul_of_nonneg_left hno hslope.le + nlinarith + · nlinarith + +/-- The unit-charge construction requests scaled gap at least eight. -/ +theorem unit_output_gap_at_least_one {slope gamma outputYes outputNo : ℝ} + (hscale : 8 ≤ slope * gamma) + (hgap : (7 / 16 : ℝ) * slope * gamma ≤ outputNo - outputYes) : + 1 ≤ outputNo - outputYes := by + nlinarith + +/-- An output threshold gap at least one meets precision exponent `c = 1` +for every positive total input length; there is no circular size estimate. -/ +theorem inverse_length_precision {outputYes outputNo : ℝ} {length : ℕ} + (hlength : 1 ≤ length) (hgap : 1 ≤ outputNo - outputYes) : + (length : ℝ)⁻¹ ≤ outputNo - outputYes := by + have hlength' : (1 : ℝ) ≤ length := by exact_mod_cast hlength + have hinv : (length : ℝ)⁻¹ ≤ 1 := + (inv_le_one₀ (lt_of_lt_of_le zero_lt_one hlength')).2 hlength' + exact hinv.trans hgap + +end ContinuumCoulomb + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/TwoInputsHardness.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/TwoInputsHardness.lean new file mode 100644 index 0000000000000000000000000000000000000000..9461ddd6b500097242181db6805493f0dd5d723e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/TwoInputsHardness.lean @@ -0,0 +1,32 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.ThreeInputsHardness +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.PlanarGroundUniqueness + +namespace OAI + +/-! +Continuum Coulomb hardness under the flow and finite-spin hardness +hypotheses. +-/ + +noncomputable section +namespace ContinuumCoulomb + +theorem unit_coulomb_qmaHard_of_two_inputs + (hcmp : PublishedCMPHardness) (hflow : PublishedC4FlowInput) : + QMAHard unitCoulombCodec.encode unitCoulombPromise := by + obtain ⟨s,_hs,hsource⟩ := hcmp + obtain ⟨reduction⟩ := exists_source_unit_reduction_with_planar_gap hflow + PlanarSobolev.manufacturedPlanarWell_gap_proved publishedVerticalOscillatorGap + publishedSobolevSmoothDensity s + exact hsource.of_reduction reduction + +theorem binary_coulomb_qmaHard_of_two_inputs + (hcmp : PublishedCMPHardness) (hflow : PublishedC4FlowInput) : + QMAHard binaryCoulombCodec.encode binaryCoulombPromise := + UnitBinaryProgram.binary_hard_of_unit (unit_coulomb_qmaHard_of_two_inputs hcmp hflow) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/UniformAbsoluteNuclearForm.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/UniformAbsoluteNuclearForm.lean new file mode 100644 index 0000000000000000000000000000000000000000..00ba844c1348f21654f3aa1c23be32a5f304d868 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/UniformAbsoluteNuclearForm.lean @@ -0,0 +1,95 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.AbsoluteNuclearForm +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.ManufacturedTransport + +namespace OAI + +/-! One fixed integer background density and one fixed constant suffice +for the absolute nuclear replacement form estimate over the whole family. -/ + +noncomputable section +open MeasureTheory +open scoped BigOperators NNReal +namespace ContinuumCoulomb + +theorem manufactured_uniform_nuclear_absolute_form (hpublished : PublishedC4FlowInput) : + ∃ rho : ℕ, 0 < rho ∧ ∃ L K : ℝ≥0, 0 < L ∧ 0 < K ∧ ∃ B : ℝ, 1 ≤ B ∧ + ∀ (freq scale S : ℝ), 0 < scale → 1 ≤ S → + ∀ (m : ℕ) (u : Fin m → PlanarPosition), + (∀ i j, i ≠ j → 3 ≤ ‖u i-u j‖) → + (∀ i, localizedCounterterm freq u i ≤ scale) → + ∃ G : Position → ℝ → Position, + IsUnitTimeFlow (moserVelocity rho (manufacturedWellField freq scale S u)) G ∧ + Function.Bijective (fun x => G x 1) ∧ + LipschitzWith L (fun x => G x 1) ∧ AntilipschitzWith K (fun x => G x 1) ∧ + (∀ x, x ∉ tsupport (manufacturedWellField freq scale S u) → G x 1 = x) ∧ + (∀ x, |manufacturedCharge (manufacturedWellField freq scale S u) x| ≤ (rho:ℝ)/2) ∧ + ContDiff ℝ 4 (fun x => G x 1) ∧ + (∀ k : ℕ, 1 ≤ k → k ≤ 4 → ∀ x, ‖iteratedFDeriv ℝ k (fun y => G y 1) x‖ ≤ L) ∧ + ∀ (H : ℝ), 0 ≤ H → tsupport (manufacturedWellField freq scale S u) ⊆ slabDomain H S → + ∀ {ι : Type} [Fintype ι] (index : ι → Fin 3 → ℤ), Function.Injective index → + ∀ (h : ℝ), 0 < h → h ≤ 1 → (m:ℝ)*S*h^2 ≤ 1 → + (⋃ i, positionCube (gaussCellCenter h (index i)) h) = slabDomain H S → + ∀ (n : ℕ) (w : Coulomb.H1Vector n) (s : SpinConfiguration n) (i : Fin n), + Integrable (fun x => |gridNuclearPotential index (fun x => G x 1) rho h (Coulomb.position x i)- + (slabPotential rho H S (Coulomb.position x i)+ + manufacturedWellField freq scale S u (Coulomb.position x i))| * ‖w.value s x‖^2) ∧ + (∫ x, |gridNuclearPotential index (fun x => G x 1) rho h (Coulomb.position x i)- + (slabPotential rho H S (Coulomb.position x i)+ + manufacturedWellField freq scale S u (Coulomb.position x i))| *‖w.value s x‖^2) ≤ + B*h^2*((∫ x, ‖w.value s x‖^2)+∑ k : Fin 3, ∫ x, ‖w.gradient s (i,k) x‖^2) := by + obtain ⟨rho,hrho,L,K,hL,hK,hfamily⟩ := manufactured_transport_family_with_charge hpublished + obtain ⟨C,A,hC,hA,hform⟩ := manufactured_grid_absolute_form_error hpublished L K hL hK + let D : ℝ := max 1 (L:ℝ) + let E : ℝ := (rho:ℝ)*(24*C*D^4*(3072*Real.pi/(L:ℝ)^2+216)+108*Real.pi*(L:ℝ)^2) + let B : ℝ := max 1 (E+(rho:ℝ)*A) + have hD : 1 ≤ D := le_max_left _ _ + have hC0 : 0 ≤ C := zero_le_one.trans hC + have hA0 : 0 ≤ A := zero_le_one.trans hA + have hE : 0 ≤ E := by dsimp [E]; positivity + have hrhoR : (0:ℝ) < rho := by exact_mod_cast hrho + refine ⟨rho,hrho,L,K,hL,hK,B,le_max_left _ _,?_⟩ + intro freq scale S hscale hS m u hsep hcounter + obtain ⟨hcharge,G,hflow,hbij,hLip,hAnti,hfix,hreg,hjets⟩ := + hfamily freq scale S hscale hS m u hsep hcounter + refine ⟨G,hflow,hbij,hLip,hAnti,hfix,hcharge,hreg,hjets,?_⟩ + intro H hH hsupp ι _ index hindex h hh hh1 hmesh hcover n w s i + have hGD (x : Position) (k : ℕ) (hk : 1 ≤ k) (hk4 : k ≤ 4) : + ‖iteratedFDeriv ℝ k (fun x => G x 1) x‖ ≤ D^k := by + apply (hjets k hk hk4 x).trans + exact (le_max_right 1 (L:ℝ)).trans (by simpa only [pow_one] using pow_le_pow_right₀ hD hk) + have he := hform rho H S freq scale m u hrhoR hH hS hcharge hsupp G hflow hbij hfix D hD hGD + hLip hAnti index hindex h hh hh1 hcover n w s i + have hmass : 0 ≤ ∫ x, ‖w.value s x‖^2 := integral_nonneg (fun _ => sq_nonneg _) + have hgrad : 0 ≤ ∑ k : Fin 3, ∫ x, ‖w.gradient s (i,k) x‖^2 := + Finset.sum_nonneg (fun _ _ => integral_nonneg (fun _ => sq_nonneg _)) + have hsize : (m:ℝ)*S*h^4 ≤ h^2 := by + calc + _ = h^2*((m:ℝ)*S*h^2) := by ring + _ ≤ h^2*1 := mul_le_mul_of_nonneg_left hmesh (sq_nonneg h) + _ = _ := mul_one _ + have hb : (rho:ℝ)*(24*C*D^4*(3072*Real.pi*h^2/(L:ℝ)^2+216*m*S*h^4)+ + 108*Real.pi*(L:ℝ)^2*h^2) ≤ E*h^2 := by + have hs := mul_le_mul_of_nonneg_left hsize (by norm_num : (0:ℝ) ≤ 216) + have ht := mul_le_mul_of_nonneg_left + (add_le_add_left hs (3072*Real.pi*h^2/(L:ℝ)^2)) (by positivity : 0 ≤ 24*C*D^4) + have ht' := mul_le_mul_of_nonneg_left + (add_le_add_right ht (108*Real.pi*(L:ℝ)^2*h^2)) hrhoR.le + dsimp only [E] + convert ht' using 1 <;> ring + refine ⟨he.1, he.2.trans ?_⟩ + calc + _ ≤ E*h^2*(∫ x, ‖w.value s x‖^2)+(rho:ℝ)*A*h^2* + ((∫ x, ‖w.value s x‖^2)+∑ k : Fin 3, ∫ x, ‖w.gradient s (i,k) x‖^2) := + add_le_add (mul_le_mul_of_nonneg_right hb hmass) le_rfl + _ ≤ (E+(rho:ℝ)*A)*h^2* + ((∫ x, ‖w.value s x‖^2)+∑ k : Fin 3, ∫ x, ‖w.gradient s (i,k) x‖^2) := by + nlinarith [mul_nonneg (mul_nonneg hE (sq_nonneg h)) hgrad] + _ ≤ _ := mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_right (show E+(rho:ℝ)*A ≤ B from le_max_right _ _) (sq_nonneg h)) + (add_nonneg hmass hgrad) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/UniformHubbardParameters.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/UniformHubbardParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..587f99b0cf2cf0479b0d354d9ac49a8ba2e61062 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/UniformHubbardParameters.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.PolynomialHoppingSmallness + +namespace OAI + +/-! Fixed inverse-polynomial exponents close the full Hubbard-to-spin +perturbation budget for every polynomial edge count and coefficient bound. -/ + +noncomputable section +open scoped BigOperators +namespace ContinuumCoulomb + +theorem exists_uniform_hubbard_parameters {freq : ℝ} (hfreq : 0 < freq) (R A g : ℕ) : + ∃ E B : ℕ, 2 ≤ E ∧ 0 < B ∧ ∀ N : ℝ, 2 ≤ N → ∀ (r : ℕ), (r : ℝ) ≤ N ^ R → + ∀ (scale D : ℝ), 5 ≤ D → ∀ (m : ℕ) (u : Fin (m + 1) → PlanarPosition), + (∀ i j, i ≠ j → D ≤ ‖u i - u j‖) → + (m + 1 : ℕ) * localLeakageBound freq D ≤ localDualMass freq / 2 → + ∀ (left right : Fin r → Fin (m + 1)) (K : Fin r → ℝ), + (∀ e, 0 ≤ K e) → (∀ e, K e ≤ N ^ A) → + (∀ e, left e ≠ right e) → + (∀ e f, e ≠ f → + ¬(left e = left f ∧ right e = right f) ∧ ¬(left e = right f ∧ right e = left f)) → + (∀ e, scale * planarHopping ‖u (left e) - u (right e)‖ = + coulombHoppingTarget freq (N ^ B)⁻¹ (K e) ‖u (left e) - u (right e)‖) → + |HubbardGlobal.hubbardFermionBottom m (localizedCoulombProfile freq 0) (localizedOffsiteCoulomb freq u) + left right (fun e => scale * planarHopping ‖u (left e) - u (right e)‖) - + HubbardGlobal.graphSourceBottom m left right (fun e => ((N ^ B)⁻¹) ^ 2 * K e)| ≤ + (N ^ g)⁻¹ * ((N ^ B)⁻¹) ^ 2 := by + obtain ⟨L, _, hconstants⟩ := exists_polynomial_constant_bounds + (localizedGramConstant_positive hfreq) + (max (2 * localizedGramConstant freq) (Real.sqrt (localizedCoulombProfile freq 0))) + let C := R + A + 2 * L + 2 + let E := g + 2 * C + L + let B := E + C + have hE : 2 ≤ E := by dsimp [E, C]; omega + refine ⟨E, B, hE, by dsimp [B, E, C]; omega, ?_⟩ + intro N hN r hr scale D hD m u hsep hleak left right K hK hKhi hloop hsimple hcal + have hNp : 0 < N := by linarith + obtain ⟨hc, hupper⟩ := hconstants N hN + have hc₂ : 2 * localizedGramConstant freq ≤ N ^ L := (le_max_left _ _).trans hupper + have hU : Real.sqrt (localizedCoulombProfile freq 0) ≤ N ^ L := (le_max_right _ _).trans hupper + have ht := polynomial_hopping_smallness hN R A L E hc hU (by simpa using hr) + (fun e => ‖u (left e) - u (right e)‖) K hK hKhi hcal + have hcomparison := HubbardGlobal.localized_calibrated_hubbard hfreq hD m u hsep hleak + left right K hK hloop hsimple hcal (by positivity : 0 ≤ (N ^ E)⁻¹) + (inverse_power_lt_half hN hE) ht + exact hcomparison.trans (polynomial_hubbard_error_budget hNp R A L g hc₂) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/UniformNuclearForm.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/UniformNuclearForm.lean new file mode 100644 index 0000000000000000000000000000000000000000..e80f45cc2c6c83f52db5d732189fe03dda56085c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/UniformNuclearForm.lean @@ -0,0 +1,89 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.ManufacturedNuclearForm +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.ManufacturedTransport + +namespace OAI + +/-! One fixed integer background density and one fixed constant suffice +for the general nuclear replacement form estimate over the whole family. -/ + +noncomputable section +open MeasureTheory +open scoped BigOperators NNReal +namespace ContinuumCoulomb + +theorem manufactured_uniform_nuclear_form (hpublished : PublishedC4FlowInput) : + ∃ rho : ℕ, 0 < rho ∧ ∃ L K : ℝ≥0, 0 < L ∧ 0 < K ∧ ∃ B : ℝ, 1 ≤ B ∧ + ∀ (freq scale S : ℝ), 0 < scale → 1 ≤ S → + ∀ (m : ℕ) (u : Fin m → PlanarPosition), + (∀ i j, i ≠ j → 3 ≤ ‖u i-u j‖) → + (∀ i, localizedCounterterm freq u i ≤ scale) → + ∃ G : Position → ℝ → Position, + IsUnitTimeFlow (moserVelocity rho (manufacturedWellField freq scale S u)) G ∧ + Function.Bijective (fun x => G x 1) ∧ + LipschitzWith L (fun x => G x 1) ∧ AntilipschitzWith K (fun x => G x 1) ∧ + (∀ x, x ∉ tsupport (manufacturedWellField freq scale S u) → G x 1 = x) ∧ + ∀ (H : ℝ), 0 ≤ H → tsupport (manufacturedWellField freq scale S u) ⊆ slabDomain H S → + ∀ {ι : Type} [Fintype ι] (index : ι → Fin 3 → ℤ), Function.Injective index → + ∀ (h : ℝ), 0 < h → h ≤ 1 → (m:ℝ)*S*h^2 ≤ 1 → + (⋃ i, positionCube (gaussCellCenter h (index i)) h) = slabDomain H S → + ∀ (n : ℕ) (w : Coulomb.H1Vector n) (s : SpinConfiguration n) (i : Fin n), + |∫ x, (gridNuclearPotential index (fun x => G x 1) rho h (Coulomb.position x i)- + (slabPotential rho H S (Coulomb.position x i)+ + manufacturedWellField freq scale S u (Coulomb.position x i)))*‖w.value s x‖^2| ≤ + B*h^2*((∫ x, ‖w.value s x‖^2)+∑ k : Fin 3, ∫ x, ‖w.gradient s (i,k) x‖^2) := by + obtain ⟨rho,hrho,L,K,hL,hK,hfamily⟩ := manufactured_transport_family_with_charge hpublished + obtain ⟨C,A,hC,hA,hform⟩ := manufactured_grid_form_error hpublished L K hL hK + let D : ℝ := max 1 (L:ℝ) + let E : ℝ := (rho:ℝ)*(24*C*D^4*(3072*Real.pi/(L:ℝ)^2+216)+108*Real.pi*(L:ℝ)^2) + let B : ℝ := max 1 (E+(rho:ℝ)*A) + have hD : 1 ≤ D := le_max_left _ _ + have hC0 : 0 ≤ C := zero_le_one.trans hC + have hA0 : 0 ≤ A := zero_le_one.trans hA + have hE : 0 ≤ E := by dsimp [E]; positivity + have hrhoR : (0:ℝ) < rho := by exact_mod_cast hrho + refine ⟨rho,hrho,L,K,hL,hK,B,le_max_left _ _,?_⟩ + intro freq scale S hscale hS m u hsep hcounter + obtain ⟨hcharge,G,hflow,hbij,hLip,hAnti,hfix,_hreg,hjets⟩ := + hfamily freq scale S hscale hS m u hsep hcounter + refine ⟨G,hflow,hbij,hLip,hAnti,hfix,?_⟩ + intro H hH hsupp ι _ index hindex h hh hh1 hmesh hcover n w s i + have hGD (x : Position) (k : ℕ) (hk : 1 ≤ k) (hk4 : k ≤ 4) : + ‖iteratedFDeriv ℝ k (fun x => G x 1) x‖ ≤ D^k := by + apply (hjets k hk hk4 x).trans + exact (le_max_right 1 (L:ℝ)).trans (by simpa only [pow_one] using pow_le_pow_right₀ hD hk) + have he := hform rho H S freq scale m u hrhoR hH hS hcharge hsupp G hflow hbij hfix D hD hGD + hLip hAnti index hindex h hh hh1 hcover n w s i + have hmass : 0 ≤ ∫ x, ‖w.value s x‖^2 := integral_nonneg (fun _ => sq_nonneg _) + have hgrad : 0 ≤ ∑ k : Fin 3, ∫ x, ‖w.gradient s (i,k) x‖^2 := + Finset.sum_nonneg (fun _ _ => integral_nonneg (fun _ => sq_nonneg _)) + have hsize : (m:ℝ)*S*h^4 ≤ h^2 := by + calc + _ = h^2*((m:ℝ)*S*h^2) := by ring + _ ≤ h^2*1 := mul_le_mul_of_nonneg_left hmesh (sq_nonneg h) + _ = _ := mul_one _ + have hb : (rho:ℝ)*(24*C*D^4*(3072*Real.pi*h^2/(L:ℝ)^2+216*m*S*h^4)+ + 108*Real.pi*(L:ℝ)^2*h^2) ≤ E*h^2 := by + have hs := mul_le_mul_of_nonneg_left hsize (by norm_num : (0:ℝ) ≤ 216) + have ht := mul_le_mul_of_nonneg_left + (add_le_add_left hs (3072*Real.pi*h^2/(L:ℝ)^2)) (by positivity : 0 ≤ 24*C*D^4) + have ht' := mul_le_mul_of_nonneg_left + (add_le_add_right ht (108*Real.pi*(L:ℝ)^2*h^2)) hrhoR.le + dsimp only [E] + convert ht' using 1 <;> ring + apply he.trans + calc + _ ≤ E*h^2*(∫ x, ‖w.value s x‖^2)+(rho:ℝ)*A*h^2* + ((∫ x, ‖w.value s x‖^2)+∑ k : Fin 3, ∫ x, ‖w.gradient s (i,k) x‖^2) := + add_le_add (mul_le_mul_of_nonneg_right hb hmass) le_rfl + _ ≤ (E+(rho:ℝ)*A)*h^2* + ((∫ x, ‖w.value s x‖^2)+∑ k : Fin 3, ∫ x, ‖w.gradient s (i,k) x‖^2) := by + nlinarith [mul_nonneg (mul_nonneg hE (sq_nonneg h)) hgrad] + _ ≤ _ := mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_right (show E+(rho:ℝ)*A ≤ B from le_max_right _ _) (sq_nonneg h)) + (add_nonneg hmass hgrad) + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/UniformQuadrature.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/UniformQuadrature.lean new file mode 100644 index 0000000000000000000000000000000000000000..2d74ea911083b7a1aab676a5e20e47db5fc7a318 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/UniformQuadrature.lean @@ -0,0 +1,108 @@ +import Mathlib.MeasureTheory.Integral.IntervalIntegral.Basic +import Mathlib.Tactic + +namespace OAI + +/-! A quantitative left-endpoint quadrature bound, including errors in the +sample values. It will be applied successively to the fixed-dimensional +truncated heat integral. -/ + +noncomputable section +open MeasureTheory +open scoped BigOperators +namespace ContinuumCoulomb.UniformQuadrature + +def node (a h : ℝ) (i : ℕ) : ℝ := a + (i : ℝ) * h + +def sum (a h : ℝ) (N : ℕ) (evaluate : ℝ → ℝ) : ℝ := + h * ∑ i ∈ Finset.range N, evaluate (node a h i) + +theorem cell_error (f : ℝ → ℝ) {a h L : ℝ} (hh : 0 ≤ h) (hL : 0 ≤ L) + (hf : ContinuousOn f (Set.Icc a (a + h))) + (hLip : ∀ x ∈ Set.Icc a (a + h), |f x - f a| ≤ L * |x - a|) : + |h * f a - ∫ x in a..a + h, f x| ≤ L * h ^ 2 := by + have hab : a ≤ a + h := by linarith + have hfi : IntervalIntegrable f volume a (a + h) := + ContinuousOn.intervalIntegrable_of_Icc hab hf + have heq : h * f a - (∫ x in a..a + h, f x) = + ∫ x in a..a + h, (f a - f x) := by + rw [intervalIntegral.integral_sub intervalIntegrable_const hfi, + intervalIntegral.integral_const] + simp only [add_sub_cancel_left, smul_eq_mul] + rw [heq] + have hi := intervalIntegral.norm_integral_le_of_norm_le_const + (f := fun x => f a - f x) (a := a) (b := a + h) (C := L * h) (by + intro x hx + have hx' : x ∈ Set.Icc a (a + h) := by + have hx'' : x ∈ Set.Ioc a (a + h) := by + simpa only [Set.uIoc_of_le hab] using hx + exact ⟨hx''.1.le, hx''.2⟩ + rw [Real.norm_eq_abs, abs_sub_comm] + exact (hLip x hx').trans (mul_le_mul_of_nonneg_left + (by rw [abs_of_nonneg (sub_nonneg.mpr hx'.1)]; linarith [hx'.2]) hL)) + simpa only [Real.norm_eq_abs, add_sub_cancel_left, abs_of_nonneg hh, pow_two, + mul_assoc] using hi + +theorem cell_sample_error (f : ℝ → ℝ) (v : ℝ) {a h L ε : ℝ} + (hh : 0 ≤ h) (hL : 0 ≤ L) + (hf : ContinuousOn f (Set.Icc a (a + h))) + (hLip : ∀ x ∈ Set.Icc a (a + h), |f x - f a| ≤ L * |x - a|) + (hv : |v - f a| ≤ ε) : + |h * v - ∫ x in a..a + h, f x| ≤ L * h ^ 2 + h * ε := by + have heq : h * v - (∫ x in a..a + h, f x) = + h * (v - f a) + (h * f a - ∫ x in a..a + h, f x) := by ring + rw [heq] + calc + _ ≤ |h * (v - f a)| + |h * f a - ∫ x in a..a + h, f x| := abs_add_le _ _ + _ ≤ h * ε + L * h ^ 2 := add_le_add + (by rw [abs_mul, abs_of_nonneg hh]; exact mul_le_mul_of_nonneg_left hv hh) + (cell_error f hh hL hf hLip) + _ = _ := by ring + +theorem error (f evaluate : ℝ → ℝ) (a h : ℝ) (N : ℕ) {L ε : ℝ} + (hh : 0 ≤ h) (hL : 0 ≤ L) (hf : Continuous f) + (hLip : ∀ x ∈ Set.Icc a (node a h N), ∀ y ∈ Set.Icc a (node a h N), + |f x - f y| ≤ L * |x - y|) + (heval : ∀ i < N, |evaluate (node a h i) - f (node a h i)| ≤ ε) : + |sum a h N evaluate - ∫ x in a..node a h N, f x| ≤ + (N : ℝ) * (L * h ^ 2 + h * ε) := by + have hnode (i j : ℕ) (hij : i ≤ j) : node a h i ≤ node a h j := by + dsimp only [node] + exact add_le_add_right (mul_le_mul_of_nonneg_right (by exact_mod_cast hij) hh) a + have hstep (i : ℕ) : node a h (i + 1) = node a h i + h := by + simp only [node, Nat.cast_add, Nat.cast_one] + ring + have ht := intervalIntegral.sum_integral_adjacent_intervals + (μ := volume) (a := node a h) (n := N) (f := f) (fun i _ => hf.intervalIntegrable _ _) + have hzero : node a h 0 = a := by simp [node] + rw [hzero] at ht + have heq : sum a h N evaluate - (∫ x in a..node a h N, f x) = + ∑ i ∈ Finset.range N, (h * evaluate (node a h i) - + ∫ x in node a h i..node a h (i + 1), f x) := by + rw [Finset.sum_sub_distrib, ht, sum, Finset.mul_sum] + rw [heq] + calc + _ ≤ ∑ i ∈ Finset.range N, |h * evaluate (node a h i) - + ∫ x in node a h i..node a h (i + 1), f x| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _i ∈ Finset.range N, (L * h ^ 2 + h * ε) := by + apply Finset.sum_le_sum + intro i hi + have hiN := Finset.mem_range.mp hi + rw [hstep] + apply cell_sample_error f _ hh hL hf.continuousOn _ (heval i hiN) + intro x hx + have hx' : x ∈ Set.Icc a (node a h N) := by + refine ⟨?_, ?_⟩ + · have hi0 : a ≤ node a h i := by simpa only [hzero] using hnode 0 i (Nat.zero_le i) + exact hi0.trans hx.1 + · exact hx.2.trans (by rw [← hstep]; exact hnode (i + 1) N hiN) + have hi' : node a h i ∈ Set.Icc a (node a h N) := + ⟨by simpa only [hzero] using hnode 0 i (Nat.zero_le i), hnode i N hiN.le⟩ + exact hLip x hx' (node a h i) hi' + _ = _ := by simp; ring + +end ContinuumCoulomb.UniformQuadrature + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/UniformReciprocal.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/UniformReciprocal.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3cba879d1425750d18a0eb160a6940dba798fb6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/UniformReciprocal.lean @@ -0,0 +1,87 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Nuclei.MoserChargeBounds + +namespace OAI + +/-! A uniform four-derivative reciprocal estimate away from zero, used +only for the positive density in the Moser field. -/ + +noncomputable section +open scoped BigOperators ContDiff +namespace ContinuumCoulomb + +private theorem reciprocal_derivatives_bounded {rho : ℝ} (hrho : 0 < rho) : + ∃ C : ℝ, 0 < C ∧ ∀ k ≤ 4, ∀ y ∈ Set.Icc (rho/2) (3*rho/2), + ‖iteratedFDeriv ℝ k (fun z : ℝ => z⁻¹) y‖ ≤ C := by + let T : Set ℝ := {0}ᶜ + have hT : IsOpen T := isClosed_singleton.isOpen_compl + have hg : ContDiffOn ℝ 4 (fun z : ℝ => z⁻¹) T := + contDiffOn_id.inv (fun z hz => hz) + have hsub : Set.Icc (rho/2) (3*rho/2) ⊆ T := by + intro z hz + exact ne_of_gt (lt_of_lt_of_le (by positivity : 0 < rho/2) hz.1) + have hb (k : Fin 5) : ∃ A : ℝ, ∀ y ∈ Set.Icc (rho/2) (3*rho/2), + ‖iteratedFDeriv ℝ k.val (fun z : ℝ => z⁻¹) y‖ ≤ A := by + have hc : ContinuousOn (iteratedFDeriv ℝ k.val (fun z : ℝ => z⁻¹)) T := by + apply (hg.continuousOn_iteratedFDerivWithin (by exact_mod_cast (show k.val ≤ 4 by omega)) + hT.uniqueDiffOn).congr + intro z hz + exact (iteratedFDerivWithin_of_isOpen (𝕜 := ℝ) (f := fun z : ℝ => z⁻¹) + k.val hT hz).symm + obtain ⟨A,hA⟩ := isCompact_Icc.bddAbove_image ((hc.mono hsub).norm) + exact ⟨A, fun y hy => hA ⟨y,hy,rfl⟩⟩ + choose B hB using hb + let C : ℝ := 1+∑ k : Fin 5, max (B k) 0 + have hn : 0 ≤ ∑ k : Fin 5, max (B k) 0 := + Finset.sum_nonneg (fun _ _ => le_max_right _ _) + refine ⟨C, by dsimp [C]; linarith, ?_⟩ + intro k hk y hy + let i : Fin 5 := ⟨k, by omega⟩ + have hs : max (B i) 0 ≤ ∑ j : Fin 5, max (B j) 0 := + Finset.single_le_sum (fun _ _ => le_max_right _ _) (Finset.mem_univ i) + exact (hB i y hy).trans ((le_max_left _ _).trans (by dsimp [C]; linarith)) + +/-- The constant depends on the density floor and on the four-derivative +bound, not on the support or the number of wells. -/ +theorem uniform_reciprocal_four_bound {rho B : ℝ} (hrho : 0 < rho) : + ∃ C : ℝ, 0 < C ∧ ∀ f : ℝ × Position → ℝ, ContDiff ℝ 4 f → + ∀ x, f x ∈ Set.Icc (rho/2) (3*rho/2) → + (∀ j ≤ 4, ‖iteratedFDeriv ℝ j f x‖ ≤ B) → + ∀ k ≤ 4, ‖iteratedFDeriv ℝ k (fun y => (f y)⁻¹) x‖ ≤ C := by + obtain ⟨A,hA,hAb⟩ := reciprocal_derivatives_bounded hrho + let D : ℝ := max 1 B + refine ⟨24*A*D^4, by dsimp [D]; positivity, ?_⟩ + intro f hf x hx hb k hk + let U : Set (ℝ × Position) := {y | f y ≠ 0} + let T : Set ℝ := {0}ᶜ + have hT : IsOpen T := isClosed_singleton.isOpen_compl + have hU : IsOpen U := isOpen_ne.preimage hf.continuous + have hxU : x ∈ U := ne_of_gt (lt_of_lt_of_le (by positivity : 0 < rho/2) hx.1) + have hg : ContDiffOn ℝ 4 (fun z : ℝ => z⁻¹) T := + contDiffOn_id.inv (fun z hz => hz) + have hcomp := norm_iteratedFDerivWithin_comp_le hg hf.contDiffOn + (show (k : WithTop ℕ∞) ≤ 4 by exact_mod_cast hk) + hT.uniqueDiffOn hU.uniqueDiffOn (fun y hy => hy) hxU + (C := A) (D := D) (fun j hj => by + rw [iteratedFDerivWithin_of_isOpen (𝕜 := ℝ) (f := fun z : ℝ => z⁻¹) + j hT (show f x ∈ T from hxU)] + exact hAb j (hj.trans hk) (f x) hx) + (fun j hj hjk => by + rw [iteratedFDerivWithin_of_isOpen (𝕜 := ℝ) (f := f) j hU hxU] + exact (hb j (hjk.trans hk)).trans ((le_max_right 1 B).trans (by + simpa only [pow_one] using pow_le_pow_right₀ (le_max_left 1 B) hj))) + rw [iteratedFDerivWithin_of_isOpen (𝕜 := ℝ) + (f := (fun z : ℝ => z⁻¹) ∘ f) k hU hxU] at hcomp + apply hcomp.trans + apply mul_le_mul + · exact mul_le_mul_of_nonneg_right (by + exact_mod_cast (show k.factorial ≤ 24 from + (Nat.factorial_le hk).trans (by decide))) hA.le + · exact pow_le_pow_right₀ (le_max_left 1 B) hk + · exact pow_nonneg (le_trans zero_le_one (le_max_left 1 B)) k + · positivity + +end ContinuumCoulomb + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/UniformSamples.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/UniformSamples.lean new file mode 100644 index 0000000000000000000000000000000000000000..7af9a951cbec50c38db36cb11a2db5d3dba89929 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/UniformSamples.lean @@ -0,0 +1,61 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.UniformQuadrature + +namespace OAI + +/-! Left-endpoint quadrature with a finite sequence of computed samples. -/ + +noncomputable section +open MeasureTheory +open scoped BigOperators +namespace ContinuumCoulomb.UniformQuadrature + +def sampleSum (h : ℝ) (N : ℕ) (v : ℕ → ℝ) : ℝ := + h * ∑ i ∈ Finset.range N, v i + +theorem samples_error (f : ℝ → ℝ) (v : ℕ → ℝ) (a h : ℝ) (N : ℕ) {L ε : ℝ} + (hh : 0 ≤ h) (hL : 0 ≤ L) (hf : Continuous f) + (hLip : ∀ x ∈ Set.Icc a (node a h N), ∀ y ∈ Set.Icc a (node a h N), + |f x - f y| ≤ L * |x - y|) + (heval : ∀ i < N, |v i - f (node a h i)| ≤ ε) : + |sampleSum h N v - ∫ x in a..node a h N, f x| ≤ + (N : ℝ) * (L * h ^ 2 + h * ε) := by + have hnode (i j : ℕ) (hij : i ≤ j) : node a h i ≤ node a h j := by + dsimp only [node] + exact add_le_add_right (mul_le_mul_of_nonneg_right (by exact_mod_cast hij) hh) a + have hstep (i : ℕ) : node a h (i + 1) = node a h i + h := by + simp only [node, Nat.cast_add, Nat.cast_one] + ring + have ht := intervalIntegral.sum_integral_adjacent_intervals + (μ := volume) (a := node a h) (n := N) (f := f) (fun i _ => hf.intervalIntegrable _ _) + have hzero : node a h 0 = a := by simp [node] + rw [hzero] at ht + have heq : sampleSum h N v - (∫ x in a..node a h N, f x) = + ∑ i ∈ Finset.range N, (h * v i - + ∫ x in node a h i..node a h (i + 1), f x) := by + rw [Finset.sum_sub_distrib, ht, sampleSum, Finset.mul_sum] + rw [heq] + calc + _ ≤ ∑ i ∈ Finset.range N, |h * v i - + ∫ x in node a h i..node a h (i + 1), f x| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _i ∈ Finset.range N, (L * h ^ 2 + h * ε) := by + apply Finset.sum_le_sum + intro i hi + have hiN := Finset.mem_range.mp hi + rw [hstep] + apply cell_sample_error f _ hh hL hf.continuousOn _ (heval i hiN) + intro x hx + have hx' : x ∈ Set.Icc a (node a h N) := by + refine ⟨?_, ?_⟩ + · have hi0 : a ≤ node a h i := by simpa only [hzero] using hnode 0 i (Nat.zero_le i) + exact hi0.trans hx.1 + · exact hx.2.trans (by rw [← hstep]; exact hnode (i + 1) N hiN) + have hi' : node a h i ∈ Set.Icc a (node a h N) := + ⟨by simpa only [hzero] using hnode 0 i (Nat.zero_le i), hnode i N hiN.le⟩ + exact hLip x hx' (node a h i) hi' + _ = _ := by simp; ring + +end ContinuumCoulomb.UniformQuadrature + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/UniformSamplesOn.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/UniformSamplesOn.lean new file mode 100644 index 0000000000000000000000000000000000000000..4520615aa2d2fcb61dea3f76595610231c31357a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/UniformSamplesOn.lean @@ -0,0 +1,92 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Reduction.UniformSamples + +namespace OAI + +/-! The quadrature estimate only needs a modulus on the integration +interval. This is the form used after cutting off the singular time zero. -/ + +noncomputable section +open MeasureTheory +open scoped BigOperators +namespace ContinuumCoulomb.UniformQuadrature + +theorem continuousOn_of_abs_sub_le {f : ℝ → ℝ} {s : Set ℝ} {L : ℝ} + (hLip : ∀ x ∈ s, ∀ y ∈ s, |f x - f y| ≤ L * |x - y|) : ContinuousOn f s := by + have h := LipschitzOnWith.of_dist_le' (K := L) (f := f) (s := s) (by + intro x hx y hy + simpa only [Real.dist_eq] using hLip x hx y hy) + exact h.continuousOn + +theorem samples_error_lipschitz (f : ℝ → ℝ) (v : ℕ → ℝ) + (a h : ℝ) (N : ℕ) {L ε : ℝ} (hh : 0 ≤ h) (hL : 0 ≤ L) + (hLip : ∀ x ∈ Set.Icc a (node a h N), ∀ y ∈ Set.Icc a (node a h N), + |f x - f y| ≤ L * |x - y|) + (heval : ∀ i < N, |v i - f (node a h i)| ≤ ε) : + |sampleSum h N v - ∫ x in a..node a h N, f x| ≤ + (N : ℝ) * (L * h ^ 2 + h * ε) := by + have hc := continuousOn_of_abs_sub_le hLip + have hnode (i j : ℕ) (hij : i ≤ j) : node a h i ≤ node a h j := by + dsimp only [node] + exact add_le_add_right (mul_le_mul_of_nonneg_right (by exact_mod_cast hij) hh) a + have hstep (i : ℕ) : node a h (i + 1) = node a h i + h := by + simp only [node, Nat.cast_add, Nat.cast_one] + ring + have hzero : node a h 0 = a := by simp [node] + have hcell (i : ℕ) (hi : i < N) : + Set.Icc (node a h i) (node a h (i + 1)) ⊆ Set.Icc a (node a h N) := by + intro x hx + have hi0 : a ≤ node a h i := by simpa only [hzero] using hnode 0 i (Nat.zero_le i) + exact ⟨hi0.trans hx.1, hx.2.trans (hnode (i + 1) N hi)⟩ + have ht := intervalIntegral.sum_integral_adjacent_intervals + (μ := volume) (a := node a h) (n := N) (f := f) (by + intro i hi + exact (hc.mono (hcell i hi)).intervalIntegrable_of_Icc (hnode i (i + 1) (Nat.le_succ i))) + rw [hzero] at ht + have heq : sampleSum h N v - (∫ x in a..node a h N, f x) = + ∑ i ∈ Finset.range N, (h * v i - + ∫ x in node a h i..node a h (i + 1), f x) := by + rw [Finset.sum_sub_distrib, ht, sampleSum, Finset.mul_sum] + rw [heq] + calc + _ ≤ ∑ i ∈ Finset.range N, |h * v i - + ∫ x in node a h i..node a h (i + 1), f x| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ _i ∈ Finset.range N, (L * h ^ 2 + h * ε) := by + apply Finset.sum_le_sum + intro i hi + have hiN := Finset.mem_range.mp hi + have hci := hc.mono (hcell i hiN) + rw [hstep] at hci ⊢ + apply cell_sample_error f _ hh hL hci _ (heval i hiN) + intro x hx + have hx' : x ∈ Set.Icc a (node a h N) := by + apply hcell i hiN + simpa only [hstep] using hx + have hi' : node a h i ∈ Set.Icc a (node a h N) := + ⟨by simpa only [hzero] using hnode 0 i (Nat.zero_le i), hnode i N hiN.le⟩ + exact hLip x hx' (node a h i) hi' + _ = _ := by simp; ring + +theorem integral_parameter_lipschitz (f : ℝ → ℝ → ℝ) {a b c d L : ℝ} + (hcd : c ≤ d) + (hf : ∀ x ∈ Set.Icc a b, ContinuousOn (f x) (Set.Icc c d)) + (hLip : ∀ x ∈ Set.Icc a b, ∀ y ∈ Set.Icc a b, ∀ z ∈ Set.Icc c d, + |f x z - f y z| ≤ L * |x - y|) + {x y : ℝ} (hx : x ∈ Set.Icc a b) (hy : y ∈ Set.Icc a b) : + |(∫ z in c..d, f x z) - ∫ z in c..d, f y z| ≤ (d - c) * L * |x - y| := by + rw [← intervalIntegral.integral_sub + ((hf x hx).intervalIntegrable_of_Icc hcd) ((hf y hy).intervalIntegrable_of_Icc hcd)] + have h := intervalIntegral.norm_integral_le_of_norm_le_const + (f := fun z => f x z - f y z) (a := c) (b := d) (C := L * |x - y|) (by + intro z hz + have hz' : z ∈ Set.Icc c d := by + have hz'' : z ∈ Set.Ioc c d := by simpa only [Set.uIoc_of_le hcd] using hz + exact ⟨hz''.1.le, hz''.2⟩ + simpa only [Real.norm_eq_abs] using hLip x hx y hy z hz') + simpa only [Real.norm_eq_abs, abs_of_nonneg (sub_nonneg.mpr hcd), mul_assoc, mul_comm, + mul_left_comm] using h + +end ContinuumCoulomb.UniformQuadrature + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/UniformTransformedGauss.lean b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/UniformTransformedGauss.lean new file mode 100644 index 0000000000000000000000000000000000000000..8386f595f45bbc779a2c409aaf3fb6ce49d716fc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/ContinuumCoulomb/Reduction/UniformTransformedGauss.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.ContinuumCoulomb.Programs.TransformedGaussProgram +import OAI.MathematicalPhysics.ContinuumCoulomb.OneParticle.ManufacturedTransport + +namespace OAI + +/-! +One rational program approximates transported Gauss nodes uniformly +for separated manufactured fields, under the smooth flow hypothesis. +-/ + +noncomputable section +open scoped NNReal +namespace ContinuumCoulomb.TransformedGauss +open CappedKernelProgram (Triple position) +open EulerRegisters (Registers) +open RationalGaussNodes (Signs) + +theorem exists_uniform_transport_program (hpublished : PublishedC4FlowInput) : + ∃ rho U C K : ℕ, 0 < rho ∧ 0 < U ∧ 0 < C ∧ + Nonempty (Turing.TM2ComputableInPolyTime inputCode CappedKernelProgram.tripleCode (output rho U C K)) ∧ + ∃ L J : ℝ≥0, 0 < L ∧ 0 < J ∧ ∀ (scale S : ℚ), + (1:ℝ) ≤ scale → (1:ℝ) ≤ S → ∀ (m : ℕ) (u : Fin m → ℚ×ℚ), + Function.Injective u → + (∀ i j, i ≠ j → 3 ≤ ‖PlanarForcingProgram.position (u i)-PlanarForcingProgram.position (u j)‖) → + (∀ i, localizedCounterterm (GaussianFrequency.frequency rho) + (fun j => PlanarForcingProgram.position (u j)) i ≤ scale) → + ∃ G : Position → ℝ → Position, + IsUnitTimeFlow (moserVelocity (rho:ℝ) (manufacturedWellField (GaussianFrequency.frequency rho) + scale S (fun i => PlanarForcingProgram.position (u i)))) G ∧ + Function.Bijective (fun x => G x 1) ∧ + LipschitzWith L (fun x => G x 1) ∧ AntilipschitzWith J (fun x => G x 1) ∧ + (∀ x, x ∉ tsupport (manufacturedWellField (GaussianFrequency.frequency rho) + scale S (fun i => PlanarForcingProgram.position (u i))) → G x 1 = x) ∧ + ContDiff ℝ 4 (fun x => G x 1) ∧ + ∀ (P N : ℕ), 0 < N → ∀ (k : Registers) (b : Signs), + ‖position (value rho U C K P N scale S (List.ofFn u) k b)- + G (gaussLatticePoint (N:ℝ)⁻¹ (RationalGaussNodes.index k b)) 1‖ ≤ ((P:ℝ)+1)⁻¹ := by + obtain ⟨rho,hrho,L,J,hL,hJ,hfamily⟩ := manufactured_transport_family_with_charge hpublished + obtain ⟨U,C,hU,hC,herror⟩ := exists_uniform_constants rho hrho + obtain ⟨K,hK⟩ := exists_nat_gt (L:ℝ) + refine ⟨rho,U,C,K,hrho,hU,hC,⟨certificate rho U C K⟩,L,J,hL,hJ,?_⟩ + intro scale S hs hS m u hu hsep hc + have hs' : (0:ℝ) < scale := lt_of_lt_of_le zero_lt_one hs + obtain ⟨hcharge,G,hflow,hbij,hLip,hAnti,hfix,hreg,_⟩ := + hfamily (GaussianFrequency.frequency rho) scale S hs' hS m + (fun i => PlanarForcingProgram.position (u i)) hsep hc + refine ⟨G,hflow,hbij,hLip,hAnti,hfix,hreg,?_⟩ + intro P N hN k b + exact herror K P N hN scale S hs hS m u hu hsep hc hcharge G hflow L hLip hK.le k b + +end ContinuumCoulomb.TransformedGauss + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/Coulomb/OuterRadius.lean b/lean/OAI/MathematicalPhysics/Coulomb/OuterRadius.lean new file mode 100644 index 0000000000000000000000000000000000000000..4b6395d3b0aa9f923f5179f3ff7b57397fec4af7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/Coulomb/OuterRadius.lean @@ -0,0 +1,392 @@ +import Mathlib + +namespace OAI + + + +noncomputable section + +open MeasureTheory Filter Set +open scoped BigOperators ENNReal Topology ContDiff + +namespace CoulombAtoms + + +abbrev Position := EuclideanSpace ℝ (Fin 3) + + +abbrev Configuration (n : ℕ) := Fin n → Position + + +abbrev SpinConfiguration (n : ℕ) := Fin n → Fin 2 + +abbrev WaveFunction (n : ℕ) := SpinConfiguration n → Configuration n → ℂ + + +def coordinateVector {n : ℕ} (i : Fin n) (a : Fin 3) : Configuration n := + fun j => if j = i then EuclideanSpace.single a 1 else 0 + + +def permutationSign {n : ℕ} (π : Equiv.Perm (Fin n)) : ℂ := + ((Equiv.Perm.sign π : ℤˣ) : ℤ) + + + +structure FormState (n : ℕ) where + wave : WaveFunction n + deriv : SpinConfiguration n → Fin n → Fin 3 → Configuration n → ℂ + wave_memLp : ∀ σ, MemLp (wave σ) 2 volume + deriv_memLp : ∀ σ i a, MemLp (deriv σ i a) 2 volume + weak_deriv : ∀ σ i a (φ : Configuration n → ℝ), + ContDiff ℝ ∞ φ → HasCompactSupport φ → + (∫ x, (φ x : ℂ) * deriv σ i a x) = + -(∫ x, ((fderiv ℝ φ x (coordinateVector i a)) : ℂ) * wave σ x) + antisymmetric : ∀ (π : Equiv.Perm (Fin n)) σ, + ∀ᵐ x ∂volume, + wave (σ ∘ π) (x ∘ π) = permutationSign π * wave σ x + + +def normSq {n : ℕ} (ψ : FormState n) : ℝ := + ∑ σ : SpinConfiguration n, ∫ x, ‖ψ.wave σ x‖ ^ 2 + + +def kineticEnergy {n : ℕ} (ψ : FormState n) : ℝ := + (1 / 2 : ℝ) * ∑ σ : SpinConfiguration n, ∑ i : Fin n, ∑ a : Fin 3, + ∫ x, ‖ψ.deriv σ i a x‖ ^ 2 + + + +def nuclearPotential {n : ℕ} (Z : ℝ) (x : Configuration n) : ℝ := + ∑ i : Fin n, Z / ‖x i‖ + + +def pairPotential {n : ℕ} (x : Configuration n) : ℝ := + ∑ i : Fin n, ∑ j ∈ Finset.univ.filter (fun j : Fin n => i < j), + ‖x i - x j‖⁻¹ + + +def atomicCoulombForm {n : ℕ} (Z : ℝ) (ψ : FormState n) : ℝ := + kineticEnergy ψ - + (∑ σ : SpinConfiguration n, ∫ x, nuclearPotential Z x * ‖ψ.wave σ x‖ ^ 2) + + (∑ σ : SpinConfiguration n, ∫ x, pairPotential x * ‖ψ.wave σ x‖ ^ 2) + + + +def IsNormalizedGroundState {n : ℕ} (Z : ℝ) (ψ : FormState n) : Prop := + normSq ψ = 1 ∧ + ∀ φ : FormState n, normSq φ = 1 → atomicCoulombForm Z ψ ≤ atomicCoulombForm Z φ + + + +def density : {n : ℕ} → FormState n → Position → ℝ + | 0, _, _ => 0 + | n + 1, ψ, x => + (n + 1 : ℝ) * ∑ σ : SpinConfiguration (n + 1), + ∫ y : Configuration n, ‖ψ.wave σ (Fin.cons x y)‖ ^ 2 + + +def exteriorMass (ρ : Position → ℝ) (r : ℝ) : ℝ := + ∫ x in {x : Position | r < ‖x‖}, ρ x + + +def halfElectronRadius (ρ : Position → ℝ) : ℝ := + sInf {r : ℝ | 0 ≤ r ∧ exteriorMass ρ r ≤ (1 / 2 : ℝ)} + +def outerRadius {n : ℕ} (ψ : FormState n) : ℝ := + halfElectronRadius (density ψ) + + + +lemma integrable_cons {n : ℕ} {f : Configuration (n + 1) → ℝ} + (hf : Integrable f) : + Integrable (fun p : Position × Configuration n => f (Fin.cons p.1 p.2)) := by + have hp := (volume_preserving_piFinSuccAbove (fun _ : Fin (n + 1) => Position) 0).symm + have h := (hp.integrable_comp_emb (MeasurableEquiv.measurableEmbedding _)).2 hf + simpa [Function.comp_def, MeasurableEquiv.piFinSuccAbove_symm_apply, + Fin.insertNthEquiv, Fin.insertNth_zero, Fin.zero_succAbove] using h + +lemma integral_cons {n : ℕ} {f : Configuration (n + 1) → ℝ} + (hf : Integrable f) : + (∫ x : Position, ∫ y : Configuration n, f (Fin.cons x y)) = ∫ z, f z := by + have hp := (volume_preserving_piFinSuccAbove (fun _ : Fin (n + 1) => Position) 0).symm + have he := hp.integral_comp' f + have hprod := integral_prod _ (integrable_cons hf) + rw [← hprod] + simpa [Function.comp_def, MeasurableEquiv.piFinSuccAbove_symm_apply, + Fin.insertNthEquiv, Fin.insertNth_zero, Fin.zero_succAbove, Measure.volume_eq_prod] using he + +lemma density_one (ψ : FormState 1) (x : Position) : + density ψ x = ∑ σ : SpinConfiguration 1, ‖ψ.wave σ (fun _ => x)‖ ^ 2 := by + have hm : volume.real (Set.univ : Set (Configuration 0)) = 1 := by + simp [measureReal_def, Configuration, volume_pi] + simp only [density, Nat.cast_zero, zero_add, one_mul] + apply Finset.sum_congr rfl + intro σ _ + rw [integral_unique, hm, one_smul] + congr 3 + funext i + fin_cases i + rfl + +lemma density_nonneg {n : ℕ} (ψ : FormState n) (x : Position) : 0 ≤ density ψ x := by + cases n with + | zero => exact le_refl _ + | succ n => + exact mul_nonneg (by positivity) + (Finset.sum_nonneg fun σ _ => integral_nonneg fun y => sq_nonneg _) + +lemma density_integrable {n : ℕ} (ψ : FormState n) : Integrable (density ψ) := by + cases n with + | zero => exact integrable_zero Position ℝ volume + | succ n => + apply Integrable.const_mul + apply integrable_finsetSum + intro σ _ + exact (integrable_cons ((ψ.wave_memLp σ).integrable_norm_pow (by norm_num : 2 ≠ 0))).integral_prod_left + +lemma integral_density {n : ℕ} (ψ : FormState n) : (∫ x, density ψ x) = (n : ℝ) * normSq ψ := by + cases n with + | zero => simp [density] + | succ n => + simp only [density] + rw [integral_const_mul, integral_finsetSum] + · simp_rw [integral_cons ((ψ.wave_memLp _).integrable_norm_pow (by norm_num : 2 ≠ 0))] + simp [normSq] + · intro σ _ + exact (integrable_cons ((ψ.wave_memLp σ).integrable_norm_pow (by norm_num : 2 ≠ 0))).integral_prod_left + +lemma integral_density_of_normalized {n : ℕ} (ψ : FormState n) (hψ : normSq ψ = 1) : + (∫ x, density ψ x) = n := by + rw [integral_density, hψ, mul_one] + + + +lemma measurableSet_exterior (r : ℝ) : MeasurableSet {x : Position | r < ‖x‖} := + (isOpen_lt continuous_const continuous_norm).measurableSet + +lemma exteriorMass_nonneg {ρ : Position → ℝ} (hρ : ∀ x, 0 ≤ ρ x) (r : ℝ) : + 0 ≤ exteriorMass ρ r := + integral_nonneg hρ + +lemma exteriorMass_antitone {ρ : Position → ℝ} (hρ : Integrable ρ) + (hρ₀ : ∀ x, 0 ≤ ρ x) : Antitone (exteriorMass ρ) := by + intro r s hrs + apply setIntegral_mono_set hρ.integrableOn + · exact Filter.Eventually.of_forall hρ₀ + · exact Filter.Eventually.of_forall (fun x hx => lt_of_le_of_lt hrs hx) + +lemma halfElectronRadius_le {ρ : Position → ℝ} {R : ℝ} + (hR : 0 ≤ R) (hTail : exteriorMass ρ R ≤ (1 / 2 : ℝ)) : + halfElectronRadius ρ ≤ R := + csInf_le ⟨0, fun _ hr => hr.1⟩ ⟨hR, hTail⟩ + + +lemma halfElectronRadius_bounds_of_tails {ρ : Position → ℝ} + (hρ : Integrable ρ) (hρ₀ : ∀ x, 0 ≤ ρ x) {c R : ℝ} + (hR : 0 ≤ R) (hc : (1 / 2 : ℝ) < exteriorMass ρ c) + (hTail : exteriorMass ρ R ≤ (1 / 2 : ℝ)) : + c ≤ halfElectronRadius ρ ∧ halfElectronRadius ρ ≤ R := by + refine ⟨le_csInf ⟨R, hR, hTail⟩ ?_, halfElectronRadius_le hR hTail⟩ + intro r hr + by_contra! hcr + exact (not_le_of_gt hc) (((exteriorMass_antitone hρ hρ₀) hcr.le).trans hr.2) + + +lemma norm_ne_ae (r : ℝ) : ∀ᵐ x : Position, ‖x‖ ≠ r := by + rw [ae_iff] + simpa [Metric.sphere, dist_zero_right] using + (Measure.addHaar_sphere (volume : Measure Position) 0 r) + + + +lemma exteriorMass_eq_ge (ρ : Position → ℝ) (r : ℝ) : + exteriorMass ρ r = ∫ x in {x : Position | r ≤ ‖x‖}, ρ x := by + apply setIntegral_congr_set + filter_upwards [norm_ne_ae r] with x hx + exact propext ⟨le_of_lt, fun h => lt_of_le_of_ne h (Ne.symm hx)⟩ + +lemma exteriorMass_zero (ρ : Position → ℝ) : exteriorMass ρ 0 = ∫ x, ρ x := by + rw [exteriorMass, ← integral_indicator (measurableSet_exterior 0)] + apply integral_congr_ae + filter_upwards [norm_ne_ae 0] with x hx + apply Set.indicator_of_mem + exact lt_of_le_of_ne (norm_nonneg x) (Ne.symm hx) + +lemma norm_exterior_indicator_le (ρ : Position → ℝ) (r : ℝ) (x : Position) : + ‖({x : Position | r < ‖x‖}.indicator ρ) x‖ ≤ ‖ρ x‖ := by + by_cases hx : r < ‖x‖ + · simp [Set.indicator, hx] + · simp [Set.indicator, hx] + +lemma exteriorMass_tendsto_zero {ρ : Position → ℝ} (hρ : Integrable ρ) : + Tendsto (exteriorMass ρ) atTop (𝓝 0) := by + change Tendsto (fun r => ∫ x in {x : Position | r < ‖x‖}, ρ x) atTop (𝓝 0) + have h := tendsto_integral_filter_of_dominated_convergence + (μ := (volume : Measure Position)) (l := (atTop : Filter ℝ)) + (F := fun r => {x : Position | r < ‖x‖}.indicator ρ) (f := fun _ => (0 : ℝ)) + (fun x => ‖ρ x‖) + (Filter.Eventually.of_forall fun r => + hρ.aestronglyMeasurable.indicator (measurableSet_exterior r)) + (Filter.Eventually.of_forall fun r => Filter.Eventually.of_forall fun x => + norm_exterior_indicator_le ρ r x) hρ.norm ?_ + · simpa only [integral_indicator (measurableSet_exterior _), integral_zero, exteriorMass] using h + · exact Filter.Eventually.of_forall fun x => + tendsto_const_nhds.congr' (by + filter_upwards [eventually_ge_atTop ‖x‖] with r hr + simp [Set.indicator, not_lt.mpr hr]) + +lemma exteriorMass_continuous {ρ : Position → ℝ} (hρ : Integrable ρ) : + Continuous (exteriorMass ρ) := by + apply continuous_iff_continuousAt.mpr + intro r + change Tendsto (fun s => ∫ x in {x : Position | s < ‖x‖}, ρ x) (𝓝 r) + (𝓝 (∫ x in {x : Position | r < ‖x‖}, ρ x)) + have h := tendsto_integral_filter_of_dominated_convergence + (μ := (volume : Measure Position)) (l := 𝓝 r) + (F := fun s => {x : Position | s < ‖x‖}.indicator ρ) + (f := {x : Position | r < ‖x‖}.indicator ρ) + (fun x => ‖ρ x‖) + (Filter.Eventually.of_forall fun s => + hρ.aestronglyMeasurable.indicator (measurableSet_exterior s)) + (Filter.Eventually.of_forall fun s => Filter.Eventually.of_forall fun x => + norm_exterior_indicator_le ρ s x) hρ.norm ?_ + · simpa only [integral_indicator (measurableSet_exterior _), exteriorMass] using h + · filter_upwards [norm_ne_ae r] with x hx + rcases lt_or_gt_of_ne hx with hxr | hrx + · have hnot : ¬ r < ‖x‖ := not_lt.mpr hxr.le + simp only [Set.indicator, Set.mem_ofPred_eq, ite_eq_right hnot] + apply tendsto_const_nhds.congr' + filter_upwards [eventually_gt_nhds hxr] with s hs + simp [not_lt.mpr hs.le] + · simp only [Set.indicator, Set.mem_ofPred_eq, ite_eq_left hrx] + apply tendsto_const_nhds.congr' + filter_upwards [eventually_lt_nhds hrx] with s hs + simp [hs] + +lemma exists_exteriorMass_le_half {ρ : Position → ℝ} (hρ : Integrable ρ) : + ∃ R : ℝ, 0 ≤ R ∧ exteriorMass ρ R ≤ (1 / 2 : ℝ) := by + have h := (exteriorMass_tendsto_zero hρ).eventually_lt_const (by norm_num : (0 : ℝ) < 1 / 2) + obtain ⟨R, hR, ht⟩ := ((eventually_ge_atTop (0 : ℝ)).and h).exists + exact ⟨R, hR, ht.le⟩ + +lemma exists_pos_exteriorMass_gt_half {ρ : Position → ℝ} (hρ : Integrable ρ) + (hm : (1 / 2 : ℝ) < ∫ x, ρ x) : + ∃ c : ℝ, 0 < c ∧ (1 / 2 : ℝ) < exteriorMass ρ c := by + have h0 : (1 / 2 : ℝ) < exteriorMass ρ 0 := by rwa [exteriorMass_zero] + have h := (exteriorMass_continuous hρ).continuousAt.eventually (eventually_gt_nhds h0) + obtain ⟨ε, hε, hball⟩ := Metric.eventually_nhds_iff.mp h + refine ⟨ε / 2, half_pos hε, hball ?_⟩ + rw [dist_zero_right, Real.norm_eq_abs, abs_of_pos (half_pos hε)] + linarith + + + +lemma halfElectronRadius_pos {ρ : Position → ℝ} (hρ : Integrable ρ) + (hρ₀ : ∀ x, 0 ≤ ρ x) (hm : (1 / 2 : ℝ) < ∫ x, ρ x) : + 0 < halfElectronRadius ρ := by + obtain ⟨R, hR, hTail⟩ := exists_exteriorMass_le_half hρ + obtain ⟨c, hc, hcTail⟩ := exists_pos_exteriorMass_gt_half hρ hm + exact hc.trans_le (halfElectronRadius_bounds_of_tails hρ hρ₀ hR hcTail hTail).1 + + + +lemma outerRadius_pos {n : ℕ} (hn : 1 ≤ n) (ψ : FormState n) (hψ : normSq ψ = 1) : + 0 < outerRadius ψ := by + apply halfElectronRadius_pos (density_integrable ψ) (density_nonneg ψ) + rw [integral_density_of_normalized ψ hψ] + have : (1 : ℝ) ≤ n := by exact_mod_cast hn + linarith + + +lemma halfElectronRadius_mem {ρ : Position → ℝ} (hρ : Integrable ρ) : + 0 ≤ halfElectronRadius ρ ∧ exteriorMass ρ (halfElectronRadius ρ) ≤ (1 / 2 : ℝ) := by + have hc : IsClosed {r : ℝ | 0 ≤ r ∧ exteriorMass ρ r ≤ (1 / 2 : ℝ)} := + isClosed_Ici.inter (isClosed_le (exteriorMass_continuous hρ) continuous_const) + exact hc.csInf_mem (exists_exteriorMass_le_half hρ) ⟨0, fun _ hr => hr.1⟩ + +lemma halfElectronRadius_le_iff {ρ : Position → ℝ} (hρ : Integrable ρ) + (hρ₀ : ∀ x, 0 ≤ ρ x) {r : ℝ} (hr : 0 ≤ r) : + halfElectronRadius ρ ≤ r ↔ exteriorMass ρ r ≤ (1 / 2 : ℝ) := by + constructor + · intro h + exact ((exteriorMass_antitone hρ hρ₀) h).trans (halfElectronRadius_mem hρ).2 + · exact halfElectronRadius_le hr + +lemma lt_halfElectronRadius_iff {ρ : Position → ℝ} (hρ : Integrable ρ) + (hρ₀ : ∀ x, 0 ≤ ρ x) {r : ℝ} (hr : 0 ≤ r) : + r < halfElectronRadius ρ ↔ (1 / 2 : ℝ) < exteriorMass ρ r := by + rw [← not_le, halfElectronRadius_le_iff hρ hρ₀ hr, not_le] + + + +lemma exteriorMass_halfElectronRadius {ρ : Position → ℝ} (hρ : Integrable ρ) + (hρ₀ : ∀ x, 0 ≤ ρ x) (hm : (1 / 2 : ℝ) < ∫ x, ρ x) : + exteriorMass ρ (halfElectronRadius ρ) = (1 / 2 : ℝ) := by + apply le_antisymm (halfElectronRadius_mem hρ).2 + by_contra! hlt + have hpos := halfElectronRadius_pos hρ hρ₀ hm + have hneigh : ∀ᶠ r in 𝓝 (halfElectronRadius ρ), + 0 < r ∧ exteriorMass ρ r < (1 / 2 : ℝ) := + (eventually_gt_nhds hpos).and + ((exteriorMass_continuous hρ).continuousAt.eventually (eventually_lt_nhds hlt)) + have hleft : ∀ᶠ r in 𝓝[Set.Iio (halfElectronRadius ρ)] (halfElectronRadius ρ), + 0 < r ∧ exteriorMass ρ r < (1 / 2 : ℝ) := + hneigh.filter_mono nhdsWithin_le_nhds + have hltleft : ∀ᶠ r in 𝓝[Set.Iio (halfElectronRadius ρ)] (halfElectronRadius ρ), + r < halfElectronRadius ρ := self_mem_nhdsWithin + obtain ⟨r, ⟨hr, ht⟩, hrlt⟩ := (hleft.and hltleft).exists + exact (not_le_of_gt hrlt) (halfElectronRadius_le hr.le ht.le) + +lemma exteriorMass_outerRadius {n : ℕ} (hn : 1 ≤ n) (ψ : FormState n) + (hψ : normSq ψ = 1) : exteriorMass (density ψ) (outerRadius ψ) = (1 / 2 : ℝ) := by + apply exteriorMass_halfElectronRadius (density_integrable ψ) (density_nonneg ψ) + rw [integral_density_of_normalized ψ hψ] + have : (1 : ℝ) ≤ n := by exact_mod_cast hn + linarith + + + +lemma halfElectronRadius_bounds_of_compact_family {ι : Type*} + [TopologicalSpace ι] [CompactSpace ι] (ρ : ι → Position → ℝ) + (hInt : ∀ i, Integrable (ρ i)) (hNonneg : ∀ i x, 0 ≤ ρ i x) + (hMass : ∀ i, (1 / 2 : ℝ) < ∫ x, ρ i x) + (hCont : ∀ r, Continuous (fun i => exteriorMass (ρ i) r)) : + ∃ c C : ℝ, 0 < c ∧ c ≤ C ∧ + ∀ i, c ≤ halfElectronRadius (ρ i) ∧ halfElectronRadius (ρ i) ≤ C := by + classical + by_cases hne : Nonempty ι + · have hlocal : ∀ i, ∃ c C : ℝ, 0 < c ∧ 0 ≤ C ∧ + (1 / 2 : ℝ) < exteriorMass (ρ i) c ∧ exteriorMass (ρ i) C < (1 / 2 : ℝ) := by + intro i + obtain ⟨c, hc, ht⟩ := exists_pos_exteriorMass_gt_half (hInt i) (hMass i) + have hlim := (exteriorMass_tendsto_zero (hInt i)).eventually_lt_const + (by norm_num : (0 : ℝ) < 1 / 2) + obtain ⟨C, hC, hTail⟩ := ((eventually_ge_atTop (0 : ℝ)).and hlim).exists + exact ⟨c, C, hc, hC, ht, hTail⟩ + choose c C hc hC hlow hupp using hlocal + let U : ι → Set ι := fun i => {j | (1 / 2 : ℝ) < exteriorMass (ρ j) (c i) ∧ + exteriorMass (ρ j) (C i) < (1 / 2 : ℝ)} + have hU : ∀ i, IsOpen (U i) := fun i => + (isOpen_lt continuous_const (hCont (c i))).inter + (isOpen_lt (hCont (C i)) continuous_const) + obtain ⟨I, hI⟩ := isCompact_univ.elim_finite_subcover U hU (by + intro i _ + exact Set.mem_iUnion.mpr ⟨i, hlow i, hupp i⟩) + have hIne : I.Nonempty := by + obtain ⟨i⟩ := hne + obtain ⟨j, hj, _⟩ := Set.mem_iUnion₂.mp (hI (Set.mem_univ i)) + exact ⟨j, hj⟩ + refine ⟨I.inf' hIne c, max (I.inf' hIne c) (I.sup' hIne C), ?_, le_max_left _ _, ?_⟩ + · exact (Finset.lt_inf'_iff hIne).mpr (fun i _ => hc i) + · intro i + obtain ⟨j, hj, hlj, huj⟩ := Set.mem_iUnion₂.mp (hI (Set.mem_univ i)) + have hb := halfElectronRadius_bounds_of_tails (hInt i) (hNonneg i) (hC j) hlj huj.le + exact ⟨(Finset.inf'_le c hj).trans hb.1, + hb.2.trans ((Finset.le_sup' C hj).trans (le_max_right _ _))⟩ + · exact ⟨1, 1, by norm_num, le_rfl, fun i => (hne ⟨i⟩).elim⟩ + +end CoulombAtoms + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalMixing/Comparison.lean b/lean/OAI/MathematicalPhysics/CriticalMixing/Comparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..79756f707ff57e2b9ecca58aa4bc32130f552fde --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalMixing/Comparison.lean @@ -0,0 +1,120 @@ +import OAI.MathematicalPhysics.CriticalSK.Main +import OAI.Probability.SKGap.Main + +namespace OAI + +noncomputable section +open scoped BigOperators Topology NNReal ENNReal +open MeasureTheory ProbabilityTheory Filter + +namespace CriticalSK + +lemma disorderLaw_temperature_map (n : ℕ) (β : ℝ) : + (disorderLaw n).map (fun W => β • W) = SKGap.disorderLaw β n := by + unfold disorderLaw SKGap.disorderLaw + change (Measure.pi (fun _ : Edge n => gaussianReal 0 (n : ℝ≥0)⁻¹)).map + (fun W e => β * W e) = _ + rw [Measure.pi_map_pi (f := fun _ : Edge n => fun a : ℝ => β * a) + (fun _ => (measurable_const.mul measurable_id).aemeasurable)] + congr 1 + funext e + rw [gaussianReal_map_const_mul, mul_zero] + congr 1 + apply NNReal.coe_injective + simp only [NNReal.coe_mul, NNReal.coe_mk, NNReal.coe_inv, NNReal.coe_natCast] + rw [Real.coe_toNNReal _ (div_nonneg (sq_nonneg β) (Nat.cast_nonneg n))] + exact (div_eq_mul_inv _ _).symm + +lemma companion_hamiltonian {n : ℕ} (W : Disorder n) (x : Spin n) : + SKGap.hamiltonian W 0 x = hamiltonian W x := by + unfold SKGap.hamiltonian + simp only [Pi.zero_apply, zero_mul, Finset.sum_const_zero, add_zero] + rw [symmetric_sum_upper _ (by + intro i j + rw [SKGap.coupling_symm W i j] + ring)] + have hd : (∑ i : Fin n, SKGap.spinValue (x i) * SKGap.coupling W i i * + SKGap.spinValue (x i)) = 0 := by simp [SKGap.coupling_diag] + rw [hd, zero_add] + have he : (∑ e : Edge n, SKGap.spinValue (x e.val.1) * + SKGap.coupling W e.val.1 e.val.2 * SKGap.spinValue (x e.val.2)) = hamiltonian W x := by + unfold hamiltonian + apply Finset.sum_congr rfl + intro e _ + simp only [SKGap.coupling, dite_eq_left e.property] + change spinValue (x e.val.1) * W e * spinValue (x e.val.2) = _ + ring + rw [he] + ring + +lemma companion_partition {n : ℕ} (W : Disorder n) : SKGap.partition W 0 = partition W := by + simp only [SKGap.partition, SKGap.weight, companion_hamiltonian, partition] + +lemma companion_mass {n : ℕ} (W : Disorder n) (x : Spin n) : + SKGap.mass W 0 x = gibbs W x := by + rw [SKGap.mass, SKGap.weight, companion_hamiltonian, companion_partition] + rfl + +lemma companion_expectation {n : ℕ} (W : Disorder n) (f : Spin n → ℝ) : + SKGap.expectation W 0 f = mean W f := by + simp only [SKGap.expectation, companion_mass, mean] + +lemma companion_variance {n : ℕ} (W : Disorder n) (f : Spin n → ℝ) : + SKGap.variance W 0 f = variance W f := by + simp only [SKGap.variance, companion_expectation, variance] + +lemma companion_conditionalExpectation {n : ℕ} (W : Disorder n) (i : Fin n) + (f : Spin n → ℝ) (x : Spin n) : + SKGap.conditionalExpectation W 0 i f x = ∑ y, siteKernel W i x y * f y := by + rw [← siteAverage_eq, siteAverage_two] + rw [← companion_mass W x, show flipSite i x = SKGap.flip i x from rfl, + ← companion_mass W (SKGap.flip i x)] + simp only [SKGap.conditionalExpectation, SKGap.mass, div_mul_eq_mul_div, ← add_div, + div_div_div_cancel_right₀ (ne_of_gt (SKGap.partition_pos W 0))] + +lemma companion_dirichlet {n : ℕ} (W : Disorder n) (f : Spin n → ℝ) : + SKGap.dirichlet W 0 f = dirichlet W f := by + simp only [SKGap.dirichlet, companion_expectation, companion_conditionalExpectation, dirichlet] + +lemma companion_poincare_preimage (n : ℕ) (β C : ℝ) : + (fun W : Disorder n => β • W) ⁻¹' SKGap.poincareEvent n C = poincareEvent n β C := by + ext W + simp only [Set.mem_preimage, SKGap.poincareEvent, poincareEvent, Set.mem_ofPred_eq, + companion_variance, companion_dirichlet] + +lemma companion_poincare_measurable (n : ℕ) (C : ℝ) : + MeasurableSet (SKGap.poincareEvent n C) := by + have he : SKGap.poincareEvent n C = poincareEvent n 1 C := by + simpa only [one_smul, Set.preimage_id'] using companion_poincare_preimage n 1 C + rw [he] + exact (poincareEvent_closed n 1 C).measurableSet + +lemma companion_poincare_probability (n : ℕ) (β C : ℝ) : + SKGap.disorderLaw β n (SKGap.poincareEvent n C) = disorderLaw n (poincareEvent n β C) := by + rw [← disorderLaw_temperature_map, + Measure.map_apply (continuous_const_smul β).measurable (companion_poincare_measurable n C), + companion_poincare_preimage] + +theorem fixed_temperature_poincare (β : ℝ) (hβ0 : 0 < β) (hβ1 : β < 1) : + ∃ C : ℝ, 1 ≤ C ∧ Tendsto (fun n : ℕ => + (disorderLaw n).real (poincareEvent n β C)) atTop (𝓝 1) := by + obtain ⟨C, hC, hP, _⟩ := SKGap.sk_main β hβ0 hβ1 + have hp : Tendsto (fun n : ℕ => (disorderLaw n).real (poincareEvent n β C)) + atTop (𝓝 1) := by + simp_rw [companion_poincare_probability] at hP + simpa only [Measure.real, ENNReal.toReal_one, Function.comp_def] using + (ENNReal.tendsto_toReal (by simp : (1 : ℝ≥0∞) ≠ ⊤)).comp hP + refine ⟨max 1 C, le_max_left _ _, ?_⟩ + apply tendsto_of_tendsto_of_tendsto_of_le_of_le hp tendsto_const_nhds + · intro n + refine measureReal_mono ?_ + intro W hW f + exact (hW f).trans (mul_le_mul_of_nonneg_right (le_max_right _ _) + (dirichlet_nonneg (β • W) f)) + · intro n + exact measureReal_le_one + +end CriticalSK +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalMixing/Main.lean b/lean/OAI/MathematicalPhysics/CriticalMixing/Main.lean new file mode 100644 index 0000000000000000000000000000000000000000..3daf45778658a94bbf635ae15df6957cf1282bb1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalMixing/Main.lean @@ -0,0 +1,50 @@ +import OAI.MathematicalPhysics.CriticalMixing.Comparison + +namespace OAI + +noncomputable section +open scoped BigOperators Topology NNReal ENNReal +open MeasureTheory ProbabilityTheory Filter + +namespace CriticalSK + +theorem critical_two_clock_mixing (ε : ℝ) (hε : 0 < ε) : + Tendsto (fun n : ℕ => (disorderLaw n).real (twoClockMixingEvent n ε)) + atTop (𝓝 1) := by + obtain ⟨β, hβ0, hβ1, hsmall⟩ := temperature_close_to_one hε + obtain ⟨C, hC, hP⟩ := fixed_temperature_poincare β hβ0 hβ1 + have hl : Tendsto (fun n : ℕ => (disorderLaw n).real (poincareEvent n β C) - + mixingReductionError n ε) atTop (𝓝 1) := by + simpa only [sub_zero] using hP.sub (mixingReductionError_tendsto hε) + exact tendsto_of_tendsto_of_tendsto_of_le_of_le' hl tendsto_const_nhds + (mixingGapReduction_lower hε hβ1.le hsmall hC) + (Filter.Eventually.of_forall (fun _ => measureReal_le_one)) + +theorem critical_mixing_bounds (ε : ℝ) (hε : 0 < ε) : + Tendsto (fun n : ℕ => (disorderLaw n {W | + (n : ℝ) ^ ((2 : ℝ) / 3 - ε) ≤ continuousMixingTime W ∧ + continuousMixingTime W ≤ Real.exp (ε * n)}).toReal) atTop (𝓝 1) ∧ + Tendsto (fun n : ℕ => (disorderLaw n {W | + (n : ℝ) ^ ((5 : ℝ) / 3 - ε) ≤ (discreteMixingTime W : ℝ) ∧ + (discreteMixingTime W : ℝ) ≤ Real.exp (ε * n)}).toReal) atTop (𝓝 1) := by + have hp := critical_two_clock_mixing ε hε + constructor + · apply tendsto_of_tendsto_of_tendsto_of_le_of_le hp tendsto_const_nhds + · intro n + refine measureReal_mono ?_ + intro W hW + exact ⟨hW.1, hW.2.1⟩ + · intro n + exact measureReal_le_one + · apply tendsto_of_tendsto_of_tendsto_of_le_of_le hp tendsto_const_nhds + · intro n + refine measureReal_mono ?_ + intro W hW + exact ⟨hW.2.2.1, hW.2.2.2⟩ + · intro n + exact measureReal_le_one + +end CriticalSK +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/BlockEnergy.lean b/lean/OAI/MathematicalPhysics/CriticalSK/BlockEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..cf0fe7139899d3b2f3627f295de66e80c5a688c8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/BlockEnergy.lean @@ -0,0 +1,458 @@ +import OAI.MathematicalPhysics.CriticalSK.GaussianConcentration +import OAI.MathematicalPhysics.CriticalSK.PathEnergy + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open MeasureTheory ProbabilityTheory + +open scoped ENNReal NNReal + +open scoped BigOperators InnerProductSpace + +open Module + +open scoped BigOperators ENNReal NNReal Real Topology + +open MeasureTheory ProbabilityTheory Filter + +open scoped BigOperators NNReal + +open scoped BigOperators + +namespace CriticalSK + +lemma sum_consecutive_blocks (K d : ℕ) (f : ℕ → ℝ) : + (∑ b ∈ Finset.range K, ∑ i ∈ Finset.range d, f (b * d + i)) = + ∑ i ∈ Finset.range (K * d), f i := by + induction K with + | zero => simp + | succ K ih => + rw [Finset.sum_range_succ, ih, Nat.succ_mul, Finset.sum_range_add] + +def blockIndices (d l : ℕ) (B : Finset ℕ) : Finset ℕ := + (B ×ˢ Finset.range l).image (fun p => p.1 * d + p.2) + +lemma block_index_injective (d l : ℕ) (B : Finset ℕ) (hd : 0 < d) (hl : l ≤ d) : + Set.InjOn (fun p : ℕ × ℕ => p.1 * d + p.2) (B ×ˢ Finset.range l : Finset _ ) := by + rintro ⟨b, i⟩ hbi ⟨c, k⟩ hck he + have hi : i < d := (Finset.mem_range.mp (Finset.mem_product.mp hbi).2).trans_le hl + have hk : k < d := (Finset.mem_range.mp (Finset.mem_product.mp hck).2).trans_le hl + have hi' : i = k := by + have hm := congrArg (fun n => n % d) he + simpa only [Nat.mul_add_mod_self_right, Nat.mod_eq_of_lt hi, Nat.mod_eq_of_lt hk] using hm + have hb : b = c := by + simp only [hi', Nat.add_right_cancel_iff] at he + exact Nat.eq_of_mul_eq_mul_right hd he + exact Prod.ext hb hi' + +lemma blockIndices_sum (d l : ℕ) (B : Finset ℕ) (hd : 0 < d) (hl : l ≤ d) (f : ℕ → ℝ) : + (∑ b ∈ B, ∑ i ∈ Finset.range l, f (b * d + i)) = + ∑ i ∈ blockIndices d l B, f i := by + rw [blockIndices, Finset.sum_image (block_index_injective d l B hd hl), Finset.sum_product] + +lemma blockIndices_lower (d l a : ℕ) (B : Finset ℕ) (hB : ∀ b ∈ B, a ≤ b * d) : + ∀ i ∈ blockIndices d l B, a ≤ i := by + intro i hi + obtain ⟨⟨b, k⟩, hbk, rfl⟩ := Finset.mem_image.mp hi + exact (hB b (Finset.mem_product.mp hbk).1).trans (Nat.le_add_right _ _) + +lemma sum_supported_le (N : ℕ) (f : ℕ → ℝ) (hf : ∀ i, 0 ≤ f i) + (hzero : ∀ i, N ≤ i → f i = 0) (s : Finset ℕ) : + (∑ i ∈ s, f i) ≤ ∑ i ∈ Finset.range N, f i := by + have he : (∑ i ∈ s, f i) = ∑ i ∈ s.filter (fun i => i < N), f i := by + rw [Finset.sum_filter] + apply Finset.sum_congr rfl + intro i _ + split_ifs with hi + · rfl + · exact hzero i (Nat.le_of_not_gt hi) + rw [he] + apply Finset.sum_le_sum_of_subset_of_nonneg + · intro i hi + exact Finset.mem_range.mpr (Finset.mem_filter.mp hi).2 + · exact fun i _ _ => hf i + +lemma supported_mass (n : ℕ) (u : ℕ → ℝ) (hu : ∀ i, n + 1 ≤ i → u i = 0) + (s : Finset ℕ) : + (∑ i ∈ s, u i ^ 2) ≤ ∑ i ∈ Finset.range (n + 1), u i ^ 2 := + sum_supported_le _ _ (fun i => sq_nonneg _) (fun i hi => by rw [hu i hi]; norm_num) s + +lemma supported_shift_mass (n k : ℕ) (u : ℕ → ℝ) (hu : ∀ i, n + 1 ≤ i → u i = 0) + (s : Finset ℕ) : + (∑ i ∈ s, u (i + k) ^ 2) ≤ ∑ i ∈ Finset.range (n + 1), u i ^ 2 := by + have he : (∑ i ∈ s, u (i + k) ^ 2) = ∑ i ∈ s.image (fun i => i + k), u i ^ 2 := by + rw [Finset.sum_image] + exact fun _ _ _ _ h => Nat.add_right_cancel h + rw [he] + exact supported_mass n u hu _ + +lemma supported_energy_tail (n : ℕ) (u : ℕ → ℝ) (hu : ∀ i, n + 1 ≤ i → u i = 0) + (s : Finset ℕ) (r : ℝ) (hr : ∀ i ∈ s, r ≤ (i + 1 : ℝ) / (n + 1)) : + r * (∑ i ∈ s, u i ^ 2) ≤ 2 * pathEnergy n u := by + calc + _ = ∑ i ∈ s, r * u i ^ 2 := Finset.mul_sum .. + _ ≤ ∑ i ∈ s, (i + 1 : ℝ) / (n + 1) * u i ^ 2 := by + gcongr with i hi + exact hr i hi + _ ≤ ∑ i ∈ Finset.range (n + 1), (i + 1 : ℝ) / (n + 1) * u i ^ 2 := + sum_supported_le _ _ (by intro i; positivity) + (fun i hi => by rw [hu i hi]; ring) s + _ ≤ _ := pathEnergy_weighted_mass n u + +lemma supported_energy_gradient (n : ℕ) (u : ℕ → ℝ) + (hu : ∀ i, n + 1 ≤ i → u i = 0) (s : Finset ℕ) : + (∑ i ∈ s, (u (i + 1) - u i) ^ 2) ≤ 20 * pathEnergy n u := by + have hs := sum_supported_le (n + 1) (fun i => (u (i + 1) - u i) ^ 2) + (fun _ => sq_nonneg _) (fun i hi => by rw [hu i hi, hu (i + 1) (by omega)]; ring) s + rw [Finset.sum_range_succ, hu (n + 1) le_rfl, zero_sub, neg_sq] at hs + have hn := supported_energy_tail n u hu {n} 1 (by + intro i hi + have : i = n := Finset.mem_singleton.mp hi + subst i + rw [div_self (by positivity : (n + 1 : ℝ) ≠ 0)]) + simp only [Finset.sum_singleton, one_mul] at hn + have hg := pathEnergy_gradient n u + linarith + +lemma supported_shift_energy_gradient (n k : ℕ) (u : ℕ → ℝ) + (hu : ∀ i, n + 1 ≤ i → u i = 0) (s : Finset ℕ) : + (∑ i ∈ s, (u (i + k + 1) - u (i + k)) ^ 2) ≤ 20 * pathEnergy n u := by + have he : (∑ i ∈ s, (u (i + k + 1) - u (i + k)) ^ 2) = + ∑ i ∈ s.image (fun i => i + k), (u (i + 1) - u i) ^ 2 := by + rw [Finset.sum_image] + exact fun _ _ _ _ h => Nat.add_right_cancel h + rw [he] + exact supported_energy_gradient n u hu _ + +lemma many_block_prefix_abs_bound (ξ w : ℕ → ℝ) (d : ℕ) (B : Finset ℕ) + (hd : 0 < d) {bnd : ℝ} (hbnd : 0 ≤ bnd) + (hpref : ∀ b ∈ B, ∀ k < d, + |∑ i ∈ Finset.range (k + 1), ξ (b * d + i)| ≤ bnd) : + (∑ b ∈ B, |∑ i ∈ Finset.range d, ξ (b * d + i) * w (b * d + i)|) ≤ + bnd / d * (∑ i ∈ blockIndices d d B, |w i|) + + 2 * bnd * ∑ i ∈ blockIndices d (d - 1) B, |w (i + 1) - w i| := by + have hd' : d - 1 + 1 = d := by omega + have hblock (b : ℕ) (hb : b ∈ B) := block_prefix_weight_bound + (fun i => ξ (b * d + i)) (fun i => w (b * d + i)) (d - 1) hbnd + (fun k hk => hpref b hb k (by omega)) + simp only [hd', Nat.cast_sub (Nat.one_le_iff_ne_zero.mpr (Nat.ne_of_gt hd)), Nat.cast_one, + sub_add_cancel] at hblock + calc + _ ≤ ∑ b ∈ B, (bnd / d * (∑ i ∈ Finset.range d, |w (b * d + i)|) + + 2 * bnd * ∑ i ∈ Finset.range (d - 1), |w (b * d + i + 1) - w (b * d + i)|) := by + exact Finset.sum_le_sum (fun b hb => by simpa only [Nat.add_assoc] using hblock b hb) + _ = _ := by + simp only [Finset.sum_add_distrib, ← Finset.mul_sum] + rw [blockIndices_sum d d B hd le_rfl (fun i => |w i|), + blockIndices_sum d (d - 1) B hd (Nat.sub_le _ _) (fun i => |w (i + 1) - w i|)] + +lemma supported_shift_energy_tail (n k : ℕ) (u : ℕ → ℝ) + (hu : ∀ i, n + 1 ≤ i → u i = 0) (s : Finset ℕ) (r : ℝ) + (hr : ∀ i ∈ s, r ≤ (i + k + 1 : ℕ) / (n + 1 : ℝ)) : + r * (∑ i ∈ s, u (i + k) ^ 2) ≤ 2 * pathEnergy n u := by + have he : (∑ i ∈ s, u (i + k) ^ 2) = ∑ i ∈ s.image (fun i => i + k), u i ^ 2 := by + rw [Finset.sum_image] + exact fun _ _ _ _ h => Nat.add_right_cancel h + rw [he] + apply supported_energy_tail n u hu _ r + intro i hi + rcases Finset.mem_image.mp hi with ⟨j, hj, hji⟩ + subst i + simpa only [Nat.cast_add, Nat.cast_one] using hr j hj + +lemma localized_product_mass (s : Finset ℕ) (u : ℕ → ℝ) {M : ℝ} + (h0 : (∑ i ∈ s, u i ^ 2) ≤ M) (h1 : (∑ i ∈ s, u (i + 1) ^ 2) ≤ M) : + (∑ i ∈ s, |u i * u (i + 1)|) ≤ M := by + have h : (∑ i ∈ s, |u i * u (i + 1)|) ≤ + (∑ i ∈ s, (u i ^ 2 + u (i + 1) ^ 2) / 2) := by + apply Finset.sum_le_sum + intro i _ + rw [abs_mul] + nlinarith [sq_abs (u i), sq_abs (u (i + 1)), sq_nonneg (|u i| - |u (i + 1)|)] + rw [← Finset.sum_div, Finset.sum_add_distrib] at h + linarith + +lemma localized_square_variation (n : ℕ) (u : ℕ → ℝ) + (hu : ∀ i, n + 1 ≤ i → u i = 0) (s : Finset ℕ) {M : ℝ} (hM : 0 ≤ M) + (h0 : (∑ i ∈ s, u i ^ 2) ≤ M) (h1 : (∑ i ∈ s, u (i + 1) ^ 2) ≤ M) : + (∑ i ∈ s, |u (i + 1) ^ 2 - u i ^ 2|) ≤ + Real.sqrt (80 * pathEnergy n u * M) := by + have hs := square_weight_variation s u + have hg := supported_energy_gradient n u hu s + have he := pathEnergy_nonneg n u + have hm : (2 * ∑ i ∈ s, (u i ^ 2 + u (i + 1) ^ 2)) ≤ 4 * M := by + rw [Finset.sum_add_distrib] + linarith + have hn : 0 ≤ ∑ i ∈ s, (u (i + 1) - u i) ^ 2 := by positivity + have hb := mul_le_mul hg hm (by positivity) (by positivity : 0 ≤ 20 * pathEnergy n u) + have hsq : (∑ i ∈ s, |u (i + 1) ^ 2 - u i ^ 2|) ^ 2 ≤ 80 * pathEnergy n u * M := by + nlinarith + exact (Real.le_sqrt (by positivity) (by positivity)).mpr hsq + +lemma localized_product_variation (n : ℕ) (u : ℕ → ℝ) + (hu : ∀ i, n + 1 ≤ i → u i = 0) (s : Finset ℕ) {M : ℝ} (hM : 0 ≤ M) + (h1 : (∑ i ∈ s, u (i + 1) ^ 2) ≤ M) : + (∑ i ∈ s, |u (i + 1) * u (i + 2) - u i * u (i + 1)|) ≤ + Real.sqrt (80 * pathEnergy n u * M) := by + have hs := product_weight_variation s u + have hg0 := supported_energy_gradient n u hu s + have hg1 := supported_shift_energy_gradient n 1 u hu s + have he := pathEnergy_nonneg n u + have hg : (2 * ∑ i ∈ s, ((u (i + 1) - u i) ^ 2 + (u (i + 2) - u (i + 1)) ^ 2)) ≤ + 80 * pathEnergy n u := by + rw [Finset.sum_add_distrib] + simp only [Nat.add_assoc] at hg1 + linarith + have hn : 0 ≤ ∑ i ∈ s, u (i + 1) ^ 2 := by positivity + have hb := mul_le_mul hg h1 hn (by positivity : 0 ≤ 80 * pathEnergy n u) + exact (Real.le_sqrt (by positivity) (by positivity)).mpr (hs.trans hb) + +lemma sum_covered_by_shells (B R : Finset ℕ) (S : ℕ → Finset ℕ) (f : ℕ → ℝ) + (hf : ∀ b, 0 ≤ f b) (hcover : ∀ b ∈ B, ∃ r ∈ R, b ∈ S r) : + (∑ b ∈ B, f b) ≤ ∑ r ∈ R, ∑ b ∈ B.filter (fun b => b ∈ S r), f b := by + simp only [Finset.sum_filter] + rw [Finset.sum_comm] + apply Finset.sum_le_sum + intro b hb + obtain ⟨r, hr, hbr⟩ := hcover b hb + calc + f b = if b ∈ S r then f b else 0 := by rw [ite_eq_left hbr] + _ ≤ ∑ x ∈ R, if b ∈ S x then f b else 0 := by + exact Finset.single_le_sum (f := fun x => if b ∈ S x then f b else 0) + (fun x _ => by split_ifs <;> first | exact hf b | exact le_rfl) hr + +lemma sum_range_eq_of_supported (f : ℕ → ℝ) (N M : ℕ) (hNM : N ≤ M) + (hf : ∀ i, N ≤ i → f i = 0) : + (∑ i ∈ Finset.range M, f i) = ∑ i ∈ Finset.range N, f i := by + symm + apply Finset.sum_subset (Finset.range_mono hNM) + intro i _ hi + exact hf i (Nat.le_of_not_gt (by simpa only [Finset.mem_range] using hi)) + +lemma shell_indices_mass (n j r d l k : ℕ) (u : ℕ → ℝ) + (hu : ∀ i, n + 1 ≤ i → u i = 0) + (hnorm : (∑ i ∈ Finset.range (n + 1), u i ^ 2) = 1) + (B : Finset ℕ) (hB : ∀ b ∈ B, b ∈ blockShell j r) + {σ : ℝ} (hσ : 0 < σ) (he : pathEnergy n u ≤ σ) + (hsize : (n + 1 : ℝ) * σ ≤ (8 : ℝ)^j * d) : + (∑ i ∈ blockIndices d l B, u (i + k) ^ 2) ≤ 2 * (1 / 2 : ℝ) ^ r := by + by_cases hr : r = 0 + · subst r + have hm := supported_shift_mass n k u hu (blockIndices d l B) + rw [hnorm] at hm + simpa only [pow_zero, mul_one] using hm.trans (by norm_num : (1 : ℝ) ≤ 2) + · have hr' : 0 < r := Nat.pos_of_ne_zero hr + have hlo (i : ℕ) (hi : i ∈ blockIndices d l B) : + (2 : ℝ) ^ r * σ ≤ (i + k + 1 : ℕ) / (n + 1 : ℝ) := by + apply (le_div_iff₀ (by positivity : (0 : ℝ) < n + 1)).mpr + have hi' := blockIndices_lower d l (2 ^ r * 8 ^ j * d) B + (fun b hb => Nat.mul_le_mul_right d (blockShell_lower j r b hr' (hB b hb))) i hi + have hc : (2 : ℝ)^r * 8^j * d ≤ (i : ℝ) + k + 1 := by + exact_mod_cast hi'.trans (by omega : i ≤ i + k + 1) + have hm := mul_le_mul_of_nonneg_left hsize (by positivity : (0 : ℝ) ≤ 2^r) + push_cast + nlinarith + have ht := supported_shift_energy_tail n k u hu (blockIndices d l B) + ((2 : ℝ)^r * σ) hlo + have hm : (2 : ℝ)^r * (∑ i ∈ blockIndices d l B, u (i + k)^2) ≤ 2 := by + apply (mul_le_mul_iff_right₀ hσ).mp + nlinarith + have hp : (2 : ℝ)^r * (1 / 2 : ℝ)^r = 1 := by + rw [← mul_pow] + norm_num + nlinarith [show (0 : ℝ) < 2^r by positivity] + +lemma half_pow_le_three_quarters_sq (r : ℕ) : + (1 / 2 : ℝ)^r ≤ ((3 / 4 : ℝ)^r)^2 := by + rw [← pow_mul, mul_comm r 2, pow_mul] + exact pow_le_pow_left₀ (by norm_num) (by norm_num) r + +lemma sqrt_shell_energy_bound {e : ℝ} (he : 0 ≤ e) (r : ℕ) : + Real.sqrt (80 * e * (2 * (1 / 2 : ℝ)^r)) ≤ + 13 * Real.sqrt e * (3 / 4 : ℝ)^r := by + apply (Real.sqrt_le_iff).mpr ⟨by positivity, ?_⟩ + have hp := half_pow_le_three_quarters_sq r + have hs := Real.sq_sqrt he + have hm := mul_le_mul_of_nonneg_left hp (by positivity : 0 ≤ 160 * e) + nlinarith [sq_nonneg ((3 / 4 : ℝ)^r)] + +lemma shell_square_mass_variation (n j r d : ℕ) (u : ℕ → ℝ) + (hu : ∀ i, n + 1 ≤ i → u i = 0) + (hnorm : (∑ i ∈ Finset.range (n + 1), u i ^ 2) = 1) + (B : Finset ℕ) (hB : ∀ b ∈ B, b ∈ blockShell j r) + {σ : ℝ} (hσ : 0 < σ) (he : pathEnergy n u ≤ σ) + (hsize : (n + 1 : ℝ) * σ ≤ (8 : ℝ)^j * d) : + (∑ i ∈ blockIndices d d B, |u i ^ 2|) ≤ 2 * (3 / 4 : ℝ)^r ∧ + (∑ i ∈ blockIndices d (d - 1) B, |u (i + 1)^2 - u i^2|) ≤ + 13 * Real.sqrt (pathEnergy n u) * (3 / 4 : ℝ)^r := by + have hm (l k : ℕ) := shell_indices_mass n j r d l k u hu hnorm B hB hσ he hsize + constructor + · simp only [abs_sq] + have h0 := hm d 0 + simp only [Nat.add_zero] at h0 + exact h0.trans (mul_le_mul_of_nonneg_left + (pow_le_pow_left₀ (by norm_num) (by norm_num : (1 / 2 : ℝ) ≤ 3 / 4) _) (by norm_num)) + · apply (localized_square_variation n u hu _ (by positivity) + (by simpa only [Nat.add_zero] using hm (d - 1) 0) (hm (d - 1) 1)).trans + exact sqrt_shell_energy_bound (pathEnergy_nonneg n u) r + +lemma shell_product_mass_variation (n j r d : ℕ) (u : ℕ → ℝ) + (hu : ∀ i, n + 1 ≤ i → u i = 0) + (hnorm : (∑ i ∈ Finset.range (n + 1), u i ^ 2) = 1) + (B : Finset ℕ) (hB : ∀ b ∈ B, b ∈ blockShell j r) + {σ : ℝ} (hσ : 0 < σ) (he : pathEnergy n u ≤ σ) + (hsize : (n + 1 : ℝ) * σ ≤ (8 : ℝ)^j * d) : + (∑ i ∈ blockIndices d d B, |u i * u (i + 1)|) ≤ 2 * (3 / 4 : ℝ)^r ∧ + (∑ i ∈ blockIndices d (d - 1) B, |u (i + 1) * u (i + 2) - u i * u (i + 1)|) ≤ + 13 * Real.sqrt (pathEnergy n u) * (3 / 4 : ℝ)^r := by + have hm (l k : ℕ) := shell_indices_mass n j r d l k u hu hnorm B hB hσ he hsize + constructor + · apply (localized_product_mass _ u + (by simpa only [Nat.add_zero] using hm d 0) (hm d 1)).trans + exact mul_le_mul_of_nonneg_left + (pow_le_pow_left₀ (by norm_num) (by norm_num : (1 / 2 : ℝ) ≤ 3 / 4) _) (by norm_num) + · exact (localized_product_variation n u hu _ (by positivity) (hm (d - 1) 1)).trans + (sqrt_shell_energy_bound (pathEnergy_nonneg n u) r) + +lemma weighted_geometric_three_quarters (N : ℕ) : + (∑ r ∈ Finset.range N, (r + 1 : ℝ) * (3 / 4 : ℝ)^r) ≤ 16 := by + have hident : (∑ r ∈ Finset.range N, (r + 1 : ℝ) * (3 / 4 : ℝ)^r) = + 16 - (4 * N + 16) * (3 / 4 : ℝ)^N := by + induction N with + | zero => norm_num + | succ N ih => rw [Finset.sum_range_succ, ih, pow_succ]; push_cast; ring + rw [hident] + have : 0 ≤ (4 * N + 16) * (3 / 4 : ℝ)^N := by positivity + linarith + +lemma shifted_weighted_geometric {a : ℝ} (ha : 1 ≤ a) (N : ℕ) : + (∑ r ∈ Finset.range N, (a + r) * (3 / 4 : ℝ)^r) ≤ 16 * a := by + calc + _ ≤ ∑ r ∈ Finset.range N, a * ((r + 1) * (3 / 4 : ℝ)^r) := by + apply Finset.sum_le_sum + intro r _ + have h : a + r ≤ a * (r + 1) := by nlinarith [show (0 : ℝ) ≤ r by positivity] + nlinarith [mul_le_mul_of_nonneg_right h (by positivity : (0 : ℝ) ≤ (3 / 4 : ℝ)^r)] + _ = a * ∑ r ∈ Finset.range N, (r + 1 : ℝ) * (3 / 4 : ℝ)^r := by rw [Finset.mul_sum] + _ ≤ 16 * a := by nlinarith [weighted_geometric_three_quarters N] + +lemma weighted_multiscale_prefix (ξ w : ℕ → ℝ) (N j d : ℕ) (hd : 0 < d) + (hw : ∀ i, N ≤ i → w i = 0) {h K e : ℝ} (hh : 0 ≤ h) (hK : 0 ≤ K) (_he : 0 ≤ e) + (hpref : ∀ r < N, ∀ b < N, b ∈ blockShell j r → ∀ k < d, + |∑ i ∈ Finset.range (k + 1), ξ (b * d + i)| ≤ K * (h + j + r + 1)) + (hmass : ∀ r < N, (∑ i ∈ blockIndices d d + ((Finset.range N).filter (fun b => b ∈ blockShell j r)), |w i|) ≤ 2 * (3 / 4 : ℝ)^r) + (hvar : ∀ r < N, (∑ i ∈ blockIndices d (d - 1) + ((Finset.range N).filter (fun b => b ∈ blockShell j r)), |w (i + 1) - w i|) ≤ + 13 * Real.sqrt e * (3 / 4 : ℝ)^r) : + |∑ i ∈ Finset.range N, ξ i * w i| ≤ + 32 * K * (h + j + 1) * (1 / d + 13 * Real.sqrt e) := by + have hblock (r : ℕ) (hr : r < N) := many_block_prefix_abs_bound ξ w d + ((Finset.range N).filter (fun b => b ∈ blockShell j r)) hd + (by positivity : 0 ≤ K * (h + j + r + 1)) + (fun b hb k hk => hpref r hr b (Finset.mem_range.mp (Finset.mem_filter.mp hb).1) + (Finset.mem_filter.mp hb).2 k hk) + have hblock' (r : ℕ) (hr : r < N) : + (∑ b ∈ (Finset.range N).filter (fun b => b ∈ blockShell j r), + |∑ i ∈ Finset.range d, ξ (b * d + i) * w (b * d + i)|) ≤ + K * (2 / d + 26 * Real.sqrt e) * ((h + j + 1 + r) * (3 / 4 : ℝ)^r) := by + calc + _ ≤ K * (h + j + r + 1) / d * (2 * (3 / 4 : ℝ)^r) + + 2 * (K * (h + j + r + 1)) * (13 * Real.sqrt e * (3 / 4 : ℝ)^r) := by + apply (hblock r hr).trans + exact add_le_add (mul_le_mul_of_nonneg_left (hmass r hr) (by positivity)) + (mul_le_mul_of_nonneg_left (hvar r hr) (by positivity)) + _ = _ := by ring + have hsum : (∑ i ∈ Finset.range N, ξ i * w i) = + ∑ b ∈ Finset.range N, ∑ i ∈ Finset.range d, ξ (b * d + i) * w (b * d + i) := by + rw [sum_consecutive_blocks N d (fun i => ξ i * w i)] + symm + exact sum_range_eq_of_supported (fun i => ξ i * w i) N (N * d) + (by nlinarith) (fun i hi => by rw [hw i hi, mul_zero]) + rw [hsum] + calc + _ ≤ ∑ b ∈ Finset.range N, |∑ i ∈ Finset.range d, ξ (b * d + i) * w (b * d + i)| := + Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ r ∈ Finset.range N, ∑ b ∈ (Finset.range N).filter (fun b => b ∈ blockShell j r), + |∑ i ∈ Finset.range d, ξ (b * d + i) * w (b * d + i)| := by + apply sum_covered_by_shells _ _ (blockShell j) _ (fun _ => abs_nonneg _) + intro b hb + obtain ⟨r, hr, hbr⟩ := blockShell_covers j b + exact ⟨r, Finset.mem_range.mpr (hr.trans_lt (Finset.mem_range.mp hb)), hbr⟩ + _ ≤ ∑ r ∈ Finset.range N, + K * (2 / d + 26 * Real.sqrt e) * ((h + j + 1 + r) * (3 / 4 : ℝ)^r) := by + exact Finset.sum_le_sum (fun r hr => hblock' r (Finset.mem_range.mp hr)) + _ = K * (2 / d + 26 * Real.sqrt e) * + (∑ r ∈ Finset.range N, ((h + j + 1 + r) * (3 / 4 : ℝ)^r)) := by rw [Finset.mul_sum] + _ ≤ K * (2 / d + 26 * Real.sqrt e) * (16 * (h + j + 1)) := by + exact mul_le_mul_of_nonneg_left (shifted_weighted_geometric (by linarith [show (0 : ℝ) ≤ j by positivity]) N) (by positivity) + _ = _ := by ring + +lemma square_multiscale_prefix (ξ : ℕ → ℝ) (n j d : ℕ) (hd : 0 < d) (u : ℕ → ℝ) + (hu : ∀ i, n + 1 ≤ i → u i = 0) + (hnorm : (∑ i ∈ Finset.range (n + 1), u i ^ 2) = 1) + {σ h K : ℝ} (hσ : 0 < σ) (hh : 0 ≤ h) (hK : 0 ≤ K) + (he : pathEnergy n u ≤ σ) (hsize : (n + 1 : ℝ) * σ ≤ (8 : ℝ)^j * d) + (hpref : ∀ r < n + 1, ∀ b < n + 1, b ∈ blockShell j r → ∀ k < d, + |∑ i ∈ Finset.range (k + 1), ξ (b * d + i)| ≤ K * (h + j + r + 1)) : + |∑ i ∈ Finset.range (n + 1), ξ i * u i^2| ≤ + 32 * K * (h + j + 1) * (1 / d + 13 * Real.sqrt (pathEnergy n u)) := by + have hmv (r : ℕ) := shell_square_mass_variation n j r d u hu hnorm + ((Finset.range (n + 1)).filter (fun b => b ∈ blockShell j r)) + (fun _ hb => (Finset.mem_filter.mp hb).2) hσ he hsize + exact weighted_multiscale_prefix ξ (fun i => u i^2) (n + 1) j d hd + (fun i hi => by rw [hu i hi]; norm_num) hh hK (pathEnergy_nonneg n u) hpref + (fun r _ => (hmv r).1) (fun r _ => (hmv r).2) + +lemma product_multiscale_prefix (ξ : ℕ → ℝ) (n j d : ℕ) (hd : 0 < d) (u : ℕ → ℝ) + (hu : ∀ i, n + 1 ≤ i → u i = 0) + (hnorm : (∑ i ∈ Finset.range (n + 1), u i ^ 2) = 1) + {σ h K : ℝ} (hσ : 0 < σ) (hh : 0 ≤ h) (hK : 0 ≤ K) + (he : pathEnergy n u ≤ σ) (hsize : (n + 1 : ℝ) * σ ≤ (8 : ℝ)^j * d) + (hpref : ∀ r < n + 1, ∀ b < n + 1, b ∈ blockShell j r → ∀ k < d, + |∑ i ∈ Finset.range (k + 1), ξ (b * d + i)| ≤ K * (h + j + r + 1)) : + |∑ i ∈ Finset.range (n + 1), ξ i * (u i * u (i + 1))| ≤ + 32 * K * (h + j + 1) * (1 / d + 13 * Real.sqrt (pathEnergy n u)) := by + have hmv (r : ℕ) := shell_product_mass_variation n j r d u hu hnorm + ((Finset.range (n + 1)).filter (fun b => b ∈ blockShell j r)) + (fun _ hb => (Finset.mem_filter.mp hb).2) hσ he hsize + exact weighted_multiscale_prefix ξ (fun i => u i * u (i + 1)) (n + 1) j d hd + (fun i hi => by rw [hu i hi, zero_mul]) hh hK (pathEnergy_nonneg n u) hpref + (fun r _ => (hmv r).1) (fun r _ => by simpa only [Nat.add_assoc] using (hmv r).2) + +lemma blockThreshold_linear_bound (c : ℝ≥0) (m j r : ℕ) {h : ℝ} (hh : 0 ≤ h) : + blockThreshold c m j r h ≤ + Real.sqrt (32 * (c : ℝ)) * Real.sqrt (m + 1) * (h + j + r + 1) := by + have hlog : Real.log 16 ≤ 15 := by + convert Real.log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 16) using 1 + norm_num + have hjr : (0 : ℝ) ≤ j + r := by positivity + have hq : h^2 + (j + r : ℕ) * Real.log 16 ≤ 16 * (h + j + r + 1)^2 := by + push_cast + nlinarith [mul_le_mul_of_nonneg_left hlog hjr, mul_nonneg hh hjr, + sq_nonneg h, sq_nonneg ((j : ℝ) + r)] + unfold blockThreshold + apply Real.sqrt_le_iff.mpr ⟨by positivity, ?_⟩ + calc + _ ≤ 2 * (m + 1) * (c : ℝ) * (16 * (h + j + r + 1)^2) := + mul_le_mul_of_nonneg_left hq (by positivity) + _ = _ := by + rw [mul_pow, mul_pow, Real.sq_sqrt (by positivity), Real.sq_sqrt (by positivity)] + ring + +lemma blockThreshold_length_bound (c : ℝ≥0) (d j r : ℕ) (hd : 0 < d) {h : ℝ} (hh : 0 ≤ h) : + blockThreshold c (d - 1) j r h ≤ + Real.sqrt (32 * (c : ℝ)) * Real.sqrt d * (h + j + r + 1) := by + have hd' : (d - 1 : ℝ) + 1 = d := by ring + have hnat : 1 ≤ d := hd + simpa only [Nat.cast_sub hnat, Nat.cast_one, hd'] using blockThreshold_linear_bound c (d - 1) j r hh + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/Cavity.lean b/lean/OAI/MathematicalPhysics/CriticalSK/Cavity.lean new file mode 100644 index 0000000000000000000000000000000000000000..df7cce6b4087716c43b1dfcaaf436bb36c8627f3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/Cavity.lean @@ -0,0 +1,485 @@ +import OAI.MathematicalPhysics.CriticalSK.HeatBath +import OAI.MathematicalPhysics.CriticalSK.SphereGeometry + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +namespace CriticalSK + +section + +open Set Filter MeasureTheory + +variable {n : ℕ} + +def flipSite (i : Fin n) (x : Spin n) : Spin n := Function.update x i (!(x i)) + +@[simp] lemma flipSite_apply_self (i : Fin n) (x : Spin n) : flipSite i x i = !(x i) := by simp [flipSite] + +@[simp] lemma flipSite_apply_ne (i : Fin n) (x : Spin n) {j : Fin n} (h : j ≠ i) : flipSite i x j = x j := by simp [flipSite,h] + +@[simp] lemma flipSite_involutive (i : Fin n) (x : Spin n) : flipSite i (flipSite i x) = x := by + funext j + by_cases hj : j=i + · subst j; simp + · simp [hj] + +lemma flipSite_ne (i : Fin n) (x : Spin n) : flipSite i x ≠ x := by + intro hh + have he := congrFun hh i + simp only [flipSite_apply_self] at he + cases h : x i <;> simp_all + +def flipSiteEquiv (i : Fin n) : Spin n ≃ Spin n where + toFun := flipSite i + invFun := flipSite i + left_inv := flipSite_involutive i + right_inv := flipSite_involutive i + +lemma sameExcept_flipSite (i : Fin n) (x : Spin n) : sameExcept i x (flipSite i x) := by + intro j hj + exact flipSite_apply_ne i x hj + +lemma sameExcept_two (i : Fin n) (x y : Spin n) : + sameExcept i x y ↔ y=x ∨ y=flipSite i x := by + constructor + · intro h + by_cases he : y i=x i + · left + funext j + by_cases hj : j=i + · simpa only [hj] using he + · exact h j hj + · right + funext j + by_cases hj : j=i + · subst j + simp only [flipSite_apply_self] + cases hx : x i <;> cases hy : y i <;> simp_all + · rw [flipSite_apply_ne i x hj] + exact h j hj + · rintro (h|h) + · subst y; exact sameExcept_refl i x + · subst y; exact sameExcept_flipSite i x + +lemma sum_sameExcept (i : Fin n) (x : Spin n) (f : Spin n → ℝ) : + (∑ y : Spin n, if sameExcept i x y then f y else 0) = f x+f (flipSite i x) := by + classical + have he (y : Spin n) : (if sameExcept i x y then f y else 0) = + (if y=x then f x else 0)+(if y=flipSite i x then f (flipSite i x) else 0) := by + simp only [sameExcept_two] + have hne := flipSite_ne i x + split_ifs <;> simp_all + simp_rw [he] + simp [Finset.sum_add_distrib] + +def incidentCoeff (i : Fin n) (x : Spin n) (e : Edge n) : ℝ := + if e.val.1=i then spinValue (x e.val.2) else if e.val.2=i then spinValue (x e.val.1) else 0 + +def localField (W : Disorder n) (i : Fin n) (x : Spin n) : ℝ := + ∑ e : Edge n, W e*incidentCoeff i x e + +def deleteDisorder (W : Disorder n) (i : Fin n) : Disorder n := + fun e => if e.val.1=i ∨ e.val.2=i then 0 else W e + +lemma incidentCoeff_fiber {i : Fin n} {x y : Spin n} (h : sameExcept i x y) (e : Edge n) : + incidentCoeff i y e = incidentCoeff i x e := by + unfold incidentCoeff + have hne : e.val.1 ≠ e.val.2 := ne_of_lt e.property + split_ifs with h1 h2 + · rw [h e.val.2 (by grind)] + · rw [h e.val.1 h1] + · rfl + +lemma localField_fiber (W : Disorder n) {i : Fin n} {x y : Spin n} (h : sameExcept i x y) : + localField W i y = localField W i x := by + simp_rw [localField,incidentCoeff_fiber h] + +lemma delete_hamiltonian_fiber (W : Disorder n) {i : Fin n} {x y : Spin n} (h : sameExcept i x y) : + hamiltonian (deleteDisorder W i) y = hamiltonian (deleteDisorder W i) x := by + unfold hamiltonian deleteDisorder + apply Finset.sum_congr rfl + intro e _ + split_ifs with he + · simp + · rw [h e.val.1 (fun hh => he (Or.inl hh)), h e.val.2 (fun hh => he (Or.inr hh))] + +lemma hamiltonian_cavity (W : Disorder n) (i : Fin n) (x : Spin n) : + hamiltonian W x = hamiltonian (deleteDisorder W i) x+spinValue (x i)*localField W i x := by + simp only [hamiltonian,localField,Finset.mul_sum,← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro e _ + unfold deleteDisorder incidentCoeff + by_cases h1 : e.val.1=i + · simp [h1]; ring + · by_cases h2 : e.val.2=i + · simp [h1,h2]; ring + · simp [h1,h2] + +lemma gibbs_delete_fiber (W : Disorder n) {i : Fin n} {x y : Spin n} (h : sameExcept i x y) : + gibbs (deleteDisorder W i) y = gibbs (deleteDisorder W i) x := by + simp only [gibbs,delete_hamiltonian_fiber W h] + +lemma cavity_exp_pair (W : Disorder n) (i : Fin n) (x : Spin n) : + (Real.exp (hamiltonian W x)+Real.exp (hamiltonian W (flipSite i x)))/2 = + Real.exp (hamiltonian (deleteDisorder W i) x)*Real.cosh (localField W i x) := by + rw [hamiltonian_cavity W i x,hamiltonian_cavity W i (flipSite i x), + localField_fiber W (sameExcept_flipSite i x),delete_hamiltonian_fiber W (sameExcept_flipSite i x)] + simp only [Real.exp_add,flipSite_apply_self,spinValue_not,Real.cosh_eq] + cases x i <;> simp only [spinValue,Bool.false_eq_true,ite_false,ite_true,one_mul,neg_one_mul,neg_neg] <;> ring + +def cavityNormalization (W : Disorder n) (i : Fin n) : ℝ := + mean (deleteDisorder W i) (fun x => Real.cosh (localField W i x)) + +lemma cavityNormalization_ge_one (W : Disorder n) (i : Fin n) : 1 ≤ cavityNormalization W i := by + rw [cavityNormalization,← mean_const (deleteDisorder W i) 1] + exact mean_mono _ (fun _ => Real.one_le_cosh _) + +lemma partition_cavity (W : Disorder n) (i : Fin n) : + partition W = partition (deleteDisorder W i)*cavityNormalization W i := by + have hh : ∑ x : Spin n, Real.exp (hamiltonian W (flipSite i x)) = partition W := + (flipSiteEquiv i).sum_comp (fun x => Real.exp (hamiltonian W x)) + have hs := congrArg (fun f : Spin n → ℝ => ∑ x, f x) (funext (cavity_exp_pair W i)) + rw [← Finset.sum_div,Finset.sum_add_distrib,hh] at hs + change (partition W+partition W)/2 = _ at hs + unfold cavityNormalization mean gibbs + simp only [Finset.mul_sum] + rw [show (fun x : Spin n => partition (deleteDisorder W i)*(Real.exp (hamiltonian (deleteDisorder W i) x)/partition (deleteDisorder W i)*Real.cosh (localField W i x))) = + (fun x => Real.exp (hamiltonian (deleteDisorder W i) x)*Real.cosh (localField W i x)) by + funext x + field_simp [ne_of_gt (partition_pos (deleteDisorder W i))]] + linarith + +lemma gibbs_cavity (W : Disorder n) (i : Fin n) (x : Spin n) : + gibbs W x = gibbs (deleteDisorder W i) x*Real.exp (spinValue (x i)*localField W i x)/cavityNormalization W i := by + simp only [gibbs,partition_cavity W i,hamiltonian_cavity W i x,Real.exp_add] + ring + +lemma gibbs_cavity_pair (W : Disorder n) (i : Fin n) (x : Spin n) : + (gibbs W x+gibbs W (flipSite i x))/2 = + gibbs (deleteDisorder W i) x*Real.cosh (localField W i x)/cavityNormalization W i := by + unfold gibbs + rw [← add_div] + rw [show (Real.exp (hamiltonian W x)+Real.exp (hamiltonian W (flipSite i x)))/partition W/2 = + ((Real.exp (hamiltonian W x)+Real.exp (hamiltonian W (flipSite i x)))/2)/partition W by ring] + rw [cavity_exp_pair,partition_cavity W i] + ring + +lemma mean_cavity_even (W : Disorder n) (i : Fin n) (f : Spin n → ℝ) + (hf : ∀ x, f (flipSite i x)=f x) : + mean W f = mean (deleteDisorder W i) (fun x => Real.cosh (localField W i x)*f x)/cavityNormalization W i := by + have hh : ∑ x : Spin n, gibbs W (flipSite i x)*f (flipSite i x) = mean W f := + (flipSiteEquiv i).sum_comp (fun x => gibbs W x*f x) + simp_rw [hf] at hh + have hs := congrArg (fun g : Spin n → ℝ => ∑ x, g x) (funext (fun x => congrArg (fun a : ℝ => a*f x) (gibbs_cavity_pair W i x))) + simp only [add_div,add_mul,div_mul_eq_mul_div,Finset.sum_add_distrib,← Finset.sum_div,hh] at hs + unfold mean at * + simp only [mul_assoc] at hs + linarith + +lemma siteAverage_two (W : Disorder n) (i : Fin n) (f : Spin n → ℝ) (x : Spin n) : + siteAverage W i f x = (gibbs W x*f x+gibbs W (flipSite i x)*f (flipSite i x))/(gibbs W x+gibbs W (flipSite i x)) := by + rw [siteAverage_eq] + simp only [siteKernel] + have he (y : Spin n) : (if sameExcept i x y then gibbs W y/(∑ z, if sameExcept i x z then gibbs W z else 0) else 0)*f y = + (if sameExcept i x y then gibbs W y*f y else 0)/(∑ z, if sameExcept i x z then gibbs W z else 0) := by + split_ifs <;> ring + simp_rw [he] + rw [← Finset.sum_div,sum_sameExcept,sum_sameExcept] + +lemma siteAverage_spin (W : Disorder n) (i : Fin n) (x : Spin n) : + siteAverage W i (fun y => spinValue (y i)) x = Real.sinh (localField W i x)/Real.cosh (localField W i x) := by + rw [siteAverage_two,gibbs_cavity W i x,gibbs_cavity W i (flipSite i x), + gibbs_delete_fiber W (sameExcept_flipSite i x),localField_fiber W (sameExcept_flipSite i x)] + have hg := ne_of_gt (gibbs_pos (deleteDisorder W i) x) + have hZ : cavityNormalization W i ≠ 0 := ne_of_gt (lt_of_lt_of_le zero_lt_one (cavityNormalization_ge_one W i)) + rw [Real.sinh_eq,Real.cosh_eq] + simp only [flipSite_apply_self,spinValue_not] + cases x i <;> simp only [spinValue,Bool.false_eq_true,ite_false,ite_true,one_mul,neg_one_mul,neg_neg] <;> + field_simp [hg,hZ] <;> ring + +def alphaSite (W : Disorder n) (i : Fin n) : ℝ := mean W (fun x => (Real.cosh (localField W i x))⁻¹^2) + +lemma alphaSite_pos (W : Disorder n) (i : Fin n) : 0 < alphaSite W i := by + unfold alphaSite mean + exact Finset.sum_pos (fun _ _ => mul_pos (gibbs_pos W _) (sq_pos_of_pos (inv_pos.mpr (Real.cosh_pos _)))) Finset.univ_nonempty + +end + +section + +open Set Filter MeasureTheory + +variable {n : ℕ} (W : Disorder n) + +lemma mean_mul_mean_inv {f : Spin n → ℝ} (hf : ∀ x, 0 < f x) : + 1 ≤ mean W f*mean W (fun x => (f x)⁻¹) := by + have hh := Finset.sum_sq_le_sum_mul_sum_of_sq_le_mul Finset.univ + (r := gibbs W) (f := fun x => gibbs W x*f x) (g := fun x => gibbs W x*(f x)⁻¹) + (fun x _ => mul_nonneg (gibbs_nonneg W x) (hf x).le) + (fun x _ => mul_nonneg (gibbs_nonneg W x) (inv_nonneg.mpr (hf x).le)) + (fun x _ => by apply le_of_eq; field_simp [ne_of_gt (hf x)]) + simpa only [gibbs_sum,one_pow,mean] using hh + +lemma alphaSite_cavity (i : Fin n) : + alphaSite W i = mean (deleteDisorder W i) (fun x => (Real.cosh (localField W i x))⁻¹)/cavityNormalization W i := by + rw [alphaSite,mean_cavity_even W i _ (fun x => by rw [localField_fiber W (sameExcept_flipSite i x)])] + congr 1 + congr 1 + funext x + field_simp + +lemma alphaSite_normalization (i : Fin n) : 1 ≤ alphaSite W i*cavityNormalization W i^2 := by + have hh := mean_mul_mean_inv (deleteDisorder W i) (fun x => Real.cosh_pos (localField W i x)) + rw [alphaSite_cavity] + have hZ : cavityNormalization W i ≠ 0 := ne_of_gt (lt_of_lt_of_le zero_lt_one (cavityNormalization_ge_one W i)) + convert hh using 1 + dsimp only [cavityNormalization] at * + field_simp + +lemma one_sub_tanh_sq (z : ℝ) : 1-(Real.sinh z/Real.cosh z)^2 = (Real.cosh z)⁻¹^2 := by + have hh := Real.cosh_sq_sub_sinh_sq z + have hc := ne_of_gt (Real.cosh_pos z) + field_simp + nlinarith + +lemma site_spin_variance (i : Fin n) : + mean W (fun x => (spinValue (x i)-siteAverage W i (fun y => spinValue (y i)) x)^2) = alphaSite W i := by + rw [siteAverage_form_identity] + have he : (fun x : Spin n => spinValue (x i)*(spinValue (x i)-siteAverage W i (fun y => spinValue (y i)) x)) = + (fun x => 1-spinValue (x i)*siteAverage W i (fun y => spinValue (y i)) x) := by + funext x + have hh := spinValue_sq (x i) + nlinarith + rw [he,mean_sub,siteAverage_self_square,← mean_sub] + simp_rw [siteAverage_spin,one_sub_tanh_sq] + rfl + +lemma siteAverage_const_mul (i : Fin n) (c : ℝ) (f : Spin n → ℝ) : + siteAverage W i (fun x => c*f x) = fun x => c*siteAverage W i f x := by + funext x + simp only [siteAverage_eq,Finset.mul_sum] + apply Finset.sum_congr rfl + intro y _ + ring + +lemma siteAverage_linear_residual (i : Fin n) (a : Fin n → ℝ) (x : Spin n) : + linearObservable a x-siteAverage W i (linearObservable a) x = + a i*(spinValue (x i)-siteAverage W i (fun y => spinValue (y i)) x) := by + have he : linearObservable a = fun y => a i*spinValue (y i)+linearRest a i y := + funext (linearObservable_split a i) + rw [he,siteAverage_add,siteAverage_const_mul, + siteAverage_of_fiber_constant W i _ (linearRest_fiber_constant a i)] + ring + +lemma dirichlet_linear_eq (a : Fin n → ℝ) : + dirichlet W (linearObservable a) = ∑ i, alphaSite W i*a i^2 := by + unfold dirichlet + simp_rw [← siteAverage_eq,siteAverage_linear_residual,mul_pow,mean_const_mul,site_spin_variance] + congr 1 + funext i + ring + +lemma dirichlet_linear_pos {a : Fin n → ℝ} (ha : a ≠ 0) : + 0 < dirichlet W (linearObservable a) := by + obtain ⟨i,hi⟩ := Function.ne_iff.mp ha + rw [dirichlet_linear_eq] + apply Finset.sum_pos' (fun j _ => mul_nonneg (alphaSite_pos W j).le (sq_nonneg _)) + exact ⟨i,Finset.mem_univ i,mul_pos (alphaSite_pos W i) (sq_pos_of_ne_zero hi)⟩ + +lemma mean_delete_le (i : Fin n) (f : Spin n → ℝ) (hf : ∀ x, 0 ≤ f x) + (hflip : ∀ x, f (flipSite i x)=f x) : + mean (deleteDisorder W i) f ≤ cavityNormalization W i*mean W f := by + rw [mean_cavity_even W i f hflip] + have hZ : cavityNormalization W i ≠ 0 := ne_of_gt (lt_of_lt_of_le zero_lt_one (cavityNormalization_ge_one W i)) + rw [mul_div_cancel₀ _ hZ] + exact mean_mono _ (fun x => le_mul_of_one_le_left (hf x) (Real.one_le_cosh _)) + +def cavityOverlapCoord (i : Fin n) (x y : Spin n) : ℝ := + (∑ j ∈ Finset.univ.erase i, spinValue (x j)*spinValue (y j))/(n:ℝ) + +def cavityOverlap (i : Fin n) : ℝ := + mean (deleteDisorder W i) (fun x => mean (deleteDisorder W i) (fun y => cavityOverlapCoord i x y^2)) + +lemma cavityOverlapCoord_eq (i : Fin n) (x y : Spin n) : + cavityOverlapCoord i x y = cubeOverlap x y-spinValue (x i)*spinValue (y i)/(n:ℝ) := by + rw [cubeOverlap_signMean] + unfold signMean cavityOverlapCoord + simp only [spinProduct,spinValue_beq] + rw [← Finset.add_sum_erase _ _ (Finset.mem_univ i)] + ring + +lemma cavityOverlapCoord_fiber_left {i : Fin n} {x x' : Spin n} (h : sameExcept i x x') (y : Spin n) : + cavityOverlapCoord i x' y = cavityOverlapCoord i x y := by + unfold cavityOverlapCoord + congr 1 + apply Finset.sum_congr rfl + intro j hj + rw [h j (Finset.ne_of_mem_erase hj)] + +lemma cavityOverlapCoord_comm (i : Fin n) (x y : Spin n) : cavityOverlapCoord i x y = cavityOverlapCoord i y x := by + unfold cavityOverlapCoord + simp only [mul_comm] + +lemma cavityOverlap_nonneg (i : Fin n) : 0 ≤ cavityOverlap W i := + mean_nonneg _ (fun _ => mean_nonneg _ (fun _ => sq_nonneg _)) + +lemma cavityOverlap_compare (i : Fin n) : + cavityOverlap W i ≤ 2*cavityNormalization W i^2*(gibbsOverlap W+(n:ℝ)⁻¹^2) := by + have hZ := (cavityNormalization_ge_one W i).trans' zero_le_one + have hfirst := mean_delete_le W i (fun x => mean (deleteDisorder W i) (fun y => cavityOverlapCoord i x y^2)) + (fun _ => mean_nonneg _ (fun _ => sq_nonneg _)) + (fun x => by simp_rw [cavityOverlapCoord_fiber_left (sameExcept_flipSite i x)]) + have hsecond (x : Spin n) := mean_delete_le W i (fun y => cavityOverlapCoord i x y^2) + (fun _ => sq_nonneg _) (fun y => by rw [cavityOverlapCoord_comm i x (flipSite i y), + cavityOverlapCoord_fiber_left (sameExcept_flipSite i y),cavityOverlapCoord_comm]) + have hpoint (x y : Spin n) : cavityOverlapCoord i x y^2 ≤ 2*(cubeOverlap x y)^2+2*(n:ℝ)⁻¹^2 := by + rw [cavityOverlapCoord_eq] + have hh : (spinValue (x i)*spinValue (y i)/(n:ℝ))^2 = (n:ℝ)⁻¹^2 := by + rw [div_pow,mul_pow,spinValue_sq,spinValue_sq,one_mul,one_div,inv_pow] + nlinarith [sq_nonneg (cubeOverlap x y+spinValue (x i)*spinValue (y i)/(n:ℝ))] + have hQ : mean W (fun x => mean W (fun y => 2*(cubeOverlap x y)^2+2*(n:ℝ)⁻¹^2)) = + 2*gibbsOverlap W+2*(n:ℝ)⁻¹^2 := by + simp_rw [mean_add,mean_const_mul,mean_const] + unfold mean gibbsOverlap + simp only [Finset.mul_sum,mul_assoc] + calc + cavityOverlap W i ≤ cavityNormalization W i*mean W (fun x => mean (deleteDisorder W i) (fun y => cavityOverlapCoord i x y^2)) := hfirst + _ ≤ cavityNormalization W i*mean W (fun x => cavityNormalization W i*mean W (fun y => cavityOverlapCoord i x y^2)) := + mul_le_mul_of_nonneg_left (mean_mono W hsecond) hZ + _ = cavityNormalization W i^2*mean W (fun x => mean W (fun y => cavityOverlapCoord i x y^2)) := by rw [mean_const_mul]; ring + _ ≤ cavityNormalization W i^2*mean W (fun x => mean W (fun y => 2*(cubeOverlap x y)^2+2*(n:ℝ)⁻¹^2)) := + mul_le_mul_of_nonneg_left (mean_mono W (fun x => mean_mono W (hpoint x))) (sq_nonneg _) + _ = _ := by rw [hQ]; ring + +end + +open Set Filter MeasureTheory ProbabilityTheory + +variable {n : ℕ} + +def touches (i : Fin n) (e : Edge n) : Prop := e.val.1=i ∨ e.val.2=i + +instance (i : Fin n) : DecidablePred (touches i) := fun _ => Classical.propDecidable _ + +abbrev Incident (i : Fin n) := {e : Edge n // touches i e} + +abbrev Nonincident (i : Fin n) := {e : Edge n // ¬touches i e} + +def edgeOfOther (i j : Fin n) (h : j ≠ i) : Edge n := + if hij : i < j then ⟨(i,j),hij⟩ else ⟨(j,i),lt_of_le_of_ne (le_of_not_gt hij) h⟩ + +lemma edgeOfOther_touches (i j : Fin n) (h : j ≠ i) : touches i (edgeOfOther i j h) := by + unfold edgeOfOther touches + split_ifs <;> simp + +def otherEnd (i : Fin n) (e : Incident i) : Fin n := + if e.val.val.1=i then e.val.val.2 else e.val.val.1 + +lemma otherEnd_ne (i : Fin n) (e : Incident i) : otherEnd i e ≠ i := by + unfold otherEnd + have hlt := e.val.property + split_ifs <;> grind + +def incidentOtherEquiv (i : Fin n) : Incident i ≃ {j : Fin n // j ≠ i} where + toFun e := ⟨otherEnd i e,otherEnd_ne i e⟩ + invFun j := ⟨edgeOfOther i j.val j.property,edgeOfOther_touches i j.val j.property⟩ + left_inv e := by + apply Subtype.ext + apply Subtype.ext + have he := e.property + have hlt := e.val.property + dsimp only [touches] at he + dsimp only [otherEnd,edgeOfOther] + split_ifs <;> ext <;> grind + right_inv j := by + apply Subtype.ext + dsimp only [otherEnd,edgeOfOther] + split_ifs <;> grind + +lemma incidentCoeff_other (i : Fin n) (x : Spin n) (e : Incident i) : + incidentCoeff i x e.val = spinValue (x ((incidentOtherEquiv i) e).val) := by + change incidentCoeff i x e.val = spinValue (x (otherEnd i e)) + unfold incidentCoeff otherEnd + have he := e.property + dsimp only [touches] at he + split_ifs <;> grind + +lemma sum_incident_other (i : Fin n) (f : Fin n → ℝ) : + (∑ e : Incident i, f (otherEnd i e)) = ∑ j ∈ Finset.univ.erase i, f j := by + calc + _ = ∑ j : {j : Fin n // j ≠ i}, f j := (incidentOtherEquiv i).sum_comp _ + _ = _ := (Finset.sum_subtype (Finset.univ.erase i) (by intro j; simp [ne_comm]) f).symm + +lemma incident_coeff_square (i : Fin n) (x : Spin n) : + (∑ e : Incident i, incidentCoeff i x e.val^2) = (n:ℝ)-1 := by + simp_rw [incidentCoeff_other] + change (∑ e : Incident i, (spinValue (x (otherEnd i e)))^2) = _ + rw [sum_incident_other i (fun j => spinValue (x j)^2)] + simp only [spinValue_sq,Finset.sum_const, nsmul_eq_mul,mul_one] + rw [Finset.card_erase_of_mem (Finset.mem_univ i),Finset.card_univ,Fintype.card_fin,Nat.cast_sub (by have := i.isLt; omega),Nat.cast_one] + +lemma incident_coeff_product (i : Fin n) (x y : Spin n) : + (∑ e : Incident i, incidentCoeff i x e.val*incidentCoeff i y e.val) = + (n:ℝ)*cavityOverlapCoord i x y := by + simp_rw [incidentCoeff_other] + change (∑ e : Incident i, spinValue (x (otherEnd i e))*spinValue (y (otherEnd i e))) = _ + rw [sum_incident_other i (fun j => spinValue (x j)*spinValue (y j)),cavityOverlapCoord,mul_div_cancel₀ _ (by exact_mod_cast (ne_of_gt (Nat.zero_lt_of_lt i.isLt)))] + +def cavitySplit (i : Fin n) : Disorder n ≃ᵐ ((Incident i → ℝ) × (Nonincident i → ℝ)) := + MeasurableEquiv.piEquivPiSubtypeProd (fun _ : Edge n => ℝ) (touches i) + +def incidentLaw (i : Fin n) : Measure (Incident i → ℝ) := + Measure.pi fun _ => gaussianReal 0 (n:ℝ≥0)⁻¹ + +def nonincidentLaw (i : Fin n) : Measure (Nonincident i → ℝ) := + Measure.pi fun _ => gaussianReal 0 (n:ℝ≥0)⁻¹ + +instance (i : Fin n) : IsProbabilityMeasure (incidentLaw i) := by unfold incidentLaw; infer_instance + +instance (i : Fin n) : IsProbabilityMeasure (nonincidentLaw i) := by unfold nonincidentLaw; infer_instance + +lemma cavitySplit_preserving (i : Fin n) : + MeasurePreserving (cavitySplit i) (disorderLaw n) ((incidentLaw i).prod (nonincidentLaw i)) := + measurePreserving_piEquivPiSubtypeProd _ _ + +lemma cavityJoin_apply_incident (i : Fin n) (u : Incident i → ℝ) (v : Nonincident i → ℝ) (e : Incident i) : + (cavitySplit i).symm (u,v) e.val = u e := by + simp [cavitySplit,MeasurableEquiv.piEquivPiSubtypeProd,Equiv.piEquivPiSubtypeProd,e.property] + +lemma cavityJoin_apply_nonincident (i : Fin n) (u : Incident i → ℝ) (v : Nonincident i → ℝ) (e : Nonincident i) : + (cavitySplit i).symm (u,v) e.val = v e := by + simp [cavitySplit,MeasurableEquiv.piEquivPiSubtypeProd,Equiv.piEquivPiSubtypeProd,e.property] + +lemma delete_cavityJoin (i : Fin n) (u : Incident i → ℝ) (v : Nonincident i → ℝ) : + deleteDisorder ((cavitySplit i).symm (u,v)) i = (cavitySplit i).symm (0,v) := by + funext e + by_cases he : touches i e + · rw [show e = (⟨e,he⟩ : Incident i).val from rfl,cavityJoin_apply_incident] + simp only [deleteDisorder,ite_eq_left (show e.val.1=i ∨ e.val.2=i from he)] + rfl + · rw [show e = (⟨e,he⟩ : Nonincident i).val from rfl,cavityJoin_apply_nonincident] + simp only [deleteDisorder,ite_eq_right (show ¬(e.val.1=i ∨ e.val.2=i) from he)] + exact cavityJoin_apply_nonincident i u v ⟨e,he⟩ + +lemma localField_cavityJoin (i : Fin n) (u : Incident i → ℝ) (v : Nonincident i → ℝ) (x : Spin n) : + localField ((cavitySplit i).symm (u,v)) i x = ∑ e : Incident i, incidentCoeff i x e.val*u e := by + unfold localField + rw [← Fintype.sum_subtype_add_sum_subtype (touches i)] + have hz : (∑ e : Nonincident i, (cavitySplit i).symm (u,v) e.val*incidentCoeff i x e.val) = 0 := by + apply Finset.sum_eq_zero + intro e _ + have he := e.property + simp only [touches,not_or] at he + simp [incidentCoeff,he.1,he.2] + rw [hz,add_zero] + simp_rw [cavityJoin_apply_incident,mul_comm] + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/Covariance.lean b/lean/OAI/MathematicalPhysics/CriticalSK/Covariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd862b8839fc2bb88e356be8d3a374c897b97d95 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/Covariance.lean @@ -0,0 +1,401 @@ +import OAI.MathematicalPhysics.CriticalSK.SmallBall + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +namespace CriticalSK + + +open Set MeasureTheory + +lemma euclideanMatrix_norm_le_frobenius {n : ℕ} (A : Matrix (Fin n) (Fin n) ℝ) : + ‖A.toEuclideanLin.toContinuousLinearMap‖ ≤ Real.sqrt (∑ i, ∑ j, A i j^2) := by + apply ContinuousLinearMap.opNorm_le_bound _ (Real.sqrt_nonneg _) + intro x + have hi (i : Fin n) : (∑ j, A i j*x j)^2 ≤ (∑ j, A i j^2)*(∑ j, (x j)^2) := + Finset.sum_mul_sq_le_sq_mul_sq _ _ _ + have hs := Finset.sum_le_sum (fun i (_ : i ∈ Finset.univ) => hi i) + rw [← Finset.sum_mul,← EuclideanSpace.real_norm_sq_eq x] at hs + have hy : ‖A.toEuclideanLin.toContinuousLinearMap x‖^2 = ∑ i, (∑ j, A i j*x j)^2 := by + rw [EuclideanSpace.real_norm_sq_eq] + rfl + rw [← hy] at hs + have hF : 0 ≤ ∑ i, ∑ j, A i j^2 := Finset.sum_nonneg fun _ _ => Finset.sum_nonneg fun _ _ => sq_nonneg _ + have hr := Real.sq_sqrt hF + refine (sq_le_sq₀ (norm_nonneg _) (mul_nonneg (Real.sqrt_nonneg _) (norm_nonneg _))).mp ?_ + rw [mul_pow,hr] + exact hs + +lemma covariance_continuous (n : ℕ) : Continuous (covariance (n := n)) := by + apply continuous_pi + intro i + apply continuous_pi + intro j + simp only [covariance_eq,mean] + apply continuous_finsetSum + intro x _ + exact (gibbs_continuous x).mul continuous_const + +lemma covarianceNorm_continuous (n : ℕ) : Continuous (covarianceNorm (n := n)) := by + unfold covarianceNorm + have h : Continuous (fun W : Disorder n => (covariance W).toEuclideanLin.toContinuousLinearMap) := by + exact (LinearMap.continuous_of_finiteDimensional + (Matrix.toEuclideanCLM (n := Fin n) (𝕜 := ℝ)).toAlgEquiv.toLinearMap).comp (covariance_continuous n) + exact h.norm + +lemma variance_linear_quadratic {n : ℕ} (W : Disorder n) (a : EuclideanSpace ℝ (Fin n)) : + variance W (linearObservable a) = inner ℝ a ((covariance W).toEuclideanLin a) := by + rw [variance,mean_linearObservable] + simp only [sub_zero,mean,linearObservable, + EuclideanSpace.inner_eq_star_dotProduct,star_trivial,Matrix.toLpLin_apply,Matrix.mulVec,dotProduct,covariance_eq,mean] + simp only [pow_two,Finset.sum_mul,Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro i _ + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro j _ + apply Finset.sum_congr rfl + intro x _ + ring + +lemma variance_linear_le_norm {n : ℕ} (W : Disorder n) (a : EuclideanSpace ℝ (Fin n)) : + variance W (linearObservable a) ≤ covarianceNorm W*‖a‖^2 := by + rw [variance_linear_quadratic] + have hh := real_inner_le_norm a ((covariance W).toEuclideanLin a) + have hn := (covariance W).toEuclideanLin.toContinuousLinearMap.le_opNorm a + calc + inner ℝ a ((covariance W).toEuclideanLin a) ≤ ‖a‖*‖(covariance W).toEuclideanLin a‖ := hh + _ ≤ ‖a‖*(covarianceNorm W*‖a‖) := mul_le_mul_of_nonneg_left hn (norm_nonneg _) + _ = covarianceNorm W*‖a‖^2 := by ring + +lemma variance_linear_smallBall {n : ℕ} (W : Disorder n) (a : Fin n → ℝ) {b : ℝ} (hb : 0 ≤ b) : + b^2*(1-linearSmallBall W a b) ≤ variance W (linearObservable a) := by + rw [variance,mean_linearObservable] + simp only [sub_zero,mean] + rw [← gibbs_sum W,linearSmallBall,← Finset.sum_sub_distrib,Finset.mul_sum] + apply Finset.sum_le_sum + intro x _ + by_cases hx : |linearObservable a x| ≤ b + · simp only [ite_eq_left hx,sub_self,mul_zero] + exact mul_nonneg (gibbs_nonneg W x) (sq_nonneg _) + · simp only [ite_eq_right hx,sub_zero] + have hs : b^2 ≤ linearObservable a x^2 := by + simpa only [sq_abs] using pow_le_pow_left₀ hb (le_of_lt (lt_of_not_ge hx)) 2 + nlinarith [mul_le_mul_of_nonneg_left hs (gibbs_nonneg W x)] + +lemma sum_four_exchange {ι κ α β : Type*} [Fintype ι] [Fintype κ] [Fintype α] [Fintype β] + (f : ι → κ → α → β → ℝ) : + (∑ i, ∑ j, ∑ x, ∑ y, f i j x y) = ∑ x, ∑ y, ∑ i, ∑ j, f i j x y := by + calc + _ = ∑ i, ∑ x, ∑ j, ∑ y, f i j x y := by + apply Finset.sum_congr rfl + intro i _ + rw [Finset.sum_comm] + _ = ∑ x, ∑ i, ∑ y, ∑ j, f i j x y := by + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro x _ + apply Finset.sum_congr rfl + intro i _ + rw [Finset.sum_comm] + _ = _ := by + apply Finset.sum_congr rfl + intro x _ + rw [Finset.sum_comm] + +lemma gibbsOverlap_nonneg {n : ℕ} (W : Disorder n) : 0 ≤ gibbsOverlap W := by + unfold gibbsOverlap + exact Finset.sum_nonneg fun x _ => Finset.sum_nonneg fun y _ => by + exact mul_nonneg (mul_nonneg (gibbs_nonneg W x) (gibbs_nonneg W y)) (sq_nonneg _) + +lemma gibbsOverlap_continuous (n : ℕ) : Continuous (gibbsOverlap (n := n)) := by + unfold gibbsOverlap + apply continuous_finsetSum + intro x _ + apply continuous_finsetSum + intro y _ + exact ((gibbs_continuous x).mul (gibbs_continuous y)).mul continuous_const + +lemma finite_gram_frobenius {ι X : Type*} [Fintype ι] [Fintype X] + (w : X → ℝ) (v : X → ι → ℝ) : + (∑ i, ∑ j, (∑ x, w x*(v x i*v x j))^2) = + ∑ x, ∑ y, w x*w y*(∑ i, v x i*v y i)^2 := by + simp only [pow_two,Finset.sum_mul,Finset.mul_sum] + rw [sum_four_exchange] + apply Finset.sum_congr rfl + intro x _ + apply Finset.sum_congr rfl + intro y _ + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + +lemma covariance_frobenius_overlap {n : ℕ} (hn : 0 < n) (W : Disorder n) : + (∑ i, ∑ j, covariance W i j^2) = (n:ℝ)^2*gibbsOverlap W := by + have hn0 : (n:ℝ) ≠ 0 := by positivity + have hR : (n:ℝ)^2*gibbsOverlap W = + ∑ x, ∑ y, gibbs W x*gibbs W y*(∑ i, spinValue (x i)*spinValue (y i))^2 := by + unfold gibbsOverlap + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro x _ + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro y _ + have hi : inner ℝ (cubeVector x) (cubeVector y) = ∑ i, spinValue (x i)*spinValue (y i) := by + simp only [EuclideanSpace.inner_eq_star_dotProduct,star_trivial,dotProduct,cubeVector] + apply Finset.sum_congr rfl + intro i _ + change spinValue (y i)*spinValue (x i) = spinValue (x i)*spinValue (y i) + ring + rw [cubeOverlap,hi] + field_simp + rw [hR] + simp only [covariance_eq,mean] + exact finite_gram_frobenius (gibbs W) (fun x i => spinValue (x i)) + +lemma covarianceNorm_sq_le_overlap {n : ℕ} (hn : 0 < n) (W : Disorder n) : + covarianceNorm W^2 ≤ (n:ℝ)^2*gibbsOverlap W := by + have h := euclideanMatrix_norm_le_frobenius (covariance W) + have hs : 0 ≤ ∑ i, ∑ j, covariance W i j^2 := + Finset.sum_nonneg fun _ _ => Finset.sum_nonneg fun _ _ => sq_nonneg _ + have hb := pow_le_pow_left₀ (norm_nonneg _) h 2 + rw [Real.sq_sqrt hs,covariance_frobenius_overlap hn W] at hb + exact hb + +lemma rotatedCubeOverlap_eq {n : ℕ} {W : Disorder n} (lam : Fin n → ℝ) + (U : Matrix.orthogonalGroup (Fin n) ℝ) (c : ℝ) + (h : ∀ x, hamiltonian W x = (1/2:ℝ)*diagonalEnergy lam (orthogonalIsometry U (cubeVector x))+c) : + rotatedCubeOverlap lam U = gibbsOverlap W := by + have hg := gibbs_exp_shift _ c h + unfold rotatedCubeOverlap rotatedCubePair rotatedCubePartition gibbsOverlap + rw [mul_pow,mul_div_mul_left _ _ (pow_ne_zero _ (inv_ne_zero (by positivity : (Fintype.card (Spin n):ℝ) ≠ 0)))] + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro x _ + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro y _ + rw [hg,hg,show (diagonalEnergy lam (orthogonalIsometry U (cubeVector x))+ + diagonalEnergy lam (orthogonalIsometry U (cubeVector y)))/2 = + (1/2:ℝ)*diagonalEnergy lam (orthogonalIsometry U (cubeVector x))+ + (1/2:ℝ)*diagonalEnergy lam (orthogonalIsometry U (cubeVector y)) by ring,Real.exp_add] + ring + + +open Set MeasureTheory Filter + +lemma haar_gibbsOverlap_bound {n : ℕ} (hn : 0 < n) + (A : GaussianMatrix (Fin n)) (hA : ∀ i j, A i j = A j i) {K : ℝ} (hK : 0 < K) : + (orthogonalHaar (Fin n)).real {U | K ≤ gibbsOverlap (gaussianDisorder (haarConjugate U A))} ≤ + 4*(∫ U, (rotatedCubePartition (matrixOrderedEigenvalues A) 1 U / + spherePartition (matrixOrderedEigenvalues A) 1 (Real.sqrt n)-1)^2 ∂orthogonalHaar (Fin n))+ + 4*((∫ U, rotatedCubePair (matrixOrderedEigenvalues A) (fun q => q^2) U ∂orthogonalHaar (Fin n))/ + spherePartition (matrixOrderedEigenvalues A) 1 (Real.sqrt n)^2)/K := by + obtain ⟨V,hV⟩ := gaussian_matrix_energy_eigenbasis A hA + let lam := matrixOrderedEigenvalues A + let R := matrixOfIsometry V + have he (U : Matrix.orthogonalGroup (Fin n) ℝ) : gibbsOverlap (gaussianDisorder (haarConjugate U A)) = + rotatedCubeOverlap lam (R*U) := by + symm + apply rotatedCubeOverlap_eq lam (R*U) (-(1/2:ℝ)*∑ j, haarConjugate U A j j) + intro x + simpa only [gaussianDisorder,lam,R,sub_eq_add_neg,neg_mul] using haarConjugate_hamiltonian A hA V hV U x + simp_rw [he] + change ((orthogonalHaar (Fin n)) ((fun U => R*U) ⁻¹' {U | K ≤ rotatedCubeOverlap lam U})).toReal ≤ _ + rw [measure_preimage_mul] + exact rotatedCubeOverlap_probability hn lam hK + +lemma natural_gibbsOverlap_probability {h L : ℝ} (hh : 0 ≤ h) (hL : 262144 ≤ L) + (hcost : edgeFixedCost h L < 1/100) {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ n : ℕ in atTop, ∀ K : ℝ, 0 < K → (disorderLaw (n+4)).real + {W | K ≤ gibbsOverlap W} ≤ + 32*Real.exp (-h^2)+4*(ε+naturalOrientationTail (n+3) L)+ + 4*((1+ε)*naturalOverlapRate (n+3) L+naturalOrientationTail (n+3) L)/K := by + have hspectral := (tendsto_add_atTop_nat 3).eventually (goe_natural_spectral_bad hh hL hcost) + filter_upwards [hspectral,spectralGood_orientation_variance hh hL hcost hε, + spectralGood_orientation_overlap hh hL hcost hε] with n hn hvar hover + intro K hK + have hE : MeasurableSet {W : Disorder (n+4) | K ≤ gibbsOverlap W} := + (isClosed_le continuous_const (gibbsOverlap_continuous _)).measurableSet + rw [disorder_goe_event (n+3) hE] + let G : Set (GaussianMatrix (Fin (n+4))) := matrixOrderedEigenvalues ⁻¹' spectralGood (n+3) h (naturalEdgeScale (n+3) L) + have hG : MeasurableSet G := (spectralGood_measurable _ _ _).preimage (matrixOrderedEigenvalues_measurable _) + have he := goe_event_from_orbit_bound (goeScale (n+3)) + (hE.preimage (gaussianDisorder_measurable _)) hG + (show 0 ≤ 4*(ε+naturalOrientationTail (n+3) L)+ + 4*((1+ε)*naturalOverlapRate (n+3) L+naturalOrientationTail (n+3) L)/K from by + have := naturalOverlapRate_nonneg (n+3) L + unfold naturalOrientationTail + positivity) + (fun A hAG hA => by + have hbnd := haar_gibbsOverlap_bound (by omega : 0 < n+4) A hA hK + apply hbnd.trans + have hV := hvar (matrixOrderedEigenvalues A) hAG + have hO := hover (matrixOrderedEigenvalues A) hAG + norm_num only [Nat.cast_add,Nat.cast_ofNat] at hbnd ⊢ + apply add_le_add + · exact mul_le_mul_of_nonneg_left hV (by norm_num) + · exact div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left hO (by norm_num)) hK.le) + have hnn : (goeLaw (Fin (n+4)) (goeScale (n+3))).real Gᶜ ≤ 32*Real.exp (-h^2) := hn + linarith + +lemma naturalOverlapConstant_pos {L : ℝ} (hL : 0 < L) : 0 < naturalOverlapConstant L := by + unfold naturalOverlapConstant + positivity + +lemma natural_GibbsOverlap_tight {α : ℝ} (hα : 0 < α) : + ∃ C : ℝ, 0 < C ∧ ∀ᶠ n : ℕ in atTop, (disorderLaw (n+4)).real + {W | C/(n+4:ℝ)^(2/3:ℝ) ≤ gibbsOverlap W} < α := by + obtain ⟨h,hh,hfail⟩ := exists_spectral_failure_parameter (show 0 < α/4 by positivity) + obtain ⟨L,hL,hcost⟩ := ((eventually_ge_atTop (262144:ℝ)).and + ((edgeFixedCost_tendsto h).eventually (gt_mem_nhds (by norm_num : (0:ℝ) < 1/100)))).exists + have hLp : 0 < L := by linarith + let ε := α/32 + have hε : 0 < ε := by dsimp [ε]; positivity + let D := (1+ε)*naturalOverlapConstant L+1 + have hD : 0 < D := by dsimp [D]; have := naturalOverlapConstant_pos hLp; positivity + let C := 32*D/α + have hC : 0 < C := by dsimp [C]; positivity + refine ⟨C,hC,?_⟩ + have ht : Tendsto (fun n : ℕ => naturalOrientationTail (n+3) L) atTop (𝓝 0) := by + have hs := (naturalOrientationTail_scaled_tendsto hLp 0).comp (tendsto_add_atTop_nat 3) + simpa only [Function.comp_def,Real.rpow_zero,one_mul] using hs + have hst : Tendsto (fun n : ℕ => (n+4:ℝ)^(2/3:ℝ)*naturalOrientationTail (n+3) L) + atTop (𝓝 0) := by + have hs := (naturalOrientationTail_scaled_tendsto hLp (2/3)).comp (tendsto_add_atTop_nat 3) + simpa only [Function.comp_def,Nat.cast_add,Nat.cast_ofNat,show (3:ℝ)+1=4 by norm_num,add_assoc] using hs + filter_upwards [natural_gibbsOverlap_probability hh hL hcost hε, + ht.eventually (gt_mem_nhds hε),hst.eventually (gt_mem_nhds (by norm_num : (0:ℝ) < 1))] with n hn htail hscale + let S := (n+4:ℝ)^(2/3:ℝ) + have hS : 0 < S := by dsimp [S]; positivity + have hp := hn (C/S) (by positivity) + apply lt_of_le_of_lt hp + have hR := naturalOverlapRate_scaled_bound (n+3) hLp + norm_num only [Nat.cast_add,Nat.cast_ofNat] at hR + rw [show (n:ℝ)+3+1=n+4 by ring] at hR + have hnum : S*((1+ε)*naturalOverlapRate (n+3) L+naturalOrientationTail (n+3) L) ≤ D := by + dsimp only [D] + have hg := mul_le_mul_of_nonneg_left hR (show 0 ≤ 1+ε by positivity) + change S*naturalOrientationTail (n+3) L < 1 at hscale + nlinarith + have hfrac : 4*((1+ε)*naturalOverlapRate (n+3) L+naturalOrientationTail (n+3) L)/(C/S) ≤ α/8 := by + rw [div_div_eq_mul_div] + apply (div_le_iff₀ hC).mpr + have he : α/8*C = 4*D := by dsimp [C]; field_simp; ring + rw [he] + nlinarith + dsimp only [ε] at htail ⊢ + linarith + +lemma two_thirds_cube {x : ℝ} (hx : 0 ≤ x) : (x^(2/3:ℝ))^3 = x^2 := by + rw [← Real.rpow_mul_natCast hx] + norm_num + +lemma covariance_lower_tight {α : ℝ} (hα : 0 < α) : + ∃ c : ℝ, 0 < c ∧ ∀ᶠ n : ℕ in atTop, (disorderLaw (n+4)).real + {W | covarianceNorm W ≤ c*(n+4:ℝ)^(2/3:ℝ)} < α := by + obtain ⟨b,hb,hp⟩ := natural_smallBall_tight (by norm_num : (0:ℝ) < 1/2) hα + refine ⟨b^2/2,by positivity,?_⟩ + filter_upwards [hp] with n hn + refine lt_of_le_of_lt (measureReal_mono ?_) hn + intro W hW u hu + have hN := variance_linear_le_norm W u + rw [hu,one_pow,mul_one] at hN + have hV := variance_linear_smallBall W u (show 0 ≤ b*(n+4:ℝ)^(1/3:ℝ) by positivity) + rw [mul_pow,third_power_square (by positivity : (0:ℝ) ≤ n+4)] at hV + change covarianceNorm W ≤ b^2/2*(n+4:ℝ)^(2/3:ℝ) at hW + have hP : 0 < b^2*(n+4:ℝ)^(2/3:ℝ) := by positivity + nlinarith + +lemma covariance_upper_tight {α : ℝ} (hα : 0 < α) : + ∃ C : ℝ, 0 < C ∧ ∀ᶠ n : ℕ in atTop, (disorderLaw (n+4)).real + {W | C*(n+4:ℝ)^(2/3:ℝ) ≤ covarianceNorm W} < α := by + obtain ⟨K,hK,hp⟩ := natural_GibbsOverlap_tight hα + refine ⟨K+1,by positivity,?_⟩ + filter_upwards [hp] with n hn + refine lt_of_le_of_lt (measureReal_mono ?_) hn + intro W hW + let S := (n+4:ℝ)^(2/3:ℝ) + have hS : 0 < S := by dsimp [S]; positivity + change K/S ≤ gibbsOverlap W + change (K+1)*S ≤ covarianceNorm W at hW + have hsq := pow_le_pow_left₀ (show 0 ≤ (K+1)*S by positivity) hW 2 + have hN := covarianceNorm_sq_le_overlap (by omega : 0 < n+4) W + norm_num only [Nat.cast_add,Nat.cast_ofNat] at hN + rw [← two_thirds_cube (by positivity : (0:ℝ) ≤ n+4)] at hN + change covarianceNorm W^2 ≤ S^3*gibbsOverlap W at hN + have hmul : (K+1)^2*S^2 ≤ (S*gibbsOverlap W)*S^2 := by + calc + _ = ((K+1)*S)^2 := by ring + _ ≤ covarianceNorm W^2 := hsq + _ ≤ S^3*gibbsOverlap W := hN + _ = _ := by ring + have hc := le_of_mul_le_mul_right hmul (sq_pos_of_pos hS) + apply (div_le_iff₀ hS).mpr + nlinarith + +lemma tight_interval_limit {X : ℕ → Type*} [∀ n, MeasurableSpace (X n)] + (μ : ∀ n, Measure (X n)) [∀ n, IsProbabilityMeasure (μ n)] + (f : ∀ n, X n → ℝ) (hf : ∀ n, Measurable (f n)) + (s : ℕ → ℝ) (hs : ∀ n, 0 < s n) + (hlower : ∀ α : ℝ, 0 < α → ∃ c : ℝ, 0 < c ∧ ∀ᶠ n : ℕ in atTop, + (μ n).real {x | f n x ≤ c*s n} < α) + (hupper : ∀ α : ℝ, 0 < α → ∃ C : ℝ, 0 < C ∧ ∀ᶠ n : ℕ in atTop, + (μ n).real {x | C*s n ≤ f n x} < α) + (M : ℕ → ℝ) (hMpos : ∀ n, 0 < M n) (hM : Tendsto M atTop atTop) : + Tendsto (fun n => (μ n).real {x | s n/M n ≤ f n x ∧ f n x ≤ M n*s n}) atTop (𝓝 1) := by + apply tendsto_order.mpr + constructor + · intro a ha + obtain ⟨c,hc,hl⟩ := hlower ((1-a)/2) (by linarith) + obtain ⟨C,hC,hu⟩ := hupper ((1-a)/2) (by linarith) + filter_upwards [hl,hu,(tendsto_atTop.mp hM (1/c)),(tendsto_atTop.mp hM C)] with n hnlo hnup hnM hnC + let E : Set (X n) := {x | s n/M n ≤ f n x ∧ f n x ≤ M n*s n} + have hE : MeasurableSet E := (measurableSet_le measurable_const (hf n)).inter + (measurableSet_le (hf n) measurable_const) + have hlow : s n/M n ≤ c*s n := by + apply (div_le_iff₀ (hMpos n)).mpr + have hh : 1 ≤ M n*c := (div_le_iff₀ hc).mp hnM + nlinarith [mul_le_mul_of_nonneg_right hh (hs n).le] + have hset : Eᶜ ⊆ {x | f n x ≤ c*s n} ∪ {x | C*s n ≤ f n x} := by + intro x hx + by_cases hxl : s n/M n ≤ f n x + · right + have hxu : M n*s n < f n x := by + apply lt_of_not_ge + intro hh + exact hx ⟨hxl,hh⟩ + exact (mul_le_mul_of_nonneg_right hnC (hs n).le).trans hxu.le + · left + exact (lt_of_not_ge hxl).le.trans hlow + have hbad := (measureReal_mono (μ := μ n) hset).trans (measureReal_union_le _ _) + have hadd := measureReal_add_measureReal_compl (μ := μ n) hE + rw [probReal_univ] at hadd + change a < (μ n).real E + linarith + · intro a ha + exact Filter.Eventually.of_forall (fun _ => lt_of_le_of_lt measureReal_le_one ha) + +theorem covariance_natural_scale (M : ℕ → ℝ) (hMpos : ∀ n, 0 < M n) (hM : Tendsto M atTop atTop) : + Tendsto (fun n => (disorderLaw n).real {W | + (n:ℝ)^(2/3:ℝ)/M n ≤ covarianceNorm W ∧ covarianceNorm W ≤ M n*(n:ℝ)^(2/3:ℝ)}) atTop (𝓝 1) := by + apply (tendsto_add_atTop_iff_nat 4).mp + have hh := tight_interval_limit (fun n => disorderLaw (n+4)) (fun _ W => covarianceNorm W) + (fun n => (covarianceNorm_continuous (n+4)).measurable) + (fun n => (n+4:ℝ)^(2/3:ℝ)) (fun _ => by positivity) + (fun _ hα => covariance_lower_tight hα) (fun _ hα => covariance_upper_tight hα) + (fun n => M (n+4)) (fun n => hMpos (n+4)) (hM.comp (tendsto_add_atTop_nat 4)) + simpa only [Nat.cast_add,Nat.cast_ofNat] using hh + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/CubeOverlap.lean b/lean/OAI/MathematicalPhysics/CriticalSK/CubeOverlap.lean new file mode 100644 index 0000000000000000000000000000000000000000..665fa0f71930f4ad90a30c35c45d8d5898ed5d6c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/CubeOverlap.lean @@ -0,0 +1,926 @@ +import OAI.MathematicalPhysics.CriticalSK.SphereGeometry + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open MeasureTheory ProbabilityTheory + +open scoped ENNReal NNReal + +open scoped BigOperators InnerProductSpace + +open Module + +open scoped BigOperators ENNReal NNReal Real Topology + +open MeasureTheory ProbabilityTheory Filter + +open scoped BigOperators NNReal + +open scoped BigOperators + +open Matrix Polynomial + +open scoped BigOperators Topology + +open Filter + +open scoped BigOperators NNReal ENNReal Topology Pointwise Matrix.Norms.Elementwise + +open Set Metric MeasureTheory MeasureTheory.Measure + +open scoped ENNReal NNReal Topology + +open MeasureTheory MeasureTheory.Measure Set Metric + +open scoped BigOperators ENNReal Topology + +open Set MeasureTheory + +open scoped BigOperators ENNReal + +open MeasureTheory + +open Finset Real + +open Finset Real Filter +open scoped Topology +open MeasureTheory Filter Set Real +namespace CriticalSK + +def latticeOverlap (n j : ℕ) : ℝ := -1 + 2 * j / n + +def cubeOverlapMass (n j : ℕ) : ℝ := (2 : ℝ)⁻¹ ^ n * n.choose j + +lemma cubeOverlapMass_nonneg (n j : ℕ) : 0 ≤ cubeOverlapMass n j := by + unfold cubeOverlapMass; positivity + +lemma latticeOverlap_mul {n j : ℕ} (hn : 0 < n) : + n * latticeOverlap n j = 2 * (j : ℝ) - n := by + unfold latticeOverlap + have hn0 : (n : ℝ) ≠ 0 := by positivity + field_simp + ring + +lemma binomial_exp_term {n j : ℕ} (hj : j ≤ n) (t : ℝ) : + Real.exp (t * (2 * (j : ℝ) - n)) = Real.exp t ^ j * Real.exp (-t) ^ (n-j) := by + rw [← Real.exp_nat_mul, ← Real.exp_nat_mul, ← Real.exp_add, Nat.cast_sub hj] + congr 1 + ring + +lemma cubeOverlapMass_exp_bound {n j : ℕ} (hn : 0 < n) (hj : j ≤ n) (t : ℝ) : + cubeOverlapMass n j * Real.exp (t * n * latticeOverlap n j) ≤ Real.cosh t ^ n := by + have hs : Real.exp t ^ j * Real.exp (-t) ^ (n-j) * (n.choose j : ℝ) ≤ + (Real.exp t + Real.exp (-t)) ^ n := by + rw [add_pow] + exact Finset.single_le_sum (f := fun i => Real.exp t ^ i * Real.exp (-t) ^ (n-i) * (n.choose i : ℝ)) + (fun i _ => by positivity) (Finset.mem_range.mpr (show j < n+1 by omega)) + have ht : t * n * latticeOverlap n j = t * (2 * (j : ℝ) - n) := by + rw [mul_assoc, latticeOverlap_mul hn] + rw [cubeOverlapMass, ht, binomial_exp_term hj t, Real.cosh_eq, div_pow] + calc + (2 : ℝ)⁻¹ ^ n * (n.choose j : ℝ) * (Real.exp t ^ j * Real.exp (-t) ^ (n-j)) = + (Real.exp t ^ j * Real.exp (-t) ^ (n-j) * (n.choose j : ℝ)) / 2 ^ n := by + rw [inv_pow]; ring + _ ≤ (Real.exp t + Real.exp (-t)) ^ n / 2 ^ n := div_le_div_of_nonneg_right hs (by positivity) + +lemma cubeOverlapMass_chernoff {n j : ℕ} (hn : 0 < n) (hj : j ≤ n) : + cubeOverlapMass n j ≤ Real.exp (-(n : ℝ) * latticeOverlap n j ^ 2 / 2) := by + set q := latticeOverlap n j + have h := cubeOverlapMass_exp_bound hn hj q + have hc : Real.cosh q ^ n ≤ Real.exp ((n : ℝ) * q ^ 2 / 2) := by + calc + Real.cosh q ^ n ≤ Real.exp (q ^ 2 / 2) ^ n := + pow_le_pow_left₀ (Real.cosh_pos q).le (Real.cosh_le_exp_half_sq q) n + _ = _ := by rw [← Real.exp_nat_mul]; congr 1; ring + have hmul : Real.exp (-(n : ℝ) * q ^ 2 / 2) * Real.exp (q * n * q) = + Real.exp ((n : ℝ) * q ^ 2 / 2) := by + rw [← Real.exp_add] + congr 1 + ring + apply (mul_le_mul_iff_left₀ (Real.exp_pos (q * n * q))).mp + rw [hmul] + exact h.trans hc + +def binaryEntropyRate (q : ℝ) : ℝ := + ((1+q)*Real.log (1+q)+(1-q)*Real.log (1-q))/2 + +lemma log_cubic_error {q : ℝ} (hq : |q| ≤ 1/2) : + |Real.log (1-q) + q + q^2/2 + q^3/3| ≤ 2*q^4 := by + have h := Real.abs_log_sub_add_sum_range_le (show |q| < 1 by linarith) 3 + have half : (0:ℝ) < 1-|q| := by linarith + have hr : |q|^4/(1-|q|) ≤ 2*q^4 := by + rw [div_le_iff₀ half, pow_abs, abs_of_nonneg (show 0 ≤ q^4 by positivity)] + nlinarith [mul_nonneg (show 0 ≤ 1/2-|q| by linarith) (show 0 ≤ q^4 by positivity)] + calc + |Real.log (1-q)+q+q^2/2+q^3/3| = + |(∑ i ∈ range 3, q^(i+1)/(i+1)) + Real.log (1-q)| := by + congr 1 + norm_num [sum_range_succ] + ring + _ ≤ _ := h + _ ≤ _ := hr + +lemma binaryEntropyRate_taylor {q : ℝ} (hq : |q| ≤ 1/2) : + |binaryEntropyRate q-q^2/2| ≤ 4*q^4 := by + have hqp := abs_le.mp hq + let Ep := Real.log (1+q)-q+q^2/2-q^3/3 + let Em := Real.log (1-q)+q+q^2/2+q^3/3 + have hp : |Ep| ≤ 2*q^4 := by + have hp0 := log_cubic_error (q := -q) (by simpa using hq) + have heq : Real.log (1-(-q))+(-q)+(-q)^2/2+(-q)^3/3 = Ep := by dsimp [Ep]; ring_nf + rw [heq] at hp0 + convert hp0 using 1; ring + have hm : |Em| ≤ 2*q^4 := log_cubic_error hq + have h1p : |1+q| ≤ 3/2 := by rw [abs_le]; constructor <;> linarith + have h1m : |1-q| ≤ 3/2 := by rw [abs_le]; constructor <;> linarith + have hid : binaryEntropyRate q-q^2/2 = ((1+q)*Ep+(1-q)*Em)/2 + q^4/3 := by + unfold binaryEntropyRate Ep Em + ring + rw [hid] + calc + |((1+q)*Ep+(1-q)*Em)/2 + q^4/3| ≤ + (|1+q| *|Ep|+|1-q| *|Em|)/2 + q^4/3 := by + calc + _ ≤ |((1+q)*Ep+(1-q)*Em)/2| + |q^4/3| := abs_add_le _ _ + _ = |(1+q)*Ep+(1-q)*Em|/2 + q^4/3 := by + rw [abs_div, abs_of_pos (by norm_num : (0:ℝ) < 2), abs_of_nonneg (show 0 ≤ q^4/3 by positivity)] + _ ≤ _ := by gcongr; simpa only [abs_mul] using abs_add_le ((1+q)*Ep) ((1-q)*Em) + _ ≤ ((3/2)*(2*q^4)+(3/2)*(2*q^4))/2 + q^4/3 := by gcongr + _ ≤ 4*q^4 := by nlinarith [show 0 ≤ q^4 by positivity] + +lemma log_square_error {q : ℝ} (hq : |q| ≤ 1/2) : + |Real.log (1-q^2)+q^2| ≤ 2*q^4 := by + have hq2 : q^2 ≤ 1/4 := by nlinarith [(abs_le.mp hq).1, (abs_le.mp hq).2] + have h := Real.abs_log_sub_add_sum_range_le (x := q^2) (by rw [abs_of_nonneg (sq_nonneg q)]; linarith) 1 + norm_num [abs_of_nonneg (sq_nonneg q)] at h + rw [add_comm] at h + calc + _ ≤ (q^2)^2/(1-q^2) := h + _ ≤ 2*q^4 := by + rw [div_le_iff₀ (by linarith : (0:ℝ) < 1-q^2)] + nlinarith [mul_nonneg (show 0 ≤ 1/2-q^2 by linarith) (show 0 ≤ q^4 by positivity)] + +lemma entropy_error_tendsto {q : ℕ → ℝ} (hq : Tendsto q atTop (𝓝 0)) + (hfour : Tendsto (fun n : ℕ => (n:ℝ)*q n^4) atTop (𝓝 0)) : + Tendsto (fun n : ℕ => (n:ℝ)*(binaryEntropyRate (q n)-q n^2/2)) atTop (𝓝 0) := by + have hev : ∀ᶠ n in atTop, |q n| ≤ 1/2 := + (hq.abs).eventually (eventually_le_nhds (by norm_num : |(0:ℝ)| < 1/2)) + apply squeeze_zero_norm' _ (by simpa using hfour.const_mul 4) + filter_upwards [hev] with n hn + rw [Real.norm_eq_abs, abs_mul, abs_of_nonneg (Nat.cast_nonneg n)] + calc + (n:ℝ)*|binaryEntropyRate (q n)-q n^2/2| ≤ (n:ℝ)*(4*q n^4) := + mul_le_mul_of_nonneg_left (binaryEntropyRate_taylor hn) (Nat.cast_nonneg n) + _ = 4*((n:ℝ)*q n^4) := by ring + +def stirlingLogError (n : ℕ) : ℝ := Real.log (Stirling.stirlingSeq n) - Real.log Real.pi/2 + +lemma stirlingLogError_tendsto : Tendsto stirlingLogError atTop (𝓝 0) := by + change Tendsto (fun n => Real.log (Stirling.stirlingSeq n) - Real.log Real.pi/2) atTop (𝓝 0) + have h := (Real.continuousAt_log (by positivity : Real.sqrt Real.pi ≠ 0)).tendsto.comp + Stirling.tendsto_stirlingSeq_sqrt_pi + have hh := h.sub_const (Real.log Real.pi/2) + simpa only [Function.comp_apply, Real.log_sqrt Real.pi_pos.le, sub_self] using hh + +lemma log_factorial_stirling_exact {n : ℕ} (hn : 0 < n) : + Real.log (n.factorial : ℝ) = (n:ℝ)*Real.log n-n+Real.log n/2+ + Real.log (2*Real.pi)/2+stirlingLogError n := by + have h := Stirling.log_stirlingSeq_formula n + rw [Real.log_mul (by norm_num) (by positivity), Real.log_div (by positivity) (Real.exp_ne_zero _), Real.log_exp] at h + rw [Real.log_mul (by norm_num) Real.pi_ne_zero] + unfold stirlingLogError + linarith + +lemma latticeOverlap_interior {n j : ℕ} (hj : 0 < j) (hjn : j < n) : + -1 < latticeOverlap n j ∧ latticeOverlap n j < 1 := by + have hn : (0:ℝ) < n := by exact_mod_cast (lt_trans hj hjn) + have hj0 : (0:ℝ) < j := by exact_mod_cast hj + have hjr : (j:ℝ) < n := by exact_mod_cast hjn + unfold latticeOverlap + constructor + · have := div_pos (mul_pos (by norm_num : (0:ℝ) < 2) hj0) hn; linarith + · have := (div_lt_iff₀ hn).mpr (show 2*(j:ℝ) < 2*n by linarith); linarith + +lemma latticeOverlap_halves {n j : ℕ} (hn : 0 < n) (hj : j ≤ n) : + (j:ℝ) = n*(1+latticeOverlap n j)/2 ∧ + ((n-j:ℕ):ℝ) = n*(1-latticeOverlap n j)/2 := by + have hn0 : (n:ℝ) ≠ 0 := by positivity + unfold latticeOverlap + rw [Nat.cast_sub hj] + constructor <;> field_simp <;> ring + +lemma log_cubeOverlapMass_exact {n j : ℕ} (hj : 0 < j) (hjn : j < n) : + Real.log (cubeOverlapMass n j) + Real.log n/2 + + n*binaryEntropyRate (latticeOverlap n j) + Real.log (1-latticeOverlap n j^2)/2 = + Real.log 2-Real.log (2*Real.pi)/2 + + stirlingLogError n-stirlingLogError j-stirlingLogError (n-j) := by + have hn : 0 < n := lt_trans hj hjn + have hnj : 0 < n-j := Nat.sub_pos_of_lt hjn + have hjp : (0:ℝ) < j := by exact_mod_cast hj + have hnp : (0:ℝ) < n := by exact_mod_cast hn + have hnjp : (0:ℝ) < (n-j:ℕ) := by exact_mod_cast hnj + obtain ⟨hqm,hqp⟩ := latticeOverlap_interior hj hjn + obtain ⟨hjhalf,hkhalf⟩ := latticeOverlap_halves hn hjn.le + have hlj : Real.log (j:ℝ) = Real.log n+Real.log (1+latticeOverlap n j)-Real.log 2 := by + conv_lhs => rw [hjhalf] + rw [Real.log_div (mul_ne_zero hnp.ne' (by linarith)) (by norm_num), Real.log_mul hnp.ne' (by linarith)] + have hlk : Real.log ((n-j:ℕ):ℝ) = Real.log n+Real.log (1-latticeOverlap n j)-Real.log 2 := by + conv_lhs => rw [hkhalf] + rw [Real.log_div (mul_ne_zero hnp.ne' (by linarith)) (by norm_num), Real.log_mul hnp.ne' (by linarith)] + have hlq : Real.log (1-latticeOverlap n j^2) = + Real.log (1+latticeOverlap n j)+Real.log (1-latticeOverlap n j) := by + rw [show 1-latticeOverlap n j^2 = (1+latticeOverlap n j)*(1-latticeOverlap n j) by ring, + Real.log_mul (by linarith) (by linarith)] + rw [cubeOverlapMass, Real.log_mul (by positivity) (by exact_mod_cast (Nat.choose_pos hjn.le).ne'), + Real.log_pow, Real.log_inv, Nat.cast_choose ℝ hjn.le, + Real.log_div (by positivity) (by positivity), Real.log_mul (by positivity) (by positivity), + log_factorial_stirling_exact hn, log_factorial_stirling_exact hj, log_factorial_stirling_exact hnj, + hlj, hlk, hlq] + unfold binaryEntropyRate + rw [hjhalf, hkhalf] + ring + +lemma cubeOverlapMass_pos {n j : ℕ} (hj : j ≤ n) : 0 < cubeOverlapMass n j := by + unfold cubeOverlapMass + exact mul_pos (by positivity) (by exact_mod_cast Nat.choose_pos hj) + +lemma cubeOverlapMass_local_limit {j : ℕ → ℕ} + (hj : ∀ᶠ n : ℕ in atTop, j n ≤ n) + (hq : Tendsto (fun n => latticeOverlap n (j n)) atTop (𝓝 0)) + (hfour : Tendsto (fun n : ℕ => (n:ℝ)*latticeOverlap n (j n)^4) atTop (𝓝 0)) : + Tendsto (fun n : ℕ => cubeOverlapMass n (j n) * Real.sqrt n * + Real.exp ((n:ℝ)*latticeOverlap n (j n)^2/2)) atTop + (𝓝 (Real.exp (Real.log 2-Real.log (2*Real.pi)/2))) := by + have hnpos : ∀ᶠ n : ℕ in atTop, 0 < n := eventually_gt_atTop 0 + have hqevent : ∀ᶠ n in atTop, |latticeOverlap n (j n)| < 1/2 := + hq.abs.eventually (eventually_lt_nhds (by norm_num : |(0:ℝ)| < 1/2)) + have hhalves : ∀ᶠ n : ℕ in atTop, (n:ℝ)/4 ≤ j n ∧ (n:ℝ)/4 ≤ (n-j n:ℕ) := by + filter_upwards [hnpos,hj,hqevent] with n hn hjn hqn + have hn0 : (0:ℝ) ≤ n := Nat.cast_nonneg _ + obtain ⟨ha,hb⟩ := latticeOverlap_halves hn hjn + have hab := abs_lt.mp hqn + constructor <;> nlinarith + have hjtop : Tendsto j atTop atTop := by + apply (tendsto_natCast_atTop_iff (R := ℝ)).mp + exact tendsto_atTop_mono' atTop (hhalves.mono fun n h => h.1) + (Filter.Tendsto.atTop_div_const (by norm_num : (0:ℝ)<4) (tendsto_natCast_atTop_atTop (R := ℝ))) + have hktop : Tendsto (fun n => n-j n) atTop atTop := by + apply (tendsto_natCast_atTop_iff (R := ℝ)).mp + exact tendsto_atTop_mono' atTop (hhalves.mono fun n h => h.2) + (Filter.Tendsto.atTop_div_const (by norm_num : (0:ℝ)<4) (tendsto_natCast_atTop_atTop (R := ℝ))) + have hint : ∀ᶠ n : ℕ in atTop, 0 < j n ∧ j n < n := by + filter_upwards [hjtop.eventually_gt_atTop 0,hktop.eventually_gt_atTop 0] with n hn hk + exact ⟨hn, Nat.sub_pos_iff_lt.mp hk⟩ + have hlq : Tendsto (fun n => Real.log (1-latticeOverlap n (j n)^2)/2) atTop (𝓝 0) := by + have ht : Tendsto (fun n => 1-latticeOverlap n (j n)^2) atTop (𝓝 1) := by + simpa using tendsto_const_nhds.sub (hq.pow 2) + simpa using ((Real.continuousAt_log (by norm_num : (1:ℝ)≠0)).tendsto.comp ht).div_const 2 + have herr := ((stirlingLogError_tendsto.sub (stirlingLogError_tendsto.comp hjtop)).sub + (stirlingLogError_tendsto.comp hktop)).sub (entropy_error_tendsto hq hfour) + have hlim := (herr.const_add (Real.log 2-Real.log (2*Real.pi)/2)).sub hlq + have hlog : Tendsto (fun n : ℕ => Real.log (cubeOverlapMass n (j n) * Real.sqrt n * + Real.exp ((n:ℝ)*latticeOverlap n (j n)^2/2))) atTop + (𝓝 (Real.log 2-Real.log (2*Real.pi)/2)) := by + apply (show Tendsto (fun n : ℕ => Real.log 2-Real.log (2*Real.pi)/2 + + ((stirlingLogError n-stirlingLogError (j n)-stirlingLogError (n-j n))- + (n:ℝ)*(binaryEntropyRate (latticeOverlap n (j n))-latticeOverlap n (j n)^2/2))- + Real.log (1-latticeOverlap n (j n)^2)/2) atTop _ from by simpa using hlim).congr' + filter_upwards [hint,hnpos] with n hn hnp + rw [Real.log_mul (mul_ne_zero (cubeOverlapMass_pos hn.2.le).ne' (by positivity)) (Real.exp_ne_zero _), + Real.log_mul (cubeOverlapMass_pos hn.2.le).ne' (by positivity), Real.log_sqrt (by positivity), Real.log_exp] + have h := log_cubeOverlapMass_exact hn.1 hn.2 + linarith + apply (Real.continuous_exp.continuousAt.tendsto.comp hlog).congr' + filter_upwards [hj,hnpos] with n hjn hn + dsimp only [Function.comp_apply] + exact Real.exp_log (mul_pos (mul_pos (cubeOverlapMass_pos hjn) (by positivity)) (Real.exp_pos _)) + +def scaledOverlapShape (n : ℕ) (x : ℝ) : ℝ := + (Real.sqrt (1-x^2/(n+6)))^(n+3) + +lemma sqrt_sub_le_exp (u : ℝ) : Real.sqrt (1-u) ≤ Real.exp (-u/2) := by + rw [Real.sqrt_le_iff] + refine ⟨(Real.exp_pos _).le, ?_⟩ + calc + 1-u ≤ Real.exp (-u) := by linarith [Real.add_one_le_exp (-u)] + _ = Real.exp (-u/2)^2 := by rw [← Real.exp_nat_mul]; congr 1; ring + +lemma scaledOverlapShape_nonneg (n : ℕ) (x : ℝ) : 0 ≤ scaledOverlapShape n x := by + unfold scaledOverlapShape; positivity + +lemma scaledOverlapShape_bound (n : ℕ) (x : ℝ) : + scaledOverlapShape n x ≤ Real.exp (-(1/4 : ℝ) * x^2) := by + unfold scaledOverlapShape + calc + (Real.sqrt (1-x^2/(n+6)))^(n+3) ≤ Real.exp (-(x^2/(n+6))/2)^(n+3) := + pow_le_pow_left₀ (Real.sqrt_nonneg _) (sqrt_sub_le_exp _) _ + _ = Real.exp (-((n+3 : ℕ) : ℝ) * x^2 / (2*(n+6))) := by + rw [← Real.exp_nat_mul]; congr 1; push_cast; field_simp + _ ≤ _ := by + apply Real.exp_le_exp.mpr + have hn : (0 : ℝ) ≤ n := Nat.cast_nonneg _ + have hp : (0 : ℝ) < 2*((n : ℝ)+6) := by positivity + rw [div_le_iff₀ hp] + push_cast + nlinarith [mul_nonneg hn (sq_nonneg x)] + +lemma sqrt_nat_pow {a : ℝ} (ha : 0 ≤ a) (n : ℕ) : + Real.sqrt (a^n) = Real.sqrt a ^ n := by + apply (sq_eq_sq₀ (Real.sqrt_nonneg _) (by positivity)).mp + rw [Real.sq_sqrt (pow_nonneg ha n), ← pow_mul, mul_comm n 2, pow_mul, Real.sq_sqrt ha] + +lemma sqrt_exp_half (x : ℝ) : Real.sqrt (Real.exp x) = Real.exp (x/2) := by + apply (sq_eq_sq₀ (Real.sqrt_nonneg _) (by positivity)).mp + rw [Real.sq_sqrt (Real.exp_pos _).le, ← Real.exp_nat_mul] + congr 1 + ring + +lemma scaledOverlapShape_tendsto (x : ℝ) : + Tendsto (fun n => scaledOverlapShape n x) atTop (𝓝 (Real.exp (-x^2/2))) := by + have hinv : Tendsto (fun n : ℕ => (x^2 : ℝ)/(n+6)) atTop (𝓝 0) := by + exact tendsto_const_nhds.div_atTop (tendsto_atTop_add_const_right _ 6 tendsto_natCast_atTop_atTop) + have hb : Tendsto (fun n : ℕ => (1 : ℝ)-x^2/(n+6)) atTop (𝓝 1) := by + simpa using tendsto_const_nhds.sub hinv + have hbpos : ∀ᶠ n : ℕ in atTop, 0 < (1 : ℝ)-x^2/(n+6) := hb.eventually (eventually_gt_nhds zero_lt_one) + have hp := (Real.tendsto_one_add_div_pow_exp (-x^2)).comp (tendsto_add_atTop_nat 6) + have hnum : Tendsto (fun n : ℕ => Real.sqrt ((1-x^2/(n+6))^(n+6))) atTop + (𝓝 (Real.exp (-x^2/2))) := by + convert Real.continuous_sqrt.continuousAt.tendsto.comp hp using 1 + · ext n; congr 2; push_cast; ring + · rw [sqrt_exp_half] + have hden : Tendsto (fun n : ℕ => Real.sqrt (1-x^2/(n+6))^3) atTop (𝓝 1) := by + simpa using (Real.continuous_sqrt.continuousAt.tendsto.comp hb).pow 3 + have hr := hnum.div hden (by norm_num : (1 : ℝ) ≠ 0) + simp only [div_one] at hr + apply hr.congr' + filter_upwards [hbpos] with n hn + dsimp only [Pi.div_apply] + rw [sqrt_nat_pow hn.le] + unfold scaledOverlapShape + have hne : Real.sqrt (1-x^2/((n : ℝ)+6)) ≠ 0 := (Real.sqrt_pos.mpr hn).ne' + rw [show n+6 = n+3+3 by omega, pow_add] + exact mul_div_cancel_right₀ _ (pow_ne_zero 3 hne) + +lemma scaledOverlapShape_integrable (n : ℕ) : Integrable (scaledOverlapShape n) := by + apply (integrable_exp_neg_mul_sq (by norm_num : (0:ℝ) < 1/4)).mono' (by unfold scaledOverlapShape; fun_prop) + exact ae_of_all _ (fun x => by simpa only [Real.norm_eq_abs, abs_of_nonneg (scaledOverlapShape_nonneg n x)] using scaledOverlapShape_bound n x) + +lemma scaledOverlapShape_integral_tendsto : + Tendsto (fun n => ∫ x, scaledOverlapShape n x) atTop (𝓝 (Real.sqrt (2*Real.pi))) := by + have h := @tendsto_integral_of_dominated_convergence ℝ ℝ _ _ _ volume + scaledOverlapShape (fun x => Real.exp (-(1/2:ℝ)*x^2)) (fun x => Real.exp (-(1/4:ℝ)*x^2)) + (fun n => (scaledOverlapShape_integrable n).aestronglyMeasurable) + (integrable_exp_neg_mul_sq (by norm_num : (0:ℝ) < 1/4)) + (fun n => ae_of_all _ (fun x => by simpa only [Real.norm_eq_abs, abs_of_nonneg (scaledOverlapShape_nonneg n x)] using scaledOverlapShape_bound n x)) + (ae_of_all _ (fun x => by convert scaledOverlapShape_tendsto x using 1; congr 2; ring)) + convert h using 1 + rw [integral_gaussian] + congr 2 + ring + +lemma scaledOverlapShape_eq (n : ℕ) (x : ℝ) : + scaledOverlapShape n x = sphereOverlapShape (n+6) (x/Real.sqrt (n+6)) := by + simp only [scaledOverlapShape, sphereOverlapShape, show n+6-3 = n+3 by omega, + div_pow] + rw [Real.sq_sqrt (show (0:ℝ) ≤ (n:ℝ)+6 by positivity)] + +lemma overlapShape_normalizer_tendsto : + Tendsto (fun n : ℕ => Real.sqrt n * ∫ q : ℝ, sphereOverlapShape n q) atTop + (𝓝 (Real.sqrt (2*Real.pi))) := by + rw [← tendsto_add_atTop_iff_nat 6] + convert scaledOverlapShape_integral_tendsto using 1 + ext n + simp_rw [scaledOverlapShape_eq] + rw [Measure.integral_comp_div, smul_eq_mul, abs_of_nonneg (Real.sqrt_nonneg _)] + push_cast + rfl + +lemma sphereOverlapShape_pos {n : ℕ} {q : ℝ} (hq : |q| < 1) : + 0 < sphereOverlapShape n q := by + unfold sphereOverlapShape + apply pow_pos + apply Real.sqrt_pos.mpr + nlinarith [(abs_lt.mp hq).1, (abs_lt.mp hq).2] + +lemma sphereOverlapShape_log_error {n : ℕ} (hn : 3 ≤ n) {q : ℝ} (hq : |q| ≤ 1/2) : + |Real.log (sphereOverlapShape n q)+(n:ℝ)*q^2/2| ≤ (n:ℝ)*q^4+2*q^2 := by + have hq2 : q^2 ≤ 1/4 := by nlinarith [(abs_le.mp hq).1, (abs_le.mp hq).2] + have hnp : (0:ℝ) ≤ n := Nat.cast_nonneg _ + have hnn : (0:ℝ) ≤ n-3 := by + have : (3:ℝ) ≤ n := by exact_mod_cast hn + linarith + have hid : Real.log (sphereOverlapShape n q)+(n:ℝ)*q^2/2 = + ((n:ℝ)-3)/2*(Real.log (1-q^2)+q^2)+3*q^2/2 := by + rw [sphereOverlapShape, Real.log_pow, Real.log_sqrt (by linarith), Nat.cast_sub hn] + push_cast + ring + rw [hid] + calc + _ ≤ |((n:ℝ)-3)/2| * |Real.log (1-q^2)+q^2| + 3*q^2/2 := by + have h := abs_add_le (((n:ℝ)-3)/2*(Real.log (1-q^2)+q^2)) (3*q^2/2) + rw [abs_mul, abs_of_nonneg (show 0 ≤ 3*q^2/2 by positivity)] at h + exact h + _ = ((n:ℝ)-3)/2 * |Real.log (1-q^2)+q^2| + 3*q^2/2 := by + rw [abs_of_nonneg (by positivity : (0:ℝ) ≤ ((n:ℝ)-3)/2)] + _ ≤ ((n:ℝ)-3)/2 * (2*q^4) + 3*q^2/2 := by gcongr; exact log_square_error hq + _ ≤ _ := by nlinarith [show 0 ≤ q^4 by positivity, sq_nonneg q] + +lemma sphereOverlapShape_local_limit {q : ℕ → ℝ} (hq : Tendsto q atTop (𝓝 0)) + (hfour : Tendsto (fun n : ℕ => (n:ℝ)*q n^4) atTop (𝓝 0)) : + Tendsto (fun n : ℕ => sphereOverlapShape n (q n)*Real.exp ((n:ℝ)*q n^2/2)) + atTop (𝓝 1) := by + have hev : ∀ᶠ n in atTop, |q n| ≤ 1/2 := + hq.abs.eventually (eventually_le_nhds (by norm_num : |(0:ℝ)| < 1/2)) + have hlog : Tendsto (fun n : ℕ => Real.log (sphereOverlapShape n (q n))+(n:ℝ)*q n^2/2) + atTop (𝓝 0) := by + apply squeeze_zero_norm' _ (show Tendsto (fun n : ℕ => (n:ℝ)*q n^4+2*q n^2) atTop (𝓝 0) from by + simpa using hfour.add ((hq.pow 2).const_mul 2)) + filter_upwards [hev,eventually_ge_atTop 3] with n hqn hn + simpa only [Real.norm_eq_abs] using sphereOverlapShape_log_error hn hqn + have he := Real.continuous_exp.continuousAt.tendsto.comp hlog + rw [Real.exp_zero] at he + apply he.congr' + filter_upwards [hev] with n hn + dsimp only [Function.comp_apply] + rw [Real.exp_add, Real.exp_log (sphereOverlapShape_pos (lt_of_le_of_lt hn (by norm_num)))] + +def sphereOverlapDensity (n : ℕ) (q : ℝ) : ℝ := + sphereOverlapShape n q / (∫ r : ℝ, sphereOverlapShape n r) + +lemma local_overlap_constant : Real.exp (Real.log 2-Real.log (2*Real.pi)/2) * + Real.sqrt (2*Real.pi) / 2 = 1 := by + rw [Real.exp_sub, ← Real.log_sqrt (by positivity : (0:ℝ) ≤ 2*Real.pi), + Real.exp_log (by norm_num : (0:ℝ)<2), Real.exp_log (by positivity)] + field_simp + +lemma local_overlap_const_pos : 0 < Real.sqrt (2*Real.pi) := by positivity + +lemma cube_sphere_overlap_local_ratio {j : ℕ → ℕ} + (hj : ∀ᶠ n : ℕ in atTop, j n ≤ n) + (hq : Tendsto (fun n => latticeOverlap n (j n)) atTop (𝓝 0)) + (hfour : Tendsto (fun n : ℕ => (n:ℝ)*latticeOverlap n (j n)^4) atTop (𝓝 0)) : + Tendsto (fun n : ℕ => cubeOverlapMass n (j n) / + ((2/(n:ℝ))*sphereOverlapDensity n (latticeOverlap n (j n)))) atTop (𝓝 1) := by + have hi := cubeOverlapMass_local_limit hj hq hfour + have hs := sphereOverlapShape_local_limit hq hfour + have hz := overlapShape_normalizer_tendsto + have hr := (hi.mul hz).div (hs.const_mul 2) (by norm_num : (2:ℝ)*1≠0) + simp only [mul_one, local_overlap_constant] at hr + apply hr.congr' + have heq : ∀ᶠ n in atTop, |latticeOverlap n (j n)| < 1 := + hq.abs.eventually (eventually_lt_nhds (by norm_num : |(0:ℝ)| < 1)) + have hzpos : ∀ᶠ n : ℕ in atTop, 0 < Real.sqrt n * ∫ q : ℝ, sphereOverlapShape n q := + hz.eventually (eventually_gt_nhds local_overlap_const_pos) + filter_upwards [eventually_gt_atTop 0,heq,hzpos] with n hn hq hnz + dsimp only [Pi.div_apply, Pi.mul_apply] + unfold sphereOverlapDensity + have hn0 : (n:ℝ) ≠ 0 := by positivity + have hS : Real.sqrt n ≠ 0 := by positivity + have hZ : (∫ q : ℝ, sphereOverlapShape n q) ≠ 0 := + (mul_ne_zero_iff.mp hnz.ne').2 + have hf := (sphereOverlapShape_pos (n:=n) hq).ne' + field_simp + rw [Real.sq_sqrt (Nat.cast_nonneg n)] + +lemma latticeOverlap_center_bound {n : ℕ} (hn : 0 < n) : + |latticeOverlap n (n/2)| ≤ 1/(n:ℝ) := by + have hnR : (0:ℝ) (n:ℝ)*c n^4) atTop (𝓝 0)) + (hcmin : ∀ᶠ n : ℕ in atTop, 1/(n:ℝ) ≤ c n) : + ∀ ε > 0, ∀ᶠ n : ℕ in atTop, ∀ j ≤ n, |latticeOverlap n j| ≤ c n → + |cubeOverlapMass n j / ((2/(n:ℝ))*sphereOverlapDensity n (latticeOverlap n j))-1| < ε := by + intro ε hε + let P (n j : ℕ) : Prop := j ≤ n ∧ |latticeOverlap n j| ≤ c n ∧ + ε ≤ |cubeOverlapMass n j / ((2/(n:ℝ))*sphereOverlapDensity n (latticeOverlap n j))-1| + classical + let j : ℕ → ℕ := fun n => if h : ∃ j, P n j then h.choose else n/2 + have hj : ∀ n, j n ≤ n := by + intro n + unfold j + split_ifs with h + · exact h.choose_spec.1 + · exact Nat.div_le_self _ _ + have hjc : ∀ᶠ n : ℕ in atTop, |latticeOverlap n (j n)| ≤ c n := by + filter_upwards [hcmin,eventually_gt_atTop 0] with n hcn hn + unfold j + split_ifs with h + · exact h.choose_spec.2.1 + · exact (latticeOverlap_center_bound hn).trans hcn + have hq : Tendsto (fun n => latticeOverlap n (j n)) atTop (𝓝 0) := by + apply squeeze_zero_norm' _ hc + simpa only [Real.norm_eq_abs] using hjc + have hq4 : Tendsto (fun n : ℕ => (n:ℝ)*latticeOverlap n (j n)^4) atTop (𝓝 0) := by + apply squeeze_zero' (Eventually.of_forall fun n => by positivity) _ hc4 + filter_upwards [hjc] with n hn + exact mul_le_mul_of_nonneg_left (by simpa only [pow_abs, abs_of_nonneg (show 0 ≤ latticeOverlap n (j n)^4 by positivity)] using pow_le_pow_left₀ (abs_nonneg _) hn 4) (Nat.cast_nonneg n) + have hr := cube_sphere_overlap_local_ratio (Eventually.of_forall hj) hq hq4 + have he : ∀ᶠ n : ℕ in atTop, + |cubeOverlapMass n (j n) / ((2/(n:ℝ))*sphereOverlapDensity n (latticeOverlap n (j n)))-1| < ε := by + have h := (hr.sub_const 1).abs + simpa only [sub_self,abs_zero] using h.eventually (eventually_lt_nhds (by simpa using hε)) + filter_upwards [he] with n hn + intro k hkn hkc + by_contra hbad + have hex : ∃ k, P n k := ⟨k,hkn,hkc,not_lt.mp hbad⟩ + have : P n (j n) := by simpa only [j,dite_eq_left hex] using hex.choose_spec + exact (not_le_of_gt hn) this.2.2 + +lemma sphereOverlapShape_continuous (n : ℕ) : Continuous (sphereOverlapShape n) := by + unfold sphereOverlapShape + fun_prop + +lemma sphereOverlapShape_nonneg (n : ℕ) (q : ℝ) : 0 ≤ sphereOverlapShape n q := by + unfold sphereOverlapShape + positivity + +lemma sphereOverlapShape_eq_zero {n : ℕ} (hn : 4 ≤ n) {q : ℝ} (hq : 1 ≤ |q|) : + sphereOverlapShape n q = 0 := by + unfold sphereOverlapShape + rw [Real.sqrt_eq_zero_of_nonpos (by nlinarith [sq_abs q]), zero_pow (by omega : n-3≠0)] + +lemma sphereOverlapShape_integrable {n : ℕ} (hn : 4 ≤ n) : Integrable (sphereOverlapShape n) := by + apply (sphereOverlapShape_continuous n).integrable_of_hasCompactSupport + apply HasCompactSupport.of_support_subset_isCompact (isCompact_Icc (a := (-1:ℝ)) (b := 1)) + intro q hq + by_contra h + apply hq + exact sphereOverlapShape_eq_zero hn (by + rw [Set.mem_Icc,not_and_or] at h + rcases h with h | h <;> have ha := le_abs_self q <;> have hb := neg_le_abs q <;> linarith) + +lemma overlapShape_normalizer_pos {n : ℕ} (hn : 4 ≤ n) : + 0 < ∫ q : ℝ, sphereOverlapShape n q := by + apply (sphereOverlapShape_continuous n).integral_pos_of_hasCompactSupport_nonneg_nonzero (x := 0) + · apply HasCompactSupport.of_support_subset_isCompact (isCompact_Icc (a := (-1:ℝ)) (b := 1)) + intro q hq + by_contra h + apply hq + exact sphereOverlapShape_eq_zero hn (by + rw [Set.mem_Icc,not_and_or] at h + rcases h with h | h <;> have ha := le_abs_self q <;> have hb := neg_le_abs q <;> linarith) + · exact sphereOverlapShape_nonneg n + · norm_num [sphereOverlapShape] + +lemma sphereOverlapShape_log_variation {n : ℕ} (hn : 3 ≤ n) {q r a δ : ℝ} + (ha : a ≤ 1/2) (hq : |q| ≤ a) (hr : |r| ≤ a) (hδ : |r-q| ≤ δ) : + |Real.log (sphereOverlapShape n r)-Real.log (sphereOverlapShape n q)| ≤ + 2*(n:ℝ)*a^4+4*a^2+(n:ℝ)*a*δ := by + have ha0 : 0 ≤ a := (abs_nonneg q).trans hq + have hd0 : 0 ≤ δ := (abs_nonneg _).trans hδ + have hq2 : q^2 ≤ a^2 := by nlinarith [mul_nonneg (sub_nonneg.mpr hq) (show 0 ≤ a+|q| by positivity), sq_abs q] + have hr2 : r^2 ≤ a^2 := by nlinarith [mul_nonneg (sub_nonneg.mpr hr) (show 0 ≤ a+|r| by positivity), sq_abs r] + have hq4 : q^4 ≤ a^4 := by nlinarith [sq_nonneg (a^2-q^2)] + have hr4 : r^4 ≤ a^4 := by nlinarith [sq_nonneg (a^2-r^2)] + have hsum : |r+q| ≤ 2*a := (abs_add_le _ _).trans (by linarith) + have hdiff : |r^2-q^2| ≤ δ*(2*a) := by + rw [show r^2-q^2=(r-q)*(r+q) by ring, abs_mul] + exact mul_le_mul hδ hsum (abs_nonneg _) hd0 + have hqe := sphereOverlapShape_log_error hn (hq.trans ha) + have hre := sphereOverlapShape_log_error hn (hr.trans ha) + have hid : Real.log (sphereOverlapShape n r)-Real.log (sphereOverlapShape n q) = + (Real.log (sphereOverlapShape n r)+(n:ℝ)*r^2/2)- + (Real.log (sphereOverlapShape n q)+(n:ℝ)*q^2/2)-(n:ℝ)/2*(r^2-q^2) := by ring + rw [hid] + calc + _ ≤ |Real.log (sphereOverlapShape n r)+(n:ℝ)*r^2/2| + + |Real.log (sphereOverlapShape n q)+(n:ℝ)*q^2/2| + |(n:ℝ)/2*(r^2-q^2)| := + by + have h₁ := abs_sub (Real.log (sphereOverlapShape n r)+(n:ℝ)*r^2/2 - (Real.log (sphereOverlapShape n q)+(n:ℝ)*q^2/2)) ((n:ℝ)/2*(r^2-q^2)) + have h₂ := abs_sub (Real.log (sphereOverlapShape n r)+(n:ℝ)*r^2/2) (Real.log (sphereOverlapShape n q)+(n:ℝ)*q^2/2) + linarith + _ ≤ ((n:ℝ)*r^4+2*r^2)+((n:ℝ)*q^4+2*q^2)+((n:ℝ)/2)*(δ*(2*a)) := by + rw [abs_mul,abs_of_nonneg (by positivity : (0:ℝ) ≤ (n:ℝ)/2)] + gcongr + _ ≤ _ := by nlinarith [mul_nonneg (Nat.cast_nonneg n) (sub_nonneg.mpr hq4), + mul_nonneg (Nat.cast_nonneg n) (sub_nonneg.mpr hr4)] + +lemma sphereOverlapDensity_variation {n : ℕ} (hn : 4 ≤ n) {q r a δ : ℝ} + (ha : a ≤ 1/2) (hq : |q| ≤ a) (hr : |r| ≤ a) (hδ : |r-q| ≤ δ) : + sphereOverlapDensity n q * Real.exp (-(2*(n:ℝ)*a^4+4*a^2+(n:ℝ)*a*δ)) ≤ + sphereOverlapDensity n r := by + have h := (abs_le.mp (sphereOverlapShape_log_variation (n:=n) (by omega) ha hq hr hδ)).1 + have hqp := sphereOverlapShape_pos (n:=n) (hq.trans_lt (ha.trans_lt (by norm_num))) + have hrp := sphereOverlapShape_pos (n:=n) (hr.trans_lt (ha.trans_lt (by norm_num))) + have he := Real.exp_le_exp.mpr (show Real.log (sphereOverlapShape n q)- + (2*(n:ℝ)*a^4+4*a^2+(n:ℝ)*a*δ) ≤ Real.log (sphereOverlapShape n r) by linarith) + rw [Real.exp_sub,Real.exp_log hqp,Real.exp_log hrp,div_eq_mul_inv,← Real.exp_neg] at he + unfold sphereOverlapDensity + simpa only [div_mul_eq_mul_div] using div_le_div_of_nonneg_right he (overlapShape_normalizer_pos hn).le + +def outwardBinLeft (δ q : ℝ) : ℝ := if q < 0 then q-δ else if 0 < q then q else -δ/2 + +def outwardBin (δ q : ℝ) : Set ℝ := Ioc (outwardBinLeft δ q) (outwardBinLeft δ q+δ) + +lemma outwardBin_distance {δ q r : ℝ} (_hδ : 0 ≤ δ) (hr : r ∈ outwardBin δ q) : + |r-q| ≤ δ ∧ |q| ≤ |r| := by + unfold outwardBin outwardBinLeft at hr + split_ifs at hr with hq hq + · rw [Set.mem_Ioc] at hr + constructor + · rw [abs_le]; constructor <;> linarith + · rw [abs_of_neg hq,abs_of_nonpos (by linarith : r ≤ 0)]; linarith + · rw [Set.mem_Ioc] at hr + constructor + · rw [abs_le]; constructor <;> linarith + · rw [abs_of_pos hq,abs_of_nonneg (by linarith : 0 ≤ r)]; linarith + · have hq0 : q=0 := by linarith + rw [Set.mem_Ioc] at hr + constructor + · rw [hq0,sub_zero,abs_le]; constructor <;> linarith + · rw [hq0,abs_zero]; exact abs_nonneg _ + +lemma outwardBin_separated {δ q r : ℝ} (hδ : 0 < δ) (hqr : q+δ ≤ r) : + outwardBinLeft δ q+δ ≤ outwardBinLeft δ r := by + unfold outwardBinLeft + split_ifs <;> linarith + +lemma outwardBin_disjoint {δ q r : ℝ} (hδ : 0 < δ) (hqr : q+δ ≤ r) : + Disjoint (outwardBin δ q) (outwardBin δ r) := by + apply Set.disjoint_left.mpr + intro x hx hy + have hb := outwardBin_separated hδ hqr + have hx' := (show x ∈ Set.Ioc _ _ from hx).2 + have hy' := (show x ∈ Set.Ioc _ _ from hy).1 + linarith + +lemma sphereOverlapDensity_nonneg (n : ℕ) (q : ℝ) : 0 ≤ sphereOverlapDensity n q := by + exact div_nonneg (sphereOverlapShape_nonneg _ _) (integral_nonneg (sphereOverlapShape_nonneg n)) + +lemma sphereOverlapDensity_continuous (n : ℕ) : Continuous (sphereOverlapDensity n) := + (sphereOverlapShape_continuous n).div_const _ + +lemma sphereOverlapDensity_mul_integrable {n : ℕ} (hn : 4 ≤ n) {h : ℝ → ℝ} (hh : Continuous h) : + Integrable (fun q => h q*sphereOverlapDensity n q) := by + apply (hh.mul (sphereOverlapDensity_continuous n)).integrable_of_hasCompactSupport + apply HasCompactSupport.of_support_subset_isCompact (isCompact_Icc (a := (-1:ℝ)) (b := 1)) + intro q hq + by_contra hnq + apply hq + have : sphereOverlapShape n q = 0 := sphereOverlapShape_eq_zero hn (by + rw [Set.mem_Icc,not_and_or] at hnq + rcases hnq with h | h <;> have ha := le_abs_self q <;> have hb := neg_le_abs q <;> linarith) + change h q * sphereOverlapDensity n q = 0 + rw [sphereOverlapDensity,this,zero_div,mul_zero] + +lemma outwardBin_integral_const (δ q c : ℝ) (hδ : 0 ≤ δ) : + (∫ _ : ℝ in outwardBin δ q, c) = δ*c := by + rw [integral_const,measureReal_restrict_apply_univ,outwardBin,Real.volume_real_Ioc] + simp only [add_sub_cancel_left,max_eq_left hδ,smul_eq_mul] + +lemma outwardBin_integral_lower {n : ℕ} (hn : 4 ≤ n) {h : ℝ → ℝ} (hc : Continuous h) + (h0 : ∀ r, 0 ≤ h r) (hm : ∀ q r, |q| ≤ |r| → h q ≤ h r) + {a δ q : ℝ} (hδ : 0 ≤ δ) (ha : a ≤ 1/2) (hq : |q|+δ ≤ a) : + δ*(h q*sphereOverlapDensity n q*Real.exp (-(2*(n:ℝ)*a^4+4*a^2+(n:ℝ)*a*δ))) ≤ + ∫ r in outwardBin δ q, h r*sphereOverlapDensity n r := by + rw [← outwardBin_integral_const δ q _ hδ] + apply setIntegral_mono_on continuous_const.integrableOn_Ioc + ((hc.mul (sphereOverlapDensity_continuous n)).integrableOn_Ioc) measurableSet_Ioc + intro r hr + obtain ⟨hd,hmr⟩ := outwardBin_distance hδ hr + have hra : |r| ≤ a := by + have hl : |r| ≤ |r-q|+|q| := by simpa only [sub_add_cancel] using abs_add_le (r-q) q + linarith + have hvar := sphereOverlapDensity_variation hn ha (show |q| ≤ a by linarith) hra hd + calc + _ = h q*(sphereOverlapDensity n q*Real.exp (-(2*(n:ℝ)*a^4+4*a^2+(n:ℝ)*a*δ))) := by ring + _ ≤ h r*sphereOverlapDensity n r := mul_le_mul (hm q r hmr) hvar (mul_nonneg (sphereOverlapDensity_nonneg n q) (Real.exp_pos _).le) (h0 r) + +lemma latticeOverlap_spacing {n j k : ℕ} (hn : 0 < n) (hjk : j < k) : + latticeOverlap n j+2/(n:ℝ) ≤ latticeOverlap n k := by + have h : (j:ℝ)+1 ≤ k := by exact_mod_cast hjk + have hnR : (0:ℝ) Disjoint (outwardBin (2/(n:ℝ)) (latticeOverlap n j)) + (outwardBin (2/(n:ℝ)) (latticeOverlap n k))) := by + intro j k hjk + rcases lt_or_gt_of_ne hjk with hjk | hkj + · exact outwardBin_disjoint (by positivity) (latticeOverlap_spacing hn hjk) + · exact (outwardBin_disjoint (by positivity) (latticeOverlap_spacing hn hkj)).symm + +lemma outwardBin_sum_integral_le {n : ℕ} (hn : 4 ≤ n) {h : ℝ → ℝ} (hc : Continuous h) + (h0 : ∀ q, 0 ≤ h q) (t : Finset ℕ) : + (∑ j ∈ t, ∫ r in outwardBin (2/(n:ℝ)) (latticeOverlap n j), h r*sphereOverlapDensity n r) ≤ + ∫ r : ℝ, h r*sphereOverlapDensity n r := by + rw [← integral_biUnion_finset t (s := fun j => outwardBin (2/(n:ℝ)) (latticeOverlap n j)) (fun _ _ => measurableSet_Ioc) + (fun _ _ _ _ hjk => outwardBin_lattice_disjoint (n:=n) (by omega) hjk) + (fun _ _ => (sphereOverlapDensity_mul_integrable hn hc).integrableOn)] + apply setIntegral_le_integral (sphereOverlapDensity_mul_integrable hn hc) + exact ae_of_all _ (fun q => mul_nonneg (h0 q) (sphereOverlapDensity_nonneg n q)) + +lemma central_overlap_sum_bound {n : ℕ} (hn : 4 ≤ n) {h : ℝ → ℝ} (hc : Continuous h) + (h0 : ∀ r, 0 ≤ h r) (hm : ∀ q r, |q| ≤ |r| → h q ≤ h r) + {a e : ℝ} (ha : a ≤ 1/2) (he : 0 ≤ e) (t : Finset ℕ) + (ht : ∀ j ∈ t, |latticeOverlap n j|+2/(n:ℝ) ≤ a) + (hp : ∀ j ∈ t, cubeOverlapMass n j ≤ (1+e)*(2/(n:ℝ))*sphereOverlapDensity n (latticeOverlap n j)) : + (∑ j ∈ t, cubeOverlapMass n j*h (latticeOverlap n j)) ≤ + (1+e)*Real.exp (2*(n:ℝ)*a^4+4*a^2+2*a) * ∫ r : ℝ, h r*sphereOverlapDensity n r := by + have hnR : (n:ℝ)≠0 := by positivity + have hE : (n:ℝ)*a*(2/(n:ℝ))=2*a := by field_simp + let C := (1+e)*Real.exp (2*(n:ℝ)*a^4+4*a^2+2*a) + have hC : 0 ≤ C := by dsimp [C]; positivity + calc + _ ≤ ∑ j ∈ t, C * ∫ r in outwardBin (2/(n:ℝ)) (latticeOverlap n j), h r*sphereOverlapDensity n r := by + apply Finset.sum_le_sum + intro j hj + have hbin := outwardBin_integral_lower hn hc h0 hm (by positivity) ha (ht j hj) + rw [hE] at hbin + have hi := mul_le_mul_of_nonneg_left hbin hC + have hid : C * ((2/(n:ℝ))*(h (latticeOverlap n j)*sphereOverlapDensity n (latticeOverlap n j)* + Real.exp (-(2*(n:ℝ)*a^4+4*a^2+2*a)))) = + ((1+e)*(2/(n:ℝ))*sphereOverlapDensity n (latticeOverlap n j))*h (latticeOverlap n j) := by + dsimp [C] + rw [Real.exp_neg] + field_simp + rw [hid] at hi + exact (mul_le_mul_of_nonneg_right (hp j hj) (h0 _)).trans hi + _ = C * (∑ j ∈ t, ∫ r in outwardBin (2/(n:ℝ)) (latticeOverlap n j), h r*sphereOverlapDensity n r) := by rw [Finset.mul_sum] + _ ≤ _ := mul_le_mul_of_nonneg_left (outwardBin_sum_integral_le hn hc h0 t) hC + +lemma overlap_bin_error_tendsto {c : ℕ → ℝ} (hc : Tendsto c atTop (𝓝 0)) + (hc4 : Tendsto (fun n : ℕ => (n:ℝ)*c n^4) atTop (𝓝 0)) + (hcmin : ∀ᶠ n : ℕ in atTop, 1/(n:ℝ) ≤ c n) : + Tendsto (fun n : ℕ => 2*(n:ℝ)*(c n+2/(n:ℝ))^4+4*(c n+2/(n:ℝ))^2+ + 2*(c n+2/(n:ℝ))) atTop (𝓝 0) := by + have hd : Tendsto (fun n : ℕ => 2/(n:ℝ)) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop + have ha : Tendsto (fun n : ℕ => c n+2/(n:ℝ)) atTop (𝓝 0) := by simpa using hc.add hd + have hfour : Tendsto (fun n : ℕ => (n:ℝ)*(c n+2/(n:ℝ))^4) atTop (𝓝 0) := by + apply squeeze_zero' (Eventually.of_forall fun n => by positivity) _ (show Tendsto (fun n : ℕ => 81*((n:ℝ)*c n^4)) atTop (𝓝 0) from by simpa using hc4.const_mul 81) + filter_upwards [hcmin] with n hn + have hc0 : 0 ≤ c n := (by positivity : 0 ≤ 1/(n:ℝ)).trans hn + have hδ : 2/(n:ℝ) ≤ 2*c n := by + calc + 2/(n:ℝ) = 2*(1/(n:ℝ)) := by ring + _ ≤ 2*c n := mul_le_mul_of_nonneg_left hn (by norm_num) + have h := pow_le_pow_left₀ (show 0 ≤ c n+2/(n:ℝ) by positivity) (show c n+2/(n:ℝ) ≤ 3*c n by linarith) 4 + have hi := mul_le_mul_of_nonneg_left h (Nat.cast_nonneg n) + nlinarith + convert ((hfour.const_mul 2).add ((ha.pow 2).const_mul 4)).add (ha.const_mul 2) using 1 + · ext n; ring + · norm_num + +lemma central_overlap_uniform_bound {c : ℕ → ℝ} (hc : Tendsto c atTop (𝓝 0)) + (hc4 : Tendsto (fun n : ℕ => (n:ℝ)*c n^4) atTop (𝓝 0)) + (hcmin : ∀ᶠ n : ℕ in atTop, 1/(n:ℝ) ≤ c n) (ε : ℝ) (hε : 0 < ε) : + ∀ᶠ n : ℕ in atTop, ∀ h : ℝ → ℝ, Continuous h → (∀ q, 0 ≤ h q) → + (∀ q r, |q| ≤ |r| → h q ≤ h r) → + (∑ j ∈ (Finset.range (n+1)).filter (fun j => |latticeOverlap n j| ≤ c n), + cubeOverlapMass n j*h (latticeOverlap n j)) ≤ + (1+ε)*∫ r : ℝ, h r*sphereOverlapDensity n r := by + have hd : Tendsto (fun n : ℕ => 2/(n:ℝ)) atTop (𝓝 0) := + tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop + have ha : Tendsto (fun n : ℕ => c n+2/(n:ℝ)) atTop (𝓝 0) := by simpa using hc.add hd + have hfac : Tendsto (fun n : ℕ => (1+ε/2)*Real.exp (2*(n:ℝ)*(c n+2/(n:ℝ))^4+ + 4*(c n+2/(n:ℝ))^2+2*(c n+2/(n:ℝ)))) atTop (𝓝 (1+ε/2)) := by + simpa using (Real.continuous_exp.continuousAt.tendsto.comp (overlap_bin_error_tendsto hc hc4 hcmin)).const_mul (1+ε/2) + have hfe := hfac.eventually (eventually_le_nhds (show 1+ε/2 < 1+ε by linarith)) + have hae := ha.eventually (eventually_le_nhds (by norm_num : (0:ℝ)<1/2)) + have hpe := cube_sphere_overlap_uniform hc hc4 hcmin (ε/2) (by linarith) + filter_upwards [eventually_ge_atTop 4,hfe,hae,hpe] with n hn hf ha hp + intro h hcont h0 hmono + classical + let t := (Finset.range (n+1)).filter (fun j => |latticeOverlap n j| ≤ c n) + have hbin := central_overlap_sum_bound hn hcont h0 hmono ha (show 0 ≤ ε/2 by linarith) t + (fun j hj => by have := (Finset.mem_filter.mp hj).2; linarith) + have hmass : ∀ j ∈ t, cubeOverlapMass n j ≤ + (1+ε/2)*(2/(n:ℝ))*sphereOverlapDensity n (latticeOverlap n j) := by + intro j hj + have hjR := Finset.mem_range.mp (Finset.mem_filter.mp hj).1 + have hjq := (Finset.mem_filter.mp hj).2 + have hq : |latticeOverlap n j| < 1 := by + have : 0 ≤ 2/(n:ℝ) := by positivity + linarith + have hpos : 0 < (2/(n:ℝ))*sphereOverlapDensity n (latticeOverlap n j) := + mul_pos (by positivity) (div_pos (sphereOverlapShape_pos hq) (overlapShape_normalizer_pos hn)) + have hh := (abs_lt.mp (hp j (by omega) hjq)).2 + have hh' : cubeOverlapMass n j / ((2/(n:ℝ))*sphereOverlapDensity n (latticeOverlap n j)) ≤ 1+ε/2 := by linarith + simpa only [mul_assoc] using (div_le_iff₀ hpos).mp hh' + exact (hbin hmass).trans (mul_le_mul_of_nonneg_right hf (integral_nonneg (fun q => mul_nonneg (h0 q) (sphereOverlapDensity_nonneg n q)))) + +def overlapCentralCutoff (n : ℕ) : ℝ := (n:ℝ)^(-(7/24:ℝ)) + +lemma overlapCentralCutoff_tendsto : Tendsto overlapCentralCutoff atTop (𝓝 0) := + (tendsto_rpow_neg_atTop (by norm_num : (0:ℝ)<7/24)).comp tendsto_natCast_atTop_atTop + +lemma overlapCentralCutoff_fourth : + Tendsto (fun n : ℕ => (n:ℝ)*overlapCentralCutoff n^4) atTop (𝓝 0) := by + have h := (tendsto_rpow_neg_atTop (by norm_num : (0:ℝ)<1/6)).comp (tendsto_natCast_atTop_atTop (R:=ℝ)) + apply h.congr' + filter_upwards [eventually_gt_atTop 0] with n hn + dsimp only [Function.comp_apply,overlapCentralCutoff] + have hpow : ((n:ℝ)^(-(7/24:ℝ)))^4 = (n:ℝ)^(-(7/24:ℝ)*(4:ℝ)) := by + rw [Real.rpow_mul (by positivity)] + norm_num + rw [hpow] + conv_rhs => lhs; rw [← Real.rpow_one (n:ℝ)] + rw [← Real.rpow_add (by positivity)] + congr 1 + norm_num + +lemma overlapCentralCutoff_min : ∀ᶠ n : ℕ in atTop, 1/(n:ℝ) ≤ overlapCentralCutoff n := by + filter_upwards [eventually_ge_atTop 1] with n hn + unfold overlapCentralCutoff + rw [one_div,← Real.rpow_neg_one] + exact Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hn) (by norm_num) + +open MeasureTheory Set + +lemma integral_shape_on_Ioo {n : ℕ} (hn : 4 ≤ n) (h : ℝ → ℝ) : + (∫ q in Ioo (-1:ℝ) 1, h q*sphereOverlapShape n q) = ∫ q, h q*sphereOverlapShape n q := by + rw [← integral_indicator measurableSet_Ioo] + apply integral_congr_ae + filter_upwards [] with q + by_cases hq : q ∈ Ioo (-1:ℝ) 1 + · simp only [indicator_of_mem hq] + · have hqs : 1 ≤ |q| := by + rw [Set.mem_Ioo,not_and_or] at hq + rcases hq with hq | hq + · exact (le_neg_of_le_neg (le_of_not_gt hq)).trans (neg_le_abs q) + · exact (le_of_not_gt hq).trans (le_abs_self q) + simp only [indicator_of_notMem hq,sphereOverlapShape_eq_zero hn hqs,mul_zero] + +lemma overlapShapeMeasure_real_univ {n : ℕ} (hn : 4 ≤ n) : + (overlapShapeMeasure n Set.univ).toReal = ∫ q, sphereOverlapShape n q := by + rw [overlapShapeMeasure_univ,← integral_eq_lintegral_of_nonneg_ae + (Filter.Eventually.of_forall (sphereOverlapShape_nonneg n)) + (sphereOverlapShape_continuous n).aestronglyMeasurable] + simpa only [one_mul] using integral_shape_on_Ioo hn (fun _ => 1) + +lemma normalizedOverlapShape_integral {n : ℕ} (hn : 4 ≤ n) (h : ℝ → ℝ) : + (∫ q, h q ∂normalizedOverlapShape n) = ∫ q, h q*sphereOverlapDensity n q := by + rw [normalizedOverlapShape,integral_smul_measure,ENNReal.toReal_inv, + overlapShapeMeasure_real_univ hn] + rw [overlapShapeMeasure,integral_withDensity_eq_integral_toReal_smul + (by unfold sphereOverlapShape; fun_prop) (ae_of_all _ (fun _ => ENNReal.ofReal_lt_top))] + simp_rw [ENNReal.toReal_ofReal (sphereOverlapShape_nonneg _ _), smul_eq_mul] + simp_rw [mul_comm (sphereOverlapShape n _)] + rw [integral_shape_on_Ioo hn,← integral_const_mul] + apply integral_congr_ae + filter_upwards [] with q + unfold sphereOverlapDensity + ring + +lemma sphereOverlap_density_second_moment (n : ℕ) (lam : Fin (n+4) → ℝ) + {u v : EuclideanSpace ℝ (Fin (n+4))} {r : ℝ} + (hu : ‖u‖ = r) (hv : ‖v‖ = r) (horth : inner ℝ u v = 0) : + (∫ q : ℝ, pairMoment lam u v q*sphereOverlapDensity (n+4) q) = spherePartition lam 1 r^2 := by + rw [← normalizedOverlapShape_integral (by omega : 4 ≤ n+4),← sphereOverlapLaw_density (n+1)] + exact sphereOverlap_second_moment lam hu hv horth + +lemma rotatedCubePartition_second_lattice {n : ℕ} (hn : 0 < n) (lam : Fin n → ℝ) + {u v : EuclideanSpace ℝ (Fin n)} (hu : ‖u‖ = Real.sqrt n) (hv : ‖v‖ = Real.sqrt n) + (horth : inner ℝ u v = 0) : + (∫ U, rotatedCubePartition lam 1 U ^ 2 ∂orthogonalHaar (Fin n)) = + ∑ j ∈ Finset.range (n+1), cubeOverlapMass n j*pairMoment lam u v (latticeOverlap n j) := by + rw [rotatedCubePartition_second_moment hn lam hu hv horth,Finset.mul_sum] + apply Finset.sum_congr rfl + intro j _ + simp only [cubeOverlapMass,latticeOverlap,mul_assoc] + +lemma normalized_integral_square {Ω : Type*} [TopologicalSpace Ω] [MeasurableSpace Ω] + [BorelSpace Ω] [CompactSpace Ω] [T2Space Ω] {μ : Measure Ω} [IsProbabilityMeasure μ] + {f : Ω → ℝ} (hf : Continuous f) {S : ℝ} (hS : S ≠ 0) (hm : ∫ x, f x ∂μ = S) : + (∫ x, (f x/S-1)^2 ∂μ) = (∫ x, f x^2 ∂μ)/S^2-1 := by + have hi : Integrable f μ := by simpa only [integrableOn_univ] using hf.continuousOn.integrableOn_compact isCompact_univ + have hi2 : Integrable (fun x => f x^2) μ := by simpa only [integrableOn_univ] using (show Continuous (fun x => f x^2) from hf.pow 2).continuousOn.integrableOn_compact isCompact_univ + have he (x : Ω) : (f x/S-1)^2 = f x^2/S^2-2*(f x/S)+1 := by ring + simp_rw [he] + have his : Integrable (fun x => f x^2/S^2-2*(f x/S)) μ := + (hi2.div_const (S^2)).sub ((hi.div_const S).const_mul 2) + rw [integral_add his (integrable_const (1:ℝ)), + integral_sub (hi2.div_const (S^2)) ((hi.div_const S).const_mul 2), + integral_div,integral_const_mul,integral_div,hm,div_self hS,integral_const,probReal_univ,one_smul] + ring + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/CubeRestriction.lean b/lean/OAI/MathematicalPhysics/CriticalSK/CubeRestriction.lean new file mode 100644 index 0000000000000000000000000000000000000000..2c8a5e9949dd858eb458f84357f9fc9fafb7d4a0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/CubeRestriction.lean @@ -0,0 +1,371 @@ +import OAI.MathematicalPhysics.CriticalSK.CubeOverlap +import OAI.MathematicalPhysics.CriticalSK.OverlapMoments + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open MeasureTheory ProbabilityTheory + +open scoped ENNReal NNReal + +open scoped BigOperators InnerProductSpace + +open Module + +open scoped BigOperators ENNReal NNReal Real Topology + +open MeasureTheory ProbabilityTheory Filter + +open scoped BigOperators NNReal + +open scoped BigOperators + +open Matrix Polynomial + +open scoped BigOperators Topology + +open Filter + +open scoped BigOperators NNReal ENNReal Topology Pointwise Matrix.Norms.Elementwise + +open Set Metric MeasureTheory MeasureTheory.Measure + +open scoped ENNReal NNReal Topology + +open MeasureTheory MeasureTheory.Measure Set Metric + +open scoped BigOperators ENNReal Topology + +open Set MeasureTheory + +open scoped BigOperators ENNReal + +open MeasureTheory + +open Finset Real + +open Finset Real Filter + +open scoped Topology + +open MeasureTheory Filter Set Real + +open scoped ENNReal NNReal BigOperators + +open scoped NNReal ENNReal BigOperators + +open scoped NNReal ENNReal + +open ProbabilityTheory + +open Metric Set MeasureTheory + +open scoped ENNReal Pointwise + +open MeasureTheory Filter Set +namespace CriticalSK + +section + +def rotatedCubePair {n : ℕ} (lam : Fin n → ℝ) (g : ℝ → ℝ) + (U : Matrix.orthogonalGroup (Fin n) ℝ) : ℝ := + (Fintype.card (Spin n) : ℝ)⁻¹^2 * ∑ x : Spin n, ∑ y : Spin n, + g (cubeOverlap x y)*Real.exp ((diagonalEnergy lam (orthogonalIsometry U (cubeVector x))+ + diagonalEnergy lam (orthogonalIsometry U (cubeVector y)))/2) + +lemma rotatedCubePair_continuous {n : ℕ} (lam : Fin n → ℝ) (g : ℝ → ℝ) : + Continuous (rotatedCubePair lam g) := by + apply Continuous.const_mul + apply continuous_finsetSum + intro x _ + apply continuous_finsetSum + intro y _ + exact (cube_pair_energy_continuous lam x y).const_mul _ + +lemma rotatedCubePair_haar {n : ℕ} (hn : 0 < n) (lam : Fin n → ℝ) (g : ℝ → ℝ) + {u v : EuclideanSpace ℝ (Fin n)} (hu : ‖u‖ = Real.sqrt n) (hv : ‖v‖ = Real.sqrt n) + (horth : inner ℝ u v = 0) : + (∫ U, rotatedCubePair lam g U ∂orthogonalHaar (Fin n)) = + (2:ℝ)⁻¹^n * ∑ j ∈ Finset.range (n+1), (Nat.choose n j:ℝ)* + (g (-1+2*(j:ℝ)/n)*pairMoment lam u v (-1+2*(j:ℝ)/n)) := by + have hi (x y : Spin n) := (orthogonalHaar_integrable (cube_pair_energy_continuous lam x y)).const_mul + (g (cubeOverlap x y)) + simp_rw [rotatedCubePair] + rw [integral_const_mul] + rw [integral_finsetSum _ (fun x _ => integrable_finsetSum _ (fun y _ => hi x y))] + have hinner (x : Spin n) : (∫ U, ∑ y : Spin n, + g (cubeOverlap x y)*Real.exp ((diagonalEnergy lam (orthogonalIsometry U (cubeVector x))+ + diagonalEnergy lam (orthogonalIsometry U (cubeVector y)))/2) ∂orthogonalHaar (Fin n)) = + ∑ y : Spin n, g (cubeOverlap x y)*pairMoment lam u v (cubeOverlap x y) := by + rw [integral_finsetSum _ (fun y _ => hi x y)] + apply Finset.sum_congr rfl + intro y _ + rw [integral_const_mul,pair_energy_orbit lam (cubeVector_norm x) (cubeVector_norm y) hu hv horth + (cubeOverlap_abs_le_one x y) (cubeOverlap_gram hn x y)] + simp_rw [hinner] + exact cubeOverlap_binomial_sum hn (fun q => g q*pairMoment lam u v q) + +lemma rotatedCubePair_lattice {n : ℕ} (hn : 0 < n) (lam : Fin n → ℝ) (g : ℝ → ℝ) + {u v : EuclideanSpace ℝ (Fin n)} (hu : ‖u‖ = Real.sqrt n) (hv : ‖v‖ = Real.sqrt n) + (horth : inner ℝ u v = 0) : + (∫ U, rotatedCubePair lam g U ∂orthogonalHaar (Fin n)) = + ∑ j ∈ Finset.range (n+1), cubeOverlapMass n j* + (g (latticeOverlap n j)*pairMoment lam u v (latticeOverlap n j)) := by + rw [rotatedCubePair_haar hn lam g hu hv horth,Finset.mul_sum] + apply Finset.sum_congr rfl + intro j _ + simp only [cubeOverlapMass,latticeOverlap,mul_assoc] + +lemma squaredPairMoment_mono_abs {ι : Type*} [Fintype ι] [DecidableEq ι] + (lam : ι → ℝ) {u v : EuclideanSpace ℝ ι} (huv : ‖u‖ = ‖v‖) + {q t : ℝ} (hqt : |q| ≤ |t|) : q^2*pairMoment lam u v q ≤ t^2*pairMoment lam u v t := by + have hsq : q^2 ≤ t^2 := by simpa only [sq_abs] using pow_le_pow_left₀ (abs_nonneg q) hqt 2 + exact mul_le_mul hsq (pairMoment_mono_abs lam huv hqt) (pairMoment_nonneg lam u v q) (sq_nonneg t) + +lemma sphereOverlap_density_weighted_moment (n : ℕ) (lam : Fin (n+4) → ℝ) + {u v : EuclideanSpace ℝ (Fin (n+4))} {r : ℝ} + (hr : 0 < r) (hu : ‖u‖ = r) (hv : ‖v‖ = r) (horth : inner ℝ u v = 0) : + (∫ q : ℝ, (q^2*pairMoment lam u v q)*sphereOverlapDensity (n+4) q) / spherePartition lam 1 r^2 = + (∑ i, (∫ x : unitSphere (Fin (n+4)), ((r • x.val) i)^2 ∂sphereTilted lam 1 r)^2)/r^4 := by + rw [← normalizedOverlapShape_integral (by omega : 4 ≤ n+4),← sphereOverlapLaw_density (n+1)] + exact sphereOverlap_square_moment lam hr hu hv horth + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι] + +lemma orthogonal_radial_integral (F : EuclideanSpace ℝ ι → ℝ) (hF : Measurable F) + {r : ℝ} (hr : 0 < r) (x : EuclideanSpace ℝ ι) (hx : ‖x‖ = r) : + (∫ U, F (orthogonalIsometry U x) ∂orthogonalHaar ι) = + sphereAverage (fun u => F (r • u.val)) := by + have hu : ‖r⁻¹ • x‖ = 1 := by + rw [norm_smul,Real.norm_of_nonneg (inv_nonneg.mpr hr.le),hx,inv_mul_cancel₀ hr.ne'] + let u : unitSphere ι := ⟨r⁻¹ • x,mem_sphere_zero_iff_norm.mpr hu⟩ + have he : r • u.val = x := by + change r • (r⁻¹ • x) = x + rw [smul_smul,mul_inv_cancel₀ hr.ne',one_smul] + have hf : (fun U : Matrix.orthogonalGroup ι ℝ => F (orthogonalIsometry U x)) = + fun U => F (r • (orthogonalSphere U u).val) := by + funext U + rw [← he,(orthogonalIsometry U).map_smul] + rfl + rw [hf,← sphereUniform_integral,← (orthogonal_sphere_preserving u).map_eq] + exact (integral_map (orthogonal_sphere_preserving u).measurable.aemeasurable + (hF.comp (show Measurable (fun v : unitSphere ι => r • v.val) by fun_prop)).aestronglyMeasurable).symm + +omit [DecidableEq ι] in +lemma sphereRestricted_as_tilted (lam : ι → ℝ) (a r b : ℝ) (i : ι) : + sphereAverage (fun u => if |(r • u.val) i| ≤ b then + Real.exp (a/2*diagonalEnergy lam (r • u.val)) else 0) = + spherePartition lam a r * (sphereTilted lam a r).real + {u : unitSphere ι | |(r • u.val) i| ≤ b} := by + have hA : MeasurableSet {u : unitSphere ι | |(r • u.val) i| ≤ b} := + measurableSet_le (by fun_prop) measurable_const + rw [Measure.real,sphereTilted_apply_real lam a r hA,← integral_indicator hA] + unfold spherePartition sphereAverage + have hZ := (sphereWeight_integral_pos lam a r).ne' + have he : (fun u : unitSphere ι => if |(r • u.val) i| ≤ b then + Real.exp (a/2*diagonalEnergy lam (r • u.val)) else 0) = + {u : unitSphere ι | |(r • u.val) i| ≤ b}.indicator + (fun u => Real.exp (a/2*diagonalEnergy lam (r • u.val))) := rfl + rw [he] + simp only [div_mul_eq_mul_div] at hZ ⊢ + field_simp [hZ] + +end + +def rotatedCubeRestricted {n : ℕ} (lam : Fin n → ℝ) (a b : ℝ) (i : Fin n) + (U : Matrix.orthogonalGroup (Fin n) ℝ) : ℝ := + (Fintype.card (Spin n):ℝ)⁻¹ * ∑ x : Spin n, + if |(orthogonalIsometry U (cubeVector x)) i| ≤ b then + Real.exp (a/2*diagonalEnergy lam (orthogonalIsometry U (cubeVector x))) else 0 + +lemma rotatedCubeRestricted_measurable {n : ℕ} (lam : Fin n → ℝ) (a b : ℝ) (i : Fin n) : + Measurable (rotatedCubeRestricted lam a b i) := by + unfold rotatedCubeRestricted + apply Measurable.const_mul + apply Finset.measurable_sum + intro x _ + have hc := orthogonalIsometry_fixed_continuous (cubeVector x) + apply Measurable.ite (measurableSet_le ((EuclideanSpace.proj i).continuous.comp hc).abs.measurable measurable_const) + · exact ((continuous_const.mul ((diagonalEnergy_continuous lam).comp hc)).rexp).measurable + · exact measurable_const + +lemma rotatedCubeRestricted_nonneg {n : ℕ} (lam : Fin n → ℝ) (a b : ℝ) (i : Fin n) + (U : Matrix.orthogonalGroup (Fin n) ℝ) : 0 ≤ rotatedCubeRestricted lam a b i U := by + unfold rotatedCubeRestricted + positivity + +lemma rotatedCubeRestricted_le {n : ℕ} (lam : Fin n → ℝ) (a b : ℝ) (i : Fin n) + (U : Matrix.orthogonalGroup (Fin n) ℝ) : rotatedCubeRestricted lam a b i U ≤ rotatedCubePartition lam a U := by + unfold rotatedCubeRestricted rotatedCubePartition + apply mul_le_mul_of_nonneg_left _ (by positivity) + apply Finset.sum_le_sum + intro x _ + split_ifs + · exact le_rfl + · exact (Real.exp_pos _).le + +lemma rotatedCubeRestricted_integrable {n : ℕ} (lam : Fin n → ℝ) (a b : ℝ) (i : Fin n) : + Integrable (rotatedCubeRestricted lam a b i) (orthogonalHaar (Fin n)) := by + apply (orthogonalHaar_integrable (rotatedCubePartition_continuous lam a)).mono' + (rotatedCubeRestricted_measurable lam a b i).aestronglyMeasurable + exact Filter.Eventually.of_forall (fun U => by + rw [Real.norm_eq_abs,abs_of_nonneg (rotatedCubeRestricted_nonneg lam a b i U)] + exact rotatedCubeRestricted_le lam a b i U) + +lemma rotatedCubeRestricted_first_moment {n : ℕ} (hn : 0 < n) (lam : Fin n → ℝ) (a b : ℝ) (i : Fin n) : + (∫ U, rotatedCubeRestricted lam a b i U ∂orthogonalHaar (Fin n)) = + spherePartition lam a (Real.sqrt n)*(sphereTilted lam a (Real.sqrt n)).real + {u : unitSphere (Fin n) | |(Real.sqrt n • u.val) i| ≤ b} := by + classical + let : Nonempty (Fin n) := ⟨⟨0,hn⟩⟩ + let F : EuclideanSpace ℝ (Fin n) → ℝ := fun x => + if |x i| ≤ b then Real.exp (a/2*diagonalEnergy lam x) else 0 + have hF : Measurable F := Measurable.ite (measurableSet_le (by fun_prop) measurable_const) + (continuous_const.mul (diagonalEnergy_continuous lam)).rexp.measurable measurable_const + have hint (x : Spin n) : Integrable (fun U : Matrix.orthogonalGroup (Fin n) ℝ => F (orthogonalIsometry U (cubeVector x))) + (orthogonalHaar (Fin n)) := by + have hc := orthogonalIsometry_fixed_continuous (cubeVector x) + apply (orthogonalHaar_integrable (((continuous_const (y := a/2)).mul ((diagonalEnergy_continuous lam).comp hc)).rexp)).mono' + (hF.comp hc.measurable).aestronglyMeasurable + filter_upwards [] with U + dsimp only [F,Function.comp_apply,Pi.mul_apply] + split_ifs + · simp only [Real.norm_eq_abs,abs_of_nonneg (Real.exp_pos _).le,le_refl] + · simpa only [norm_zero] using (Real.exp_pos (a/2*diagonalEnergy lam (orthogonalIsometry U (cubeVector x)))).le + have he (x : Spin n) : (∫ U, F (orthogonalIsometry U (cubeVector x)) ∂orthogonalHaar (Fin n)) = + spherePartition lam a (Real.sqrt n)*(sphereTilted lam a (Real.sqrt n)).real + {u : unitSphere (Fin n) | |(Real.sqrt n • u.val) i| ≤ b} := by + rw [orthogonal_radial_integral F hF (Real.sqrt_pos.mpr (by exact_mod_cast hn)) _ (cubeVector_norm x)] + exact sphereRestricted_as_tilted lam a (Real.sqrt n) b i + unfold rotatedCubeRestricted + change (∫ U, (Fintype.card (Spin n):ℝ)⁻¹*∑ x : Spin n, F (orthogonalIsometry U (cubeVector x)) + ∂orthogonalHaar (Fin n)) = _ + rw [integral_const_mul,integral_finsetSum _ (fun x _ => hint x)] + simp only [he,Finset.sum_const,Finset.card_univ,nsmul_eq_mul] + rw [← mul_assoc,inv_mul_cancel₀ (by positivity : (Fintype.card (Spin n):ℝ) ≠ 0),one_mul] + +lemma divided_mass_variance_bound {A Z S : ℝ} (hA : 0 ≤ A) (hAZ : A ≤ Z) + (hZ : 0 < Z) (hS : 0 < S) : A/Z ≤ 2*A/S+4*(Z/S-1)^2 := by + by_cases hz : S/2 ≤ Z + · have hh : A/Z ≤ 2*A/S := by + rw [div_le_div_iff₀ hZ hS] + nlinarith [mul_nonneg hA (sub_nonneg.mpr hz)] + linarith [sq_nonneg (Z/S-1)] + · have hratio : A/Z ≤ 1 := (div_le_one hZ).mpr hAZ + have hfrac : Z/S < 1/2 := (div_lt_iff₀ hS).mpr (by linarith) + have hfrac0 : 0 ≤ Z/S := div_nonneg hZ.le hS.le + have he : 1 ≤ 4*(Z/S-1)^2 := by nlinarith [sq_nonneg (Z/S)] + have hnon : 0 ≤ 2*A/S := by positivity + linarith + +lemma normalized_pair_event_bound {B Z S K : ℝ} (hB : 0 ≤ B) (hZ : 0 < Z) + (hS : 0 < S) (hK : 0 < K) (hlarge : K ≤ B/Z^2) : + 1 ≤ 4*(Z/S-1)^2+4*(B/S^2)/K := by + by_cases hz : S/2 ≤ Z + · have hf : 1 ≤ 4*(B/S^2)/K := by + have hb := (le_div_iff₀ (sq_pos_of_pos hZ)).mp hlarge + have hsq : S^2 ≤ 4*Z^2 := by nlinarith + apply (le_div_iff₀ hK).mpr + rw [← mul_div_assoc] + apply (le_div_iff₀ (sq_pos_of_pos hS)).mpr + nlinarith [mul_le_mul_of_nonneg_left hsq hK.le] + linarith [sq_nonneg (Z/S-1)] + · have hfrac : Z/S < 1/2 := (div_lt_iff₀ hS).mpr (by linarith) + have hfrac0 : 0 ≤ Z/S := div_nonneg hZ.le hS.le + have he : 1 ≤ 4*(Z/S-1)^2 := by nlinarith [sq_nonneg (Z/S)] + have hnon : 0 ≤ 4*(B/S^2)/K := by positivity + linarith + +lemma integral_dominates_event {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} + [IsFiniteMeasure μ] {E : Set Ω} {f : Ω → ℝ} + (hi : Integrable f μ) (hf : ∀ x, 0 ≤ f x) (he : ∀ x ∈ E, 1 ≤ f x) : + μ.real E ≤ ∫ x, f x ∂μ := by + apply (measureReal_mono (show E ⊆ {x | 1 ≤ f x} from he)).trans + simpa only [one_mul] using mul_meas_ge_le_integral_of_nonneg + (Filter.Eventually.of_forall hf) hi 1 + +lemma rotatedCubePartition_pos {n : ℕ} (lam : Fin n → ℝ) (a : ℝ) + (U : Matrix.orthogonalGroup (Fin n) ℝ) : 0 < rotatedCubePartition lam a U := by + unfold rotatedCubePartition + apply mul_pos (by positivity) + exact Finset.sum_pos (fun _ _ => Real.exp_pos _) Finset.univ_nonempty + +def rotatedCubeSmallBall {n : ℕ} (lam : Fin n → ℝ) (b : ℝ) (i : Fin n) + (U : Matrix.orthogonalGroup (Fin n) ℝ) : ℝ := + rotatedCubeRestricted lam 1 b i U/rotatedCubePartition lam 1 U + +lemma rotatedCubeSmallBall_measurable {n : ℕ} (lam : Fin n → ℝ) (b : ℝ) (i : Fin n) : + Measurable (rotatedCubeSmallBall lam b i) := + (rotatedCubeRestricted_measurable lam 1 b i).div (rotatedCubePartition_continuous lam 1).measurable + +lemma rotatedCubeSmallBall_nonneg {n : ℕ} (lam : Fin n → ℝ) (b : ℝ) (i : Fin n) + (U : Matrix.orthogonalGroup (Fin n) ℝ) : 0 ≤ rotatedCubeSmallBall lam b i U := + div_nonneg (rotatedCubeRestricted_nonneg lam 1 b i U) (rotatedCubePartition_pos lam 1 U).le + +lemma rotatedCubeSmallBall_le_one {n : ℕ} (lam : Fin n → ℝ) (b : ℝ) (i : Fin n) + (U : Matrix.orthogonalGroup (Fin n) ℝ) : rotatedCubeSmallBall lam b i U ≤ 1 := + (div_le_one (rotatedCubePartition_pos lam 1 U)).mpr (rotatedCubeRestricted_le lam 1 b i U) + +lemma rotatedCubeSmallBall_integrable {n : ℕ} (lam : Fin n → ℝ) (b : ℝ) (i : Fin n) : + Integrable (rotatedCubeSmallBall lam b i) (orthogonalHaar (Fin n)) := by + apply (integrable_const (1:ℝ)).mono' (rotatedCubeSmallBall_measurable lam b i).aestronglyMeasurable + filter_upwards [] with U + rw [Real.norm_eq_abs,abs_of_nonneg (rotatedCubeSmallBall_nonneg lam b i U)] + exact rotatedCubeSmallBall_le_one lam b i U + +lemma rotatedCubeSmallBall_expectation {n : ℕ} (hn : 0 < n) (lam : Fin n → ℝ) (b : ℝ) (i : Fin n) : + (∫ U, rotatedCubeSmallBall lam b i U ∂orthogonalHaar (Fin n)) ≤ + 2*(sphereTilted lam 1 (Real.sqrt n)).real {u : unitSphere (Fin n) | |(Real.sqrt n • u.val) i| ≤ b}+ + 4*(∫ U, (rotatedCubePartition lam 1 U/spherePartition lam 1 (Real.sqrt n)-1)^2 + ∂orthogonalHaar (Fin n)) := by + let : Nonempty (Fin n) := ⟨⟨0,hn⟩⟩ + let S := spherePartition lam 1 (Real.sqrt n) + have hS : 0 < S := spherePartition_pos _ _ _ + have hA := (rotatedCubeRestricted_integrable lam 1 b i).const_mul 2 + have hV : Integrable (fun U => (rotatedCubePartition lam 1 U / S - 1)^2) (orthogonalHaar (Fin n)) := orthogonalHaar_integrable (((rotatedCubePartition_continuous lam 1).div_const S).sub continuous_const |>.pow 2) + have hh := integral_mono (rotatedCubeSmallBall_integrable lam b i) ((hA.div_const S).add (hV.const_mul 4)) + (fun U => divided_mass_variance_bound (rotatedCubeRestricted_nonneg lam 1 b i U) + (rotatedCubeRestricted_le lam 1 b i U) (rotatedCubePartition_pos lam 1 U) hS) + simp only [Pi.add_apply] at hh + rw [integral_add (hA.div_const S) (hV.const_mul 4),integral_div,integral_const_mul,integral_const_mul, + rotatedCubeRestricted_first_moment hn,show spherePartition lam 1 (Real.sqrt n) = S from rfl] at hh + have heq : 2*(S*(sphereTilted lam 1 (Real.sqrt n)).real {u : unitSphere (Fin n) | |(Real.sqrt n • u.val) i| ≤ b})/S = + 2*(sphereTilted lam 1 (Real.sqrt n)).real {u : unitSphere (Fin n) | |(Real.sqrt n • u.val) i| ≤ b} := by + field_simp + rw [heq] at hh + exact hh + +def rotatedCubeOverlap {n : ℕ} (lam : Fin n → ℝ) + (U : Matrix.orthogonalGroup (Fin n) ℝ) : ℝ := + rotatedCubePair lam (fun q => q^2) U/rotatedCubePartition lam 1 U^2 + +lemma rotatedCubePair_square_nonneg {n : ℕ} (lam : Fin n → ℝ) + (U : Matrix.orthogonalGroup (Fin n) ℝ) : 0 ≤ rotatedCubePair lam (fun q => q^2) U := by + unfold rotatedCubePair + positivity + +lemma rotatedCubeOverlap_probability {n : ℕ} (hn : 0 < n) (lam : Fin n → ℝ) {K : ℝ} (hK : 0 < K) : + (orthogonalHaar (Fin n)).real {U | K ≤ rotatedCubeOverlap lam U} ≤ + 4*(∫ U, (rotatedCubePartition lam 1 U/spherePartition lam 1 (Real.sqrt n)-1)^2 ∂orthogonalHaar (Fin n))+ + 4*((∫ U, rotatedCubePair lam (fun q => q^2) U ∂orthogonalHaar (Fin n))/spherePartition lam 1 (Real.sqrt n)^2)/K := by + let : Nonempty (Fin n) := ⟨⟨0,hn⟩⟩ + let S := spherePartition lam 1 (Real.sqrt n) + have hS : 0 < S := spherePartition_pos _ _ _ + have hV : Integrable (fun U => (rotatedCubePartition lam 1 U / S - 1)^2) (orthogonalHaar (Fin n)) := orthogonalHaar_integrable (((rotatedCubePartition_continuous lam 1).div_const S).sub continuous_const |>.pow 2) + have hB := orthogonalHaar_integrable (rotatedCubePair_continuous lam (fun q => q^2)) + have hh := integral_dominates_event ((hV.const_mul 4).add (((hB.div_const (S^2)).const_mul 4).div_const K)) + (fun U => by dsimp; have := rotatedCubePair_square_nonneg lam U; positivity) (fun U hU => normalized_pair_event_bound + (rotatedCubePair_square_nonneg lam U) (rotatedCubePartition_pos lam 1 U) hS hK hU) + simp only [Pi.add_apply] at hh + rw [integral_add (hV.const_mul 4) (((hB.div_const (S^2)).const_mul 4).div_const K), + integral_const_mul,integral_div,integral_const_mul,integral_div] at hh + exact hh + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/DisorderTransfer.lean b/lean/OAI/MathematicalPhysics/CriticalSK/DisorderTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..a23f48c188f22f168b1f153ad0e2a7af4440d48c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/DisorderTransfer.lean @@ -0,0 +1,436 @@ +import OAI.MathematicalPhysics.CriticalSK.CubeRestriction +import OAI.MathematicalPhysics.CriticalSK.GOESpectrum +import OAI.MathematicalPhysics.CriticalSK.Gibbs + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open MeasureTheory ProbabilityTheory + +open scoped ENNReal NNReal + +open scoped BigOperators InnerProductSpace + +open Module + +open scoped BigOperators ENNReal NNReal Real Topology + +open MeasureTheory ProbabilityTheory Filter + +open scoped BigOperators NNReal + +open scoped BigOperators + +open Matrix Polynomial + +open scoped BigOperators Topology + +open Filter + +open scoped BigOperators NNReal ENNReal Topology Pointwise Matrix.Norms.Elementwise + +open Set Metric MeasureTheory MeasureTheory.Measure + +open scoped ENNReal NNReal Topology + +open MeasureTheory MeasureTheory.Measure Set Metric + +open scoped BigOperators ENNReal Topology + +open Set MeasureTheory + +open scoped BigOperators ENNReal + +open MeasureTheory + +open Finset Real + +open Finset Real Filter + +open scoped Topology + +open MeasureTheory Filter Set Real + +open scoped ENNReal NNReal BigOperators + +open scoped NNReal ENNReal BigOperators + +open scoped NNReal ENNReal + +open ProbabilityTheory + +open Metric Set MeasureTheory + +open scoped ENNReal Pointwise + +open MeasureTheory Filter Set + +namespace CriticalSK + +section + +lemma symmetric_sum_upper {n : ℕ} (f : Fin n → Fin n → ℝ) (hf : ∀ i j, f i j = f j i) : + (∑ i, ∑ j, f i j) = (∑ i, f i i)+2*∑ e : Edge n, f e.val.1 e.val.2 := by + classical + have hu : (∑ e : Edge n, f e.val.1 e.val.2) = ∑ i, ∑ j, if i < j then f i j else 0 := by + rw [← Fintype.sum_prod_type' (fun i j : Fin n => if i < j then f i j else 0)] + rw [← Finset.sum_filter] + exact (Finset.sum_subtype (Finset.univ.filter (fun p : Fin n × Fin n => p.1 < p.2)) + (by intro p; simp) (fun p : Fin n × Fin n => f p.1 p.2)).symm + rw [hu] + have hl : (∑ i, ∑ j, if j < i then f i j else 0) = ∑ i, ∑ j, if i < j then f i j else 0 := by + rw [Finset.sum_comm] + congr 1 + ext i + congr 1 + ext j + rw [hf j i] + have hd : (∑ i, ∑ j, if i = j then f i j else 0) = ∑ i, f i i := by simp + calc + _ = (∑ i, ∑ j, if i = j then f i j else 0)+ + (∑ i, ∑ j, if i < j then f i j else 0)+(∑ i, ∑ j, if j < i then f i j else 0) := by + simp only [← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + rcases lt_trichotomy i j with h | h | h + · simp [h,ne_of_lt h,not_lt_of_ge h.le] + · subst j; simp + · simp [h,ne_of_gt h,not_lt_of_ge h.le] + _ = _ := by rw [hd,hl]; ring + +def matrixDisorder {n : ℕ} (A : Matrix (Fin n) (Fin n) ℝ) : Disorder n := fun e => A e.val.1 e.val.2 + +def matrixEnergy {n : ℕ} (A : Matrix (Fin n) (Fin n) ℝ) (x : Spin n) : ℝ := + (1/2:ℝ)*∑ i, ∑ j, A i j*spinValue (x i)*spinValue (x j) + +lemma matrixEnergy_hamiltonian {n : ℕ} (A : Matrix (Fin n) (Fin n) ℝ) (hA : A.IsSymm) (x : Spin n) : + matrixEnergy A x = hamiltonian (matrixDisorder A) x+(1/2:ℝ)*∑ i, A i i := by + unfold matrixEnergy + rw [symmetric_sum_upper _ (by intro i j; rw [hA.apply i j]; ring)] + have hd : (∑ i, A i i*spinValue (x i)*spinValue (x i)) = ∑ i, A i i := by + apply Finset.sum_congr rfl + intro i _ + rw [mul_assoc,← pow_two,spinValue_sq,mul_one] + rw [hd] + unfold hamiltonian matrixDisorder + ring + +lemma matrixEnergy_inner {n : ℕ} (A : Matrix (Fin n) (Fin n) ℝ) (x : Spin n) : + matrixEnergy A x = (1/2:ℝ)*inner ℝ (cubeVector x) (A.toEuclideanLin (cubeVector x)) := by + simp only [matrixEnergy,EuclideanSpace.inner_eq_star_dotProduct,Matrix.toLpLin_apply,star_trivial] + change (1/2:ℝ)*(∑ i, ∑ j, A i j*spinValue (x i)*spinValue (x j)) = + (1/2:ℝ)*∑ i, (∑ j, A i j*spinValue (x j))*spinValue (x i) + congr 1 + simp only [Finset.sum_mul] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + +def matrixGibbs {n : ℕ} (A : Matrix (Fin n) (Fin n) ℝ) (x : Spin n) : ℝ := + Real.exp (matrixEnergy A x)/(∑ y, Real.exp (matrixEnergy A y)) + +lemma matrixGibbs_eq {n : ℕ} (A : Matrix (Fin n) (Fin n) ℝ) (hA : A.IsSymm) (x : Spin n) : + matrixGibbs A x = gibbs (matrixDisorder A) x := by + simp only [matrixGibbs,matrixEnergy_hamiltonian A hA,Real.exp_add,← Finset.sum_mul] + unfold gibbs partition + rw [mul_div_mul_right _ _ (Real.exp_ne_zero _)] + +lemma gibbs_continuous {n : ℕ} (x : Spin n) : Continuous (fun W : Disorder n => gibbs W x) := by + apply Continuous.div + · unfold hamiltonian; fun_prop + · unfold partition hamiltonian; fun_prop + · exact fun W => (partition_pos W).ne' + +def linearSmallBall {n : ℕ} (W : Disorder n) (a : Fin n → ℝ) (b : ℝ) : ℝ := + ∑ x, if |linearObservable a x| ≤ b then gibbs W x else 0 + +lemma linearSmallBall_nonneg {n : ℕ} (W : Disorder n) (a : Fin n → ℝ) (b : ℝ) : + 0 ≤ linearSmallBall W a b := by + unfold linearSmallBall + exact Finset.sum_nonneg fun x _ => by split_ifs; exact gibbs_nonneg W x; rfl + +lemma linearSmallBall_le_one {n : ℕ} (W : Disorder n) (a : Fin n → ℝ) (b : ℝ) : + linearSmallBall W a b ≤ 1 := by + rw [← gibbs_sum W] + apply Finset.sum_le_sum + intro x _ + split_ifs; rfl; exact gibbs_nonneg W x + +lemma linearSmallBall_continuous {n : ℕ} (a : Fin n → ℝ) (b : ℝ) : + Continuous (fun W : Disorder n => linearSmallBall W a b) := by + unfold linearSmallBall + apply continuous_finsetSum + intro x _ + split_ifs + · exact gibbs_continuous x + · exact continuous_const + +def smallBallObstruction (n : ℕ) (b δ : ℝ) : Set (Disorder n) := + {W | ∀ a : EuclideanSpace ℝ (Fin n), ‖a‖ = 1 → δ ≤ linearSmallBall W a b} + +lemma smallBallObstruction_closed (n : ℕ) (b δ : ℝ) : IsClosed (smallBallObstruction n b δ) := by + unfold smallBallObstruction + simp only [ofPred_forall] + apply isClosed_iInter + intro a + apply isClosed_iInter + intro _ + exact isClosed_le continuous_const (linearSmallBall_continuous _ _) + +lemma linearObservable_inner {n : ℕ} (a : EuclideanSpace ℝ (Fin n)) (x : Spin n) : + linearObservable a x = inner ℝ a (cubeVector x) := by + simp only [linearObservable,EuclideanSpace.inner_eq_star_dotProduct,star_trivial,dotProduct] + apply Finset.sum_congr rfl + intro i _ + change a i*spinValue (x i) = spinValue (x i)*a i + ring + +def rotatedDirection {n : ℕ} (U : Matrix.orthogonalGroup (Fin n) ℝ) (i : Fin n) : EuclideanSpace ℝ (Fin n) := + (orthogonalIsometry U).symm (EuclideanSpace.basisFun (Fin n) ℝ i) + +lemma rotatedDirection_norm {n : ℕ} (U : Matrix.orthogonalGroup (Fin n) ℝ) (i : Fin n) : + ‖rotatedDirection U i‖ = 1 := by + rw [rotatedDirection,LinearIsometryEquiv.norm_map] + exact (EuclideanSpace.basisFun (Fin n) ℝ).norm_eq_one i + +lemma rotatedDirection_observable {n : ℕ} (U : Matrix.orthogonalGroup (Fin n) ℝ) (i : Fin n) (x : Spin n) : + linearObservable (rotatedDirection U i) x = (orthogonalIsometry U (cubeVector x)) i := by + rw [linearObservable_inner,← (orthogonalIsometry U).inner_map_map] + simp only [rotatedDirection,LinearIsometryEquiv.apply_symm_apply,EuclideanSpace.basisFun_inner] + +lemma gibbs_exp_shift {n : ℕ} {W : Disorder n} (E : Spin n → ℝ) (c : ℝ) + (h : ∀ x, hamiltonian W x = E x+c) (x : Spin n) : + gibbs W x = Real.exp (E x)/(∑ y, Real.exp (E y)) := by + simp only [gibbs,partition,h,Real.exp_add,← Finset.sum_mul] + rw [mul_div_mul_right _ _ (Real.exp_ne_zero _)] + +lemma rotatedCubeSmallBall_eq {n : ℕ} {W : Disorder n} (lam : Fin n → ℝ) + (U : Matrix.orthogonalGroup (Fin n) ℝ) (c : ℝ) + (h : ∀ x, hamiltonian W x = (1/2:ℝ)*diagonalEnergy lam (orthogonalIsometry U (cubeVector x))+c) + (b : ℝ) (i : Fin n) : + rotatedCubeSmallBall lam b i U = linearSmallBall W (rotatedDirection U i) b := by + have hg := gibbs_exp_shift _ c h + unfold rotatedCubeSmallBall rotatedCubeRestricted rotatedCubePartition linearSmallBall + simp only [one_div,rotatedDirection_observable,hg] + rw [mul_div_mul_left _ _ (inv_ne_zero (by positivity : (Fintype.card (Spin n):ℝ) ≠ 0))] + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro x _ + split_ifs <;> simp + +lemma smallBallObstruction_rotation {n : ℕ} {W : Disorder n} (lam : Fin n → ℝ) + (U : Matrix.orthogonalGroup (Fin n) ℝ) (c : ℝ) + (h : ∀ x, hamiltonian W x = (1/2:ℝ)*diagonalEnergy lam (orthogonalIsometry U (cubeVector x))+c) + (b δ : ℝ) (i : Fin n) (hW : W ∈ smallBallObstruction n b δ) : + δ ≤ rotatedCubeSmallBall lam b i U := by + rw [rotatedCubeSmallBall_eq lam U c h] + exact hW _ (rotatedDirection_norm U i) + +lemma orthogonalIsometry_one {ι : Type*} [Fintype ι] [DecidableEq ι] (x : EuclideanSpace ℝ ι) : + orthogonalIsometry (1 : Matrix.orthogonalGroup ι ℝ) x = x := euclideanMatrix_one_apply x + +lemma orthogonalIsometry_inv {ι : Type*} [Fintype ι] [DecidableEq ι] + (U : Matrix.orthogonalGroup ι ℝ) : orthogonalIsometry U⁻¹ = (orthogonalIsometry U).symm := by + apply LinearIsometryEquiv.ext + intro x + apply (orthogonalIsometry U).injective + rw [LinearIsometryEquiv.apply_symm_apply,← orthogonalIsometry_mul,mul_inv_cancel,orthogonalIsometry_one] + +lemma continuous_pair_transform {X Y Z : Type*} [TopologicalSpace X] [TopologicalSpace Y] + [TopologicalSpace Z] {f : X × Y → Z} {g : X → X} (hf : Continuous f) (hg : Continuous g) : + Continuous (fun p : X × Y => f (g p.1,p.2)) := + hf.comp ((hg.comp continuous_fst).prodMk continuous_snd) + +lemma orthogonalIsometry_symm_continuous {ι : Type*} [Fintype ι] [DecidableEq ι] : + Continuous (fun p : Matrix.orthogonalGroup ι ℝ × EuclideanSpace ℝ ι => (orthogonalIsometry p.1).symm p.2) := by + have h : Continuous (fun p : Matrix.orthogonalGroup ι ℝ × EuclideanSpace ℝ ι => + orthogonalIsometry (p.1⁻¹) p.2) := + continuous_pair_transform orthogonalIsometry_continuous continuous_inv + convert h using 1 + funext p + exact congrArg (fun V : EuclideanSpace ℝ ι ≃ₗᵢ[ℝ] EuclideanSpace ℝ ι => V p.2) + (orthogonalIsometry_inv p.1).symm + +def haarConjugate {n : ℕ} (U : Matrix.orthogonalGroup (Fin n) ℝ) (A : GaussianMatrix (Fin n)) : GaussianMatrix (Fin n) := + conjugateGaussianMatrix (orthogonalIsometry U).symm A + +lemma haarConjugate_measurable (n : ℕ) : + Measurable (fun p : Matrix.orthogonalGroup (Fin n) ℝ × GaussianMatrix (Fin n) => haarConjugate p.1 p.2) := + by + have h := conjugateGaussianMatrix_measurable + (fun U : Matrix.orthogonalGroup (Fin n) ℝ => (orthogonalIsometry U).symm) + (orthogonalIsometry_symm_continuous (ι := Fin n)).measurable + exact h + +lemma gaussian_matrix_energy_eigenbasis {n : ℕ} (A : GaussianMatrix (Fin n)) + (hA : ∀ i j, A i j = A j i) : + ∃ V : EuclideanSpace ℝ (Fin n) ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n), + ∀ x, diagonalEnergy (matrixOrderedEigenvalues A) (V x) = inner ℝ x (gaussianMatrixCLM A x) := by + let hT := gaussianMatrixCLM_symmetric A hA + let hn : finrank ℝ (EuclideanSpace ℝ (Fin n)) = n := by simp + refine ⟨(hT.eigenvectorBasis hn).repr,?_⟩ + intro x + rw [matrixOrderedEigenvalues_eq A hA] + exact eigenbasisQuadratic_eq hT hn x + +lemma haarConjugate_energy {n : ℕ} (U : Matrix.orthogonalGroup (Fin n) ℝ) + (A : GaussianMatrix (Fin n)) (x : Spin n) : + matrixEnergy (matrixOfGaussian (haarConjugate U A)) x = + (1/2:ℝ)*inner ℝ (orthogonalIsometry U (cubeVector x)) + (gaussianMatrixCLM A (orthogonalIsometry U (cubeVector x))) := by + rw [matrixEnergy_inner] + have hc := congrArg (fun L : EuclideanSpace ℝ (Fin n) →ₗ[ℝ] EuclideanSpace ℝ (Fin n) => L (cubeVector x)) + (gaussianMatrixCLM_conjugate (orthogonalIsometry U).symm A) + change gaussianMatrixCLM (haarConjugate U A) (cubeVector x) = + (orthogonalIsometry U).symm (gaussianMatrixCLM A (orthogonalIsometry U (cubeVector x))) at hc + change (1/2:ℝ)*inner ℝ (cubeVector x) (gaussianMatrixCLM (haarConjugate U A) (cubeVector x)) = _ + rw [hc,← (orthogonalIsometry U).inner_map_map,LinearIsometryEquiv.apply_symm_apply] + +lemma haarConjugate_hamiltonian {n : ℕ} (A : GaussianMatrix (Fin n)) (hA : ∀ i j, A i j = A j i) + (V : EuclideanSpace ℝ (Fin n) ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n)) + (hV : ∀ x, diagonalEnergy (matrixOrderedEigenvalues A) (V x) = inner ℝ x (gaussianMatrixCLM A x)) + (U : Matrix.orthogonalGroup (Fin n) ℝ) (x : Spin n) : + hamiltonian (matrixDisorder (matrixOfGaussian (haarConjugate U A))) x = + (1/2:ℝ)*diagonalEnergy (matrixOrderedEigenvalues A) + (orthogonalIsometry (matrixOfIsometry V*U) (cubeVector x))- + (1/2:ℝ)*∑ i, haarConjugate U A i i := by + rw [orthogonalIsometry_mul,orthogonalIsometry_matrixOfIsometry,hV,← haarConjugate_energy] + have hB : (matrixOfGaussian (haarConjugate U A)).IsSymm := by + ext i j + exact conjugate_symmetric (orthogonalIsometry U).symm A hA j i + rw [matrixEnergy_hamiltonian _ hB] + change _ = _ - (1/2:ℝ)*∑ i, matrixOfGaussian (haarConjugate U A) i i + ring + +lemma goe_haar_preserving (n : ℕ) (s : ℝ) : + MeasurePreserving (fun p : Matrix.orthogonalGroup (Fin n) ℝ × GaussianMatrix (Fin n) => haarConjugate p.1 p.2) + ((orthogonalHaar (Fin n)).prod (goeLaw (Fin n) s)) (goeLaw (Fin n) s) := by + exact measurePreserving_snd.comp (random_goe_conjugation_preserving (orthogonalHaar (Fin n)) s + (fun U => (orthogonalIsometry U).symm) orthogonalIsometry_symm_continuous.measurable) + +lemma preserving_product_event_real {X Y Z : Type*} [MeasurableSpace X] [MeasurableSpace Y] + [MeasurableSpace Z] (μ : Measure X) (ν : Measure Y) (ρ : Measure Z) + [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] [IsProbabilityMeasure ρ] + (T : X × Y → Z) (hT : MeasurePreserving T (μ.prod ν) ρ) + {E : Set Z} (hE : MeasurableSet E) : + ρ.real E = ∫ y, μ.real {x | T (x,y) ∈ E} ∂ν := by + let f : Z → ℝ := E.indicator 1 + have hf : Measurable f := measurable_const.indicator hE + let F := fun p : X × Y => f (T p) + have hF : Measurable F := hf.comp hT.measurable + have hi : Integrable F (μ.prod ν) := by + apply (integrable_const (1:ℝ)).mono' hF.aestronglyMeasurable + filter_upwards [] with p + simp only [F,f] + by_cases hp : T p ∈ E <;> simp [hp] + have he := integral_map (μ := μ.prod ν) hT.measurable.aemeasurable hf.aestronglyMeasurable + rw [hT.map_eq,integral_indicator_one hE,integral_prod_symm F hi] at he + rw [he] + apply integral_congr_ae + filter_upwards [] with y + have hs : MeasurableSet {x | T (x,y) ∈ E} := + hE.preimage (hT.measurable.comp (measurable_id.prodMk measurable_const)) + exact integral_indicator_one hs + +lemma goe_haar_event_identity (n : ℕ) (s : ℝ) {E : Set (GaussianMatrix (Fin n))} (hE : MeasurableSet E) : + (goeLaw (Fin n) s).real E = + ∫ A, (orthogonalHaar (Fin n)).real {U | haarConjugate U A ∈ E} ∂goeLaw (Fin n) s := + preserving_product_event_real _ _ _ _ (goe_haar_preserving n s) hE + +open scoped NNReal + +def gaussianDisorder {n : ℕ} (A : GaussianMatrix (Fin n)) : Disorder n := + matrixDisorder (matrixOfGaussian A) + +lemma gaussianDisorder_measurable (n : ℕ) : Measurable (gaussianDisorder (n := n)) := by + apply Measurable.of_eval + intro e + change Measurable (fun A : GaussianMatrix (Fin n) => A e.val.1 e.val.2) + fun_prop + +lemma goe_disorder_law (n : ℕ) : (goeLaw (Fin (n+1)) (goeScale n)).map gaussianDisorder = disorderLaw (n+1) := by + let e : Edge (n+1) → UpperEntry (Fin (n+1)) := fun p => ⟨p.val,p.property.le⟩ + have he : Function.Injective e := by + intro p q hpq + apply Subtype.ext + exact congrArg (fun r : UpperEntry (Fin (n+1)) => r.val) hpq + have hi := (goe_entries_independent (ι := Fin (n+1)) (goeScale n)).precomp he + have hm := hi.map_fun_eq_pi_map (fun _ => by fun_prop) + change (goeLaw (Fin (n+1)) (goeScale n)).map gaussianDisorder = _ at hm + rw [hm] + unfold disorderLaw + congr 1 + funext p + rw [goe_entry_law,ite_eq_right (ne_of_lt p.property)] + congr 1 + apply NNReal.eq + rw [Real.coe_toNNReal _ (by positivity),NNReal.coe_inv,NNReal.coe_natCast,goeScale_square] + norm_num only [Nat.cast_add,Nat.cast_one] + +end + +open Set MeasureTheory + +lemma haar_smallBallObstruction_bound {n : ℕ} (hn : 0 < n) + (A : GaussianMatrix (Fin n)) (hA : ∀ i j, A i j = A j i) + (b : ℝ) {δ : ℝ} (hδ : 0 < δ) (i : Fin n) : + (orthogonalHaar (Fin n)).real {U | gaussianDisorder (haarConjugate U A) ∈ smallBallObstruction n b δ} ≤ + (2*(sphereTilted (matrixOrderedEigenvalues A) 1 (Real.sqrt n)).real + {u : unitSphere (Fin n) | |(Real.sqrt n • u.val) i| ≤ b}+ + 4*(∫ U, (rotatedCubePartition (matrixOrderedEigenvalues A) 1 U / + spherePartition (matrixOrderedEigenvalues A) 1 (Real.sqrt n)-1)^2 ∂orthogonalHaar (Fin n)))/δ := by + obtain ⟨V,hV⟩ := gaussian_matrix_energy_eigenbasis A hA + let lam := matrixOrderedEigenvalues A + let R := matrixOfIsometry V + have hmeas : Measurable (fun U => rotatedCubeSmallBall lam b i (R*U)) := + (rotatedCubeSmallBall_measurable lam b i).comp ((continuous_const.mul continuous_id).measurable) + have hi : Integrable (fun U => rotatedCubeSmallBall lam b i (R*U)) (orthogonalHaar (Fin n)) := by + apply (integrable_const (1:ℝ)).mono' hmeas.aestronglyMeasurable + filter_upwards [] with U + rw [Real.norm_eq_abs,abs_of_nonneg (rotatedCubeSmallBall_nonneg lam b i (R*U))] + exact rotatedCubeSmallBall_le_one lam b i (R*U) + have hh := integral_dominates_event (E := {U | gaussianDisorder (haarConjugate U A) ∈ smallBallObstruction n b δ}) + (hi.div_const δ) (fun U => div_nonneg (rotatedCubeSmallBall_nonneg lam b i (R*U)) hδ.le) (fun U hU => by + apply (le_div_iff₀ hδ).mpr + rw [one_mul] + exact smallBallObstruction_rotation lam (R*U) (-(1/2:ℝ)*∑ j, haarConjugate U A j j) + (fun x => by simpa only [gaussianDisorder,lam,R,sub_eq_add_neg,neg_mul] using haarConjugate_hamiltonian A hA V hV U x) b δ i hU) + rw [integral_div,integral_mul_left_eq_self] at hh + exact hh.trans (div_le_div_of_nonneg_right (rotatedCubeSmallBall_expectation hn lam b i) hδ.le) + +lemma goe_event_from_orbit_bound {n : ℕ} (s : ℝ) {E G : Set (GaussianMatrix (Fin n))} + (hE : MeasurableSet E) (hG : MeasurableSet G) {C : ℝ} (hC : 0 ≤ C) + (hbound : ∀ A ∈ G, (∀ i j, A i j = A j i) → + (orthogonalHaar (Fin n)).real {U | haarConjugate U A ∈ E} ≤ C) : + (goeLaw (Fin n) s).real E ≤ (goeLaw (Fin n) s).real Gᶜ+C := by + rw [goe_haar_event_identity n s hE] + have hi : Integrable (fun A => Gᶜ.indicator (1 : GaussianMatrix (Fin n) → ℝ) A+C) (goeLaw (Fin n) s) := + ((integrable_const (1:ℝ)).indicator hG.compl).add (integrable_const C) + have hh := integral_mono_of_nonneg + (show ∀ᵐ A ∂goeLaw (Fin n) s, 0 ≤ (orthogonalHaar (Fin n)).real {U | haarConjugate U A ∈ E} from + ae_of_all _ (fun _ => measureReal_nonneg)) hi + (show ∀ᵐ A ∂goeLaw (Fin n) s, (orthogonalHaar (Fin n)).real {U | haarConjugate U A ∈ E} ≤ + Gᶜ.indicator (1 : GaussianMatrix (Fin n) → ℝ) A+C from by + filter_upwards [goe_symmetric_ae s] with A hA + by_cases hAG : A ∈ G + · simpa only [Set.indicator_of_notMem (show A ∉ Gᶜ from not_not.mpr hAG),zero_add] using hbound A hAG hA + · rw [Set.indicator_of_mem hAG] + exact (measureReal_le_one).trans (le_add_of_nonneg_right hC)) + change (∫ A, (orthogonalHaar (Fin n)).real {U | haarConjugate U A ∈ E} ∂goeLaw (Fin n) s) ≤ + (∫ A, Gᶜ.indicator (fun _ => (1:ℝ)) A+C ∂goeLaw (Fin n) s) at hh + rw [integral_add ((integrable_const (1:ℝ)).indicator hG.compl) (integrable_const C), + integral_indicator_const _ hG.compl,integral_const] at hh + simpa using hh + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/EdgeAsymptotics.lean b/lean/OAI/MathematicalPhysics/CriticalSK/EdgeAsymptotics.lean new file mode 100644 index 0000000000000000000000000000000000000000..a5b13fc06ceba52f315206ae819b21d283cbe2d5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/EdgeAsymptotics.lean @@ -0,0 +1,727 @@ +import OAI.MathematicalPhysics.CriticalSK.GOESpectrum + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open scoped BigOperators ENNReal NNReal Real Topology + +open MeasureTheory ProbabilityTheory Filter + +open scoped ENNReal NNReal + +open scoped BigOperators NNReal + +open scoped BigOperators + +open scoped BigOperators InnerProductSpace + +open Module + +open Matrix Polynomial + +open scoped BigOperators Topology + +open Filter + +namespace CriticalSK + + +open scoped Topology + +def edgeLength (n : ℕ) : ℕ := 2^(Nat.clog 8 (n+1)) + +def naturalEdgeScale (n : ℕ) (L : ℝ) : ℝ := L/(edgeLength n : ℝ)^2 + +def formConstant : ℝ := 41472*Real.sqrt (512*(48*Real.exp 1+4)) + +lemma edgeLength_pos (n : ℕ) : 0 < edgeLength n := by unfold edgeLength; positivity + +lemma edgeLength_cast_pos (n : ℕ) : (0:ℝ) < edgeLength n := by exact_mod_cast edgeLength_pos n + +lemma edgeLength_cube (n : ℕ) : (n+1:ℝ) ≤ (edgeLength n:ℝ)^3 ∧ + (edgeLength n:ℝ)^3 ≤ 8*(n+1:ℝ) := by + simpa only [edgeLength,Nat.cast_pow,Nat.cast_ofNat,Nat.cast_add,Nat.cast_one] using + dyadic_cube_scale (n+1) (Nat.succ_pos n) + +lemma naturalEdgeScale_pos (n : ℕ) {L : ℝ} (hL : 0 < L) : 0 < naturalEdgeScale n L := by + exact div_pos hL (sq_pos_of_pos (edgeLength_cast_pos n)) + +lemma naturalEdgeScale_base (n : ℕ) {L : ℝ} (hL : 1 ≤ L) : + scaleEnergy (Nat.clog 8 (n+1)) 0 ≤ naturalEdgeScale n L := by + simp only [scaleEnergy,scaleRoot,pow_zero,one_div,naturalEdgeScale,edgeLength,Nat.cast_pow,Nat.cast_ofNat] + rw [inv_pow,← one_div] + exact div_le_div_of_nonneg_right hL (by positivity) + +lemma formConstant_pos : 0 < formConstant := by unfold formConstant; positivity + +lemma formA_edgeLength (n : ℕ) {h : ℝ} (hh : 0 ≤ h) : + formA n h ≤ formConstant*(h+1)*(edgeLength n:ℝ)^(-5/4:ℝ) := by + let D : ℝ := edgeLength n + have hD : 0 < D := edgeLength_cast_pos n + have hN : (0:ℝ) < n+1 := by positivity + have hroot : Real.sqrt (32*(entryVariance n:ℝ)) ≤ + Real.sqrt (512*(48*Real.exp 1+4))*D^(-3/2:ℝ) := by + have hfrac : 32*(entryVariance n:ℝ) ≤ (512*(48*Real.exp 1+4))/D^3 := by + change 32*(2*(48*Real.exp 1+4)/(n+1)) ≤ _ + apply (le_div_iff₀ (pow_pos hD 3)).mpr + calc + _ = (64*(48*Real.exp 1+4))*D^3/(n+1) := by ring + _ ≤ (64*(48*Real.exp 1+4))*(8*(n+1))/(n+1) := + div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left (edgeLength_cube n).2 (by positivity)) hN.le + _ = 512*(48*Real.exp 1+4) := by field_simp; ring + calc + _ ≤ Real.sqrt ((512*(48*Real.exp 1+4))/D^3) := Real.sqrt_le_sqrt hfrac + _ = _ := by + rw [Real.sqrt_div (by positivity)] + have hd : Real.sqrt (D^3) = D^(3/2:ℝ) := by + rw [Real.sqrt_eq_rpow,← Real.rpow_natCast,← Real.rpow_mul hD.le] + norm_num + rw [hd,div_eq_mul_inv,← Real.rpow_neg hD.le] + congr 2; norm_num + calc + _ = 41472*Real.sqrt (32*(entryVariance n:ℝ))*(h+1)*D^(1/4:ℝ) := by + simp only [formA,D,edgeLength,Nat.cast_pow,Nat.cast_ofNat] + _ ≤ 41472*(Real.sqrt (512*(48*Real.exp 1+4))*D^(-3/2:ℝ))*(h+1)*D^(1/4:ℝ) := by + gcongr + _ = formConstant*(h+1)*D^(-5/4:ℝ) := by + rw [formConstant,show (-5/4:ℝ)=(-3/2:ℝ)+(1/4:ℝ) by norm_num,Real.rpow_add hD] + ring + +lemma formA_natural_scale (n : ℕ) {h L : ℝ} (hh : 0 ≤ h) (hL : 0 < L) : + formA n h*(naturalEdgeScale n L)^(-5/8:ℝ) ≤ formConstant*(h+1)*L^(-5/8:ℝ) := by + have hD := edgeLength_cast_pos n + calc + _ ≤ (formConstant*(h+1)*(edgeLength n:ℝ)^(-5/4:ℝ))*(naturalEdgeScale n L)^(-5/8:ℝ) := by + exact mul_le_mul_of_nonneg_right (formA_edgeLength n hh) + (Real.rpow_nonneg (naturalEdgeScale_pos n hL).le _) + _ = _ := by + rw [naturalEdgeScale,Real.div_rpow hL.le (sq_nonneg _),← Real.rpow_natCast, + ← Real.rpow_mul hD.le] + norm_num + field_simp [Real.rpow_ne_zero hD.le hD.ne'] + +lemma orderedJacobiGaps_top_bound {n m : ℕ} (hm : 0 < m) (hfit : 12*m ≤ n) + (i : Fin (n+1)) (hi : i.val < 3) : + orderedJacobiGaps n i ≤ 4/(m:ℝ)^2+2*(12*m+1:ℝ)/(n+1) := by + have hh := pathOperator_eigenvalue_lower hm (r := 3) (by omega) i hi + unfold orderedJacobiGaps + norm_num only [Nat.cast_ofNat] at hh + rw [show (4:ℝ)*m*3 = 12*m by ring] at hh + linarith + +lemma edgeLength_tendsto : Tendsto (fun n : ℕ => (edgeLength n:ℝ)) atTop atTop := by + apply tendsto_atTop.2 + intro b + have hn : Tendsto (fun n : ℕ => (n:ℝ)+1) atTop atTop := + tendsto_natCast_atTop_atTop.atTop_add tendsto_const_nhds + filter_upwards [hn.eventually_ge_atTop ((max b 0)^3)] with n hn' + by_contra! hb + have hp := pow_lt_pow_left₀ (hb.trans_le (le_max_left b 0)) + (edgeLength_cast_pos n).le (by norm_num : 3 ≠ 0) + linarith [(edgeLength_cube n).1] + +lemma edgeLength_sq_div_bound (n : ℕ) : + (edgeLength n:ℝ)^2/(n+1) ≤ 8/(edgeLength n:ℝ) := by + have hD := edgeLength_cast_pos n + have hN : (0:ℝ) < n+1 := by positivity + rw [div_le_div_iff₀ hN hD] + nlinarith [(edgeLength_cube n).2] + +lemma edgeLength_sq_div_tendsto : + Tendsto (fun n : ℕ => (edgeLength n:ℝ)^2/(n+1)) atTop (𝓝 0) := by + apply squeeze_zero (fun n => by positivity) edgeLength_sq_div_bound + exact edgeLength_tendsto.const_div_atTop 8 + +lemma edgeLength_div_sqrt_tendsto : + Tendsto (fun n : ℕ => (edgeLength n:ℝ)/Real.sqrt (n+1)) atTop (𝓝 0) := by + have hh := edgeLength_sq_div_tendsto.sqrt + simpa only [Real.sqrt_div (sq_nonneg _),Real.sqrt_sq (edgeLength_cast_pos _).le,Real.sqrt_zero] using hh + +lemma naturalEdgeScale_tendsto (L : ℝ) : + Tendsto (fun n => naturalEdgeScale n L) atTop (𝓝 0) := by + exact ((tendsto_pow_atTop (by norm_num : 2 ≠ 0)).comp edgeLength_tendsto).const_div_atTop L + +lemma formB_natural_scale_tendsto (L : ℝ) : + Tendsto (fun n => formB n / naturalEdgeScale n L) atTop (𝓝 0) := by + have hh := (edgeLength_sq_div_tendsto.const_mul 8).div_const L + simpa only [mul_zero,zero_div] using hh.congr (fun n => by + dsimp only [formB,naturalEdgeScale] + ring_nf; simp only [inv_inv]; ring) + +lemma formC_natural_scale_tendsto {L : ℝ} (hL : 0 < L) : + Tendsto (fun n => formC n / Real.sqrt (naturalEdgeScale n L)) atTop (𝓝 0) := by + have hh := (edgeLength_div_sqrt_tendsto.const_mul 16).div_const (Real.sqrt L) + simpa only [mul_zero,zero_div] using hh.congr (fun n => by + dsimp only [formC,naturalEdgeScale] + rw [Real.sqrt_div hL.le,Real.sqrt_sq (edgeLength_cast_pos n).le] + simp only [div_eq_mul_inv,_root_.mul_inv_rev,inv_inv]; ring) + +lemma naturalEdgeScale_space (n : ℕ) {L : ℝ} (hL : 0 < L) : + L*Real.sqrt L/8 ≤ (n+1:ℝ)*naturalEdgeScale n L*Real.sqrt (naturalEdgeScale n L) ∧ + (n+1:ℝ)*naturalEdgeScale n L*Real.sqrt (naturalEdgeScale n L) ≤ L*Real.sqrt L := by + have hD := edgeLength_cast_pos n + have he : (n+1:ℝ)*naturalEdgeScale n L*Real.sqrt (naturalEdgeScale n L) = + (L*Real.sqrt L)*((n+1:ℝ)/(edgeLength n:ℝ)^3) := by + rw [naturalEdgeScale,Real.sqrt_div hL.le,Real.sqrt_sq hD.le] + ring + have hfrac : (1/8:ℝ) ≤ (n+1:ℝ)/(edgeLength n:ℝ)^3 := by + rw [le_div_iff₀ (pow_pos hD 3)] + linarith [(edgeLength_cube n).2] + have hfrac' : (n+1:ℝ)/(edgeLength n:ℝ)^3 ≤ 1 := by + rw [div_le_one (pow_pos hD 3)] + exact (edgeLength_cube n).1 + rw [he] + constructor + · simpa only [div_eq_mul_inv, one_mul] using mul_le_mul_of_nonneg_left hfrac (by positivity : 0 ≤ L*Real.sqrt L) + · simpa using mul_le_mul_of_nonneg_left hfrac' (by positivity : 0 ≤ L*Real.sqrt L) + +lemma formB_tendsto : Tendsto formB atTop (𝓝 0) := by + exact (tendsto_natCast_atTop_atTop.atTop_add (tendsto_const_nhds (x := (1:ℝ)))).const_div_atTop 8 + +lemma formC_tendsto : Tendsto formC atTop (𝓝 0) := by + exact (Real.tendsto_sqrt_atTop.comp + (tendsto_natCast_atTop_atTop.atTop_add (tendsto_const_nhds (x := (1:ℝ))))).const_div_atTop 16 + +lemma formA_tendsto {h : ℝ} (hh : 0 ≤ h) : Tendsto (fun n => formA n h) atTop (𝓝 0) := by + apply squeeze_zero (fun n => formA_nonneg n hh) (fun n => formA_edgeLength n hh) + have ht := (tendsto_rpow_neg_atTop (by norm_num : (0:ℝ) < 5/4)).comp edgeLength_tendsto + simpa only [mul_zero,neg_div,Function.comp_def] using ht.const_mul (formConstant*(h+1)) + +lemma edgeLength_tents_eventually : ∀ᶠ n : ℕ in atTop, 12*edgeLength n ≤ n := by + have ht := edgeLength_sq_div_tendsto.eventually (gt_mem_nhds (by norm_num : (0:ℝ) < 1/24)) + filter_upwards [ht,eventually_ge_atTop 1] with n hn hn1 + have hD1 : (1:ℝ) ≤ edgeLength n := by exact_mod_cast edgeLength_pos n + have hN : (0:ℝ) < n+1 := by positivity + have h' := (div_lt_iff₀ hN).mp hn + have hn1' : (1:ℝ) ≤ n := by exact_mod_cast hn1 + have hr : (12:ℝ)*edgeLength n ≤ n := by nlinarith + exact_mod_cast hr + +lemma orderedJacobiGaps_natural_top {n : ℕ} (hfit : 12*edgeLength n ≤ n) + (i : Fin (n+1)) (hi : i.val < 3) : + orderedJacobiGaps n i ≤ 212/(edgeLength n:ℝ)^2 := by + have hD := edgeLength_cast_pos n + have hD1 : (1:ℝ) ≤ edgeLength n := by exact_mod_cast edgeLength_pos n + have hN : (0:ℝ) < n+1 := by positivity + apply (orderedJacobiGaps_top_bound (edgeLength_pos n) hfit i hi).trans + have hcube := (edgeLength_cube n).2 + have hmain : 2*(12*(edgeLength n:ℝ)+1)*(edgeLength n:ℝ)^2 ≤ 208*(n+1) := by + nlinarith [mul_nonneg (sq_nonneg (edgeLength n:ℝ)) (sub_nonneg.mpr hD1)] + apply (le_div_iff₀ (sq_pos_of_pos hD)).mpr + have hx := (div_le_iff₀ hN).mpr hmain + calc + _ = 4+2*(12*(edgeLength n:ℝ)+1)*(edgeLength n:ℝ)^2/(n+1) := by field_simp + _ ≤ _ := by linarith + + + +lemma orderedJacobiGaps_le_four (n : ℕ) (i : Fin (n+1)) : orderedJacobiGaps n i ≤ 4 := by + let h := pathOperator_symmetric n + let x := h.eigenvectorBasis (by simp) i + have hx : ‖x‖=1 := (h.eigenvectorBasis (by simp)).norm_eq_one i + have hh := pathEnergy_le_four_mass n (extendPath n x) + rw [extendPath_mass,hx] at hh + have he := pathOperator_energy n x + have heig : inner ℝ x (pathOperator n x) = h.eigenvalues (by simp) i := by + dsimp only [x] + rw [h.apply_eigenvectorBasis,inner_smul_right,real_inner_self_eq_norm_sq] + simp only [(h.eigenvectorBasis (by simp)).norm_eq_one i,one_pow,mul_one,RCLike.ofReal_real_eq_id,id_eq] + rw [heig,hx] at he + unfold orderedJacobiGaps + linarith + +lemma spectralGood_resolvent (n : ℕ) {lam : Fin (n+1) → ℝ} {h s₀ s : ℝ} + (hh : 0 ≤ h) (hs₀ : 0 < s₀) (hs : s₀ ≤ s) + (hsmall : formA n h*s₀^(-5/8:ℝ)+formB n/s₀+formC n ≤ 1/2) + (hspace : 2 ≤ (n+1:ℝ)*s₀*Real.sqrt s₀) + (hlam : lam ∈ spectralGood n h s₀) : + (∀ i, 0 < 2+s-lam i) ∧ + (∑ i, (2+s-lam i)⁻¹^2)/(n+1) ≤ 16/Real.sqrt s ∧ + |(∑ i, (2+s-lam i)⁻¹)/(n+1)-semicircleResolvent s| ≤ + 416*formA n h*s^(-1/8:ℝ)+8*formB n/Real.sqrt s+2*formC n+2/((n+1:ℝ)*s) := by + have hn : (0:ℝ) < n+1 := by positivity + have hspos : 0 < s := hs₀.trans_le hs + have hA := formA_nonneg n hh + have hB := formB_nonneg n + have hC := formC_nonneg n + have hsc (t : ℝ) (hst : s ≤ t) : 2 ≤ (n+1:ℝ)*t*Real.sqrt t := by + have htpos : 0 < t := hspos.trans_le hst + exact hspace.trans (mul_le_mul (mul_le_mul_of_nonneg_left (hs.trans hst) hn.le) + (Real.sqrt_le_sqrt (hs.trans hst)) (Real.sqrt_nonneg _) (by positivity)) + have hc := resolvent_trace_transfer (orderedJacobiGaps n) (lam) + (orderedJacobiGaps_nonneg n) hA hB hC hs₀ hs + hlam hsmall + (fun t hst => (orderedJacobi_trace n (hspos.trans_le hst) (hsc t hst)).1) + have hd := orderedJacobi_trace n hspos (hsc s le_rfl) + refine ⟨hc.1,?_,?_⟩ + · apply (div_le_iff₀ hn).mpr + convert hc.2.1 using 1 + all_goals first | rfl | ring + · have hdif : |(∑ i, (2+s-lam i)⁻¹)/(n+1)- + (∑ i, (s+orderedJacobiGaps n i)⁻¹)/(n+1)| ≤ + 416*formA n h*s^(-1/8:ℝ)+8*formB n/Real.sqrt s+2*formC n := by + rw [← sub_div,abs_div,abs_of_pos hn] + apply (div_le_iff₀ hn).mpr + calc + _ ≤ _ := hc.2.2 + _ ≤ 104*formA n h*(4*(n+1))*s^(-1/8:ℝ)+2*formB n*(4*(n+1)/Real.sqrt s)+2*formC n*(n+1) := by gcongr; exact hd.2.2 + _ = _ := by ring + exact (abs_sub_le _ _ _).trans (add_le_add hdif hd.2.1) + +def traceCost (n : ℕ) (h s : ℝ) : ℝ := + 416*formA n h*s^(-5/8:ℝ)+8*formB n/s+2*formC n/Real.sqrt s+ + 2/((n+1:ℝ)*s*Real.sqrt s) + +lemma traceCost_nonneg (n : ℕ) {h s : ℝ} (hh : 0 ≤ h) (hs : 0 < s) : 0 ≤ traceCost n h s := by + have := formA_nonneg n hh + have := formB_nonneg n + have := formC_nonneg n + unfold traceCost; positivity + +lemma traceCost_antitone (n : ℕ) {h s t : ℝ} (hh : 0 ≤ h) (hs : 0 < s) (hst : s ≤ t) : + traceCost n h t ≤ traceCost n h s := by + have ht : 0 < t := hs.trans_le hst + have hA := formA_nonneg n hh + have hB := formB_nonneg n + have hC := formC_nonneg n + have hr := Real.sqrt_le_sqrt hst + have hsp := Real.sqrt_pos.mpr hs + unfold traceCost + apply add_le_add + · apply add_le_add + · apply add_le_add + · exact mul_le_mul_of_nonneg_left (Real.rpow_le_rpow_of_nonpos hs hst (by norm_num)) (by positivity) + · exact div_le_div_of_nonneg_left (by positivity) hs hst + · exact div_le_div_of_nonneg_left (by positivity) hsp hr + · apply div_le_div_of_nonneg_left (by norm_num) (by positivity) + exact mul_le_mul (mul_le_mul_of_nonneg_left hst (by positivity)) hr hsp.le (by positivity) + +lemma traceError_eq_cost (n : ℕ) (h : ℝ) {s : ℝ} (hs : 0 < s) : + 416*formA n h*s^(-1/8:ℝ)+8*formB n/Real.sqrt s+2*formC n+2/((n+1:ℝ)*s) = + traceCost n h s * Real.sqrt s := by + have hp : s^(-1/8:ℝ) = s^(-5/8:ℝ)*Real.sqrt s := by + rw [Real.sqrt_eq_rpow,← Real.rpow_add hs] + norm_num + have hsqrt := Real.sqrt_pos.mpr hs + have hN : (0:ℝ) < n+1 := by positivity + rw [hp,traceCost] + field_simp + linear_combination -(8*formB n*(n+1))*(Real.sq_sqrt hs.le) + +lemma spectralGood_relative_trace (n : ℕ) {lam : Fin (n+1) → ℝ} {h s₀ s η : ℝ} + (hh : 0 ≤ h) (hs₀ : 0 < s₀) (hs : s₀ ≤ s) + (hsmall : formA n h*s₀^(-5/8:ℝ)+formB n/s₀+formC n ≤ 1/2) + (hspace : 2 ≤ (n+1:ℝ)*s₀*Real.sqrt s₀) + (hlam : lam ∈ spectralGood n h s₀) (hcost : traceCost n h s₀ ≤ η) : + |(∑ i, (2+s-lam i)⁻¹)/(n+1)-semicircleResolvent s| ≤ η*Real.sqrt s := by + have ht := spectralGood_resolvent n hh hs₀ hs hsmall hspace hlam + apply ht.2.2.trans + rw [traceError_eq_cost n h (hs₀.trans_le hs)] + exact mul_le_mul_of_nonneg_right ((traceCost_antitone n hh hs₀ hs).trans hcost) (Real.sqrt_nonneg _) + +lemma traceCost_small (n : ℕ) {h s η : ℝ} (hh : 0 ≤ h) (hs : 0 < s) (hs1 : s ≤ 1) + (hcost : traceCost n h s ≤ η) : + formA n h*s^(-5/8:ℝ)+formB n/s+formC n ≤ η := by + have hA := formA_nonneg n hh + have hB := formB_nonneg n + have hC := formC_nonneg n + have hp : 0 ≤ formA n h*s^(-5/8:ℝ) := by positivity + have hq : 0 ≤ formB n/s := by positivity + have hroot : Real.sqrt s ≤ 1 := by simpa using Real.sqrt_le_sqrt hs1 + have hcle : formC n ≤ 2*formC n/Real.sqrt s := by + rw [le_div_iff₀ (Real.sqrt_pos.mpr hs)] + nlinarith [mul_le_mul_of_nonneg_left hroot hC] + have htail : 0 ≤ 2/((n+1:ℝ)*s*Real.sqrt s) := by positivity + unfold traceCost at hcost + have h8 : 8*formB n/s = 8*(formB n/s) := by ring + rw [h8] at hcost + nlinarith + +open scoped Topology + +def edgeFixedCost (h L : ℝ) : ℝ := + 416*formConstant*(h+1)*L^(-5/8:ℝ)+16/(L*Real.sqrt L) + +lemma edgeFixedCost_tendsto (h : ℝ) : Tendsto (edgeFixedCost h) atTop (𝓝 0) := by + have hA := (tendsto_rpow_neg_atTop (by norm_num : (0:ℝ) < 5/8)).const_mul + (416*formConstant*(h+1)) + have hB := (tendsto_id.atTop_mul_atTop₀ Real.tendsto_sqrt_atTop).const_div_atTop (16:ℝ) + have ht : Tendsto (fun L => edgeFixedCost h L) atTop (𝓝 0) := by + simpa only [edgeFixedCost,neg_div,mul_zero,zero_add,id_eq] using hA.add hB + exact ht + +lemma traceCost_natural_le (n : ℕ) {h L : ℝ} (hh : 0 ≤ h) (hL : 0 < L) : + traceCost n h (naturalEdgeScale n L) ≤ edgeFixedCost h L+ + 8*(formB n/naturalEdgeScale n L)+2*(formC n/Real.sqrt (naturalEdgeScale n L)) := by + have hspace := (naturalEdgeScale_space n hL).1 + have hbot : 0 < L*Real.sqrt L/8 := by positivity + have htail := div_le_div_of_nonneg_left (by norm_num : (0:ℝ) ≤ 2) hbot hspace + have hA := mul_le_mul_of_nonneg_left (formA_natural_scale n hh hL) (by norm_num : (0:ℝ) ≤ 416) + rw [show 2/(L*Real.sqrt L/8) = 16/(L*Real.sqrt L) by ring] at htail + unfold traceCost edgeFixedCost + ring_nf at hA htail ⊢ + linarith + +lemma traceCost_natural_eventually {h L η : ℝ} (hh : 0 ≤ h) (hL : 0 < L) + (hcost : edgeFixedCost h L < η) : + ∀ᶠ n : ℕ in atTop, traceCost n h (naturalEdgeScale n L) ≤ η := by + have ht := ((formB_natural_scale_tendsto L).const_mul 8).add + ((formC_natural_scale_tendsto hL).const_mul 2) + have ht' : Tendsto (fun n => 8*(formB n/naturalEdgeScale n L)+ + 2*(formC n/Real.sqrt (naturalEdgeScale n L))) atTop (𝓝 0) := by simpa using ht + filter_upwards [ht'.eventually (gt_mem_nhds (sub_pos.mpr hcost))] with n hn + linarith [traceCost_natural_le n hh hL] + +lemma exists_natural_edge_parameters {h η B : ℝ} (hh : 0 ≤ h) (hη : 0 < η) : + ∃ L : ℝ, max 1696 B ≤ L ∧ 0 < L ∧ + (∀ᶠ n : ℕ in atTop, traceCost n h (naturalEdgeScale n L) ≤ η) := by + obtain ⟨L,hL,hcost⟩ := ((eventually_ge_atTop (max 1696 B)).and + ((edgeFixedCost_tendsto h).eventually (gt_mem_nhds hη))).exists + have hLp : 0 < L := lt_of_lt_of_le (by norm_num : (0:ℝ) < 1696) ((le_max_left _ _).trans hL) + exact ⟨L,hL,hLp,traceCost_natural_eventually hh hLp hcost⟩ + +lemma spectralGood_relative_error (n : ℕ) {lam : Fin (n+1) → ℝ} {h s η : ℝ} + (hh : 0 ≤ h) (hs : 0 < s) (hs1 : s ≤ 1) (hcost : traceCost n h s ≤ η) + (hlam : lam ∈ spectralGood n h s) (i : Fin (n+1)) : + |lam i-(2-orderedJacobiGaps n i)| ≤ η*(s+orderedJacobiGaps n i) := by + have he := edgeError_relative (formA_nonneg n hh) (formB_nonneg n) (formC_nonneg n) + hs le_rfl (orderedJacobiGaps_nonneg n i) + exact (hlam i).trans (he.trans (mul_le_mul_of_nonneg_right (traceCost_small n hh hs hs1 hcost) + (by linarith [orderedJacobiGaps_nonneg n i]))) + +lemma spectralGood_bounded (n : ℕ) {lam : Fin (n+1) → ℝ} {h s η : ℝ} + (hh : 0 ≤ h) (hs : 0 < s) (hs1 : s ≤ 1) (hη : η ≤ 1/5) + (hcost : traceCost n h s ≤ η) (hlam : lam ∈ spectralGood n h s) : + ∀ i, |lam i| ≤ 3 := by + have hη0 := (traceCost_nonneg n hh hs).trans hcost + intro i + have he := spectralGood_relative_error n hh hs hs1 hcost hlam i + have h0 := orderedJacobiGaps_nonneg n i + have h4 := orderedJacobiGaps_le_four n i + have hE : η*(s+orderedJacobiGaps n i) ≤ 1 := by nlinarith + have h := abs_le.mp (he.trans hE) + exact abs_le.mpr ⟨by linarith,by linarith⟩ + +lemma spectralGood_top_upper (n : ℕ) {lam : Fin (n+1) → ℝ} {h s η : ℝ} + (hh : 0 ≤ h) (hs : 0 < s) (hs1 : s ≤ 1) (hη : η ≤ 1) + (hcost : traceCost n h s ≤ η) (hlam : lam ∈ spectralGood n h s) : + ∀ i, lam i ≤ 2+η*s := by + intro i + have he := (abs_le.mp (spectralGood_relative_error n hh hs hs1 hcost hlam i)).2 + nlinarith [orderedJacobiGaps_nonneg n i] + +lemma spectralGood_top_close {n : ℕ} {lam : Fin (n+1) → ℝ} {h L : ℝ} + (hh : 0 ≤ h) (hL : 1696 ≤ L) (hs1 : naturalEdgeScale n L ≤ 1) + (hfit : 12*edgeLength n ≤ n) (hcost : traceCost n h (naturalEdgeScale n L) ≤ 1/100) + (hlam : lam ∈ spectralGood n h (naturalEdgeScale n L)) + (i : Fin (n+1)) (hi : i.val < 3) : + |lam i-2| ≤ naturalEdgeScale n L/4 := by + have hLp : 0 < L := lt_of_lt_of_le (by norm_num) hL + have hs := naturalEdgeScale_pos n hLp + have hg : orderedJacobiGaps n i ≤ naturalEdgeScale n L/8 := by + apply (orderedJacobiGaps_natural_top hfit i hi).trans + calc + _ ≤ (L/8)/(edgeLength n:ℝ)^2 := + div_le_div_of_nonneg_right (by linarith) (sq_nonneg _) + _ = _ := by unfold naturalEdgeScale; ring + have he := abs_le.mp (spectralGood_relative_error n hh hs hs1 hcost hlam i) + have hg0 := orderedJacobiGaps_nonneg n i + exact abs_le.mpr ⟨by linarith,by linarith⟩ + + +lemma finite_cover_sum {ι κ : Type*} [Fintype ι] [DecidableEq ι] [DecidableEq κ] + (J : Finset κ) (S : κ → Finset ι) (f : ι → ℝ) + (hf : ∀ i, 0 ≤ f i) (hc : ∀ i, ∃ j ∈ J, i ∈ S j) : + (∑ i, f i) ≤ ∑ j ∈ J, ∑ i ∈ S j, f i := by + calc + _ ≤ ∑ i, ∑ j ∈ J, if i ∈ S j then f i else 0 := by + apply Finset.sum_le_sum + intro i _ + obtain ⟨j, hj, hij⟩ := hc i + calc + f i = (if i ∈ S j then f i else 0) := by rw [ite_eq_left hij] + _ ≤ _ := Finset.single_le_sum (f := fun k => if i ∈ S k then f i else 0) + (fun k _ => by split_ifs <;> simp [hf]) hj + _ = _ := by + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro j _ + simp only [← Finset.sum_filter] + congr + ext; simp + +lemma dyadic_real_cover {x s : ℝ} (_hx : 0 ≤ x) (hs : 0 < s) : + x ≤ s ∨ ∃ j : ℕ, (2 : ℝ)^j * s ≤ x ∧ x ≤ (2 : ℝ)^(j + 1) * s := by + by_cases hxs : x ≤ s + · exact Or.inl hxs + right + have hratio : 1 ≤ x / s := (le_div_iff₀ hs).mpr (by linarith) + obtain ⟨j, hj, hj'⟩ := exists_nat_pow_near hratio (by norm_num : (1 : ℝ) < 2) + exact ⟨j, (le_div_iff₀ hs).mp hj, (div_le_iff₀ hs).mp hj'.le⟩ + +lemma rpow_dyadic_shell {s : ℝ} (hs : 0 < s) (j : ℕ) : + ((2 : ℝ)^(j + 1) * s) ^ (3 / 2 : ℝ) * + ((2 : ℝ)^j * s) ^ (-13 / 8 : ℝ) = + (2 : ℝ) ^ (3 / 2 : ℝ) * s ^ (-1 / 8 : ℝ) * + ((2 : ℝ) ^ (-1 / 8 : ℝ)) ^ j := by + rw [Real.mul_rpow (by positivity) hs.le, Real.mul_rpow (by positivity) hs.le, + ← Real.rpow_pow_comm (by norm_num), ← Real.rpow_pow_comm (by norm_num), pow_succ] + calc + _ = (2 : ℝ) ^ (3 / 2 : ℝ) * (s ^ (3 / 2 : ℝ) * s ^ (-13 / 8 : ℝ)) * + (((2 : ℝ) ^ (3 / 2 : ℝ)) ^ j * ((2 : ℝ) ^ (-13 / 8 : ℝ)) ^ j) := by ring + _ = _ := by + rw [← Real.rpow_add hs, ← mul_pow, ← Real.rpow_add (by norm_num : (0 : ℝ) < 2)] + norm_num + +lemma fractional_resolvent_counting {ι : Type*} [Fintype ι] [DecidableEq ι] + (e : ι → ℝ) (he : ∀ i, 0 ≤ e i) {s C : ℝ} (hs : 0 < s) (hC : 0 ≤ C) + (hc : ∀ t, s ≤ t → ((Finset.univ.filter fun i => e i ≤ t).card : ℝ) ≤ + C * t ^ (3 / 2 : ℝ)) : + (∑ i, (s + e i) ^ (-13 / 8 : ℝ)) ≤ + C * (1 + (2 : ℝ) ^ (3 / 2 : ℝ) / (1 - (2 : ℝ) ^ (-1 / 8 : ℝ))) * + s ^ (-1 / 8 : ℝ) := by + let rho : ℝ := (2 : ℝ) ^ (-1 / 8 : ℝ) + have hrho0 : 0 ≤ rho := by dsimp [rho]; positivity + have hrho : rho < 1 := by + exact Real.rpow_lt_one_of_one_lt_of_neg (by norm_num) (by norm_num) + let small : Finset ι := Finset.univ.filter fun i => e i ≤ s + let shell (j : ℕ) : Finset ι := + Finset.univ.filter fun i => (2 : ℝ)^j * s ≤ e i ∧ e i ≤ (2 : ℝ)^(j + 1) * s + have hcover : ∀ i, ∃ j : ℕ, i ∈ (if j = 0 then small else shell (j - 1)) := by + intro i + rcases dyadic_real_cover (he i) hs with hi | ⟨j, hj, hj'⟩ + · exact ⟨0, by simp [small, hi]⟩ + · exact ⟨j + 1, by simp [shell, hj, hj']⟩ + choose j hj using hcover + let J : Finset ℕ := Finset.univ.image j + have hsum0 : (∑ i ∈ small, (s + e i) ^ (-13 / 8 : ℝ)) ≤ C * s ^ (-1 / 8 : ℝ) := by + calc + _ ≤ ∑ _i ∈ small, s ^ (-13 / 8 : ℝ) := by + apply Finset.sum_le_sum + intro i _ + exact Real.rpow_le_rpow_of_nonpos hs (le_add_of_nonneg_right (he i)) (by norm_num) + _ = (small.card : ℝ) * s ^ (-13 / 8 : ℝ) := by simp + _ ≤ (C * s ^ (3 / 2 : ℝ)) * s ^ (-13 / 8 : ℝ) := + mul_le_mul_of_nonneg_right (hc s le_rfl) (by positivity) + _ = _ := by rw [mul_assoc, ← Real.rpow_add hs]; norm_num + have hshell (k : ℕ) : (∑ i ∈ shell k, (s + e i) ^ (-13 / 8 : ℝ)) ≤ + C * (2 : ℝ) ^ (3 / 2 : ℝ) * s ^ (-1 / 8 : ℝ) * rho ^ k := by + have ht : s ≤ (2 : ℝ)^(k + 1) * s := by + have : (1 : ℝ) ≤ 2^(k + 1) := one_le_pow₀ (by norm_num) + nlinarith + have hcard : (shell k).card ≤ (Finset.univ.filter fun i => e i ≤ (2 : ℝ)^(k + 1) * s).card := + Finset.card_le_card (by intro i hi; exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, (Finset.mem_filter.mp hi).2.2⟩) + calc + _ ≤ ∑ _i ∈ shell k, ((2 : ℝ)^k * s) ^ (-13 / 8 : ℝ) := by + apply Finset.sum_le_sum + intro i hi + apply Real.rpow_le_rpow_of_nonpos (by positivity) _ (by norm_num) + have := (Finset.mem_filter.mp hi).2.1 + linarith + _ = ((shell k).card : ℝ) * ((2 : ℝ)^k * s) ^ (-13 / 8 : ℝ) := by simp + _ ≤ (C * ((2 : ℝ)^(k + 1) * s) ^ (3 / 2 : ℝ)) * + ((2 : ℝ)^k * s) ^ (-13 / 8 : ℝ) := by + apply mul_le_mul_of_nonneg_right _ (by positivity) + have hcardR : ((shell k).card : ℝ) ≤ + ((Finset.univ.filter fun i => e i ≤ (2 : ℝ)^(k + 1) * s).card : ℝ) := by + exact_mod_cast hcard + exact hcardR.trans (hc _ ht) + _ = _ := by rw [mul_assoc, rpow_dyadic_shell hs k]; dsimp [rho]; ring + have hcover' : ∀ i, ∃ k ∈ J, i ∈ (if k = 0 then small else shell (k - 1)) := + fun i => ⟨j i, Finset.mem_image.mpr ⟨i, Finset.mem_univ _, rfl⟩, hj i⟩ + have hbound := finite_cover_sum J (fun k => if k = 0 then small else shell (k - 1)) + (fun i => (s + e i) ^ (-13 / 8 : ℝ)) (fun i => Real.rpow_nonneg (by linarith [he i]) _) hcover' + have hterm (k : ℕ) : (∑ i ∈ (if k = 0 then small else shell (k - 1)), + (s + e i) ^ (-13 / 8 : ℝ)) ≤ + (if k = 0 then C * s ^ (-1 / 8 : ℝ) else + C * (2 : ℝ) ^ (3 / 2 : ℝ) * s ^ (-1 / 8 : ℝ) * rho ^ (k - 1)) := by + split_ifs + · exact hsum0 + · exact hshell _ + let f (k : ℕ) : ℝ := if k = 0 then C * s ^ (-1 / 8 : ℝ) else + C * (2 : ℝ) ^ (3 / 2 : ℝ) * s ^ (-1 / 8 : ℝ) * rho ^ (k - 1) + have hf0 : ∀ k, 0 ≤ f k := by intro k; dsimp [f]; split_ifs <;> positivity + have hfsucc : (fun k => f (k + 1)) = (fun k => C * (2 : ℝ) ^ (3 / 2 : ℝ) * + s ^ (-1 / 8 : ℝ) * rho ^ k) := by funext k; simp [f] + have hgeom : Summable (fun k : ℕ => rho ^ k) := summable_geometric_of_lt_one hrho0 hrho + have hfsum : Summable f := by + rw [← summable_nat_add_iff 1] + rw [hfsucc] + exact hgeom.mul_left _ + have htotal : (∑' k, f k) = C * s ^ (-1 / 8 : ℝ) + + C * (2 : ℝ) ^ (3 / 2 : ℝ) * s ^ (-1 / 8 : ℝ) / (1 - rho) := by + rw [hfsum.tsum_eq_zero_add, hfsucc, tsum_mul_left, + tsum_geometric_of_lt_one hrho0 hrho] + simp only [f, ite_eq_left rfl] + ring + calc + _ ≤ ∑ k ∈ J, f k := hbound.trans (Finset.sum_le_sum (fun k _ => hterm k)) + _ ≤ ∑' k, f k := hfsum.sum_le_tsum J (fun k _ => hf0 k) + _ = _ := by rw [htotal]; dsimp [rho]; ring + +lemma rpow_three_halves {s : ℝ} (hs : 0 < s) : + s ^ (3 / 2 : ℝ) = s * Real.sqrt s := by + rw [Real.sqrt_eq_rpow, show (3 / 2 : ℝ) = 1 + 1 / 2 by norm_num, + Real.rpow_add hs, Real.rpow_one] + +lemma jacobi_fractional_resolvent {n : ℕ} (hn : 0 < n) {s : ℝ} (hs : 0 < s) + (hscale : 2 ≤ (n : ℝ) * s * Real.sqrt s) : + (n : ℝ)⁻¹ * (∑ i, (s + jacobiGaps n i) ^ (-13 / 8 : ℝ)) ≤ + 16 * (1 + (2 : ℝ) ^ (3 / 2 : ℝ) / (1 - (2 : ℝ) ^ (-1 / 8 : ℝ))) * + s ^ (-1 / 8 : ℝ) := by + have h := fractional_resolvent_counting (jacobiGaps n) (jacobiGaps_nonneg n) + hs (C := 16 * n) (by positivity) ?_ + · have hn0 : (n : ℝ) ≠ 0 := by exact_mod_cast hn.ne' + have h' := mul_le_mul_of_nonneg_left h (inv_nonneg.mpr (Nat.cast_nonneg n)) + convert! h' using 1 + field_simp + · intro t ht + have ht0 : 0 < t := hs.trans_le ht + have hst : (n : ℝ) * s * Real.sqrt s ≤ n * t * Real.sqrt t := by gcongr + simpa only [rpow_three_halves ht0, mul_assoc] using + jacobi_gap_counting hn ht0 (hscale.trans hst) + +lemma semicircleResolvent_deficit_lower {s : ℝ} (hs : 0 ≤ s) (hs1 : s ≤ 1) : + Real.sqrt s/2 ≤ 1-semicircleResolvent s := by + have hsroot : s ≤ Real.sqrt s := by + nlinarith [Real.sq_sqrt hs,Real.sqrt_nonneg s,Real.sqrt_le_sqrt hs1] + have hc := semicircle_discriminant_lower hs + unfold semicircleResolvent + linarith + +lemma sum_pair_tail_real {n : ℕ} (v : Fin (n+2) → ℝ) : + (∑ i, v i) = v 0+v 1+∑ i : Fin n, v i.succ.succ := by + rw [Fin.sum_univ_succ,Fin.sum_univ_succ] + simp only [Fin.succ_zero_eq_one] + ring + +def fixedEdgeVariance {ι : Type*} (lam : ι → ℝ) (s : ℝ) (i : ι) : NNReal := + ⟨max 0 ((2+s-lam i)⁻¹),le_max_left _ _⟩ + +lemma fixedEdgeVariance_coe {ι : Type*} {lam : ι → ℝ} {s : ℝ} + (hgap : ∀ i, 0 < 2+s-lam i) (i : ι) : + (fixedEdgeVariance lam s i:ℝ) = (2+s-lam i)⁻¹ := + max_eq_right (inv_nonneg.mpr (hgap i).le) + +lemma fixedEdgeVariance_pos {ι : Type*} {lam : ι → ℝ} {s : ℝ} + (hgap : ∀ i, 0 < 2+s-lam i) (i : ι) : fixedEdgeVariance lam s i ≠ 0 := by + rw [← NNReal.coe_ne_zero,fixedEdgeVariance_coe hgap] + exact inv_ne_zero (hgap i).ne' + +lemma fixedEdgeVariance_inverse {ι : Type*} {lam : ι → ℝ} {s : ℝ} + (hgap : ∀ i, 0 < 2+s-lam i) (i : ι) : + (fixedEdgeVariance lam s i:ℝ)⁻¹ = 2+s-lam i := by + rw [fixedEdgeVariance_coe hgap,inv_inv] + +lemma bulk_fixedTilt_bounds {n : ℕ} (v : Fin (n+2) → ℝ) {s : ℝ} + (hs : 0 < s) (hs1 : s ≤ 1) (hv : ∀ i, 0 ≤ v i) + (htrace : |(∑ i, v i)/(n+2)-semicircleResolvent s| ≤ (1/100)*Real.sqrt s) + (hsq : (∑ i, v i^2) ≤ 16*(n+2)/Real.sqrt s) + (hmax : ∀ i, v i ≤ 2/s) + (hspace : 32768 ≤ (n+2:ℝ)*s*Real.sqrt s) : + let d : ℝ := (n+2)-(∑ i : Fin n, v i.succ.succ) + (n+2:ℝ)*Real.sqrt s/4 ≤ d ∧ d ≤ 3*(n+2:ℝ)*Real.sqrt s ∧ + 128*(∑ i : Fin n, (v i.succ.succ)^2) ≤ d^2 := by + have hN : (0:ℝ) < n+2 := by positivity + have hr : 0 < Real.sqrt s := Real.sqrt_pos.mpr hs + have ht := abs_le.mp htrace + have hlowR := semicircleResolvent_deficit_lower hs.le hs1 + have huppR := semicircleResolvent_deficit hs.le + have hfull_upper : (∑ i, v i) ≤ (n+2)-(n+2)*Real.sqrt s/4 := by + have hh : (∑ i, v i)/(n+2) ≤ 1-Real.sqrt s/4 := by linarith + have hm := (div_le_iff₀ hN).mp hh + nlinarith + have hfull_lower : (n+2)-(∑ i, v i) ≤ 2*(n+2)*Real.sqrt s := by + have hh : 1-2*Real.sqrt s ≤ (∑ i, v i)/(n+2) := by linarith + have hm := (le_div_iff₀ hN).mp hh + nlinarith + have hpair_le : v 0+v 1 ≤ (n+2)*Real.sqrt s := by + have hh : 4/s ≤ (n+2)*Real.sqrt s := by + rw [div_le_iff₀ hs] + nlinarith + have h0 := hmax 0 + have h1 := hmax 1 + ring_nf at h0 h1 hh ⊢ + linarith + have hsplit := sum_pair_tail_real v + dsimp only + have hd : (n+2:ℝ)*Real.sqrt s/4 ≤ (n+2)-(∑ i : Fin n, v i.succ.succ) := by + linarith [hv 0,hv 1] + refine ⟨hd,by linarith,?_⟩ + have htail : (∑ i : Fin n, (v i.succ.succ)^2) ≤ (∑ i, v i^2) := by + rw [sum_pair_tail_real (fun i => v i^2)] + linarith [sq_nonneg (v 0),sq_nonneg (v 1)] + have hid : ((n+2:ℝ)*Real.sqrt s/4)^2*Real.sqrt s = + ((n+2:ℝ)/16)*((n+2:ℝ)*s*Real.sqrt s) := by + rw [div_pow,mul_pow,Real.sq_sqrt hs.le] + ring + have hmid : 2048*(n+2:ℝ)/Real.sqrt s ≤ ((n+2:ℝ)*Real.sqrt s/4)^2 := by + rw [div_le_iff₀ hr,hid] + have hh := mul_le_mul_of_nonneg_left hspace (div_nonneg hN.le (by norm_num : (0:ℝ) ≤ 16)) + linarith + calc + _ ≤ 128*(16*(n+2:ℝ)/Real.sqrt s) := mul_le_mul_of_nonneg_left (htail.trans hsq) (by norm_num) + _ = 2048*(n+2:ℝ)/Real.sqrt s := by ring + _ ≤ ((n+2:ℝ)*Real.sqrt s/4)^2 := hmid + _ ≤ _ := pow_le_pow_left₀ (by positivity) hd 2 + +lemma fixedEdgeVariance_upper {ι : Type*} {lam : ι → ℝ} {s : ℝ} (hs : 0 < s) + (hgap : ∀ i, s/2 ≤ 2+s-lam i) (i : ι) : + (fixedEdgeVariance lam s i:ℝ) ≤ 2/s := by + have hp (j : ι) : 0 < 2+s-lam j := lt_of_lt_of_le (by positivity) (hgap j) + rw [fixedEdgeVariance_coe hp] + have hh := (inv_le_inv₀ (hp i) (by positivity : (0:ℝ) < s/2)).2 (hgap i) + simpa only [inv_div,inv_one,one_div] using hh + +lemma fixedEdgeVariance_lower {ι : Type*} {lam : ι → ℝ} {s : ℝ} (hs : 0 < s) + (hgap : ∀ i, 0 < 2+s-lam i) (i : ι) (hi : |lam i-2| ≤ s/4) : + 1/(2*s) ≤ (fixedEdgeVariance lam s i:ℝ) := by + rw [fixedEdgeVariance_coe hgap,one_div] + exact (inv_le_inv₀ (by positivity : (0:ℝ) < 2*s) (hgap i)).2 (by + have hh := (abs_le.mp hi).1; linarith) + +lemma spectralGood_fixed_variance {n : ℕ} {lam : Fin (n+2) → ℝ} {h s : ℝ} + (hh : 0 ≤ h) (hs : 0 < s) (hs1 : s ≤ 1) + (hcost : traceCost (n+1) h s ≤ 1/100) (hlam : lam ∈ spectralGood (n+1) h s) + (hspace : 32768 ≤ (n+2:ℝ)*s*Real.sqrt s) : + (∀ i, 0 < 2+s-lam i) ∧ + (∀ i, (fixedEdgeVariance lam s i:ℝ) ≤ 2/s) ∧ + |(∑ i, (fixedEdgeVariance lam s i:ℝ))/(n+2)-semicircleResolvent s| ≤ (1/100)*Real.sqrt s ∧ + (∑ i, (fixedEdgeVariance lam s i:ℝ)^2) ≤ 16*(n+2)/Real.sqrt s := by + have hup := spectralGood_top_upper (n+1) hh hs hs1 (by norm_num : (1/100:ℝ) ≤ 1) hcost hlam + have hgap (i) : s/2 ≤ 2+s-lam i := by linarith [hup i] + have hpos (i) : 0 < 2+s-lam i := lt_of_lt_of_le (by positivity) (hgap i) + have hsmall : formA (n+1) h*s^(-5/8:ℝ)+formB (n+1)/s+formC (n+1) ≤ 1/2 := + (traceCost_small (n+1) hh hs hs1 hcost).trans (by norm_num) + have hspace' : 2 ≤ (n+1+1:ℝ)*s*Real.sqrt s := by linarith + have hN : (0:ℝ) < n+2 := by positivity + have ht := spectralGood_relative_trace (n+1) hh hs le_rfl hsmall + (by simpa only [Nat.cast_add,Nat.cast_one] using hspace') hlam hcost + have hq := (spectralGood_resolvent (n+1) hh hs le_rfl hsmall + (by simpa only [Nat.cast_add,Nat.cast_one] using hspace') hlam).2.1 + simp only [Nat.cast_add,Nat.cast_one,show (n:ℝ)+1+1=n+2 by ring] at ht hq + refine ⟨hpos,fixedEdgeVariance_upper hs hgap,?_,?_⟩ + · simpa only [fixedEdgeVariance_coe hpos] using ht + · simp only [fixedEdgeVariance_coe hpos] + have he := (div_le_iff₀ hN).mp hq + convert he using 1; first | rfl | ring + +lemma spectralGood_fixed_bulk {n : ℕ} {lam : Fin (n+2) → ℝ} {h s : ℝ} + (hh : 0 ≤ h) (hs : 0 < s) (hs1 : s ≤ 1) + (hcost : traceCost (n+1) h s ≤ 1/100) (hlam : lam ∈ spectralGood (n+1) h s) + (hspace : 32768 ≤ (n+2:ℝ)*s*Real.sqrt s) : + let d : ℝ := (n+2)-(∑ i : Fin n, (fixedEdgeVariance lam s i.succ.succ:ℝ)) + (n+2:ℝ)*Real.sqrt s/4 ≤ d ∧ d ≤ 3*(n+2:ℝ)*Real.sqrt s ∧ + 128*(∑ i : Fin n, (fixedEdgeVariance lam s i.succ.succ:ℝ)^2) ≤ d^2 := by + have hi := spectralGood_fixed_variance hh hs hs1 hcost hlam hspace + exact bulk_fixedTilt_bounds (fun i => (fixedEdgeVariance lam s i:ℝ)) hs hs1 + (fun i => NNReal.coe_nonneg _) hi.2.2.1 hi.2.2.2 hi.2.1 hspace + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/EntropyBounds.lean b/lean/OAI/MathematicalPhysics/CriticalSK/EntropyBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..018c4c62034e931448ea8a2a5c1bc93ec6239821 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/EntropyBounds.lean @@ -0,0 +1,194 @@ +import OAI.MathematicalPhysics.CriticalSK.RelaxationBounds + +namespace OAI + +noncomputable section +open scoped BigOperators Topology NNReal ENNReal +open MeasureTheory ProbabilityTheory Filter +namespace CriticalSK + +lemma scalar_entropy_upper {z b : ℝ} (hz : 0 ≤ z) (hb : 0 < b) : + b * (z * (Real.log z - Real.log b)) ≤ z ^ 2 - b * z := by + by_cases hz0 : z = 0 + · simp [hz0] + have hzp : 0 < z := lt_of_le_of_ne hz (Ne.symm hz0) + have hh := mul_le_mul_of_nonneg_left (Real.log_le_sub_one_of_pos (div_pos hzp hb)) + (mul_nonneg hb.le hz) + rw [Real.log_div hz0 hb.ne'] at hh + have he : (b * z) * (z / b - 1) = z ^ 2 - b * z := by + field_simp + rw [he] at hh + simpa only [mul_assoc] using hh + +lemma scalar_entropy_lower {z b : ℝ} (hz : 0 ≤ z) (hb : 0 < b) : + 2 * z ^ 2 - 2 * z * b ≤ z ^ 2 * (Real.log (z ^ 2) - Real.log (b ^ 2)) := by + by_cases hz0 : z = 0 + · simp [hz0] + have hh := mul_le_mul_of_nonneg_left (Real.self_sub_one_le_mul_log (div_nonneg hz hb.le)) hb.le + have he : b * (z / b - 1) = z - b := by field_simp + have he' : b * (z / b * Real.log (z / b)) = z * Real.log (z / b) := by field_simp + rw [he, he', Real.log_div hz0 hb.ne'] at hh + have hmul := mul_le_mul_of_nonneg_left hh (show 0 ≤ 2 * z by positivity) + rw [Real.log_pow, Real.log_pow] + norm_num only [Nat.cast_ofNat] + nlinarith only [hmul] + +section EntropyFinite +variable {n : ℕ} (W : Disorder n) + +lemma variance_eq_second_moment (f : Spin n → ℝ) : + variance W f = mean W (fun x => f x ^ 2) - (mean W f) ^ 2 := by + have hh := mean_square_center_identity W f 0 + simp only [sub_zero] at hh + linarith + +lemma mean_square_pos_full {f : Spin n → ℝ} (hf : f ≠ 0) : + 0 < mean W (fun x => f x ^ 2) := by + classical + obtain ⟨x, hx⟩ : ∃ x, f x ≠ 0 := by + by_contra! hh + exact hf (funext hh) + exact lt_of_lt_of_le (mul_pos (gibbs_pos W x) (sq_pos_of_ne_zero hx)) + (Finset.single_le_sum (fun y _ => mul_nonneg (gibbs_nonneg W y) (sq_nonneg (f y))) + (Finset.mem_univ x)) + +lemma entropy_eq_centered_log (g : Spin n → ℝ) : + entropy W g = mean W (fun x => g x * (Real.log (g x) - Real.log (mean W g))) := by + simp only [entropy, mul_sub, mean_sub, mean_mul_const] + +lemma entropy_times_mean_le_variance (g : Spin n → ℝ) (hg : ∀ x, 0 ≤ g x) + (hp : 0 < mean W g) : + mean W g * entropy W g ≤ variance W g := by + have hh := mean_mono W (fun x => scalar_entropy_upper (hg x) hp) + rw [mean_const_mul, ← entropy_eq_centered_log, mean_sub, mean_const_mul] at hh + rw [variance_eq_second_moment] + nlinarith only [hh] + +lemma variance_le_entropy_square (f : Spin n → ℝ) (hf : ∀ x, 0 ≤ f x) : + variance W f ≤ entropy W (fun x => f x ^ 2) := by + by_cases hf0 : f = 0 + · simp [hf0, variance, entropy, mean] + have hp := mean_square_pos_full W hf0 + have hh := mean_mono W (fun x => scalar_entropy_lower (hf x) (Real.sqrt_pos.mpr hp)) + rw [Real.sq_sqrt hp.le] at hh + change mean W (fun x => 2 * f x ^ 2 - (2 * f x) * Real.sqrt (mean W (fun y => f y ^ 2))) ≤ _ at hh + rw [mean_sub, mean_const_mul, mean_mul_const, mean_const_mul, + ← entropy_eq_centered_log] at hh + rw [variance_eq_second_moment] + nlinarith [sq_nonneg (Real.sqrt (mean W (fun y => f y ^ 2)) - mean W f), Real.sq_sqrt hp.le] + +lemma exists_gibbs_lower : ∃ m : ℝ, 0 < m ∧ ∀ x, m ≤ gibbs W x := by + classical + let T : Finset ℝ := Finset.univ.image (gibbs W) + have hT : T.Nonempty := Finset.Nonempty.image Finset.univ_nonempty _ + refine ⟨T.min' hT, ?_, fun x => Finset.min'_le T _ (Finset.mem_image.mpr ⟨x, Finset.mem_univ _, rfl⟩)⟩ + obtain ⟨x, _, hx⟩ := Finset.mem_image.mp (Finset.min'_mem T hT) + rw [← hx] + exact gibbs_pos W x + +lemma square_variance_bound {m : ℝ} (hm : 0 < m) (hmin : ∀ x, m ≤ gibbs W x) + (f : Spin n → ℝ) : + m * variance W (fun x => f x ^ 2) ≤ 4 * mean W (fun x => f x ^ 2) * variance W f := by + let E := mean W (fun x => f x ^ 2) + have hcoord (x : Spin n) : m * f x ^ 2 ≤ E := by + calc + _ ≤ gibbs W x * f x ^ 2 := mul_le_mul_of_nonneg_right (hmin x) (sq_nonneg _) + _ ≤ _ := Finset.single_le_sum (fun y _ => mul_nonneg (gibbs_nonneg W y) (sq_nonneg (f y))) + (Finset.mem_univ x) + have hdiff (x y : Spin n) : m * (f x ^ 2 - f y ^ 2) ^ 2 ≤ 4 * E * (f x - f y) ^ 2 := by + have hsum : m * (f x + f y) ^ 2 ≤ 4 * E := by + nlinarith [hcoord x, hcoord y, mul_nonneg hm.le (sq_nonneg (f x - f y))] + have hh := mul_le_mul_of_nonneg_right hsum (sq_nonneg (f x - f y)) + nlinarith only [hh] + have hh : m * mean W (fun x => ∑ y, gibbs W y * (f x ^ 2 - f y ^ 2) ^ 2) ≤ + (4 * E) * mean W (fun x => ∑ y, gibbs W y * (f x - f y) ^ 2) := by + rw [← mean_const_mul, ← mean_const_mul] + apply mean_mono + intro x + rw [Finset.mul_sum, Finset.mul_sum] + apply Finset.sum_le_sum + intro y _ + nlinarith only [mul_le_mul_of_nonneg_left (hdiff x y) (gibbs_nonneg W y)] + rw [variance_pair_identity, variance_pair_identity] at hh + change m * variance W (fun x => f x ^ 2) ≤ (4 * E) * variance W f + linarith + +lemma entropy_square_le_variance {m : ℝ} (hm : 0 < m) (hmin : ∀ x, m ≤ gibbs W x) + (f : Spin n → ℝ) : + entropy W (fun x => f x ^ 2) ≤ (4 / m) * variance W f := by + by_cases hf0 : f = 0 + · simp [hf0, entropy, variance, mean] + have hp := mean_square_pos_full W hf0 + have he := entropy_times_mean_le_variance W (fun x => f x ^ 2) (fun x => sq_nonneg _) hp + have hv := square_variance_bound W hm hmin f + have hh := (mul_le_mul_of_nonneg_left he hm.le).trans hv + have hc : m * entropy W (fun x => f x ^ 2) ≤ 4 * variance W f := by + apply (mul_le_mul_iff_left₀ hp).mp + nlinarith only [hh] + have := (le_div_iff₀ hm).mpr (by simpa only [mul_comm] using hc) + convert this using 2 + first | rfl | ring + +lemma exists_finite_logSobolev (hn : 0 < n) : + ∃ C : ℝ, 0 < C ∧ ∀ f : Spin n → ℝ, + entropy W (fun x => f x ^ 2) ≤ C * dirichlet W f := by + obtain ⟨m, hm, hmin⟩ := exists_gibbs_lower W + obtain ⟨C, hC, hgap⟩ := exists_finite_poincare W hn + have hb : 0 < 4 / m := div_pos (by norm_num) hm + refine ⟨(4 / m) * C, mul_pos hb hC, fun f => ?_⟩ + calc + _ ≤ (4 / m) * variance W f := entropy_square_le_variance W hm hmin f + _ ≤ (4 / m) * (C * dirichlet W f) := mul_le_mul_of_nonneg_left (hgap f) hb.le + _ = _ := by ring + +lemma entropy_ratios_bdd (hn : 0 < n) : + BddAbove {r : ℝ | ∃ f : Spin n → ℝ, 0 < entropy W (fun x => f x ^ 2) ∧ + r = entropy W (fun x => f x ^ 2) / dirichlet W f} := by + obtain ⟨C, hC, hLS⟩ := exists_finite_logSobolev W hn + refine ⟨C, ?_⟩ + rintro r ⟨f, hf, rfl⟩ + have hd : 0 < dirichlet W f := by + by_contra h + have ht := mul_nonpos_of_nonneg_of_nonpos hC.le (le_of_not_gt h) + have hh := hLS f + linarith + exact (div_le_iff₀ hd).mpr (hLS f) + +lemma variance_add_const (f : Spin n → ℝ) (c : ℝ) : + variance W (fun x => f x + c) = variance W f := by + simp only [variance, mean_add, mean_const, add_sub_add_right_eq_sub] + +lemma dirichlet_add_const (f : Spin n → ℝ) (c : ℝ) : + dirichlet W (fun x => f x + c) = dirichlet W f := by + simp only [dirichlet, mul_add, Finset.sum_add_distrib, ← Finset.sum_mul, + siteKernel_sum, one_mul, add_sub_add_right_eq_sub] + +lemma full_ratios_nonempty (hn : 0 < n) : + Set.Nonempty {r : ℝ | ∃ f : Spin n → ℝ, 0 < variance W f ∧ + r = variance W f / dirichlet W f} := by + obtain ⟨r, a, ha, hr⟩ := linear_ratios_nonempty W hn + exact ⟨r, linearObservable a, variance_linear_pos_full W ha, hr⟩ + +lemma relaxationTime_le_logSobolevConstant (hn : 0 < n) : + relaxationTime W ≤ logSobolevConstant W := by + apply csSup_le (full_ratios_nonempty W hn) + rintro r ⟨f, hf, rfl⟩ + let c := ∑ x, |f x| + have hnonneg (x : Spin n) : 0 ≤ f x + c := by + have hh : |f x| ≤ c := + Finset.single_le_sum (fun x _ => abs_nonneg (f x)) (Finset.mem_univ x) + linarith [neg_abs_le (f x)] + have hvar := variance_le_entropy_square W (fun x => f x + c) hnonneg + rw [variance_add_const] at hvar + have he := lt_of_lt_of_le hf hvar + have hratio : entropy W (fun x => (f x + c) ^ 2) / dirichlet W (fun x => f x + c) ≤ + logSobolevConstant W := le_csSup (entropy_ratios_bdd W hn) ⟨_, he, rfl⟩ + rw [dirichlet_add_const] at hratio + exact (div_le_div_of_nonneg_right hvar (dirichlet_nonneg W f)).trans hratio + +end EntropyFinite + +end CriticalSK +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/Equilibrium.lean b/lean/OAI/MathematicalPhysics/CriticalSK/Equilibrium.lean new file mode 100644 index 0000000000000000000000000000000000000000..db2292e18db5e4dd56b23d595136a3fdfa6f4d59 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/Equilibrium.lean @@ -0,0 +1,120 @@ +import OAI.MathematicalPhysics.CriticalSK.HeatBath +import OAI.MathematicalPhysics.CriticalSK.SmallBall + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +namespace CriticalSK + +open Set MeasureTheory Filter + +lemma continuousGoodMass_le_one {n : ℕ} (W : Disorder n) (t : ℝ) : continuousGoodMass W t ≤ 1 := by + rw [← gibbs_sum W] + apply Finset.sum_le_sum + intro x _ + split_ifs + · rfl + · exact gibbs_nonneg W x + +lemma discreteGoodMass_le_one {n : ℕ} (W : Disorder n) (k : ℕ) : discreteGoodMass W k ≤ 1 := by + rw [← gibbs_sum W] + apply Finset.sum_le_sum + intro x _ + split_ifs + · rfl + · exact gibbs_nonneg W x + +lemma continuous_bad_subset {n : ℕ} (hn : 0 < n) (t : ℝ) (ht : 0 ≤ t) + {a δ : ℝ} (ha : 0 < a) (_hδ : 0 < δ) (hinc : 2*t/a^2 < δ/8) : + {W : Disorder n | δ ≤ |continuousGoodMass W t-1|} ⊆ smallBallObstruction n a (δ/8) := by + intro W hW u hu + have hb := continuous_good_mass_bound W hn t ht u a ha + change 1-continuousGoodMass W t ≤ 4*(linearSmallBall W u a+(2*t*∑ i, (u i)^2)/a^2) at hb + rw [← EuclideanSpace.real_norm_sq_eq,hu,one_pow,mul_one] at hb + have he : |continuousGoodMass W t-1| = 1-continuousGoodMass W t := by + rw [abs_of_nonpos (sub_nonpos.mpr (continuousGoodMass_le_one W t))] + ring + simp only [Set.mem_ofPred_eq,he] at hW + linarith + +lemma discrete_bad_subset {n : ℕ} (hn : 0 < n) (k : ℕ) + {a δ : ℝ} (ha : 0 < a) (_hδ : 0 < δ) (hinc : ((2*k:ℝ)/n)/a^2 < δ/8) : + {W : Disorder n | δ ≤ |discreteGoodMass W k-1|} ⊆ smallBallObstruction n a (δ/8) := by + intro W hW u hu + have hb := discrete_good_mass_bound W hn k u a ha + change 1-discreteGoodMass W k ≤ 4*(linearSmallBall W u a+((2*k:ℝ)/n*∑ i, (u i)^2)/a^2) at hb + rw [← EuclideanSpace.real_norm_sq_eq,hu,one_pow,mul_one] at hb + have he : |discreteGoodMass W k-1| = 1-discreteGoodMass W k := by + rw [abs_of_nonpos (sub_nonpos.mpr (discreteGoodMass_le_one W k))] + ring + simp only [Set.mem_ofPred_eq,he] at hW + linarith + +lemma realized_continuous_initial_states (t : ℕ → ℝ) (ht : ∀ n, 0 ≤ t n) + (hscale : Tendsto (fun n => t n/(n:ℝ)^(2/3:ℝ)) atTop (𝓝 0)) + (δ : ℝ) (hδ : 0 < δ) : + Tendsto (fun n => (disorderLaw n).real {W | δ ≤ |continuousGoodMass W (t n)-1|}) atTop (𝓝 0) := by + apply (tendsto_add_atTop_iff_nat 4).mp + apply tendsto_order.mpr + constructor + · intro a ha + exact Filter.Eventually.of_forall (fun n => lt_of_lt_of_le ha measureReal_nonneg) + · intro α hα + obtain ⟨b,hb,hprob⟩ := natural_smallBall_tight (show 0 < δ/8 by positivity) hα + have hinc : Tendsto (fun n : ℕ => 2*t (n+4)/(b*(n+4:ℝ)^(1/3:ℝ))^2) atTop (𝓝 0) := by + have hh := (hscale.comp (tendsto_add_atTop_nat 4)).const_mul (2/b^2) + convert hh using 1 + · ext n + simp only [Function.comp_def,Nat.cast_add,Nat.cast_ofNat,mul_pow,third_power_square (by positivity : (0:ℝ) ≤ n+4)] + simp only [div_eq_mul_inv,mul_inv_rev] + ring + · ring_nf + filter_upwards [hprob,hinc.eventually (gt_mem_nhds (show 0 < δ/8 by positivity))] with n hn hi + exact lt_of_le_of_lt (measureReal_mono (continuous_bad_subset (by omega : 0 < n+4) + (t (n+4)) (ht _) (by positivity) hδ hi)) hn + +lemma realized_discrete_initial_states (k : ℕ → ℕ) + (hscale : Tendsto (fun n => (k n:ℝ)/(n:ℝ)^(5/3:ℝ)) atTop (𝓝 0)) + (δ : ℝ) (hδ : 0 < δ) : + Tendsto (fun n => (disorderLaw n).real {W | δ ≤ |discreteGoodMass W (k n)-1|}) atTop (𝓝 0) := by + apply (tendsto_add_atTop_iff_nat 4).mp + apply tendsto_order.mpr + constructor + · intro a ha + exact Filter.Eventually.of_forall (fun n => lt_of_lt_of_le ha measureReal_nonneg) + · intro α hα + obtain ⟨b,hb,hprob⟩ := natural_smallBall_tight (show 0 < δ/8 by positivity) hα + have hinc : Tendsto (fun n : ℕ => ((2*k (n+4):ℝ)/(n+4:ℝ))/(b*(n+4:ℝ)^(1/3:ℝ))^2) atTop (𝓝 0) := by + have hh := (hscale.comp (tendsto_add_atTop_nat 4)).const_mul (2/b^2) + convert hh using 1 + · ext n + simp only [Function.comp_def,Nat.cast_add,Nat.cast_ofNat,mul_pow, + third_power_square (by positivity : (0:ℝ) ≤ n+4), fifth_third_power (by positivity : (0:ℝ) < n+4)] + simp only [div_eq_mul_inv,mul_inv_rev] + ring + · ring_nf + filter_upwards [hprob,hinc.eventually (gt_mem_nhds (show 0 < δ/8 by positivity))] with n hn hi + exact lt_of_le_of_lt (measureReal_mono (discrete_bad_subset (by omega : 0 < n+4) + (k (n+4)) (by positivity) hδ (by simpa only [Nat.cast_add,Nat.cast_ofNat] using hi))) hn + +theorem realized_equilibrium_initial_states : + (∀ t : ℕ → ℝ, (∀ n, 0 ≤ t n) → + Tendsto (fun n => t n / (n : ℝ) ^ ((2 : ℝ) / 3)) atTop (𝓝 0) → + ∀ δ : ℝ, 0 < δ → + Tendsto (fun n => (disorderLaw n {W | + δ ≤ |continuousGoodMass W (t n) - 1|}).toReal) atTop (𝓝 0)) ∧ + (∀ k : ℕ → ℕ, + Tendsto (fun n => (k n : ℝ) / (n : ℝ) ^ ((5 : ℝ) / 3)) atTop (𝓝 0) → + ∀ δ : ℝ, 0 < δ → + Tendsto (fun n => (disorderLaw n {W | + δ ≤ |discreteGoodMass W (k n) - 1|}).toReal) atTop (𝓝 0)) := by + exact ⟨realized_continuous_initial_states,realized_discrete_initial_states⟩ + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/FunctionalMeasurability.lean b/lean/OAI/MathematicalPhysics/CriticalSK/FunctionalMeasurability.lean new file mode 100644 index 0000000000000000000000000000000000000000..5f80ca63f4e6d60ab3acae29f91fd78e9225b812 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/FunctionalMeasurability.lean @@ -0,0 +1,128 @@ +import OAI.MathematicalPhysics.CriticalSK.EntropyBounds + +namespace OAI + +noncomputable section +open scoped BigOperators Topology NNReal ENNReal +open MeasureTheory ProbabilityTheory Filter +namespace CriticalSK + +section FunctionalMeasurability +variable {n : ℕ} (W : Disorder n) + +lemma variance_pos_iff_nonconstant (f : Spin n → ℝ) : + 0 < variance W f ↔ ∃ x y, f x ≠ f y := by + constructor + · intro hf + by_contra! hconst + have he : f = fun _ => f (fun _ => false) := funext (fun x => hconst x _) + rw [he] at hf + simp [variance] at hf + · rintro ⟨x, y, hxy⟩ + by_contra h + have hv : variance W f = 0 := le_antisymm (le_of_not_gt h) (variance_nonneg_full W f) + have he (z : Spin n) : f z = mean W f := by + have hh : gibbs W z * (f z - mean W f) ^ 2 ≤ variance W f := + Finset.single_le_sum + (fun y _ => mul_nonneg (gibbs_nonneg W y) (sq_nonneg (f y - mean W f))) + (Finset.mem_univ z) + rw [hv] at hh + have heq := le_antisymm hh (mul_nonneg (gibbs_nonneg W z) (sq_nonneg (f z - mean W f))) + have hs := (mul_eq_zero.mp heq).resolve_left (gibbs_pos W z).ne' + exact sub_eq_zero.mp (sq_eq_zero_iff.mp hs) + exact hxy ((he x).trans (he y).symm) + +lemma dirichlet_pos_of_nonconstant (hn : 0 < n) (f : Spin n → ℝ) + (hf : ∃ x y, f x ≠ f y) : 0 < dirichlet W f := by + have hv := (variance_pos_iff_nonconstant W f).mpr hf + obtain ⟨C, hC, hgap⟩ := exists_finite_poincare W hn + by_contra h + have ht := mul_nonpos_of_nonneg_of_nonpos hC.le (le_of_not_gt h) + have hh := hgap f + linarith + +lemma entropy_square_pos_iff_nonconstant (f : Spin n → ℝ) : + 0 < entropy W (fun x => f x ^ 2) ↔ ∃ x y, f x ^ 2 ≠ f y ^ 2 := by + constructor + · intro hf + by_contra! hconst + have he : (fun x => f x ^ 2) = fun _ => f (fun _ => false) ^ 2 := + funext (fun x => hconst x _) + rw [he] at hf + simp [entropy, mean_const] at hf + · rintro ⟨x, y, hxy⟩ + have hxyabs : |f x| ≠ |f y| := by + intro he + apply hxy + have hh : |f x| ^ 2 = |f y| ^ 2 := congrArg (fun a : ℝ => a ^ 2) he + simpa only [sq_abs] using hh + have hv := (variance_pos_iff_nonconstant W (fun x => |f x|)).mpr ⟨x, y, hxyabs⟩ + have hh := variance_le_entropy_square W (fun x => |f x|) (fun x => abs_nonneg _) + simp only [sq_abs] at hh + exact hv.trans_le hh + +lemma relaxationTime_eq_iSup : relaxationTime W = + ⨆ f : {f : Spin n → ℝ // ∃ x y, f x ≠ f y}, variance W f.val / dirichlet W f.val := by + change sSup _ = sSup _ + congr 1 + ext r + constructor + · rintro ⟨f, hf, rfl⟩ + exact ⟨⟨f, (variance_pos_iff_nonconstant W f).mp hf⟩, rfl⟩ + · rintro ⟨f, rfl⟩ + exact ⟨f.val, (variance_pos_iff_nonconstant W f.val).mpr f.property, rfl⟩ + +lemma logSobolevConstant_eq_iSup : logSobolevConstant W = + ⨆ f : {f : Spin n → ℝ // ∃ x y, f x ^ 2 ≠ f y ^ 2}, + entropy W (fun x => f.val x ^ 2) / dirichlet W f.val := by + change sSup _ = sSup _ + congr 1 + ext r + constructor + · rintro ⟨f, hf, rfl⟩ + exact ⟨⟨f, (entropy_square_pos_iff_nonconstant W f).mp hf⟩, rfl⟩ + · rintro ⟨f, rfl⟩ + exact ⟨f.val, (entropy_square_pos_iff_nonconstant W f.val).mpr f.property, rfl⟩ + +end FunctionalMeasurability + +lemma entropy_continuous {n : ℕ} (g : Spin n → ℝ) : + Continuous (fun W : Disorder n => entropy W g) := + (mean_continuous (fun x => g x * Real.log (g x))).sub + (Real.continuous_mul_log.comp (mean_continuous g)) + +lemma relaxationTime_measurable {n : ℕ} (hn : 0 < n) : + Measurable (relaxationTime (n := n)) := by + apply LowerSemicontinuous.measurable + change LowerSemicontinuous (fun W : Disorder n => relaxationTime W) + simp_rw [relaxationTime_eq_iSup] + apply lowerSemicontinuous_ciSup + · intro W + apply (full_ratios_bdd W hn).mono + rintro r ⟨f, rfl⟩ + exact ⟨f.val, (variance_pos_iff_nonconstant W f.val).mpr f.property, rfl⟩ + · intro f + exact ((variance_continuous f.val).div (dirichlet_continuous f.val) + (fun W => (dirichlet_pos_of_nonconstant W hn f.val f.property).ne')).lowerSemicontinuous + +lemma logSobolevConstant_measurable {n : ℕ} (hn : 0 < n) : + Measurable (logSobolevConstant (n := n)) := by + apply LowerSemicontinuous.measurable + change LowerSemicontinuous (fun W : Disorder n => logSobolevConstant W) + simp_rw [logSobolevConstant_eq_iSup] + apply lowerSemicontinuous_ciSup + · intro W + apply (entropy_ratios_bdd W hn).mono + rintro r ⟨f, rfl⟩ + exact ⟨f.val, (entropy_square_pos_iff_nonconstant W f.val).mpr f.property, rfl⟩ + · intro f + have hf : ∃ x y, f.val x ≠ f.val y := by + obtain ⟨x, y, hxy⟩ := f.property + exact ⟨x, y, fun he => hxy (congrArg (fun a : ℝ => a ^ 2) he)⟩ + exact ((entropy_continuous (fun x => f.val x ^ 2)).div (dirichlet_continuous f.val) + (fun W => (dirichlet_pos_of_nonconstant W hn f.val hf).ne')).lowerSemicontinuous + +end CriticalSK +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/GOESpectrum.lean b/lean/OAI/MathematicalPhysics/CriticalSK/GOESpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..7a4804865c40f69407b6beb6b870c8abff8db2b2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/GOESpectrum.lean @@ -0,0 +1,471 @@ +import OAI.MathematicalPhysics.CriticalSK.GaussianMatrices +import OAI.MathematicalPhysics.CriticalSK.Resolvent + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open MeasureTheory ProbabilityTheory + +open scoped ENNReal NNReal + +open scoped BigOperators InnerProductSpace + +open Module + +open scoped BigOperators ENNReal NNReal Real Topology +open MeasureTheory ProbabilityTheory Filter +open scoped BigOperators NNReal +open scoped BigOperators +open Matrix Polynomial +open scoped BigOperators Topology +open Filter +namespace CriticalSK + +open scoped InnerProductSpace + +lemma symmetric_eigenvalue_norm_bound {E : Type*} [NormedAddCommGroup E] + [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] + (A B : E →L[ℝ] E) (hA : A.toLinearMap.IsSymmetric) (hB : B.toLinearMap.IsSymmetric) + {n : ℕ} (hn : finrank ℝ E = n) (i : Fin n) : + |hA.eigenvalues hn i - hB.eigenvalues hn i| ≤ ‖A-B‖ := by + refine eigenvalue_form_comparison hA hB hn (S := Set.univ) (Φ := fun _ => ‖A-B‖) + (by intro a ha b hb hab; dsimp; linarith) (by intro a ha b hb hab; dsimp; linarith) + (fun _ => Set.mem_univ _) (fun _ _ => Set.mem_univ _) ?_ i + intro x hx + calc + _ = |inner ℝ x ((A-B) x)| := by rw [_root_.sub_apply,inner_sub_right]; rfl + _ ≤ ‖x‖*‖(A-B) x‖ := abs_real_inner_le_norm _ _ + _ ≤ ‖x‖*(‖A-B‖*‖x‖) := mul_le_mul_of_nonneg_left ((A-B).le_opNorm x) (norm_nonneg _) + _ = _ := by rw [hx]; ring + +def gaussianMatrixCLM {n : ℕ} (A : GaussianMatrix (Fin n)) : + EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n) := + (Matrix.toLpLin 2 2 (fun i j => A i j)).toContinuousLinearMap + +def gaussianMatrixToCLM (n : ℕ) : GaussianMatrix (Fin n) →ₗ[ℝ] + (EuclideanSpace ℝ (Fin n) →L[ℝ] EuclideanSpace ℝ (Fin n)) where + toFun := gaussianMatrixCLM + map_add' A B := by + ext x i + change (∑ j, (A i j+B i j)*x j) = (∑ j, A i j*x j)+(∑ j, B i j*x j) + simp only [add_mul,Finset.sum_add_distrib] + map_smul' r A := by + ext x i + change (∑ j, (r*A i j)*x j) = r*(∑ j, A i j*x j) + simp only [mul_assoc,Finset.mul_sum] + +lemma finite_real_linear_continuous {D F : Type*} [NormedAddCommGroup D] [NormedSpace ℝ D] + [FiniteDimensional ℝ D] [NormedAddCommGroup F] [NormedSpace ℝ F] (T : D →ₗ[ℝ] F) : Continuous T := + T.continuous_of_finiteDimensional + +lemma gaussianMatrixCLM_continuous (n : ℕ) : Continuous (gaussianMatrixCLM (n := n)) := by + change Continuous (gaussianMatrixToCLM n) + exact finite_real_linear_continuous (gaussianMatrixToCLM n) + +lemma gaussianMatrixCLM_symmetric {n : ℕ} (A : GaussianMatrix (Fin n)) + (hA : ∀ i j, A i j = A j i) : (gaussianMatrixCLM A).toLinearMap.IsSymmetric := by + apply Matrix.isSymmetric_toEuclideanLin_iff.mpr + ext i j + exact hA j i + +lemma symmetrize_half_entry {n : ℕ} (A : GaussianMatrix (Fin n)) (i j : Fin n) : + symmetrizeGaussianMatrix (1/2:ℝ) A i j = (A i j + A j i)/2 := by + change (1/2:ℝ)*(A i j+A j i) = _ + ring + +lemma symmetrize_half_symmetric {n : ℕ} (A : GaussianMatrix (Fin n)) : + ∀ i j, symmetrizeGaussianMatrix (1/2:ℝ) A i j = symmetrizeGaussianMatrix (1/2:ℝ) A j i := by + intro i j + rw [symmetrize_half_entry,symmetrize_half_entry,add_comm] + +lemma symmetrize_half_eq {n : ℕ} (A : GaussianMatrix (Fin n)) (hA : ∀ i j, A i j = A j i) : + symmetrizeGaussianMatrix (1/2:ℝ) A = A := by + ext i j + rw [symmetrize_half_entry,hA j i] + ring + +def matrixOrderedEigenvalues {n : ℕ} (A : GaussianMatrix (Fin n)) : Fin n → ℝ := + (gaussianMatrixCLM_symmetric _ (symmetrize_half_symmetric A)).eigenvalues (by simp : finrank ℝ (EuclideanSpace ℝ (Fin n)) = n) + +lemma matrixOrderedEigenvalues_eq {n : ℕ} (A : GaussianMatrix (Fin n)) + (hA : ∀ i j, A i j = A j i) : + matrixOrderedEigenvalues A = (gaussianMatrixCLM_symmetric A hA).eigenvalues (by simp : finrank ℝ (EuclideanSpace ℝ (Fin n)) = n) := by + unfold matrixOrderedEigenvalues + congr 2 + exact congrArg gaussianMatrixCLM (symmetrize_half_eq A hA) + +lemma matrixOrderedEigenvalues_continuous {n : ℕ} (i : Fin n) : + Continuous (fun A : GaussianMatrix (Fin n) => matrixOrderedEigenvalues A i) := by + let F := fun A : GaussianMatrix (Fin n) => gaussianMatrixCLM (symmetrizeGaussianMatrix (1/2:ℝ) A) + have hc : Continuous F := (gaussianMatrixCLM_continuous n).comp (symmetrizeGaussianMatrix_continuous _) + rw [continuous_iff_continuousAt] + intro A + rw [Metric.continuousAt_iff] + intro ε hε + obtain ⟨δ,hδ,h⟩ := Metric.continuousAt_iff.mp hc.continuousAt ε hε + refine ⟨δ,hδ,fun B hB => ?_⟩ + have hh := symmetric_eigenvalue_norm_bound (F B) (F A) + (gaussianMatrixCLM_symmetric _ (symmetrize_half_symmetric B)) + (gaussianMatrixCLM_symmetric _ (symmetrize_half_symmetric A)) (by simp : finrank ℝ (EuclideanSpace ℝ (Fin n)) = n) i + exact (show dist (matrixOrderedEigenvalues B i) (matrixOrderedEigenvalues A i) ≤ dist (F B) (F A) by + simpa only [dist_eq_norm,Real.norm_eq_abs,matrixOrderedEigenvalues] using hh).trans_lt (h hB) + +lemma orthoMatrix_transpose {n : ℕ} + (U : EuclideanSpace ℝ (Fin n) ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n)) : + (orthoMatrix U).transpose = orthoMatrix U.symm := by + ext i j + have hh := U.inner_map_eq_flip (EuclideanSpace.basisFun (Fin n) ℝ i) + (EuclideanSpace.basisFun (Fin n) ℝ j) + simpa only [EuclideanSpace.inner_basisFun_real,EuclideanSpace.basisFun_inner, + orthoMatrix,Matrix.transpose_apply] using hh + +lemma orthoMatrix_toLpLin {n : ℕ} + (U : EuclideanSpace ℝ (Fin n) ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n)) : + Matrix.toLpLin 2 2 (orthoMatrix U) = U.toLinearEquiv.toLinearMap := by + ext x i + change (∑ j, U (EuclideanSpace.basisFun (Fin n) ℝ j) i * x j) = U x i + rw [euclidean_isometry_apply_eq_sum] + apply Finset.sum_congr rfl + intros + ring + +lemma gaussianMatrixCLM_conjugate {n : ℕ} + (U : EuclideanSpace ℝ (Fin n) ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n)) + (A : GaussianMatrix (Fin n)) : + (gaussianMatrixCLM (conjugateGaussianMatrix U A)).toLinearMap = + U.toLinearEquiv.conj (gaussianMatrixCLM A).toLinearMap := by + change Matrix.toLpLin 2 2 (matrixOfGaussian (conjugateGaussianMatrix U A)) = _ + rw [matrixOfGaussian_conjugate,Matrix.toLpLin_mul_same,Matrix.toLpLin_mul_same, + orthoMatrix_transpose,orthoMatrix_toLpLin,orthoMatrix_toLpLin] + rfl + +lemma matrixOrderedEigenvalues_conjugate {n : ℕ} + (U : EuclideanSpace ℝ (Fin n) ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n)) + (A : GaussianMatrix (Fin n)) (hA : ∀ i j, A i j = A j i) : + matrixOrderedEigenvalues (conjugateGaussianMatrix U A) = matrixOrderedEigenvalues A := by + rw [matrixOrderedEigenvalues_eq _ (conjugate_symmetric U A hA),matrixOrderedEigenvalues_eq _ hA] + apply (LinearMap.IsSymmetric.eigenvalues_eq_eigenvalues_iff _ _ _ _).mpr + rw [gaussianMatrixCLM_conjugate,LinearEquiv.charpoly_conj] + +lemma matrixOrderedEigenvalues_triReduce {n : ℕ} + (A : GaussianMatrix (Fin n)) (hA : ∀ i j, A i j = A j i) : + matrixOrderedEigenvalues (triReduce n A) = matrixOrderedEigenvalues A := by + rw [triReduce_conjugate n A hA] + exact matrixOrderedEigenvalues_conjugate _ _ hA + +lemma matrixOrderedEigenvalues_sample (n : ℕ) (ω : TriSample n) : + matrixOrderedEigenvalues (WithLp.toLp 2 (fun i => WithLp.toLp 2 (fun j => triSampleMatrix n ω i j))) = + sampleEigenvalues n ω := by + have hA : ∀ i j, triSampleMatrix n ω i j = triSampleMatrix n ω j i := by + intro i j + have hh := congrArg (fun M : Matrix (Fin (n+1)) (Fin (n+1)) ℝ => M i j) (triSampleMatrix_hermitian n ω) + simpa only [Matrix.conjTranspose_apply,star_trivial] using hh.symm + rw [matrixOrderedEigenvalues_eq _ hA] + rfl + +def triEntriesLaw (n : ℕ) (s : ℝ) : Measure (Fin n → ℝ × ℝ) := + Measure.pi fun i => (gaussianReal 0 (4*s^2).toNNReal).prod (columnNormLaw (n-i.val-1) s) + +instance triEntriesLaw_probability (n : ℕ) (s : ℝ) : IsProbabilityMeasure (triEntriesLaw n s) := by + unfold triEntriesLaw; infer_instance + +def triEntriesMatrix : (n : ℕ) → (Fin n → ℝ × ℝ) → GaussianMatrix (Fin n) + | 0, _ => 0 + | n+1, p => assembleTri n ((p 0).1, (p 0).2, triEntriesMatrix n (fun i => p i.succ)) + +lemma triEntriesMatrix_measurable (n : ℕ) : Measurable (triEntriesMatrix n) := by + induction n with + | zero => exact measurable_const + | succ n ih => + exact (assembleTri_measurable n).comp + (((measurable_pi_apply (0 : Fin (n+1))).fst).prodMk + (((measurable_pi_apply (0 : Fin (n+1))).snd).prodMk + (ih.comp (Measurable.of_eval (fun i => measurable_pi_apply i.succ))))) + +lemma triEntriesLaw_split (n : ℕ) (s : ℝ) : + MeasurePreserving (fun p : Fin (n+1) → ℝ × ℝ => (p 0, fun i : Fin n => p i.succ)) + (triEntriesLaw (n+1) s) + (((gaussianReal 0 (4*s^2).toNNReal).prod (columnNormLaw n s)).prod (triEntriesLaw n s)) := by + convert measurePreserving_piFinSuccAbove + (fun i : Fin (n+1) => (gaussianReal 0 (4*s^2).toNNReal).prod (columnNormLaw (n+1-i.val-1) s)) 0 using 1 + · rfl + · rfl + · simp only [Fin.val_zero,Nat.sub_zero,Nat.add_sub_cancel_right,triEntriesLaw, + Fin.succAbove_zero,Fin.val_succ,Nat.add_sub_add_right] + +lemma probability_eq_on_subsingleton {Ω : Type*} [MeasurableSpace Ω] [Subsingleton Ω] + (μ ν : Measure Ω) [IsProbabilityMeasure μ] [IsProbabilityMeasure ν] : μ=ν := by + apply Measure.ext + intro t _ + by_cases ht : t.Nonempty + · obtain ⟨x,hx⟩ := ht + have he : t=Set.univ := Set.eq_univ_of_forall (fun y => by simpa only [Subsingleton.elim y x] using hx) + simp only [he,measure_univ] + · simp only [Set.not_nonempty_iff_eq_empty.mp ht,measure_empty] + +lemma triEntriesMatrix_preserving (n : ℕ) (s : ℝ) : + MeasurePreserving (triEntriesMatrix n) (triEntriesLaw n s) (triMatrixLaw n s) := by + induction n with + | zero => + refine ⟨triEntriesMatrix_measurable 0,?_⟩ + exact probability_eq_on_subsingleton _ _ + | succ n ih => + have hp := (MeasurePreserving.id ((gaussianReal 0 (4*s^2).toNNReal).prod (columnNormLaw n s))).prod ih + have ha := measurePreserving_prodAssoc (gaussianReal 0 (4*s^2).toNNReal) + (columnNormLaw n s) (triMatrixLaw n s) + have hb : MeasurePreserving (assembleTri n) + ((gaussianReal 0 (4*s^2).toNNReal).prod ((columnNormLaw n s).prod (triMatrixLaw n s))) + (triMatrixLaw (n+1) s) := ⟨assembleTri_measurable n,rfl⟩ + exact hb.comp (ha.comp (hp.comp (triEntriesLaw_split n s))) + +lemma triEntriesMatrix_apply (n : ℕ) (p : Fin n → ℝ × ℝ) (i j : Fin n) : + triEntriesMatrix n p i j = + (if i=j then (p i).1 else 0)+(if i.val+1=j.val then (p i).2 else 0)+ + (if j.val+1=i.val then (p j).2 else 0) := by + induction n with + | zero => exact Fin.elim0 i + | succ n ih => + cases i using Fin.cases with + | zero => + cases j using Fin.cases with + | zero => simp [triEntriesMatrix,assembleTri,borderMatrix_zero_zero] + | succ j => + rw [triEntriesMatrix,assembleTri,borderMatrix_zero_succ] + have he : (1=j.val+1) ↔ (j.val=0) := by omega + have hn : ¬(j.val+1+1=0) := by omega + simp only [Ne.symm (Fin.succ_ne_zero j),Fin.val_zero,Fin.val_succ,hn,ite_false, + zero_add,add_zero,he] + change (p 0).2*(if j.val=0 then 1 else 0) = _ + split_ifs <;> simp only [mul_one,mul_zero] + | succ i => + cases j using Fin.cases with + | zero => + rw [triEntriesMatrix,assembleTri,borderMatrix_succ_zero] + have he : (1=i.val+1) ↔ (i.val=0) := by omega + have hn : ¬(i.val+1+1=0) := by omega + simp only [Fin.succ_ne_zero i,Fin.val_zero,Fin.val_succ,hn,ite_false, + zero_add,add_zero,he] + change (p 0).2*(if i.val=0 then 1 else 0) = _ + split_ifs <;> simp only [mul_one,mul_zero] + | succ j => + simpa only [triEntriesMatrix,assembleTri,borderMatrix_succ_succ,Fin.succ_inj, + Fin.val_succ,Nat.add_right_cancel_iff] using ih (fun k => p k.succ) i j + +def goeScale (n : ℕ) : ℝ := (Real.sqrt (2*(n+1:ℝ)))⁻¹ + +lemma goeScale_square (n : ℕ) : 2*(goeScale n)^2 = (n+1:ℝ)⁻¹ := by + have hn : (0:ℝ) < n+1 := by positivity + unfold goeScale + rw [inv_pow,Real.sq_sqrt (by positivity)] + field_simp + +lemma goeScale_diagonal (n : ℕ) : 4*(goeScale n)^2 = 2/(n+1:ℝ) := by + have := goeScale_square n + rw [div_eq_mul_inv] + nlinarith + +lemma gaussian_div_sqrt_preserving (n : ℕ) : + MeasurePreserving (fun x : ℝ => x/Real.sqrt (n+1:ℝ)) (gaussianReal 0 1) + (gaussianReal 0 (2*(goeScale n)^2).toNNReal) := by + refine ⟨by fun_prop,?_⟩ + rw [gaussianReal_map_div_const,zero_div,goeScale_square] + congr 1 + apply NNReal.coe_injective + simp only [NNReal.coe_div,NNReal.coe_one,NNReal.coe_mk,Real.coe_toNNReal _ (by positivity : 0 ≤ (n+1:ℝ)⁻¹)] + rw [Real.sq_sqrt (by positivity),one_div] + +lemma chi_eq_norm (m : ℕ) (x : Fin m → ℝ) : + chi m x = ‖(WithLp.toLp 2 x : EuclideanSpace ℝ (Fin m))‖ := by + rw [EuclideanSpace.norm_eq] + simp only [chi,chiSquare,Real.norm_eq_abs,sq_abs] + +lemma columnNormLaw_scale (n m : ℕ) : + columnNormLaw m (goeScale n) = + (standardGaussianProduct m).map (fun x => chi m x/Real.sqrt (n+1:ℝ)) := by + have hp := measurePreserving_pi (fun _ : Fin m => gaussianReal 0 1) + (fun _ : Fin m => gaussianReal 0 (2*(goeScale n)^2).toNNReal) + (fun _ => gaussian_div_sqrt_preserving n) + have hh := (columnNorm_preserving m (goeScale n)).comp hp + have he : (fun x : Fin m → ℝ => ‖(WithLp.toLp 2 (fun i => x i/Real.sqrt (n+1:ℝ)) : EuclideanSpace ℝ (Fin m))‖) = + (fun x => chi m x/Real.sqrt (n+1:ℝ)) := by + funext x + have hv : (WithLp.toLp 2 (fun i => x i/Real.sqrt (n+1:ℝ)) : EuclideanSpace ℝ (Fin m)) = + (Real.sqrt (n+1:ℝ))⁻¹ • WithLp.toLp 2 x := by ext i; simp [div_eq_mul_inv,mul_comm] + rw [hv,norm_smul,Real.norm_eq_abs,abs_of_nonneg (by positivity),← chi_eq_norm] + ring + have hmap := hh.map_eq + change (standardGaussianProduct m).map (fun x : Fin m → ℝ => + ‖(WithLp.toLp 2 (fun i => x i/Real.sqrt (n+1:ℝ)) : EuclideanSpace ℝ (Fin m))‖) = _ at hmap + rw [he] at hmap + exact hmap.symm + +lemma columnNormLaw_zero (s : ℝ) : columnNormLaw 0 s = Measure.dirac 0 := by + unfold columnNormLaw + have he : (fun v : Fin 0 → ℝ => ‖(WithLp.toLp 2 v : EuclideanSpace ℝ (Fin 0))‖) = fun _ => (0:ℝ) := by + funext v + rw [show (WithLp.toLp 2 v : EuclideanSpace ℝ (Fin 0)) = 0 from Subsingleton.elim _ _,norm_zero] + rw [he,Measure.map_const,measure_univ,one_smul] + +lemma measurePreserving_independent {ι Ω : Type*} [Fintype ι] [MeasurableSpace Ω] + {β : ι → Type*} [∀ i, MeasurableSpace (β i)] (μ : Measure Ω) (ν : ∀ i, Measure (β i)) + (f : ∀ i, Ω → β i) (hf : ∀ i, MeasurePreserving (f i) μ (ν i)) (hi : iIndepFun f μ) : + MeasurePreserving (fun ω i => f i ω) μ (Measure.pi ν) := by + refine ⟨Measurable.of_eval (fun i => (hf i).measurable),?_⟩ + rw [hi.map_fun_eq_pi_map (fun i => (hf i).aemeasurable)] + congr 1 + funext i + exact (hf i).map_eq + +lemma diagonalMarginal_scale (n i : ℕ) : + diagonalMarginal n i = gaussianReal 0 (4*(goeScale n)^2).toNNReal := by + rw [goeScale_diagonal] + unfold diagonalMarginal + congr 1 + apply NNReal.coe_injective + rw [Real.coe_toNNReal _ (by positivity : 0 ≤ 2/(n+1:ℝ))] + rfl + +lemma diagonalFinite_preserving (n : ℕ) : + MeasurePreserving (fun a : ℕ → ℝ => fun i : Fin (n+1) => a i.val) + (diagonalLaw n) (Measure.pi fun _ => gaussianReal 0 (4*(goeScale n)^2).toNNReal) := by + have hi : iIndepFun (fun i : ℕ => fun a : ℕ → ℝ => a i) (diagonalLaw n) := + iIndepFun_infinitePi (fun _ => measurable_id) + exact measurePreserving_independent _ _ _ + (fun i => by simpa only [diagonalLaw,diagonalMarginal_scale] using measurePreserving_eval_infinitePi (diagonalMarginal n) i.val) + (hi.precomp Fin.val_injective) + +def finiteChiEntry (n i : ℕ) (x : Fin (chiRowDim n i) → ℝ) : ℝ := + if i if i fun i : Fin (n+1) => finiteChiEntry n i.val (a i.val)) + (chiRowLaw n) (Measure.pi fun i => columnNormLaw (n-i.val) (goeScale n)) := by + have hi : iIndepFun (fun i : ℕ => fun a : ChiRows n => finiteChiEntry n i (a i)) (chiRowLaw n) := + iIndepFun_infinitePi (fun i => finiteChiEntry_measurable n i) + exact measurePreserving_independent _ _ _ + (fun i => (finiteChiEntry_preserving n i.val).comp + (measurePreserving_eval_infinitePi (fun i => standardGaussianProduct (chiRowDim n i)) i.val)) + (hi.precomp Fin.val_injective) + +def sampleEntries (n : ℕ) (ω : TriSample n) (i : Fin (n+1)) : ℝ × ℝ := + (ω.1 i.val, finiteChiEntry n i.val (ω.2 i.val)) + +lemma sampleEntries_preserving (n : ℕ) : + MeasurePreserving (sampleEntries n) (triLaw n) (triEntriesLaw (n+1) (goeScale n)) := by + have hp := (diagonalFinite_preserving n).prod (chiFinite_preserving n) + have he := (measurePreserving_arrowProdEquivProdArrow ℝ ℝ (Fin (n+1)) + (fun _ => gaussianReal 0 (4*(goeScale n)^2).toNNReal) + (fun i => columnNormLaw (n-i.val) (goeScale n))).symm + convert he.comp hp using 1 + · rfl + · rfl + · unfold triEntriesLaw + congr 1 + funext i + congr 2 + omega + +lemma sampleEntriesMatrix_apply (n : ℕ) (ω : TriSample n) (i j : Fin (n+1)) : + triEntriesMatrix (n+1) (sampleEntries n ω) i j = triSampleMatrix n ω i j := by + rw [triEntriesMatrix_apply] + simp only [sampleEntries,triSampleMatrix,finiteChiEntry] + congr 1 + · congr 1 + split_ifs with he hi + · rfl + · omega + · rfl + · split_ifs with he hi + · rfl + · omega + · rfl + +lemma sampleMatrix_preserving (n : ℕ) : + MeasurePreserving (fun ω : TriSample n => WithLp.toLp 2 + (fun i => WithLp.toLp 2 (fun j => triSampleMatrix n ω i j))) + (triLaw n) (triMatrixLaw (n+1) (goeScale n)) := by + have hh := (triEntriesMatrix_preserving (n+1) (goeScale n)).comp (sampleEntries_preserving n) + convert hh using 1 + funext ω + ext i j + exact (sampleEntriesMatrix_apply n ω i j).symm + +lemma matrixOrderedEigenvalues_measurable (n : ℕ) : + Measurable (matrixOrderedEigenvalues (n := n)) := + Measurable.of_eval (fun i => (matrixOrderedEigenvalues_continuous i).measurable) + +lemma goe_sample_eigenvalues_law (n : ℕ) : + (goeLaw (Fin (n+1)) (goeScale n)).map matrixOrderedEigenvalues = + (triLaw n).map (sampleEigenvalues n) := by + have hT : (triMatrixLaw (n+1) (goeScale n)).map matrixOrderedEigenvalues = + (goeLaw (Fin (n+1)) (goeScale n)).map matrixOrderedEigenvalues := by + rw [← (triReduce_preserving (n+1) (goeScale n)).map_eq, + Measure.map_map (matrixOrderedEigenvalues_measurable _) (triReduce_measurable _)] + apply Measure.map_congr + filter_upwards [goe_symmetric_ae (ι := Fin (n+1)) (goeScale n)] with A hA + exact matrixOrderedEigenvalues_triReduce A hA + rw [← hT,← (sampleMatrix_preserving n).map_eq, + Measure.map_map (matrixOrderedEigenvalues_measurable _) (sampleMatrix_preserving n).measurable] + congr 1 + funext ω + exact matrixOrderedEigenvalues_sample n ω + +def spectralGood (n : ℕ) (h s : ℝ) : Set (Fin (n+1) → ℝ) := + {lam | ∀ i, |lam i-(2-orderedJacobiGaps n i)| ≤ + edgeError (formA n h) (formB n) (formC n) s (orderedJacobiGaps n i)} + +lemma spectralGood_measurable (n : ℕ) (h s : ℝ) : MeasurableSet (spectralGood n h s) := by + simp only [spectralGood,Set.ofPred_forall] + apply MeasurableSet.iInter + intro i + exact measurableSet_le ((measurable_pi_apply i).sub_const _).abs measurable_const + +lemma sampleEigenvalues_measurable (n : ℕ) : Measurable (sampleEigenvalues n) := by + have hc := (matrixOrderedEigenvalues_measurable (n+1)).comp (sampleMatrix_preserving n).measurable + simpa only [Function.comp_def,matrixOrderedEigenvalues_sample] using hc + +lemma goe_spectral_bad_probability (n : ℕ) {h s : ℝ} (hh : 0 ≤ h) (hs : 0 < s) + (hscale : scaleEnergy (Nat.clog 8 (n+1)) 0 ≤ s) + (hsmall : formA n h*(3/8:ℝ)*s^(-5/8:ℝ)+formC n ≤ 1) : + (goeLaw (Fin (n+1)) (goeScale n)).real + (matrixOrderedEigenvalues ⁻¹' (spectralGood n h s)ᶜ) ≤ 32*Real.exp (-h^2) := by + have he := congrArg (fun μ : Measure (Fin (n+1) → ℝ) => μ.real (spectralGood n h s)ᶜ) + (goe_sample_eigenvalues_law n) + simp only [Measure.real,Measure.map_apply (matrixOrderedEigenvalues_measurable _) + (spectralGood_measurable n h s).compl,Measure.map_apply (sampleEigenvalues_measurable n) + (spectralGood_measurable n h s).compl] at he + rw [show (goeLaw (Fin (n+1)) (goeScale n)).real + (matrixOrderedEigenvalues ⁻¹' (spectralGood n h s)ᶜ) = + (triLaw n).real (sampleEigenvalues n ⁻¹' (spectralGood n h s)ᶜ) from he] + apply (measureReal_mono ?_).trans (triBad_probability n h) + intro ω hω + by_contra hn + exact hω (triSample_eigenvalue_good n hh hs hscale hsmall hn) + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/GapMixing.lean b/lean/OAI/MathematicalPhysics/CriticalSK/GapMixing.lean new file mode 100644 index 0000000000000000000000000000000000000000..a2c494abe5c0ac94d3d3328e4a8021acf301a1cb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/GapMixing.lean @@ -0,0 +1,527 @@ +import OAI.MathematicalPhysics.CriticalSK.HeatBath + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open scoped BigOperators Topology + +open scoped BigOperators Topology InnerProductSpace +open scoped BigOperators Topology +namespace CriticalSK + + +section + +open Set Filter MeasureTheory + +variable {n : ℕ} (W V : Disorder n) + +lemma mean_square_center_identity (f : Spin n → ℝ) (c : ℝ) : + mean W (fun x => (f x-c)^2) = variance W f+(mean W f-c)^2 := by + have hs : mean W (fun x => (f x-c)^2) = mean W (fun x => f x^2)-2*c*mean W f+c^2 := by + have he : (fun x => (f x-c)^2) = (fun x => f x^2-(2*c)*f x+c^2) := by funext x; ring + rw [he,mean_add,mean_sub,mean_const_mul,mean_const] + have hv : variance W f = mean W (fun x => f x^2)-(mean W f)^2 := by + unfold variance + have he : (fun x => (f x-mean W f)^2) = (fun x => f x^2-(2*mean W f)*f x+(mean W f)^2) := by funext x; ring + rw [he,mean_add,mean_sub,mean_const_mul,mean_const] + ring + rw [hs,hv] + ring + +lemma mean_least_squares (f : Spin n → ℝ) (c : ℝ) : + variance W f ≤ mean W (fun x => (f x-c)^2) := by + rw [mean_square_center_identity] + exact le_add_of_nonneg_right (sq_nonneg _) + +lemma mean_density_upper {M : ℝ} (hM : ∀ x, gibbs W x ≤ M*gibbs V x) + (f : Spin n → ℝ) (hf : ∀ x, 0 ≤ f x) : mean W f ≤ M*mean V f := by + unfold mean + rw [Finset.mul_sum] + apply Finset.sum_le_sum + intro x _ + nlinarith [mul_le_mul_of_nonneg_right (hM x) (hf x)] + +lemma variance_density_upper {M : ℝ} (hM : ∀ x, gibbs W x ≤ M*gibbs V x) + (f : Spin n → ℝ) : variance W f ≤ M*variance V f := + (mean_least_squares W f (mean V f)).trans (mean_density_upper W V hM _ (fun _ => sq_nonneg _)) + +lemma dirichlet_density_lower {m : ℝ} (hm : 0 ≤ m) (hden : ∀ x, m*gibbs V x ≤ gibbs W x) + (f : Spin n → ℝ) : m*dirichlet V f ≤ dirichlet W f := by + unfold dirichlet + rw [Finset.mul_sum] + apply Finset.sum_le_sum + intro i _ + change m*mean V (fun x => (f x-siteAverage V i f x)^2) ≤ mean W (fun x => (f x-siteAverage W i f x)^2) + have hh := siteAverage_least_squares V i f (siteAverage W i f) (fun x y h => (siteAverage_fiber_constant W i f h).symm) + refine (mul_le_mul_of_nonneg_left hh hm).trans ?_ + unfold mean + rw [Finset.mul_sum] + apply Finset.sum_le_sum + intro x _ + nlinarith [mul_le_mul_of_nonneg_right (hden x) (sq_nonneg (f x-siteAverage W i f x))] + +lemma poincare_density_comparison {m M C : ℝ} (hm : 0 < m) (hM : 0 ≤ M) (hC : 0 ≤ C) + (hlower : ∀ x, m*gibbs V x ≤ gibbs W x) (hupper : ∀ x, gibbs W x ≤ M*gibbs V x) + (hgap : ∀ f : Spin n → ℝ, variance V f ≤ C*dirichlet V f) (f : Spin n → ℝ) : + variance W f ≤ (M/m*C)*dirichlet W f := by + have hu := (variance_density_upper W V hupper f).trans (mul_le_mul_of_nonneg_left (hgap f) hM) + have hl := dirichlet_density_lower W V hm.le hlower f + have hh := mul_le_mul_of_nonneg_left hl (mul_nonneg hM hC) + have he : (M/m*C)*dirichlet W f = (M*C*dirichlet W f)/m := by ring + rw [he] + apply (le_div_iff₀ hm).mpr + have ht := mul_le_mul_of_nonneg_right hu hm.le + nlinarith only [hh,ht] + +lemma hamiltonian_scale (β : ℝ) (x : Spin n) : hamiltonian (β • W) x = β*hamiltonian W x := by + simp only [hamiltonian,Pi.smul_apply,smul_eq_mul,Finset.mul_sum] + apply Finset.sum_congr rfl + intro e _ + ring + +lemma gibbs_scale_ratio (β : ℝ) (x : Spin n) : gibbs W x = + (partition (β • W)/partition W)*Real.exp ((1-β)*hamiltonian W x)*gibbs (β • W) x := by + rw [gibbs,gibbs,hamiltonian_scale] + have he : Real.exp ((1-β)*hamiltonian W x)*Real.exp (β*hamiltonian W x) = Real.exp (hamiltonian W x) := by + rw [← Real.exp_add] + congr 1 + ring + field_simp [ne_of_gt (partition_pos W),ne_of_gt (partition_pos (β • W))] + nlinarith only [he] + +lemma poincare_temperature_comparison {β R C : ℝ} (hβ : β ≤ 1) (hC : 0 ≤ C) + (hH : ∀ x, |hamiltonian W x| ≤ R) + (hgap : ∀ f : Spin n → ℝ, variance (β • W) f ≤ C*dirichlet (β • W) f) (f : Spin n → ℝ) : + variance W f ≤ (C*Real.exp (2*(1-β)*R))*dirichlet W f := by + let z := partition (β • W)/partition W + have hz : 0 < z := div_pos (partition_pos _) (partition_pos _) + let m := z*Real.exp (-(1-β)*R) + let M := z*Real.exp ((1-β)*R) + have hm : 0 < m := mul_pos hz (Real.exp_pos _) + have hM : 0 ≤ M := (mul_pos hz (Real.exp_pos _)).le + have hl (x : Spin n) : m*gibbs (β • W) x ≤ gibbs W x := by + rw [gibbs_scale_ratio W β x] + apply mul_le_mul_of_nonneg_right _ (gibbs_nonneg _ _) + apply mul_le_mul_of_nonneg_left _ hz.le + apply Real.exp_le_exp.mpr + have ht := mul_le_mul_of_nonneg_left (abs_le.mp (hH x)).1 (sub_nonneg.mpr hβ) + nlinarith only [ht] + have hu (x : Spin n) : gibbs W x ≤ M*gibbs (β • W) x := by + rw [gibbs_scale_ratio W β x] + apply mul_le_mul_of_nonneg_right _ (gibbs_nonneg _ _) + exact mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left (abs_le.mp (hH x)).2 (sub_nonneg.mpr hβ))) hz.le + have hh := poincare_density_comparison W (β • W) hm hM hC hl hu hgap f + have he : M/m*C = C*Real.exp (2*(1-β)*R) := by + dsimp [M,m] + rw [mul_div_mul_left _ _ hz.ne',← Real.exp_sub] + rw [mul_comm] + congr 2 + ring + rwa [he] at hh + +end + +section + +open Set Filter MeasureTheory + +variable {n : ℕ} (W : Disorder n) + +lemma mean_kernel (K : Matrix (Spin n) (Spin n) ℝ) + (hstat : ∀ y, ∑ x, gibbs W x*K x y = gibbs W y) (f : Spin n → ℝ) : mean W (K.mulVec f) = mean W f := by + unfold mean Matrix.mulVec dotProduct + simp only [Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro y _ + simp_rw [← mul_assoc,← Finset.sum_mul,hstat] + +lemma discreteKernel_quadratic_eq (f : Spin n → ℝ) : + mean W (fun x => f x*(discreteKernel W).mulVec f x) = + (n:ℝ)⁻¹*∑ i : Fin n, mean W (fun x => (siteAverage W i f x)^2) := by + simp_rw [discreteKernel_average,mul_left_comm (f _),Finset.mul_sum,mean_sum,mean_const_mul,siteAverage_self_square] + +lemma discreteKernel_square_le (hn : 0 ((discreteKernel W).mulVec f x)^2) ≤ + mean W (fun x => f x^2)-dirichlet W f/n := by + have hnpos : (0:ℝ) (1:ℝ)) (fun i => siteAverage W i f x) + simp only [one_mul,one_pow,Finset.sum_const,Finset.card_univ,Fintype.card_fin,nsmul_eq_mul,mul_one] at hh + rw [discreteKernel_average,← div_eq_inv_mul,div_pow,← div_eq_inv_mul] + apply (div_le_div_iff₀ (sq_pos_of_pos hnpos) hnpos).mpr + nlinarith [mul_le_mul_of_nonneg_right hh hnpos.le] + have hm := mean_mono W hp + rw [mean_const_mul,mean_sum,← discreteKernel_quadratic_eq] at hm + have hd := dirichlet_discrete W hn f + have he : mean W (fun x => f x*(f x-(discreteKernel W).mulVec f x)) = + mean W (fun x => f x^2)-mean W (fun x => f x*(discreteKernel W).mulVec f x) := by + rw [← mean_sub] + congr 1 + funext x + ring + rw [he] at hd + linarith + +lemma gap_factor_nonneg (hn : 0 ((discreteKernel W).mulVec f x)^2) ≤ + (1-1/((n:ℝ)*C))*mean W (fun x => f x^2) := by + have hg := hgap f + simp only [variance,hf,sub_zero] at hg + have hnpos : (0:ℝ) f x^2)/((n:ℝ)*C) ≤ dirichlet W f/n := by + apply (div_le_div_iff₀ (mul_pos hnpos hC) hnpos).mpr + nlinarith [mul_le_mul_of_nonneg_right hg hnpos.le] + have hs := discreteKernel_square_le W hn f + have he : (1-1/((n:ℝ)*C))*mean W (fun x => f x^2) = mean W (fun x => f x^2)-mean W (fun x => f x^2)/((n:ℝ)*C) := by ring + rw [he] + linarith + +lemma gap_square_pow (hn : 0 ((discreteKernel W^k).mulVec f x)^2) ≤ + (1-1/((n:ℝ)*C))^k*mean W (fun x => f x^2) := by + induction k with + | zero => simp only [pow_zero,Matrix.one_mulVec,one_mul,le_refl] + | succ k ih => + have hzero : mean W ((discreteKernel W^k).mulVec f)=0 := by rw [mean_kernel W _ (kernel_pow_stationary (discreteKernel_stationary W hn) k),hf] + have hs := gap_square_step W hn (lt_of_lt_of_le zero_lt_one hC) hgap _ hzero + rw [pow_succ',← Matrix.mulVec_mulVec] + refine hs.trans ?_ + rw [pow_succ'] + exact (mul_le_mul_of_nonneg_left ih (gap_factor_nonneg hn hC)).trans_eq (mul_assoc _ _ _).symm + +lemma gap_square_exponential (hn : 0 ((discreteKernel W^k).mulVec f x)^2) ≤ + Real.exp (-(k:ℝ)/((n:ℝ)*C))*mean W (fun x => f x^2) := by + refine (gap_square_pow W hn hC hgap f hf k).trans ?_ + apply mul_le_mul_of_nonneg_right _ (mean_nonneg W (fun _ => sq_nonneg _)) + have he : 1-1/((n:ℝ)*C) ≤ Real.exp (-1/((n:ℝ)*C)) := by + simpa only [neg_div,sub_eq_add_neg,add_comm] using Real.add_one_le_exp (-1/((n:ℝ)*C)) + have hh := pow_le_pow_left₀ (gap_factor_nonneg hn hC) he k + rw [← Real.exp_nat_mul] at hh + convert hh using 1 + congr 1 + ring + +end + + +section + +open Set Filter MeasureTheory + +variable {n : ℕ} (W : Disorder n) + +lemma kernel_pow_reversible {ι : Type*} [Fintype ι] [DecidableEq ι] + {K : Matrix ι ι ℝ} {μ : ι → ℝ} (h : ∀ x y, μ x*K x y=μ y*K y x) + (k : ℕ) (x y : ι) : μ x*(K^k) x y=μ y*(K^k) y x := by + induction k generalizing x y with + | zero => simp only [pow_zero,Matrix.one_apply]; split_ifs with he <;> simp_all + | succ k ih => + rw [pow_succ,Matrix.mul_apply,Finset.mul_sum] + calc + _ = ∑ z, μ y*K y z*(K^k) z x := by + apply Finset.sum_congr rfl + intro z _ + rw [← mul_assoc,ih,mul_assoc,mul_left_comm, h z y] + ring + _ = μ y*(K^(k+1)) y x := by rw [pow_succ',Matrix.mul_apply,Finset.mul_sum]; ring_nf + +lemma mean_abs_square_le (f : Spin n → ℝ) : (mean W (fun x => |f x|))^2 ≤ mean W (fun x => f x^2) := by + have hh := Finset.sum_mul_sq_le_sq_mul_sq Finset.univ (fun x => Real.sqrt (gibbs W x)) (fun x => Real.sqrt (gibbs W x)*|f x|) + simp only [mul_pow,Real.sq_sqrt (gibbs_nonneg W _),sq_abs,gibbs_sum,one_mul] at hh + have he : (∑ x : Spin n, Real.sqrt (gibbs W x)*(Real.sqrt (gibbs W x)*|f x|)) = mean W (fun x => |f x|) := by + unfold mean + apply Finset.sum_congr rfl + intro x _ + rw [← mul_assoc,Real.mul_self_sqrt (gibbs_nonneg W _)] + rw [he] at hh + exact hh + +def centeredPointDensity (x : Spin n) : Spin n → ℝ := fun y => (if y=x then (gibbs W x)⁻¹ else 0)-1 + +lemma centeredPointDensity_mean (x : Spin n) : mean W (centeredPointDensity W x)=0 := by + change mean W (fun y => (if y=x then (gibbs W x)⁻¹ else 0)-1)=0 + rw [mean_sub,mean_const] + unfold mean + simp only [mul_ite,mul_zero,Finset.sum_ite_eq',Finset.mem_univ,ite_true] + rw [mul_inv_cancel₀ (gibbs_pos W x).ne',sub_self] + +lemma centeredPointDensity_square (x : Spin n) : mean W (fun y => centeredPointDensity W x y ^ 2) = (gibbs W x)⁻¹-1 := by + have hid (y : Spin n) : centeredPointDensity W x y ^2 = (if y=x then (gibbs W x)⁻¹^2-2*(gibbs W x)⁻¹ else 0)+1 := by + unfold centeredPointDensity + split_ifs <;> ring + simp_rw [hid] + rw [mean_add,mean_const] + unfold mean + simp only [mul_ite,mul_zero,Finset.sum_ite_eq',Finset.mem_univ,ite_true] + field_simp [(gibbs_pos W x).ne'] + ring + +lemma centeredPointDensity_kernel (hn : 0 |(discreteKernel W^k).mulVec (centeredPointDensity W x) y|) := by + unfold discreteDistance totalVariation mean + congr 1 + apply Finset.sum_congr rfl + intro y _ + change |(discreteKernel W^k) x y-gibbs W y|=gibbs W y*|(discreteKernel W^k).mulVec (centeredPointDensity W x) y| + rw [centeredPointDensity_kernel W hn] + symm + calc + _ = |gibbs W y| *|(discreteKernel W^k) x y/gibbs W y-1| := by rw [abs_of_nonneg (gibbs_nonneg W y)] + _ = _ := by + rw [← abs_mul] + congr 1 + field_simp [(gibbs_pos W y).ne'] + +lemma discreteDistance_square_gap (hn : 0 (Real.exp (-a)*a^k/k.factorial)*r^k) (Real.exp (a*(r-1))) := by + have h := (NormedSpace.exp_series_hasSum_exp' (𝕂 := ℝ) (a*r)).mul_left (Real.exp (-a)) + rw [← Real.exp_eq_exp_ℝ,← Real.exp_add,show -a+a*r=a*(r-1) by ring] at h + apply h.congr_fun + intro k + simp only [smul_eq_mul,mul_pow] + ring + +lemma finite_l1_series_bound {ι : Type*} [Fintype ι] + (F : ℕ → ι → ℝ) (z : ι → ℝ) (g : ℕ → ℝ) (B : ℝ) + (hf : ∀ y, HasSum (fun k => F k y) (z y)) (hg : HasSum g B) + (hb : ∀ k, (∑ y, |F k y|) ≤ g k) : (∑ y, |z y|) ≤ B := by + classical + have ht : Summable (fun k => ∑ y, |F k y|) := + Summable.of_nonneg_of_le (fun _ => Finset.sum_nonneg (fun _ _ => abs_nonneg _)) hb hg.summable + have hs (y : ι) : Summable (fun k => |F k y|) := by + have hc (k : ℕ) : |F k y| ≤ ∑ i : ι, |F k i| := + Finset.single_le_sum (fun i (_ : i ∈ (Finset.univ : Finset ι)) => abs_nonneg (F k i)) (Finset.mem_univ y) + exact Summable.of_nonneg_of_le (fun k => abs_nonneg (F k y)) hc ht + have he (y : ι) : |z y| ≤ ∑' k, |F k y| := + (hf y).norm_le_of_bounded (hs y).hasSum (fun _ => le_rfl) + calc + _ ≤ ∑ y, ∑' k, |F k y| := Finset.sum_le_sum (fun y _ => he y) + _ = ∑' k, ∑ y, |F k y| := (Summable.tsum_finsetSum (fun y _ => hs y)).symm + _ ≤ B := hasSum_le hb ht.hasSum hg + +lemma poisson_l1_bound {ι : Type*} [Fintype ι] [DecidableEq ι] + (K : Matrix ι ι ℝ) (μ : ι → ℝ) (a : ℝ) (ha : 0≤a) (B r : ℝ) (x : ι) + (hbound : ∀ k : ℕ, (∑ y, |(K^k) x y-μ y|) ≤ B*r^k) : + (∑ y, |NormedSpace.exp (a • (K-1)) x y-μ y|) ≤ B*Real.exp (a*(r-1)) := by + let c : ℕ → ℝ := fun k => Real.exp (-a)*a^k/k.factorial + have hc (k : ℕ) : 0≤c k := poisson_coeff_nonneg a ha k + have hgen : HasSum (fun k : ℕ => c k*(B*r^k)) (B*Real.exp (a*(r-1))) := by + apply ((poisson_generating_hasSum a r).mul_left B).congr_fun + intro k + dsimp [c] + ring + have hf (y : ι) : HasSum (fun k => c k*((K^k) x y-μ y)) (NormedSpace.exp (a • (K-1)) x y-μ y) := by + have hh := (matrix_poisson_hasSum K a x y).sub ((poisson_coeff_hasSum a).mul_right (μ y)) + rw [one_mul] at hh + apply hh.congr_fun + intro k + dsimp [c] + ring + apply finite_l1_series_bound _ _ _ _ hf hgen + intro k + simp only [abs_mul,abs_of_nonneg (hc k),← Finset.mul_sum] + exact mul_le_mul_of_nonneg_left (hbound k) (hc k) + +lemma exp_neg_linear_bound {u : ℝ} (hu : 0≤u) (hu1 : u≤1) : Real.exp (-u) ≤ 1-u/2 := by + have hh := mul_le_mul_of_nonneg_right (Real.add_one_le_exp u) (Real.exp_nonneg (-u)) + rw [← Real.exp_add,add_neg_cancel,Real.exp_zero] at hh + have hp : 0<1+u := by linarith + have ht : 1≤(1-u/2)*(1+u) := by nlinarith [mul_nonneg hu (sub_nonneg.mpr hu1)] + apply (mul_le_mul_iff_of_pos_right hp).mp + nlinarith only [hh,ht] + +variable {n : ℕ} (W : Disorder n) + +lemma continuousDistance_gap_bound (hn : 0 Real.exp_le_exp.mpr (abs_le.mp (hH x)).2) + _ = (Fintype.card (Spin n):ℝ)*Real.exp R := by simp + _ ≤ Real.exp (n:ℝ)*Real.exp R := mul_le_mul_of_nonneg_right hcard (Real.exp_nonneg _) + _ = Real.exp (R+(n:ℝ)) := by rw [← Real.exp_add,add_comm] + unfold gibbs + apply (le_div_iff₀ (partition_pos W)).mpr + calc + _ ≤ Real.exp (-(2*R+(n:ℝ)))*Real.exp (R+(n:ℝ)) := mul_le_mul_of_nonneg_left hz (Real.exp_nonneg _) + _ = Real.exp (-R) := by rw [← Real.exp_add]; congr 1; ring + _ ≤ Real.exp (hamiltonian W x) := Real.exp_le_exp.mpr (abs_le.mp (hH x)).1 + +lemma continuousMixingTime_le_of_distance {t : ℝ} (ht : 0≤t) + (hd : ∀ x, continuousDistance W t x ≤ 1/4) : continuousMixingTime W ≤ t := by + apply csInf_le (show BddBelow {s : ℝ | 0 ≤ s ∧ ∀ x, continuousDistance W s x≤1/4} from ⟨0,fun _ hs => hs.1⟩) + exact ⟨ht,hd⟩ + +lemma discreteMixingTime_le_of_distance {k : ℕ} + (hd : ∀ x, discreteDistance W k x ≤ 1/4) : discreteMixingTime W ≤ k := Nat.sInf_le hd + +lemma finite_continuous_gap_mixing (hn : 0 Real.exp (t * x ^ 2))] + simp_rw [gaussian_square_integral t ht] + simp + +lemma chiSquare_exp_integrable (m : ℕ) (t : ℝ) (ht : t < 1 / 2) : + Integrable (fun x => Real.exp (t * chiSquare m x)) (standardGaussianProduct m) := by + apply mgf_pos_iff.mp + rw [chiSquare_mgf m t ht] + exact pow_pos (inv_pos.mpr (Real.sqrt_pos.mpr (by linarith))) m + +lemma chiSquare_mgf_exp (m : ℕ) (t : ℝ) (ht : t < 1 / 2) : + mgf (chiSquare m) (standardGaussianProduct m) t = + Real.exp (-(m : ℝ) / 2 * Real.log (1 - 2 * t)) := by + rw [chiSquare_mgf m t ht] + have hb : 0 < 1 - 2 * t := by linarith + rw [← Real.exp_log (pow_pos (inv_pos.mpr (Real.sqrt_pos.mpr hb)) m), + Real.log_pow, Real.log_inv, Real.log_sqrt hb.le] + congr 1 + ring + +lemma chiSquare_chernoff_value (m : ℕ) (a : ℝ) (ha : 0 < a) : + Real.exp (-((1 - a⁻¹) / 2) * (m * a)) * + mgf (chiSquare m) (standardGaussianProduct m) ((1 - a⁻¹) / 2) = + Real.exp (-(m : ℝ) / 2 * (a - 1 - Real.log a)) := by + have ht : (1 - a⁻¹) / 2 < 1 / 2 := by have := inv_pos.mpr ha; linarith + rw [chiSquare_mgf_exp m _ ht, ← Real.exp_add] + have he : 1 - 2 * ((1 - a⁻¹) / 2) = a⁻¹ := by ring + rw [he, Real.log_inv] + congr 1 + field_simp + ring + +lemma chiSquare_upper_tail (m : ℕ) (a : ℝ) (ha : 1 ≤ a) : + (standardGaussianProduct m).real {x | (m : ℝ) * a ≤ chiSquare m x} ≤ + Real.exp (-(m : ℝ) / 2 * (a - 1 - Real.log a)) := by + have ha0 : 0 < a := by linarith + have ht : (1 - a⁻¹) / 2 < 1 / 2 := by have := inv_pos.mpr ha0; linarith + have ht0 : 0 ≤ (1 - a⁻¹) / 2 := by + have := inv_le_one₀ ha0 |>.mpr ha + linarith + have hh := measure_ge_le_exp_mul_mgf (μ := standardGaussianProduct m) + (X := chiSquare m) ((m : ℝ) * a) ht0 (chiSquare_exp_integrable m _ ht) + simpa only [chiSquare_chernoff_value m a ha0] using hh + +lemma chiSquare_lower_tail (m : ℕ) (a : ℝ) (ha : 0 < a) (ha1 : a ≤ 1) : + (standardGaussianProduct m).real {x | chiSquare m x ≤ (m : ℝ) * a} ≤ + Real.exp (-(m : ℝ) / 2 * (a - 1 - Real.log a)) := by + have ht : (1 - a⁻¹) / 2 < 1 / 2 := by have := inv_pos.mpr ha; linarith + have ht0 : (1 - a⁻¹) / 2 ≤ 0 := by + have := one_le_inv₀ ha |>.mpr ha1 + linarith + have hh := measure_le_le_exp_mul_mgf (μ := standardGaussianProduct m) + (X := chiSquare m) ((m : ℝ) * a) ht0 (chiSquare_exp_integrable m _ ht) + simpa only [chiSquare_chernoff_value m a ha] using hh + +lemma chi_entropy_lower (a : ℝ) (ha : 0 < a) : + (Real.sqrt a - 1) ^ 2 ≤ a - 1 - Real.log a := by + have hh := Real.log_le_sub_one_of_pos (Real.sqrt_pos.mpr ha) + rw [Real.log_sqrt ha.le] at hh + nlinarith [Real.sq_sqrt ha.le] + +lemma chiSquare_nonneg (m : ℕ) (x : Fin m → ℝ) : 0 ≤ chiSquare m x := + Finset.sum_nonneg fun _ _ => sq_nonneg _ + +lemma chiSquare_eq_zero_iff (m : ℕ) (x : Fin m → ℝ) : chiSquare m x = 0 ↔ x = 0 := by + constructor + · intro hx + funext i + have hle : x i ^ 2 ≤ chiSquare m x := Finset.single_le_sum (fun j _ => sq_nonneg (x j)) + (Finset.mem_univ i) + rw [hx] at hle + simpa using sq_eq_zero_iff.mp (le_antisymm hle (sq_nonneg _)) + · rintro rfl + simp [chiSquare] + +lemma chiSquare_zero_measure (m : ℕ) (hm : 0 < m) : + standardGaussianProduct m {x | chiSquare m x = 0} = 0 := by + have : Nonempty (Fin m) := ⟨⟨0, hm⟩⟩ + have : NullSingletonClass (gaussianReal 0 1) := nullSingletonClass_gaussianReal (by norm_num) + simp only [chiSquare_eq_zero_iff, Set.ofPred_eq_eq_singleton, standardGaussianProduct, + measure_singleton] + +lemma chi_radius_algebra (m : ℕ) (hm : 0 < m) (u : ℝ) : + (m : ℝ) * (u / Real.sqrt m) ^ 2 = u ^ 2 ∧ + (m : ℝ) / 2 * (u / Real.sqrt m - 1) ^ 2 = (u - Real.sqrt m) ^ 2 / 2 := by + have hm0 : (0 : ℝ) < m := by exact_mod_cast hm + have hb0 : Real.sqrt (m : ℝ) ≠ 0 := by positivity + have hb := Real.sq_sqrt hm0.le + constructor + · rw [div_pow, hb] + field_simp + · rw [div_sub_one hb0, div_pow, hb] + field_simp + +lemma chi_upper_tail (m : ℕ) (hm : 0 < m) (r : ℝ) (hr : 0 ≤ r) : + (standardGaussianProduct m).real {x | Real.sqrt m + r ≤ Real.sqrt (chiSquare m x)} ≤ + Real.exp (-r ^ 2 / 2) := by + have hm0 : (0 : ℝ) < m := by exact_mod_cast hm + have hb : 0 < Real.sqrt (m : ℝ) := Real.sqrt_pos.mpr hm0 + let u := Real.sqrt (m : ℝ) + r + have hu : 0 < u := by dsimp [u]; linarith + have hu1 : 1 ≤ u / Real.sqrt (m : ℝ) := (le_div_iff₀ hb).mpr (by dsimp [u]; linarith) + have ha : 1 ≤ (u / Real.sqrt (m : ℝ)) ^ 2 := by nlinarith + have halg := chi_radius_algebra m hm u + calc + _ ≤ (standardGaussianProduct m).real {x | (m : ℝ) * (u / Real.sqrt m) ^ 2 ≤ chiSquare m x} := by + apply measureReal_mono (h₂ := measure_ne_top _ _) + intro x hx + rw [halg.1] + have hsq := Real.sq_sqrt (chiSquare_nonneg m x) + change u ≤ _ at hx + change u ^ 2 ≤ chiSquare m x + nlinarith [sq_le_sq₀ hu.le (Real.sqrt_nonneg (chiSquare m x)) |>.mpr hx] + _ ≤ Real.exp (-(m : ℝ) / 2 * ((u / Real.sqrt m) ^ 2 - 1 - Real.log ((u / Real.sqrt m) ^ 2))) := + chiSquare_upper_tail m _ ha + _ ≤ Real.exp (-r ^ 2 / 2) := by + apply Real.exp_le_exp.mpr + have he := chi_entropy_lower ((u / Real.sqrt m) ^ 2) (lt_of_lt_of_le zero_lt_one ha) + rw [Real.sqrt_sq (by positivity)] at he + have hh := mul_le_mul_of_nonneg_left he (show (0 : ℝ) ≤ m / 2 by positivity) + rw [halg.2] at hh + dsimp [u] at hh + nlinarith + +lemma chi_lower_tail (m : ℕ) (hm : 0 < m) (r : ℝ) (hr : 0 ≤ r) : + (standardGaussianProduct m).real {x | Real.sqrt (chiSquare m x) ≤ Real.sqrt m - r} ≤ + Real.exp (-r ^ 2 / 2) := by + have hm0 : (0 : ℝ) < m := by exact_mod_cast hm + have hb : 0 < Real.sqrt (m : ℝ) := Real.sqrt_pos.mpr hm0 + by_cases hru : r < Real.sqrt (m : ℝ) + · let u := Real.sqrt (m : ℝ) - r + have hu : 0 < u := by dsimp [u]; linarith + have hu1 : u / Real.sqrt (m : ℝ) ≤ 1 := (div_le_one hb).mpr (by dsimp [u]; linarith) + have hur : 0 < u / Real.sqrt (m : ℝ) := div_pos hu hb + have ha : (u / Real.sqrt (m : ℝ)) ^ 2 ≤ 1 := by nlinarith + have ha0 : 0 < (u / Real.sqrt (m : ℝ)) ^ 2 := sq_pos_of_pos hur + have halg := chi_radius_algebra m hm u + calc + _ ≤ (standardGaussianProduct m).real {x | chiSquare m x ≤ (m : ℝ) * (u / Real.sqrt m) ^ 2} := by + apply measureReal_mono (h₂ := measure_ne_top _ _) + intro x hx + rw [halg.1] + have hsq := Real.sq_sqrt (chiSquare_nonneg m x) + change _ ≤ u at hx + change chiSquare m x ≤ u ^ 2 + nlinarith [sq_le_sq₀ (Real.sqrt_nonneg (chiSquare m x)) hu.le |>.mpr hx] + _ ≤ Real.exp (-(m : ℝ) / 2 * ((u / Real.sqrt m) ^ 2 - 1 - Real.log ((u / Real.sqrt m) ^ 2))) := + chiSquare_lower_tail m _ ha0 ha + _ ≤ Real.exp (-r ^ 2 / 2) := by + apply Real.exp_le_exp.mpr + have he := chi_entropy_lower ((u / Real.sqrt m) ^ 2) ha0 + rw [Real.sqrt_sq hur.le] at he + have hh := mul_le_mul_of_nonneg_left he (show (0 : ℝ) ≤ m / 2 by positivity) + rw [halg.2] at hh + dsimp [u] at hh + nlinarith + · have hzero : (standardGaussianProduct m).real + {x | Real.sqrt (chiSquare m x) ≤ Real.sqrt m - r} = 0 := by + apply measureReal_mono_null (s₂ := {x | chiSquare m x = 0}) + · intro x hx + have hn : 0 ≤ Real.sqrt (chiSquare m x) := Real.sqrt_nonneg _ + have hz : Real.sqrt (chiSquare m x) = 0 := by dsimp at hx; linarith + exact (Real.sqrt_eq_zero (chiSquare_nonneg m x)).mp hz + · simp [Measure.real, chiSquare_zero_measure m hm] + rw [hzero] + positivity + +lemma chi_tail (m : ℕ) (hm : 0 < m) (r : ℝ) (hr : 0 ≤ r) : + (standardGaussianProduct m).real {x | r ≤ |Real.sqrt (chiSquare m x) - Real.sqrt m|} ≤ + 2 * Real.exp (-r ^ 2 / 2) := by + have hset : {x | r ≤ |Real.sqrt (chiSquare m x) - Real.sqrt m|} = + {x | Real.sqrt m + r ≤ Real.sqrt (chiSquare m x)} ∪ + {x | Real.sqrt (chiSquare m x) ≤ Real.sqrt m - r} := by + ext x + simp only [Set.mem_ofPred_eq, Set.mem_union, le_abs] + constructor <;> intro h <;> rcases h with h | h <;> first | left; linarith | right; linarith + rw [hset] + exact (measureReal_union_le _ _).trans (by + have := chi_upper_tail m hm r hr + have := chi_lower_tail m hm r hr + linarith) + +def chi (m : ℕ) (x : Fin m → ℝ) : ℝ := Real.sqrt (chiSquare m x) + +lemma chi_measurable (m : ℕ) : Measurable (chi m) := by + unfold chi chiSquare + fun_prop + +lemma chi_sq (m : ℕ) (x : Fin m → ℝ) : chi m x ^ 2 = chiSquare m x := + Real.sq_sqrt (chiSquare_nonneg m x) + +lemma chiSquare_integrable (m : ℕ) : Integrable (chiSquare m) (standardGaussianProduct m) := by + simpa using integrable_pow_of_integrable_exp_mul (X := chiSquare m) + (by norm_num : (1 / 4 : ℝ) ≠ 0) (chiSquare_exp_integrable m _ (by norm_num)) + (chiSquare_exp_integrable m _ (by norm_num)) 1 + +lemma chi_integrable (m : ℕ) : Integrable (chi m) (standardGaussianProduct m) := by + change Integrable (fun x => Real.sqrt (chiSquare m x)) _ + simpa only [Real.sqrt_eq_rpow] using integrable_rpow_of_integrable_exp_mul + (X := chiSquare m) (by norm_num : (1 / 4 : ℝ) ≠ 0) + (chiSquare_exp_integrable m _ (by norm_num)) + (chiSquare_exp_integrable m _ (by norm_num)) (p := 1 / 2) (by norm_num) + +lemma chi_memLp_two (m : ℕ) : MemLp (chi m) 2 (standardGaussianProduct m) := by + rw [memLp_two_iff_integrable_sq (chi_measurable m).aestronglyMeasurable] + simpa only [chi_sq] using chiSquare_integrable m + +lemma chi_center_integrable_sq (m : ℕ) (c : ℝ) : + Integrable (fun x => (chi m x - c) ^ 2) (standardGaussianProduct m) := by + have h := (chi_memLp_two m).sub (memLp_const c) + exact (memLp_two_iff_integrable_sq h.aestronglyMeasurable).mp h + +lemma chi_mean_square_error (m : ℕ) (hm : 0 < m) : + (∫ x, (chi m x - Real.sqrt m) ^ 2 ∂standardGaussianProduct m) ≤ 4 := by + rw [(chi_center_integrable_sq m (Real.sqrt m)).integral_eq_integral_meas_le + (Filter.Eventually.of_forall (fun _ => sq_nonneg _))] + have hbound : ∀ t : ℝ, 0 < t → (standardGaussianProduct m).real + {x | t ≤ (chi m x - Real.sqrt m) ^ 2} ≤ 2 * Real.exp (-(1 / 2) * t) := by + intro t ht + have hset : {x | t ≤ (chi m x - Real.sqrt m) ^ 2} = + {x | Real.sqrt t ≤ |chi m x - Real.sqrt m|} := by + ext x + simp only [Set.mem_ofPred_eq, Real.sqrt_le_iff, abs_nonneg, true_and, sq_abs] + rw [hset] + have h := chi_tail m hm (Real.sqrt t) (Real.sqrt_nonneg t) + simpa [chi, Real.sq_sqrt ht.le, div_eq_mul_inv, neg_mul, mul_neg, mul_comm] using h + calc + _ ≤ ∫ t in Set.Ioi 0, 2 * Real.exp (-(1 / 2) * t) := by + apply integral_mono_of_nonneg + · exact Filter.Eventually.of_forall (fun _ => measureReal_nonneg) + · exact (integrableOn_exp_mul_Ioi (by norm_num : (-(1 / 2) : ℝ) < 0) 0).const_mul 2 + · filter_upwards [ae_restrict_mem measurableSet_Ioi] with t ht using hbound t ht + _ = 4 := by + rw [integral_const_mul, integral_exp_mul_Ioi (by norm_num : (-(1 / 2) : ℝ) < 0)] + norm_num + +lemma gaussian_integral_square : (∫ x : ℝ, x ^ 2 ∂gaussianReal 0 1) = 1 := by + have h := variance_eq_sub (μ := gaussianReal 0 1) (X := id) (memLp_id_gaussianReal 2) + simpa only [variance_id_gaussianReal, NNReal.coe_one, id_eq, Pi.pow_apply, + integral_id_gaussianReal, zero_pow (by norm_num : 2 ≠ 0), sub_zero] using h.symm + +lemma chiSquare_mean (m : ℕ) : + (∫ x, chiSquare m x ∂standardGaussianProduct m) = m := by + have hg : Integrable (fun x : ℝ => x ^ 2) (gaussianReal 0 1) := by + simpa using (memLp_two_iff_integrable_sq + (measurable_id.aestronglyMeasurable : AEStronglyMeasurable id (gaussianReal 0 1))).mp + (memLp_id_gaussianReal 2) + unfold chiSquare standardGaussianProduct + rw [integral_finsetSum Finset.univ (f := fun (i : Fin m) (x : Fin m → ℝ) => x i ^ 2) + (fun i _ => integrable_comp_eval (μ := fun _ : Fin m => gaussianReal 0 1) (i := i) hg)] + have hcomp (i : Fin m) : + (∫ x : Fin m → ℝ, x i ^ 2 ∂Measure.pi (fun _ : Fin m => gaussianReal 0 1)) = 1 := by + rw [integral_comp_eval (μ := fun _ : Fin m => gaussianReal 0 1) (i := i) + hg.aestronglyMeasurable] + exact gaussian_integral_square + simp only [hcomp, Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul, mul_one] + +lemma chi_mean_nonneg (m : ℕ) : 0 ≤ ∫ x, chi m x ∂standardGaussianProduct m := + integral_nonneg fun _ => Real.sqrt_nonneg _ + +lemma chi_mean_upper (m : ℕ) : (∫ x, chi m x ∂standardGaussianProduct m) ≤ Real.sqrt m := by + have hv := variance_nonneg (X := chi m) (μ := standardGaussianProduct m) + rw [variance_eq_sub (chi_memLp_two m)] at hv + simp only [Pi.pow_apply, chi_sq, chiSquare_mean] at hv + exact (Real.le_sqrt (chi_mean_nonneg m) (Nat.cast_nonneg m)).mpr (by linarith) + +lemma chi_mean_bias (m : ℕ) (hm : 0 < m) : + 0 ≤ Real.sqrt m - (∫ x, chi m x ∂standardGaussianProduct m) ∧ + Real.sqrt m - (∫ x, chi m x ∂standardGaussianProduct m) ≤ 2 / Real.sqrt m := by + refine ⟨sub_nonneg.mpr (chi_mean_upper m), ?_⟩ + have he := chi_mean_square_error m hm + have hpoint : (fun x => (chi m x - Real.sqrt m) ^ 2) = + (fun x => chiSquare m x - 2 * Real.sqrt m * chi m x + (m : ℝ)) := by + funext x + rw [sub_sq, chi_sq, Real.sq_sqrt (Nat.cast_nonneg m)] + ring + rw [hpoint, integral_add (f := fun x => chiSquare m x - 2 * Real.sqrt m * chi m x) + (g := fun _ => (m : ℝ)) ((chiSquare_integrable m).sub + ((chi_integrable m).const_mul _)) (integrable_const _), + integral_sub (f := chiSquare m) (g := fun x => 2 * Real.sqrt m * chi m x) + (chiSquare_integrable m) ((chi_integrable m).const_mul _), + integral_const_mul, chiSquare_mean, integral_const] at he + simp only [probReal_univ, smul_eq_mul, one_mul] at he + apply (le_div_iff₀ (Real.sqrt_pos.mpr (Nat.cast_pos.mpr hm))).mpr + nlinarith [Real.sq_sqrt (Nat.cast_nonneg m)] + +lemma chi_square_deviation_tail (m : ℕ) (hm : 0 < m) (t : ℝ) (ht : 0 ≤ t) : + (standardGaussianProduct m).real {x | t ≤ (chi m x - Real.sqrt m) ^ 2} ≤ + 2 * Real.exp (-(1 / 2) * t) := by + have hset : {x | t ≤ (chi m x - Real.sqrt m) ^ 2} = + {x | Real.sqrt t ≤ |chi m x - Real.sqrt m|} := by + ext x + simp only [Set.mem_ofPred_eq, Real.sqrt_le_iff, abs_nonneg, true_and, sq_abs] + rw [hset] + simpa [chi, Real.sq_sqrt ht, div_eq_mul_inv, neg_mul, mul_neg, mul_comm] using + chi_tail m hm (Real.sqrt t) (Real.sqrt_nonneg t) + +lemma chi_square_deviation_exp_integrable (m : ℕ) : + Integrable (fun x => Real.exp ((chi m x - Real.sqrt m) ^ 2 / 4)) + (standardGaussianProduct m) := by + apply ((chiSquare_exp_integrable m (1 / 4) (by norm_num)).const_mul + (Real.exp ((m : ℝ) / 4))).mono' + · exact ((chi_measurable m).sub measurable_const).pow_const 2 |>.div_const 4 |>.exp + |>.aestronglyMeasurable + · apply Filter.Eventually.of_forall + intro x + rw [Real.norm_eq_abs, abs_of_pos (Real.exp_pos _), ← Real.exp_add] + apply Real.exp_le_exp.mpr + have h1 := Real.sqrt_nonneg (chiSquare m x) + have h2 := Real.sqrt_nonneg (m : ℝ) + have h3 := chi_sq m x + have h4 := Real.sq_sqrt (Nat.cast_nonneg m) + change 0 ≤ chi m x at h1 + nlinarith [mul_nonneg h1 h2] + +lemma chi_square_deviation_exp_bound (m : ℕ) (hm : 0 < m) : + (∫ x, Real.exp ((chi m x - Real.sqrt m) ^ 2 / 4) + ∂standardGaussianProduct m) ≤ 3 := by + have hi := chi_square_deviation_exp_integrable m + have hnonneg : ∀ x, 0 ≤ Real.exp ((chi m x - Real.sqrt m) ^ 2 / 4) - 1 := by + intro x + exact sub_nonneg.mpr (Real.one_le_exp (by positivity)) + have hformula (u : ℝ) : (∫ t in (0 : ℝ)..u, (1 / 4 : ℝ) * Real.exp (t / 4)) = + Real.exp (u / 4) - 1 := by + have hd (x : ℝ) : HasDerivAt (fun t : ℝ => Real.exp (t / 4)) + ((1 / 4 : ℝ) * Real.exp (x / 4)) x := by + simpa only [id_eq, one_div, mul_comm] using ((hasDerivAt_id x).div_const 4).exp + simpa only [zero_div, Real.exp_zero] using + intervalIntegral.integral_eq_sub_of_hasDerivAt (fun x _ => hd x) + ((by fun_prop : Continuous (fun t : ℝ => (1 / 4 : ℝ) * Real.exp (t / 4))).intervalIntegrable 0 u) + have hl := lintegral_comp_eq_lintegral_meas_le_mul + (f := fun x => (chi m x - Real.sqrt m) ^ 2) + (g := fun t : ℝ => (1 / 4 : ℝ) * Real.exp (t / 4)) (standardGaussianProduct m) + (Filter.Eventually.of_forall (fun _ => sq_nonneg _)) + (((chi_measurable m).sub measurable_const).pow_const 2).aemeasurable + (fun t _ => (by fun_prop : Continuous (fun t : ℝ => (1 / 4 : ℝ) * Real.exp (t / 4))).intervalIntegrable 0 t) + (Filter.Eventually.of_forall (fun _ => by positivity)) + simp_rw [hformula] at hl + rw [← ofReal_integral_eq_lintegral_ofReal (f := fun x => Real.exp ((chi m x - Real.sqrt m) ^ 2 / 4) - 1) (hi.sub (integrable_const 1)) + (Filter.Eventually.of_forall hnonneg)] at hl + have hb : ENNReal.ofReal (∫ x, Real.exp ((chi m x - Real.sqrt m) ^ 2 / 4) - 1 + ∂standardGaussianProduct m) ≤ ENNReal.ofReal 2 := by + rw [hl] + calc + _ ≤ ∫⁻ t in Set.Ioi (0 : ℝ), ENNReal.ofReal ((1 / 2 : ℝ) * Real.exp (-(1 / 4) * t)) := by + apply lintegral_mono_ae + filter_upwards [ae_restrict_mem measurableSet_Ioi] with t ht + rw [← ENNReal.ofReal_toReal (measure_ne_top _ _)] + rw [← ENNReal.ofReal_mul ENNReal.toReal_nonneg] + apply ENNReal.ofReal_le_ofReal + calc + _ ≤ (2 * Real.exp (-(1 / 2) * t)) * ((1 / 4) * Real.exp (t / 4)) := by + gcongr + exact chi_square_deviation_tail m hm t ht.le + _ = (1 / 2) * Real.exp (-(1 / 4) * t) := by + rw [show -(1 / 4) * t = -(1 / 2) * t + t / 4 by ring, Real.exp_add] + ring + _ = ENNReal.ofReal 2 := by + rw [← ofReal_integral_eq_lintegral_ofReal + ((integrableOn_exp_mul_Ioi (by norm_num : (-(1 / 4) : ℝ) < 0) 0).const_mul (1 / 2)) + (Filter.Eventually.of_forall (fun _ => by positivity))] + rw [integral_const_mul, integral_exp_mul_Ioi (by norm_num : (-(1 / 4) : ℝ) < 0)] + norm_num + have hb' := (ENNReal.ofReal_le_ofReal_iff (by norm_num : (0 : ℝ) ≤ 2)).mp hb + rw [integral_sub (f := fun x => Real.exp ((chi m x - Real.sqrt m) ^ 2 / 4)) + (g := fun _ => (1 : ℝ)) hi (integrable_const 1)] at hb' + simp only [integral_const, probReal_univ, smul_eq_mul, one_mul] at hb' + linarith + +lemma exp_quadratic_remainder (x : ℝ) : + Real.exp x ≤ 1 + x + x ^ 2 * Real.exp |x| := by + have h : |Real.exp x - (1 + x)| ≤ x ^ 2 * Real.exp |x| := by + have hc := Complex.norm_exp_sub_sum_le_norm_mul_exp (x : ℂ) 2 + norm_num [Finset.sum_range_succ] at hc + simpa only [← Complex.ofReal_exp, ← Complex.ofReal_one, ← Complex.ofReal_add, + ← Complex.ofReal_sub, Complex.norm_real, Real.norm_eq_abs, sq_abs] using hc + have hh := (abs_le.mp h).2 + linarith + +lemma exp_quadratic_domination (t z : ℝ) : + Real.exp (t * z) ≤ 1 + t * z + + (16 * t ^ 2 * Real.exp (4 * t ^ 2)) * Real.exp (z ^ 2 / 8) := by + have hy : |t * z| ≤ 4 * t ^ 2 + z ^ 2 / 16 := by + apply abs_le.mpr + constructor <;> nlinarith [sq_nonneg (2 * t + z / 4), sq_nonneg (2 * t - z / 4)] + have hz : z ^ 2 ≤ 16 * Real.exp (z ^ 2 / 16) := by + have := Real.add_one_le_exp (z ^ 2 / 16) + linarith + calc + _ ≤ 1 + t * z + (t * z) ^ 2 * Real.exp |t * z| := exp_quadratic_remainder _ + _ ≤ 1 + t * z + (t * z) ^ 2 * Real.exp (4 * t ^ 2 + z ^ 2 / 16) := by gcongr + _ = 1 + t * z + (t ^ 2 * Real.exp (4 * t ^ 2)) * (z ^ 2 * Real.exp (z ^ 2 / 16)) := by + rw [Real.exp_add] + ring + _ ≤ 1 + t * z + (t ^ 2 * Real.exp (4 * t ^ 2)) * + (16 * Real.exp (z ^ 2 / 16) * Real.exp (z ^ 2 / 16)) := by gcongr + _ = _ := by + rw [show z ^ 2 / 8 = z ^ 2 / 16 + z ^ 2 / 16 by ring, Real.exp_add] + ring + +lemma one_add_linear_mul_exp_le (a b r : ℝ) (_ha : 0 ≤ a) (hb : 0 ≤ b) (hr : 0 ≤ r) : + 1 + a * r * Real.exp (b * r) ≤ Real.exp ((a + b) * r) := by + calc + _ ≤ Real.exp (b * r) + a * r * Real.exp (b * r) := by + gcongr + exact Real.one_le_exp (mul_nonneg hb hr) + _ = (1 + a * r) * Real.exp (b * r) := by ring + _ ≤ Real.exp (a * r) * Real.exp (b * r) := by + gcongr + simpa [add_comm] using Real.add_one_le_exp (a * r) + _ = _ := by rw [← Real.exp_add]; congr 1; ring + +lemma centered_mgf_from_exp_square {Ω : Type*} [MeasurableSpace Ω] + {μ : Measure Ω} [IsProbabilityMeasure μ] {X : Ω → ℝ} {B : ℝ} + (hX : Integrable X μ) (hzero : ∫ x, X x ∂μ = 0) + (hexp : Integrable (fun x => Real.exp (X x ^ 2 / 8)) μ) + (hB : (∫ x, Real.exp (X x ^ 2 / 8) ∂μ) ≤ B) (hB0 : 0 ≤ B) (t : ℝ) : + (∫ x, Real.exp (t * X x) ∂μ) ≤ Real.exp ((16 * B + 4) * t ^ 2) := by + have hbound := fun x => exp_quadratic_domination t (X x) + calc + _ ≤ ∫ x, (1 + t * X x) + (16 * t ^ 2 * Real.exp (4 * t ^ 2)) * + Real.exp (X x ^ 2 / 8) ∂μ := by + apply integral_mono_of_nonneg + · exact Filter.Eventually.of_forall (fun _ => (Real.exp_pos _).le) + · exact ((integrable_const 1).add (hX.const_mul t)).add (hexp.const_mul _) + · exact Filter.Eventually.of_forall hbound + _ = 1 + (16 * t ^ 2 * Real.exp (4 * t ^ 2)) * + (∫ x, Real.exp (X x ^ 2 / 8) ∂μ) := by + rw [integral_add (f := fun x => 1 + t * X x) + (g := fun x => (16 * t ^ 2 * Real.exp (4 * t ^ 2)) * Real.exp (X x ^ 2 / 8)) + ((integrable_const 1).add (hX.const_mul t)) (hexp.const_mul _), + integral_add (f := fun _ => (1 : ℝ)) (g := fun x => t * X x) + (integrable_const 1) (hX.const_mul t), integral_const_mul, integral_const_mul, hzero] + simp + _ ≤ 1 + (16 * B) * (t ^ 2) * Real.exp (4 * t ^ 2) := by + nlinarith [mul_le_mul_of_nonneg_left hB + (show 0 ≤ 16 * t ^ 2 * Real.exp (4 * t ^ 2) by positivity)] + _ ≤ _ := one_add_linear_mul_exp_le (16 * B) 4 (t ^ 2) (by positivity) (by norm_num) (sq_nonneg t) + +lemma integrable_exp_of_exp_square {Ω : Type*} [MeasurableSpace Ω] + {μ : Measure Ω} {X : Ω → ℝ} (hX : AEStronglyMeasurable X μ) + (hexp : Integrable (fun x => Real.exp (X x ^ 2 / 8)) μ) (t : ℝ) : + Integrable (fun x => Real.exp (t * X x)) μ := by + apply (hexp.const_mul (Real.exp (4 * t ^ 2))).mono' + · exact Real.continuous_exp.comp_aestronglyMeasurable (hX.const_mul t) + · apply Filter.Eventually.of_forall + intro x + rw [Real.norm_eq_abs, abs_of_pos (Real.exp_pos _), ← Real.exp_add] + apply Real.exp_le_exp.mpr + nlinarith [sq_nonneg (2 * t - X x / 4), sq_nonneg (X x)] + +lemma chi_bias_le_two (m : ℕ) (hm : 0 < m) : + Real.sqrt m - (∫ x, chi m x ∂standardGaussianProduct m) ≤ 2 := by + have hs : (1 : ℝ) ≤ Real.sqrt m := by + have : (1 : ℝ) ≤ (m : ℝ) := by exact_mod_cast hm + simpa only [Real.sqrt_one] using Real.sqrt_le_sqrt this + calc + _ ≤ 2 / Real.sqrt m := (chi_mean_bias m hm).2 + _ ≤ 2 := by apply (div_le_iff₀ (by positivity)).mpr; linarith + +lemma chi_center_square_exp_pointwise (m : ℕ) (hm : 0 < m) (x : Fin m → ℝ) : + Real.exp ((chi m x - (∫ y, chi m y ∂standardGaussianProduct m)) ^ 2 / 8) ≤ + Real.exp 1 * Real.exp ((chi m x - Real.sqrt m) ^ 2 / 4) := by + rw [← Real.exp_add] + apply Real.exp_le_exp.mpr + have hb0 := (chi_mean_bias m hm).1 + have hb2 := chi_bias_le_two m hm + have hb4 : (Real.sqrt m - (∫ y, chi m y ∂standardGaussianProduct m)) ^ 2 ≤ 4 := by + nlinarith + nlinarith [sq_nonneg (chi m x - Real.sqrt m - + (Real.sqrt m - (∫ y, chi m y ∂standardGaussianProduct m)))] + +lemma chi_center_square_exp_integrable (m : ℕ) (hm : 0 < m) : + Integrable (fun x => Real.exp ((chi m x - (∫ y, chi m y ∂standardGaussianProduct m)) ^ 2 / 8)) + (standardGaussianProduct m) := by + apply ((chi_square_deviation_exp_integrable m).const_mul (Real.exp 1)).mono' + · exact ((chi_measurable m).sub measurable_const).pow_const 2 |>.div_const 8 |>.exp + |>.aestronglyMeasurable + · apply Filter.Eventually.of_forall + intro x + rw [Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)] + exact chi_center_square_exp_pointwise m hm x + +lemma chi_center_square_exp_bound (m : ℕ) (hm : 0 < m) : + (∫ x, Real.exp ((chi m x - (∫ y, chi m y ∂standardGaussianProduct m)) ^ 2 / 8) + ∂standardGaussianProduct m) ≤ 3 * Real.exp 1 := by + calc + _ ≤ ∫ x, Real.exp 1 * Real.exp ((chi m x - Real.sqrt m) ^ 2 / 4) + ∂standardGaussianProduct m := by + apply integral_mono_of_nonneg + · exact Filter.Eventually.of_forall (fun _ => (Real.exp_pos _).le) + · exact (chi_square_deviation_exp_integrable m).const_mul (Real.exp 1) + · exact Filter.Eventually.of_forall (chi_center_square_exp_pointwise m hm) + _ = Real.exp 1 * (∫ x, Real.exp ((chi m x - Real.sqrt m) ^ 2 / 4) + ∂standardGaussianProduct m) := integral_const_mul _ _ + _ ≤ _ := by + have h := mul_le_mul_of_nonneg_left (chi_square_deviation_exp_bound m hm) (Real.exp_pos 1).le + nlinarith + +theorem chi_centered_subGaussian (m : ℕ) (hm : 0 < m) : + HasSubgaussianMGF (fun x => chi m x - (∫ y, chi m y ∂standardGaussianProduct m)) + ⟨2 * (48 * Real.exp 1 + 4), by positivity⟩ (standardGaussianProduct m) := by + have hi : Integrable (fun x => chi m x - (∫ y, chi m y ∂standardGaussianProduct m)) + (standardGaussianProduct m) := (chi_integrable m).sub (integrable_const _) + have hz : (∫ x, chi m x - (∫ y, chi m y ∂standardGaussianProduct m) + ∂standardGaussianProduct m) = 0 := by + rw [integral_sub (f := chi m) (g := fun _ => (∫ y, chi m y ∂standardGaussianProduct m)) + (chi_integrable m) (integrable_const _)] + simp + refine ⟨integrable_exp_of_exp_square hi.aestronglyMeasurable + (chi_center_square_exp_integrable m hm), ?_⟩ + intro t + have h := centered_mgf_from_exp_square hi hz (chi_center_square_exp_integrable m hm) + (chi_center_square_exp_bound m hm) (by positivity) t + change _ ≤ Real.exp ((2 * (48 * Real.exp 1 + 4)) * t ^ 2 / 2) + convert h using 1 + congr 1 + ring_nf + +def chiRowDim (n i : ℕ) : ℕ := max 1 (n - i) + +abbrev ChiRows (n : ℕ) := (i : ℕ) → (Fin (chiRowDim n i) → ℝ) + +def chiRowLaw (n : ℕ) : Measure (ChiRows n) := + Measure.infinitePi (fun i => standardGaussianProduct (chiRowDim n i)) + +instance (n : ℕ) : IsProbabilityMeasure (chiRowLaw n) := by + unfold chiRowLaw + infer_instance + +def centeredChiRow (n i : ℕ) (ω : ChiRows n) : ℝ := + chi (chiRowDim n i) (ω i) - ∫ y, chi (chiRowDim n i) y ∂standardGaussianProduct (chiRowDim n i) + +lemma centeredChiRow_measurable (n i : ℕ) : Measurable (centeredChiRow n i) := + ((chi_measurable _).comp (measurable_pi_apply i)).sub measurable_const + +lemma centeredChiRows_independent (n : ℕ) : iIndepFun (centeredChiRow n) (chiRowLaw n) := by + exact iIndepFun_infinitePi (fun i => (chi_measurable _).sub measurable_const) + +lemma centeredChiRow_subGaussian (n i : ℕ) : + HasSubgaussianMGF (centeredChiRow n i) + ⟨2 * (48 * Real.exp 1 + 4), by positivity⟩ (chiRowLaw n) := by + have h := chi_centered_subGaussian (chiRowDim n i) (by unfold chiRowDim; omega) + have h' : HasSubgaussianMGF + (fun x => chi (chiRowDim n i) x - + ∫ y, chi (chiRowDim n i) y ∂standardGaussianProduct (chiRowDim n i)) + ⟨2 * (48 * Real.exp 1 + 4), by positivity⟩ + ((chiRowLaw n).map (fun ω => ω i)) := by + simpa only [chiRowLaw, Measure.infinitePi_map_eval] using h + exact HasSubgaussianMGF.of_map (μ := chiRowLaw n) (Y := fun ω : ChiRows n => ω i) + (measurable_pi_apply i).aemeasurable h' + +lemma centeredChiRow_mean (n i : ℕ) : (∫ ω, centeredChiRow n i ω ∂chiRowLaw n) = 0 := by + let f (x : Fin (chiRowDim n i) → ℝ) := chi (chiRowDim n i) x - + ∫ y, chi (chiRowDim n i) y ∂standardGaussianProduct (chiRowDim n i) + have he := integral_map (μ := chiRowLaw n) (φ := fun ω : ChiRows n => ω i) + (f := f) (measurable_pi_apply i).aemeasurable + ((chi_measurable _).sub measurable_const).aestronglyMeasurable + change (∫ ω, f (ω i) ∂chiRowLaw n) = 0 + rw [← he] + simp only [chiRowLaw, Measure.infinitePi_map_eval] + dsimp only [f] + rw [integral_sub (chi_integrable _) (integrable_const _)] + simp + +def scaledChiRow (n i : ℕ) (ω : ChiRows n) : ℝ := + (Real.sqrt (n + 1))⁻¹ * centeredChiRow n i ω + +lemma scaledChiRow_subGaussian (n i : ℕ) : + HasSubgaussianMGF (scaledChiRow n i) + ⟨2 * (48 * Real.exp 1 + 4) / (n + 1), by positivity⟩ (chiRowLaw n) := by + have h := (centeredChiRow_subGaussian n i).const_mul (Real.sqrt (n + 1))⁻¹ + refine ⟨h.integrable_exp_mul, ?_⟩ + intro t + have ht := h.mgf_le t + convert ht using 1 + congr 1 + apply congrArg Real.exp + change (2 * (48 * Real.exp 1 + 4) / (n + 1)) * t ^ 2 / 2 = + ((Real.sqrt (n + 1))⁻¹ ^ 2 * (2 * (48 * Real.exp 1 + 4))) * t ^ 2 / 2 + rw [inv_pow, Real.sq_sqrt (show (0 : ℝ) ≤ n + 1 by positivity)] + ring + +lemma scaledChiRows_independent (n : ℕ) : iIndepFun (scaledChiRow n) (chiRowLaw n) := + (centeredChiRows_independent n).comp (fun _ x => (Real.sqrt (n + 1))⁻¹ * x) + (fun _ => measurable_const.mul measurable_id) + +lemma scaledChiRow_measurable (n i : ℕ) : Measurable (scaledChiRow n i) := + (centeredChiRow_measurable n i).const_mul _ + +lemma scaledChiRow_mean (n i : ℕ) : (∫ ω, scaledChiRow n i ω ∂chiRowLaw n) = 0 := by + change (∫ ω, (Real.sqrt (n + 1))⁻¹ * centeredChiRow n i ω ∂chiRowLaw n) = 0 + rw [integral_const_mul, centeredChiRow_mean, mul_zero] + +def diagonalMarginal (n _i : ℕ) : Measure ℝ := + gaussianReal 0 ⟨2 / (n + 1), by positivity⟩ + +instance (n i : ℕ) : IsProbabilityMeasure (diagonalMarginal n i) := by + exact instIsProbabilityMeasureGaussianReal _ _ + +def diagonalLaw (n : ℕ) : Measure (ℕ → ℝ) := + Measure.infinitePi (diagonalMarginal n) + +instance (n : ℕ) : IsProbabilityMeasure (diagonalLaw n) := by + unfold diagonalLaw + infer_instance + +lemma gaussian_id_subGaussian (v : ℝ≥0) : HasSubgaussianMGF id v (gaussianReal 0 v) := by + refine ⟨fun t => integrable_exp_mul_gaussianReal t, fun t => ?_⟩ + rw [mgf_gaussianReal (μ := 0) (v := v) (by simp)] + simp + +lemma diagonalRows_subGaussian (n i : ℕ) : + HasSubgaussianMGF (fun ω : ℕ → ℝ => ω i) ⟨2 / (n + 1), by positivity⟩ (diagonalLaw n) := by + have h : HasSubgaussianMGF id ⟨2 / (n + 1), by positivity⟩ + ((diagonalLaw n).map (fun ω => ω i)) := by + simpa only [diagonalLaw, Measure.infinitePi_map_eval, diagonalMarginal] using + gaussian_id_subGaussian ⟨2 / (n + 1), by positivity⟩ + exact HasSubgaussianMGF.of_map (μ := diagonalLaw n) (Y := fun ω : ℕ → ℝ => ω i) + (measurable_pi_apply i).aemeasurable h + +lemma diagonalRows_independent (n : ℕ) : + iIndepFun (fun i (ω : ℕ → ℝ) => ω i) (diagonalLaw n) := + iIndepFun_infinitePi (fun _ => measurable_id) + +lemma diagonalRows_mean (n i : ℕ) : (∫ ω, ω i ∂diagonalLaw n) = 0 := by + have he := integral_map (μ := diagonalLaw n) (φ := fun ω : ℕ → ℝ => ω i) + (f := id) (measurable_pi_apply i).aemeasurable (measurable_id.aestronglyMeasurable) + change (∫ ω, id (ω i) ∂diagonalLaw n) = 0 + rw [← he] + simp only [diagonalLaw, Measure.infinitePi_map_eval, diagonalMarginal] + exact integral_id_gaussianReal + +variable {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ] + +lemma independent_product_submartingale {Y : ℕ → Ω → ℝ} + (hY : ∀ i, StronglyMeasurable (Y i)) (hind : iIndepFun Y μ) + (hint : ∀ n, Integrable (fun ω => ∏ i ∈ Finset.range (n + 1), Y i ω) μ) + (hi : ∀ i, Integrable (Y i) μ) (hpos : ∀ i ω, 0 ≤ Y i ω) + (hmean : ∀ i, 1 ≤ ∫ ω, Y i ω ∂μ) : + Submartingale (fun n ω => ∏ i ∈ Finset.range (n + 1), Y i ω) + (Filtration.natural Y hY) μ := by + have hadp : StronglyAdapted (Filtration.natural Y hY) + (fun n ω => ∏ i ∈ Finset.range (n + 1), Y i ω) := by + intro n + have hh : ∀ i ∈ Finset.range (n + 1), + StronglyMeasurable[Filtration.natural Y hY n] (Y i) := by + intro i hi + exact (Filtration.stronglyAdapted_natural hY i).mono + ((Filtration.natural Y hY).mono (Nat.le_of_lt_succ (Finset.mem_range.mp hi))) + convert Finset.stronglyMeasurable_prod (Finset.range (n + 1)) hh using 1 + ext ω + simp only [Finset.prod_apply] + apply submartingale_nat hadp hint + intro n + have hid : (fun ω => ∏ i ∈ Finset.range (n + 1 + 1), Y i ω) = + (fun ω => ∏ i ∈ Finset.range (n + 1), Y i ω) * Y (n + 1) := by + funext ω + simp [Finset.prod_range_succ] + rw [hid] + have hcond := condExp_mul_of_stronglyMeasurable_left (hadp n) + (hid ▸ hint (n + 1)) (hi (n + 1)) + have hindcond := hind.condExp_natural_ae_eq_of_lt hY (Nat.lt_succ_self n) + filter_upwards [hcond, hindcond] with ω hc he + rw [hc] + simp only [Pi.mul_apply] + rw [he] + exact le_mul_of_one_le_right + (Finset.prod_nonneg (fun i _ => hpos i ω)) (hmean (n + 1)) + +lemma exp_partial_sum_submartingale {X : ℕ → Ω → ℝ} {c : ℝ≥0} + (hX : ∀ i, StronglyMeasurable (X i)) (hind : iIndepFun X μ) + (hmgf : ∀ i, HasSubgaussianMGF (X i) c μ) + (hmean : ∀ i, ∫ ω, X i ω ∂μ = 0) (t : ℝ) : + ∃ (F : Filtration ℕ ‹MeasurableSpace Ω›), + Submartingale (fun n ω => Real.exp (t * ∑ i ∈ Finset.range (n + 1), X i ω)) F μ := by + let Y : ℕ → Ω → ℝ := fun i ω => Real.exp (t * X i ω) + have hY : ∀ i, StronglyMeasurable (Y i) := fun i => + Real.continuous_exp.comp_stronglyMeasurable ((hX i).const_mul t) + have hYi : ∀ i, Integrable (Y i) μ := fun i => (hmgf i).integrable_exp_mul t + have hindY : iIndepFun Y μ := hind.comp (fun _ x => Real.exp (t * x)) + (fun _ => Real.measurable_exp.comp (measurable_const.mul measurable_id)) + have heq (n : ℕ) : (fun ω => ∏ i ∈ Finset.range (n + 1), Y i ω) = + (fun ω => Real.exp (t * ∑ i ∈ Finset.range (n + 1), X i ω)) := by + funext ω + simp only [Y, Finset.mul_sum, Real.exp_sum] + have hint (n : ℕ) : Integrable (fun ω => ∏ i ∈ Finset.range (n + 1), Y i ω) μ := by + rw [heq] + exact (HasSubgaussianMGF.sum_of_iIndepFun hind (fun i _ => hmgf i)).integrable_exp_mul t + have hm (i : ℕ) : 1 ≤ ∫ ω, Y i ω ∂μ := by + have h := integral_mono (((hmgf i).integrable.const_mul t).add (integrable_const 1)) + (hYi i) (fun ω => Real.add_one_le_exp (t * X i ω)) + change (∫ ω, t * X i ω + 1 ∂μ) ≤ ∫ ω, Y i ω ∂μ at h + rw [integral_add ((hmgf i).integrable.const_mul t) (integrable_const 1), + integral_const_mul, hmean i] at h + simpa using h + refine ⟨Filtration.natural Y hY, ?_⟩ + have h := independent_product_submartingale hY hindY hint hYi + (fun i ω => (Real.exp_pos _).le) hm + convert h using 1 + funext n + exact (heq n).symm + +lemma partial_sum_maximal_exponential {X : ℕ → Ω → ℝ} {c : ℝ≥0} + (hX : ∀ i, StronglyMeasurable (X i)) (hind : iIndepFun X μ) + (hmgf : ∀ i, HasSubgaussianMGF (X i) c μ) + (hmean : ∀ i, ∫ ω, X i ω ∂μ = 0) + (m : ℕ) {a t : ℝ} (ht : 0 ≤ t) : + μ.real {ω | ∃ k ≤ m, a ≤ ∑ i ∈ Finset.range (k + 1), X i ω} ≤ + Real.exp (-t * a + (m + 1) * (c : ℝ) * t ^ 2 / 2) := by + obtain ⟨F, hs⟩ := exp_partial_sum_submartingale hX hind hmgf hmean t + let f : ℕ → Ω → ℝ := fun k ω => Real.exp (t * ∑ i ∈ Finset.range (k + 1), X i ω) + let A : Set Ω := {ω | Real.exp (t * a) ≤ + (Finset.range (m + 1)).sup' Finset.nonempty_range_add_one (fun k => f k ω)} + have hmax := maximal_ineq (f := f) hs (fun k ω => (Real.exp_pos _).le) + (ε := ⟨Real.exp (t * a), (Real.exp_pos _).le⟩) m + have hr := ENNReal.toReal_mono ENNReal.ofReal_ne_top hmax + have hn : 0 ≤ ∫ ω in A, f m ω ∂μ := integral_nonneg (fun _ => (Real.exp_pos _).le) + have hr' : Real.exp (t * a) * μ.real A ≤ ∫ ω in A, f m ω ∂μ := by + rw [ENNReal.toReal_mul] at hr + change Real.exp (t * a) * μ.real A ≤ + (ENNReal.ofReal (∫ ω in A, f m ω ∂μ)).toReal at hr + rwa [ENNReal.toReal_ofReal hn] at hr + have hsubset : {ω | ∃ k ≤ m, a ≤ ∑ i ∈ Finset.range (k + 1), X i ω} ⊆ A := by + rintro ω ⟨k, hk, hka⟩ + exact (Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left hka ht)).trans + (Finset.le_sup' (fun k => f k ω) (Finset.mem_range.mpr (Nat.lt_succ_of_le hk))) + have htotal : (∫ ω, f m ω ∂μ) ≤ + Real.exp ((m + 1) * (c : ℝ) * t ^ 2 / 2) := by + have h := (HasSubgaussianMGF.sum_of_iIndepFun hind + (s := Finset.range (m + 1)) (fun i _ => hmgf i)).mgf_le t + simpa [f, mgf] using h + have hbound : Real.exp (t * a) * + μ.real {ω | ∃ k ≤ m, a ≤ ∑ i ∈ Finset.range (k + 1), X i ω} ≤ + Real.exp ((m + 1) * (c : ℝ) * t ^ 2 / 2) := by + exact (mul_le_mul_of_nonneg_left (measureReal_mono hsubset) (Real.exp_pos _).le).trans + (hr'.trans ((setIntegral_le_integral (hs.integrable m) + (ae_of_all _ (fun _ => (Real.exp_pos _).le))).trans htotal)) + calc + _ ≤ Real.exp ((m + 1) * (c : ℝ) * t ^ 2 / 2) / Real.exp (t * a) := + (le_div_iff₀ (Real.exp_pos _)).mpr (by simpa only [mul_comm] using hbound) + _ = _ := by rw [← Real.exp_sub]; congr 1; ring + +lemma partial_sum_maximal_tail {X : ℕ → Ω → ℝ} {c : ℝ≥0} + (hX : ∀ i, StronglyMeasurable (X i)) (hind : iIndepFun X μ) + (hmgf : ∀ i, HasSubgaussianMGF (X i) c μ) + (hmean : ∀ i, ∫ ω, X i ω ∂μ = 0) (hc : 0 < c) + (m : ℕ) {a : ℝ} (ha : 0 ≤ a) : + μ.real {ω | ∃ k ≤ m, a ≤ ∑ i ∈ Finset.range (k + 1), X i ω} ≤ + Real.exp (-a ^ 2 / (2 * (m + 1) * (c : ℝ))) := by + have hc' : 0 < (c : ℝ) := hc + have hp : 0 < (m + 1 : ℝ) := by positivity + have h := partial_sum_maximal_exponential hX hind hmgf hmean m + (a := a) (t := a / ((m + 1) * (c : ℝ))) (by positivity) + convert h using 1 + congr 1 + field_simp + ring + +lemma partial_sum_abs_maximal_tail {X : ℕ → Ω → ℝ} {c : ℝ≥0} + (hX : ∀ i, StronglyMeasurable (X i)) (hind : iIndepFun X μ) + (hmgf : ∀ i, HasSubgaussianMGF (X i) c μ) + (hmean : ∀ i, ∫ ω, X i ω ∂μ = 0) (hc : 0 < c) + (m : ℕ) {a : ℝ} (ha : 0 ≤ a) : + μ.real {ω | ∃ k ≤ m, a ≤ |∑ i ∈ Finset.range (k + 1), X i ω|} ≤ + 2 * Real.exp (-a ^ 2 / (2 * (m + 1) * (c : ℝ))) := by + have hp := partial_sum_maximal_tail hX hind hmgf hmean hc m ha + have hn := partial_sum_maximal_tail (X := fun i ω => -X i ω) + (fun i => (hX i).neg) (hind.comp (fun _ x => -x) (fun _ => measurable_neg)) + (fun i => (hmgf i).neg) (fun i => by rw [integral_neg, hmean, neg_zero]) hc m ha + let A : Set Ω := {ω | ∃ k ≤ m, a ≤ ∑ i ∈ Finset.range (k + 1), X i ω} + let B : Set Ω := {ω | ∃ k ≤ m, a ≤ ∑ i ∈ Finset.range (k + 1), -X i ω} + have hs : {ω | ∃ k ≤ m, a ≤ |∑ i ∈ Finset.range (k + 1), X i ω|} ⊆ A ∪ B := by + rintro ω ⟨k, hk, hka⟩ + rcases le_abs.mp hka with h | h + · exact Or.inl ⟨k, hk, h⟩ + · exact Or.inr ⟨k, hk, by simpa only [Finset.sum_neg_distrib] using h⟩ + have h := (measureReal_mono (μ := μ) hs).trans (measureReal_union_le A B) + change μ.real _ ≤ μ.real A + μ.real B at h + change μ.real A ≤ _ at hp + change μ.real B ≤ _ at hn + linarith + +lemma block_prefix_tail {X : ℕ → Ω → ℝ} {c : ℝ≥0} + (hX : ∀ i, StronglyMeasurable (X i)) (hind : iIndepFun X μ) + (hmgf : ∀ i, HasSubgaussianMGF (X i) c μ) + (hmean : ∀ i, ∫ ω, X i ω ∂μ = 0) (hc : 0 < c) + (start m : ℕ) {a : ℝ} (ha : 0 ≤ a) : + μ.real {ω | ∃ k ≤ m, a ≤ |∑ i ∈ Finset.range (k + 1), X (start + i) ω|} ≤ + 2 * Real.exp (-a ^ 2 / (2 * (m + 1) * (c : ℝ))) := by + exact partial_sum_abs_maximal_tail (fun i => hX (start + i)) + (hind.precomp (fun i j h => Nat.add_left_cancel h)) + (fun i => hmgf (start + i)) (fun i => hmean (start + i)) hc m ha + +noncomputable def blockThreshold (c : ℝ≥0) (m j r : ℕ) (h : ℝ) : ℝ := + Real.sqrt (2 * (m + 1) * (c : ℝ) * (h ^ 2 + (j + r : ℕ) * Real.log 16)) + +lemma blockThreshold_sq (c : ℝ≥0) (m j r : ℕ) (h : ℝ) : + blockThreshold c m j r h ^ 2 = + 2 * (m + 1) * (c : ℝ) * (h ^ 2 + (j + r : ℕ) * Real.log 16) := by + apply Real.sq_sqrt + positivity + +lemma block_prefix_dyadic_tail {X : ℕ → Ω → ℝ} {c : ℝ≥0} + (hX : ∀ i, StronglyMeasurable (X i)) (hind : iIndepFun X μ) + (hmgf : ∀ i, HasSubgaussianMGF (X i) c μ) + (hmean : ∀ i, ∫ ω, X i ω ∂μ = 0) (hc : 0 < c) + (start m j r : ℕ) (h : ℝ) : + μ.real {ω | ∃ k ≤ m, blockThreshold c m j r h ≤ + |∑ i ∈ Finset.range (k + 1), X (start + i) ω|} ≤ + 2 * Real.exp (-h ^ 2) * (1 / 16 : ℝ) ^ (j + r) := by + have ht := block_prefix_tail hX hind hmgf hmean hc start m + (a := blockThreshold c m j r h) (Real.sqrt_nonneg _) + rw [blockThreshold_sq] at ht + have hc' : (c : ℝ) ≠ 0 := ne_of_gt hc + have hm : (m + 1 : ℝ) ≠ 0 := by positivity + have he : -(2 * (m + 1) * (c : ℝ) * (h ^ 2 + (j + r : ℕ) * Real.log 16)) / + (2 * (m + 1) * (c : ℝ)) = -h ^ 2 + (j + r : ℕ) * (-Real.log 16) := by + field_simp + ring + rw [he, Real.exp_add, Real.exp_nat_mul, Real.exp_neg (Real.log 16), Real.exp_log (by norm_num : (0 : ℝ) < 16)] at ht + simpa only [one_div, mul_assoc] using ht + +lemma geometric_half_sum_le_two (N : ℕ) : + (∑ j ∈ Finset.range N, (1 / 2 : ℝ) ^ j) ≤ 2 := by + have h := (summable_geometric_of_lt_one (r := (1 / 2 : ℝ)) (by norm_num) (by norm_num)).sum_le_tsum + (Finset.range N) (fun _ _ => by positivity) + rw [tsum_geometric_of_lt_one (by norm_num : (0 : ℝ) ≤ 1 / 2) (by norm_num : (1 / 2 : ℝ) < 1)] at h + norm_num at h ⊢ + exact h + +omit [IsProbabilityMeasure μ] in +lemma finite_scale_shell_union_bound (A : ℕ → ℕ → ℕ → Set Ω) + (B : ℕ → ℕ → Finset ℕ) (J R : ℕ) {C h : ℝ} (hC : 0 ≤ C) + (hcard : ∀ j r, ((B j r).card : ℝ) ≤ C * (8 : ℝ) ^ (j + r)) + (hprob : ∀ j r b, b ∈ B j r → μ.real (A j r b) ≤ + 2 * Real.exp (-h ^ 2) * (1 / 16 : ℝ) ^ (j + r)) : + μ.real (⋃ j ∈ Finset.range J, ⋃ r ∈ Finset.range R, ⋃ b ∈ B j r, A j r b) ≤ + 8 * C * Real.exp (-h ^ 2) := by + have hbr (j r : ℕ) : μ.real (⋃ b ∈ B j r, A j r b) ≤ + 2 * C * Real.exp (-h ^ 2) * (1 / 2 : ℝ) ^ (j + r) := by + calc + _ ≤ ∑ b ∈ B j r, μ.real (A j r b) := measureReal_biUnion_finset_le _ _ + _ ≤ ∑ _b ∈ B j r, 2 * Real.exp (-h ^ 2) * (1 / 16 : ℝ) ^ (j + r) := + Finset.sum_le_sum (fun b hb => hprob j r b hb) + _ = (B j r).card * (2 * Real.exp (-h ^ 2) * (1 / 16 : ℝ) ^ (j + r)) := by simp + _ ≤ (C * (8 : ℝ) ^ (j + r)) * + (2 * Real.exp (-h ^ 2) * (1 / 16 : ℝ) ^ (j + r)) := + mul_le_mul_of_nonneg_right (hcard j r) (by positivity) + _ = _ := by + have he : (8 : ℝ) ^ (j + r) * (1 / 16 : ℝ) ^ (j + r) = (1 / 2 : ℝ) ^ (j + r) := by + rw [← mul_pow] + norm_num + calc + _ = 2 * C * Real.exp (-h ^ 2) * ((8 : ℝ) ^ (j + r) * (1 / 16 : ℝ) ^ (j + r)) := by ring + _ = _ := by rw [he] + calc + _ ≤ ∑ j ∈ Finset.range J, μ.real (⋃ r ∈ Finset.range R, ⋃ b ∈ B j r, A j r b) := + measureReal_biUnion_finset_le _ _ + _ ≤ ∑ j ∈ Finset.range J, ∑ r ∈ Finset.range R, μ.real (⋃ b ∈ B j r, A j r b) := by + exact Finset.sum_le_sum fun _ _ => measureReal_biUnion_finset_le _ _ + _ ≤ ∑ j ∈ Finset.range J, ∑ r ∈ Finset.range R, + 2 * C * Real.exp (-h ^ 2) * (1 / 2 : ℝ) ^ (j + r) := by + exact Finset.sum_le_sum fun j _ => Finset.sum_le_sum fun r _ => hbr j r + _ = 2 * C * Real.exp (-h ^ 2) * + (∑ j ∈ Finset.range J, (1 / 2 : ℝ) ^ j) * + (∑ r ∈ Finset.range R, (1 / 2 : ℝ) ^ r) := by + simp_rw [pow_add, ← mul_assoc, ← Finset.mul_sum, ← Finset.sum_mul] + rw [← Finset.mul_sum] + _ ≤ 2 * C * Real.exp (-h ^ 2) * 2 * 2 := by + gcongr + · exact geometric_half_sum_le_two J + · exact geometric_half_sum_le_two R + _ = _ := by ring + +def blockShell (j : ℕ) : ℕ → Finset ℕ + | 0 => Finset.range (2 * 8 ^ j) + | r + 1 => Finset.Ico (2 ^ (r + 1) * 8 ^ j) (2 ^ (r + 2) * 8 ^ j) + +lemma blockShell_card (j r : ℕ) : + ((blockShell j r).card : ℝ) ≤ 2 * (8 : ℝ) ^ (j + r) := by + cases r with + | zero => simp [blockShell] + | succ r => + have hpow : (2 : ℕ) ^ (r + 1) ≤ 8 ^ (r + 1) := Nat.pow_le_pow_left (by decide) _ + have he : 2 ^ (r + 2) * 8 ^ j - 2 ^ (r + 1) * 8 ^ j = 2 ^ (r + 1) * 8 ^ j := by + rw [show r + 2 = (r + 1) + 1 by omega, pow_succ] + have hid : 2 ^ (r + 1) * 2 * 8 ^ j = 2 * (2 ^ (r + 1) * 8 ^ j) := by ring + rw [hid] + omega + rw [blockShell, Nat.card_Ico, he] + push_cast + rw [pow_add (8 : ℝ) j (r + 1)] + have hp : (2 : ℝ) ^ (r + 1) ≤ 8 ^ (r + 1) := by exact_mod_cast hpow + calc + _ ≤ 8 ^ (r + 1) * (8 : ℝ) ^ j := mul_le_mul_of_nonneg_right hp (by positivity) + _ ≤ _ := by nlinarith [show 0 ≤ (8 : ℝ) ^ j * 8 ^ (r + 1) by positivity] + +lemma blockShell_covers (j b : ℕ) : + ∃ r ≤ b, b ∈ blockShell j r := by + by_cases hb : b < 2 * 8 ^ j + · exact ⟨0, Nat.zero_le _, by simpa [blockShell]⟩ + · have h8 : 0 < (8 : ℕ) ^ j := by positivity + have hq : 2 ≤ b / 8 ^ j := (Nat.le_div_iff_mul_le h8).mpr (Nat.le_of_not_gt hb) + let r := Nat.log 2 (b / 8 ^ j) + have hr : 0 < r := Nat.log_pos (by decide) hq + have hlo : 2 ^ r * 8 ^ j ≤ b := + (Nat.le_div_iff_mul_le h8).mp (Nat.pow_log_le_self 2 (by omega : b / 8 ^ j ≠ 0)) + have hhi : b < 2 ^ (r + 1) * 8 ^ j := + (Nat.div_lt_iff_lt_mul h8).mp (Nat.lt_pow_succ_log_self (by decide) _) + refine ⟨r, (Nat.log_le_self _ _).trans (Nat.div_le_self _ _), ?_⟩ + obtain ⟨r', heq⟩ := Nat.exists_eq_succ_of_ne_zero (Nat.ne_of_gt hr) + rw [heq] at hlo hhi ⊢ + simpa [blockShell, Nat.succ_eq_add_one, Nat.add_assoc] using And.intro hlo hhi + +lemma blockShell_lower (j r b : ℕ) (hr : 0 < r) (hb : b ∈ blockShell j r) : + 2 ^ r * 8 ^ j ≤ b := by + obtain ⟨r', rfl⟩ := Nat.exists_eq_succ_of_ne_zero (Nat.ne_of_gt hr) + exact (Finset.mem_Ico.mp hb).1 + +def multiscaleBad (X : ℕ → Ω → ℝ) (c : ℝ≥0) (d : ℕ → ℕ) + (J N : ℕ) (h : ℝ) : Set Ω := + ⋃ j ∈ Finset.range J, ⋃ r ∈ Finset.range (N + 1), ⋃ b ∈ blockShell j r, + {ω | ∃ k ≤ d j, blockThreshold c (d j) j r h ≤ + |∑ i ∈ Finset.range (k + 1), X (b * (d j + 1) + i) ω|} + +lemma multiscaleBad_measurable (X : ℕ → Ω → ℝ) (hX : ∀ i, Measurable (X i)) + (c : ℝ≥0) (d : ℕ → ℕ) (J N : ℕ) (h : ℝ) : + MeasurableSet (multiscaleBad X c d J N h) := by + unfold multiscaleBad + apply MeasurableSet.iUnion + intro j + apply MeasurableSet.iUnion + intro _ + apply MeasurableSet.iUnion + intro r + apply MeasurableSet.iUnion + intro _ + apply MeasurableSet.iUnion + intro b + apply MeasurableSet.iUnion + intro _ + simp only [Set.ofPred_exists, Set.ofPred_and] + apply MeasurableSet.iUnion + intro k + exact (MeasurableSet.const _).inter + (measurableSet_le measurable_const (Finset.measurable_sum _ (fun i _ => hX _)).abs) + +lemma multiscaleBad_probability {X : ℕ → Ω → ℝ} {c : ℝ≥0} + (hX : ∀ i, StronglyMeasurable (X i)) (hind : iIndepFun X μ) + (hmgf : ∀ i, HasSubgaussianMGF (X i) c μ) + (hmean : ∀ i, ∫ ω, X i ω ∂μ = 0) (hc : 0 < c) + (d : ℕ → ℕ) (J N : ℕ) (h : ℝ) : + μ.real (multiscaleBad X c d J N h) ≤ 16 * Real.exp (-h ^ 2) := by + simpa only [multiscaleBad, show (8 : ℝ) * 2 = 16 by norm_num] using + finite_scale_shell_union_bound + (fun j r b => {ω | ∃ k ≤ d j, blockThreshold c (d j) j r h ≤ + |∑ i ∈ Finset.range (k + 1), X (b * (d j + 1) + i) ω|}) + blockShell J (N + 1) (by norm_num : (0 : ℝ) ≤ 2) + blockShell_card (fun j r b _ => block_prefix_dyadic_tail hX hind hmgf hmean hc _ _ _ _ _) + +omit [MeasurableSpace Ω] in +lemma good_multiscale_prefix {X : ℕ → Ω → ℝ} {c : ℝ≥0} {d : ℕ → ℕ} + {J N : ℕ} {h : ℝ} {ω : Ω} (hω : ω ∉ multiscaleBad X c d J N h) + {j b : ℕ} (hj : j < J) (hb : b ≤ N) : + ∃ r ≤ b, b ∈ blockShell j r ∧ ∀ k ≤ d j, + |∑ i ∈ Finset.range (k + 1), X (b * (d j + 1) + i) ω| ≤ + blockThreshold c (d j) j r h := by + obtain ⟨r, hr, hbr⟩ := blockShell_covers j b + refine ⟨r, hr, hbr, fun k hk => le_of_lt ?_⟩ + by_contra! hbad + apply hω + simp only [multiscaleBad, Set.mem_iUnion, Set.mem_ofPred_eq] + exact ⟨j, Finset.mem_range.mpr hj, r, Finset.mem_range.mpr (by omega), b, hbr, k, hk, hbad⟩ + +omit [MeasurableSpace Ω] in +lemma good_multiscale_prefix_all {X : ℕ → Ω → ℝ} {c : ℝ≥0} {d : ℕ → ℕ} + {J N : ℕ} {h : ℝ} {ω : Ω} (hω : ω ∉ multiscaleBad X c d J N h) + {j r b : ℕ} (hj : j < J) (hr : r ≤ N) (hb : b ∈ blockShell j r) {k : ℕ} (hk : k ≤ d j) : + |∑ i ∈ Finset.range (k + 1), X (b * (d j + 1) + i) ω| ≤ blockThreshold c (d j) j r h := by + apply le_of_lt + by_contra! hbad + apply hω + simp only [multiscaleBad, Set.mem_iUnion, Set.mem_ofPred_eq] + exact ⟨j, Finset.mem_range.mpr hj, r, Finset.mem_range.mpr (by omega), b, hb, k, hk, hbad⟩ + +end + +lemma block_summation_by_parts (ξ w : ℕ → ℝ) (m : ℕ) : + ∑ i ∈ Finset.range m, ξ i * w i = + (∑ i ∈ Finset.range m, ξ i) * w m + + ∑ i ∈ Finset.range m, (∑ j ∈ Finset.range (i + 1), ξ j) * (w i - w (i + 1)) := by + induction m with + | zero => simp + | succ m ih => + rw [Finset.sum_range_succ, ih] + simp only [Finset.sum_range_succ] + ring + +lemma block_zero_sum_bound (ξ w : ℕ → ℝ) (m : ℕ) {B : ℝ} + (htotal : ∑ i ∈ Finset.range (m + 1), ξ i = 0) + (hpref : ∀ k ≤ m, |∑ i ∈ Finset.range (k + 1), ξ i| ≤ B) : + |∑ i ∈ Finset.range (m + 1), ξ i * w i| ≤ + B * ∑ i ∈ Finset.range m, |w (i + 1) - w i| := by + rw [block_summation_by_parts, htotal, zero_mul, zero_add, + Finset.sum_range_succ, htotal, zero_mul, add_zero] + calc + _ ≤ ∑ i ∈ Finset.range m, + |(∑ j ∈ Finset.range (i + 1), ξ j) * (w i - w (i + 1))| := + Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ i ∈ Finset.range m, B * |w (i + 1) - w i| := by + apply Finset.sum_le_sum + intro i hi + rw [abs_mul, abs_sub_comm (w i)] + exact mul_le_mul_of_nonneg_right (hpref i (Nat.le_of_lt (Finset.mem_range.mp hi))) + (abs_nonneg _) + _ = _ := (Finset.mul_sum ..).symm + +lemma block_prefix_weight_bound (ξ w : ℕ → ℝ) (m : ℕ) {B : ℝ} (hB : 0 ≤ B) + (hpref : ∀ k ≤ m, |∑ i ∈ Finset.range (k + 1), ξ i| ≤ B) : + |∑ i ∈ Finset.range (m + 1), ξ i * w i| ≤ + B / (m + 1) * (∑ i ∈ Finset.range (m + 1), |w i|) + + 2 * B * ∑ i ∈ Finset.range m, |w (i + 1) - w i| := by + let avg : ℝ := (∑ i ∈ Finset.range (m + 1), ξ i) / (m + 1) + have hm : 0 < (m + 1 : ℝ) := by positivity + have havg : |avg| ≤ B / (m + 1) := by + dsimp [avg] + rw [abs_div, abs_of_pos hm] + exact div_le_div_of_nonneg_right (hpref m le_rfl) hm.le + have hc (k : ℕ) : (∑ i ∈ Finset.range k, (ξ i - avg)) = + (∑ i ∈ Finset.range k, ξ i) - k * avg := by + simp only [Finset.sum_sub_distrib, Finset.sum_const, Finset.card_range, nsmul_eq_mul] + have hz : ∑ i ∈ Finset.range (m + 1), (ξ i - avg) = 0 := by + rw [hc] + dsimp [avg] + push_cast + field_simp + ring + have hp (k : ℕ) (hk : k ≤ m) : |∑ i ∈ Finset.range (k + 1), (ξ i - avg)| ≤ 2 * B := by + rw [hc] + have hk' : (k + 1 : ℝ) ≤ m + 1 := by exact_mod_cast Nat.succ_le_succ hk + have hpart : |(k + 1 : ℝ) * avg| ≤ B := by + rw [abs_mul, abs_of_nonneg (by positivity : (0 : ℝ) ≤ k + 1)] + calc + _ ≤ (k + 1) * (B / (m + 1)) := mul_le_mul_of_nonneg_left havg (by positivity) + _ ≤ (m + 1) * (B / (m + 1)) := mul_le_mul_of_nonneg_right hk' (by positivity) + _ = B := by field_simp + have ha := abs_sub (∑ i ∈ Finset.range (k + 1), ξ i) ((k + 1 : ℝ) * avg) + push_cast + exact ha.trans (by linarith [hpref k hk]) + have hs := block_zero_sum_bound (fun i => ξ i - avg) w m hz hp + have hid : (∑ i ∈ Finset.range (m + 1), ξ i * w i) = + avg * (∑ i ∈ Finset.range (m + 1), w i) + + (∑ i ∈ Finset.range (m + 1), (ξ i - avg) * w i) := by + rw [Finset.mul_sum, ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro i _ + ring + rw [hid] + refine (abs_add_le _ _).trans (add_le_add ?_ hs) + rw [abs_mul] + exact mul_le_mul havg (Finset.abs_sum_le_sum_abs _ _) (abs_nonneg _) (by positivity) + +instance (m : ℕ) : IsProbabilityMeasure (standardGaussianProduct m) := by + unfold standardGaussianProduct + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (chiRowLaw n) := by + unfold chiRowLaw + infer_instance + +instance (n i : ℕ) : IsProbabilityMeasure (diagonalMarginal n i) := by + exact instIsProbabilityMeasureGaussianReal _ _ + +instance (n : ℕ) : IsProbabilityMeasure (diagonalLaw n) := by + unfold diagonalLaw + infer_instance + +instance (m : ℕ) : IsProbabilityMeasure (standardGaussianProduct m) := by + unfold standardGaussianProduct + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (chiRowLaw n) := by + unfold chiRowLaw + infer_instance + +instance (n i : ℕ) : IsProbabilityMeasure (diagonalMarginal n i) := by + exact instIsProbabilityMeasureGaussianReal _ _ + +instance (n : ℕ) : IsProbabilityMeasure (diagonalLaw n) := by + unfold diagonalLaw + infer_instance + +instance (m : ℕ) : IsProbabilityMeasure (standardGaussianProduct m) := by + unfold standardGaussianProduct + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (chiRowLaw n) := by + unfold chiRowLaw + infer_instance + +instance (n i : ℕ) : IsProbabilityMeasure (diagonalMarginal n i) := by + exact instIsProbabilityMeasureGaussianReal _ _ + +instance (n : ℕ) : IsProbabilityMeasure (diagonalLaw n) := by + unfold diagonalLaw + infer_instance + +instance (m : ℕ) : IsProbabilityMeasure (standardGaussianProduct m) := by + unfold standardGaussianProduct + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (chiRowLaw n) := by + unfold chiRowLaw + infer_instance + +instance (n i : ℕ) : IsProbabilityMeasure (diagonalMarginal n i) := by + exact instIsProbabilityMeasureGaussianReal _ _ + +instance (n : ℕ) : IsProbabilityMeasure (diagonalLaw n) := by + unfold diagonalLaw + infer_instance + +instance (m : ℕ) : IsProbabilityMeasure (standardGaussianProduct m) := by + unfold standardGaussianProduct + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (chiRowLaw n) := by + unfold chiRowLaw + infer_instance + +instance (n i : ℕ) : IsProbabilityMeasure (diagonalMarginal n i) := by + exact instIsProbabilityMeasureGaussianReal _ _ + +instance (n : ℕ) : IsProbabilityMeasure (diagonalLaw n) := by + unfold diagonalLaw + infer_instance + +instance (m : ℕ) : IsProbabilityMeasure (standardGaussianProduct m) := by + unfold standardGaussianProduct + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (chiRowLaw n) := by + unfold chiRowLaw + infer_instance + +instance (n i : ℕ) : IsProbabilityMeasure (diagonalMarginal n i) := by + exact instIsProbabilityMeasureGaussianReal _ _ + +instance (n : ℕ) : IsProbabilityMeasure (diagonalLaw n) := by + unfold diagonalLaw + infer_instance + +instance (m : ℕ) : IsProbabilityMeasure (standardGaussianProduct m) := by + unfold standardGaussianProduct + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (chiRowLaw n) := by + unfold chiRowLaw + infer_instance + +instance (n i : ℕ) : IsProbabilityMeasure (diagonalMarginal n i) := by + exact instIsProbabilityMeasureGaussianReal _ _ + +instance (n : ℕ) : IsProbabilityMeasure (diagonalLaw n) := by + unfold diagonalLaw + infer_instance + +instance (m : ℕ) : IsProbabilityMeasure (standardGaussianProduct m) := by + unfold standardGaussianProduct + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (chiRowLaw n) := by + unfold chiRowLaw + infer_instance + +instance (n i : ℕ) : IsProbabilityMeasure (diagonalMarginal n i) := by + exact instIsProbabilityMeasureGaussianReal _ _ + +instance (n : ℕ) : IsProbabilityMeasure (diagonalLaw n) := by + unfold diagonalLaw + infer_instance + +instance (m : ℕ) : IsProbabilityMeasure (standardGaussianProduct m) := by + unfold standardGaussianProduct + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (chiRowLaw n) := by + unfold chiRowLaw + infer_instance + +instance (n i : ℕ) : IsProbabilityMeasure (diagonalMarginal n i) := by + exact instIsProbabilityMeasureGaussianReal _ _ + +instance (n : ℕ) : IsProbabilityMeasure (diagonalLaw n) := by + unfold diagonalLaw + infer_instance + +instance (m : ℕ) : IsProbabilityMeasure (standardGaussianProduct m) := by + unfold standardGaussianProduct + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (chiRowLaw n) := by + unfold chiRowLaw + infer_instance + +instance (n i : ℕ) : IsProbabilityMeasure (diagonalMarginal n i) := by + exact instIsProbabilityMeasureGaussianReal _ _ + +instance (n : ℕ) : IsProbabilityMeasure (diagonalLaw n) := by + unfold diagonalLaw + infer_instance + +instance (m : ℕ) : IsProbabilityMeasure (standardGaussianProduct m) := by + unfold standardGaussianProduct + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (chiRowLaw n) := by + unfold chiRowLaw + infer_instance + +instance (n i : ℕ) : IsProbabilityMeasure (diagonalMarginal n i) := by + exact instIsProbabilityMeasureGaussianReal _ _ + +instance (n : ℕ) : IsProbabilityMeasure (diagonalLaw n) := by + unfold diagonalLaw + infer_instance + +instance (m : ℕ) : IsProbabilityMeasure (standardGaussianProduct m) := by + unfold standardGaussianProduct + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (chiRowLaw n) := by + unfold chiRowLaw + infer_instance + +instance (n i : ℕ) : IsProbabilityMeasure (diagonalMarginal n i) := by + exact instIsProbabilityMeasureGaussianReal _ _ + +instance (n : ℕ) : IsProbabilityMeasure (diagonalLaw n) := by + unfold diagonalLaw + infer_instance + +instance (m : ℕ) : IsProbabilityMeasure (standardGaussianProduct m) := by + unfold standardGaussianProduct + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (chiRowLaw n) := by + unfold chiRowLaw + infer_instance + +instance (n i : ℕ) : IsProbabilityMeasure (diagonalMarginal n i) := by + exact instIsProbabilityMeasureGaussianReal _ _ + +instance (n : ℕ) : IsProbabilityMeasure (diagonalLaw n) := by + unfold diagonalLaw + infer_instance + +instance (m : ℕ) : IsProbabilityMeasure (standardGaussianProduct m) := by + unfold standardGaussianProduct + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (chiRowLaw n) := by + unfold chiRowLaw + infer_instance + +instance (n i : ℕ) : IsProbabilityMeasure (diagonalMarginal n i) := by + exact instIsProbabilityMeasureGaussianReal _ _ + +instance (n : ℕ) : IsProbabilityMeasure (diagonalLaw n) := by + unfold diagonalLaw + infer_instance + +instance (m : ℕ) : IsProbabilityMeasure (standardGaussianProduct m) := by + unfold standardGaussianProduct + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (chiRowLaw n) := by + unfold chiRowLaw + infer_instance + +instance (n i : ℕ) : IsProbabilityMeasure (diagonalMarginal n i) := by + exact instIsProbabilityMeasureGaussianReal _ _ + +instance (n : ℕ) : IsProbabilityMeasure (diagonalLaw n) := by + unfold diagonalLaw + infer_instance + +instance (m : ℕ) : IsProbabilityMeasure (standardGaussianProduct m) := by + unfold standardGaussianProduct + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (chiRowLaw n) := by + unfold chiRowLaw + infer_instance + +instance (n i : ℕ) : IsProbabilityMeasure (diagonalMarginal n i) := by + exact instIsProbabilityMeasureGaussianReal _ _ + +instance (n : ℕ) : IsProbabilityMeasure (diagonalLaw n) := by + unfold diagonalLaw + infer_instance + +instance (m : ℕ) : IsProbabilityMeasure (standardGaussianProduct m) := by + unfold standardGaussianProduct + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (chiRowLaw n) := by + unfold chiRowLaw + infer_instance + +instance (n i : ℕ) : IsProbabilityMeasure (diagonalMarginal n i) := by + exact instIsProbabilityMeasureGaussianReal _ _ + +instance (n : ℕ) : IsProbabilityMeasure (diagonalLaw n) := by + unfold diagonalLaw + infer_instance + +instance (m : ℕ) : IsProbabilityMeasure (standardGaussianProduct m) := by + unfold standardGaussianProduct + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (chiRowLaw n) := by + unfold chiRowLaw + infer_instance + +instance (n i : ℕ) : IsProbabilityMeasure (diagonalMarginal n i) := by + exact instIsProbabilityMeasureGaussianReal _ _ + +instance (n : ℕ) : IsProbabilityMeasure (diagonalLaw n) := by + unfold diagonalLaw + infer_instance + +instance (m : ℕ) : IsProbabilityMeasure (standardGaussianProduct m) := by + unfold standardGaussianProduct + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (chiRowLaw n) := by + unfold chiRowLaw + infer_instance + +instance (n i : ℕ) : IsProbabilityMeasure (diagonalMarginal n i) := by + exact instIsProbabilityMeasureGaussianReal _ _ + +instance (n : ℕ) : IsProbabilityMeasure (diagonalLaw n) := by + unfold diagonalLaw + infer_instance + +instance (m : ℕ) : IsProbabilityMeasure (standardGaussianProduct m) := by + unfold standardGaussianProduct + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (chiRowLaw n) := by + unfold chiRowLaw + infer_instance + +instance (n i : ℕ) : IsProbabilityMeasure (diagonalMarginal n i) := by + exact instIsProbabilityMeasureGaussianReal _ _ + +instance (n : ℕ) : IsProbabilityMeasure (diagonalLaw n) := by + unfold diagonalLaw + infer_instance + +instance (m : ℕ) : IsProbabilityMeasure (standardGaussianProduct m) := by + unfold standardGaussianProduct + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (chiRowLaw n) := by + unfold chiRowLaw + infer_instance + +instance (n i : ℕ) : IsProbabilityMeasure (diagonalMarginal n i) := by + exact instIsProbabilityMeasureGaussianReal _ _ + +instance (n : ℕ) : IsProbabilityMeasure (diagonalLaw n) := by + unfold diagonalLaw + infer_instance + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/GaussianMatrices.lean b/lean/OAI/MathematicalPhysics/CriticalSK/GaussianMatrices.lean new file mode 100644 index 0000000000000000000000000000000000000000..d0c7c22f4fded513db16ed013bb67d7991bf5d5f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/GaussianMatrices.lean @@ -0,0 +1,885 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open MeasureTheory ProbabilityTheory + +open scoped ENNReal NNReal + +open scoped BigOperators InnerProductSpace +open Module +namespace CriticalSK + + +section + +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + +def alignIsometry (e v : E) : E ≃ₗᵢ[ℝ] E := + Submodule.reflection (ℝ ∙ (v - ‖v‖ • e))ᗮ + +omit [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] in +lemma alignIsometry_apply (e v x : E) : + alignIsometry e v x = x - + (2 * (inner ℝ (v - ‖v‖ • e) x / ‖v - ‖v‖ • e‖ ^ 2)) • (v - ‖v‖ • e) := by + rw [alignIsometry, Submodule.reflection_orthogonal_apply, + Submodule.reflection_singleton_apply] + simp only [RCLike.ofReal_real_eq_id, id_eq, neg_sub, two_smul] + rw [two_mul, add_smul] + +omit [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] in +lemma alignIsometry_align (e v : E) (he : ‖e‖ = 1) : + alignIsometry e v v = ‖v‖ • e := by + apply Submodule.reflection_sub + rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg (norm_nonneg _), he, mul_one] + +lemma alignIsometry_measurable (e : E) : + Measurable (fun p : E × E => alignIsometry e p.1 p.2) := by + simp_rw [alignIsometry_apply] + fun_prop + +lemma random_isometry_gaussian_preserving {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [SFinite μ] (U : Ω → E ≃ₗᵢ[ℝ] E) + (hU : Measurable (fun p : Ω × E => U p.1 p.2)) : + MeasurePreserving (fun p : Ω × E => (p.1, U p.1 p.2)) + (μ.prod (stdGaussian E)) (μ.prod (stdGaussian E)) := by + exact (MeasurePreserving.id μ).skew_product (g := fun ω x => U ω x) + (μc := stdGaussian E) (μd := stdGaussian E) hU + (Filter.Eventually.of_forall (fun ω => stdGaussian_map (U ω))) + +lemma exposed_gaussian_alignment (e : E) : + MeasurePreserving (fun p : E × E => (p.1, alignIsometry e p.1 p.2)) + ((stdGaussian E).prod (stdGaussian E)) ((stdGaussian E).prod (stdGaussian E)) := + random_isometry_gaussian_preserving _ _ (alignIsometry_measurable e) + +lemma covariance_inner_stdGaussian (v w : E) : + cov[fun x => inner ℝ v x, fun x => inner ℝ w x; stdGaussian E] = inner ℝ v w := by + rw [← covarianceBilin_apply_eq_cov IsGaussian.memLp_two_id, + covarianceBilin_stdGaussian] + rfl + +lemma inner_stdGaussian_law (v : E) : + (stdGaussian E).map (fun x => inner ℝ v x) = + gaussianReal 0 (‖v‖ ^ 2).toNNReal := by + have hG : HasGaussianLaw (fun x : E => inner ℝ v x) (stdGaussian E) := + IsGaussian.hasGaussianLaw_id.map_fun (innerSL ℝ v) + rw [hG.map_eq_gaussianReal] + congr 1 + · exact integral_strongDual_stdGaussian (innerSL ℝ v) + · rw [← covariance_self (by fun_prop), covariance_inner_stdGaussian, real_inner_self_eq_norm_sq] + +lemma gaussian_orthogonal_independent {κ : Type*} [Fintype κ] (v : κ → E) + (hv : Pairwise (fun i j => inner ℝ (v i) (v j) = 0)) : + iIndepFun (fun i x => inner ℝ (v i) x) (stdGaussian E) := by + have hG : HasGaussianLaw (fun x : E => fun i => inner ℝ (v i) x) (stdGaussian E) := + IsGaussian.hasGaussianLaw_id.map_fun (ContinuousLinearMap.pi (fun i => innerSL ℝ (v i))) + apply hG.iIndepFun_of_covariance_eq_zero + intro i j hij + rw [covariance_inner_stdGaussian] + exact hv hij + +variable {ι : Type*} [Fintype ι] + +abbrev GaussianMatrix (ι : Type*) [Fintype ι] := + PiLp 2 (fun _ : ι => EuclideanSpace ℝ ι) + +def transposeGaussianMatrix : GaussianMatrix ι ≃ₗᵢ[ℝ] GaussianMatrix ι where + toFun A := WithLp.toLp 2 (fun i => WithLp.toLp 2 (fun j => A j i)) + invFun A := WithLp.toLp 2 (fun i => WithLp.toLp 2 (fun j => A j i)) + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' _ _ := rfl + norm_map' A := by + apply (sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)).mp + simp only [PiLp.norm_sq_eq_of_L2] + exact Finset.sum_comm + +@[simp] lemma transposeGaussianMatrix_apply (A : GaussianMatrix ι) (i j : ι) : + transposeGaussianMatrix A i j = A j i := rfl + +def rowIsometry (U : EuclideanSpace ℝ ι ≃ₗᵢ[ℝ] EuclideanSpace ℝ ι) : + GaussianMatrix ι ≃ₗᵢ[ℝ] GaussianMatrix ι := + LinearIsometryEquiv.piLpCongrRight 2 (fun _ : ι => U) + +@[simp] lemma rowIsometry_apply (U : EuclideanSpace ℝ ι ≃ₗᵢ[ℝ] EuclideanSpace ℝ ι) + (A : GaussianMatrix ι) (i : ι) : rowIsometry U A i = U (A i) := rfl + +def conjugateGaussianMatrix (U : EuclideanSpace ℝ ι ≃ₗᵢ[ℝ] EuclideanSpace ℝ ι) : + GaussianMatrix ι ≃ₗᵢ[ℝ] GaussianMatrix ι := + (rowIsometry U).trans (transposeGaussianMatrix.trans + ((rowIsometry U).trans transposeGaussianMatrix)) + +lemma conjugateGaussianMatrix_preserves (U : EuclideanSpace ℝ ι ≃ₗᵢ[ℝ] EuclideanSpace ℝ ι) : + (stdGaussian (GaussianMatrix ι)).map (conjugateGaussianMatrix U) = + stdGaussian (GaussianMatrix ι) := + stdGaussian_map _ + +lemma euclidean_isometry_apply_eq_sum + (U : EuclideanSpace ℝ ι ≃ₗᵢ[ℝ] EuclideanSpace ℝ ι) + (v : EuclideanSpace ℝ ι) (i : ι) : + U v i = ∑ j, v j * U (EuclideanSpace.basisFun ι ℝ j) i := by + conv_lhs => rw [← (EuclideanSpace.basisFun ι ℝ).sum_repr v, map_sum] + simp + +lemma conjugateGaussianMatrix_apply + (U : EuclideanSpace ℝ ι ≃ₗᵢ[ℝ] EuclideanSpace ℝ ι) + (A : GaussianMatrix ι) (i j : ι) : + conjugateGaussianMatrix U A i j = + ∑ k, ∑ l, U (EuclideanSpace.basisFun ι ℝ k) i * A k l * + U (EuclideanSpace.basisFun ι ℝ l) j := by + simp only [conjugateGaussianMatrix, LinearIsometryEquiv.trans_apply, + transposeGaussianMatrix_apply, rowIsometry_apply] + rw [euclidean_isometry_apply_eq_sum] + apply Finset.sum_congr rfl + intro k _ + simp only [transposeGaussianMatrix_apply, rowIsometry_apply] + rw [euclidean_isometry_apply_eq_sum, Finset.sum_mul] + apply Finset.sum_congr rfl + intro l _ + ring + +lemma conjugateGaussianMatrix_transpose + (U : EuclideanSpace ℝ ι ≃ₗᵢ[ℝ] EuclideanSpace ℝ ι) (A : GaussianMatrix ι) : + conjugateGaussianMatrix U (transposeGaussianMatrix A) = + transposeGaussianMatrix (conjugateGaussianMatrix U A) := by + ext i j + simp only [conjugateGaussianMatrix_apply, transposeGaussianMatrix_apply] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro k _ + apply Finset.sum_congr rfl + intro l _ + ring + +def symmetrizeGaussianMatrix (s : ℝ) (A : GaussianMatrix ι) : GaussianMatrix ι := + s • (A + transposeGaussianMatrix A) + +lemma symmetrizeGaussianMatrix_continuous (s : ℝ) : + Continuous (symmetrizeGaussianMatrix (ι := ι) s) := by + unfold symmetrizeGaussianMatrix + fun_prop + +lemma conjugate_symmetrize (s : ℝ) + (U : EuclideanSpace ℝ ι ≃ₗᵢ[ℝ] EuclideanSpace ℝ ι) (A : GaussianMatrix ι) : + conjugateGaussianMatrix U (symmetrizeGaussianMatrix s A) = + symmetrizeGaussianMatrix s (conjugateGaussianMatrix U A) := by + simp only [symmetrizeGaussianMatrix, map_smul, map_add, + conjugateGaussianMatrix_transpose] + +def goeLaw (ι : Type*) [Fintype ι] (s : ℝ) : Measure (GaussianMatrix ι) := + (stdGaussian (GaussianMatrix ι)).map (symmetrizeGaussianMatrix s) + +lemma goeLaw_conjugate (s : ℝ) + (U : EuclideanSpace ℝ ι ≃ₗᵢ[ℝ] EuclideanSpace ℝ ι) : + (goeLaw ι s).map (conjugateGaussianMatrix U) = goeLaw ι s := by + unfold goeLaw + rw [Measure.map_map (by fun_prop) (symmetrizeGaussianMatrix_continuous s).measurable] + simp only [Function.comp_def, conjugate_symmetrize] + calc + _ = ((stdGaussian (GaussianMatrix ι)).map (conjugateGaussianMatrix U)).map + (symmetrizeGaussianMatrix s) := + (Measure.map_map (symmetrizeGaussianMatrix_continuous s).measurable + (conjugateGaussianMatrix U).continuous.measurable).symm + _ = _ := by rw [conjugateGaussianMatrix_preserves] + +lemma conjugateGaussianMatrix_measurable {Ω : Type*} [MeasurableSpace Ω] + (U : Ω → EuclideanSpace ℝ ι ≃ₗᵢ[ℝ] EuclideanSpace ℝ ι) + (hU : Measurable (fun p : Ω × EuclideanSpace ℝ ι => U p.1 p.2)) : + Measurable (fun p : Ω × GaussianMatrix ι => conjugateGaussianMatrix (U p.1) p.2) := by + have hc (k i : ι) : Measurable (fun ω => U ω (EuclideanSpace.basisFun ι ℝ k) i) := + (by fun_prop : Measurable (fun x : EuclideanSpace ℝ ι => x i)).comp + (hU.comp (measurable_id.prodMk measurable_const)) + change Measurable (fun p : Ω × GaussianMatrix ι => WithLp.toLp 2 + (fun i => WithLp.toLp 2 (fun j => conjugateGaussianMatrix (U p.1) p.2 i j))) + apply (WithLp.measurable_toLp _ _).comp + apply Measurable.of_eval + intro i + apply (WithLp.measurable_toLp _ _).comp + apply Measurable.of_eval + intro j + simp only [conjugateGaussianMatrix_apply] + apply Finset.measurable_sum + intro k _ + apply Finset.measurable_sum + intro l _ + exact ((hc k i).comp measurable_fst |>.mul + ((by fun_prop : Measurable (fun A : GaussianMatrix ι => A k l)).comp measurable_snd)).mul + ((hc l j).comp measurable_fst) + +lemma random_goe_conjugation_preserving {Ω : Type*} [MeasurableSpace Ω] + (μ : Measure Ω) [SFinite μ] (s : ℝ) + (U : Ω → EuclideanSpace ℝ ι ≃ₗᵢ[ℝ] EuclideanSpace ℝ ι) + (hU : Measurable (fun p : Ω × EuclideanSpace ℝ ι => U p.1 p.2)) : + MeasurePreserving (fun p : Ω × GaussianMatrix ι => + (p.1, conjugateGaussianMatrix (U p.1) p.2)) + (μ.prod (goeLaw ι s)) (μ.prod (goeLaw ι s)) := by + let : IsProbabilityMeasure (goeLaw ι s) := + (Measure.isProbabilityMeasure_map_iff + (symmetrizeGaussianMatrix_continuous s).measurable.aemeasurable).2 inferInstance + exact (MeasurePreserving.id μ).skew_product + (g := fun ω A => conjugateGaussianMatrix (U ω) A) + (conjugateGaussianMatrix_measurable U hU) + (Filter.Eventually.of_forall (fun ω => goeLaw_conjugate s (U ω))) + +noncomputable def matrixUnit (i j : ι) : GaussianMatrix ι := by + classical + exact PiLp.single 2 i (EuclideanSpace.single j 1) + +@[simp] lemma matrixUnit_inner (i j : ι) (A : GaussianMatrix ι) : + inner ℝ (matrixUnit i j) A = A i j := by + classical + rw [PiLp.inner_apply] + rw [Finset.sum_eq_single i] + · simp [matrixUnit, EuclideanSpace.inner_single_left] + · intro k _ hki + simp [matrixUnit, hki] + · simp + +@[simp] lemma matrixUnit_apply [DecidableEq ι] (i j k l : ι) : + matrixUnit i j k l = if k = i ∧ l = j then 1 else 0 := by + classical + simp [matrixUnit] + split_ifs <;> simp_all + +def goeEntryVector (s : ℝ) (i j : ι) : GaussianMatrix ι := + s • (matrixUnit i j + matrixUnit j i) + +lemma goeEntryVector_inner (s : ℝ) (i j : ι) (A : GaussianMatrix ι) : + inner ℝ (goeEntryVector s i j) A = symmetrizeGaussianMatrix s A i j := by + simp [goeEntryVector, symmetrizeGaussianMatrix, inner_smul_left, inner_add_left] + +lemma goe_entry_variance [DecidableEq ι] (s : ℝ) (i j : ι) : + ‖goeEntryVector s i j‖ ^ 2 = if i = j then 4 * s ^ 2 else 2 * s ^ 2 := by + classical + rw [← real_inner_self_eq_norm_sq] + simp only [goeEntryVector, real_inner_smul_left, real_inner_smul_right, + inner_add_left, inner_add_right, matrixUnit_inner, matrixUnit_apply] + by_cases hij : i = j + · subst j + simp only [and_self, ite_true] + ring + · have hji : j ≠ i := Ne.symm hij + simp only [hij, hji, and_self, ite_true, ite_false] + ring + +lemma goe_entry_law [DecidableEq ι] (s : ℝ) (i j : ι) : + (goeLaw ι s).map (fun A => A i j) = + gaussianReal 0 (if i = j then (4 * s ^ 2).toNNReal else (2 * s ^ 2).toNNReal) := by + classical + unfold goeLaw + rw [Measure.map_map (by fun_prop) (symmetrizeGaussianMatrix_continuous s).measurable] + simp only [Function.comp_def, ← goeEntryVector_inner] + rw [inner_stdGaussian_law, goe_entry_variance] + split_ifs <;> rfl + +variable [LinearOrder ι] + +abbrev UpperEntry (ι : Type*) [LinearOrder ι] := {p : ι × ι // p.1 ≤ p.2} + +lemma goeEntryVector_orthogonal (s : ℝ) : + Pairwise (fun p q : UpperEntry ι => + inner ℝ (goeEntryVector s p.1.1 p.1.2) (goeEntryVector s q.1.1 q.1.2) = 0) := by + rintro ⟨⟨i, j⟩, hij⟩ ⟨⟨k, l⟩, hkl⟩ hpq + have h1 : ¬(i = k ∧ j = l) := by + rintro ⟨rfl, rfl⟩ + exact hpq rfl + have h2 : ¬(i = l ∧ j = k) := by + intro hs + have he : i = j := le_antisymm hij (by simpa only [hs.1, hs.2] using hkl) + apply hpq + apply Subtype.ext + exact Prod.ext (he.trans hs.2) (he.symm.trans hs.1) + simp only [goeEntryVector, real_inner_smul_left, real_inner_smul_right, + inner_add_left, inner_add_right, matrixUnit_inner, matrixUnit_apply] + simp only [h1, h2, ite_false, add_zero, mul_zero, + show ¬(j = k ∧ i = l) from fun h => h2 ⟨h.2, h.1⟩, + show ¬(j = l ∧ i = k) from fun h => h1 ⟨h.2, h.1⟩] + +lemma goe_entries_independent (s : ℝ) : + iIndepFun (fun p : UpperEntry ι => fun A : GaussianMatrix ι => A p.1.1 p.1.2) + (goeLaw ι s) := by + have h := gaussian_orthogonal_independent + (fun p : UpperEntry ι => goeEntryVector s p.1.1 p.1.2) (goeEntryVector_orthogonal s) + simp only [goeEntryVector_inner] at h + let : IsProbabilityMeasure (goeLaw ι s) := + (Measure.isProbabilityMeasure_map_iff + (symmetrizeGaussianMatrix_continuous s).measurable.aemeasurable).2 inferInstance + apply (iIndepFun_iff_map_fun_eq_pi_map (fun _ => by fun_prop)).2 + unfold goeLaw + rw [Measure.map_map (by fun_prop) (symmetrizeGaussianMatrix_continuous s).measurable] + have hh := h.map_fun_eq_pi_map (fun _ => by fun_prop) + simp only [Function.comp_def] at * + rw [hh] + congr 1 + ext p : 1 + exact (Measure.map_map (g := fun A : GaussianMatrix ι => A p.1.1 p.1.2) (by fun_prop) + (symmetrizeGaussianMatrix_continuous s).measurable).symm + +end + +section + +open scoped NNReal + +section Upper + +variable {ι : Type*} [Fintype ι] [LinearOrder ι] + +def upperRead (A : GaussianMatrix ι) : UpperEntry ι → ℝ := fun p => A p.1.1 p.1.2 + +def upperWrite (a : UpperEntry ι → ℝ) : GaussianMatrix ι := + WithLp.toLp 2 (fun i => WithLp.toLp 2 (fun j => + if h : i ≤ j then a ⟨(i, j), h⟩ else a ⟨(j, i), (le_of_not_ge h)⟩)) + +lemma upperRead_measurable : Measurable (upperRead (ι := ι)) := by + apply Measurable.of_eval + intro p + fun_prop [upperRead] + +lemma upperWrite_measurable : Measurable (upperWrite (ι := ι)) := by + apply (WithLp.measurable_toLp _ _).comp + apply Measurable.of_eval + intro i + apply (WithLp.measurable_toLp _ _).comp + apply Measurable.of_eval + intro j + dsimp [upperWrite] + split_ifs <;> fun_prop + +lemma upperWrite_upperRead (A : GaussianMatrix ι) (hA : ∀ i j, A i j = A j i) : + upperWrite (upperRead A) = A := by + ext i j + dsimp [upperWrite, upperRead] + split_ifs + · rfl + · exact hA j i + +@[simp] lemma upperRead_upperWrite (a : UpperEntry ι → ℝ) : + upperRead (upperWrite a) = a := by + funext p + exact dite_eq_left p.2 + +lemma goe_symmetric_ae (s : ℝ) : ∀ᵐ A ∂goeLaw ι s, ∀ i j, A i j = A j i := by + rw [goeLaw] + apply (ae_map_iff (symmetrizeGaussianMatrix_continuous s).measurable.aemeasurable (by measurability)).2 + filter_upwards [] with A i j + simp only [symmetrizeGaussianMatrix, PiLp.smul_apply, PiLp.add_apply, + transposeGaussianMatrix_apply, smul_eq_mul] + ring + +lemma goe_upper_law (s : ℝ) : + (goeLaw ι s).map upperRead = Measure.pi (fun p : UpperEntry ι => + gaussianReal 0 (if p.1.1 = p.1.2 then (4 * s^2).toNNReal else (2 * s^2).toNNReal)) := by + unfold upperRead + rw [(goe_entries_independent (ι := ι) s).map_fun_eq_pi_map (fun _ => by fun_prop)] + congr 1 + funext p + exact goe_entry_law s p.1.1 p.1.2 + +lemma goeLaw_eq_upper_product (s : ℝ) : + goeLaw ι s = (Measure.pi (fun p : UpperEntry ι => + gaussianReal 0 (if p.1.1 = p.1.2 then (4 * s^2).toNNReal else (2 * s^2).toNNReal))).map + upperWrite := by + rw [← goe_upper_law, Measure.map_map upperWrite_measurable upperRead_measurable] + have heq : (upperWrite ∘ upperRead : GaussianMatrix ι → GaussianMatrix ι) =ᵐ[goeLaw ι s] id := by + filter_upwards [goe_symmetric_ae (ι := ι) s] with A hA + exact upperWrite_upperRead A hA + rw [Measure.map_congr heq, Measure.map_id] + +end Upper + +def upperSplit (n : ℕ) : Unit ⊕ (Fin n ⊕ UpperEntry (Fin n)) ≃ UpperEntry (Fin (n + 1)) := + Equiv.ofBijective + (fun x => match x with + | Sum.inl _ => ⟨(0, 0), le_rfl⟩ + | Sum.inr (Sum.inl i) => ⟨(0, i.succ), Fin.zero_le _⟩ + | Sum.inr (Sum.inr p) => ⟨(p.1.1.succ, p.1.2.succ), Fin.succ_le_succ_iff.mpr p.2⟩) + ⟨by + intro x y h + have hz (i : Fin n) : (0 : Fin (n + 1)) ≠ i.succ := (Fin.succ_ne_zero i).symm + rcases x with u | (i | p) <;> rcases y with v | (j | q) + all_goals simp_all [Subtype.ext_iff, Prod.ext_iff] + , by + rintro ⟨⟨i, j⟩, hij⟩ + cases i using Fin.cases with + | zero => + cases j using Fin.cases with + | zero => exact ⟨Sum.inl (), rfl⟩ + | succ j => exact ⟨Sum.inr (Sum.inl j), rfl⟩ + | succ i => + cases j using Fin.cases with + | zero => simp at hij + | succ j => exact ⟨Sum.inr (Sum.inr ⟨(i, j), Fin.succ_le_succ_iff.mp hij⟩), rfl⟩⟩ + +@[simp] lemma upperSplit_diag (n : ℕ) : upperSplit n (Sum.inl ()) = ⟨(0, 0), le_rfl⟩ := rfl + +@[simp] lemma upperSplit_column (n : ℕ) (i : Fin n) : + upperSplit n (Sum.inr (Sum.inl i)) = ⟨(0, i.succ), Fin.zero_le _⟩ := rfl + +@[simp] lemma upperSplit_tail (n : ℕ) (p : UpperEntry (Fin n)) : + upperSplit n (Sum.inr (Sum.inr p)) = + ⟨(p.1.1.succ, p.1.2.succ), Fin.succ_le_succ_iff.mpr p.2⟩ := rfl + +def goeUpperMarginal {ι : Type*} [LinearOrder ι] (s : ℝ) (p : UpperEntry ι) : Measure ℝ := + gaussianReal 0 (if p.1.1 = p.1.2 then (4 * s^2).toNNReal else (2 * s^2).toNNReal) + +instance goeUpperMarginal_probability {ι : Type*} [LinearOrder ι] (s : ℝ) (p : UpperEntry ι) : + IsProbabilityMeasure (goeUpperMarginal s p) := by + unfold goeUpperMarginal + infer_instance + +def splitUpper (n : ℕ) (a : UpperEntry (Fin (n + 1)) → ℝ) : + ℝ × ((Fin n → ℝ) × (UpperEntry (Fin n) → ℝ)) := + (a ⟨(0, 0), le_rfl⟩, ((fun i => a ⟨(0, i.succ), Fin.zero_le _⟩), + fun p => a ⟨(p.1.1.succ, p.1.2.succ), Fin.succ_le_succ_iff.mpr p.2⟩)) + +lemma splitUpper_preserving (n : ℕ) (s : ℝ) : + MeasurePreserving (splitUpper n) (Measure.pi (goeUpperMarginal (ι := Fin (n + 1)) s)) + ((gaussianReal 0 (4 * s^2).toNNReal).prod + ((Measure.pi fun _ : Fin n => gaussianReal 0 (2 * s^2).toNNReal).prod + (Measure.pi (goeUpperMarginal (ι := Fin n) s)))) := by + let μ := goeUpperMarginal (ι := Fin (n + 1)) s + have h1 := (measurePreserving_piCongrLeft μ (upperSplit n)).symm + have h2 := measurePreserving_sumPiEquivProdPi (fun i => μ (upperSplit n i)) + have h3 := (measurePreserving_piUnique (fun u : Unit => μ (upperSplit n (Sum.inl u)))).prod + (measurePreserving_sumPiEquivProdPi (fun i => μ (upperSplit n (Sum.inr i)))) + have h := h3.comp (h2.comp h1) + convert h using 1 + · rfl + · dsimp [μ, goeUpperMarginal] + simp only [Fin.succ_inj, (Ne.symm (Fin.succ_ne_zero _)), ite_false] + rfl + +open scoped BigOperators + +def extendTailIsometry {n : ℕ} + (U : EuclideanSpace ℝ (Fin n) ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n)) : + EuclideanSpace ℝ (Fin (n + 1)) ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin (n + 1)) where + toFun x := WithLp.toLp 2 (Fin.cases (x 0) (U (WithLp.toLp 2 (fun i => x i.succ)))) + invFun x := WithLp.toLp 2 (Fin.cases (x 0) (U.symm (WithLp.toLp 2 (fun i => x i.succ)))) + left_inv x := by + ext i + cases i using Fin.cases with + | zero => rfl + | succ i => change U.symm (U (WithLp.toLp 2 (fun j => x j.succ))) i = x i.succ; simp + right_inv x := by + ext i + cases i using Fin.cases with + | zero => rfl + | succ i => change U (U.symm (WithLp.toLp 2 (fun j => x j.succ))) i = x i.succ; simp + map_add' x y := by + ext i + cases i using Fin.cases with + | zero => rfl + | succ i => + change U ((WithLp.toLp 2 (fun j => x j.succ)) + (WithLp.toLp 2 (fun j => y j.succ))) i = _ + simp + map_smul' c x := by + ext i + cases i using Fin.cases with + | zero => rfl + | succ i => + change U (c • WithLp.toLp 2 (fun j => x j.succ)) i = _ + simp + norm_map' x := by + change ‖(WithLp.toLp 2 (Fin.cases (x 0) (U (WithLp.toLp 2 (fun i => x i.succ)))) : EuclideanSpace ℝ (Fin (n + 1)))‖ = ‖x‖ + apply (sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)).mp + have h := congrArg (fun r : ℝ => r^2) (U.norm_map (WithLp.toLp 2 (fun j => x j.succ))) + simp only [PiLp.norm_sq_eq_of_L2] at h ⊢ + simpa only [Fin.sum_univ_succ, Fin.cases_zero, Fin.cases_succ, PiLp.toLp_apply] using + congrArg (fun t : ℝ => ‖x 0‖ ^ 2 + t) h + +@[simp] lemma extendTailIsometry_zero {n : ℕ} + (U : EuclideanSpace ℝ (Fin n) ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n)) + (x : EuclideanSpace ℝ (Fin (n + 1))) : extendTailIsometry U x 0 = x 0 := rfl + +@[simp] lemma extendTailIsometry_succ {n : ℕ} + (U : EuclideanSpace ℝ (Fin n) ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n)) + (x : EuclideanSpace ℝ (Fin (n + 1))) (i : Fin n) : + extendTailIsometry U x i.succ = U (WithLp.toLp 2 (fun j => x j.succ)) i := rfl + +@[simp] lemma extendTailIsometry_basis_zero {n : ℕ} + (U : EuclideanSpace ℝ (Fin n) ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n)) : + extendTailIsometry U (EuclideanSpace.basisFun (Fin (n + 1)) ℝ 0) = + EuclideanSpace.basisFun (Fin (n + 1)) ℝ 0 := by + ext i + cases i using Fin.cases with + | zero => rfl + | succ i => + simp only [extendTailIsometry_succ, EuclideanSpace.basisFun_apply] + have h : (WithLp.toLp 2 fun j : Fin n => (EuclideanSpace.single 0 (1 : ℝ)) j.succ) = 0 := by + ext j; simp + rw [h, map_zero] + simp + +lemma extendTailIsometry_basis_succ {n : ℕ} + (U : EuclideanSpace ℝ (Fin n) ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n)) (k : Fin n) : + extendTailIsometry U (EuclideanSpace.basisFun (Fin (n + 1)) ℝ k.succ) = + WithLp.toLp 2 (Fin.cases 0 (U (EuclideanSpace.basisFun (Fin n) ℝ k))) := by + ext i + cases i using Fin.cases with + | zero => simp + | succ i => + simp only [extendTailIsometry_succ, Fin.cases_succ] + apply congrArg (fun w : EuclideanSpace ℝ (Fin n) => U w i) + ext j + simp + +def borderMatrix {n : ℕ} (a : ℝ) (v : EuclideanSpace ℝ (Fin n)) + (B : GaussianMatrix (Fin n)) : GaussianMatrix (Fin (n + 1)) := + WithLp.toLp 2 (Fin.cases (WithLp.toLp 2 (Fin.cases a v)) + (fun i => WithLp.toLp 2 (Fin.cases (v i) (B i)))) + +@[simp] lemma borderMatrix_zero_zero {n : ℕ} (a : ℝ) (v : EuclideanSpace ℝ (Fin n)) + (B : GaussianMatrix (Fin n)) : borderMatrix a v B 0 0 = a := rfl + +@[simp] lemma borderMatrix_zero_succ {n : ℕ} (a : ℝ) (v : EuclideanSpace ℝ (Fin n)) + (B : GaussianMatrix (Fin n)) (i : Fin n) : borderMatrix a v B 0 i.succ = v i := rfl + +@[simp] lemma borderMatrix_succ_zero {n : ℕ} (a : ℝ) (v : EuclideanSpace ℝ (Fin n)) + (B : GaussianMatrix (Fin n)) (i : Fin n) : borderMatrix a v B i.succ 0 = v i := rfl + +@[simp] lemma borderMatrix_succ_succ {n : ℕ} (a : ℝ) (v : EuclideanSpace ℝ (Fin n)) + (B : GaussianMatrix (Fin n)) (i j : Fin n) : borderMatrix a v B i.succ j.succ = B i j := rfl + +lemma extendTailIsometry_border {n : ℕ} + (U : EuclideanSpace ℝ (Fin n) ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n)) + (a : ℝ) (v : EuclideanSpace ℝ (Fin n)) (B : GaussianMatrix (Fin n)) : + conjugateGaussianMatrix (extendTailIsometry U) (borderMatrix a v B) = + borderMatrix a (U v) (conjugateGaussianMatrix U B) := by + classical + ext i j + cases i using Fin.cases <;> cases j using Fin.cases + all_goals simp only [conjugateGaussianMatrix_apply, Fin.sum_univ_succ] + all_goals simp only [extendTailIsometry_basis_zero, extendTailIsometry_basis_succ] + all_goals simp only [Fin.cases_zero, Fin.cases_succ, + EuclideanSpace.basisFun_apply] + all_goals simp only [PiLp.single_apply, Fin.succ_ne_zero, + ite_true, ite_false, borderMatrix_zero_zero, borderMatrix_zero_succ, + borderMatrix_succ_zero, borderMatrix_succ_succ, zero_mul, mul_zero, + one_mul, mul_one, Finset.sum_const_zero, add_zero, zero_add] + · simpa only [EuclideanSpace.basisFun_apply] using (euclidean_isometry_apply_eq_sum U v _).symm + · rw [euclidean_isometry_apply_eq_sum] + apply Finset.sum_congr rfl + intro k _ + simp only [EuclideanSpace.basisFun_apply, mul_comm] + · simpa only [EuclideanSpace.basisFun_apply] using (conjugateGaussianMatrix_apply U B _ _).symm + +instance goeLaw_probability {ι : Type*} [Fintype ι] (s : ℝ) : + IsProbabilityMeasure (goeLaw ι s) := + (Measure.isProbabilityMeasure_map_iff + (symmetrizeGaussianMatrix_continuous s).measurable.aemeasurable).2 inferInstance + +def matrixTail {n : ℕ} (A : GaussianMatrix (Fin (n + 1))) : GaussianMatrix (Fin n) := + WithLp.toLp 2 (fun i => WithLp.toLp 2 (fun j => A i.succ j.succ)) + +def goeBlocks {n : ℕ} (A : GaussianMatrix (Fin (n + 1))) : + ℝ × ((Fin n → ℝ) × GaussianMatrix (Fin n)) := + (A 0 0, (fun i => A 0 i.succ, matrixTail A)) + +lemma matrixTail_measurable (n : ℕ) : Measurable (matrixTail (n := n)) := by + apply (WithLp.measurable_toLp _ _).comp + apply Measurable.of_eval + intro i + apply (WithLp.measurable_toLp _ _).comp + apply Measurable.of_eval + intro j + fun_prop [matrixTail] + +lemma goeBlocks_measurable (n : ℕ) : Measurable (goeBlocks (n := n)) := by + exact (by fun_prop : Measurable fun A : GaussianMatrix (Fin (n+1)) => A 0 0).prodMk + ((Measurable.of_eval (fun _ => by fun_prop)).prodMk (matrixTail_measurable n)) + +lemma borderMatrix_blocks {n : ℕ} (A : GaussianMatrix (Fin (n + 1))) + (hA : ∀ i j, A i j = A j i) : + borderMatrix (goeBlocks A).1 (WithLp.toLp 2 (goeBlocks A).2.1) (goeBlocks A).2.2 = A := by + ext i j + cases i using Fin.cases <;> cases j using Fin.cases + · rfl + · rfl + · exact hA _ _ + · rfl + +lemma goeBlocks_preserving (n : ℕ) (s : ℝ) : + MeasurePreserving (goeBlocks (n := n)) (goeLaw (Fin (n + 1)) s) + ((gaussianReal 0 (4 * s^2).toNNReal).prod + ((Measure.pi fun _ : Fin n => gaussianReal 0 (2 * s^2).toNNReal).prod + (goeLaw (Fin n) s))) := by + let μ := Measure.pi (goeUpperMarginal (ι := Fin (n+1)) s) + have hw : MeasurePreserving (upperWrite (ι := Fin n)) + (Measure.pi (goeUpperMarginal s)) (goeLaw (Fin n) s) := + ⟨upperWrite_measurable, (goeLaw_eq_upper_product s).symm⟩ + have hr : MeasurePreserving (upperRead (ι := Fin (n+1))) (goeLaw (Fin (n+1)) s) μ := + ⟨upperRead_measurable, goe_upper_law s⟩ + have hp := (MeasurePreserving.id (gaussianReal 0 (4 * s^2).toNNReal)).prod + ((MeasurePreserving.id (Measure.pi fun _ : Fin n => gaussianReal 0 (2 * s^2).toNNReal)).prod hw) + have h := hp.comp ((splitUpper_preserving n s).comp hr) + refine ⟨goeBlocks_measurable n, ?_⟩ + rw [← h.map_eq] + apply Measure.map_congr + filter_upwards [goe_symmetric_ae (ι := Fin (n+1)) s] with A hA + dsimp only [Function.comp_apply, Prod.map_apply, id_eq, splitUpper, upperRead, goeBlocks] + refine Prod.ext rfl (Prod.ext rfl ?_) + change matrixTail A = upperWrite (upperRead (matrixTail A)) + exact (upperWrite_upperRead _ (fun i j => hA i.succ j.succ)).symm + +lemma aligned_goeBlock_preserving (n : ℕ) (s : ℝ) + (e : EuclideanSpace ℝ (Fin n)) : + MeasurePreserving (fun p : (Fin n → ℝ) × GaussianMatrix (Fin n) => + (p.1, conjugateGaussianMatrix (alignIsometry e (WithLp.toLp 2 p.1)) p.2)) + ((Measure.pi fun _ : Fin n => gaussianReal 0 (2 * s^2).toNNReal).prod (goeLaw (Fin n) s)) + ((Measure.pi fun _ : Fin n => gaussianReal 0 (2 * s^2).toNNReal).prod (goeLaw (Fin n) s)) := by + have hm : Measurable (fun p : (Fin n → ℝ) × EuclideanSpace ℝ (Fin n) => + alignIsometry e (WithLp.toLp 2 p.1) p.2) := by + simp_rw [alignIsometry_apply] + fun_prop + exact random_goe_conjugation_preserving + (Measure.pi fun _ : Fin n => gaussianReal 0 (2 * s^2).toNNReal) s + (fun v : Fin n → ℝ => alignIsometry e (WithLp.toLp 2 v)) hm + +lemma exposed_column_tail_law (n : ℕ) (s : ℝ) (e : EuclideanSpace ℝ (Fin n)) : + MeasurePreserving (fun A : GaussianMatrix (Fin (n+1)) => + (A 0 0, (fun i => A 0 i.succ, + conjugateGaussianMatrix (alignIsometry e (WithLp.toLp 2 (fun i => A 0 i.succ))) + (matrixTail A)))) + (goeLaw (Fin (n+1)) s) + ((gaussianReal 0 (4 * s^2).toNNReal).prod + ((Measure.pi fun _ : Fin n => gaussianReal 0 (2 * s^2).toNNReal).prod + (goeLaw (Fin n) s))) := + ((MeasurePreserving.id _).prod (aligned_goeBlock_preserving n s e)).comp (goeBlocks_preserving n s) + +lemma goe_step_conjugate {n : ℕ} (e : EuclideanSpace ℝ (Fin n)) (he : ‖e‖ = 1) + (A : GaussianMatrix (Fin (n+1))) (hA : ∀ i j, A i j = A j i) : + conjugateGaussianMatrix + (extendTailIsometry (alignIsometry e (WithLp.toLp 2 (fun i => A 0 i.succ)))) A = + borderMatrix (A 0 0) (‖(WithLp.toLp 2 (fun i => A 0 i.succ) : EuclideanSpace ℝ (Fin n))‖ • e) + (conjugateGaussianMatrix (alignIsometry e (WithLp.toLp 2 (fun i => A 0 i.succ))) + (matrixTail A)) := by + conv_lhs => arg 2; rw [← borderMatrix_blocks A hA] + rw [extendTailIsometry_border] + dsimp only [goeBlocks] + rw [alignIsometry_align _ _ he] + +end + +section + +open scoped BigOperators + +variable {ι : Type*} [Fintype ι] + +def orthoMatrix (U : EuclideanSpace ℝ ι ≃ₗᵢ[ℝ] EuclideanSpace ℝ ι) : Matrix ι ι ℝ := + fun i j => U (EuclideanSpace.basisFun ι ℝ j) i + +def matrixOfGaussian (A : GaussianMatrix ι) : Matrix ι ι ℝ := fun i j => A i j + +lemma matrixOfGaussian_injective : Function.Injective (matrixOfGaussian (ι := ι)) := by + intro A B h + ext i j + exact congrFun (congrFun h i) j + +lemma orthoMatrix_trans (U V : EuclideanSpace ℝ ι ≃ₗᵢ[ℝ] EuclideanSpace ℝ ι) : + orthoMatrix (U.trans V) = orthoMatrix V * orthoMatrix U := by + ext i j + change V (U (EuclideanSpace.basisFun ι ℝ j)) i = _ + rw [euclidean_isometry_apply_eq_sum] + simp only [Matrix.mul_apply, orthoMatrix] + apply Finset.sum_congr rfl + intros + ring + +lemma matrixOfGaussian_conjugate (U : EuclideanSpace ℝ ι ≃ₗᵢ[ℝ] EuclideanSpace ℝ ι) + (A : GaussianMatrix ι) : + matrixOfGaussian (conjugateGaussianMatrix U A) = + orthoMatrix U * matrixOfGaussian A * (orthoMatrix U).transpose := by + ext i j + simp only [matrixOfGaussian, conjugateGaussianMatrix_apply, Matrix.mul_apply, + Matrix.transpose_apply, orthoMatrix, Finset.sum_mul] + rw [Finset.sum_comm] + +lemma conjugateGaussianMatrix_trans (U V : EuclideanSpace ℝ ι ≃ₗᵢ[ℝ] EuclideanSpace ℝ ι) + (A : GaussianMatrix ι) : + conjugateGaussianMatrix (U.trans V) A = + conjugateGaussianMatrix V (conjugateGaussianMatrix U A) := by + apply matrixOfGaussian_injective + simp only [matrixOfGaussian_conjugate, orthoMatrix_trans, Matrix.transpose_mul] + simp only [Matrix.mul_assoc] + +lemma conjugate_symmetric (U : EuclideanSpace ℝ ι ≃ₗᵢ[ℝ] EuclideanSpace ℝ ι) + (A : GaussianMatrix ι) (hA : ∀ i j, A i j = A j i) : + ∀ i j, conjugateGaussianMatrix U A i j = conjugateGaussianMatrix U A j i := by + have hT : transposeGaussianMatrix A = A := by ext i j; exact hA j i + have h := conjugateGaussianMatrix_transpose U A + rw [hT] at h + intro i j + exact congrArg (fun B : GaussianMatrix ι => B i j) h + +end + +open scoped BigOperators + +def firstAxis (n : ℕ) : EuclideanSpace ℝ (Fin n) := + WithLp.toLp 2 (fun i => if i.val = 0 then 1 else 0) + +lemma firstAxis_succ (n : ℕ) : firstAxis (n+1) = EuclideanSpace.basisFun (Fin (n+1)) ℝ 0 := by + ext i + cases i using Fin.cases <;> simp [firstAxis, EuclideanSpace.basisFun_apply] + +lemma firstAxis_norm_succ (n : ℕ) : ‖firstAxis (n+1)‖ = 1 := by + rw [firstAxis_succ] + exact (EuclideanSpace.basisFun (Fin (n+1)) ℝ).orthonormal.norm_eq_one 0 + +lemma align_firstAxis (n : ℕ) (v : EuclideanSpace ℝ (Fin n)) : + alignIsometry (firstAxis n) v v = ‖v‖ • firstAxis n := by + cases n with + | zero => exact Subsingleton.elim _ _ + | succ n => exact alignIsometry_align _ _ (firstAxis_norm_succ n) + +lemma extendTailIsometry_firstAxis {n : ℕ} + (U : EuclideanSpace ℝ (Fin n) ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n)) : + extendTailIsometry U (firstAxis (n+1)) = firstAxis (n+1) := by + rw [firstAxis_succ] + exact extendTailIsometry_basis_zero U + +def firstColumn {n : ℕ} (A : GaussianMatrix (Fin (n+1))) : EuclideanSpace ℝ (Fin n) := + WithLp.toLp 2 (fun i => A 0 i.succ) + +def reducedTail {n : ℕ} (A : GaussianMatrix (Fin (n+1))) : GaussianMatrix (Fin n) := + conjugateGaussianMatrix (alignIsometry (firstAxis n) (firstColumn A)) (matrixTail A) + +lemma reducedTail_symmetric {n : ℕ} (A : GaussianMatrix (Fin (n+1))) + (hA : ∀ i j, A i j = A j i) : ∀ i j, reducedTail A i j = reducedTail A j i := + conjugate_symmetric _ _ (fun i j => hA i.succ j.succ) + +@[fun_prop] lemma firstColumn_measurable (n : ℕ) : Measurable (firstColumn (n := n)) := by + apply (WithLp.measurable_toLp _ _).comp + apply Measurable.of_eval + intro i + fun_prop [firstColumn] + +lemma reducedTail_measurable (n : ℕ) : Measurable (reducedTail (n := n)) := by + have hm := (exposed_column_tail_law n 1 (firstAxis n)).measurable + have ht : Measurable (fun p : ℝ × ((Fin n → ℝ) × GaussianMatrix (Fin n)) => p.2.2) := + measurable_snd.comp measurable_snd + exact ht.comp hm + +lemma first_step_conjugate {n : ℕ} (A : GaussianMatrix (Fin (n+1))) + (hA : ∀ i j, A i j = A j i) : + conjugateGaussianMatrix (extendTailIsometry (alignIsometry (firstAxis n) (firstColumn A))) A = + borderMatrix (A 0 0) (‖firstColumn A‖ • firstAxis n) (reducedTail A) := by + conv_lhs => arg 2; rw [← borderMatrix_blocks A hA] + rw [extendTailIsometry_border] + dsimp only [goeBlocks] + change borderMatrix (A 0 0) (alignIsometry (firstAxis n) (firstColumn A) (firstColumn A)) + (reducedTail A) = _ + rw [align_firstAxis] + +def triReduce : (n : ℕ) → GaussianMatrix (Fin n) → GaussianMatrix (Fin n) + | 0, A => A + | n+1, A => borderMatrix (A 0 0) (‖firstColumn A‖ • firstAxis n) (triReduce n (reducedTail A)) + +def triIsometry : (n : ℕ) → GaussianMatrix (Fin n) → + (EuclideanSpace ℝ (Fin n) ≃ₗᵢ[ℝ] EuclideanSpace ℝ (Fin n)) + | 0, _ => LinearIsometryEquiv.refl _ _ + | n+1, A => (extendTailIsometry (alignIsometry (firstAxis n) (firstColumn A))).trans + (extendTailIsometry (triIsometry n (reducedTail A))) + +lemma triIsometry_firstAxis (n : ℕ) (A : GaussianMatrix (Fin n)) : + triIsometry n A (firstAxis n) = firstAxis n := by + cases n with + | zero => rfl + | succ n => simp only [triIsometry, LinearIsometryEquiv.trans_apply, extendTailIsometry_firstAxis] + +lemma triReduce_conjugate (n : ℕ) (A : GaussianMatrix (Fin n)) + (hA : ∀ i j, A i j = A j i) : + triReduce n A = conjugateGaussianMatrix (triIsometry n A) A := by + induction n with + | zero => exact Subsingleton.elim _ _ + | succ n ih => + rw [triIsometry, conjugateGaussianMatrix_trans, first_step_conjugate A hA, + extendTailIsometry_border] + simp only [map_smul, triIsometry_firstAxis] + rw [← ih _ (reducedTail_symmetric A hA)] + rfl + +lemma borderMatrix_measurable (n : ℕ) : + Measurable (fun p : ℝ × (EuclideanSpace ℝ (Fin n) × GaussianMatrix (Fin n)) => + borderMatrix p.1 p.2.1 p.2.2) := by + apply (WithLp.measurable_toLp _ _).comp + apply Measurable.of_eval + intro i + apply (WithLp.measurable_toLp _ _).comp + apply Measurable.of_eval + intro j + change Measurable (fun p : ℝ × (EuclideanSpace ℝ (Fin n) × GaussianMatrix (Fin n)) => + borderMatrix p.1 p.2.1 p.2.2 i j) + cases i using Fin.cases <;> cases j using Fin.cases + all_goals simp only [borderMatrix_zero_zero, borderMatrix_zero_succ, + borderMatrix_succ_zero, borderMatrix_succ_succ] + all_goals fun_prop + +lemma triReduce_measurable (n : ℕ) : Measurable (triReduce n) := by + induction n with + | zero => exact measurable_id + | succ n ih => + exact (borderMatrix_measurable n).comp + ((by fun_prop : Measurable fun A : GaussianMatrix (Fin (n+1)) => A 0 0).prodMk + (((firstColumn_measurable n).norm.smul measurable_const).prodMk + (ih.comp (reducedTail_measurable n)))) + +def columnNormLaw (n : ℕ) (s : ℝ) : Measure ℝ := + (Measure.pi fun _ : Fin n => gaussianReal 0 (2*s^2).toNNReal).map + (fun v : Fin n → ℝ => ‖(WithLp.toLp 2 v : EuclideanSpace ℝ (Fin n))‖) + +def assembleTri (n : ℕ) (p : ℝ × (ℝ × GaussianMatrix (Fin n))) : GaussianMatrix (Fin (n+1)) := + borderMatrix p.1 (p.2.1 • firstAxis n) p.2.2 + +lemma assembleTri_measurable (n : ℕ) : Measurable (assembleTri n) := + (borderMatrix_measurable n).comp + (measurable_fst.prodMk ((measurable_fst.comp measurable_snd |>.smul measurable_const).prodMk + (measurable_snd.comp measurable_snd))) + +def triMatrixLaw : (n : ℕ) → ℝ → Measure (GaussianMatrix (Fin n)) + | 0, s => goeLaw (Fin 0) s + | n+1, s => ((gaussianReal 0 (4*s^2).toNNReal).prod + ((columnNormLaw n s).prod (triMatrixLaw n s))).map (assembleTri n) + +lemma columnNorm_preserving (n : ℕ) (s : ℝ) : + MeasurePreserving (fun v : Fin n → ℝ => ‖(WithLp.toLp 2 v : EuclideanSpace ℝ (Fin n))‖) + (Measure.pi fun _ : Fin n => gaussianReal 0 (2*s^2).toNNReal) (columnNormLaw n s) := + ⟨(WithLp.measurable_toLp _ _).norm, rfl⟩ + +instance columnNormLaw_probability (n : ℕ) (s : ℝ) : IsProbabilityMeasure (columnNormLaw n s) := + (Measure.isProbabilityMeasure_map_iff + (columnNorm_preserving n s).measurable.aemeasurable).2 inferInstance + +instance triMatrixLaw_probability (n : ℕ) (s : ℝ) : IsProbabilityMeasure (triMatrixLaw n s) := by + induction n with + | zero => exact goeLaw_probability s + | succ n ih => + have := ih + exact (Measure.isProbabilityMeasure_map_iff (assembleTri_measurable n).aemeasurable).2 inferInstance + +lemma triReduce_preserving (n : ℕ) (s : ℝ) : + MeasurePreserving (triReduce n) (goeLaw (Fin n) s) (triMatrixLaw n s) := by + induction n with + | zero => exact MeasurePreserving.id _ + | succ n ih => + have hp := (MeasurePreserving.id (gaussianReal 0 (4*s^2).toNNReal)).prod + ((columnNorm_preserving n s).prod ih) + have ha : MeasurePreserving (assembleTri n) + ((gaussianReal 0 (4*s^2).toNNReal).prod ((columnNormLaw n s).prod (triMatrixLaw n s))) + (triMatrixLaw (n+1) s) := ⟨assembleTri_measurable n, rfl⟩ + exact ha.comp (hp.comp (exposed_column_tail_law n s (firstAxis n))) + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/GaussianMoments.lean b/lean/OAI/MathematicalPhysics/CriticalSK/GaussianMoments.lean new file mode 100644 index 0000000000000000000000000000000000000000..46b215288cbe18b8616dff00cc81bf44580419ac --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/GaussianMoments.lean @@ -0,0 +1,311 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open MeasureTheory ProbabilityTheory + +open scoped ENNReal NNReal + +open scoped BigOperators InnerProductSpace + +open Module + +open scoped BigOperators ENNReal NNReal Real Topology + +open MeasureTheory ProbabilityTheory Filter + +namespace CriticalSK + +lemma gaussian_square_density (t x : ℝ) : + gaussianPDFReal 0 1 x * Real.exp (t * x ^ 2) = + (Real.sqrt (2 * Real.pi))⁻¹ * Real.exp (-(1 / 2 - t) * x ^ 2) := by + simp only [gaussianPDFReal, NNReal.coe_one, mul_one, sub_zero] + rw [mul_assoc, ← Real.exp_add] + congr 2 + ring + +lemma gaussian_square_integral (t : ℝ) (ht : t < 1 / 2) : + (∫ x : ℝ, Real.exp (t * x ^ 2) ∂gaussianReal 0 1) = + (Real.sqrt (1 - 2 * t))⁻¹ := by + rw [integral_gaussianReal_eq_integral_smul (by norm_num : (1 : ℝ≥0) ≠ 0)] + simp only [smul_eq_mul, gaussian_square_density] + rw [integral_const_mul, integral_gaussian] + have ha : 0 < 1 / 2 - t := by linarith + have hb : 0 < 1 - 2 * t := by linarith + apply (mul_left_inj' (Real.sqrt_ne_zero'.mpr hb)).mp + rw [inv_mul_cancel₀ (Real.sqrt_ne_zero'.mpr hb)] + have he : Real.sqrt (Real.pi / (1 / 2 - t)) * Real.sqrt (1 - 2 * t) = + Real.sqrt (2 * Real.pi) := by + rw [← Real.sqrt_mul (by positivity), show Real.pi / (1 / 2 - t) * (1 - 2 * t) = + 2 * Real.pi by field_simp] + calc + (Real.sqrt (2 * Real.pi))⁻¹ * Real.sqrt (Real.pi / (1 / 2 - t)) * + Real.sqrt (1 - 2 * t) = (Real.sqrt (2 * Real.pi))⁻¹ * Real.sqrt (2 * Real.pi) := by + rw [mul_assoc, he] + _ = 1 := inv_mul_cancel₀ (by positivity) + +lemma gaussian_square_integrable (t : ℝ) (ht : t < 1 / 2) : + Integrable (fun x : ℝ => Real.exp (t * x ^ 2)) (gaussianReal 0 1) := by + apply mgf_pos_iff.mp + change 0 < ∫ x : ℝ, Real.exp (t * x ^ 2) ∂gaussianReal 0 1 + rw [gaussian_square_integral t ht] + exact inv_pos.mpr (Real.sqrt_pos.mpr (by linarith)) + +def chiSquare (m : ℕ) (x : Fin m → ℝ) : ℝ := ∑ i, x i ^ 2 + +def standardGaussianProduct (m : ℕ) : Measure (Fin m → ℝ) := + Measure.pi fun _ => gaussianReal 0 1 + +section + +open Set Filter MeasureTheory ProbabilityTheory + +variable {ι : Type*} [Fintype ι] + +def gaussianScalarPi (v : ℝ≥0) : Measure (ι → ℝ) := Measure.pi fun _ => gaussianReal 0 v + +instance (v : ℝ≥0) : IsProbabilityMeasure (gaussianScalarPi (ι := ι) v) := by unfold gaussianScalarPi; infer_instance + +def gaussianLinear (a : ι → ℝ) (z : ι → ℝ) : ℝ := ∑ i, a i*z i + +lemma gaussianLinear_continuous (a : ι → ℝ) : Continuous (gaussianLinear a) := by + unfold gaussianLinear + fun_prop + +lemma gaussian_exp_integrable (v : ℝ≥0) (a : ι → ℝ) : + Integrable (fun z => Real.exp (gaussianLinear a z)) (gaussianScalarPi v) := by + simp only [gaussianLinear,Real.exp_sum] + exact Integrable.fintype_prod (fun i => integrable_exp_mul_gaussianReal (a i)) + +lemma gaussian_exp_integral (v : ℝ≥0) (a : ι → ℝ) : + (∫ z, Real.exp (gaussianLinear a z) ∂gaussianScalarPi v) = Real.exp ((v:ℝ)*(∑ i, a i^2)/2) := by + simp only [gaussianLinear,Real.exp_sum,gaussianScalarPi] + rw [integral_fintype_prod_eq_prod (μ := fun _ => gaussianReal 0 v) (fun i (z : ℝ) => Real.exp (a i*z))] + have he (i : ι) : (∫ z : ℝ, Real.exp (a i*z) ∂gaussianReal 0 v) = Real.exp ((v:ℝ)*(a i)^2/2) := by + have hh := mgf_gaussianReal (p := gaussianReal 0 v) (X := id) (μ := 0) (v := v) (by simp) (a i) + simpa only [mgf,zero_mul,zero_add,id_eq] using hh + simp_rw [he] + rw [← Real.exp_sum] + congr 1 + simp only [Finset.mul_sum,Finset.sum_div] + +lemma gaussianLinear_neg (a z : ι → ℝ) : gaussianLinear (-a) z = -gaussianLinear a z := by + simp [gaussianLinear] + +lemma gaussianLinear_add (a b z : ι → ℝ) : gaussianLinear (a+b) z = gaussianLinear a z+gaussianLinear b z := by + simp [gaussianLinear,add_mul,Finset.sum_add_distrib] + +lemma gaussianLinear_sub (a b z : ι → ℝ) : gaussianLinear (a-b) z = gaussianLinear a z-gaussianLinear b z := by + simp [gaussianLinear,sub_mul,Finset.sum_sub_distrib] + +lemma gaussian_cosh_integrable (v : ℝ≥0) (a : ι → ℝ) : + Integrable (fun z => Real.cosh (gaussianLinear a z)) (gaussianScalarPi v) := by + simp_rw [Real.cosh_eq,← gaussianLinear_neg] + exact ((gaussian_exp_integrable v a).add (gaussian_exp_integrable v (-a))).div_const 2 + +lemma gaussian_cosh_integral (v : ℝ≥0) (a : ι → ℝ) : + (∫ z, Real.cosh (gaussianLinear a z) ∂gaussianScalarPi v) = Real.exp ((v:ℝ)*(∑ i, a i^2)/2) := by + simp_rw [Real.cosh_eq,← gaussianLinear_neg] + rw [integral_div,integral_add (gaussian_exp_integrable v a) (gaussian_exp_integrable v (-a)),gaussian_exp_integral,gaussian_exp_integral] + simp only [Pi.neg_apply,neg_sq] + ring + +lemma cosh_mul_cosh_identity (a b : ℝ) : Real.cosh a*Real.cosh b = (Real.cosh (a+b)+Real.cosh (a-b))/2 := by + rw [Real.cosh_add,Real.cosh_sub] + ring + +lemma gaussian_cosh_product_integrable (v : ℝ≥0) (a b : ι → ℝ) : + Integrable (fun z => Real.cosh (gaussianLinear a z)*Real.cosh (gaussianLinear b z)) (gaussianScalarPi v) := by + simp_rw [cosh_mul_cosh_identity,← gaussianLinear_add,← gaussianLinear_sub] + exact ((gaussian_cosh_integrable v (a+b)).add (gaussian_cosh_integrable v (a-b))).div_const 2 + +lemma gaussian_cosh_product_integral (v : ℝ≥0) (a b : ι → ℝ) : + (∫ z, Real.cosh (gaussianLinear a z)*Real.cosh (gaussianLinear b z) ∂gaussianScalarPi v) = + Real.exp ((v:ℝ)*((∑ i, a i^2)+(∑ i, b i^2))/2)*Real.cosh ((v:ℝ)*∑ i, a i*b i) := by + simp_rw [cosh_mul_cosh_identity,← gaussianLinear_add,← gaussianLinear_sub] + rw [integral_div,integral_add (gaussian_cosh_integrable v (a+b)) (gaussian_cosh_integrable v (a-b)),gaussian_cosh_integral,gaussian_cosh_integral] + have hp : (∑ i, (a+b) i^2) = (∑ i, a i^2)+(∑ i, b i^2)+2*∑ i, a i*b i := by + simp only [Pi.add_apply,Finset.mul_sum,← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro i _; ring + have hm : (∑ i, (a-b) i^2) = (∑ i, a i^2)+(∑ i, b i^2)-2*∑ i, a i*b i := by + simp only [Pi.sub_apply,Finset.mul_sum,← Finset.sum_add_distrib,← Finset.sum_sub_distrib] + apply Finset.sum_congr rfl + intro i _; ring + rw [hp,hm,Real.cosh_eq] + rw [show (v:ℝ)*((∑ i, a i^2)+(∑ i, b i^2)+2*∑ i, a i*b i)/2 = + (v:ℝ)*((∑ i, a i^2)+(∑ i, b i^2))/2+(v:ℝ)*∑ i, a i*b i by ring, + show (v:ℝ)*((∑ i, a i^2)+(∑ i, b i^2)-2*∑ i, a i*b i)/2 = + (v:ℝ)*((∑ i, a i^2)+(∑ i, b i^2))/2+(-((v:ℝ)*∑ i, a i*b i)) by ring, + Real.exp_add,Real.exp_add] + ring + +lemma cosh_pow_exp_bound (z : ℝ) (m : ℕ) : + Real.cosh z^m ≤ Real.exp ((m:ℝ)*z)+Real.exp (-((m:ℝ)*z)) := by + have hc : Real.cosh z ≤ Real.exp |z| := by + rw [Real.cosh_eq] + have hp := Real.exp_le_exp.mpr (le_abs_self z) + have hm := Real.exp_le_exp.mpr (neg_le_abs z) + linarith + have hh := pow_le_pow_left₀ (Real.cosh_pos z).le hc m + rw [← Real.exp_nat_mul] at hh + exact hh.trans (by + by_cases hz : 0 ≤ z + · rw [abs_of_nonneg hz] + linarith [Real.exp_pos (-((m:ℝ)*z))] + · rw [abs_of_neg (lt_of_not_ge hz),mul_neg] + linarith [Real.exp_pos ((m:ℝ)*z)]) + +lemma gaussian_cosh_pow_bound (v : ℝ≥0) (a : ι → ℝ) (m : ℕ) : + Integrable (fun z => Real.cosh (gaussianLinear a z)^m) (gaussianScalarPi v) ∧ + (∫ z, Real.cosh (gaussianLinear a z)^m ∂gaussianScalarPi v) ≤ + 2*Real.exp ((m:ℝ)^2*(v:ℝ)*(∑ i, a i^2)/2) := by + let b : ι → ℝ := fun i => (m:ℝ)*a i + have he (z : ι → ℝ) : gaussianLinear b z = (m:ℝ)*gaussianLinear a z := by + simp only [gaussianLinear,b,Finset.mul_sum,mul_assoc] + have hib := (gaussian_exp_integrable v b).add (gaussian_exp_integrable v (-b)) + have hi : Integrable (fun z => Real.cosh (gaussianLinear a z)^m) (gaussianScalarPi v) := by + apply hib.mono' (((Real.continuous_cosh.comp (gaussianLinear_continuous a)).pow m).aestronglyMeasurable) + exact Filter.Eventually.of_forall (fun z => by + simp only [Pi.add_apply, Pi.pow_apply, Function.comp_apply] + rw [Real.norm_eq_abs,abs_of_nonneg (pow_nonneg (Real.cosh_pos _).le _),gaussianLinear_neg,he] + exact cosh_pow_exp_bound _ _) + refine ⟨hi,?_⟩ + calc + _ ≤ ∫ z, Real.exp (gaussianLinear b z)+Real.exp (gaussianLinear (-b) z) ∂gaussianScalarPi v := + integral_mono hi hib (fun z => by rw [gaussianLinear_neg,he]; exact cosh_pow_exp_bound _ _) + _ = _ := by + rw [integral_add (gaussian_exp_integrable v b) (gaussian_exp_integrable v (-b)),gaussian_exp_integral,gaussian_exp_integral] + simp only [Pi.neg_apply,neg_sq,b,mul_pow,← Finset.mul_sum] + ring_nf + +lemma cosh_sub_one_quadratic {z : ℝ} (hz : |z| ≤ 1) : Real.cosh z-1 ≤ (Real.exp 1-1)*z^2 := by + have hz2 : z^2 ≤ 1 := by nlinarith [sq_abs z,abs_nonneg z] + have hc := (convexOn_exp.2 (show (0:ℝ) ∈ univ from trivial) (show (1:ℝ) ∈ univ from trivial) + (show 0 ≤ 1-z^2 by nlinarith) (sq_nonneg z) (by ring)) + simp only [smul_eq_mul,mul_zero,mul_one,zero_add,Real.exp_zero] at hc + have he := (Real.cosh_le_exp_half_sq z).trans (Real.exp_le_exp.mpr (by nlinarith [sq_nonneg z] : z^2/2 ≤ z^2)) + nlinarith + +end + +open Set Filter MeasureTheory ProbabilityTheory + +variable {ι κ : Type*} [Fintype ι] [Fintype κ] + +def coshMixture (p : κ → ℝ) (a : κ → ι → ℝ) (z : ι → ℝ) : ℝ := + ∑ x, p x*Real.cosh (gaussianLinear (a x) z) + +lemma coshMixture_continuous (p : κ → ℝ) (a : κ → ι → ℝ) : Continuous (coshMixture p a) := by + unfold coshMixture + apply continuous_finsetSum + intro x _ + exact continuous_const.mul (Real.continuous_cosh.comp (gaussianLinear_continuous _)) + +lemma coshMixture_nonneg {p : κ → ℝ} (hp : ∀ x, 0 ≤ p x) (a : κ → ι → ℝ) (z : ι → ℝ) : 0 ≤ coshMixture p a z := by + exact Finset.sum_nonneg (fun x _ => mul_nonneg (hp x) (Real.cosh_pos _).le) + +lemma coshMixture_integrable (v : ℝ≥0) (p : κ → ℝ) (a : κ → ι → ℝ) : + Integrable (coshMixture p a) (gaussianScalarPi v) := + integrable_finsetSum _ (fun x _ => (gaussian_cosh_integrable v (a x)).const_mul (p x)) + +lemma coshMixture_integral (v : ℝ≥0) {p : κ → ℝ} (hpsum : ∑ x, p x = 1) + (a : κ → ι → ℝ) {s : ℝ} (hs : ∀ x, ∑ i, a x i^2 = s) : + (∫ z, coshMixture p a z ∂gaussianScalarPi v) = Real.exp ((v:ℝ)*s/2) := by + unfold coshMixture + rw [integral_finsetSum _ (fun x _ => (gaussian_cosh_integrable v (a x)).const_mul (p x))] + simp_rw [integral_const_mul,gaussian_cosh_integral,hs] + rw [← Finset.sum_mul,hpsum,one_mul] + +lemma coshMixture_pow_integrable_bound (v : ℝ≥0) {p : κ → ℝ} (hp : ∀ x, 0 ≤ p x) + (hpsum : ∑ x, p x = 1) (a : κ → ι → ℝ) {s : ℝ} (hs : ∀ x, ∑ i, a x i^2 = s) (m : ℕ) : + Integrable (fun z => coshMixture p a z^m) (gaussianScalarPi v) ∧ + (∫ z, coshMixture p a z^m ∂gaussianScalarPi v) ≤ 2*Real.exp ((m:ℝ)^2*(v:ℝ)*s/2) := by + have hib : Integrable (fun z => ∑ x, p x*Real.cosh (gaussianLinear (a x) z)^m) (gaussianScalarPi v) := + integrable_finsetSum _ (fun x _ => ((gaussian_cosh_pow_bound v (a x) m).1.const_mul _)) + have hbound (z : ι → ℝ) : coshMixture p a z^m ≤ ∑ x, p x*Real.cosh (gaussianLinear (a x) z)^m := + Real.pow_arith_mean_le_arith_mean_pow _ _ _ (fun x _ => hp x) hpsum (fun _ _ => (Real.cosh_pos _).le) m + have hi : Integrable (fun z => coshMixture p a z^m) (gaussianScalarPi v) := by + apply hib.mono' ((coshMixture_continuous p a).pow m).aestronglyMeasurable + exact Filter.Eventually.of_forall (fun z => by simp only [Pi.pow_apply]; rw [Real.norm_eq_abs,abs_of_nonneg (pow_nonneg (coshMixture_nonneg hp a z) _)]; exact hbound z) + refine ⟨hi,?_⟩ + calc + _ ≤ ∫ z, ∑ x, p x*Real.cosh (gaussianLinear (a x) z)^m ∂gaussianScalarPi v := integral_mono hi hib hbound + _ = ∑ x, p x*(∫ z, Real.cosh (gaussianLinear (a x) z)^m ∂gaussianScalarPi v) := by + rw [integral_finsetSum _ (fun x _ => ((gaussian_cosh_pow_bound v (a x) m).1.const_mul _))] + simp only [integral_const_mul] + _ ≤ ∑ x, p x*(2*Real.exp ((m:ℝ)^2*(v:ℝ)*s/2)) := by + apply Finset.sum_le_sum + intro x _ + apply mul_le_mul_of_nonneg_left _ (hp x) + simpa only [hs] using (gaussian_cosh_pow_bound v (a x) m).2 + _ = _ := by rw [← Finset.sum_mul,hpsum,one_mul] + +lemma coshMixture_square (p : κ → ℝ) (a : κ → ι → ℝ) (z : ι → ℝ) : + coshMixture p a z^2 = ∑ x, ∑ y, p x*p y*(Real.cosh (gaussianLinear (a x) z)*Real.cosh (gaussianLinear (a y) z)) := by + simp only [coshMixture,pow_two,Finset.sum_mul,Finset.mul_sum] + apply Finset.sum_congr rfl + intro x _ + apply Finset.sum_congr rfl + intro y _ + ring + +lemma coshMixture_square_integral (v : ℝ≥0) (p : κ → ℝ) (a : κ → ι → ℝ) + {s : ℝ} (hs : ∀ x, ∑ i, a x i^2 = s) : + (∫ z, coshMixture p a z^2 ∂gaussianScalarPi v) = + Real.exp ((v:ℝ)*s)*(∑ x, ∑ y, p x*p y*Real.cosh ((v:ℝ)*∑ i, a x i*a y i)) := by + simp_rw [coshMixture_square] + rw [integral_finsetSum _ (fun x _ => integrable_finsetSum _ (fun y _ => (gaussian_cosh_product_integrable v (a x) (a y)).const_mul (p x*p y)))] + simp_rw [integral_finsetSum _ (fun y _ => (gaussian_cosh_product_integrable v _ (a y)).const_mul _),integral_const_mul,gaussian_cosh_product_integral,hs] + rw [show (v:ℝ)*(s+s)/2 = (v:ℝ)*s by ring] + simp only [Finset.mul_sum] + apply Finset.sum_congr rfl + intro x _ + apply Finset.sum_congr rfl + intro y _ + ring + +lemma coshMixture_centered_integrable_bound (v : ℝ≥0) {p : κ → ℝ} (hp : ∀ x, 0 ≤ p x) + (hpsum : ∑ x, p x = 1) (a : κ → ι → ℝ) {s : ℝ} (hs : ∀ x, ∑ i, a x i^2 = s) + (hc : ∀ x y, |(v:ℝ)*∑ i, a x i*a y i| ≤ 1) : + Integrable (fun z => (coshMixture p a z-Real.exp ((v:ℝ)*s/2))^2) (gaussianScalarPi v) ∧ + (∫ z, (coshMixture p a z-Real.exp ((v:ℝ)*s/2))^2 ∂gaussianScalarPi v) ≤ + Real.exp ((v:ℝ)*s)*(Real.exp 1-1)*(∑ x, ∑ y, p x*p y*((v:ℝ)*∑ i, a x i*a y i)^2) := by + let m := Real.exp ((v:ℝ)*s/2) + have hi := (coshMixture_pow_integrable_bound v hp hpsum a hs 2).1 + have hmi := coshMixture_integrable v p a + have he (z : ι → ℝ) : (coshMixture p a z-m)^2 = coshMixture p a z^2-2*m*coshMixture p a z+m^2 := by ring + have hiz : Integrable (fun z => (coshMixture p a z-m)^2) (gaussianScalarPi v) := by + simp_rw [he] + exact (hi.sub (hmi.const_mul _)).add (integrable_const _) + refine ⟨hiz,?_⟩ + have hm2 : m^2 = Real.exp ((v:ℝ)*s) := by dsimp only [m]; rw [← Real.exp_nat_mul]; congr 1; push_cast; ring + have hsum : (∑ x, ∑ y, p x*p y) = 1 := by simp only [← Finset.mul_sum,hpsum,mul_one] + have hid : (∫ z, (coshMixture p a z-m)^2 ∂gaussianScalarPi v) = + Real.exp ((v:ℝ)*s)*(∑ x, ∑ y, p x*p y*(Real.cosh ((v:ℝ)*∑ i, a x i*a y i)-1)) := by + simp_rw [he] + rw [integral_add (f := fun z => coshMixture p a z^2-2*m*coshMixture p a z) (g := fun _ => m^2) (hi.sub (hmi.const_mul _)) (integrable_const _),integral_sub (f := fun z => coshMixture p a z^2) (g := fun z => 2*m*coshMixture p a z) hi (hmi.const_mul _),integral_const_mul, + coshMixture_integral v hpsum a hs,coshMixture_square_integral v p a hs,integral_const,probReal_univ,one_smul] + change Real.exp ((v:ℝ)*s)*_-2*m*m+m^2 = _ + simp only [mul_sub,mul_one,Finset.sum_sub_distrib,hsum] + nlinarith + rw [hid] + rw [mul_assoc] + apply mul_le_mul_of_nonneg_left _ (Real.exp_pos _).le + rw [Finset.mul_sum] + apply Finset.sum_le_sum + intro x _ + rw [Finset.mul_sum] + apply Finset.sum_le_sum + intro y _ + nlinarith [mul_le_mul_of_nonneg_left (cosh_sub_one_quadratic (hc x y)) (mul_nonneg (hp x) (hp y))] + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/Gibbs.lean b/lean/OAI/MathematicalPhysics/CriticalSK/Gibbs.lean new file mode 100644 index 0000000000000000000000000000000000000000..0a99b4a0c512f012617f90b98bf399923bd249fb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/Gibbs.lean @@ -0,0 +1,379 @@ +import OAI.MathematicalPhysics.CriticalSK.SpinModel + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open MeasureTheory ProbabilityTheory + +open scoped ENNReal NNReal + +open scoped BigOperators InnerProductSpace + +open Module + +open scoped BigOperators ENNReal NNReal Real Topology + +open MeasureTheory ProbabilityTheory Filter + +open scoped BigOperators NNReal + +open scoped BigOperators + +open Matrix Polynomial + +open scoped BigOperators Topology + +open Filter + +namespace CriticalSK + +section FiniteGibbs + +variable {n : ℕ} (W : Disorder n) + +lemma partition_pos : 0 < partition W := by + unfold partition + exact Finset.sum_pos (fun _ _ => Real.exp_pos _) Finset.univ_nonempty + +lemma gibbs_pos (x : Spin n) : 0 < gibbs W x := + div_pos (Real.exp_pos _) (partition_pos W) + +lemma gibbs_nonneg (x : Spin n) : 0 ≤ gibbs W x := (gibbs_pos W x).le + +lemma gibbs_sum : ∑ x : Spin n, gibbs W x = 1 := by + unfold gibbs + rw [← Finset.sum_div] + exact div_self (ne_of_gt (partition_pos W)) + +lemma gibbs_le_one (x : Spin n) : gibbs W x ≤ 1 := by + rw [← gibbs_sum W] + exact Finset.single_le_sum (fun y _ => gibbs_nonneg W y) (Finset.mem_univ x) + +def spinFlip (x : Spin n) : Spin n := fun i => !(x i) + +def spinFlipEquiv : Equiv.Perm (Spin n) := Equiv.piCongrRight (fun _ => Equiv.boolNot) + +@[simp] lemma spinFlipEquiv_apply (x : Spin n) : spinFlipEquiv x = spinFlip x := rfl + +@[simp] lemma spinFlip_spinFlip (x : Spin n) : spinFlip (spinFlip x) = x := by + funext i + simp [spinFlip] + +@[simp] lemma spinValue_not (b : Bool) : spinValue (!b) = -spinValue b := by + cases b <;> norm_num [spinValue] + +@[simp] lemma hamiltonian_spinFlip (x : Spin n) : + hamiltonian W (spinFlip x) = hamiltonian W x := by + unfold hamiltonian + apply Finset.sum_congr rfl + intro e _ + simp [spinFlip] + +@[simp] lemma gibbs_spinFlip (x : Spin n) : gibbs W (spinFlip x) = gibbs W x := by + simp [gibbs] + +lemma mean_odd_eq_zero (f : Spin n → ℝ) (hf : ∀ x, f (spinFlip x) = -f x) : + mean W f = 0 := by + have h : mean W f = -mean W f := by + calc + mean W f = ∑ x, gibbs W (spinFlip x) * f (spinFlip x) := + (Equiv.sum_comp spinFlipEquiv (fun x => gibbs W x * f x)).symm + _ = -mean W f := by simp [hf, mean, Finset.sum_neg_distrib] + linarith + +@[simp] lemma mean_spin (i : Fin n) : mean W (fun x => spinValue (x i)) = 0 := by + apply mean_odd_eq_zero + intro x + simp [spinFlip] + +@[simp] lemma linearObservable_spinFlip (a : Fin n → ℝ) (x : Spin n) : + linearObservable a (spinFlip x) = -linearObservable a x := by + simp [linearObservable, spinFlip, Finset.sum_neg_distrib] + +@[simp] lemma mean_linearObservable (a : Fin n → ℝ) : + mean W (linearObservable a) = 0 := + mean_odd_eq_zero W _ (linearObservable_spinFlip a) + +lemma covariance_eq (i j : Fin n) : + covariance W i j = mean W (fun x => spinValue (x i) * spinValue (x j)) := by + simp [covariance] + +@[simp] lemma covariance_diag (i : Fin n) : covariance W i i = 1 := by + rw [covariance_eq] + simpa [mean, ← sq] using gibbs_sum W + +lemma sameExcept_refl (i : Fin n) (x : Spin n) : sameExcept i x x := by + intro _ _ + rfl + +lemma sameExcept_symm {i : Fin n} {x y : Spin n} (h : sameExcept i x y) : + sameExcept i y x := by + intro j hj + exact (h j hj).symm + +lemma sameExcept_trans {i : Fin n} {x y z : Spin n} + (hxy : sameExcept i x y) (hyz : sameExcept i y z) : sameExcept i x z := by + intro j hj + exact (hyz j hj).trans (hxy j hj) + +lemma sameExcept_classes {i : Fin n} {x y : Spin n} (h : sameExcept i x y) + (z : Spin n) : sameExcept i x z ↔ sameExcept i y z := + ⟨sameExcept_trans (sameExcept_symm h), sameExcept_trans h⟩ + +def fiberMass (i : Fin n) (x : Spin n) : ℝ := + ∑ z : Spin n, if sameExcept i x z then gibbs W z else 0 + +lemma fiberMass_pos (i : Fin n) (x : Spin n) : 0 < fiberMass W i x := by + have h : gibbs W x ≤ fiberMass W i x := by + unfold fiberMass + have hh := Finset.single_le_sum (s := Finset.univ) + (f := fun z => if sameExcept i x z then gibbs W z else 0) + (fun z _ => by split_ifs; exact gibbs_nonneg W z; exact le_rfl) (Finset.mem_univ x) + simpa only [sameExcept_refl, ite_true] using hh + exact lt_of_lt_of_le (gibbs_pos W x) h + +lemma fiberMass_eq {i : Fin n} {x y : Spin n} (h : sameExcept i x y) : + fiberMass W i x = fiberMass W i y := by + unfold fiberMass + apply Finset.sum_congr rfl + intro z _ + simp only [sameExcept_classes h z] + +lemma siteKernel_nonneg (i : Fin n) (x y : Spin n) : 0 ≤ siteKernel W i x y := by + unfold siteKernel + split_ifs + · exact (div_pos (gibbs_pos W y) (fiberMass_pos W i x)).le + · exact le_rfl + +lemma siteKernel_sum (i : Fin n) (x : Spin n) : ∑ y, siteKernel W i x y = 1 := by + calc + (∑ y, siteKernel W i x y) = fiberMass W i x / fiberMass W i x := by + unfold siteKernel fiberMass + rw [Finset.sum_div] + apply Finset.sum_congr rfl + intro y _ + split_ifs <;> simp + _ = 1 := div_self (ne_of_gt (fiberMass_pos W i x)) + +lemma siteKernel_reversible (i : Fin n) (x y : Spin n) : + gibbs W x * siteKernel W i x y = gibbs W y * siteKernel W i y x := by + by_cases h : sameExcept i x y + · have h' := sameExcept_symm h + change gibbs W x * (if sameExcept i x y then gibbs W y / fiberMass W i x else 0) = + gibbs W y * (if sameExcept i y x then gibbs W x / fiberMass W i y else 0) + simp only [h, h', ite_true, fiberMass_eq W h] + ring + · have h' : ¬sameExcept i y x := fun hh => h (sameExcept_symm hh) + simp [siteKernel, h, h'] + +lemma siteKernel_stationary (i : Fin n) (y : Spin n) : + ∑ x, gibbs W x * siteKernel W i x y = gibbs W y := by + simp_rw [siteKernel_reversible W i] + rw [← Finset.mul_sum, siteKernel_sum, mul_one] + +lemma siteKernel_same_row {i : Fin n} {x y : Spin n} (h : sameExcept i x y) : + siteKernel W i x = siteKernel W i y := by + funext z + change (if sameExcept i x z then gibbs W z / fiberMass W i x else 0) = + (if sameExcept i y z then gibbs W z / fiberMass W i y else 0) + simp only [sameExcept_classes h z, fiberMass_eq W h] + +lemma siteKernel_projection (i : Fin n) : siteKernel W i * siteKernel W i = siteKernel W i := by + ext x z + change (∑ y, siteKernel W i x y * siteKernel W i y z) = siteKernel W i x z + calc + (∑ y, siteKernel W i x y * siteKernel W i y z) = + ∑ y, siteKernel W i x y * siteKernel W i x z := by + apply Finset.sum_congr rfl + intro y _ + by_cases h : sameExcept i x y + · rw [siteKernel_same_row W h] + · simp [siteKernel, h] + _ = siteKernel W i x z := by rw [← Finset.sum_mul, siteKernel_sum, one_mul] + +end FiniteGibbs + +variable {n : ℕ} (W : Disorder n) + +lemma mean_nonneg {f : Spin n → ℝ} (hf : ∀ x, 0 ≤ f x) : 0 ≤ mean W f := + Finset.sum_nonneg (fun x _ => mul_nonneg (gibbs_nonneg W x) (hf x)) + +lemma mean_mono {f g : Spin n → ℝ} (h : ∀ x, f x ≤ g x) : mean W f ≤ mean W g := + Finset.sum_le_sum (fun x _ => mul_le_mul_of_nonneg_left (h x) (gibbs_nonneg W x)) + +@[simp] lemma mean_const (c : ℝ) : mean W (fun _ => c) = c := by + simp only [mean, ← Finset.sum_mul, gibbs_sum, one_mul] + +lemma mean_add (f g : Spin n → ℝ) : + mean W (fun x => f x + g x) = mean W f + mean W g := by + simp only [mean, mul_add, Finset.sum_add_distrib] + +lemma mean_sub (f g : Spin n → ℝ) : + mean W (fun x => f x - g x) = mean W f - mean W g := by + simp only [mean, mul_sub, Finset.sum_sub_distrib] + +lemma mean_neg (f : Spin n → ℝ) : mean W (fun x => -f x) = -mean W f := by + simp only [mean, mul_neg, Finset.sum_neg_distrib] + +lemma mean_mul_const (f : Spin n → ℝ) (c : ℝ) : + mean W (fun x => f x * c) = mean W f * c := by + simp only [mean, ← mul_assoc, Finset.sum_mul] + +lemma mean_const_mul (f : Spin n → ℝ) (c : ℝ) : + mean W (fun x => c * f x) = c * mean W f := by + simpa only [mul_comm c] using mean_mul_const W f c + +lemma mean_sum {ι : Type*} (s : Finset ι) (f : ι → Spin n → ℝ) : + mean W (fun x => ∑ i ∈ s, f i x) = ∑ i ∈ s, mean W (f i) := by + simp only [mean, Finset.mul_sum] + exact Finset.sum_comm + +def siteAverage (i : Fin n) (f : Spin n → ℝ) : Spin n → ℝ := + (siteKernel W i).mulVec f + +lemma siteAverage_eq (i : Fin n) (f : Spin n → ℝ) (x : Spin n) : + siteAverage W i f x = ∑ y, siteKernel W i x y * f y := rfl + +lemma siteAverage_add (i : Fin n) (f g : Spin n → ℝ) : + siteAverage W i (fun x => f x + g x) = + fun x => siteAverage W i f x + siteAverage W i g x := + Matrix.mulVec_add _ _ _ + +lemma siteAverage_sub (i : Fin n) (f g : Spin n → ℝ) : + siteAverage W i (fun x => f x - g x) = + fun x => siteAverage W i f x - siteAverage W i g x := by + funext x + simp only [siteAverage_eq, mul_sub, Finset.sum_sub_distrib] + +lemma siteAverage_idempotent (i : Fin n) (f : Spin n → ℝ) : + siteAverage W i (siteAverage W i f) = siteAverage W i f := by + unfold siteAverage + rw [Matrix.mulVec_mulVec, siteKernel_projection] + +lemma siteAverage_fiber_constant (i : Fin n) (f : Spin n → ℝ) + {x y : Spin n} (h : sameExcept i x y) : + siteAverage W i f x = siteAverage W i f y := by + simp only [siteAverage_eq, siteKernel_same_row W h] + +lemma siteAverage_of_fiber_constant (i : Fin n) (f : Spin n → ℝ) + (hf : ∀ x y, sameExcept i x y → f y = f x) : siteAverage W i f = f := by + funext x + calc + siteAverage W i f x = ∑ y, siteKernel W i x y * f x := by + apply Finset.sum_congr rfl + intro y _ + by_cases h : sameExcept i x y + · rw [hf x y h] + · simp [siteKernel, h] + _ = f x := by rw [← Finset.sum_mul, siteKernel_sum, one_mul] + +lemma siteAverage_selfadjoint (i : Fin n) (f g : Spin n → ℝ) : + mean W (fun x => f x * siteAverage W i g x) = + mean W (fun x => siteAverage W i f x * g x) := by + simp only [mean, siteAverage_eq, Finset.mul_sum, Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro x _ + apply Finset.sum_congr rfl + intro y _ + calc + gibbs W y * (f y * (siteKernel W i y x * g x)) = + (gibbs W y * siteKernel W i y x) * (f y * g x) := by ring + _ = (gibbs W x * siteKernel W i x y) * (f y * g x) := by + rw [siteKernel_reversible] + _ = gibbs W x * (siteKernel W i x y * f y * g x) := by ring + +lemma siteAverage_orthogonal (i : Fin n) (f g : Spin n → ℝ) + (hg : siteAverage W i g = g) : + mean W (fun x => (f x - siteAverage W i f x) * g x) = 0 := by + have h := siteAverage_selfadjoint W i f g + rw [hg] at h + simp only [sub_mul, mean_sub] + exact sub_eq_zero.mpr h + +theorem siteAverage_least_squares (i : Fin n) (f g : Spin n → ℝ) + (hg : ∀ x y, sameExcept i x y → g y = g x) : + mean W (fun x => (f x - siteAverage W i f x) ^ 2) ≤ + mean W (fun x => (f x - g x) ^ 2) := by + have hfixed : siteAverage W i (fun x => siteAverage W i f x - g x) = + (fun x => siteAverage W i f x - g x) := by + rw [siteAverage_sub, siteAverage_idempotent, siteAverage_of_fiber_constant W i g hg] + have horth := siteAverage_orthogonal W i f _ hfixed + have hexpand : mean W (fun x => (f x - g x) ^ 2) = + mean W (fun x => (f x - siteAverage W i f x) ^ 2) + + mean W (fun x => (siteAverage W i f x - g x) ^ 2) + + 2 * mean W (fun x => (f x - siteAverage W i f x) * (siteAverage W i f x - g x)) := by + rw [← mean_const_mul, ← mean_add, ← mean_add] + congr 1 + funext x + ring + rw [horth, mul_zero, add_zero] at hexpand + have hnonneg := mean_nonneg W (fun x => sq_nonneg (siteAverage W i f x - g x)) + linarith + +lemma siteAverage_form_identity (i : Fin n) (f : Spin n → ℝ) : + mean W (fun x => (f x - siteAverage W i f x) ^ 2) = + mean W (fun x => f x * (f x - siteAverage W i f x)) := by + have hfixed := siteAverage_idempotent W i f + have horth := siteAverage_orthogonal W i f _ hfixed + have hexpand : mean W (fun x => f x * (f x - siteAverage W i f x)) = + mean W (fun x => (f x - siteAverage W i f x) ^ 2) + + mean W (fun x => (f x - siteAverage W i f x) * siteAverage W i f x) := by + rw [← mean_add] + congr 1 + funext x + ring + linarith + +lemma dirichlet_nonneg (f : Spin n → ℝ) : 0 ≤ dirichlet W f := by + apply Finset.sum_nonneg + intro i _ + exact mean_nonneg W (fun _ => sq_nonneg _) + +lemma dirichlet_generator (f : Spin n → ℝ) : + dirichlet W f = -mean W (fun x => f x * (generator W).mulVec f x) := by + have hgen : (generator W).mulVec f = fun x => + ∑ i : Fin n, (siteAverage W i f x - f x) := by + ext x + simp [generator, Matrix.sum_mulVec, Matrix.sub_mulVec, siteAverage] + rw [hgen] + unfold dirichlet + simp_rw [← siteAverage_eq, siteAverage_form_identity] + rw [show (fun x => f x * ∑ i : Fin n, (siteAverage W i f x - f x)) = + (fun x => ∑ i : Fin n, -(f x * (f x - siteAverage W i f x))) by + funext x; simp only [Finset.mul_sum]; congr 1; funext i; ring] + simp only [mean_sum, mean_neg, Finset.sum_neg_distrib, neg_neg] + +def linearRest (a : Fin n → ℝ) (i : Fin n) (x : Spin n) : ℝ := + ∑ j ∈ Finset.univ.erase i, a j * spinValue (x j) + +lemma linearObservable_split (a : Fin n → ℝ) (i : Fin n) (x : Spin n) : + linearObservable a x = a i * spinValue (x i) + linearRest a i x := by + exact (Finset.add_sum_erase _ _ (Finset.mem_univ i)).symm + +lemma linearRest_fiber_constant (a : Fin n → ℝ) (i : Fin n) (x y : Spin n) + (h : sameExcept i x y) : linearRest a i y = linearRest a i x := by + apply Finset.sum_congr rfl + intro j hj + rw [h j (Finset.ne_of_mem_erase hj)] + +theorem dirichlet_linear_le (a : Fin n → ℝ) : + dirichlet W (linearObservable a) ≤ ∑ i : Fin n, a i ^ 2 := by + apply Finset.sum_le_sum + intro i _ + calc + mean W (fun x => (linearObservable a x - ∑ y, siteKernel W i x y * linearObservable a y) ^ 2) + ≤ mean W (fun x => (linearObservable a x - linearRest a i x) ^ 2) := + siteAverage_least_squares W i _ _ (linearRest_fiber_constant a i) + _ = a i ^ 2 := by + simp_rw [linearObservable_split a i, add_sub_cancel_right, mul_pow, spinValue_sq, mul_one] + exact mean_const W _ + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/HeatBath.lean b/lean/OAI/MathematicalPhysics/CriticalSK/HeatBath.lean new file mode 100644 index 0000000000000000000000000000000000000000..463c8a81fe8edb6a0400f5c7246c33c4cba389ef --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/HeatBath.lean @@ -0,0 +1,758 @@ +import OAI.MathematicalPhysics.CriticalSK.Gibbs + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open MeasureTheory ProbabilityTheory + +open scoped ENNReal NNReal + +open scoped BigOperators InnerProductSpace + +open Module + +open scoped BigOperators ENNReal NNReal Real Topology + +open MeasureTheory ProbabilityTheory Filter + +open scoped BigOperators NNReal + +open scoped BigOperators + +open Matrix Polynomial + +open scoped BigOperators Topology + +open Filter + +namespace CriticalSK + +open scoped InnerProductSpace + +section GibbsEuclidean + +variable {n : ℕ} (W : Disorder n) + +lemma gibbs_sqrt_pos (x : Spin n) : 0 < Real.sqrt (gibbs W x) := + Real.sqrt_pos.mpr (gibbs_pos W x) + +def gibbsEuclideanEquiv : (Spin n → ℝ) ≃ₗ[ℝ] EuclideanSpace ℝ (Spin n) where + toFun f := WithLp.toLp 2 (fun x => Real.sqrt (gibbs W x) * f x) + invFun v := fun x => v x / Real.sqrt (gibbs W x) + left_inv f := by + funext x + simp [ne_of_gt (gibbs_sqrt_pos W x)] + right_inv v := by + ext x + change Real.sqrt (gibbs W x) * (v x / Real.sqrt (gibbs W x)) = v x + field_simp [ne_of_gt (gibbs_sqrt_pos W x)] + map_add' f g := by ext x; simp [mul_add] + map_smul' c f := by ext x; simp [mul_left_comm] + +@[simp] lemma gibbsEuclideanEquiv_apply (f : Spin n → ℝ) (x : Spin n) : + gibbsEuclideanEquiv W f x = Real.sqrt (gibbs W x) * f x := rfl + +@[simp] lemma gibbsEuclideanEquiv_symm_apply (v : EuclideanSpace ℝ (Spin n)) (x : Spin n) : + (gibbsEuclideanEquiv W).symm v x = v x / Real.sqrt (gibbs W x) := rfl + +lemma gibbsEuclideanEquiv_inner (f g : Spin n → ℝ) : + ⟪gibbsEuclideanEquiv W f, gibbsEuclideanEquiv W g⟫_ℝ = + mean W (fun x => f x * g x) := by + rw [PiLp.inner_apply] + apply Finset.sum_congr rfl + intro x _ + simp only [RCLike.inner_apply, conj_trivial, gibbsEuclideanEquiv_apply] + calc + (Real.sqrt (gibbs W x) * g x) * (Real.sqrt (gibbs W x) * f x) = + (Real.sqrt (gibbs W x)) ^ 2 * (f x * g x) := by ring + _ = gibbs W x * (f x * g x) := by rw [Real.sq_sqrt (gibbs_nonneg W x)] + +def kernelConjugate (K : Matrix (Spin n) (Spin n) ℝ) : Matrix (Spin n) (Spin n) ℝ := + fun x y => Real.sqrt (gibbs W x) * K x y / Real.sqrt (gibbs W y) + +lemma kernelConjugate_apply (K : Matrix (Spin n) (Spin n) ℝ) (f : Spin n → ℝ) : + (kernelConjugate W K).toEuclideanLin (gibbsEuclideanEquiv W f) = + gibbsEuclideanEquiv W (K.mulVec f) := by + ext x + change (∑ y, (Real.sqrt (gibbs W x) * K x y / Real.sqrt (gibbs W y)) * + (Real.sqrt (gibbs W y) * f y)) = Real.sqrt (gibbs W x) * ∑ y, K x y * f y + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro y _ + field_simp [ne_of_gt (gibbs_sqrt_pos W y)] + +lemma kernelConjugate_isHermitian (K : Matrix (Spin n) (Spin n) ℝ) + (hK : ∀ x y, gibbs W x * K x y = gibbs W y * K y x) : + (kernelConjugate W K).IsHermitian := by + ext x y + simp only [Matrix.conjTranspose_apply, star_trivial, kernelConjugate] + apply (div_eq_div_iff (ne_of_gt (gibbs_sqrt_pos W x)) + (ne_of_gt (gibbs_sqrt_pos W y))).mpr + have h := hK x y + rw [← Real.sq_sqrt (gibbs_nonneg W x), ← Real.sq_sqrt (gibbs_nonneg W y)] at h + nlinarith only [h] + +lemma discreteKernel_nonneg (x y : Spin n) : 0 ≤ discreteKernel W x y := by + simp only [discreteKernel, Matrix.smul_apply, Matrix.sum_apply, smul_eq_mul] + change 0 ≤ (n : ℝ)⁻¹ * ∑ i : Fin n, siteKernel W i x y + apply mul_nonneg (inv_nonneg.mpr (Nat.cast_nonneg n)) + exact Finset.sum_nonneg (fun i _ => siteKernel_nonneg W i x y) + +lemma discreteKernel_sum (hn : 0 < n) (x : Spin n) : ∑ y, discreteKernel W x y = 1 := by + have hn0 : (n : ℝ) ≠ 0 := by exact_mod_cast (ne_of_gt hn) + simp only [discreteKernel, Matrix.smul_apply, Matrix.sum_apply, smul_eq_mul] + change (∑ y, (n : ℝ)⁻¹ * ∑ i : Fin n, siteKernel W i x y) = 1 + rw [← Finset.mul_sum, Finset.sum_comm] + simp [siteKernel_sum, hn0] + +lemma discreteKernel_reversible (x y : Spin n) : + gibbs W x * discreteKernel W x y = gibbs W y * discreteKernel W y x := by + simp only [discreteKernel, Matrix.smul_apply, Matrix.sum_apply, smul_eq_mul] + change gibbs W x * ((n : ℝ)⁻¹ * ∑ i, siteKernel W i x y) = + gibbs W y * ((n : ℝ)⁻¹ * ∑ i, siteKernel W i y x) + simp only [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + calc + gibbs W x * ((n : ℝ)⁻¹ * siteKernel W i x y) = + (n : ℝ)⁻¹ * (gibbs W x * siteKernel W i x y) := by ring + _ = (n : ℝ)⁻¹ * (gibbs W y * siteKernel W i y x) := by + rw [siteKernel_reversible W i x y] + _ = gibbs W y * ((n : ℝ)⁻¹ * siteKernel W i y x) := by ring + +lemma discreteKernel_stationary (hn : 0 < n) (y : Spin n) : + ∑ x, gibbs W x * discreteKernel W x y = gibbs W y := by + simp_rw [discreteKernel_reversible] + rw [← Finset.mul_sum, discreteKernel_sum W hn, mul_one] + +lemma discreteKernel_average (f : Spin n → ℝ) (x : Spin n) : + (discreteKernel W).mulVec f x = (n : ℝ)⁻¹ * ∑ i : Fin n, siteAverage W i f x := by + simp only [discreteKernel, Matrix.smul_mulVec, Matrix.sum_mulVec, Pi.smul_apply, + Finset.sum_apply, smul_eq_mul, siteAverage] + +lemma siteAverage_self_square (i : Fin n) (f : Spin n → ℝ) : + mean W (fun x => f x * siteAverage W i f x) = + mean W (fun x => (siteAverage W i f x) ^ 2) := by + have h := siteAverage_selfadjoint W i f (siteAverage W i f) + simpa only [siteAverage_idempotent, sq] using h + +lemma discreteKernel_quadratic_nonneg (f : Spin n → ℝ) : + 0 ≤ mean W (fun x => f x * (discreteKernel W).mulVec f x) := by + have heq : mean W (fun x => f x * (discreteKernel W).mulVec f x) = + (n : ℝ)⁻¹ * ∑ i : Fin n, mean W (fun x => (siteAverage W i f x) ^ 2) := by + simp_rw [discreteKernel_average, mul_left_comm (f _), Finset.mul_sum, + mean_sum, mean_const_mul, siteAverage_self_square] + rw [heq] + apply mul_nonneg (inv_nonneg.mpr (Nat.cast_nonneg n)) + exact Finset.sum_nonneg (fun _ _ => mean_nonneg W (fun _ => sq_nonneg _)) + +lemma generator_discreteKernel (hn : 0 < n) : + generator W = (n : ℝ) • (discreteKernel W - 1) := by + have hn0 : (n : ℝ) ≠ 0 := by exact_mod_cast (ne_of_gt hn) + simp [generator, discreteKernel, smul_sub, smul_smul, hn0, Finset.sum_sub_distrib] + simp [Nat.cast_smul_eq_nsmul] + +lemma dirichlet_discrete (hn : 0 < n) (f : Spin n → ℝ) : + mean W (fun x => f x * (f x - (discreteKernel W).mulVec f x)) = + dirichlet W f / n := by + rw [dirichlet_generator, generator_discreteKernel W hn, + Matrix.smul_mulVec, Matrix.sub_mulVec, Matrix.one_mulVec] + have hn0 : (n : ℝ) ≠ 0 := by exact_mod_cast (ne_of_gt hn) + simp only [Pi.smul_apply, Pi.sub_apply, smul_eq_mul] + have hfunc : (fun x => f x * ((n : ℝ) * ((discreteKernel W).mulVec f x - f x))) = + (fun x => -(n : ℝ) * (f x * (f x - (discreteKernel W).mulVec f x))) := by + funext x + ring + rw [hfunc, mean_const_mul] + field_simp + +end GibbsEuclidean + +section HermitianIncrements + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +variable {A : Matrix ι ι ℝ} (hA : A.IsHermitian) + +lemma hermitian_eigenbasis_apply (i : ι) : + A.toEuclideanLin (hA.eigenvectorBasis i) = + hA.eigenvalues i • hA.eigenvectorBasis i := by + ext j + exact congrFun (hA.mulVec_eigenvectorBasis i) j + +lemma hermitian_repr_apply (v : EuclideanSpace ℝ ι) (i : ι) : + hA.eigenvectorBasis.repr (A.toEuclideanLin v) i = + hA.eigenvalues i * hA.eigenvectorBasis.repr v i := by + rw [OrthonormalBasis.repr_apply_apply, ← (Matrix.isSymmetric_toEuclideanLin_iff.mpr hA) + (hA.eigenvectorBasis i) v, hermitian_eigenbasis_apply hA, + real_inner_smul_left, OrthonormalBasis.repr_apply_apply] + +lemma hermitian_repr_pow (k : ℕ) (v : EuclideanSpace ℝ ι) (i : ι) : + hA.eigenvectorBasis.repr ((A ^ k).toEuclideanLin v) i = + hA.eigenvalues i ^ k * hA.eigenvectorBasis.repr v i := by + induction k with + | zero => simp [Matrix.toEuclideanLin, Matrix.toLpLin_one] + | succ k ih => + rw [pow_succ', Matrix.toEuclideanLin, Matrix.toLpLin_mul] + change hA.eigenvectorBasis.repr (A.toEuclideanLin ((A ^ k).toEuclideanLin v)) i = _ + rw [hermitian_repr_apply hA, ih, pow_succ'] + ring + +lemma hermitian_inner_sub_pow (k : ℕ) (v : EuclideanSpace ℝ ι) : + ⟪v, v - (A ^ k).toEuclideanLin v⟫_ℝ = + ∑ i, (hA.eigenvectorBasis.repr v i) ^ 2 * (1 - hA.eigenvalues i ^ k) := by + rw [← hA.eigenvectorBasis.repr.inner_map_map, map_sub, PiLp.inner_apply] + apply Finset.sum_congr rfl + intro i _ + simp only [PiLp.sub_apply, RCLike.inner_apply, conj_trivial, + hermitian_repr_pow hA] + ring + +lemma one_sub_pow_le_mul (θ : ℝ) (hθ0 : 0 ≤ θ) (hθ1 : θ ≤ 1) (k : ℕ) : + 1 - θ ^ k ≤ (k : ℝ) * (1 - θ) := by + induction k with + | zero => simp + | succ k ih => + have hp : θ ^ k ≤ 1 := pow_le_one₀ hθ0 hθ1 + have ht : 0 ≤ 1 - θ := sub_nonneg.mpr hθ1 + rw [pow_succ, Nat.cast_succ] + nlinarith [mul_nonneg (sub_nonneg.mpr hp) ht] + +lemma hermitian_power_increment_le (hθ : ∀ i, hA.eigenvalues i ∈ Set.Icc (0 : ℝ) 1) + (k : ℕ) (v : EuclideanSpace ℝ ι) : + ⟪v, v - (A ^ k).toEuclideanLin v⟫_ℝ ≤ + (k : ℝ) * ⟪v, v - A.toEuclideanLin v⟫_ℝ := by + rw [hermitian_inner_sub_pow hA] + conv_rhs => rw [← pow_one A, hermitian_inner_sub_pow hA] + simp only [pow_one] + rw [Finset.mul_sum] + apply Finset.sum_le_sum + intro i _ + have h := mul_le_mul_of_nonneg_left + (one_sub_pow_le_mul (hA.eigenvalues i) (hθ i).1 (hθ i).2 k) + (sq_nonneg (hA.eigenvectorBasis.repr v i)) + nlinarith only [h] + +end HermitianIncrements + +section DiscreteIncrements + +variable {n : ℕ} (W : Disorder n) + +lemma kernelConjugate_pow_apply (K : Matrix (Spin n) (Spin n) ℝ) + (k : ℕ) (f : Spin n → ℝ) : + (kernelConjugate W K ^ k).toEuclideanLin (gibbsEuclideanEquiv W f) = + gibbsEuclideanEquiv W ((K ^ k).mulVec f) := by + induction k with + | zero => simp [Matrix.toEuclideanLin, Matrix.toLpLin_one] + | succ k ih => + rw [pow_succ', Matrix.toEuclideanLin, Matrix.toLpLin_mul] + change (kernelConjugate W K).toEuclideanLin + ((kernelConjugate W K ^ k).toEuclideanLin (gibbsEuclideanEquiv W f)) = _ + rw [ih, kernelConjugate_apply, pow_succ', ← Matrix.mulVec_mulVec] + +lemma discreteKernel_eigenvalues (hn : 0 < n) (i : Spin n) : + (kernelConjugate_isHermitian W (discreteKernel W) + (discreteKernel_reversible W)).eigenvalues i ∈ Set.Icc (0 : ℝ) 1 := by + let hA := kernelConjugate_isHermitian W (discreteKernel W) (discreteKernel_reversible W) + let v := hA.eigenvectorBasis i + let f := (gibbsEuclideanEquiv W).symm v + have hf : gibbsEuclideanEquiv W f = v := (gibbsEuclideanEquiv W).apply_symm_apply v + have hnorm : ⟪v, v⟫_ℝ = 1 := by + rw [real_inner_self_eq_norm_sq, hA.eigenvectorBasis.orthonormal.norm_eq_one] + norm_num + have heig := hermitian_eigenbasis_apply hA i + change (kernelConjugate W (discreteKernel W)).toEuclideanLin v = + hA.eigenvalues i • v at heig + have hpos := discreteKernel_quadratic_nonneg W f + rw [← gibbsEuclideanEquiv_inner, ← kernelConjugate_apply, hf, heig, + inner_smul_right, hnorm, mul_one] at hpos + have hneg : 0 ≤ ⟪v, v - (kernelConjugate W (discreteKernel W)).toEuclideanLin v⟫_ℝ := by + rw [← hf, kernelConjugate_apply, ← map_sub, gibbsEuclideanEquiv_inner] + change 0 ≤ mean W (fun x => f x * (f x - (discreteKernel W).mulVec f x)) + rw [dirichlet_discrete W hn] + exact div_nonneg (dirichlet_nonneg W f) (Nat.cast_nonneg n) + rw [heig, inner_sub_right, inner_smul_right, hnorm, mul_one] at hneg + exact ⟨hpos, by linarith⟩ + +theorem discrete_inner_increment_le (hn : 0 < n) (k : ℕ) (f : Spin n → ℝ) : + mean W (fun x => f x * (f x - (discreteKernel W ^ k).mulVec f x)) ≤ + (k : ℝ) / n * dirichlet W f := by + have h := hermitian_power_increment_le + (kernelConjugate_isHermitian W (discreteKernel W) (discreteKernel_reversible W)) + (discreteKernel_eigenvalues W hn) k (gibbsEuclideanEquiv W f) + rw [kernelConjugate_pow_apply, kernelConjugate_apply, + ← map_sub, ← map_sub, gibbsEuclideanEquiv_inner, gibbsEuclideanEquiv_inner] at h + change mean W (fun x => f x * (f x - (discreteKernel W ^ k).mulVec f x)) ≤ + (k : ℝ) * mean W (fun x => f x * (f x - (discreteKernel W).mulVec f x)) at h + rw [dirichlet_discrete W hn] at h + convert h using 1 + ring + +end DiscreteIncrements + +section FiniteKernels + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +omit [DecidableEq ι] in +lemma kernel_mul_nonneg {K L : Matrix ι ι ℝ} + (hK : ∀ x y, 0 ≤ K x y) (hL : ∀ x y, 0 ≤ L x y) (x y : ι) : + 0 ≤ (K * L) x y := + Finset.sum_nonneg fun z _ => mul_nonneg (hK x z) (hL z y) + +omit [DecidableEq ι] in +lemma kernel_mul_sum {K L : Matrix ι ι ℝ} + (hK : ∀ x, ∑ y, K x y = 1) (hL : ∀ x, ∑ y, L x y = 1) (x : ι) : + ∑ y, (K * L) x y = 1 := by + simp only [Matrix.mul_apply] + rw [Finset.sum_comm] + simp_rw [← Finset.mul_sum, hL, mul_one] + exact hK x + +omit [DecidableEq ι] in +lemma kernel_mul_stationary {K L : Matrix ι ι ℝ} {μ : ι → ℝ} + (hK : ∀ y, ∑ x, μ x * K x y = μ y) + (hL : ∀ y, ∑ x, μ x * L x y = μ y) (y : ι) : + ∑ x, μ x * (K * L) x y = μ y := by + simp only [Matrix.mul_apply, Finset.mul_sum] + rw [Finset.sum_comm] + simp_rw [← mul_assoc, ← Finset.sum_mul, hK] + exact hL y + +lemma kernel_pow_nonneg {K : Matrix ι ι ℝ} + (hK : ∀ x y, 0 ≤ K x y) (k : ℕ) (x y : ι) : 0 ≤ (K ^ k) x y := by + induction k generalizing x y with + | zero => simp only [pow_zero, Matrix.one_apply]; split_ifs <;> norm_num + | succ k ih => rw [pow_succ]; exact kernel_mul_nonneg ih hK x y + +lemma kernel_pow_sum {K : Matrix ι ι ℝ} + (hK : ∀ x, ∑ y, K x y = 1) (k : ℕ) (x : ι) : ∑ y, (K ^ k) x y = 1 := by + induction k generalizing x with + | zero => simp [Matrix.one_apply] + | succ k ih => rw [pow_succ]; exact kernel_mul_sum ih hK x + +lemma kernel_pow_stationary {K : Matrix ι ι ℝ} {μ : ι → ℝ} + (hK : ∀ y, ∑ x, μ x * K x y = μ y) (k : ℕ) (y : ι) : + ∑ x, μ x * (K ^ k) x y = μ y := by + induction k generalizing y with + | zero => simp [Matrix.one_apply] + | succ k ih => rw [pow_succ]; exact kernel_mul_stationary ih hK y + +omit [DecidableEq ι] in +lemma stationary_increment_identity {K : Matrix ι ι ℝ} {μ : ι → ℝ} + (hrow : ∀ x, ∑ y, K x y = 1) + (hstationary : ∀ y, ∑ x, μ x * K x y = μ y) (f : ι → ℝ) : + (∑ x, ∑ y, μ x * K x y * (f y - f x) ^ 2) = + 2 * ∑ x, μ x * (f x * (f x - K.mulVec f x)) := by + have hsquare : (∑ x, ∑ y, μ x * K x y * (f y) ^ 2) = ∑ y, μ y * (f y) ^ 2 := by + rw [Finset.sum_comm] + simp_rw [← Finset.sum_mul, hstationary] + have hstart : (∑ x, ∑ y, μ x * K x y * (f x) ^ 2) = ∑ x, μ x * (f x) ^ 2 := by + apply Finset.sum_congr rfl + intro x _ + calc + _ = μ x * (f x) ^ 2 * ∑ y, K x y := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro y _ + ring + _ = μ x * (f x) ^ 2 := by rw [hrow, mul_one] + have hexpand : (∑ x, ∑ y, μ x * K x y * (f y - f x) ^ 2) = + (∑ x, ∑ y, μ x * K x y * (f y) ^ 2) + + (∑ x, ∑ y, μ x * K x y * (f x) ^ 2) - + 2 * ∑ x, μ x * f x * K.mulVec f x := by + simp only [Matrix.mulVec, dotProduct, Finset.mul_sum, ← Finset.sum_sub_distrib, + ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro x _ + apply Finset.sum_congr rfl + intro y _ + ring + rw [hexpand, hsquare, hstart] + simp only [Finset.mul_sum, ← Finset.sum_add_distrib, ← Finset.sum_sub_distrib] + apply Finset.sum_congr rfl + intro x _ + ring + +end FiniteKernels + +section StationaryIncrements + +variable {n : ℕ} (W : Disorder n) + +theorem stationary_increment_discrete (hn : 0 < n) (k : ℕ) (f : Spin n → ℝ) : + (∑ x, ∑ y, gibbs W x * (discreteKernel W ^ k) x y * (f y - f x) ^ 2) ≤ + (2 * k : ℝ) / n * dirichlet W f := by + rw [stationary_increment_identity (kernel_pow_sum (discreteKernel_sum W hn) k) + (kernel_pow_stationary (discreteKernel_stationary W hn) k)] + calc + 2 * mean W (fun x => f x * (f x - (discreteKernel W ^ k).mulVec f x)) ≤ + 2 * ((k : ℝ) / n * dirichlet W f) := + mul_le_mul_of_nonneg_left (discrete_inner_increment_le W hn k f) (by norm_num) + _ = _ := by ring + +end StationaryIncrements + +section + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +open scoped Matrix.Norms.Operator in + +lemma matrix_exp_hasSum (A : Matrix ι ι ℝ) : + HasSum (fun k : ℕ => ((k.factorial : ℝ)⁻¹) • A ^ k) (NormedSpace.exp A) := + NormedSpace.exp_series_hasSum_exp' (𝕂 := ℝ) A + +lemma matrix_exp_entry_hasSum (A : Matrix ι ι ℝ) (x y : ι) : + HasSum (fun k : ℕ => ((k.factorial : ℝ)⁻¹) * (A ^ k) x y) (NormedSpace.exp A x y) := by + exact ((Pi.hasSum.mp (Pi.hasSum.mp (matrix_exp_hasSum A) x)) y) + +lemma matrix_exp_scalar (a : ℝ) : + NormedSpace.exp (a • (1 : Matrix ι ι ℝ)) = Real.exp a • (1 : Matrix ι ι ℝ) := by + rw [← Matrix.diagonal_one, ← Matrix.diagonal_smul, Matrix.exp_diagonal] + ext x y + simp [Matrix.diagonal_apply, Matrix.one_apply, Pi.coe_exp, ← Real.exp_eq_exp_ℝ] + +lemma matrix_poisson_exp (P : Matrix ι ι ℝ) (a : ℝ) : + NormedSpace.exp (a • (P - 1)) = Real.exp (-a) • NormedSpace.exp (a • P) := by + have hcomm : Commute ((-a) • (1 : Matrix ι ι ℝ)) (a • P) := by + exact (Commute.one_left P).smul_left (-a) |>.smul_right a + have hsplit : a • (P - 1) = (-a) • (1 : Matrix ι ι ℝ) + a • P := by + simp [neg_smul, sub_eq_add_neg, add_comm] + rw [hsplit, Matrix.exp_add_of_commute _ _ hcomm, matrix_exp_scalar] + simp + +lemma matrix_poisson_hasSum (P : Matrix ι ι ℝ) (a : ℝ) (x y : ι) : + HasSum (fun k : ℕ => (Real.exp (-a) * a ^ k / k.factorial) * (P ^ k) x y) + (NormedSpace.exp (a • (P - 1)) x y) := by + have h := (matrix_exp_entry_hasSum (a • P) x y).mul_left (Real.exp (-a)) + rw [matrix_poisson_exp] + change HasSum _ (Real.exp (-a) * NormedSpace.exp (a • P) x y) + apply h.congr_fun + intro k + simp only [_root_.smul_pow, Matrix.smul_apply, smul_eq_mul] + ring + +lemma poisson_coeff_hasSum (a : ℝ) : + HasSum (fun k : ℕ => Real.exp (-a) * a ^ k / k.factorial) 1 := by + have h := (NormedSpace.exp_series_hasSum_exp' (𝕂 := ℝ) a).mul_left (Real.exp (-a)) + rw [← Real.exp_eq_exp_ℝ, ← Real.exp_add, neg_add_cancel, Real.exp_zero] at h + apply h.congr_fun + intro k + simp only [smul_eq_mul] + ring + +lemma poisson_coeff_moment_hasSum (a : ℝ) : + HasSum (fun k : ℕ => (Real.exp (-a) * a ^ k / k.factorial) * k) a := by + have h := (poisson_coeff_hasSum a).mul_left a + rw [mul_one] at h + apply (hasSum_nat_add_iff' 1).mp + simp only [Finset.sum_range_one, pow_zero, Nat.factorial_zero, Nat.cast_zero, + mul_zero, sub_zero] + apply h.congr_fun + intro k + rw [Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one, pow_succ] + have hk : (k : ℝ) + 1 ≠ 0 := by positivity + field_simp + +lemma poisson_coeff_nonneg (a : ℝ) (ha : 0 ≤ a) (k : ℕ) : + 0 ≤ Real.exp (-a) * a ^ k / k.factorial := by positivity + +end + +section PoissonKernel + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +lemma poisson_kernel_nonneg {P : Matrix ι ι ℝ} (hP : ∀ x y, 0 ≤ P x y) + (a : ℝ) (ha : 0 ≤ a) (x y : ι) : + 0 ≤ NormedSpace.exp (a • (P - 1)) x y := by + apply HasSum.nonneg _ (matrix_poisson_hasSum P a x y) + intro k + exact mul_nonneg (poisson_coeff_nonneg a ha k) (kernel_pow_nonneg hP k x y) + +lemma poisson_kernel_sum {P : Matrix ι ι ℝ} (hP : ∀ x, ∑ y, P x y = 1) + (a : ℝ) (x : ι) : ∑ y, NormedSpace.exp (a • (P - 1)) x y = 1 := by + have h := hasSum_sum (s := Finset.univ) (fun y _ => matrix_poisson_hasSum P a x y) + simp_rw [← Finset.mul_sum, kernel_pow_sum hP, mul_one] at h + exact h.unique (poisson_coeff_hasSum a) + +lemma poisson_kernel_stationary {P : Matrix ι ι ℝ} {μ : ι → ℝ} + (hP : ∀ y, ∑ x, μ x * P x y = μ y) (a : ℝ) (y : ι) : + ∑ x, μ x * NormedSpace.exp (a • (P - 1)) x y = μ y := by + have h := hasSum_sum (s := Finset.univ) (fun x _ => + (matrix_poisson_hasSum P a x y).mul_left (μ x)) + simp_rw [mul_left_comm (μ _), ← Finset.mul_sum, kernel_pow_stationary hP] at h + have h' := (poisson_coeff_hasSum a).mul_right (μ y) + rw [one_mul] at h' + exact h.unique h' + +lemma poisson_stationary_increment_le {P : Matrix ι ι ℝ} {μ : ι → ℝ} + (f : ι → ℝ) (D : ℝ) + (hincrement : ∀ k : ℕ, (∑ x, ∑ y, μ x * (P ^ k) x y * (f y - f x) ^ 2) ≤ (k : ℝ) * D) + (a : ℝ) (ha : 0 ≤ a) : + (∑ x, ∑ y, μ x * NormedSpace.exp (a • (P - 1)) x y * (f y - f x) ^ 2) ≤ a * D := by + have h := hasSum_sum (s := Finset.univ) (fun x _ => + hasSum_sum (s := Finset.univ) (fun y _ => + ((matrix_poisson_hasSum P a x y).mul_left (μ x)).mul_right ((f y - f x) ^ 2))) + have hleft : HasSum (fun k : ℕ => (Real.exp (-a) * a ^ k / k.factorial) * + (∑ x, ∑ y, μ x * (P ^ k) x y * (f y - f x) ^ 2)) + (∑ x, ∑ y, μ x * NormedSpace.exp (a • (P - 1)) x y * (f y - f x) ^ 2) := by + apply h.congr_fun + intro k + simp only [Finset.mul_sum] + apply Finset.sum_congr rfl + intro x _ + apply Finset.sum_congr rfl + intro y _ + ring + have hright := (poisson_coeff_moment_hasSum a).mul_right D + apply hasSum_le _ hleft hright + intro k + calc + _ ≤ (Real.exp (-a) * a ^ k / k.factorial) * ((k : ℝ) * D) := + mul_le_mul_of_nonneg_left (hincrement k) (poisson_coeff_nonneg a ha k) + _ = _ := by ring + +end PoissonKernel + +section ContinuousIncrements + +variable {n : ℕ} (W : Disorder n) + +lemma continuousKernel_poisson (hn : 0 < n) (t : ℝ) : + continuousKernel W t = NormedSpace.exp (((n : ℝ) * t) • (discreteKernel W - 1)) := by + rw [continuousKernel, generator_discreteKernel W hn, smul_smul, mul_comm] + +lemma continuousKernel_nonneg (hn : 0 < n) (t : ℝ) (ht : 0 ≤ t) (x y : Spin n) : + 0 ≤ continuousKernel W t x y := by + rw [continuousKernel_poisson W hn] + exact poisson_kernel_nonneg (discreteKernel_nonneg W) _ + (mul_nonneg (Nat.cast_nonneg n) ht) x y + +lemma continuousKernel_sum (hn : 0 < n) (t : ℝ) (x : Spin n) : + ∑ y, continuousKernel W t x y = 1 := by + rw [continuousKernel_poisson W hn] + exact poisson_kernel_sum (discreteKernel_sum W hn) _ x + +lemma continuousKernel_stationary (hn : 0 < n) (t : ℝ) (y : Spin n) : + ∑ x, gibbs W x * continuousKernel W t x y = gibbs W y := by + rw [continuousKernel_poisson W hn] + exact poisson_kernel_stationary (discreteKernel_stationary W hn) _ y + +theorem stationary_increment_continuous (hn : 0 < n) (t : ℝ) (ht : 0 ≤ t) (f : Spin n → ℝ) : + (∑ x, ∑ y, gibbs W x * continuousKernel W t x y * (f y - f x) ^ 2) ≤ + 2 * t * dirichlet W f := by + rw [continuousKernel_poisson W hn] + have hdt : ∀ k : ℕ, (∑ x, ∑ y, gibbs W x * (discreteKernel W ^ k) x y * (f y - f x) ^ 2) ≤ + (k : ℝ) * (2 * dirichlet W f / n) := by + intro k + calc + _ ≤ (2 * k : ℝ) / n * dirichlet W f := stationary_increment_discrete W hn k f + _ = _ := by ring + have h := poisson_stationary_increment_le f (2 * dirichlet W f / n) hdt + ((n : ℝ) * t) (mul_nonneg (Nat.cast_nonneg n) ht) + calc + _ ≤ ((n : ℝ) * t) * (2 * dirichlet W f / n) := h + _ = 2 * t * dirichlet W f := by + have hn0 : (n : ℝ) ≠ 0 := by exact_mod_cast (ne_of_gt hn) + field_simp + +end ContinuousIncrements + +section SignTest + +variable {ι : Type*} [Fintype ι] + +lemma finite_event_test {p μ : ι → ℝ} (hmass : ∑ y, p y = ∑ y, μ y) + (s : ι → Prop) [DecidablePred s] : + (∑ y, if s y then p y else 0) - (∑ y, if s y then μ y else 0) ≤ + (1 / 2 : ℝ) * ∑ y, |p y - μ y| := by + let d : ι → ℝ := fun y => p y - μ y + have hzero : ∑ y, d y = 0 := by simp [d, Finset.sum_sub_distrib, hmass] + have hwhole : (∑ y, if s y then d y else 0) + (∑ y, if s y then 0 else d y) = 0 := by + rw [← Finset.sum_add_distrib] + simpa only [ite_add_ite, add_zero, zero_add, ite_self] using hzero + have hineq : (∑ y, if s y then d y else 0) - (∑ y, if s y then 0 else d y) ≤ + ∑ y, |d y| := by + rw [← Finset.sum_sub_distrib] + apply Finset.sum_le_sum + intro y _ + by_cases hy : s y + · simp only [hy, ite_true, sub_zero]; exact le_abs_self _ + · simp only [hy, ite_false, zero_sub]; exact neg_le_abs _ + have heq : (∑ y, if s y then p y else 0) - (∑ y, if s y then μ y else 0) = + ∑ y, if s y then d y else 0 := by + rw [← Finset.sum_sub_distrib] + apply Finset.sum_congr rfl + intro y _ + by_cases hy : s y <;> simp [hy, d] + rw [heq] + change _ ≤ (1 / 2 : ℝ) * ∑ y, |d y| + linarith + +lemma odd_halfspace_mass_le {μ : ι → ℝ} (hμ : ∀ x, 0 ≤ μ x) (hμsum : ∑ x, μ x = 1) + (flip : Equiv.Perm ι) (hflip : ∀ x, μ (flip x) = μ x) + (f : ι → ℝ) (hodd : ∀ x, f (flip x) = -f x) (c : ℝ) : + (∑ y, if 0 < c * f y then μ y else 0) ≤ (1 / 2 : ℝ) := by + have heq : (∑ y, if 0 < c * f y then μ y else 0) = + ∑ y, if c * f y < 0 then μ y else 0 := by + calc + _ = ∑ y, if 0 < c * f (flip y) then μ (flip y) else 0 := + (Equiv.sum_comp flip _).symm + _ = _ := by simp [hodd, hflip] + have hdisjoint : (∑ y, if 0 < c * f y then μ y else 0) + + (∑ y, if c * f y < 0 then μ y else 0) ≤ 1 := by + rw [← hμsum, ← Finset.sum_add_distrib] + apply Finset.sum_le_sum + intro y _ + by_cases hp : 0 < c * f y + · simp [hp, not_lt.mpr hp.le] + · by_cases hn : c * f y < 0 + · simp [hp, hn] + · simp [hp, hn, hμ y] + linarith + +lemma sign_row_test {p μ : ι → ℝ} (hpsum : ∑ y, p y = 1) (hμsum : ∑ y, μ y = 1) + (f : ι → ℝ) (c : ℝ) + (hhalf : (∑ y, if 0 < c * f y then μ y else 0) ≤ (1 / 2 : ℝ)) : + (1 / 2 : ℝ) - (1 / 2 : ℝ) * ∑ y, |p y - μ y| ≤ + ∑ y, if c * f y ≤ 0 then p y else 0 := by + have htv := finite_event_test (hpsum.trans hμsum.symm) (fun y => 0 < c * f y) + have hcover : (∑ y, if 0 < c * f y then p y else 0) + + (∑ y, if c * f y ≤ 0 then p y else 0) = 1 := by + rw [← hpsum, ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro y _ + by_cases hy : 0 < c * f y <;> simp [hy, le_of_not_gt, not_le.mpr] + linarith + +lemma sign_failure_pointwise (u v a : ℝ) (ha : 0 < a) : + (if u * v ≤ 0 then (1 : ℝ) else 0) ≤ + (if |u| ≤ a then (1 : ℝ) else 0) + (v - u) ^ 2 / a ^ 2 := by + have hnonneg : 0 ≤ (v - u) ^ 2 / a ^ 2 := div_nonneg (sq_nonneg _) (sq_nonneg _) + by_cases hsmall : |u| ≤ a + · simp only [hsmall, ite_true] + split_ifs <;> linarith + · simp only [hsmall, ite_false, zero_add] + split_ifs with hsign + · have habs : a < |u| := lt_of_not_ge hsmall + have hs : a ^ 2 ≤ u ^ 2 := by nlinarith [sq_abs u] + apply (le_div_iff₀ (sq_pos_of_pos ha)).mpr + nlinarith [sq_nonneg v] + · exact hnonneg + +lemma sign_failure_average {μ : ι → ℝ} (hμ : ∀ x, 0 ≤ μ x) + {K : Matrix ι ι ℝ} (hK : ∀ x y, 0 ≤ K x y) (hrow : ∀ x, ∑ y, K x y = 1) + (f : ι → ℝ) (a : ℝ) (ha : 0 < a) : + (∑ x, μ x * ∑ y, if f x * f y ≤ 0 then K x y else 0) ≤ + (∑ x, if |f x| ≤ a then μ x else 0) + + (∑ x, ∑ y, μ x * K x y * (f y - f x) ^ 2) / a ^ 2 := by + calc + _ = ∑ x, ∑ y, μ x * K x y * (if f x * f y ≤ 0 then (1 : ℝ) else 0) := by + simp only [Finset.mul_sum] + apply Finset.sum_congr rfl + intro x _ + apply Finset.sum_congr rfl + intro y _ + split_ifs <;> ring + _ ≤ ∑ x, ∑ y, μ x * K x y * + ((if |f x| ≤ a then (1 : ℝ) else 0) + (f y - f x) ^ 2 / a ^ 2) := by + apply Finset.sum_le_sum + intro x _ + apply Finset.sum_le_sum + intro y _ + exact mul_le_mul_of_nonneg_left (sign_failure_pointwise (f x) (f y) a ha) + (mul_nonneg (hμ x) (hK x y)) + _ = _ := by + simp only [mul_add, Finset.sum_add_distrib, ← mul_div_assoc, + ← Finset.sum_div] + congr 1 + apply Finset.sum_congr rfl + intro x _ + by_cases hx : |f x| ≤ a + · simp only [hx, ite_true, mul_one, ← Finset.mul_sum, hrow] + · simp [hx] + +lemma good_mass_complement {μ : ι → ℝ} (hμsum : ∑ x, μ x = 1) (d : ι → ℝ) (c : ℝ) : + 1 - (∑ x, if c < d x then μ x else 0) = ∑ x, if d x ≤ c then μ x else 0 := by + have h : (∑ x, if c < d x then μ x else 0) + + (∑ x, if d x ≤ c then μ x else 0) = 1 := by + rw [← hμsum, ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro x _ + by_cases hx : c < d x <;> simp [hx, not_le.mpr, le_of_not_gt] + linarith + +lemma sign_good_mass_bound {μ : ι → ℝ} (hμ : ∀ x, 0 ≤ μ x) (hμsum : ∑ x, μ x = 1) + (flip : Equiv.Perm ι) (hflip : ∀ x, μ (flip x) = μ x) + {K : Matrix ι ι ℝ} (hK : ∀ x y, 0 ≤ K x y) (hrow : ∀ x, ∑ y, K x y = 1) + (f : ι → ℝ) (hodd : ∀ x, f (flip x) = -f x) (a : ℝ) (ha : 0 < a) : + 1 - (∑ x, if (1 / 4 : ℝ) < (1 / 2 : ℝ) * ∑ y, |K x y - μ y| then μ x else 0) ≤ + 4 * ((∑ x, if |f x| ≤ a then μ x else 0) + + (∑ x, ∑ y, μ x * K x y * (f y - f x) ^ 2) / a ^ 2) := by + rw [good_mass_complement hμsum] + calc + _ ≤ 4 * ∑ x, μ x * ∑ y, if f x * f y ≤ 0 then K x y else 0 := by + rw [Finset.mul_sum] + apply Finset.sum_le_sum + intro x _ + have her := sign_row_test (hrow x) hμsum f (f x) + (odd_halfspace_mass_le hμ hμsum flip hflip f hodd (f x)) + have herr0 : 0 ≤ ∑ y, if f x * f y ≤ 0 then K x y else 0 := by + apply Finset.sum_nonneg + intro y _ + split_ifs <;> first | exact hK x y | exact le_rfl + split_ifs with hd + · have hlower : (1 / 4 : ℝ) ≤ ∑ y, if f x * f y ≤ 0 then K x y else 0 := by + linarith + nlinarith [mul_le_mul_of_nonneg_left hlower (hμ x)] + · exact mul_nonneg (by norm_num) (mul_nonneg (hμ x) herr0) + _ ≤ _ := mul_le_mul_of_nonneg_left (sign_failure_average hμ hK hrow f a ha) (by norm_num) + +end SignTest + +variable {n : ℕ} (W : Disorder n) + +theorem continuous_good_mass_bound (hn : 0 < n) (t : ℝ) (ht : 0 ≤ t) + (a : Fin n → ℝ) (b : ℝ) (hb : 0 < b) : + 1 - continuousGoodMass W t ≤ + 4 * ((∑ x, if |linearObservable a x| ≤ b then gibbs W x else 0) + + (2 * t * ∑ i, a i ^ 2) / b ^ 2) := by + have htest := sign_good_mass_bound (gibbs_nonneg W) (gibbs_sum W) spinFlipEquiv + (gibbs_spinFlip W) (continuousKernel_nonneg W hn t ht) (continuousKernel_sum W hn t) + (linearObservable a) (linearObservable_spinFlip a) b hb + change 1 - continuousGoodMass W t ≤ _ at htest + refine le_trans htest ?_ + apply mul_le_mul_of_nonneg_left _ (by norm_num) + apply add_le_add_right + apply div_le_div_of_nonneg_right _ (sq_nonneg b) + exact (stationary_increment_continuous W hn t ht (linearObservable a)).trans + (mul_le_mul_of_nonneg_left (dirichlet_linear_le W a) (by positivity)) + +theorem discrete_good_mass_bound (hn : 0 < n) (k : ℕ) + (a : Fin n → ℝ) (b : ℝ) (hb : 0 < b) : + 1 - discreteGoodMass W k ≤ + 4 * ((∑ x, if |linearObservable a x| ≤ b then gibbs W x else 0) + + ((2 * k : ℝ) / n * ∑ i, a i ^ 2) / b ^ 2) := by + have htest := sign_good_mass_bound (gibbs_nonneg W) (gibbs_sum W) spinFlipEquiv + (gibbs_spinFlip W) (kernel_pow_nonneg (discreteKernel_nonneg W) k) + (kernel_pow_sum (discreteKernel_sum W hn) k) + (linearObservable a) (linearObservable_spinFlip a) b hb + change 1 - discreteGoodMass W k ≤ _ at htest + refine le_trans htest ?_ + apply mul_le_mul_of_nonneg_left _ (by norm_num) + apply add_le_add_right + apply div_le_div_of_nonneg_right _ (sq_nonneg b) + exact (stationary_increment_discrete W hn k (linearObservable a)).trans + (mul_le_mul_of_nonneg_left (dirichlet_linear_le W a) (by positivity)) + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/HighTemperature.lean b/lean/OAI/MathematicalPhysics/CriticalSK/HighTemperature.lean new file mode 100644 index 0000000000000000000000000000000000000000..9e56f268fb7b09bc38fdd1316a9c9131165fc70e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/HighTemperature.lean @@ -0,0 +1,329 @@ +import OAI.MathematicalPhysics.CriticalSK.GapMixing +import OAI.MathematicalPhysics.CriticalSK.Mixing + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open scoped BigOperators Topology +namespace CriticalSK + + +section + +open Set Filter MeasureTheory ProbabilityTheory + +lemma spinValue_abs (b : Bool) : |spinValue b|=1 := by cases b <;> norm_num [spinValue] + +lemma hamiltonian_gaussianLinear {n : ℕ} (x : Spin n) (W : Disorder n) : + hamiltonian W x = gaussianLinear (fun e : Edge n => spinValue (x e.val.1)*spinValue (x e.val.2)) W := by + unfold hamiltonian gaussianLinear + apply Finset.sum_congr rfl + intro e _ + ring + +lemma edge_card_le_sq (n : ℕ) : Fintype.card (Edge n) ≤ n^2 := by + simpa only [Edge,Fintype.card_prod,Fintype.card_fin,pow_two] using Fintype.card_subtype_le (fun p : Fin n × Fin n => p.1 < p.2) + +lemma hamiltonian_exp_moment {n : ℕ} (hn : 0 Real.exp (a*hamiltonian W x)) (disorderLaw n) ∧ + (∫ W : Disorder n, Real.exp (a*hamiltonian W x) ∂disorderLaw n) ≤ Real.exp ((n:ℝ)/2) := by + let c := fun e : Edge n => a*(spinValue (x e.val.1)*spinValue (x e.val.2)) + have he (W : Disorder n) : a*hamiltonian W x = gaussianLinear c W := by + rw [hamiltonian_gaussianLinear] + simp only [gaussianLinear,Finset.mul_sum,c] + apply Finset.sum_congr rfl + intro e _ + ring + simp_rw [he] + constructor + · exact gaussian_exp_integrable _ c + · change (∫ W, Real.exp (gaussianLinear c W) ∂gaussianScalarPi (n : ℝ≥0)⁻¹) ≤ _ + rw [gaussian_exp_integral] + apply Real.exp_le_exp.mpr + have hc (e : Edge n) : c e^2=1 := by + have hh : |c e|=1 := by simp only [c,abs_mul,ha,spinValue_abs,mul_one] + nlinarith [sq_abs (c e)] + simp only [hc,Finset.sum_const,Finset.card_univ,nsmul_eq_mul,mul_one,NNReal.coe_inv,NNReal.coe_natCast] + have hN : (0:ℝ) div_nonneg (Real.exp_nonneg _) (Real.exp_nonneg _)) + (fun W hW => by + apply (le_div_iff₀ (Real.exp_pos _)).mpr + simpa only [one_mul] using Real.exp_le_exp.mpr hW) + rw [integral_div] at hp + apply hp.trans + calc + _ ≤ Real.exp ((n:ℝ)/2)/Real.exp (3*(n:ℝ)) := div_le_div_of_nonneg_right hm (Real.exp_nonneg _) + _ = _ := by rw [← Real.exp_sub]; congr 1; ring + +lemma hamiltonian_abs_tail {n : ℕ} (hn : 0 hamiltonian_abs_tail hn x) + _ = (Fintype.card (Spin n):ℝ)*(2*Real.exp (-(5/2:ℝ)*(n:ℝ))) := by simp + _ ≤ Real.exp (n:ℝ)*(2*Real.exp (-(5/2:ℝ)*(n:ℝ))) := mul_le_mul_of_nonneg_right (spin_card_le_exp n) (by positivity) + _ = _ := by rw [← mul_assoc,mul_comm _ 2,mul_assoc,← Real.exp_add]; congr 2; ring + +lemma maximum_energy_tendsto : Tendsto (fun n : ℕ => (disorderLaw n).real + {W | ∃ x : Spin n, 3*(n:ℝ) < |hamiltonian W x|}) atTop (𝓝 0) := by + have he : Tendsto (fun n : ℕ => 2*Real.exp (-(3/2:ℝ)*(n:ℝ))) atTop (𝓝 0) := by + have hh : Tendsto (fun n : ℕ => (-(3/2:ℝ))*(n:ℝ)) atTop atBot := + Tendsto.const_mul_atTop_of_neg (by norm_num) tendsto_natCast_atTop_atTop + simpa only [mul_zero,Function.comp_def] using (Real.tendsto_exp_atBot.comp hh).const_mul 2 + apply squeeze_zero' (Filter.Eventually.of_forall (fun _ => measureReal_nonneg)) _ he + filter_upwards [eventually_gt_atTop (0:ℕ)] with n hn + exact (measureReal_mono (fun W hW => by obtain ⟨x,hx⟩ := hW; exact ⟨x,hx.le⟩)).trans (maximum_energy_tail hn) + +end + +section + +open Set Filter MeasureTheory + +lemma polynomial_exp_eventually_le (C : ℝ) {a : ℝ} (ha : 0 C*((n:ℝ)^2*Real.exp (-a*(n:ℝ)))) atTop (𝓝 0) := by + have hh := ((tendsto_rpow_mul_exp_neg_mul_atTop_nhds_zero 2 a ha).comp tendsto_natCast_atTop_atTop).const_mul C + simpa only [Function.comp_def,Real.rpow_two,mul_zero] using hh + filter_upwards [ht.eventually (gt_mem_nhds (by norm_num : (0:ℝ)<1))] with n hn + have hm := mul_le_mul_of_nonneg_right hn.le (Real.exp_nonneg (a*(n:ℝ))) + have he : Real.exp (-a*(n:ℝ))*Real.exp (a*(n:ℝ))=1 := by + rw [← Real.exp_add,show -a*(n:ℝ)+a*(n:ℝ)=0 by ring,Real.exp_zero] + simpa only [one_mul,mul_assoc,he,mul_one] using hm + +lemma finite_tempered_mixing {n : ℕ} (hn : 0 fiberMass W i x) := by + unfold fiberMass + apply continuous_finsetSum + intro y _ + by_cases hy : sameExcept i x y + · simp only [ite_eq_left hy]; exact gibbs_continuous y + · simp only [ite_eq_right hy]; exact continuous_const + +lemma siteKernel_continuous {n : ℕ} (i : Fin n) (x y : Spin n) : + Continuous (fun W : Disorder n => siteKernel W i x y) := by + by_cases h : sameExcept i x y + · simp only [siteKernel,ite_eq_left h] + exact (gibbs_continuous y).div (fiberMass_continuous i x) (fun W => (fiberMass_pos W i x).ne') + · simp only [siteKernel,ite_eq_right h]; exact continuous_const + +lemma mean_continuous {n : ℕ} (f : Spin n → ℝ) : Continuous (fun W : Disorder n => mean W f) := by + unfold mean + exact continuous_finsetSum _ (fun x _ => (gibbs_continuous x).mul continuous_const) + +lemma variance_continuous {n : ℕ} (f : Spin n → ℝ) : Continuous (fun W : Disorder n => variance W f) := by + unfold variance + change Continuous (fun W : Disorder n => ∑ x, gibbs W x*(f x-mean W f)^2) + apply continuous_finsetSum + intro x _ + exact (gibbs_continuous x).mul ((continuous_const.sub (mean_continuous f)).pow 2) + +lemma dirichlet_continuous {n : ℕ} (f : Spin n → ℝ) : Continuous (fun W : Disorder n => dirichlet W f) := by + unfold dirichlet mean + apply continuous_finsetSum + intro i _ + apply continuous_finsetSum + intro x _ + apply (gibbs_continuous x).mul + apply Continuous.pow + apply continuous_const.sub + exact continuous_finsetSum _ (fun y _ => (siteKernel_continuous i x y).mul continuous_const) + +def poincareEvent (n : ℕ) (β C : ℝ) : Set (Disorder n) := + {W | ∀ f : Spin n → ℝ, variance (β • W) f ≤ C*dirichlet (β • W) f} + +lemma poincareEvent_closed (n : ℕ) (β C : ℝ) : IsClosed (poincareEvent n β C) := by + have he : poincareEvent n β C = ⋂ f : Spin n → ℝ, + {W : Disorder n | variance (β • W) f ≤ C*dirichlet (β • W) f} := by ext W; simp [poincareEvent] + rw [he] + apply isClosed_iInter + intro f + have hs : Continuous (fun W : Disorder n => β • W) := continuous_const_smul β + exact isClosed_le ((variance_continuous f).comp hs) + (continuous_const.mul ((dirichlet_continuous f).comp hs)) + +lemma tempered_mixing_probability_lower {ε β C : ℝ} (hε : 0<ε) (hβ : β≤1) + (hsmall : 6*(1-β)≤ε/2) (hC : 1≤C) : + ∀ᶠ n : ℕ in atTop, + (disorderLaw n).real (poincareEvent n β C)-2*Real.exp (-(3/2:ℝ)*(n:ℝ)) ≤ + (disorderLaw n).real {W | continuousMixingTime W≤Real.exp (ε*(n:ℝ)) ∧ + (discreteMixingTime W:ℝ)≤Real.exp (ε*(n:ℝ))} := by + filter_upwards [tempered_mixing_eventual_implication hε hβ hsmall hC,eventually_gt_atTop (0:ℕ)] with n hn hnp + let U : Set (Disorder n) := {W | continuousMixingTime W≤Real.exp (ε*(n:ℝ)) ∧ + (discreteMixingTime W:ℝ)≤Real.exp (ε*(n:ℝ))} + let B : Set (Disorder n) := {W | ∃ x : Spin n, 3*(n:ℝ)≤|hamiltonian W x|} + have hs : poincareEvent n β C ⊆ U ∪ B := by + intro W hW + by_cases hb : W∈B + · exact Or.inr hb + · apply Or.inl + apply hn W _ hW + intro x + by_contra hx + exact hb ⟨x,(lt_of_not_ge hx).le⟩ + have hp := (measureReal_mono (μ := disorderLaw n) hs).trans (measureReal_union_le U B) + have hb := maximum_energy_tail hnp + change (disorderLaw n).real B ≤ _ at hb + change _ ≤ (disorderLaw n).real U + linarith + +noncomputable def mixingReductionError (n : ℕ) (ε : ℝ) : ℝ := + 2*Real.exp (-(3/2:ℝ)*(n:ℝ)) + + (disorderLaw n).real {W | (1:ℝ)≤|continuousGoodMass W ((n:ℝ)^(2/3-ε))-1|} + + (disorderLaw n).real {W | (1:ℝ)≤|discreteGoodMass W ⌈(n:ℝ)^(5/3-ε)⌉₊-1|} + +def twoClockMixingEvent (n : ℕ) (ε : ℝ) : Set (Disorder n) := + {W | (n:ℝ)^(2/3-ε) ≤ continuousMixingTime W ∧ + continuousMixingTime W ≤ Real.exp (ε*(n:ℝ)) ∧ + (n:ℝ)^(5/3-ε) ≤ (discreteMixingTime W:ℝ) ∧ + (discreteMixingTime W:ℝ) ≤ Real.exp (ε*(n:ℝ))} + +lemma mixingReductionError_tendsto {ε : ℝ} (hε : 0<ε) : + Tendsto (fun n => mixingReductionError n ε) atTop (𝓝 0) := by + have hc := realized_continuous_initial_states (fun n => (n:ℝ)^(2/3-ε)) + (fun _ => by positivity) (rpow_ratio_tendsto_zero hε) 1 zero_lt_one + have hd := realized_discrete_initial_states (fun n => ⌈(n:ℝ)^(5/3-ε)⌉₊) + (ceil_rpow_ratio_tendsto_zero (by norm_num : (0:ℝ)<5/3) hε) 1 zero_lt_one + have he : Tendsto (fun n : ℕ => 2*Real.exp (-(3/2:ℝ)*(n:ℝ))) atTop (𝓝 0) := by + have ht : Tendsto (fun n : ℕ => -(3/2:ℝ)*(n:ℝ)) atTop atBot := + (tendsto_const_mul_atBot_of_neg (by norm_num : -(3/2:ℝ)<0)).mpr tendsto_natCast_atTop_atTop + simpa using (Real.tendsto_exp_atBot.comp ht).const_mul 2 + simpa only [mixingReductionError,add_zero] using (he.add hc).add hd + +lemma mixingGapReduction_lower {ε β C : ℝ} (hε : 0<ε) (hβ : β≤1) + (hsmall : 6*(1-β)≤ε/2) (hC : 1≤C) : + ∀ᶠ n : ℕ in atTop, + (disorderLaw n).real (poincareEvent n β C)-mixingReductionError n ε ≤ + (disorderLaw n).real (twoClockMixingEvent n ε) := by + filter_upwards [tempered_mixing_eventual_implication hε hβ hsmall hC, + eventually_gt_atTop (0:ℕ)] with n hn hnp + let B : Set (Disorder n) := {W | ∃ x : Spin n, 3*(n:ℝ)≤|hamiltonian W x|} + let Lc : Set (Disorder n) := {W | (1:ℝ)≤|continuousGoodMass W ((n:ℝ)^(2/3-ε))-1|} + let Ld : Set (Disorder n) := {W | (1:ℝ)≤|discreteGoodMass W ⌈(n:ℝ)^(5/3-ε)⌉₊-1|} + have hs : poincareEvent n β C ⊆ ((twoClockMixingEvent n ε ∪ B) ∪ Lc) ∪ Ld := by + intro W hW + by_cases hb : W∈B + · exact Or.inl (Or.inl (Or.inr hb)) + by_cases hc : W∈Lc + · exact Or.inl (Or.inr hc) + by_cases hd : W∈Ld + · exact Or.inr hd + apply Or.inl ∘ Or.inl ∘ Or.inl + have hH : ∀ x, |hamiltonian W x|≤3*(n:ℝ) := by + intro x + by_contra hx + exact hb ⟨x,(lt_of_not_ge hx).le⟩ + have hu := hn W hH hW + have hc' : 0 (disorderLaw n).real + {W | (n : ℝ) ^ (2 / 3 - δ) ≤ logSobolevConstant W}) atTop (𝓝 1) := by + have hp := critical_relaxation_lower_bound δ hδ + apply tendsto_order.mpr + constructor + · intro a ha + filter_upwards [(tendsto_order.mp hp).1 a ha, eventually_gt_atTop 0] with n hn hnpos + refine lt_of_lt_of_le hn (measureReal_mono ?_) + intro W hW + exact hW.trans (relaxationTime_le_logSobolevConstant W hnpos) + · intro a ha + exact Filter.Eventually.of_forall (fun _ => lt_of_le_of_lt measureReal_le_one ha) + +theorem critical_lower_exponents + (ε : ℝ) (hε : 0 < ε) (hεhalf : ε < 1 / 2) (δ : ℝ) (hδ : 0 < δ) : + Tendsto (fun n => (disorderLaw n).real + {W | (n : ℝ) ^ (2 / 3 - δ) ≤ continuousMixingAt W ε}) atTop (𝓝 1) ∧ + Tendsto (fun n => (disorderLaw n).real + {W | (n : ℝ) ^ (5 / 3 - δ) ≤ (discreteMixingAt W ε : ℝ)}) atTop (𝓝 1) ∧ + Tendsto (fun n => (disorderLaw n).real + {W | (n : ℝ) ^ (2 / 3 - δ) ≤ relaxationTime W}) atTop (𝓝 1) ∧ + Tendsto (fun n => (disorderLaw n).real + {W | (n : ℝ) ^ (2 / 3 - δ) ≤ logSobolevConstant W}) atTop (𝓝 1) := by + have hm := critical_mixing_lower_bounds_at ε hε hεhalf δ hδ + exact ⟨hm.1, hm.2, critical_relaxation_lower_bound δ hδ, + critical_logSobolev_lower_bound δ hδ⟩ + +end CriticalSK +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/Main.lean b/lean/OAI/MathematicalPhysics/CriticalSK/Main.lean new file mode 100644 index 0000000000000000000000000000000000000000..0f069f32199b0c67d6e9c064360542bd86673484 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/Main.lean @@ -0,0 +1,34 @@ +import OAI.MathematicalPhysics.CriticalSK.GaussianMatrices +import OAI.MathematicalPhysics.CriticalSK.GaussianMoments +import OAI.MathematicalPhysics.CriticalSK.MinMax +import OAI.MathematicalPhysics.CriticalSK.PathEnergy +import OAI.MathematicalPhysics.CriticalSK.Powers +import OAI.MathematicalPhysics.CriticalSK.Saddle +import OAI.MathematicalPhysics.CriticalSK.SpinModel +import OAI.MathematicalPhysics.CriticalSK.GaussianConcentration +import OAI.MathematicalPhysics.CriticalSK.Gibbs +import OAI.MathematicalPhysics.CriticalSK.PathSpectra +import OAI.MathematicalPhysics.CriticalSK.SphereGeometry +import OAI.MathematicalPhysics.CriticalSK.BlockEnergy +import OAI.MathematicalPhysics.CriticalSK.CubeOverlap +import OAI.MathematicalPhysics.CriticalSK.HeatBath +import OAI.MathematicalPhysics.CriticalSK.SphereSaddle +import OAI.MathematicalPhysics.CriticalSK.Cavity +import OAI.MathematicalPhysics.CriticalSK.GapMixing +import OAI.MathematicalPhysics.CriticalSK.OverlapMoments +import OAI.MathematicalPhysics.CriticalSK.TriNoise +import OAI.MathematicalPhysics.CriticalSK.CubeRestriction +import OAI.MathematicalPhysics.CriticalSK.Resolvent +import OAI.MathematicalPhysics.CriticalSK.GOESpectrum +import OAI.MathematicalPhysics.CriticalSK.DisorderTransfer +import OAI.MathematicalPhysics.CriticalSK.EdgeAsymptotics +import OAI.MathematicalPhysics.CriticalSK.PartitionBounds +import OAI.MathematicalPhysics.CriticalSK.SaddleLimit +import OAI.MathematicalPhysics.CriticalSK.OrientationBounds +import OAI.MathematicalPhysics.CriticalSK.OrientationLimits +import OAI.MathematicalPhysics.CriticalSK.SmallBall +import OAI.MathematicalPhysics.CriticalSK.Covariance +import OAI.MathematicalPhysics.CriticalSK.Equilibrium +import OAI.MathematicalPhysics.CriticalSK.Mixing +import OAI.MathematicalPhysics.CriticalSK.Rayleigh +import OAI.MathematicalPhysics.CriticalSK.HighTemperature diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/MinMax.lean b/lean/OAI/MathematicalPhysics/CriticalSK/MinMax.lean new file mode 100644 index 0000000000000000000000000000000000000000..3d5c3dbaa5e09d640e95598717728e0617c9bc52 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/MinMax.lean @@ -0,0 +1,183 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open MeasureTheory ProbabilityTheory + +open scoped ENNReal NNReal + +open scoped BigOperators InnerProductSpace + +open Module + +namespace CriticalSK + +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] + +def basisSpan {n : ℕ} (b : OrthonormalBasis (Fin n) ℝ E) (s : Finset (Fin n)) : Submodule ℝ E := + Submodule.span ℝ (Set.range (fun i : s => b i)) + +omit [FiniteDimensional ℝ E] in +lemma basisSpan_finrank {n : ℕ} (b : OrthonormalBasis (Fin n) ℝ E) (s : Finset (Fin n)) : + finrank ℝ (basisSpan b s) = s.card := by + have hli : LinearIndependent ℝ (fun i : s => b i) := + b.orthonormal.linearIndependent.comp (fun i : s => (i : Fin n)) Subtype.val_injective + rw [basisSpan, finrank_span_eq_card hli, Fintype.card_coe] + +omit [FiniteDimensional ℝ E] in +lemma basisSpan_repr_zero {n : ℕ} (b : OrthonormalBasis (Fin n) ℝ E) + (s : Finset (Fin n)) {x : E} (hx : x ∈ basisSpan b s) + (i : Fin n) (hi : i ∉ s) : b.repr x i = 0 := by + have hmem : x ∈ Submodule.span ℝ (b.toBasis '' (s : Set (Fin n))) := by + convert hx using 1 + congr 1 + ext y + simp [Set.mem_range, Set.mem_image] + have hs := b.toBasis.repr_support_subset_of_mem_span _ hmem + have hz : b.toBasis.repr x i = 0 := by + by_contra hz + exact hi (hs (Finsupp.mem_support_iff.mpr hz)) + simpa only [b.coe_toBasis_repr_apply] using hz + +lemma basisSpan_intersection_unit {n : ℕ} + (b c : OrthonormalBasis (Fin n) ℝ E) (s t : Finset (Fin n)) + (hcard : n < s.card + t.card) : + ∃ x : E, ‖x‖ = 1 ∧ x ∈ basisSpan b s ∧ x ∈ basisSpan c t := by + have hn : finrank ℝ E = n := by + rw [finrank_eq_card_basis b.toBasis, Fintype.card_fin] + have hnot : ¬ Disjoint (basisSpan b s) (basisSpan c t) := by + intro hd + have h := Submodule.finrank_add_finrank_le_of_disjoint hd + rw [basisSpan_finrank, basisSpan_finrank, hn] at h + omega + rw [Submodule.disjoint_def] at hnot + push Not at hnot + obtain ⟨x, hxs, hxt, hx⟩ := hnot + refine ⟨‖x‖⁻¹ • x, ?_, (basisSpan b s).smul_mem _ hxs, (basisSpan c t).smul_mem _ hxt⟩ + rw [norm_smul, Real.norm_eq_abs, abs_inv, abs_of_nonneg (norm_nonneg _)] + exact inv_mul_cancel₀ (norm_ne_zero_iff.mpr hx) + +def basisQuadratic {n : ℕ} (b : OrthonormalBasis (Fin n) ℝ E) (a : Fin n → ℝ) (x : E) : ℝ := + ∑ i, a i * (b.repr x i) ^ 2 + +omit [FiniteDimensional ℝ E] in +lemma basis_sum_squares {n : ℕ} (b : OrthonormalBasis (Fin n) ℝ E) (x : E) : + ∑ i, (b.repr x i) ^ 2 = ‖x‖ ^ 2 := by + simp only [b.repr_apply_apply] + exact b.sum_sq_inner_right x + +omit [FiniteDimensional ℝ E] in +lemma basisQuadratic_le {n : ℕ} (b : OrthonormalBasis (Fin n) ℝ E) (a : Fin n → ℝ) + (s : Finset (Fin n)) {x : E} (hx : x ∈ basisSpan b s) (hunit : ‖x‖ = 1) + {r : ℝ} (hr : ∀ i ∈ s, a i ≤ r) : basisQuadratic b a x ≤ r := by + calc + _ ≤ ∑ i, r * (b.repr x i) ^ 2 := by + apply Finset.sum_le_sum + intro i _ + by_cases hi : i ∈ s + · exact mul_le_mul_of_nonneg_right (hr i hi) (sq_nonneg _) + · simp [basisSpan_repr_zero b s hx i hi] + _ = r := by rw [← Finset.mul_sum, basis_sum_squares, hunit]; ring + +omit [FiniteDimensional ℝ E] in +lemma basisQuadratic_ge {n : ℕ} (b : OrthonormalBasis (Fin n) ℝ E) (a : Fin n → ℝ) + (s : Finset (Fin n)) {x : E} (hx : x ∈ basisSpan b s) (hunit : ‖x‖ = 1) + {r : ℝ} (hr : ∀ i ∈ s, r ≤ a i) : r ≤ basisQuadratic b a x := by + calc + _ = ∑ i, r * (b.repr x i) ^ 2 := by rw [← Finset.mul_sum, basis_sum_squares, hunit]; ring + _ ≤ _ := by + apply Finset.sum_le_sum + intro i _ + by_cases hi : i ∈ s + · exact mul_le_mul_of_nonneg_right (hr i hi) (sq_nonneg _) + · simp [basisSpan_repr_zero b s hx i hi] + +lemma basis_minmax_upper {n : ℕ} (a b : OrthonormalBasis (Fin n) ℝ E) + (α β : Fin n → ℝ) (hα : Antitone α) (hβ : Antitone β) + {S : Set ℝ} {f : ℝ → ℝ} (hf : MonotoneOn f S) + (hβS : ∀ i, β i ∈ S) + (hqS : ∀ x : E, ‖x‖ = 1 → basisQuadratic b β x ∈ S) + (hform : ∀ x : E, ‖x‖ = 1 → basisQuadratic a α x ≤ f (basisQuadratic b β x)) + (i : Fin n) : α i ≤ f (β i) := by + have hcard : n < (Finset.Iic i).card + (Finset.Ici i).card := by + simp only [Fin.card_Iic, Fin.card_Ici] + omega + obtain ⟨x, hx, hxa, hxb⟩ := basisSpan_intersection_unit a b + (Finset.Iic i) (Finset.Ici i) hcard + have hlow : α i ≤ basisQuadratic a α x := + basisQuadratic_ge a α (Finset.Iic i) hxa hx + (fun j hj => hα (Finset.mem_Iic.mp hj)) + have hupp : basisQuadratic b β x ≤ β i := + basisQuadratic_le b β (Finset.Ici i) hxb hx + (fun j hj => hβ (Finset.mem_Ici.mp hj)) + exact hlow.trans ((hform x hx).trans (hf (hqS x hx) (hβS i) hupp)) + +lemma basis_minmax_lower {n : ℕ} (a b : OrthonormalBasis (Fin n) ℝ E) + (α β : Fin n → ℝ) (hα : Antitone α) (hβ : Antitone β) + {S : Set ℝ} {f : ℝ → ℝ} (hf : MonotoneOn f S) + (hβS : ∀ i, β i ∈ S) + (hqS : ∀ x : E, ‖x‖ = 1 → basisQuadratic b β x ∈ S) + (hform : ∀ x : E, ‖x‖ = 1 → f (basisQuadratic b β x) ≤ basisQuadratic a α x) + (i : Fin n) : f (β i) ≤ α i := by + have hcard : n < (Finset.Ici i).card + (Finset.Iic i).card := by + simp only [Fin.card_Iic, Fin.card_Ici] + omega + obtain ⟨x, hx, hxa, hxb⟩ := basisSpan_intersection_unit a b + (Finset.Ici i) (Finset.Iic i) hcard + have hupp : basisQuadratic a α x ≤ α i := + basisQuadratic_le a α (Finset.Ici i) hxa hx + (fun j hj => hα (Finset.mem_Ici.mp hj)) + have hlow : β i ≤ basisQuadratic b β x := + basisQuadratic_ge b β (Finset.Iic i) hxb hx + (fun j hj => hβ (Finset.mem_Iic.mp hj)) + exact (hf (hβS i) (hqS x hx) hlow).trans ((hform x hx).trans hupp) + +lemma eigenbasisQuadratic_eq {T : E →ₗ[ℝ] E} (hT : T.IsSymmetric) + {n : ℕ} (hn : finrank ℝ E = n) (x : E) : + basisQuadratic (hT.eigenvectorBasis hn) (hT.eigenvalues hn) x = inner ℝ x (T x) := by + rw [basisQuadratic, ← (hT.eigenvectorBasis hn).sum_inner_mul_inner x (T x)] + apply Finset.sum_congr rfl + intro i _ + rw [real_inner_comm ((hT.eigenvectorBasis hn) i) x, ← (hT.eigenvectorBasis hn).repr_apply_apply, + ← (hT.eigenvectorBasis hn).repr_apply_apply, hT.eigenvectorBasis_apply_self_apply] + simp only [RCLike.ofReal_real_eq_id, id_eq] + ring + +lemma eigenvalue_form_comparison {A B : E →ₗ[ℝ] E} + (hA : A.IsSymmetric) (hB : B.IsSymmetric) + {n : ℕ} (hn : finrank ℝ E = n) {S : Set ℝ} {Φ : ℝ → ℝ} + (hplus : MonotoneOn (fun e => e + Φ e) S) + (hminus : MonotoneOn (fun e => e - Φ e) S) + (hBS : ∀ i, hB.eigenvalues hn i ∈ S) + (hqS : ∀ x : E, ‖x‖ = 1 → inner ℝ x (B x) ∈ S) + (hform : ∀ x : E, ‖x‖ = 1 → + |inner ℝ x (A x) - inner ℝ x (B x)| ≤ Φ (inner ℝ x (B x))) + (i : Fin n) : |hA.eigenvalues hn i - hB.eigenvalues hn i| ≤ Φ (hB.eigenvalues hn i) := by + have hu := basis_minmax_upper (hA.eigenvectorBasis hn) (hB.eigenvectorBasis hn) + (hA.eigenvalues hn) (hB.eigenvalues hn) (hA.eigenvalues_antitone hn) + (hB.eigenvalues_antitone hn) hplus hBS + (fun x hx => by simpa only [eigenbasisQuadratic_eq] using hqS x hx) + (fun x hx => by + simp only [eigenbasisQuadratic_eq] + have h := (abs_le.mp (hform x hx)).2 + linarith) i + have hl := basis_minmax_lower (hA.eigenvectorBasis hn) (hB.eigenvectorBasis hn) + (hA.eigenvalues hn) (hB.eigenvalues hn) (hA.eigenvalues_antitone hn) + (hB.eigenvalues_antitone hn) hminus hBS + (fun x hx => by simpa only [eigenbasisQuadratic_eq] using hqS x hx) + (fun x hx => by + simp only [eigenbasisQuadratic_eq] + have h := (abs_le.mp (hform x hx)).1 + linarith) i + exact abs_le.mpr ⟨by linarith, by linarith⟩ + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/Mixing.lean b/lean/OAI/MathematicalPhysics/CriticalSK/Mixing.lean new file mode 100644 index 0000000000000000000000000000000000000000..153e50d9805fd2f4b54bbb84fa65fc8362afa4c9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/Mixing.lean @@ -0,0 +1,305 @@ +import OAI.MathematicalPhysics.CriticalSK.Equilibrium + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +namespace CriticalSK + +section + +open Set Filter + +section KernelContraction + +variable {ι : Type*} [Fintype ι] + +lemma kernel_l1_contraction {K : Matrix ι ι ℝ} {μ p : ι → ℝ} {c : ℝ} + (hmass : ∑ x, p x = ∑ x, μ x) + (hminor : ∀ x y, c ≤ K x y) (hrow : ∀ x, ∑ y, K x y = 1) + (hstat : ∀ y, ∑ x, μ x*K x y = μ y) : + (∑ y, |(∑ x, p x*K x y)-μ y|) ≤ + (1-Fintype.card ι*c)*(∑ x, |p x-μ x|) := by + have hid (y : ι) : (∑ x, p x*K x y)-μ y = ∑ x, (p x-μ x)*(K x y-c) := by + simp only [sub_mul,mul_sub,Finset.sum_sub_distrib,← Finset.sum_mul,hstat,hmass] + ring + simp_rw [hid] + calc + _ ≤ ∑ y, ∑ x, |(p x-μ x)*(K x y-c)| := + Finset.sum_le_sum (fun _ _ => Finset.abs_sum_le_sum_abs _ _) + _ = ∑ x, |p x-μ x| *(1-Fintype.card ι*c) := by + simp_rw [abs_mul,abs_of_nonneg (sub_nonneg.mpr (hminor _ _))] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro x _ + rw [← Finset.mul_sum,Finset.sum_sub_distrib,hrow] + simp + _ = _ := by rw [← Finset.sum_mul,mul_comm] + +lemma kernel_row_l1_le_two {K : Matrix ι ι ℝ} {μ : ι → ℝ} + (hK : ∀ x y, 0 ≤ K x y) (hμ : ∀ y, 0 ≤ μ y) + (hrow : ∀ x, ∑ y, K x y = 1) (hmass : ∑ y, μ y = 1) (x : ι) : + ∑ y, |K x y-μ y| ≤ 2 := by + calc + _ ≤ ∑ y, (K x y+μ y) := Finset.sum_le_sum (fun y _ => by + simpa only [abs_of_nonneg (hK x y),abs_of_nonneg (hμ y)] using abs_sub (K x y) (μ y)) + _ = 2 := by rw [Finset.sum_add_distrib,hrow,hmass]; norm_num + +variable [DecidableEq ι] + +lemma strictly_positive_kernel_mixes [Nonempty ι] {K : Matrix ι ι ℝ} {μ : ι → ℝ} + (hK : ∀ x y, 0 < K x y) (hμ : ∀ y, 0 ≤ μ y) + (hrow : ∀ x, ∑ y, K x y = 1) (hmass : ∑ y, μ y = 1) + (hstat : ∀ y, ∑ x, μ x*K x y = μ y) : + ∃ k : ℕ, ∀ x, (1/2:ℝ)*(∑ y, |(K^k) x y-μ y|) ≤ 1/4 := by + classical + let T : Finset ℝ := Finset.univ.image (fun p : ι×ι => K p.1 p.2) + have hT : T.Nonempty := Finset.Nonempty.image Finset.univ_nonempty _ + let c := T.min' hT/2 + have hc : 0 < c := by + dsimp [c] + apply half_pos + obtain ⟨p,_,hp⟩ := Finset.mem_image.mp (Finset.min'_mem T hT) + rw [← hp] + exact hK _ _ + have hminor : ∀ x y, c ≤ K x y := by + intro x y + have hh := Finset.min'_le T (K x y) (Finset.mem_image.mpr ⟨(x,y),Finset.mem_univ _,rfl⟩) + have hm : 0 < T.min' hT := by change 0 < T.min' hT/2 at hc; linarith + dsimp [c] + linarith + have hcard : (0:ℝ) < Fintype.card ι := Nat.cast_pos.mpr Fintype.card_pos + have hq0 : 0 ≤ 1-Fintype.card ι*c := by + have hh := Finset.sum_le_sum (fun y (_ : y ∈ Finset.univ) => hminor (Classical.arbitrary ι) y) + simpa only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul,hrow] using sub_nonneg.mpr hh + have hq1 : 1-Fintype.card ι*c < 1 := by nlinarith + have hbound : ∀ k : ℕ, ∀ x, ∑ y, |(K^k) x y-μ y| ≤ 2*(1-Fintype.card ι*c)^k := by + intro k + induction k with + | zero => + intro x + simpa using kernel_row_l1_le_two (K := K^0) (kernel_pow_nonneg (fun x y => (hK x y).le) 0) + hμ (kernel_pow_sum hrow 0) hmass x + | succ k ih => + intro x + simp only [pow_succ,Matrix.mul_apply] + have hh := kernel_l1_contraction (p := fun y => (K^k) x y) + ((kernel_pow_sum hrow k x).trans hmass.symm) hminor hrow hstat + calc + _ ≤ (1-Fintype.card ι*c)*(∑ y, |(K^k) x y-μ y|) := hh + _ ≤ (1-Fintype.card ι*c)*(2*(1-Fintype.card ι*c)^k) := mul_le_mul_of_nonneg_left (ih x) hq0 + _ = _ := by ring + have hh := (tendsto_pow_atTop_nhds_zero_of_lt_one hq0 hq1).eventually + (gt_mem_nhds (show (0:ℝ) < 1/4 by norm_num)) + obtain ⟨k,hk⟩ := hh.exists + refine ⟨k,?_⟩ + intro x + have hb := hbound k x + linarith + +end KernelContraction + +variable {n : ℕ} (W : Disorder n) + +lemma discreteKernel_pos_of_sameExcept (hn : 0 < n) {i : Fin n} {x y : Spin n} + (hxy : sameExcept i x y) : 0 < discreteKernel W x y := by + have hi : 0 < siteKernel W i x y := by + change 0 < if sameExcept i x y then gibbs W y/fiberMass W i x else 0 + rw [ite_eq_left hxy] + exact div_pos (gibbs_pos W y) (fiberMass_pos W i x) + have hs : 0 < ∑ j : Fin n, siteKernel W j x y := + lt_of_lt_of_le hi (Finset.single_le_sum (fun j _ => siteKernel_nonneg W j x y) (Finset.mem_univ i)) + change 0 < (n:ℝ)⁻¹*(∑ j : Fin n, siteKernel W j) x y + simpa only [Matrix.sum_apply] using mul_pos (inv_pos.mpr (Nat.cast_pos.mpr hn)) hs + +lemma discreteKernel_power_pos (hn : 0 < n) (x y : Spin n) : 0 < (discreteKernel W^n) x y := by + classical + let z (k : ℕ) : Spin n := fun i => if i.val < k then y i else x i + have hh : ∀ k, k ≤ n → 0 < (discreteKernel W^k) x (z k) := by + intro k + induction k with + | zero => intro _; simp [z] + | succ k ih => + intro hk + have hik : k < n := by omega + have hstep : sameExcept ⟨k,hik⟩ (z k) (z (k+1)) := by + intro j hj + have hjk : j.val ≠ k := by intro he; apply hj; exact Fin.ext he + dsimp [z] + split_ifs <;> simp_all <;> omega + rw [pow_succ,Matrix.mul_apply] + exact lt_of_lt_of_le (mul_pos (ih (by omega)) (discreteKernel_pos_of_sameExcept W hn hstep)) + (Finset.single_le_sum (fun t _ => mul_nonneg + (kernel_pow_nonneg (discreteKernel_nonneg W) k x t) (discreteKernel_nonneg W t (z (k+1)))) + (Finset.mem_univ (z k))) + have hz : z n = y := by funext i; simp [z,i.isLt] + simpa only [hz] using hh n le_rfl + +lemma discrete_mixing_set_nonempty (hn : 0 < n) : + {k : ℕ | ∀ x, discreteDistance W k x ≤ 1/4}.Nonempty := by + obtain ⟨k,hk⟩ := strictly_positive_kernel_mixes (discreteKernel_power_pos W hn) + (gibbs_nonneg W) (kernel_pow_sum (discreteKernel_sum W hn) n) (gibbs_sum W) + (kernel_pow_stationary (discreteKernel_stationary W hn) n) + refine ⟨n*k,?_⟩ + intro x + simpa only [discreteDistance,totalVariation,pow_mul] using hk x + +lemma continuousKernel_add (s t : ℝ) : continuousKernel W (s+t) = continuousKernel W s*continuousKernel W t := by + unfold continuousKernel + rw [add_smul] + exact Matrix.exp_add_of_commute _ _ (((Commute.refl (generator W)).smul_left s).smul_right t) + +lemma continuousKernel_nat (k : ℕ) : continuousKernel W k = continuousKernel W 1^k := by + induction k with + | zero => simp [continuousKernel] + | succ k ih => rw [Nat.cast_add,Nat.cast_one,continuousKernel_add,ih,pow_succ] + +lemma continuousKernel_one_pos (hn : 0 < n) (x y : Spin n) : 0 < continuousKernel W 1 x y := by + rw [continuousKernel_poisson W hn] + have hs := matrix_poisson_hasSum (discreteKernel W) ((n:ℝ)*1) x y + have hle := sum_le_hasSum ({n} : Finset ℕ) (fun k _ => mul_nonneg (poisson_coeff_nonneg _ (by positivity) k) + (kernel_pow_nonneg (discreteKernel_nonneg W) k x y)) hs + simp only [Finset.sum_singleton] at hle + have hp : 0 < (Real.exp (-((n:ℝ)*1))*((n:ℝ)*1)^n/n.factorial)*(discreteKernel W^n) x y := by + exact mul_pos (div_pos (mul_pos (Real.exp_pos _) (pow_pos (by positivity) n)) + (Nat.cast_pos.mpr (Nat.factorial_pos n))) (discreteKernel_power_pos W hn x y) + exact hp.trans_le hle + +lemma continuous_mixing_set_nonempty (hn : 0 < n) : + {t : ℝ | 0 ≤ t ∧ ∀ x, continuousDistance W t x ≤ 1/4}.Nonempty := by + obtain ⟨k,hk⟩ := strictly_positive_kernel_mixes (continuousKernel_one_pos W hn) + (gibbs_nonneg W) (continuousKernel_sum W hn 1) (gibbs_sum W) + (continuousKernel_stationary W hn 1) + refine ⟨k,Nat.cast_nonneg k,?_⟩ + intro x + simpa only [continuousDistance,totalVariation,continuousKernel_nat] using hk x + +end + +open Set Filter MeasureTheory + +section MixingLower + +variable {n : ℕ} (W : Disorder n) + +lemma continuousDistance_antitone (hn : 0 < n) {s t : ℝ} (_hs : 0 ≤ s) (hst : s ≤ t) (x : Spin n) : + continuousDistance W t x ≤ continuousDistance W s x := by + have hh := kernel_l1_contraction (p := continuousKernel W s x) (c := 0) + ((continuousKernel_sum W hn s x).trans (gibbs_sum W).symm) + (continuousKernel_nonneg W hn (t-s) (sub_nonneg.mpr hst)) + (continuousKernel_sum W hn (t-s)) (continuousKernel_stationary W hn (t-s)) + have he : continuousKernel W t = continuousKernel W s * continuousKernel W (t-s) := by + rw [← continuousKernel_add]; congr 1; ring + simp only [mul_zero,sub_zero,one_mul] at hh + unfold continuousDistance totalVariation + rw [he] + simp only [Matrix.mul_apply] + linarith + +lemma discreteDistance_antitone (hn : 0 < n) {k l : ℕ} (hkl : k ≤ l) (x : Spin n) : + discreteDistance W l x ≤ discreteDistance W k x := by + have hh := kernel_l1_contraction (p := (discreteKernel W^k) x) (c := 0) + ((kernel_pow_sum (discreteKernel_sum W hn) k x).trans (gibbs_sum W).symm) + (kernel_pow_nonneg (discreteKernel_nonneg W) (l-k)) + (kernel_pow_sum (discreteKernel_sum W hn) (l-k)) + (kernel_pow_stationary (discreteKernel_stationary W hn) (l-k)) + have he : discreteKernel W^l = discreteKernel W^k*discreteKernel W^(l-k) := by + rw [← pow_add,Nat.add_sub_of_le hkl] + simp only [mul_zero,sub_zero,one_mul] at hh + unfold discreteDistance totalVariation + rw [he] + simp only [Matrix.mul_apply] + linarith + +lemma continuousMixingTime_lower (hn : 0 < n) {t : ℝ} (h : 0 < continuousGoodMass W t) : + t ≤ continuousMixingTime W := by + apply le_csInf (continuous_mixing_set_nonempty W hn) + intro s hs + by_contra hst + have hzero : continuousGoodMass W t = 0 := by + unfold continuousGoodMass + apply Finset.sum_eq_zero + intro x _ + have hx := (continuousDistance_antitone W hn hs.1 (le_of_not_ge hst) x).trans (hs.2 x) + rw [ite_eq_right (not_lt.mpr hx)] + linarith + +lemma discreteMixingTime_lower (hn : 0 < n) {k : ℕ} (h : 0 < discreteGoodMass W k) : + k ≤ discreteMixingTime W := by + have hs := Nat.sInf_mem (discrete_mixing_set_nonempty W hn) + by_contra hk + have hzero : discreteGoodMass W k = 0 := by + unfold discreteGoodMass + apply Finset.sum_eq_zero + intro x _ + have hx := (discreteDistance_antitone W hn (le_of_not_ge hk) x).trans (hs x) + rw [ite_eq_right (not_lt.mpr hx)] + linarith + +end MixingLower + +lemma event_probability_one_of_error_zero {X : ℕ → Type*} [∀ n, MeasurableSpace (X n)] + (μ : ∀ n, Measure (X n)) [∀ n, IsProbabilityMeasure (μ n)] + (E B : ∀ n, Set (X n)) (hcover : ∀ᶠ n : ℕ in atTop, E n ∪ B n = univ) + (hB : Tendsto (fun n => (μ n).real (B n)) atTop (𝓝 0)) : + Tendsto (fun n => (μ n).real (E n)) atTop (𝓝 1) := by + apply tendsto_order.mpr + constructor + · intro a ha + filter_upwards [hcover,hB.eventually (gt_mem_nhds (show 0 < 1-a by linarith))] with n hn hnb + have hh := measureReal_union_le (μ := μ n) (E n) (B n) + rw [hn,probReal_univ] at hh + linarith + · intro a ha + exact Filter.Eventually.of_forall (fun _ => lt_of_le_of_lt measureReal_le_one ha) + +lemma continuousMixingTime_lower_limit (t : ℕ → ℝ) (ht : ∀ n, 0 ≤ t n) + (hscale : Tendsto (fun n => t n/(n:ℝ)^(2/3:ℝ)) atTop (𝓝 0)) : + Tendsto (fun n => (disorderLaw n).real {W | t n ≤ continuousMixingTime W}) atTop (𝓝 1) := by + apply event_probability_one_of_error_zero (μ := disorderLaw) + (B := fun n => {W | (1:ℝ) ≤ |continuousGoodMass W (t n)-1|}) + · filter_upwards [eventually_gt_atTop 0] with n hn + apply Set.eq_univ_of_forall + intro W + by_cases hW : 0 < continuousGoodMass W (t n) + · exact Or.inl (continuousMixingTime_lower W hn hW) + · exact Or.inr (by change (1:ℝ) ≤ |continuousGoodMass W (t n)-1|; rw [abs_of_nonpos (by linarith [continuousGoodMass_le_one W (t n)])]; linarith) + · exact realized_continuous_initial_states t ht hscale 1 zero_lt_one + +lemma discreteMixingTime_lower_limit (k : ℕ → ℕ) + (hscale : Tendsto (fun n => (k n:ℝ)/(n:ℝ)^(5/3:ℝ)) atTop (𝓝 0)) : + Tendsto (fun n => (disorderLaw n).real {W | k n ≤ discreteMixingTime W}) atTop (𝓝 1) := by + apply event_probability_one_of_error_zero (μ := disorderLaw) + (B := fun n => {W | (1:ℝ) ≤ |discreteGoodMass W (k n)-1|}) + · filter_upwards [eventually_gt_atTop 0] with n hn + apply Set.eq_univ_of_forall + intro W + by_cases hW : 0 < discreteGoodMass W (k n) + · exact Or.inl (discreteMixingTime_lower W hn hW) + · exact Or.inr (by change (1:ℝ) ≤ |discreteGoodMass W (k n)-1|; rw [abs_of_nonpos (by linarith [discreteGoodMass_le_one W (k n)])]; linarith) + · exact realized_discrete_initial_states k hscale 1 zero_lt_one + +theorem critical_mixing_lower_bounds (ε : ℝ) (hε : 0 < ε) : + Tendsto (fun n => (disorderLaw n).real {W | (n:ℝ)^(2/3-ε) ≤ continuousMixingTime W}) atTop (𝓝 1) ∧ + Tendsto (fun n => (disorderLaw n).real {W | (n:ℝ)^(5/3-ε) ≤ (discreteMixingTime W:ℝ)}) atTop (𝓝 1) := by + constructor + · exact continuousMixingTime_lower_limit (fun n => (n:ℝ)^(2/3-ε)) (fun _ => by positivity) (rpow_ratio_tendsto_zero hε) + · have hh := discreteMixingTime_lower_limit (fun n => ⌈(n:ℝ)^(5/3-ε)⌉₊) + (ceil_rpow_ratio_tendsto_zero (by norm_num : (0:ℝ) < 5/3) hε) + apply tendsto_order.mpr + constructor + · intro a ha + filter_upwards [(tendsto_order.mp hh).1 a ha] with n hn + refine lt_of_lt_of_le hn (measureReal_mono ?_) + intro W hW + exact (Nat.le_ceil _).trans (Nat.cast_le.mpr hW) + · intro a ha + exact Filter.Eventually.of_forall (fun _ => lt_of_le_of_lt measureReal_le_one ha) + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/MixingMeasurability.lean b/lean/OAI/MathematicalPhysics/CriticalSK/MixingMeasurability.lean new file mode 100644 index 0000000000000000000000000000000000000000..b5f8470d799cb8dc48f504bb5c2209861b4e7457 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/MixingMeasurability.lean @@ -0,0 +1,127 @@ +import OAI.MathematicalPhysics.CriticalSK.ThresholdMixing + +namespace OAI + +noncomputable section +open scoped BigOperators Topology NNReal ENNReal +open MeasureTheory ProbabilityTheory Filter +namespace CriticalSK + +lemma generator_continuous {n : ℕ} : Continuous (generator (n := n)) := by + apply continuous_pi + intro x + apply continuous_pi + intro y + simp only [generator, Matrix.sum_apply, Matrix.sub_apply] + exact continuous_finsetSum _ (fun i _ => (siteKernel_continuous i x y).sub continuous_const) + +lemma discreteKernel_continuous {n : ℕ} : Continuous (discreteKernel (n := n)) := by + apply continuous_pi + intro x + apply continuous_pi + intro y + simp only [discreteKernel, Matrix.smul_apply, Matrix.sum_apply, smul_eq_mul] + exact continuous_const.mul (continuous_finsetSum _ (fun i _ => siteKernel_continuous i x y)) + +open scoped Matrix.Norms.Operator in +lemma continuousKernel_continuous {n : ℕ} (t : ℝ) : + Continuous (fun W : Disorder n => continuousKernel W t) := by + unfold continuousKernel + have hexp : Continuous (NormedSpace.exp : + Matrix (Spin n) (Spin n) ℝ → Matrix (Spin n) (Spin n) ℝ) := + NormedSpace.exp_continuous + apply hexp.comp + change Continuous ((fun _ : Disorder n => t) • generator (n := n)) + exact continuous_const.smul generator_continuous + +open scoped Matrix.Norms.Operator in +lemma continuousKernel_time_continuous {n : ℕ} (W : Disorder n) : + Continuous (continuousKernel W) := by + unfold continuousKernel + exact NormedSpace.exp_continuous.comp (continuous_id.smul continuous_const) + +lemma continuousDistance_continuous {n : ℕ} (t : ℝ) (x : Spin n) : + Continuous (fun W : Disorder n => continuousDistance W t x) := by + unfold continuousDistance totalVariation + apply Continuous.const_mul + apply continuous_finsetSum + intro y _ + exact (((continuous_apply y).comp ((continuous_apply x).comp + (continuousKernel_continuous t))).sub (gibbs_continuous y)).abs + +lemma discreteDistance_continuous {n : ℕ} (k : ℕ) (x : Spin n) : + Continuous (fun W : Disorder n => discreteDistance W k x) := by + unfold discreteDistance totalVariation + apply Continuous.const_mul + apply continuous_finsetSum + intro y _ + exact (((continuous_apply y).comp ((continuous_apply x).comp + (discreteKernel_continuous.pow k))).sub (gibbs_continuous y)).abs + +lemma continuousDistance_time_continuous {n : ℕ} (W : Disorder n) (x : Spin n) : + Continuous (fun t : ℝ => continuousDistance W t x) := by + unfold continuousDistance totalVariation + apply Continuous.const_mul + apply continuous_finsetSum + intro y _ + exact (((continuous_apply y).comp ((continuous_apply x).comp + (continuousKernel_time_continuous W))).sub continuous_const).abs + +lemma continuousMixingAt_mem {n : ℕ} (W : Disorder n) (hn : 0 < n) + {ε : ℝ} (hε : 0 < ε) : + 0 ≤ continuousMixingAt W ε ∧ ∀ x, continuousDistance W (continuousMixingAt W ε) x ≤ ε := by + have hclosed : IsClosed {t : ℝ | 0 ≤ t ∧ ∀ x, continuousDistance W t x ≤ ε} := by + apply IsClosed.inter (isClosed_le continuous_const continuous_id) + change IsClosed {t : ℝ | ∀ x, continuousDistance W t x ≤ ε} + rw [Set.ofPred_forall] + exact isClosed_iInter fun x => isClosed_le (continuousDistance_time_continuous W x) continuous_const + exact hclosed.csInf_mem (continuousMixingAt_set_nonempty W hn hε) ⟨0, fun _ hs => hs.1⟩ + +lemma continuousMixingAt_le_iff {n : ℕ} (W : Disorder n) (hn : 0 < n) + {ε : ℝ} (hε : 0 < ε) (t : ℝ) : + continuousMixingAt W ε ≤ t ↔ 0 ≤ t ∧ ∀ x, continuousDistance W t x ≤ ε := by + have hm := continuousMixingAt_mem W hn hε + constructor + · intro ht + exact ⟨hm.1.trans ht, fun x => (continuousDistance_antitone W hn hm.1 ht x).trans (hm.2 x)⟩ + · intro ht + exact csInf_le ⟨0, fun _ hs => hs.1⟩ ht + +lemma discreteMixingAt_le_iff {n : ℕ} (W : Disorder n) (hn : 0 < n) + {ε : ℝ} (hε : 0 < ε) (k : ℕ) : + discreteMixingAt W ε ≤ k ↔ ∀ x, discreteDistance W k x ≤ ε := by + constructor + · intro hk + have hm : ∀ x, discreteDistance W (discreteMixingAt W ε) x ≤ ε := + Nat.sInf_mem (discreteMixingAt_set_nonempty W hn hε) + exact fun x => (discreteDistance_antitone W hn hk x).trans (hm x) + · intro hk + exact Nat.sInf_le hk + +lemma continuousMixingAt_measurable {n : ℕ} (hn : 0 < n) {ε : ℝ} (hε : 0 < ε) : + Measurable (fun W : Disorder n => continuousMixingAt W ε) := by + apply LowerSemicontinuous.measurable + rw [lowerSemicontinuous_iff_isClosed_preimage] + intro t + change IsClosed {W : Disorder n | continuousMixingAt W ε ≤ t} + simp only [continuousMixingAt_le_iff _ hn hε] + apply (show IsClosed {W : Disorder n | (0 : ℝ) ≤ t} from + isClosed_le continuous_const continuous_const).inter + change IsClosed {W : Disorder n | ∀ x, continuousDistance W t x ≤ ε} + rw [Set.ofPred_forall] + exact isClosed_iInter fun x => isClosed_le (continuousDistance_continuous t x) continuous_const + +lemma discreteMixingAt_measurable {n : ℕ} (hn : 0 < n) {ε : ℝ} (hε : 0 < ε) : + Measurable (fun W : Disorder n => discreteMixingAt W ε) := by + apply measurable_of_Iic + intro k + change MeasurableSet {W : Disorder n | discreteMixingAt W ε ≤ k} + simp only [discreteMixingAt_le_iff _ hn hε, Set.ofPred_forall] + apply MeasurableSet.iInter + intro x + exact (isClosed_le (discreteDistance_continuous k x) continuous_const).measurableSet + +end CriticalSK +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/OrientationBounds.lean b/lean/OAI/MathematicalPhysics/CriticalSK/OrientationBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..57e52d762b5a3ea63334fd849fd46468b0f5c271 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/OrientationBounds.lean @@ -0,0 +1,644 @@ +import OAI.MathematicalPhysics.CriticalSK.CubeRestriction +import OAI.MathematicalPhysics.CriticalSK.SaddleLimit + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open scoped BigOperators ENNReal NNReal Real Topology + +open MeasureTheory ProbabilityTheory Filter + +open scoped ENNReal NNReal + +open scoped BigOperators NNReal + +open scoped BigOperators + +open scoped BigOperators InnerProductSpace + +open Module + +open Matrix Polynomial + +open scoped BigOperators Topology + +open Filter + +open scoped BigOperators NNReal ENNReal Topology Pointwise Matrix.Norms.Elementwise + +open Set Metric MeasureTheory MeasureTheory.Measure + +open scoped ENNReal NNReal BigOperators + +open MeasureTheory ProbabilityTheory + +open scoped ENNReal NNReal Topology + +open MeasureTheory MeasureTheory.Measure Set Metric + +open scoped NNReal ENNReal BigOperators + +open scoped NNReal ENNReal + +open ProbabilityTheory + +open Metric Set MeasureTheory + +open scoped ENNReal Pointwise + +open MeasureTheory Filter Set Real + +open Finset Real +open scoped BigOperators ENNReal Topology +open Set MeasureTheory +open scoped BigOperators ENNReal +open MeasureTheory +open Finset Real Filter +open scoped Topology +namespace CriticalSK + + + +section + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +lemma exp_midpoint_bound (A B : ℝ) : Real.exp ((A+B)/2) ≤ (Real.exp A+Real.exp B)/2 := by + have he : Real.exp ((A+B)/2)*Real.cosh ((A-B)/2) = (Real.exp A+Real.exp B)/2 := by + rw [Real.cosh_eq, ← mul_div_assoc, mul_add, ← Real.exp_add, ← Real.exp_add] + rw [show (A+B)/2+(A-B)/2=A by ring, + show (A+B)/2+-((A-B)/2)=B by ring] + rw [← he] + exact le_mul_of_one_le_right (Real.exp_pos _).le (Real.one_le_cosh _) + +def correlatedVector (u v : EuclideanSpace ℝ ι) (t : ℝ) : EuclideanSpace ℝ ι := + t • u + Real.sqrt (1-t^2) • v + +omit [DecidableEq ι] in +lemma correlatedVector_gram {u v : EuclideanSpace ℝ ι} {r t : ℝ} + (hu : ‖u‖ = r) (hv : ‖v‖ = r) (horth : inner ℝ u v = 0) (ht : |t| ≤ 1) : + ‖correlatedVector u v t‖ = r ∧ inner ℝ u (correlatedVector u v t) = t*r^2 := by + have ht2 : t^2 ≤ 1 := by nlinarith [(abs_le.mp ht).1,(abs_le.mp ht).2] + have hs := Real.sq_sqrt (sub_nonneg.mpr ht2) + have horth' : inner ℝ v u = 0 := by rw [real_inner_comm,horth] + have huu : inner ℝ u u = r^2 := by rw [real_inner_self_eq_norm_sq,hu] + have hvv : inner ℝ v v = r^2 := by rw [real_inner_self_eq_norm_sq,hv] + have hr : 0 ≤ r := hu ▸ norm_nonneg u + constructor + · apply (sq_eq_sq₀ (norm_nonneg _) hr).mp + rw [← real_inner_self_eq_norm_sq] + simp only [correlatedVector,inner_add_left,inner_add_right,real_inner_smul_left, + real_inner_smul_right,horth,horth',huu,hvv] + nlinarith + · simp only [correlatedVector,inner_add_right,real_inner_smul_right,horth,huu,mul_zero,add_zero] + +omit [DecidableEq ι] in +lemma correlatedEnergy_sign (lam : ι → ℝ) (u v : EuclideanSpace ℝ ι) (t : ℝ) : + diagonalEnergy lam (correlatedVector u v t)+diagonalEnergy lam (correlatedVector u (-v) t) = + 2*(t^2*diagonalEnergy lam u+(Real.sqrt (1-t^2))^2*diagonalEnergy lam v) := by + simp only [diagonalEnergy,correlatedVector,PiLp.add_apply,PiLp.smul_apply,PiLp.neg_apply,smul_eq_mul] + simp_rw [Finset.mul_sum,← Finset.sum_add_distrib] + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + ring + +lemma correlatedMoment_sign (lam : ι → ℝ) {u v : EuclideanSpace ℝ ι} + (horth : inner ℝ u v = 0) (q t : ℝ) : + pairMoment lam u (correlatedVector u (-v) t) q = pairMoment lam u (correlatedVector u v t) q := by + have he := orthogonal_pair_integral_eq + (fun x y => Real.exp (((1+q)*diagonalEnergy lam x+(1-q)*diagonalEnergy lam (correlatedVector x y t))/2)) + (x := u) (y := -v) (x' := u) (y' := v) rfl (norm_neg v) + (by rw [inner_neg_right,horth,neg_zero]) + simpa only [pairMoment,pairIntegrand,correlatedVector,map_add,map_smul,map_neg] using he + +lemma pairMoment_correlated_lower (lam : ι → ℝ) {u v : EuclideanSpace ℝ ι} + (hnorm : ‖u‖ = ‖v‖) (horth : inner ℝ u v = 0) {q t : ℝ} + (hq : q ∈ Set.Icc 0 1) (ht : |t| ≤ 1) : + pairMoment lam u v q ≤ pairMoment lam u (correlatedVector u v t) q := by + let p := q+(1-q)*t^2 + have hpq : |q| ≤ |p| := (le_abs_self p).trans' (by + rw [abs_of_nonneg hq.1] + dsimp [p] + nlinarith [mul_nonneg (sub_nonneg.mpr hq.2) (sq_nonneg t)]) + apply (pairMoment_mono_abs lam hnorm hpq).trans + have ht2 : t^2 ≤ 1 := by nlinarith [(abs_le.mp ht).1,(abs_le.mp ht).2] + have hs := Real.sq_sqrt (sub_nonneg.mpr ht2) + have hpt (U : Matrix.orthogonalGroup ι ℝ) : pairIntegrand lam u v p U ≤ + (pairIntegrand lam u (correlatedVector u v t) q U+ + pairIntegrand lam u (correlatedVector u (-v) t) q U)/2 := by + have hE := correlatedEnergy_sign lam (orthogonalIsometry U u) (orthogonalIsometry U v) t + have hmid := exp_midpoint_bound + (((1+q)*diagonalEnergy lam (orthogonalIsometry U u)+(1-q)*diagonalEnergy lam (correlatedVector (orthogonalIsometry U u) (orthogonalIsometry U v) t))/2) + (((1+q)*diagonalEnergy lam (orthogonalIsometry U u)+(1-q)*diagonalEnergy lam (correlatedVector (orthogonalIsometry U u) (-(orthogonalIsometry U v)) t))/2) + convert! hmid using 1 + · unfold pairIntegrand + congr 1 + dsimp [p] + rw [hs] at hE + linear_combination -(1-q)/4*hE + · simp only [pairIntegrand,correlatedVector,map_add,map_smul,map_neg] + have hi := integral_mono (orthogonalHaar_integrable (pairIntegrand_continuous lam u v p)) + (((orthogonalHaar_integrable (pairIntegrand_continuous lam u (correlatedVector u v t) q)).add + (orthogonalHaar_integrable (pairIntegrand_continuous lam u (correlatedVector u (-v) t) q))).div_const 2) hpt + simp only [Pi.add_apply] at hi + rw [integral_div,integral_add + (orthogonalHaar_integrable (pairIntegrand_continuous lam u (correlatedVector u v t) q)) + (orthogonalHaar_integrable (pairIntegrand_continuous lam u (correlatedVector u (-v) t) q))] at hi + change pairMoment lam u v p ≤ (pairMoment lam u (correlatedVector u v t) q+ + pairMoment lam u (correlatedVector u (-v) t) q)/2 at hi + rw [correlatedMoment_sign lam horth] at hi + linarith + +end + + +section + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +lemma pairMoment_min_at_orthogonal (lam : ι → ℝ) {u v x y : EuclideanSpace ℝ ι} {r t q : ℝ} + (hu : ‖u‖ = r) (hv : ‖v‖ = r) (horth : inner ℝ u v = 0) + (hx : ‖x‖ = r) (hy : ‖y‖ = r) (ht : |t| ≤ 1) + (hxy : inner ℝ x y = t*r^2) (hq : q ∈ Set.Icc 0 1) : + pairMoment lam u v q ≤ pairMoment lam x y q := by + have hg := correlatedVector_gram hu hv horth ht + have he := orthogonal_pair_integral_eq + (fun x y => Real.exp (((1+q)*diagonalEnergy lam x+(1-q)*diagonalEnergy lam y)/2)) + (x := u) (y := correlatedVector u v t) (x' := x) (y' := y) + (hu.trans hx.symm) (hg.1.trans hy.symm) (hg.2.trans hxy.symm) + change pairMoment lam u (correlatedVector u v t) q = pairMoment lam x y q at he + exact (pairMoment_correlated_lower lam (hu.trans hv.symm) horth hq ht).trans_eq he + +variable [Nonempty ι] + +def sphereWeightedPair (lam : ι → ℝ) (r q : ℝ) (p : unitSphere ι × unitSphere ι) : ℝ := + Real.exp (((1+q)*diagonalEnergy lam (r • p.1.val)+(1-q)*diagonalEnergy lam (r • p.2.val))/2) + +omit [DecidableEq ι] [Nonempty ι] in +lemma sphereWeightedPair_factor (lam : ι → ℝ) (r q : ℝ) (p : unitSphere ι × unitSphere ι) : + sphereWeightedPair lam r q p = + Real.exp ((1+q)/2*diagonalEnergy lam (r • p.1.val))* + Real.exp ((1-q)/2*diagonalEnergy lam (r • p.2.val)) := by + rw [← Real.exp_add] + unfold sphereWeightedPair + congr 1 + ring + +omit [DecidableEq ι] [Nonempty ι] in +lemma sphereWeightedPair_continuous (lam : ι → ℝ) (r q : ℝ) : Continuous (sphereWeightedPair lam r q) := by + change Continuous (fun p => sphereWeightedPair lam r q p) + simp_rw [sphereWeightedPair_factor] + exact ((sphere_energy_continuous lam (1+q) r).comp continuous_fst).mul + ((sphere_energy_continuous lam (1-q) r).comp continuous_snd) + +omit [DecidableEq ι] in +lemma sphereWeightedPair_integral (lam : ι → ℝ) (r q : ℝ) : + (∫ p, sphereWeightedPair lam r q p ∂(sphereUniform.prod sphereUniform)) = + spherePartition lam (1+q) r * spherePartition lam (1-q) r := by + simp_rw [sphereWeightedPair_factor] + rw [integral_prod_mul (fun u : unitSphere ι => Real.exp ((1+q)/2*diagonalEnergy lam (r • u.val))) + (fun v : unitSphere ι => Real.exp ((1-q)/2*diagonalEnergy lam (r • v.val))), + sphereUniform_integral,sphereUniform_integral] + rfl + +omit [Fintype ι] [DecidableEq ι] [Nonempty ι] in +lemma continuous_product_swap {α β γ : Type*} [TopologicalSpace α] [TopologicalSpace β] + [TopologicalSpace γ] {f : α × β → γ} (hf : Continuous f) : + Continuous (fun z : β × α => f (z.2,z.1)) := hf.comp continuous_swap + +omit [Nonempty ι] in +lemma spherePair_haar_continuous (f : unitSphere ι × unitSphere ι → ℝ) (hf : Continuous f) : + Continuous (fun p : unitSphere ι × unitSphere ι => + ∫ U, f (orthogonalSphere U p.1,orthogonalSphere U p.2) ∂orthogonalHaar ι) := by + have hc0 : Continuous (fun z : Matrix.orthogonalGroup ι ℝ × (unitSphere ι × unitSphere ι) => + f (orthogonalSphere z.1 z.2.1,orthogonalSphere z.1 z.2.2)) := + hf.comp spherePair_action_continuous + have hc := continuous_product_swap hc0 + simpa only [setIntegral_univ] using + continuous_parametric_integral_of_continuous (μ := orthogonalHaar ι) + (f := fun (p : unitSphere ι × unitSphere ι) U => f (orthogonalSphere U p.1,orthogonalSphere U p.2)) hc (s := Set.univ) isCompact_univ + +lemma pairMoment_le_partition_product (lam : ι → ℝ) {u v : EuclideanSpace ℝ ι} {r q : ℝ} + (hu : ‖u‖ = r) (hv : ‖v‖ = r) (horth : inner ℝ u v = 0) (hq : q ∈ Set.Icc 0 1) : + pairMoment lam u v q ≤ spherePartition lam (1+q) r * spherePartition lam (1-q) r := by + have hr : 0 ≤ r := hu ▸ norm_nonneg u + have hnorm (x : unitSphere ι) : ‖r • x.val‖ = r := by + rw [norm_smul,Real.norm_of_nonneg hr,mem_sphere_zero_iff_norm.mp x.property,mul_one] + have hle (p : unitSphere ι × unitSphere ι) : pairMoment lam u v q ≤ + ∫ U, sphereWeightedPair lam r q (orthogonalSphere U p.1,orthogonalSphere U p.2) ∂orthogonalHaar ι := by + have hxy : inner ℝ (r • p.1.val) (r • p.2.val) = inner ℝ p.1.val p.2.val*r^2 := by + rw [real_inner_smul_left,real_inner_smul_right] + ring + have hh := pairMoment_min_at_orthogonal lam hu hv horth (hnorm p.1) (hnorm p.2) + (sphere_inner_abs_le_one p.1 p.2) hxy hq + simpa only [pairMoment,pairIntegrand,sphereWeightedPair,orthogonalSphere,sphereMap,map_smul] using hh + have hc := spherePair_haar_continuous _ (sphereWeightedPair_continuous lam r q) + have hi : Integrable (fun p : unitSphere ι × unitSphere ι => + ∫ U, sphereWeightedPair lam r q (orthogonalSphere U p.1,orthogonalSphere U p.2) ∂orthogonalHaar ι) + (sphereUniform.prod sphereUniform) := by + simpa only [integrableOn_univ] using hc.continuousOn.integrableOn_compact isCompact_univ + have hh := integral_mono (integrable_const (pairMoment lam u v q)) hi hle + rw [integral_const,probReal_univ,one_smul,spherePair_haar_average _ + (sphereWeightedPair_continuous lam r q),sphereWeightedPair_integral] at hh + exact hh + +end + +section + +variable {ι : Type*} [Fintype ι] [Nonempty ι] + +lemma sphericalVariational_deriv_integrable (lam : ι → ℝ) {a b C : ℝ} + (hlam : ∀ i, |lam i| ≤ C) (ha : 0 ≤ a) (hab : a ≤ b) : + IntervalIntegrable (deriv (sphericalVariational lam)) volume a b := by + rw [intervalIntegrable_iff_integrableOn_Ioo_of_le hab] + apply ((continuousOn_const.integrableOn_Icc (μ := volume) (a := a) (b := b) (f := fun _ : ℝ => C/2)).mono_set Ioo_subset_Icc_self).mono' + (aestronglyMeasurable_deriv _ _) + filter_upwards [ae_restrict_mem measurableSet_Ioo] with x hx + have hx0 : 0 < x := ha.trans_lt hx.1 + rw [norm_eq_abs,(sphericalVariational_hasDerivAt lam hx0).deriv] + exact sphericalVariational_slope_bound lam hx0 hlam + +lemma saddleSubcriticalError_bound (lam : ι → ℝ) {C a : ℝ} (hlam : ∀ i, |lam i| ≤ C) + (ha : a ∈ Set.Icc 0 1) : + |sphericalVariational lam 1-sphericalVariational lam a-(1-a^2)/4| ≤ saddleSubcriticalError lam := by + have hpoly : IntervalIntegrable (fun x : ℝ => x/2) volume 0 1 := + (continuous_id.div_const 2).intervalIntegrable _ _ + have hint := (sphericalVariational_deriv_integrable lam hlam (le_refl 0) (by norm_num : (0:ℝ) ≤ 1)).sub hpoly + have hint' := hint.mono_set (show uIcc a 1 ⊆ uIcc (0:ℝ) 1 by + rw [uIcc_of_le ha.2,uIcc_of_le (by norm_num : (0:ℝ) ≤ 1)] + exact Icc_subset_Icc ha.1 (le_refl 1)) + have hc : ContinuousOn (fun x => sphericalVariational lam x-x^2/4) (Set.Icc a 1) := + ((sphericalVariational_continuousOn lam).mono (fun _ hx => ha.1.trans hx.1)).sub + ((continuous_id.pow 2).div_const 4).continuousOn + have hd (x : ℝ) (hx : x ∈ Ioo a 1) : + HasDerivAt (fun x => sphericalVariational lam x-x^2/4) + (deriv (sphericalVariational lam) x-x/2) x := by + have hh := sphericalVariational_hasDerivAt lam (ha.1.trans_lt hx.1) + convert! hh.sub (((hasDerivAt_id x).pow 2).div_const 4) using 1 + rw [hh.deriv] + simp only [id_eq] + ring + have hFTC := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le ha.2 hc hd hint' + have hmono := intervalIntegral.integral_mono_interval ha.1 ha.2 (le_refl (1:ℝ)) + (Eventually.of_forall (fun x => abs_nonneg (deriv (sphericalVariational lam) x-x/2))) hint.abs + have hh := (intervalIntegral.abs_integral_le_integral_abs (f := fun x => deriv (sphericalVariational lam) x-x/2) ha.2).trans hmono + rw [hFTC] at hh + convert hh using 1 <;> try rfl + congr 1 + ring + +lemma sphericalVariational_supercritical_bound (lam : ι → ℝ) {s₀ q : ℝ} + (hedge : spectralTop lam < 2+s₀) (hres₀ : spectralStieltjes lam (2+s₀) ≤ 1) + (hq : q ∈ Set.Icc 0 1) : + sphericalVariational lam (1+q)-sphericalVariational lam 1 ≤ q/2+q^2/4-q^3/12+s₀*q/2 := by + let g : ℝ → ℝ := fun u => u/2+u^2/4-u^3/12+s₀*u/2 + have hg : Continuous g := by dsimp [g]; fun_prop + have hdg (u : ℝ) : HasDerivAt g ((1+u)/2-u^2/4+s₀/2) u := by + convert! ((((hasDerivAt_id u).div_const 2).add (((hasDerivAt_id u).pow 2).div_const 4)).sub + (((hasDerivAt_id u).pow 3).div_const 12)).add (((hasDerivAt_id u).const_mul s₀).div_const 2) using 1 + simp only [id_eq] + ring + have hB (u : ℝ) (hu : 0 ≤ u) : HasDerivAt (fun u => sphericalVariational lam (1+u)) + ((saddleRadius lam (1+u)-(1+u)⁻¹)/2) u := by + simpa only [zero_add,mul_one,Function.comp_def] using + (sphericalVariational_hasDerivAt lam (show 0 < 1+u by linarith)).comp u + ((hasDerivAt_const u 1).add (hasDerivAt_id u)) + have hdBound (u : ℝ) (hu : u ∈ Ioo 0 q) : + (saddleRadius lam (1+u)-(1+u)⁻¹)/2 ≤ (1+u)/2-u^2/4+s₀/2 := by + have hP : 0 < 1+u := by linarith [hu.1] + have hp := (saddleRadius_le_iff lam hP hedge).mpr (show spectralStieltjes lam (2+s₀) ≤ 1+u by linarith [hu.1]) + have he : (2+s₀-(1+u)⁻¹)/2 = (1+u)/2-u^2/(2*(1+u))+s₀/2 := by field_simp; ring + have hc : u^2/4 ≤ u^2/(2*(1+u)) := by + apply (le_div_iff₀ (by positivity)).mpr + nlinarith [mul_nonneg (sq_nonneg u) (show 0 ≤ 1-u by linarith [hu.2,hq.2])] + linarith + have hc : ContinuousOn (fun u => sphericalVariational lam (1+u)-g u) (Set.Icc 0 q) := by + apply ContinuousOn.sub _ hg.continuousOn + exact (sphericalVariational_continuousOn lam).comp (continuous_const.add continuous_id).continuousOn + (fun u hu => show 0 ≤ 1+u by linarith [hu.1]) + have hd (u : ℝ) (hu : u ∈ Ioo 0 q) : + HasDerivAt (fun u => sphericalVariational lam (1+u)-g u) + ((saddleRadius lam (1+u)-(1+u)⁻¹)/2-((1+u)/2-u^2/4+s₀/2)) u := + (hB u hu.1.le).sub (hdg u) + have hmono := antitoneOn_of_deriv_nonpos (convex_Icc 0 q) hc + (fun u hu => (hd u (by rwa [interior_Icc] at hu)).differentiableAt.differentiableWithinAt) + (fun u hu => by + rw [interior_Icc] at hu + rw [(hd u hu).deriv] + linarith [hdBound u hu]) + have hh := hmono (show (0:ℝ) ∈ Set.Icc 0 q from ⟨le_refl 0,hq.1⟩) (show q ∈ Set.Icc 0 q from ⟨hq.1,le_refl q⟩) hq.1 + dsimp [g] at hh + simp only [add_zero,zero_div,zero_pow (by omega : 2 ≠ 0),zero_pow (by omega : 3 ≠ 0),mul_zero,sub_zero] at hh + linarith + +lemma saddlePairDeficit_macro_bound (lam : ι → ℝ) {s₀ q C : ℝ} + (hlam : ∀ i, |lam i| ≤ C) (hs₀ : 0 ≤ s₀) + (hedge : spectralTop lam < 2+s₀) (hres₀ : spectralStieltjes lam (2+s₀) ≤ 1) + (hq : q ∈ Set.Icc 0 1) : + saddlePairDeficit lam q ≤ q^2/2-q^3/12+saddleSubcriticalError lam+s₀/2 := by + have hsub := (abs_le.mp (saddleSubcriticalError_bound lam hlam (show 1-q ∈ Set.Icc (0:ℝ) 1 by constructor <;> linarith [hq.1,hq.2]))).1 + have hsup := sphericalVariational_supercritical_bound lam hedge hres₀ hq + unfold saddlePairDeficit + nlinarith [mul_le_mul_of_nonneg_left hq.2 hs₀] + +lemma saddlePairDeficit_macro_cubic (lam : ι → ℝ) {s₀ q C : ℝ} + (hlam : ∀ i, |lam i| ≤ C) (hs₀ : 0 ≤ s₀) + (hedge : spectralTop lam < 2+s₀) (hres₀ : spectralStieltjes lam (2+s₀) ≤ 1) + (hq : q ∈ Set.Icc (1/4) 1) (herr : saddleSubcriticalError lam+s₀/2 ≤ 1/1536) : + saddlePairDeficit lam q ≤ q^2/2-q^3/24 := by + have hh := saddlePairDeficit_macro_bound lam hlam hs₀ hedge hres₀ (show q ∈ Set.Icc (0:ℝ) 1 by constructor <;> linarith [hq.1,hq.2]) + have hq3 : (1:ℝ)/64 ≤ q^3 := by + calc (1:ℝ)/64 = (1/4)^3 := by norm_num + _ ≤ q^3 := pow_le_pow_left₀ (by norm_num) hq.1 3 + nlinarith + +end + +section + +open Set + +variable {n : ℕ} + +lemma pairMoment_abs (lam : Fin (n+2) → ℝ) {u v : EuclideanSpace ℝ (Fin (n+2))} + (h : ‖u‖ = ‖v‖) (q : ℝ) : pairMoment lam u v q = pairMoment lam u v |q| := by + rcases le_or_gt 0 q with hp | hp + · rw [abs_of_nonneg hp] + · rw [abs_of_neg hp,pairMoment_even lam h] + +lemma pairMoment_variational_upper (lam : Fin (n+2) → ℝ) + {u v : EuclideanSpace ℝ (Fin (n+2))} (hu : ‖u‖ = Real.sqrt (n+2)) + (hv : ‖v‖ = Real.sqrt (n+2)) (horth : inner ℝ u v = 0) + (hlam : ∀ i, |lam i| ≤ 3) {q K : ℝ} (hq : |q| ≤ 1) (hK : 0 < K) + (hlo : K*Real.exp ((n+2)*sphericalVariational lam 1) ≤ + spherePartition lam 1 (Real.sqrt (n+2))) : + pairMoment lam u v q / spherePartition lam 1 (Real.sqrt (n+2))^2 ≤ + (26*Real.exp 1*(n+2)/K)^2 * Real.exp ((n+2)*saddlePairDeficit lam |q|) := by + let S := spherePartition lam 1 (Real.sqrt (n+2)) + let A := 26*Real.exp 1*((n:ℝ)+2) + have hS : 0 < S := spherePartition_pos _ _ _ + have hm := pairMoment_le_partition_product lam hu hv horth (show |q| ∈ Set.Icc (0:ℝ) 1 from ⟨abs_nonneg _,hq⟩) + rw [← pairMoment_abs lam (hu.trans hv.symm) q] at hm + have hup := spherePartition_upper n lam (show 1+|q| ∈ Set.Icc (0:ℝ) 2 by constructor <;> linarith [abs_nonneg q]) hlam + have hdown := spherePartition_upper n lam (show 1-|q| ∈ Set.Icc (0:ℝ) 2 by constructor <;> linarith [abs_nonneg q]) hlam + have hprod := mul_le_mul hup hdown (spherePartition_pos lam (1-|q|) (Real.sqrt (n+2))).le (by positivity) + have hupper : pairMoment lam u v q ≤ A^2 * Real.exp (((n:ℝ)+2)* + (sphericalVariational lam (1+|q|)+sphericalVariational lam (1-|q|))) := by + calc + _ ≤ _ := hm.trans hprod + _ = A^2 * Real.exp (((n:ℝ)+2)*(sphericalVariational lam (1+|q|)+sphericalVariational lam (1-|q|))) := by + rw [mul_add (((n:ℝ)+2)) (sphericalVariational lam (1+|q|)) (sphericalVariational lam (1-|q|)),Real.exp_add] + dsimp only [A] + ring + have hlower : (K*Real.exp (((n:ℝ)+2)*sphericalVariational lam 1))^2 ≤ S^2 := + pow_le_pow_left₀ (by positivity) hlo 2 + have hpos : 0 < (K*Real.exp (((n:ℝ)+2)*sphericalVariational lam 1))^2 := by positivity + calc + pairMoment lam u v q / S^2 ≤ + (A^2 * Real.exp (((n:ℝ)+2)*(sphericalVariational lam (1+|q|)+sphericalVariational lam (1-|q|)))) / + (K*Real.exp (((n:ℝ)+2)*sphericalVariational lam 1))^2 := + div_le_div₀ (by positivity) hupper hpos hlower + _ = _ := by + have he : ((n:ℝ)+2)*saddlePairDeficit lam |q| = + ((n:ℝ)+2)*(sphericalVariational lam (1+|q|)+sphericalVariational lam (1-|q|)) - + 2*(((n:ℝ)+2)*sphericalVariational lam 1) := by unfold saddlePairDeficit; ring + rw [he,Real.exp_sub,two_mul,Real.exp_add] + dsimp only [A] + field_simp + +lemma weighted_overlap_tail_term {m j : ℕ} (hm : 0 < m) (hj : j ≤ m) + {h D : ℝ → ℝ} {A c δ : ℝ} (hA : 0 ≤ A) (hc : 0 ≤ c) + (hδ : 0 ≤ δ) (htail : δ ≤ |latticeOverlap m j|) + (hh : h (latticeOverlap m j) ≤ A*Real.exp ((m:ℝ)*D |latticeOverlap m j|)) + (hD : D |latticeOverlap m j| ≤ latticeOverlap m j^2/2-c*|latticeOverlap m j|^3) : + cubeOverlapMass m j*h (latticeOverlap m j) ≤ A*Real.exp (-(m:ℝ)*c*δ^3) := by + have hp := cubeOverlapMass_chernoff hm hj + have hmul := (mul_le_mul_of_nonneg_left hh (cubeOverlapMass_nonneg m j)).trans + (mul_le_mul_of_nonneg_right hp (show 0 ≤ A*Real.exp ((m:ℝ)*D |latticeOverlap m j|) by positivity)) + have he : Real.exp (-(m:ℝ)*latticeOverlap m j^2/2) * + (A*Real.exp ((m:ℝ)*D |latticeOverlap m j|)) = + A*Real.exp ((m:ℝ)*(D |latticeOverlap m j|-latticeOverlap m j^2/2)) := by + rw [← mul_assoc,mul_comm _ A,mul_assoc,← Real.exp_add] + congr 1 + congr 1 + ring + rw [he] at hmul + apply hmul.trans + apply mul_le_mul_of_nonneg_left _ hA + apply Real.exp_le_exp.mpr + have hcub := pow_le_pow_left₀ hδ htail 3 + have hh0 := mul_le_mul_of_nonneg_left hcub hc + have hh1 : D |latticeOverlap m j|-latticeOverlap m j^2/2 ≤ -c*δ^3 := by linarith + have hh2 := mul_le_mul_of_nonneg_left hh1 (Nat.cast_nonneg m : (0:ℝ) ≤ m) + nlinarith + +lemma weighted_overlap_tail_sum {m : ℕ} (hm : 0 < m) {h D : ℝ → ℝ} {A c δ : ℝ} + (hA : 0 ≤ A) (hc : 0 ≤ c) (hδ : 0 ≤ δ) + (hh : ∀ j ≤ m, δ < |latticeOverlap m j| → + h (latticeOverlap m j) ≤ A*Real.exp ((m:ℝ)*D |latticeOverlap m j|)) + (hD : ∀ j ≤ m, δ < |latticeOverlap m j| → + D |latticeOverlap m j| ≤ latticeOverlap m j^2/2-c*|latticeOverlap m j|^3) : + (∑ j ∈ (Finset.range (m+1)).filter (fun j => ¬ |latticeOverlap m j| ≤ δ), + cubeOverlapMass m j*h (latticeOverlap m j)) ≤ (m+1)*(A*Real.exp (-(m:ℝ)*c*δ^3)) := by + let s := (Finset.range (m+1)).filter (fun j => ¬ |latticeOverlap m j| ≤ δ) + have hc0 : (s.card:ℝ) ≤ m+1 := by + have h : s.card ≤ m+1 := by + simpa only [s,Finset.card_range] using Finset.card_filter_le (s := Finset.range (m+1)) (p := fun j => ¬ |latticeOverlap m j| ≤ δ) + exact_mod_cast h + have hs : ∀ j ∈ s, cubeOverlapMass m j*h (latticeOverlap m j) ≤ A*Real.exp (-(m:ℝ)*c*δ^3) := by + intro j hj + obtain ⟨hjm,hjt⟩ := Finset.mem_filter.mp hj + have hjm' : j ≤ m := by have := Finset.mem_range.mp hjm; omega + have hjt' := lt_of_not_ge hjt + exact weighted_overlap_tail_term hm hjm' hA hc hδ hjt'.le (hh j hjm' hjt') (hD j hjm' hjt') + have hsum := Finset.sum_le_card_nsmul s _ _ hs + rw [nsmul_eq_mul] at hsum + exact hsum.trans (mul_le_mul_of_nonneg_right hc0 (by positivity)) + +lemma polynomial_stretched_exponential_tendsto (p : ℝ) {a c : ℝ} (ha : 0 < a) (hc : 0 < c) : + Tendsto (fun n : ℕ => (n:ℝ)^p*Real.exp (-c*(n:ℝ)^a)) atTop (𝓝 0) := by + have ht := (tendsto_rpow_atTop ha).comp tendsto_natCast_atTop_atTop + have hd := (tendsto_rpow_mul_exp_neg_mul_atTop_nhds_zero (p/a) c hc).comp ht + apply hd.congr' + filter_upwards [eventually_ge_atTop 1] with n hn + dsimp only [Function.comp_def] + rw [← Real.rpow_mul (Nat.cast_nonneg n),mul_div_cancel₀ p ha.ne'] + +end + +open Set MeasureTheory Filter + +lemma latticeOverlap_abs_le {n j : ℕ} (hn : 0 < n) (hj : j ≤ n) : |latticeOverlap n j| ≤ 1 := by + have hn' : (0:ℝ) < n := by exact_mod_cast hn + have hj' : (j:ℝ) ≤ n := by exact_mod_cast hj + have hnon : 0 ≤ 2*(j:ℝ)/n := by positivity + have hup : 2*(j:ℝ)/n ≤ 2 := (div_le_iff₀ hn').mpr (by linarith) + rw [abs_le] + unfold latticeOverlap + constructor <;> linarith + +lemma pairMoment_variational_upper_general {n : ℕ} [Nonempty (Fin n)] (hn : 2 ≤ n) (lam : Fin n → ℝ) + {u v : EuclideanSpace ℝ (Fin n)} (hu : ‖u‖ = Real.sqrt n) + (hv : ‖v‖ = Real.sqrt n) (horth : inner ℝ u v = 0) + (hlam : ∀ i, |lam i| ≤ 3) {q K : ℝ} (hq : |q| ≤ 1) (hK : 0 < K) + (hlo : K*Real.exp ((n:ℝ)*sphericalVariational lam 1) ≤ spherePartition lam 1 (Real.sqrt n)) : + pairMoment lam u v q / spherePartition lam 1 (Real.sqrt n)^2 ≤ + (26*Real.exp 1*n/K)^2 * Real.exp ((n:ℝ)*saddlePairDeficit lam |q|) := by + obtain ⟨m,hm⟩ := Nat.exists_eq_add_of_le hn + rw [Nat.add_comm] at hm + subst n + simpa only [Nat.cast_add,Nat.cast_ofNat] using pairMoment_variational_upper lam (by simpa only [Nat.cast_add,Nat.cast_ofNat] using hu) (by simpa only [Nat.cast_add,Nat.cast_ofNat] using hv) horth hlam hq hK (by simpa only [Nat.cast_add,Nat.cast_ofNat] using hlo) + +lemma sphereOverlap_density_second_moment_general {n : ℕ} (hn : 4 ≤ n) (lam : Fin n → ℝ) + {u v : EuclideanSpace ℝ (Fin n)} {r : ℝ} + (hu : ‖u‖ = r) (hv : ‖v‖ = r) (horth : inner ℝ u v = 0) : + (∫ q : ℝ, pairMoment lam u v q*sphereOverlapDensity n q) = spherePartition lam 1 r^2 := by + obtain ⟨m,hm⟩ := Nat.exists_eq_add_of_le hn + rw [Nat.add_comm] at hm + subst n + exact sphereOverlap_density_second_moment m lam hu hv horth + +lemma saddlePairDeficit_full_cubic {ι : Type*} [Fintype ι] [Nonempty ι] (lam : ι → ℝ) + {s₀ δ q : ℝ} (hlam : ∀ i, |lam i| ≤ 3) (hs₀ : 0 ≤ s₀) + (hedge : spectralTop lam < 2+s₀) (hlow : 2-s₀ ≤ spectralTop lam) + (hres₀ : spectralStieltjes lam (2+s₀) ≤ 1) + (hres : ∀ s ∈ Set.Icc s₀ 1, |spectralStieltjes lam (2+s)-semicircleResolvent s| ≤ (1/100)*Real.sqrt s) + (hδ : 0 ≤ δ) (hscale : 216*s₀ ≤ δ^2) + (herr : saddleSubcriticalError lam+s₀/2 ≤ 1/1536) (hq : q ∈ Set.Icc δ 1) : + saddlePairDeficit lam q ≤ q^2/2-q^3/24 := by + have hq0 : 0 ≤ q := hδ.trans hq.1 + by_cases hsmall : q ≤ 1/4 + · have hsc : 216*s₀ ≤ q^2 := hscale.trans (pow_le_pow_left₀ hδ hq.1 2) + have hh := saddlePairDeficit_shrinking_cubic lam hs₀ hedge hlow hres₀ hres ⟨hq0,hsmall⟩ hsc + nlinarith [pow_nonneg hq0 3] + · exact saddlePairDeficit_macro_cubic lam hlam hs₀ hedge hres₀ ⟨(le_of_not_ge hsmall),hq.2⟩ herr + +lemma orientation_normalized_variance_bound (ε : ℝ) (hε : 0 < ε) : + ∀ᶠ n : ℕ in atTop, ∀ [Nonempty (Fin n)] (lam : Fin n → ℝ) (u v : EuclideanSpace ℝ (Fin n)) (K s₀ : ℝ), + ‖u‖ = Real.sqrt n → ‖v‖ = Real.sqrt n → inner ℝ u v = 0 → + (∀ i, |lam i| ≤ 3) → 0 < K → + K*Real.exp ((n:ℝ)*sphericalVariational lam 1) ≤ spherePartition lam 1 (Real.sqrt n) → + 0 ≤ s₀ → spectralTop lam < 2+s₀ → 2-s₀ ≤ spectralTop lam → + spectralStieltjes lam (2+s₀) ≤ 1 → + (∀ s ∈ Set.Icc s₀ 1, |spectralStieltjes lam (2+s)-semicircleResolvent s| ≤ (1/100)*Real.sqrt s) → + 216*s₀ ≤ overlapCentralCutoff n^2 → + saddleSubcriticalError lam+s₀/2 ≤ 1/1536 → + (∫ U, (rotatedCubePartition lam 1 U / spherePartition lam 1 (Real.sqrt n)-1)^2 + ∂orthogonalHaar (Fin n)) ≤ + ε+(n+1)*((26*Real.exp 1*n/K)^2 * Real.exp (-(n:ℝ)/24*overlapCentralCutoff n^3)) := by + have hc := central_overlap_uniform_bound overlapCentralCutoff_tendsto overlapCentralCutoff_fourth + overlapCentralCutoff_min ε hε + filter_upwards [hc,eventually_ge_atTop 4] with n hn hfour + intro _ lam u v K s₀ hu hv horth hlam hK hlo hs₀ hedge hlow hres₀ hres hscale herr + let S := spherePartition lam 1 (Real.sqrt n) + let A := (26*Real.exp 1*n/K)^2 + let M := pairMoment lam u v + let δ := overlapCentralCutoff n + have hδ : 0 ≤ δ := Real.rpow_nonneg (Nat.cast_nonneg n) _ + have hpos : 0 < S := spherePartition_pos _ _ _ + have hM := pairMoment_continuous lam u v + have hMpos := pairMoment_nonneg lam u v + have hcentral := hn M hM hMpos (fun _ _ hh => pairMoment_mono_abs lam (hu.trans hv.symm) hh) + rw [sphereOverlap_density_second_moment_general hfour lam hu hv horth] at hcentral + have hdivcentral : (∑ j ∈ (Finset.range (n+1)).filter (fun j => |latticeOverlap n j| ≤ δ), + cubeOverlapMass n j*(M (latticeOverlap n j)/S^2)) ≤ 1+ε := by + simp_rw [← mul_div_assoc,← Finset.sum_div] + apply (div_le_iff₀ (sq_pos_of_pos hpos)).mpr + exact hcentral + have hpair (j : ℕ) (hj : j ≤ n) : M (latticeOverlap n j)/S^2 ≤ + A*Real.exp ((n:ℝ)*saddlePairDeficit lam |latticeOverlap n j|) := + pairMoment_variational_upper_general (by omega) lam hu hv horth hlam + (latticeOverlap_abs_le (by omega) hj) hK hlo + have hcubic (j : ℕ) (hj : j ≤ n) (ht : δ < |latticeOverlap n j|) : + saddlePairDeficit lam |latticeOverlap n j| ≤ latticeOverlap n j^2/2-(1/24)*|latticeOverlap n j|^3 := by + have hh := saddlePairDeficit_full_cubic lam hlam hs₀ hedge hlow hres₀ hres hδ hscale herr + ⟨ht.le,latticeOverlap_abs_le (by omega) hj⟩ + rw [sq_abs] at hh + linarith + have htail := weighted_overlap_tail_sum (h := fun q => M q/S^2) (D := saddlePairDeficit lam) + (by omega : 0 < n) (sq_nonneg _) (by norm_num : (0:ℝ) ≤ 1/24) hδ + (fun j hj _ => hpair j hj) hcubic + have hsum := Finset.sum_filter_add_sum_filter_not (Finset.range (n+1)) + (fun j => |latticeOverlap n j| ≤ δ) (fun j => cubeOverlapMass n j*(M (latticeOverlap n j)/S^2)) + have hwhole := add_le_add hdivcentral htail + rw [hsum] at hwhole + simp_rw [← mul_div_assoc,← Finset.sum_div] at hwhole + rw [← rotatedCubePartition_second_lattice (by omega) lam hu hv horth] at hwhole + have hvareq := normalized_integral_square (rotatedCubePartition_continuous lam 1) hpos.ne' + (rotatedCubePartition_first_moment (by omega) lam 1) + rw [hvareq] + dsimp only [A,δ,S,M] at hwhole ⊢ + convert (sub_le_sub_right hwhole 1) using 1 + all_goals first | rfl | ring_nf + +lemma orientation_normalized_overlap_bound (ε : ℝ) (hε : 0 < ε) : + ∀ᶠ n : ℕ in atTop, ∀ [Nonempty (Fin n)] (lam : Fin n → ℝ) (u v : EuclideanSpace ℝ (Fin n)) (K s₀ : ℝ), + ‖u‖ = Real.sqrt n → ‖v‖ = Real.sqrt n → inner ℝ u v = 0 → + (∀ i, |lam i| ≤ 3) → 0 < K → + K*Real.exp ((n:ℝ)*sphericalVariational lam 1) ≤ spherePartition lam 1 (Real.sqrt n) → + 0 ≤ s₀ → spectralTop lam < 2+s₀ → 2-s₀ ≤ spectralTop lam → + spectralStieltjes lam (2+s₀) ≤ 1 → + (∀ s ∈ Set.Icc s₀ 1, |spectralStieltjes lam (2+s)-semicircleResolvent s| ≤ (1/100)*Real.sqrt s) → + 216*s₀ ≤ overlapCentralCutoff n^2 → + saddleSubcriticalError lam+s₀/2 ≤ 1/1536 → + (∫ U, rotatedCubePair lam (fun q => q^2) U ∂orthogonalHaar (Fin n)) / + spherePartition lam 1 (Real.sqrt n)^2 ≤ + (1+ε)*((∫ q : ℝ, (q^2*pairMoment lam u v q)*sphereOverlapDensity n q) / + spherePartition lam 1 (Real.sqrt n)^2)+ + (n+1)*((26*Real.exp 1*n/K)^2 * Real.exp (-(n:ℝ)/24*overlapCentralCutoff n^3)) := by + have hc := central_overlap_uniform_bound overlapCentralCutoff_tendsto overlapCentralCutoff_fourth + overlapCentralCutoff_min ε hε + filter_upwards [hc,eventually_ge_atTop 4] with n hn hfour + intro _ lam u v K s₀ hu hv horth hlam hK hlo hs₀ hedge hlow hres₀ hres hscale herr + let S := spherePartition lam 1 (Real.sqrt n) + let A := (26*Real.exp 1*n/K)^2 + let M := fun q => q^2*pairMoment lam u v q + let δ := overlapCentralCutoff n + have hδ : 0 ≤ δ := Real.rpow_nonneg (Nat.cast_nonneg n) _ + have hpos : 0 < S := spherePartition_pos _ _ _ + have hM : Continuous M := (continuous_id.pow 2).mul (pairMoment_continuous lam u v) + have hMpos (q) : 0 ≤ M q := mul_nonneg (sq_nonneg _) (pairMoment_nonneg lam u v q) + have hcentral := hn M hM hMpos (fun _ _ hh => squaredPairMoment_mono_abs lam (hu.trans hv.symm) hh) + have hdivcentral : (∑ j ∈ (Finset.range (n+1)).filter (fun j => |latticeOverlap n j| ≤ δ), + cubeOverlapMass n j*(M (latticeOverlap n j)/S^2)) ≤ + (1+ε)*((∫ q : ℝ, M q*sphereOverlapDensity n q)/S^2) := by + simp_rw [← mul_div_assoc,← Finset.sum_div] + exact div_le_div_of_nonneg_right hcentral (sq_nonneg S) + have hpair (j : ℕ) (hj : j ≤ n) : M (latticeOverlap n j)/S^2 ≤ + A*Real.exp ((n:ℝ)*saddlePairDeficit lam |latticeOverlap n j|) := by + have hq := latticeOverlap_abs_le (by omega : 0 < n) hj + have hsq : latticeOverlap n j^2 ≤ 1 := by + simpa only [sq_abs,one_pow] using pow_le_pow_left₀ (abs_nonneg (latticeOverlap n j)) hq 2 + have hh : M (latticeOverlap n j) ≤ pairMoment lam u v (latticeOverlap n j) := by + dsimp only [M] + exact mul_le_of_le_one_left (pairMoment_nonneg lam u v _) hsq + exact (div_le_div_of_nonneg_right hh (sq_nonneg S)).trans + (pairMoment_variational_upper_general (by omega) lam hu hv horth hlam hq hK hlo) + have hcubic (j : ℕ) (hj : j ≤ n) (ht : δ < |latticeOverlap n j|) : + saddlePairDeficit lam |latticeOverlap n j| ≤ latticeOverlap n j^2/2-(1/24)*|latticeOverlap n j|^3 := by + have hh := saddlePairDeficit_full_cubic lam hlam hs₀ hedge hlow hres₀ hres hδ hscale herr + ⟨ht.le,latticeOverlap_abs_le (by omega) hj⟩ + rw [sq_abs] at hh + linarith + have htail := weighted_overlap_tail_sum (h := fun q => M q/S^2) (D := saddlePairDeficit lam) + (by omega : 0 < n) (sq_nonneg _) (by norm_num : (0:ℝ) ≤ 1/24) hδ + (fun j hj _ => hpair j hj) hcubic + have hsum := Finset.sum_filter_add_sum_filter_not (Finset.range (n+1)) + (fun j => |latticeOverlap n j| ≤ δ) (fun j => cubeOverlapMass n j*(M (latticeOverlap n j)/S^2)) + have hwhole := add_le_add hdivcentral htail + rw [hsum] at hwhole + simp_rw [← mul_div_assoc,← Finset.sum_div] at hwhole + rw [← rotatedCubePair_lattice (by omega) lam (fun q => q^2) hu hv horth] at hwhole + dsimp only [S,M,δ] at hwhole ⊢ + convert hwhole using 1; first | rfl | ring_nf + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/OrientationLimits.lean b/lean/OAI/MathematicalPhysics/CriticalSK/OrientationLimits.lean new file mode 100644 index 0000000000000000000000000000000000000000..f01a420dc24cc46968ba30943c7c55d00b922cc5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/OrientationLimits.lean @@ -0,0 +1,384 @@ +import OAI.MathematicalPhysics.CriticalSK.OrientationBounds + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open scoped BigOperators ENNReal NNReal Real Topology + +open MeasureTheory ProbabilityTheory Filter + +open scoped ENNReal NNReal + +open scoped BigOperators NNReal + +open scoped BigOperators + +open scoped BigOperators InnerProductSpace + +open Module + +open Matrix Polynomial + +open scoped BigOperators Topology + +open Filter + +open scoped BigOperators NNReal ENNReal Topology Pointwise Matrix.Norms.Elementwise + +open Set Metric MeasureTheory MeasureTheory.Measure + +open scoped ENNReal NNReal BigOperators + +open MeasureTheory ProbabilityTheory + +open scoped ENNReal NNReal Topology + +open MeasureTheory MeasureTheory.Measure Set Metric + +open scoped NNReal ENNReal BigOperators + +open scoped NNReal ENNReal + +open ProbabilityTheory + +open Metric Set MeasureTheory + +open scoped ENNReal Pointwise + +open MeasureTheory Filter Set Real + +open Finset Real + +open scoped BigOperators ENNReal Topology + +open Set MeasureTheory + +open scoped BigOperators ENNReal + +open MeasureTheory + +open Finset Real Filter + +open scoped Topology + +namespace CriticalSK + + +lemma naturalEdgeScale_le_rpow (n : ℕ) {L : ℝ} (hL : 0 ≤ L) : + naturalEdgeScale n L ≤ L*(n+1:ℝ)^(-2/3:ℝ) := by + have hd := edgeLength_cast_pos n + have hN : (0:ℝ) < n+1 := by positivity + have hp := Real.rpow_le_rpow hN.le (edgeLength_cube n).1 (by norm_num : (0:ℝ) ≤ 2/3) + have he : ((edgeLength n:ℝ)^3)^(2/3:ℝ) = (edgeLength n:ℝ)^2 := by + rw [← Real.rpow_natCast,← Real.rpow_mul hd.le] + norm_num + rw [he] at hp + have hi := inv_anti₀ (Real.rpow_pos_of_pos hN (2/3:ℝ)) hp + have ht := mul_le_mul_of_nonneg_left hi hL + rw [show (-2/3:ℝ) = -(2/3) by ring,Real.rpow_neg hN.le] + simpa only [naturalEdgeScale,div_eq_mul_inv] using ht + +lemma naturalEdgeScale_cutoff_tendsto (L : ℝ) : + Tendsto (fun n : ℕ => 216*L*(n+1:ℝ)^(-1/12:ℝ)) atTop (𝓝 0) := by + have hn : Tendsto (fun n : ℕ => (n+1:ℝ)) atTop atTop := + tendsto_natCast_atTop_atTop.atTop_add (tendsto_const_nhds (x := (1:ℝ))) + simpa only [mul_zero,neg_div,Function.comp_def] using + ((tendsto_rpow_neg_atTop (by norm_num : (0:ℝ) < 1/12)).comp hn).const_mul (216*L) + +lemma naturalEdgeScale_cutoff_eventually {L : ℝ} (hL : 0 ≤ L) : + ∀ᶠ n : ℕ in atTop, 216*naturalEdgeScale n L ≤ overlapCentralCutoff (n+1)^2 := by + filter_upwards [(naturalEdgeScale_cutoff_tendsto L).eventually (gt_mem_nhds (by norm_num : (0:ℝ) < 1))] with n hn + have hN : (0:ℝ) < n+1 := by positivity + have hid : overlapCentralCutoff (n+1)^2 = (n+1:ℝ)^(-7/12:ℝ) := by + unfold overlapCentralCutoff + rw [← Real.rpow_natCast,← Real.rpow_mul (by positivity)] + norm_num + have he : (216*L*(n+1:ℝ)^(-1/12:ℝ))*(n+1:ℝ)^(-7/12:ℝ) = + 216*(L*(n+1:ℝ)^(-2/3:ℝ)) := by + rw [mul_assoc (216*L),← Real.rpow_add hN] + norm_num + ring + rw [hid] + calc + _ ≤ 216*(L*(n+1:ℝ)^(-2/3:ℝ)) := mul_le_mul_of_nonneg_left (naturalEdgeScale_le_rpow n hL) (by norm_num) + _ = _ := he.symm + _ ≤ _ := mul_le_of_le_one_left (Real.rpow_nonneg hN.le _) hn.le + +lemma cutoff_cubic_identity {x : ℝ} (hx : 0 < x) : + x*(x^(-(7/24:ℝ)))^3 = x^(1/8:ℝ) := by + rw [← Real.rpow_natCast,← Real.rpow_mul hx.le] + conv_lhs => lhs; rw [← Real.rpow_one x] + rw [← Real.rpow_add hx] + norm_num + +lemma rpow_exp_small_tendsto (p : ℝ) : + Tendsto (fun n : ℕ => (n+1:ℝ)^p*Real.exp (-(1/24:ℝ)*(n+1:ℝ)^(1/8:ℝ))) atTop (𝓝 0) := by + have hn : Tendsto (fun n : ℕ => (n+1:ℝ)) atTop atTop := + tendsto_natCast_atTop_atTop.atTop_add (tendsto_const_nhds (x := (1:ℝ))) + have hx := (tendsto_rpow_atTop (by norm_num : (0:ℝ) < 1/8)).comp hn + have hh := (tendsto_rpow_mul_exp_neg_mul_atTop_nhds_zero (8*p) (1/24) (by norm_num)).comp hx + apply hh.congr + intro n + change ((n+1:ℝ)^(1/8:ℝ))^(8*p)*_ = _ + rw [← Real.rpow_mul (by positivity)] + congr 2 + ring + +lemma edgeLength_sq_le_linear (n : ℕ) : (edgeLength n:ℝ)^2 ≤ 8*(n+1) := by + have hd : (1:ℝ) ≤ edgeLength n := by exact_mod_cast edgeLength_pos n + have hcube := (edgeLength_cube n).2 + have hh : (edgeLength n:ℝ)^2 ≤ (edgeLength n:ℝ)^3 := by nlinarith [sq_nonneg ((edgeLength n:ℝ)-1)] + exact hh.trans hcube + +def naturalPartitionConstant (n : ℕ) (L : ℝ) : ℝ := + (naturalEdgeScale n L/4)*Real.exp (-6*(L*Real.sqrt L)) + +def naturalPartitionBase (L : ℝ) : ℝ := (L/32)*Real.exp (-6*(L*Real.sqrt L)) + +lemma naturalPartitionBase_pos {L : ℝ} (hL : 0 < L) : 0 < naturalPartitionBase L := by + unfold naturalPartitionBase + positivity + +lemma naturalPartitionConstant_lower (n : ℕ) {L : ℝ} (hL : 0 < L) : + naturalPartitionBase L/(n+1) ≤ naturalPartitionConstant n L := by + have hn : (0:ℝ) < n+1 := by positivity + have hd := edgeLength_cast_pos n + have hh := div_le_div_of_nonneg_left hL.le (pow_pos hd 2) (edgeLength_sq_le_linear n) + have ht := mul_le_mul_of_nonneg_right (div_le_div_of_nonneg_right hh (by norm_num : (0:ℝ) ≤ 4)) + (Real.exp_pos (-6*(L*Real.sqrt L))).le + unfold naturalPartitionBase naturalPartitionConstant naturalEdgeScale + calc + _ = L/(8*(n+1))/4*Real.exp (-6*(L*Real.sqrt L)) := by + field_simp + ring + _ ≤ _ := ht + +lemma naturalPartitionConstant_pos (n : ℕ) {L : ℝ} (hL : 0 < L) : 0 < naturalPartitionConstant n L := + (div_pos (naturalPartitionBase_pos hL) (by positivity)).trans_le (naturalPartitionConstant_lower n hL) + +def naturalOrientationTail (n : ℕ) (L : ℝ) : ℝ := + (n+2:ℝ)*((26*Real.exp 1*(n+1)/naturalPartitionConstant n L)^2* + Real.exp (-(n+1:ℝ)/24*overlapCentralCutoff (n+1)^3)) + +lemma naturalOrientationTail_bound (n : ℕ) {L : ℝ} (hL : 0 < L) : + naturalOrientationTail n L ≤ 2*(26*Real.exp 1/naturalPartitionBase L)^2*(n+1:ℝ)^5* + Real.exp (-(1/24:ℝ)*(n+1:ℝ)^(1/8:ℝ)) := by + have hN : (0:ℝ) < n+1 := by positivity + have hK := naturalPartitionConstant_pos n hL + have hB := naturalPartitionBase_pos hL + have he : -(n+1:ℝ)/24*overlapCentralCutoff (n+1)^3 = -(1/24:ℝ)*(n+1:ℝ)^(1/8:ℝ) := by + have hi := cutoff_cubic_identity hN + unfold overlapCentralCutoff + push_cast + linear_combination -(1/24:ℝ)*hi + have hratio : 26*Real.exp 1*(n+1)/naturalPartitionConstant n L ≤ + (26*Real.exp 1/naturalPartitionBase L)*(n+1)^2 := by + apply (div_le_iff₀ hK).mpr + have hh := mul_le_mul_of_nonneg_left (naturalPartitionConstant_lower n hL) + (show 0 ≤ (26*Real.exp 1/naturalPartitionBase L)*(n+1:ℝ)^2 by positivity) + apply le_trans _ hh + apply le_of_eq + field_simp + have hsq := pow_le_pow_left₀ (by positivity : 0 ≤ 26*Real.exp 1*(n+1:ℝ)/naturalPartitionConstant n L) hratio 2 + have hfac : (n+2:ℝ) ≤ 2*(n+1) := by linarith [Nat.cast_nonneg (α := ℝ) n] + unfold naturalOrientationTail + rw [he] + have hh := mul_le_mul hfac (mul_le_mul_of_nonneg_right hsq (Real.exp_pos (-(1/24:ℝ)*(n+1:ℝ)^(1/8:ℝ))).le) + (by positivity) (by positivity : (0:ℝ) ≤ 2*(n+1)) + apply hh.trans_eq + ring + +lemma naturalOrientationTail_scaled_tendsto {L : ℝ} (hL : 0 < L) (p : ℝ) : + Tendsto (fun n : ℕ => (n+1:ℝ)^p*naturalOrientationTail n L) atTop (𝓝 0) := by + have ht := (rpow_exp_small_tendsto (p+5)).const_mul (2*(26*Real.exp 1/naturalPartitionBase L)^2) + have hz : Tendsto (fun n : ℕ => (n+1:ℝ)^p* + (2*(26*Real.exp 1/naturalPartitionBase L)^2*(n+1:ℝ)^5*Real.exp (-(1/24:ℝ)*(n+1:ℝ)^(1/8:ℝ)))) + atTop (𝓝 0) := by + simpa only [mul_zero] using ht.congr (fun n => by + rw [Real.rpow_add (by positivity),show (5:ℝ) = (5:ℕ) by norm_num, Real.rpow_natCast] + ring) + apply squeeze_zero (fun n => by unfold naturalOrientationTail; positivity) (fun n => + mul_le_mul_of_nonneg_left (naturalOrientationTail_bound n hL) (Real.rpow_nonneg (by positivity) _)) hz + +open Set MeasureTheory Filter + +structure OrientationInputs {n : ℕ} [Nonempty (Fin n)] + (lam : Fin n → ℝ) (K s : ℝ) : Prop where + bounded : ∀ i, |lam i| ≤ 3 + Kpos : 0 < K + partitionLower : K*Real.exp ((n:ℝ)*sphericalVariational lam 1) ≤ spherePartition lam 1 (Real.sqrt n) + scaleNonneg : 0 ≤ s + topUpper : spectralTop lam < 2+s + topLower : 2-s ≤ spectralTop lam + trace : spectralStieltjes lam (2+s) ≤ 1 + traceUniform : ∀ t ∈ Icc s 1, |spectralStieltjes lam (2+t)-semicircleResolvent t| ≤ (1/100)*Real.sqrt t + cutoff : 216*s ≤ overlapCentralCutoff n^2 + saddle : saddleSubcriticalError lam+s/2 ≤ 1/1536 + +lemma orthogonal_equal_norm_pair (n : ℕ) (r : ℝ) (hr : 0 ≤ r) : + ∃ u v : EuclideanSpace ℝ (Fin (n+2)), ‖u‖ = r ∧ ‖v‖ = r ∧ inner ℝ u v = 0 := by + let b := EuclideanSpace.basisFun (Fin (n+2)) ℝ + refine ⟨r • b 0,r • b 1,?_,?_,?_⟩ + · rw [norm_smul,Real.norm_eq_abs,abs_of_nonneg hr,b.norm_eq_one,mul_one] + · rw [norm_smul,Real.norm_eq_abs,abs_of_nonneg hr,b.norm_eq_one,mul_one] + · rw [real_inner_smul_left,real_inner_smul_right,b.inner_eq_ite] + norm_num + +lemma largeL_space {L : ℝ} (hL : 262144 ≤ L) : 262144 ≤ L*Real.sqrt L := by + have hL1 : 1 ≤ L := by linarith + have hr : 1 ≤ Real.sqrt L := by simpa using Real.sqrt_le_sqrt hL1 + nlinarith + +lemma naturalOrientationInputs {h L : ℝ} (hh : 0 ≤ h) (hL : 262144 ≤ L) + (hcost : edgeFixedCost h L < 1/100) : + ∀ᶠ n : ℕ in atTop, ∀ lam ∈ spectralGood (n+3) h (naturalEdgeScale (n+3) L), + OrientationInputs lam (naturalPartitionConstant (n+3) L) (naturalEdgeScale (n+3) L) := by + have hLp : 0 < L := by linarith + have hLa : 1696 ≤ L := by linarith + have hspaceL := largeL_space hL + have hc := (tendsto_add_atTop_nat 3).eventually (traceCost_natural_eventually hh hLp hcost) + have hs := (tendsto_add_atTop_nat 3).eventually + ((naturalEdgeScale_tendsto L).eventually (gt_mem_nhds (by norm_num : (0:ℝ) < 1))) + have hf := (tendsto_add_atTop_nat 3).eventually edgeLength_tents_eventually + have hcut := (tendsto_add_atTop_nat 3).eventually (naturalEdgeScale_cutoff_eventually hLp.le) + have herr := (tendsto_add_atTop_nat 3).eventually + (spectralGood_saddle_uniform hh hLa hcost (by linarith : 16 ≤ L*Real.sqrt L) + (by norm_num : (0:ℝ) < 1/1536)) + filter_upwards [hc,hs,hf,hcut,herr] with n hnc hns hnf hncut hnerr + intro lam hlam + let s := naturalEdgeScale (n+3) L + have hsp : 0 < s := naturalEdgeScale_pos (n+3) hLp + have hsm : s ≤ 1 := hns.le + have hsc : 32768 ≤ (n+4:ℝ)*s*Real.sqrt s := by + have hs' := (naturalEdgeScale_space (n+3) hLp).1 + norm_num only [Nat.cast_add,Nat.cast_ofNat] at hs' + have he : (n:ℝ)+3+1 = n+4 := by ring + rw [he] at hs' + linarith + have hclose (i : Fin (n+4)) (hi : i.val < 3) : |lam i-2| ≤ s/4 := + spectralGood_top_close hh hLa hsm hnf hnc hlam i hi + have hb := spectralGood_bounded (n+3) hh hsp hsm (by norm_num : (1/100:ℝ) ≤ 1/5) hnc hlam + have hlo := spectralGood_sphere_partition_lower (n := n+2) hh hsp hsm hnc hlam + (by norm_num only [Nat.cast_add,Nat.cast_ofNat,add_assoc]; exact hsc) + (hclose 0 (by simp)) (hclose 1 (by simp)) + norm_num only [Nat.cast_add,Nat.cast_ofNat,add_assoc] at hlo + have hsup := (naturalEdgeScale_space (n+3) hLp).2 + norm_num only [Nat.cast_add,Nat.cast_ofNat] at hsup + rw [show (n:ℝ)+3+1=n+4 by ring] at hsup + have hpart : naturalPartitionConstant (n+3) L*Real.exp ((n+4:ℝ)*sphericalVariational lam 1) ≤ + spherePartition lam 1 (Real.sqrt (n+4)) := by + apply le_trans _ hlo + apply mul_le_mul_of_nonneg_right _ (Real.exp_pos _).le + unfold naturalPartitionConstant + apply mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr (by linarith)) (by positivity : 0 ≤ s/4) + have hsmall := (traceCost_small (n+3) hh hsp hsm hnc).trans (by norm_num : (1/100:ℝ) ≤ 1/2) + have hsc' : 2 ≤ ((n+3:ℕ)+1:ℝ)*s*Real.sqrt s := by + norm_num only [Nat.cast_add,Nat.cast_ofNat] + linarith + have htrace (t : ℝ) (ht : s ≤ t) : + |spectralStieltjes lam (2+t)-semicircleResolvent t| ≤ (1/100)*Real.sqrt t := by + have ht' := spectralGood_relative_trace (n+3) hh hsp ht hsmall hsc' hlam hnc + simpa only [spectralStieltjes,Fintype.card_fin,Nat.cast_add,Nat.cast_one,div_eq_mul_inv,mul_comm] using ht' + have htmax : spectralTop lam < 2+s := by + obtain ⟨i,hi⟩ := spectralTop_attained lam + have hu := spectralGood_top_upper (n+3) hh hsp hsm (by norm_num : (1/100:ℝ) ≤ 1) hnc hlam i + rw [hi] at hu + linarith + have htmin : 2-s ≤ spectralTop lam := by + have hh0 := (abs_le.mp (hclose 0 (by simp))).1 + have hh1 := le_spectralTop lam 0 + linarith + have htr : spectralStieltjes lam (2+s) ≤ 1 := by + have he := (abs_le.mp (htrace s le_rfl)).2 + have hd := semicircleResolvent_deficit_lower hsp.le hsm + linarith [Real.sqrt_nonneg s] + refine ⟨hb,naturalPartitionConstant_pos (n+3) hLp,?_,hsp.le,htmax,htmin,htr, + fun t ht => htrace t ht.1,hncut,(hnerr lam hlam).le⟩ + norm_num only [Nat.cast_add,Nat.cast_ofNat,add_assoc] at hpart ⊢ + exact hpart + +lemma spectralGood_orientation_variance {h L : ℝ} (hh : 0 ≤ h) (hL : 262144 ≤ L) + (hcost : edgeFixedCost h L < 1/100) {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ n : ℕ in atTop, ∀ lam ∈ spectralGood (n+3) h (naturalEdgeScale (n+3) L), + (∫ U, (rotatedCubePartition lam 1 U/spherePartition lam 1 (Real.sqrt (n+4))-1)^2 + ∂orthogonalHaar (Fin (n+4))) ≤ ε+naturalOrientationTail (n+3) L := by + have ho := (tendsto_add_atTop_nat 4).eventually (orientation_normalized_variance_bound ε hε) + filter_upwards [naturalOrientationInputs hh hL hcost,ho] with n hn hv + intro lam hlam + have hi := hn lam hlam + obtain ⟨u,v,hu,hv',huv⟩ := orthogonal_equal_norm_pair (n+2) (Real.sqrt (n+4)) (Real.sqrt_nonneg _) + have hh := hv lam u v _ _ + (by simpa only [Nat.cast_add,Nat.cast_ofNat] using hu) + (by simpa only [Nat.cast_add,Nat.cast_ofNat] using hv') huv hi.bounded hi.Kpos hi.partitionLower hi.scaleNonneg + hi.topUpper hi.topLower hi.trace hi.traceUniform hi.cutoff hi.saddle + simpa only [naturalOrientationTail,Nat.cast_add,Nat.cast_ofNat,show (n:ℝ)+3+1=n+4 by ring, + show (n:ℝ)+3+2=n+4+1 by ring] using hh + + +lemma edgeLength_rpow_lower (n : ℕ) : (n+1:ℝ)^(1/3:ℝ) ≤ edgeLength n := by + have hh := Real.rpow_le_rpow (by positivity : (0:ℝ) ≤ n+1) (edgeLength_cube n).1 + (by norm_num : (0:ℝ) ≤ 1/3) + rw [← Real.rpow_natCast,← Real.rpow_mul (edgeLength_cast_pos n).le] at hh + norm_num at hh + exact hh + +lemma edgeLength_rpow_upper (n : ℕ) : (edgeLength n:ℝ) ≤ 2*(n+1:ℝ)^(1/3:ℝ) := by + have hh := Real.rpow_le_rpow (by positivity : (0:ℝ) ≤ (edgeLength n:ℝ)^3) + (edgeLength_cube n).2 (by norm_num : (0:ℝ) ≤ 1/3) + rw [Real.mul_rpow (by norm_num : (0:ℝ) ≤ 8) (by positivity)] at hh + have hc : (8:ℝ)^(1/3:ℝ) = 2 := by + rw [show (8:ℝ) = 2^3 by norm_num,← Real.rpow_natCast,← Real.rpow_mul (by norm_num : (0:ℝ) ≤ 2)] + norm_num + rw [hc,← Real.rpow_natCast,← Real.rpow_mul (edgeLength_cast_pos n).le] at hh + norm_num at hh + exact hh + +lemma naturalEdgeScale_sqrt (n : ℕ) {L : ℝ} (hL : 0 ≤ L) : + Real.sqrt (naturalEdgeScale n L) = Real.sqrt L/(edgeLength n) := by + rw [naturalEdgeScale,Real.sqrt_div hL,Real.sqrt_sq (edgeLength_cast_pos n).le] + +lemma natural_smallBall_rate (n : ℕ) {L : ℝ} (hL : 0 ≤ L) : + (n+1:ℝ)^(1/3:ℝ)*Real.sqrt (naturalEdgeScale n L) ≤ Real.sqrt L := by + rw [naturalEdgeScale_sqrt n hL,← mul_div_assoc,div_le_iff₀ (edgeLength_cast_pos n)] + simpa only [mul_comm] using mul_le_mul_of_nonneg_left (edgeLength_rpow_lower n) (Real.sqrt_nonneg L) + +def naturalOverlapRate (n : ℕ) (L : ℝ) : ℝ := + (16*Real.exp (6*(L*Real.sqrt L)))^2*16/((n+1)*Real.sqrt (naturalEdgeScale n L)) + +def naturalOverlapConstant (L : ℝ) : ℝ := + 32*(16*Real.exp (6*(L*Real.sqrt L)))^2/Real.sqrt L + +lemma naturalOverlapRate_nonneg (n : ℕ) (L : ℝ) : 0 ≤ naturalOverlapRate n L := by + unfold naturalOverlapRate + positivity + +lemma naturalOverlapRate_scaled_bound (n : ℕ) {L : ℝ} (hL : 0 < L) : + (n+1:ℝ)^(2/3:ℝ)*naturalOverlapRate n L ≤ naturalOverlapConstant L := by + have hn : (0:ℝ) < n+1 := by positivity + have hr := Real.sqrt_pos.mpr hL + have hd := edgeLength_cast_pos n + have he : (n+1:ℝ)^(2/3:ℝ)*(n+1:ℝ)^(1/3:ℝ) = n+1 := by + rw [← Real.rpow_add hn] + norm_num + have hh := mul_le_mul_of_nonneg_left (edgeLength_rpow_upper n) + (show 0 ≤ (n+1:ℝ)^(2/3:ℝ) by positivity) + have hb : (n+1:ℝ)^(2/3:ℝ)*(edgeLength n:ℝ) ≤ 2*(n+1) := by + nlinarith [he] + unfold naturalOverlapRate naturalOverlapConstant + rw [naturalEdgeScale_sqrt n hL.le] + have ht := mul_le_mul_of_nonneg_left hb + (show 0 ≤ 16*(16*Real.exp (6*(L*Real.sqrt L)))^2/((n+1:ℝ)*Real.sqrt L) by positivity) + calc + _ = (16*(16*Real.exp (6*(L*Real.sqrt L)))^2/((n+1:ℝ)*Real.sqrt L))* + ((n+1:ℝ)^(2/3:ℝ)*(edgeLength n:ℝ)) := by field_simp + _ ≤ (16*(16*Real.exp (6*(L*Real.sqrt L)))^2/((n+1:ℝ)*Real.sqrt L))*(2*(n+1)) := ht + _ = _ := by field_simp; ring + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/OverlapMoments.lean b/lean/OAI/MathematicalPhysics/CriticalSK/OverlapMoments.lean new file mode 100644 index 0000000000000000000000000000000000000000..72f71e7a533347580156da434b834b1ca1474b1a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/OverlapMoments.lean @@ -0,0 +1,369 @@ +import OAI.MathematicalPhysics.CriticalSK.SphereSaddle + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open MeasureTheory ProbabilityTheory + +open scoped ENNReal NNReal + +open scoped BigOperators InnerProductSpace + +open Module + +open scoped BigOperators ENNReal NNReal Real Topology + +open MeasureTheory ProbabilityTheory Filter + +open scoped BigOperators NNReal + +open scoped BigOperators + +open Matrix Polynomial + +open scoped BigOperators Topology + +open Filter + +open scoped BigOperators NNReal ENNReal Topology Pointwise Matrix.Norms.Elementwise + +open Set Metric MeasureTheory MeasureTheory.Measure + +open scoped ENNReal NNReal Topology + +open MeasureTheory MeasureTheory.Measure Set Metric + +open scoped BigOperators ENNReal Topology + +open Set MeasureTheory + +open scoped BigOperators ENNReal + +open MeasureTheory + +open Finset Real + +open Finset Real Filter + +open scoped Topology + +open MeasureTheory Filter Set Real + +open scoped ENNReal NNReal BigOperators + +open scoped NNReal ENNReal BigOperators + +open scoped NNReal ENNReal + +open ProbabilityTheory + +open Metric Set MeasureTheory +open scoped ENNReal Pointwise +namespace CriticalSK + +section + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι] + +omit [Nonempty ι] in +lemma sphereInner_rotation (U : Matrix.orthogonalGroup ι ℝ) (x y : unitSphere ι) : + inner ℝ (orthogonalSphere U x).val (orthogonalSphere U y).val = inner ℝ x.val y.val := + (orthogonalIsometry U).inner_map_map x.val y.val + +omit [Nonempty ι] in +lemma spherePairEnergy_haar (lam : ι → ℝ) {u v : EuclideanSpace ℝ ι} {r : ℝ} + (hu : ‖u‖ = r) (hv : ‖v‖ = r) (horth : inner ℝ u v = 0) + (p : unitSphere ι × unitSphere ι) : + (∫ U, spherePairEnergy lam r (orthogonalSphere U p.1, orthogonalSphere U p.2) + ∂orthogonalHaar ι) = pairMoment lam u v (inner ℝ p.1.val p.2.val) := by + have hr : 0 ≤ r := hu ▸ norm_nonneg u + have hnorm (x : unitSphere ι) : ‖r • x.val‖ = r := by + rw [norm_smul,Real.norm_of_nonneg hr,mem_sphere_zero_iff_norm.mp x.property,mul_one] + have hxy : inner ℝ (r • p.1.val) (r • p.2.val) = inner ℝ p.1.val p.2.val * r^2 := by + rw [real_inner_smul_left,real_inner_smul_right]; ring + rw [← pair_energy_orbit lam (hnorm p.1) (hnorm p.2) hu hv horth + (sphere_inner_abs_le_one p.1 p.2) hxy] + apply integral_congr_ae + filter_upwards [] with U + simp only [spherePairEnergy,orthogonalSphere,sphereMap,map_smul] + +lemma sphereOverlap_weighted_pair (lam : ι → ℝ) {u v : EuclideanSpace ℝ ι} {r : ℝ} + (hu : ‖u‖ = r) (hv : ‖v‖ = r) (horth : inner ℝ u v = 0) + (g : ℝ → ℝ) (hg : Continuous g) : + (∫ q, g q*pairMoment lam u v q ∂sphereOverlapLaw ι) = + ∫ p : unitSphere ι × unitSphere ι, + g (inner ℝ p.1.val p.2.val)*spherePairEnergy lam r p ∂(sphereUniform.prod sphereUniform) := by + have hc : Continuous (fun p : unitSphere ι × unitSphere ι => inner ℝ p.1.val p.2.val) := + (continuous_subtype_val.comp continuous_fst).inner (continuous_subtype_val.comp continuous_snd) + rw [sphereOverlapLaw,integral_map hc.measurable.aemeasurable + (show AEStronglyMeasurable (fun q => g q * pairMoment lam u v q) _ from + (hg.mul (pairMoment_continuous lam u v)).aestronglyMeasurable)] + have hf : Continuous (fun p : unitSphere ι × unitSphere ι => + g (inner ℝ p.1.val p.2.val)*spherePairEnergy lam r p) := + (hg.comp hc).mul (spherePairEnergy_continuous lam r) + rw [← spherePair_haar_average _ hf] + apply integral_congr_ae + filter_upwards [] with p + simp only [sphereInner_rotation] + rw [integral_const_mul,spherePairEnergy_haar lam hu hv horth] + +omit [DecidableEq ι] in +lemma sphereTilted_uniform_integral (lam : ι → ℝ) (a r : ℝ) (F : unitSphere ι → ℝ) : + (∫ u, F u ∂sphereTilted lam a r) = + (∫ u, Real.exp (a/2*diagonalEnergy lam (r • u.val))*F u ∂sphereUniform) / + spherePartition lam a r := by + rw [sphereTilted_integral,sphereUniform_integral,spherePartition,sphereAverage,sphereAverage] + have ha := ne_of_gt (sphereArea_pos (ι := ι)) + field_simp [ha] + +omit [DecidableEq ι] in +lemma sphereTilted_pair_integral (lam : ι → ℝ) (r : ℝ) + (F : unitSphere ι × unitSphere ι → ℝ) (hF : Continuous F) : + (∫ p, F p ∂((sphereTilted lam 1 r).prod (sphereTilted lam 1 r))) = + (∫ p, spherePairEnergy lam r p*F p ∂(sphereUniform.prod sphereUniform)) / + spherePartition lam 1 r^2 := by + have hi : Integrable F ((sphereTilted lam 1 r).prod (sphereTilted lam 1 r)) := by + simpa only [integrableOn_univ] using hF.continuousOn.integrableOn_compact isCompact_univ + have hi' : Integrable (fun p => spherePairEnergy lam r p*F p) + (sphereUniform.prod sphereUniform) := by + have hc : Continuous (fun p : unitSphere ι × unitSphere ι => spherePairEnergy lam r p * F p) := + (spherePairEnergy_continuous lam r).mul hF + simpa only [integrableOn_univ] using hc.continuousOn.integrableOn_compact isCompact_univ + rw [integral_prod _ hi,integral_prod _ hi'] + simp_rw [sphereTilted_uniform_integral] + simp_rw [spherePairEnergy_factor,mul_assoc,integral_const_mul] + simp_rw [← mul_div_assoc,integral_div] + rw [div_div,← pow_two] + +end + +section + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +def coordinateReflection (i : ι) : EuclideanSpace ℝ ι ≃ₗᵢ[ℝ] EuclideanSpace ℝ ι := + LinearIsometryEquiv.piLpCongrRight 2 (fun j => + if j=i then LinearIsometryEquiv.neg ℝ else LinearIsometryEquiv.refl ℝ ℝ) + +lemma coordinateReflection_apply (i j : ι) (x : EuclideanSpace ℝ ι) : + coordinateReflection i x j = if j=i then -x j else x j := by + classical + simp only [coordinateReflection, LinearIsometryEquiv.piLpCongrRight_apply, PiLp.toLp_apply] + split_ifs <;> rfl + +lemma coordinateReflection_energy (lam : ι → ℝ) (i : ι) (x : EuclideanSpace ℝ ι) : + diagonalEnergy lam (coordinateReflection i x) = diagonalEnergy lam x := by + unfold diagonalEnergy + apply Finset.sum_congr rfl + intro j _ + rw [coordinateReflection_apply] + split_ifs <;> ring + +omit [DecidableEq ι] in +lemma sphereMap_measurableEmbedding (U : EuclideanSpace ℝ ι ≃ₗᵢ[ℝ] EuclideanSpace ℝ ι) : + MeasurableEmbedding (sphereMap U) := by + apply (sphereMap_continuous U).measurableEmbedding + intro u w h + apply Subtype.ext + exact U.injective (congrArg Subtype.val h) + +variable [Nonempty ι] + +lemma sphereTilted_coordinate_cross (lam : ι → ℝ) (a r : ℝ) (i j : ι) (hij : i ≠ j) : + (∫ u : unitSphere ι, ((r • u.val) i) * ((r • u.val) j) ∂sphereTilted lam a r) = 0 := by + rw [sphereTilted_integral] + suffices hn : (∫ u : unitSphere ι, Real.exp (a/2*diagonalEnergy lam (r • u.val)) * + ((r • u.val) i * (r • u.val) j) ∂(volume : Measure (EuclideanSpace ℝ ι)).toSphere) = 0 by + rw [hn, zero_div] + let F := fun u : unitSphere ι => Real.exp (a/2*diagonalEnergy lam (r • u.val)) * + ((r • u.val) i * (r • u.val) j) + have he (u : unitSphere ι) : F (sphereMap (coordinateReflection i) u) = -F u := by + dsimp [F, sphereMap] + rw [← (coordinateReflection i).map_smul, coordinateReflection_energy] + simp only [coordinateReflection_apply] + simp only [ite_eq_left, ite_eq_right hij.symm] + ring + have hi := (sphereMap_preserving (coordinateReflection i)).integral_comp + (sphereMap_measurableEmbedding _) F + simp_rw [he, integral_neg] at hi + change (∫ u, F u ∂(volume : Measure (EuclideanSpace ℝ ι)).toSphere) = 0 + linarith only [hi] + +end + +section + +lemma gaussianPairPrefactor_antitone {a b c d : ℝ≥0} (ha : a ≠ 0) (hb : b ≠ 0) + (hac : a ≤ c) (hbd : b ≤ d) : + gaussianPairPrefactor c d ≤ gaussianPairPrefactor a b := by + unfold gaussianPairPrefactor + have ha' : 0 < (a:ℝ) := NNReal.coe_pos.mpr (pos_iff_ne_zero.mpr ha) + have hb' : 0 < (b:ℝ) := NNReal.coe_pos.mpr (pos_iff_ne_zero.mpr hb) + apply inv_anti₀ (by positivity) + apply mul_le_mul + · exact Real.sqrt_le_sqrt (mul_le_mul_of_nonneg_left (NNReal.coe_le_coe.mpr hac) (by positivity)) + · exact Real.sqrt_le_sqrt (mul_le_mul_of_nonneg_left (NNReal.coe_le_coe.mpr hbd) (by positivity)) + · positivity + · positivity + +variable {n : ℕ} + +lemma gaussianSquareCoordinateDensity_upper_all (v : Fin (n+2) → ℝ≥0) (hv : ∀ i, v i ≠ 0) + (i : Fin (n+2)) {s : ℝ} (hs : 0 < s) : + gaussianSquareCoordinateDensity v i s ≤ + 8*(v i:ℝ)*Real.pi*gaussianPairPrefactor (v 0) (v 1) := by + let v' := Function.update v i (2*v i) + have hv' : ∀ j, v' j ≠ 0 := by + intro j + by_cases hj : j=i + · subst j + simpa only [v', Function.update_self] using mul_ne_zero (by norm_num : (2:ℝ≥0) ≠ 0) (hv i) + · simpa only [v', Function.update_of_ne hj] using hv j + have hvle : ∀ j, v j ≤ v' j := by + intro j + by_cases hj : j=i + · subst j + simp only [v', Function.update_self] + exact le_mul_of_one_le_left (by positivity) (by norm_num) + · simp only [v', Function.update_of_ne hj, le_refl] + have hp := gaussianPairPrefactor_antitone (hv 0) (hv 1) (hvle 0) (hvle 1) + calc + _ ≤ 8*(v i:ℝ)*diagonalSquareDensity v' s := + gaussianSquareCoordinateDensity_le_double v i (hv i) hs + _ ≤ 8*(v i:ℝ)*(Real.pi*gaussianPairPrefactor (v' 0) (v' 1)) := + mul_le_mul_of_nonneg_left (diagonalSquareDensity_upper v' hv' hs) (by positivity) + _ ≤ 8*(v i:ℝ)*(Real.pi*gaussianPairPrefactor (v 0) (v 1)) := + mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_left hp Real.pi_pos.le) (by positivity) + _ = _ := by ring + +lemma sphereTilted_coordinate_sq_upper_all (lam : Fin (n+2) → ℝ) (a z : ℝ) + (v : Fin (n+2) → ℝ≥0) (hv : ∀ i, v i ≠ 0) + (hq : ∀ i, (v i:ℝ)⁻¹ = z-a*lam i) + {s m d : ℝ} (hs : 0 < s) (hm : 0 < m) (hm0 : m ≤ v 0) (hm1 : m ≤ v 1) + (hd : 0 < d) (hmean : (∑ j : Fin n, (v j.succ.succ : ℝ)) = s-d) + (hvar : 128*(∑ j : Fin n, (v j.succ.succ : ℝ)^2) ≤ d^2) + (i : Fin (n+2)) : + (∫ u : unitSphere (Fin (n+2)), ((Real.sqrt s • u.val) i)^2 + ∂sphereTilted lam a (Real.sqrt s)) ≤ 16*(v i:ℝ)*Real.exp (d/m) := by + rw [sphereTilted_coordinate_sq hv hq hs] + have hl := diagonalSquareDensity_lower v hv hs hm hm0 hm1 hd hmean hvar + have hp : 0 < diagonalSquareDensity v s := + (div_pos (mul_pos (mul_pos Real.pi_pos (gaussianPairPrefactor_pos (hv 0) (hv 1))) + (Real.exp_pos _)) (by norm_num)).trans_le hl + apply (div_le_iff₀ hp).mpr + apply (gaussianSquareCoordinateDensity_upper_all v hv i hs).trans + apply le_trans _ (mul_le_mul_of_nonneg_left hl (show 0 ≤ 16*(v i:ℝ)*Real.exp (d/m) by positivity)) + have he : Real.exp (d/m) * Real.exp (-d/m) = 1 := by + rw [← Real.exp_add, show d/m + -d/m = 0 by ring, Real.exp_zero] + apply le_of_eq + symm + calc + _ = (8*(v i:ℝ)*Real.pi*gaussianPairPrefactor (v 0) (v 1)) * + (Real.exp (d/m) * Real.exp (-d/m)) := by ring + _ = _ := by rw [he, mul_one] + +end + +section + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι] + +omit [DecidableEq ι] in +lemma sphereTilted_continuous_integrable (lam : ι → ℝ) (a r : ℝ) {f : unitSphere ι → ℝ} + (hf : Continuous f) : Integrable f (sphereTilted lam a r) := by + simpa only [integrableOn_univ] using hf.continuousOn.integrableOn_compact isCompact_univ + +lemma sphereTilted_linear_square (lam : ι → ℝ) (a r : ℝ) (c : ι → ℝ) : + (∫ u : unitSphere ι, (∑ i, c i * (r • u.val) i)^2 ∂sphereTilted lam a r) = + ∑ i, c i^2 * (∫ u : unitSphere ι, ((r • u.val) i)^2 ∂sphereTilted lam a r) := by + have hh (u : unitSphere ι) : (∑ i, c i*(r • u.val) i)^2 = + ∑ i, ∑ j, c i*c j*((r • u.val) i*(r • u.val) j) := by + simp only [pow_two, Finset.sum_mul, Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intro j _ + ring + simp_rw [hh] + rw [integral_finsetSum _ (fun i _ => sphereTilted_continuous_integrable lam a r (by fun_prop))] + apply Finset.sum_congr rfl + intro i _ + rw [integral_finsetSum _ (fun j _ => sphereTilted_continuous_integrable lam a r (by fun_prop))] + simp_rw [integral_const_mul] + rw [Finset.sum_eq_single i] + · simp only [pow_two] + · intro j _ hji + rw [sphereTilted_coordinate_cross lam a r i j hji.symm, mul_zero] + · simp + +lemma sphereTilted_linear_square_le (lam : ι → ℝ) (a r : ℝ) (C : ℝ) + (hC : ∀ i, (∫ u : unitSphere ι, ((r • u.val) i)^2 ∂sphereTilted lam a r) ≤ C) + (c : ι → ℝ) : + (∫ u : unitSphere ι, (∑ i, c i*(r • u.val) i)^2 ∂sphereTilted lam a r) ≤ + C*(∑ i, c i^2) := by + rw [sphereTilted_linear_square, Finset.mul_sum] + apply Finset.sum_le_sum + intro i _ + simpa only [mul_comm C] using mul_le_mul_of_nonneg_left (hC i) (sq_nonneg (c i)) + +end + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι] + +lemma sphereTilted_overlap_moment (lam : ι → ℝ) (a r : ℝ) : + (∫ p : unitSphere ι × unitSphere ι, + (inner ℝ (r • p.1.val) (r • p.2.val))^2 + ∂((sphereTilted lam a r).prod (sphereTilted lam a r))) = + ∑ i, (∫ u : unitSphere ι, ((r • u.val) i)^2 ∂sphereTilted lam a r)^2 := by + have hc : Continuous (fun p : unitSphere ι × unitSphere ι => + (inner ℝ (r • p.1.val) (r • p.2.val))^2) := by fun_prop + have hi : Integrable (fun p : unitSphere ι × unitSphere ι => + (inner ℝ (r • p.1.val) (r • p.2.val))^2) + ((sphereTilted lam a r).prod (sphereTilted lam a r)) := by + simpa only [integrableOn_univ] using hc.continuousOn.integrableOn_compact isCompact_univ + rw [integral_prod _ hi] + simp_rw [EuclideanSpace.inner_eq_star_dotProduct,star_trivial,dotProduct,mul_comm] + simp_rw [sphereTilted_linear_square] + rw [integral_finsetSum _ (fun i _ => sphereTilted_continuous_integrable lam a r (by fun_prop))] + simp_rw [integral_mul_const,pow_two] + +lemma sphereTilted_overlap_bound (lam : ι → ℝ) (a r C : ℝ) (v : ι → ℝ) + (hm : ∀ i, (∫ u : unitSphere ι, ((r • u.val) i)^2 ∂sphereTilted lam a r) ≤ C*v i) : + (∫ p : unitSphere ι × unitSphere ι, + (inner ℝ (r • p.1.val) (r • p.2.val))^2 + ∂((sphereTilted lam a r).prod (sphereTilted lam a r))) ≤ C^2*(∑ i, v i^2) := by + rw [sphereTilted_overlap_moment,Finset.mul_sum] + apply Finset.sum_le_sum + intro i _ + simpa only [mul_pow] using pow_le_pow_left₀ + (integral_nonneg (fun _ => sq_nonneg _)) (hm i) 2 + +lemma sphereOverlap_weighted_tilted (lam : ι → ℝ) {u v : EuclideanSpace ℝ ι} {r : ℝ} + (hu : ‖u‖ = r) (hv : ‖v‖ = r) (horth : inner ℝ u v = 0) + (g : ℝ → ℝ) (hg : Continuous g) : + (∫ q, g q*pairMoment lam u v q ∂sphereOverlapLaw ι) / spherePartition lam 1 r^2 = + ∫ p : unitSphere ι × unitSphere ι, g (inner ℝ p.1.val p.2.val) + ∂((sphereTilted lam 1 r).prod (sphereTilted lam 1 r)) := by + rw [sphereOverlap_weighted_pair lam hu hv horth g hg] + have hc : Continuous (fun p : unitSphere ι × unitSphere ι => g (inner ℝ p.1.val p.2.val)) := + hg.comp ((continuous_subtype_val.comp continuous_fst).inner (continuous_subtype_val.comp continuous_snd)) + rw [sphereTilted_pair_integral lam r _ hc] + simp only [mul_comm] + +lemma sphereOverlap_square_moment (lam : ι → ℝ) {u v : EuclideanSpace ℝ ι} {r : ℝ} + (hr : 0 < r) (hu : ‖u‖ = r) (hv : ‖v‖ = r) (horth : inner ℝ u v = 0) : + (∫ q, q^2*pairMoment lam u v q ∂sphereOverlapLaw ι) / spherePartition lam 1 r^2 = + (∑ i, (∫ x : unitSphere ι, ((r • x.val) i)^2 ∂sphereTilted lam 1 r)^2) / r^4 := by + rw [sphereOverlap_weighted_tilted lam hu hv horth (fun q => q^2) (by fun_prop), + ← sphereTilted_overlap_moment] + simp_rw [real_inner_smul_left,real_inner_smul_right,mul_pow,integral_const_mul] + field_simp + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/PartitionBounds.lean b/lean/OAI/MathematicalPhysics/CriticalSK/PartitionBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..46334d17a39382d87b67093565be21b80f12818e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/PartitionBounds.lean @@ -0,0 +1,804 @@ +import OAI.MathematicalPhysics.CriticalSK.EdgeAsymptotics +import OAI.MathematicalPhysics.CriticalSK.OverlapMoments + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open scoped BigOperators ENNReal NNReal Real Topology + +open MeasureTheory ProbabilityTheory Filter + +open scoped ENNReal NNReal + +open scoped BigOperators NNReal + +open scoped BigOperators + +open scoped BigOperators InnerProductSpace + +open Module + +open Matrix Polynomial + +open scoped BigOperators Topology + +open Filter + +open scoped BigOperators NNReal ENNReal Topology Pointwise Matrix.Norms.Elementwise + +open Set Metric MeasureTheory MeasureTheory.Measure + +open scoped ENNReal NNReal BigOperators + +open MeasureTheory ProbabilityTheory + +open scoped ENNReal NNReal Topology + +open MeasureTheory MeasureTheory.Measure Set Metric + +open scoped NNReal ENNReal BigOperators + +open scoped NNReal ENNReal + +open ProbabilityTheory + +open Metric Set MeasureTheory + +open scoped ENNReal Pointwise + +open MeasureTheory Filter Set Real + +namespace CriticalSK + +section + +lemma log_le_square_half {x : ℝ} (hx : 0 < x) : Real.log x ≤ (x^2-1)/2 := by + have hh := Real.log_le_sub_one_of_pos (sq_pos_of_pos hx) + rw [Real.log_pow] at hh + norm_num at hh + linarith + +lemma gaussian_radial_shape_bound (p : ℕ) {R r : ℝ} (hR : 0 < R) (hr : 0 < r) + (hp : (p:ℝ) ≤ R) : + r^p * Real.exp (-r^2/2) ≤ + Real.exp ((R-p)/2) * (Real.sqrt R)^p * Real.exp (-R/2) := by + have hs := Real.sqrt_pos.mpr hR + have hs2 := Real.sq_sqrt hR.le + let x := r / Real.sqrt R + have hx : 0 < x := div_pos hr hs + have hxid : Real.sqrt R*x = r := by dsimp [x]; field_simp + have hx2 : R*x^2 = r^2 := by nlinarith [sq_nonneg (Real.sqrt R*x-r)] + have hlog := mul_le_mul_of_nonneg_left (log_le_square_half hx) (Nat.cast_nonneg p : (0:ℝ) ≤ p) + have hn : 0 ≤ (R-p)*x^2 := mul_nonneg (sub_nonneg.mpr hp) (sq_nonneg x) + have he : (p:ℝ)*Real.log x-r^2/2 ≤ (R-p)/2-R/2 := by nlinarith + have he' := Real.exp_le_exp.mpr he + rw [Real.exp_sub,Real.exp_nat_mul,Real.exp_log hx,Real.exp_sub] at he' + have he'' : x^p * Real.exp (-r^2/2) ≤ Real.exp ((R-p)/2)*Real.exp (-R/2) := by + rw [show -r^2/2 = -(r^2/2) by ring, show -R/2 = -(R/2) by ring, Real.exp_neg, Real.exp_neg] + simpa only [div_eq_mul_inv] using he' + calc + r^p * Real.exp (-r^2/2) = (Real.sqrt R)^p*(x^p*Real.exp (-r^2/2)) := by + rw [← mul_assoc,← mul_pow,hxid] + _ ≤ (Real.sqrt R)^p*(Real.exp ((R-p)/2)*Real.exp (-R/2)) := + mul_le_mul_of_nonneg_left he'' (pow_nonneg hs.le _) + _ = _ := by ring + +open Set Filter + +variable {ι : Type*} [Fintype ι] + +lemma diagonalGaussian_normSq_integrable (v : ι → ℝ≥0) : + Integrable (fun x : EuclideanSpace ℝ ι => ‖x‖^2) (diagonalGaussian v) := by + unfold diagonalGaussian + apply (integrable_map_measure (by fun_prop) (WithLp.measurable_toLp 2 _).aemeasurable).mpr + have hi := (piSquareSum_memLp v).integrable (by norm_num : (1:ℝ≥0∞) ≤ 2) + unfold piSquareSum at hi + simpa only [Function.comp_def,EuclideanSpace.real_norm_sq_eq] using hi + +lemma diagonalGaussian_normSq_mean (v : ι → ℝ≥0) : + (∫ x : EuclideanSpace ℝ ι, ‖x‖^2 ∂diagonalGaussian v) = ∑ i, (v i : ℝ) := by + rw [diagonalGaussian,integral_map (WithLp.measurable_toLp 2 _).aemeasurable (by fun_prop)] + simpa only [EuclideanSpace.real_norm_sq_eq,piSquareSum] using piSquareSum_mean v + +lemma diagonalGaussian_singleton_zero [Nonempty ι] (v : ι → ℝ≥0) (hv : ∀ i, v i ≠ 0) : + diagonalGaussian v ({0} : Set (EuclideanSpace ℝ ι)) = 0 := by + rw [diagonalGaussian_density v hv] + exact withDensity_absolutelyContinuous _ _ (measure_singleton 0) + +lemma diagonalGaussian_standard_shell_half [Nonempty ι] : + (1:ℝ)/2 ≤ (diagonalGaussian (fun _ : ι => 1) (normShell 0 (Real.sqrt (2*Fintype.card ι)))).toReal := by + let μ := diagonalGaussian (fun _ : ι => 1) + let A : Set (EuclideanSpace ℝ ι) := normShell 0 (Real.sqrt (2*Fintype.card ι)) + have hN : (0:ℝ) < Fintype.card ι := by exact_mod_cast Fintype.card_pos + have htail := mul_meas_ge_le_integral_of_nonneg (μ := μ) + (Eventually.of_forall (fun x : EuclideanSpace ℝ ι => sq_nonneg ‖x‖)) + (diagonalGaussian_normSq_integrable (fun _ => 1)) (2*Fintype.card ι) + rw [diagonalGaussian_normSq_mean] at htail + simp only [NNReal.coe_one,Finset.sum_const,Finset.card_univ,nsmul_eq_mul,mul_one] at htail + have hcomp : Aᶜ ⊆ ({0} : Set (EuclideanSpace ℝ ι)) ∪ {x | 2*(Fintype.card ι : ℝ) ≤ ‖x‖^2} := by + intro x hx + by_cases hx0 : x = 0 + · exact Or.inl hx0 + · right + change 2*(Fintype.card ι : ℝ) ≤ ‖x‖^2 + have hn : 0 < ‖x‖ := norm_pos_iff.mpr hx0 + have hh : Real.sqrt (2*Fintype.card ι) < ‖x‖ := by + by_contra h + exact hx ⟨hn,le_of_not_gt h⟩ + have hs := Real.sq_sqrt (show (0:ℝ) ≤ 2*Fintype.card ι by positivity) + have hspos := Real.sqrt_nonneg (2*(Fintype.card ι : ℝ)) + nlinarith + have hcomp' : μ Aᶜ ≤ μ {x | 2*(Fintype.card ι : ℝ) ≤ ‖x‖^2} := by + apply (measure_mono hcomp).trans + apply (measure_union_le _ _).trans + rw [show μ ({0} : Set (EuclideanSpace ℝ ι)) = 0 from diagonalGaussian_singleton_zero _ (by simp),zero_add] + have hreal := ENNReal.toReal_mono (measure_ne_top _ _) hcomp' + have hsum : (μ A).toReal+(μ Aᶜ).toReal = 1 := by + rw [← ENNReal.toReal_add (measure_ne_top _ _) (measure_ne_top _ _), + measure_add_measure_compl (normShell_measurable _ _),measure_univ,ENNReal.toReal_one] + change 1/2 ≤ (μ A).toReal + change 2*(Fintype.card ι : ℝ)*(μ {x | 2*(Fintype.card ι : ℝ) ≤ ‖x‖^2}).toReal ≤ Fintype.card ι at htail + nlinarith + +variable (n : ℕ) + +lemma diagonalSquareDensity_standard_formula : + diagonalSquareDensity (fun _ : Fin (n+2) => 1) (n+2) = + (Real.sqrt (n+2))^n * gaussianPiPrefactor (fun _ : Fin (n+2) => 1) * + Real.exp (-(n+2)/2) * sphereArea (ι := Fin (n+2)) / 2 := by + rw [diagonalSquareDensity,radialDensity_standard] + simp only [Fintype.card_fin,show n+2-1=n+1 by omega,pow_succ, + Real.sq_sqrt (show (0:ℝ) ≤ n+2 by positivity)] + field_simp + +lemma standard_radial_density_upper {r : ℝ} (hr : 0 ≤ r) : + radialDensity volume (fun x : EuclideanSpace ℝ (Fin (n+2)) => gaussianPiPDF (fun _ => 1) x) r ≤ + 2*r*Real.exp 1*diagonalSquareDensity (fun _ : Fin (n+2) => 1) (n+2) := by + rw [radialDensity_standard,diagonalSquareDensity_standard_formula] + simp only [Fintype.card_fin,show n+2-1=n+1 by omega,pow_succ] + rcases hr.eq_or_lt with h | h + · simp [← h] + · have hp := gaussian_radial_shape_bound n (by positivity : (0:ℝ) < n+2) h (by linarith : (n:ℝ) ≤ n+2) + rw [show ((n:ℝ)+2-n)/2=1 by ring] at hp + have hmul := mul_le_mul_of_nonneg_right hp + (show 0 ≤ r*gaussianPiPrefactor (fun _ : Fin (n+2) => 1)*sphereArea (ι := Fin (n+2)) by + exact mul_nonneg (mul_nonneg h.le (gaussianPiPrefactor_pos (by simp)).le) sphereArea_pos.le) + convert hmul using 1 <;> first | rfl | ring_nf + +lemma diagonalSquareDensity_standard_lower : + 1/(4*Real.exp 1*(n+2)) ≤ diagonalSquareDensity (fun _ : Fin (n+2) => 1) (n+2) := by + let R := Real.sqrt (2*((n:ℝ)+2)) + have hR : 0 ≤ R := Real.sqrt_nonneg _ + have hR2 : R^2 = 2*((n:ℝ)+2) := Real.sq_sqrt (by positivity) + have hmass := diagonalGaussian_standard_shell_half (ι := Fin (n+2)) + simp only [Fintype.card_fin,Nat.cast_add,Nat.cast_ofNat] at hmass + rw [diagonalGaussian_density _ (by simp),normShell_density_real volume + (euclideanGaussianPDF_integrable _) (fun x => gaussianPiPDF_nonneg _ x.ofLp) (le_refl 0)] at hmass + have hi := setIntegral_mono_on (μ := (volume : Measure ℝ)) (s := Ioc 0 R) + ((radialDensity_continuous volume (euclideanGaussianPDF_continuous (fun _ : Fin (n+2) => 1))).continuousOn.integrableOn_Icc.mono_set Ioc_subset_Icc_self) + ((show Continuous (fun r : ℝ => 2*r*Real.exp 1*diagonalSquareDensity (fun _ : Fin (n+2) => 1) (n+2)) by fun_prop).continuousOn.integrableOn_Icc.mono_set Ioc_subset_Icc_self) + measurableSet_Ioc (fun r hr => standard_radial_density_upper n hr.1.le) + have he : (∫ r in Ioc 0 R, 2*r*Real.exp 1*diagonalSquareDensity (fun _ : Fin (n+2) => 1) (n+2)) = + 2*((n:ℝ)+2)*Real.exp 1*diagonalSquareDensity (fun _ : Fin (n+2) => 1) (n+2) := by + rw [← intervalIntegral.integral_of_le hR,intervalIntegral.integral_mul_const, + intervalIntegral.integral_mul_const,intervalIntegral.integral_const_mul,integral_id] + rw [hR2] + ring + rw [he] at hi + have hh : 1/2 ≤ 2*((n:ℝ)+2)*Real.exp 1*diagonalSquareDensity (fun _ : Fin (n+2) => 1) (n+2) := + hmass.trans hi + apply (div_le_iff₀ (by positivity)).mpr + nlinarith + +end + +section + +variable {ι : Type*} [Fintype ι] [Nonempty ι] + +def spectralTop (lam : ι → ℝ) : ℝ := Finset.univ.sup' Finset.univ_nonempty lam + +lemma le_spectralTop (lam : ι → ℝ) (i : ι) : lam i ≤ spectralTop lam := + Finset.le_sup' lam (Finset.mem_univ i) + +lemma spectralTop_attained (lam : ι → ℝ) : ∃ i, lam i = spectralTop lam := by + obtain ⟨i, _, hi⟩ := Finset.exists_mem_eq_sup' Finset.univ_nonempty lam + exact ⟨i,hi.symm⟩ + +def spectralStieltjes (lam : ι → ℝ) (r : ℝ) : ℝ := + (Fintype.card ι : ℝ)⁻¹ * ∑ i, (r-lam i)⁻¹ + +def spectralStieltjesSlope (lam : ι → ℝ) (r : ℝ) : ℝ := + -(Fintype.card ι : ℝ)⁻¹ * ∑ i, ((r-lam i)⁻¹)^2 + +lemma cardinal_pos_real : (0:ℝ) < Fintype.card ι := by exact_mod_cast Fintype.card_pos + +lemma spectralStieltjes_pos (lam : ι → ℝ) {r : ℝ} (hr : spectralTop lam < r) : + 0 < spectralStieltjes lam r := by + unfold spectralStieltjes + apply mul_pos (inv_pos.mpr cardinal_pos_real) + apply Finset.sum_pos (fun i _ => inv_pos.mpr (by linarith [le_spectralTop lam i])) Finset.univ_nonempty + +lemma spectralStieltjes_strictAnti (lam : ι → ℝ) : StrictAntiOn (spectralStieltjes lam) (Ioi (spectralTop lam)) := by + intro r hr s _ hrs + change spectralTop lam < r at hr + unfold spectralStieltjes + apply mul_lt_mul_of_pos_left _ (inv_pos.mpr cardinal_pos_real) + apply Finset.sum_lt_sum_of_nonempty Finset.univ_nonempty + intro i _ + exact inv_strictAnti₀ (by linarith [le_spectralTop lam i] : 0 < r-lam i) (by linarith) + +lemma spectralStieltjes_hasStrictDerivAt (lam : ι → ℝ) {r : ℝ} (hr : spectralTop lam < r) : + HasStrictDerivAt (spectralStieltjes lam) (spectralStieltjesSlope lam r) r := by + have h (i : ι) := (hasStrictDerivAt_inv (ne_of_gt (show 0 < r-lam i by linarith [le_spectralTop lam i]))).comp r ((hasStrictDerivAt_id r).sub_const (lam i)) + have hd := (HasStrictDerivAt.sum (u := Finset.univ) (fun i _ => h i)).const_mul (Fintype.card ι : ℝ)⁻¹ + convert! hd using 1 + · funext x; simp [spectralStieltjes, Finset.sum_apply] + · unfold spectralStieltjesSlope + simp only [mul_one,inv_pow,Finset.sum_neg_distrib,neg_mul,mul_neg] + +lemma spectralStieltjesSlope_neg (lam : ι → ℝ) {r : ℝ} (hr : spectralTop lam < r) : + spectralStieltjesSlope lam r < 0 := by + unfold spectralStieltjesSlope + apply mul_neg_of_neg_of_pos (neg_neg_of_pos (inv_pos.mpr cardinal_pos_real)) + exact Finset.sum_pos (fun i _ => sq_pos_of_pos (inv_pos.mpr (by linarith [le_spectralTop lam i]))) Finset.univ_nonempty + +lemma spectralStieltjes_continuous (lam : ι → ℝ) : ContinuousOn (spectralStieltjes lam) (Ioi (spectralTop lam)) := + fun _ hr => (spectralStieltjes_hasStrictDerivAt lam hr).hasDerivAt.continuousAt.continuousWithinAt + +lemma spectralStieltjes_exists (lam : ι → ℝ) {a : ℝ} (ha : 0 < a) : + ∃ r, spectralTop lam < r ∧ spectralStieltjes lam r = a := by + let N : ℝ := Fintype.card ι + have hN : 0 < N := cardinal_pos_real + have hN1 : 1 ≤ N := by + change (1:ℝ) ≤ Fintype.card ι + exact_mod_cast (Fintype.card_pos (α := ι)) + let l := spectralTop lam + (N*a)⁻¹ + let u := spectralTop lam + a⁻¹ + have hl : spectralTop lam < l := by + exact lt_add_of_pos_right _ (inv_pos.mpr (mul_pos hN ha)) + have hlu : l ≤ u := by + dsimp [l,u] + gcongr + nlinarith + have hlow : a ≤ spectralStieltjes lam l := by + obtain ⟨i,hi⟩ := spectralTop_attained lam + have hp (j : ι) : 0 ≤ (l-lam j)⁻¹ := by exact (inv_pos.mpr (by linarith [le_spectralTop lam j])).le + have hsum := Finset.single_le_sum (fun j _ => hp j) (Finset.mem_univ i) + have hmul := mul_le_mul_of_nonneg_left hsum (inv_pos.mpr hN).le + have heq : N⁻¹ * (l-lam i)⁻¹ = a := by + rw [hi] + dsimp [l] + rw [add_sub_cancel_left, inv_inv] + field_simp + rw [heq] at hmul + exact hmul + have hupp : spectralStieltjes lam u ≤ a := by + have hh (i : ι) : (u-lam i)⁻¹ ≤ a := by + have hle : a⁻¹ ≤ u-lam i := by dsimp [u]; linarith [le_spectralTop lam i] + have hh := inv_anti₀ (inv_pos.mpr ha) hle + simpa only [inv_inv] using hh + have hs := Finset.sum_le_sum (fun i (_ : i ∈ Finset.univ) => hh i) + have ht := mul_le_mul_of_nonneg_left hs (inv_pos.mpr hN).le + change N⁻¹ * ∑ i, (u-lam i)⁻¹ ≤ a + simpa only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul,← mul_assoc, show (Fintype.card ι : ℝ) = N from rfl, inv_mul_cancel₀ hN.ne',one_mul] using ht + have hc := (spectralStieltjes_continuous lam).mono (show Icc l u ⊆ Ioi (spectralTop lam) from fun _ hx => hl.trans_le hx.1) + obtain ⟨r,hr,heq⟩ := intermediate_value_Icc' hlu hc ⟨hupp,hlow⟩ + exact ⟨r,hl.trans_le hr.1,heq⟩ + +def saddleRadius (lam : ι → ℝ) (a : ℝ) : ℝ := + if h : 0 < a then (spectralStieltjes_exists lam h).choose else 0 + +lemma saddleRadius_spec (lam : ι → ℝ) {a : ℝ} (ha : 0 < a) : + spectralTop lam < saddleRadius lam a ∧ spectralStieltjes lam (saddleRadius lam a) = a := by + simpa only [saddleRadius,dite_eq_left ha] using (spectralStieltjes_exists lam ha).choose_spec + +lemma saddleRadius_unique (lam : ι → ℝ) {a r : ℝ} (hr : spectralTop lam < r) + (heq : spectralStieltjes lam r = a) : saddleRadius lam a = r := by + have ha : 0 < a := heq ▸ spectralStieltjes_pos lam hr + exact (spectralStieltjes_strictAnti lam).injOn (saddleRadius_spec lam ha).1 hr + ((saddleRadius_spec lam ha).2.trans heq.symm) + +lemma saddleRadius_hasStrictDerivAt (lam : ι → ℝ) {a : ℝ} (ha : 0 < a) : + HasStrictDerivAt (saddleRadius lam) (spectralStieltjesSlope lam (saddleRadius lam a))⁻¹ a := by + obtain ⟨hr,heq⟩ := saddleRadius_spec lam ha + have hd := spectralStieltjes_hasStrictDerivAt lam hr + have hg : ∀ᶠ r in 𝓝 (saddleRadius lam a), saddleRadius lam (spectralStieltjes lam r) = r := by + filter_upwards [eventually_gt_nhds hr] with r hr + exact saddleRadius_unique lam hr rfl + have h := hd.to_local_left_inverse (spectralStieltjesSlope_neg lam hr).ne hg + rwa [heq] at h + +def saddleObjective (lam : ι → ℝ) (a z : ℝ) : ℝ := + (z-1)/2 - (2*(Fintype.card ι : ℝ))⁻¹ * ∑ i, Real.log (z-a*lam i) + +def sphericalVariational (lam : ι → ℝ) (a : ℝ) : ℝ := + sInf (saddleObjective lam a '' Set.Ioi (a*spectralTop lam)) + +def saddleZ (lam : ι → ℝ) (a : ℝ) : ℝ := + if a = 0 then 1 else a*saddleRadius lam a + +lemma saddleZ_pos_gap (lam : ι → ℝ) {a : ℝ} (ha : 0 ≤ a) : + a*spectralTop lam < saddleZ lam a := by + rcases ha.eq_or_lt with h | h + · simp [← h,saddleZ] + · simp only [saddleZ,ite_eq_right h.ne'] + exact mul_lt_mul_of_pos_left (saddleRadius_spec lam h).1 h + +lemma saddleZ_gap_pos (lam : ι → ℝ) {a : ℝ} (ha : 0 ≤ a) (i : ι) : + 0 < saddleZ lam a-a*lam i := by + have h := mul_le_mul_of_nonneg_left (le_spectralTop lam i) ha + linarith [saddleZ_pos_gap lam ha] + +lemma saddleZ_reciprocal_sum (lam : ι → ℝ) {a : ℝ} (ha : 0 ≤ a) : + ∑ i, (saddleZ lam a-a*lam i)⁻¹ = Fintype.card ι := by + rcases ha.eq_or_lt with h | h + · simp [← h,saddleZ] + · have heq := (saddleRadius_spec lam h).2 + unfold spectralStieltjes at heq + have hs : ∑ i, (saddleRadius lam a-lam i)⁻¹ = (Fintype.card ι : ℝ)*a := by + have hN : (Fintype.card ι : ℝ) ≠ 0 := cardinal_pos_real.ne' + exact (inv_mul_eq_iff_eq_mul₀ hN).mp heq + simp only [saddleZ,ite_eq_right h.ne',← mul_sub,_root_.mul_inv_rev] + rw [← Finset.sum_mul, hs] + field_simp + +lemma saddleObjective_min (lam : ι → ℝ) {a z : ℝ} (ha : 0 ≤ a) + (hz : a*spectralTop lam < z) : + saddleObjective lam a (saddleZ lam a) ≤ saddleObjective lam a z := by + have hzpos (i : ι) : 0 < z-a*lam i := by + have h := mul_le_mul_of_nonneg_left (le_spectralTop lam i) ha + linarith + have hl (i : ι) : Real.log (z-a*lam i)-Real.log (saddleZ lam a-a*lam i) ≤ + (z-saddleZ lam a)*(saddleZ lam a-a*lam i)⁻¹ := by + rw [← Real.log_div (hzpos i).ne' (saddleZ_gap_pos lam ha i).ne'] + have hh := Real.log_le_sub_one_of_pos (div_pos (hzpos i) (saddleZ_gap_pos lam ha i)) + convert hh using 1 + field_simp [(saddleZ_gap_pos lam ha i).ne'] + ring + have hs := Finset.sum_le_sum (fun i (_ : i ∈ Finset.univ) => hl i) + rw [Finset.sum_sub_distrib,← Finset.mul_sum,saddleZ_reciprocal_sum lam ha] at hs + have hN : (0:ℝ) < Fintype.card ι := cardinal_pos_real + have hm := mul_le_mul_of_nonneg_left hs (show 0 ≤ (2*(Fintype.card ι : ℝ))⁻¹ by positivity) + unfold saddleObjective + have he : (2*(Fintype.card ι : ℝ))⁻¹ * ((z-saddleZ lam a)*(Fintype.card ι : ℝ)) = + (z-saddleZ lam a)/2 := by field_simp + rw [he] at hm + linarith + +lemma sphericalVariational_eq (lam : ι → ℝ) {a : ℝ} (ha : 0 ≤ a) : + sphericalVariational lam a = saddleObjective lam a (saddleZ lam a) := by + apply IsLeast.csInf_eq + constructor + · exact ⟨saddleZ lam a,saddleZ_pos_gap lam ha,rfl⟩ + · rintro _ ⟨z,hz,rfl⟩ + exact saddleObjective_min lam ha hz + +lemma sphericalVariational_zero (lam : ι → ℝ) : sphericalVariational lam 0 = 0 := by + rw [sphericalVariational_eq lam (le_refl 0)] + simp [saddleObjective,saddleZ] + +lemma sphericalVariational_radius_expr (lam : ι → ℝ) {a : ℝ} (ha : 0 < a) : + sphericalVariational lam a = (a*saddleRadius lam a-1)/2-Real.log a/2 - + (2*(Fintype.card ι : ℝ))⁻¹ * ∑ i, Real.log (saddleRadius lam a-lam i) := by + rw [sphericalVariational_eq lam ha.le] + simp only [saddleObjective,saddleZ,ite_eq_right ha.ne',← mul_sub] + have hr := (saddleRadius_spec lam ha).1 + have he (i : ι) := Real.log_mul ha.ne' (ne_of_gt (show 0 < saddleRadius lam a-lam i by linarith [le_spectralTop lam i])) + simp_rw [he] + rw [Finset.sum_add_distrib,Finset.sum_const,Finset.card_univ,nsmul_eq_mul] + have hN : (Fintype.card ι : ℝ) ≠ 0 := cardinal_pos_real.ne' + field_simp + ring + +lemma sphericalVariational_hasDerivAt (lam : ι → ℝ) {a : ℝ} (ha : 0 < a) : + HasDerivAt (sphericalVariational lam) ((saddleRadius lam a-a⁻¹)/2) a := by + let r := saddleRadius lam + let d := (spectralStieltjesSlope lam (r a))⁻¹ + have hr : HasDerivAt r d a := (saddleRadius_hasStrictDerivAt lam ha).hasDerivAt + have hpos (i : ι) : 0 < r a-lam i := by + have hs := (saddleRadius_spec lam ha).1 + dsimp [r] + linarith [le_spectralTop lam i] + have hlog (i : ι) := (hr.sub_const (lam i)).log (hpos i).ne' + have hsum := HasDerivAt.sum (u := Finset.univ) (fun i _ => hlog i) + have hd := (((hasDerivAt_id a).mul hr).sub_const 1).div_const 2 + have hd := (hd.sub ((hasDerivAt_log ha.ne').div_const 2)).sub + (hsum.const_mul (2*(Fintype.card ι : ℝ))⁻¹) + have heq : ∀ᶠ b in 𝓝 a, sphericalVariational lam b = + (b*r b-1)/2-Real.log b/2 - (2*(Fintype.card ι : ℝ))⁻¹*∑ i, Real.log (r b-lam i) := by + filter_upwards [eventually_gt_nhds ha] with b hb + exact sphericalVariational_radius_expr lam hb + simp only [Pi.mul_apply, Finset.sum_apply, id_eq] at hd + have hres := hd.congr_of_eventuallyEq heq + have hs := (saddleRadius_spec lam ha).2 + unfold spectralStieltjes at hs + have hN : (Fintype.card ι : ℝ) ≠ 0 := cardinal_pos_real.ne' + have hs' : ∑ i, (r a-lam i)⁻¹ = (Fintype.card ι : ℝ)*a := + (inv_mul_eq_iff_eq_mul₀ hN).mp hs + convert! hres using 1 + simp only [div_eq_mul_inv,← Finset.mul_sum,hs'] + field_simp + ring + +lemma saddleZ_weighted_identity (lam : ι → ℝ) {a : ℝ} (ha : 0 ≤ a) : + (saddleZ lam a-1)*(Fintype.card ι : ℝ) = + a*∑ i, lam i*(saddleZ lam a-a*lam i)⁻¹ := by + have h (i : ι) : saddleZ lam a*(saddleZ lam a-a*lam i)⁻¹ - + a*(lam i*(saddleZ lam a-a*lam i)⁻¹) = 1 := by + rw [← mul_assoc,← sub_mul,mul_inv_cancel₀ (saddleZ_gap_pos lam ha i).ne'] + have hs := Finset.sum_congr rfl (fun i (_ : i ∈ Finset.univ) => h i) + rw [Finset.sum_sub_distrib,← Finset.mul_sum,← Finset.mul_sum, + saddleZ_reciprocal_sum lam ha,Finset.sum_const,Finset.card_univ,nsmul_eq_mul,mul_one] at hs + linarith + +lemma sphericalVariational_slope_bound (lam : ι → ℝ) {a C : ℝ} (ha : 0 < a) + (hlam : ∀ i, |lam i| ≤ C) : |(saddleRadius lam a-a⁻¹)/2| ≤ C/2 := by + have hN : (0:ℝ) < Fintype.card ι := cardinal_pos_real + have hw := saddleZ_weighted_identity lam ha.le + have hb : |∑ i, lam i*(saddleZ lam a-a*lam i)⁻¹| ≤ C*(Fintype.card ι : ℝ) := by + calc + _ ≤ ∑ i, |lam i*(saddleZ lam a-a*lam i)⁻¹| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ i, C*(saddleZ lam a-a*lam i)⁻¹ := by + apply Finset.sum_le_sum + intro i _ + rw [abs_mul,abs_of_pos (inv_pos.mpr (saddleZ_gap_pos lam ha.le i))] + exact mul_le_mul_of_nonneg_right (hlam i) (inv_pos.mpr (saddleZ_gap_pos lam ha.le i)).le + _ = _ := by rw [← Finset.mul_sum,saddleZ_reciprocal_sum lam ha.le] + have hwb := congrArg abs hw + rw [abs_mul,abs_of_pos hN,abs_mul,abs_of_pos ha] at hwb + have hzbound : |saddleZ lam a-1| ≤ a*C := by nlinarith + have heq : (saddleRadius lam a-a⁻¹)/2 = (saddleZ lam a-1)/(2*a) := by + simp only [saddleZ,ite_eq_right ha.ne'] + field_simp + rw [heq,abs_div,abs_of_pos (by positivity : 0 < 2*a)] + apply (div_le_iff₀ (by positivity)).mpr + nlinarith + +lemma sphericalVariational_abs_le (lam : ι → ℝ) {a C : ℝ} (ha : 0 ≤ a) + (hlam : ∀ i, |lam i| ≤ C) : |sphericalVariational lam a| ≤ a*C/2 := by + have hN : (0:ℝ) < Fintype.card ι := cardinal_pos_real + have htop : spectralTop lam ≤ C := by + obtain ⟨i,hi⟩ := spectralTop_attained lam + rw [← hi] + exact (abs_le.mp (hlam i)).2 + have hz : a*spectralTop lam < 1+a*C := by nlinarith [mul_le_mul_of_nonneg_left htop ha] + have hu := saddleObjective_min lam ha hz + have hlogs : 0 ≤ ∑ i, Real.log (1+a*C-a*lam i) := by + apply Finset.sum_nonneg + intro i _ + apply Real.log_nonneg + nlinarith [mul_le_mul_of_nonneg_left (abs_le.mp (hlam i)).2 ha] + have hlo := Finset.sum_le_sum (fun i (_ : i ∈ Finset.univ) => + Real.log_le_sub_one_of_pos (saddleZ_gap_pos lam ha i)) + have hsumlow : -(C*(Fintype.card ι : ℝ)) ≤ ∑ i, lam i := by + have hs := Finset.sum_le_sum (fun i (_ : i ∈ Finset.univ) => (abs_le.mp (hlam i)).1) + simpa [Finset.sum_const,Finset.card_univ,mul_comm] using hs + rw [sphericalVariational_eq lam ha,abs_le] + constructor + · unfold saddleObjective + simp only [Finset.sum_sub_distrib,Finset.sum_const,Finset.card_univ,nsmul_eq_mul, + ← Finset.mul_sum,mul_one] at hlo + have hl := mul_le_mul_of_nonneg_left hsumlow ha + have hb : ∑ i, Real.log (saddleZ lam a-a*lam i) ≤ + (Fintype.card ι : ℝ)*(saddleZ lam a-1+a*C) := by nlinarith + have hh := mul_le_mul_of_nonneg_left hb (show 0 ≤ (2*(Fintype.card ι : ℝ))⁻¹ by positivity) + have he : (2*(Fintype.card ι : ℝ))⁻¹ *((Fintype.card ι : ℝ)*(saddleZ lam a-1+a*C)) = + (saddleZ lam a-1+a*C)/2 := by field_simp + rw [he] at hh + linarith + · unfold saddleObjective at hu ⊢ + have hh : 0 ≤ (2*(Fintype.card ι : ℝ))⁻¹ * ∑ i, Real.log (1+a*C-a*lam i) := mul_nonneg (by positivity) hlogs + linarith + +lemma sphericalVariational_continuousOn (lam : ι → ℝ) : + ContinuousOn (sphericalVariational lam) (Ici 0) := by + intro a ha + change 0 ≤ a at ha + rcases ha.eq_or_lt with h | h + · subst a + let C := Finset.univ.sup' Finset.univ_nonempty (fun i => |lam i|) + have hC (i : ι) : |lam i| ≤ C := Finset.le_sup' (fun i => |lam i|) (Finset.mem_univ i) + rw [ContinuousWithinAt] + rw [sphericalVariational_zero] + apply squeeze_zero_norm' (f := sphericalVariational lam) (a := fun a : ℝ => a*C/2) + · filter_upwards [self_mem_nhdsWithin] with a ha + simpa only [norm_eq_abs] using sphericalVariational_abs_le lam ha hC + · simpa using (((continuousAt_id.mul_const C).div_const 2).tendsto.mono_left nhdsWithin_le_nhds : + Tendsto (fun a : ℝ => a*C/2) (𝓝[Ici 0] 0) (𝓝 (0*C/2))) + · exact (sphericalVariational_hasDerivAt lam h).continuousAt.continuousWithinAt + +end + +section + +open Set + +variable {ι : Type*} [Fintype ι] [Nonempty ι] + +omit [Nonempty ι] in +lemma gaussianPiPrefactor_log {v : ι → ℝ≥0} (hv : ∀ i, v i ≠ 0) : + Real.log (gaussianPiPrefactor v) = -(∑ i, Real.log (2*Real.pi*(v i:ℝ)))/2 := by + unfold gaussianPiPrefactor + rw [Real.log_prod (fun i _ => inv_ne_zero (Real.sqrt_ne_zero'.mpr (by + have hi : 0 < (v i : ℝ) := NNReal.coe_pos.mpr (pos_iff_ne_zero.mpr (hv i)) + positivity)))] + have hs (i : ι) : Real.log (Real.sqrt (2*Real.pi*(v i:ℝ))) = Real.log (2*Real.pi*(v i:ℝ))/2 := + Real.log_sqrt (by positivity) + simp_rw [Real.log_inv,hs] + simp only [Finset.sum_neg_distrib,← Finset.sum_div,neg_div] + +omit [Nonempty ι] in +lemma gaussianPiPrefactor_log_ratio {v : ι → ℝ≥0} (hv : ∀ i, v i ≠ 0) : + Real.log (gaussianPiPrefactor v / gaussianPiPrefactor (fun _ : ι => 1)) = + (∑ i, Real.log ((v i : ℝ)⁻¹))/2 := by + rw [Real.log_div (gaussianPiPrefactor_pos hv).ne' + (gaussianPiPrefactor_pos (v := fun _ : ι => 1) (by simp)).ne', + gaussianPiPrefactor_log hv,gaussianPiPrefactor_log (v := fun _ : ι => 1) (by simp)] + have hlog (i : ι) : Real.log (2*Real.pi*(v i:ℝ)) = Real.log (2*Real.pi)+Real.log (v i) := + Real.log_mul (by positivity) (NNReal.coe_ne_zero.mpr (hv i)) + simp_rw [hlog,NNReal.coe_one,mul_one,Real.log_inv] + rw [Finset.sum_add_distrib,Finset.sum_neg_distrib] + ring + +lemma spherical_gaussian_identity {lam : ι → ℝ} {v : ι → ℝ≥0} {z a : ℝ} + (hv : ∀ i, v i ≠ 0) (hq : ∀ i, (v i : ℝ)⁻¹ = z-a*lam i) : + spherePartition lam a (Real.sqrt (Fintype.card ι)) = + Real.exp ((Fintype.card ι : ℝ)*saddleObjective lam a z) * + (diagonalSquareDensity v (Fintype.card ι) / + diagonalSquareDensity (fun _ : ι => 1) (Fintype.card ι)) := by + have hN : (0:ℝ) < Fintype.card ι := cardinal_pos_real + have hs := Real.sqrt_pos.mpr hN + have hr := spherical_radial_ratio hq hs + have hp := gaussianPiPrefactor_log_ratio hv + simp_rw [hq] at hp + have he : gaussianPiPrefactor v / gaussianPiPrefactor (fun _ : ι => 1) * + Real.exp (-(z-1)*(Real.sqrt (Fintype.card ι))^2/2) = + Real.exp (-((Fintype.card ι : ℝ)*saddleObjective lam a z)) := by + rw [← Real.exp_log (div_pos (gaussianPiPrefactor_pos hv) (gaussianPiPrefactor_pos (by simp))), + ← Real.exp_add,hp,Real.sq_sqrt hN.le] + congr 1 + unfold saddleObjective + field_simp + ring + rw [he] at hr + have hd : diagonalSquareDensity v (Fintype.card ι) / + diagonalSquareDensity (fun _ : ι => 1) (Fintype.card ι) = + radialDensity volume (fun x : EuclideanSpace ℝ ι => gaussianPiPDF v x) (Real.sqrt (Fintype.card ι)) / + radialDensity volume (fun x : EuclideanSpace ℝ ι => gaussianPiPDF (fun _ => 1) x) (Real.sqrt (Fintype.card ι)) := by + unfold diagonalSquareDensity + rw [div_div_div_cancel_right₀ (mul_ne_zero two_ne_zero hs.ne')] + rw [hd,hr,Real.exp_neg] + field_simp + +lemma saddleZ_le_bound (lam : ι → ℝ) {a C : ℝ} (ha : 0 ≤ a) (hlam : ∀ i, lam i ≤ C) : + saddleZ lam a ≤ 1+a*C := by + have hs := Finset.sum_le_sum (fun i (_ : i ∈ Finset.univ) => + mul_le_mul_of_nonneg_right (hlam i) (inv_pos.mpr (saddleZ_gap_pos lam ha i)).le) + rw [← Finset.mul_sum,saddleZ_reciprocal_sum lam ha] at hs + have hh := mul_le_mul_of_nonneg_left hs ha + rw [← saddleZ_weighted_identity lam ha] at hh + have hN : (0:ℝ) < Fintype.card ι := cardinal_pos_real + nlinarith + +def saddleVariance (lam : ι → ℝ) (a : ℝ) (i : ι) : ℝ≥0 := + Real.toNNReal ((saddleZ lam a-a*lam i)⁻¹) + +lemma saddleVariance_coe (lam : ι → ℝ) {a : ℝ} (ha : 0 ≤ a) (i : ι) : + (saddleVariance lam a i : ℝ) = (saddleZ lam a-a*lam i)⁻¹ := + Real.coe_toNNReal _ (inv_pos.mpr (saddleZ_gap_pos lam ha i)).le + +lemma saddleVariance_pos (lam : ι → ℝ) {a : ℝ} (ha : 0 ≤ a) (i : ι) : + 0 < saddleVariance lam a i := by + rw [← NNReal.coe_pos,saddleVariance_coe lam ha] + exact inv_pos.mpr (saddleZ_gap_pos lam ha i) + +lemma saddleVariance_lower (lam : ι → ℝ) {a : ℝ} (ha : a ∈ Icc 0 2) + (hlam : ∀ i, |lam i| ≤ 3) (i : ι) : (1:ℝ)/13 ≤ saddleVariance lam a i := by + rw [saddleVariance_coe lam ha.1] + have hz := saddleZ_le_bound lam ha.1 (fun i => (abs_le.mp (hlam i)).2) + have hi := (abs_le.mp (hlam i)).1 + have hm := mul_le_mul_of_nonneg_left hi ha.1 + have hg : saddleZ lam a-a*lam i ≤ 13 := by nlinarith [ha.2] + simpa using inv_anti₀ (saddleZ_gap_pos lam ha.1 i) hg + +lemma gaussianPairPrefactor_bound {a b : ℝ≥0} {c : ℝ} (hc : 0 < c) + (ha : c⁻¹ ≤ (a:ℝ)) (hb : c⁻¹ ≤ (b:ℝ)) : + Real.pi*gaussianPairPrefactor a b ≤ c/2 := by + have hc' : 0 < 2*Real.pi/c := by positivity + have h1 : Real.sqrt (2*Real.pi/c) ≤ Real.sqrt (2*Real.pi*a) := + Real.sqrt_le_sqrt (by simpa only [div_eq_mul_inv] using mul_le_mul_of_nonneg_left ha (by positivity : 0 ≤ 2*Real.pi)) + have h2 : Real.sqrt (2*Real.pi/c) ≤ Real.sqrt (2*Real.pi*b) := + Real.sqrt_le_sqrt (by simpa only [div_eq_mul_inv] using mul_le_mul_of_nonneg_left hb (by positivity : 0 ≤ 2*Real.pi)) + have hh := mul_le_mul h1 h2 (Real.sqrt_nonneg _) (Real.sqrt_nonneg _) + rw [← sq,Real.sq_sqrt hc'.le] at hh + have hi := inv_anti₀ hc' hh + have hp := mul_le_mul_of_nonneg_left hi Real.pi_pos.le + unfold gaussianPairPrefactor + convert hp using 1; first | rfl | field_simp + +variable (n : ℕ) + +lemma spherePartition_upper (lam : Fin (n+2) → ℝ) {a : ℝ} (ha : a ∈ Icc 0 2) + (hlam : ∀ i, |lam i| ≤ 3) : + spherePartition lam a (Real.sqrt (n+2)) ≤ + 26*Real.exp 1*(n+2)*Real.exp ((n+2)*sphericalVariational lam a) := by + have hv : ∀ i, saddleVariance lam a i ≠ 0 := fun i => (saddleVariance_pos lam ha.1 i).ne' + have hq (i) : (saddleVariance lam a i : ℝ)⁻¹ = saddleZ lam a-a*lam i := by + rw [saddleVariance_coe lam ha.1,inv_inv] + have hid := spherical_gaussian_identity hv hq + rw [← sphericalVariational_eq lam ha.1] at hid + simp only [Fintype.card_fin,Nat.cast_add,Nat.cast_ofNat] at hid + rw [hid] + have hu := (diagonalSquareDensity_upper (saddleVariance lam a) hv + (by positivity : (0:ℝ) < n+2)).trans (gaussianPairPrefactor_bound (by norm_num : (0:ℝ) < 13) + (by simpa using saddleVariance_lower lam ha hlam 0) (by simpa using saddleVariance_lower lam ha hlam 1)) + have hd := diagonalSquareDensity_standard_lower n + have hdpos : 0 < diagonalSquareDensity (fun _ : Fin (n+2) => 1) (n+2) := + lt_of_lt_of_le (by positivity) hd + have hratio : diagonalSquareDensity (saddleVariance lam a) (n+2) / + diagonalSquareDensity (fun _ : Fin (n+2) => 1) (n+2) ≤ 26*Real.exp 1*(n+2) := by + apply (div_le_iff₀ hdpos).mpr + have hm := mul_le_mul_of_nonneg_left hd (show 0 ≤ 26*Real.exp 1*((n:ℝ)+2) by positivity) + have he : 26*Real.exp 1*((n:ℝ)+2)*(1/(4*Real.exp 1*((n:ℝ)+2))) = 13/2 := by field_simp; ring + rw [he] at hm + exact hu.trans hm + have hh := mul_le_mul_of_nonneg_left hratio (Real.exp_pos (((n:ℝ)+2)*sphericalVariational lam a)).le + simpa only [mul_comm] using hh + +end + +section + +open Set + +variable {n : ℕ} + +lemma diagonalSquareDensity_standard_upper : + diagonalSquareDensity (fun _ : Fin (n+2) => 1) (n+2) ≤ 1/2 := by + have hh := diagonalSquareDensity_upper (fun _ : Fin (n+2) => 1) (by simp) + (by positivity : (0:ℝ) < n+2) + have he : Real.pi*gaussianPairPrefactor 1 1 = 1/2 := by + unfold gaussianPairPrefactor + norm_num only [NNReal.coe_one,mul_one] + rw [← sq,Real.sq_sqrt (by positivity)] + field_simp + rwa [he] at hh + +lemma spherePartition_fixed_lower (lam : Fin (n+2) → ℝ) (v : Fin (n+2) → ℝ≥0) + {z m d : ℝ} (hv : ∀ i, v i ≠ 0) (hq : ∀ i, (v i:ℝ)⁻¹ = z-lam i) + (hm : 0 < m) (hm0 : m ≤ v 0) (hm1 : m ≤ v 1) (hd : 0 < d) + (hmean : (∑ i : Fin n, (v i.succ.succ : ℝ)) = (n+2)-d) + (hvar : 128*(∑ i : Fin n, (v i.succ.succ : ℝ)^2) ≤ d^2) : + Real.pi*gaussianPairPrefactor (v 0) (v 1)*Real.exp (-d/m) * + Real.exp ((n+2)*sphericalVariational lam 1) ≤ spherePartition lam 1 (Real.sqrt (n+2)) := by + let K := Real.pi*gaussianPairPrefactor (v 0) (v 1)*Real.exp (-d/m) + have hK : 0 ≤ K := mul_nonneg (mul_nonneg Real.pi_pos.le (gaussianPairPrefactor_nonneg _ _)) (Real.exp_pos _).le + have hlo := diagonalSquareDensity_lower v hv (by positivity : (0:ℝ) < n+2) hm hm0 hm1 hd hmean hvar + have hstd := diagonalSquareDensity_standard_upper (n := n) + have hstdpos : 0 < diagonalSquareDensity (fun _ : Fin (n+2) => 1) (n+2) := + lt_of_lt_of_le (by positivity) (diagonalSquareDensity_standard_lower n) + have hratio : K ≤ diagonalSquareDensity v (n+2) / + diagonalSquareDensity (fun _ : Fin (n+2) => 1) (n+2) := by + apply (le_div_iff₀ hstdpos).mpr + have hh := mul_le_mul_of_nonneg_left hstd hK + dsimp only [K] at hh ⊢ + linarith + have hq' : ∀ i, (v i:ℝ)⁻¹ = z-1*lam i := by simpa only [one_mul] using hq + have hid := spherical_gaussian_identity hv hq' + simp only [Fintype.card_fin,Nat.cast_add,Nat.cast_ofNat] at hid + rw [hid] + have hz : (1:ℝ)*spectralTop lam < z := by + obtain ⟨i,hi⟩ := spectralTop_attained lam + have hp : 0 < (v i : ℝ)⁻¹ := inv_pos.mpr (NNReal.coe_pos.mpr (pos_iff_ne_zero.mpr (hv i))) + rw [hq i,hi] at hp + linarith + have hB := saddleObjective_min lam (by norm_num : (0:ℝ) ≤ 1) hz + rw [← sphericalVariational_eq lam (by norm_num : (0:ℝ) ≤ 1)] at hB + have hE := Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left hB (by positivity : (0:ℝ) ≤ n+2)) + have hh := mul_le_mul hratio hE (Real.exp_pos _).le (hK.trans hratio) + simpa only [K, _root_.mul_comm] using hh + +end + +lemma gaussianPairPrefactor_lower {a b : ℝ≥0} {c : ℝ} (hc : 0 < c) + (ha : a ≠ 0) (hb : b ≠ 0) (hac : (a:ℝ) ≤ c) (hbc : (b:ℝ) ≤ c) : + 1/(2*c) ≤ Real.pi*gaussianPairPrefactor a b := by + have hs : 0 < Real.sqrt (2*Real.pi*a)*Real.sqrt (2*Real.pi*b) := by + have hapos := NNReal.coe_pos.mpr (pos_iff_ne_zero.mpr ha) + have hbpos := NNReal.coe_pos.mpr (pos_iff_ne_zero.mpr hb) + positivity + have ht : Real.sqrt (2*Real.pi*a)*Real.sqrt (2*Real.pi*b) ≤ 2*Real.pi*c := by + have h1 := Real.sqrt_le_sqrt (mul_le_mul_of_nonneg_left hac (by positivity : 0 ≤ 2*Real.pi)) + have h2 := Real.sqrt_le_sqrt (mul_le_mul_of_nonneg_left hbc (by positivity : 0 ≤ 2*Real.pi)) + have hp := mul_le_mul h1 h2 (Real.sqrt_nonneg _) (Real.sqrt_nonneg _) + simpa only [← sq,Real.sq_sqrt (by positivity : 0 ≤ 2*Real.pi*c)] using hp + have h := mul_le_mul_of_nonneg_left (inv_anti₀ hs ht) Real.pi_pos.le + unfold gaussianPairPrefactor + convert h using 1; first | rfl | field_simp + +def fixedBulkDeficit {n : ℕ} (lam : Fin (n+2) → ℝ) (s : ℝ) : ℝ := + (n+2)-(∑ i : Fin n, (fixedEdgeVariance lam s i.succ.succ:ℝ)) + +lemma fixedBulkDeficit_bounds {n : ℕ} {lam : Fin (n+2) → ℝ} {h s : ℝ} + (hh : 0 ≤ h) (hs : 0 < s) (hs1 : s ≤ 1) + (hcost : traceCost (n+1) h s ≤ 1/100) (hlam : lam ∈ spectralGood (n+1) h s) + (hspace : 32768 ≤ (n+2:ℝ)*s*Real.sqrt s) : + 0 < fixedBulkDeficit lam s ∧ fixedBulkDeficit lam s/(1/(2*s)) ≤ 6*((n+2:ℝ)*s*Real.sqrt s) ∧ + 128*(∑ i : Fin n, (fixedEdgeVariance lam s i.succ.succ:ℝ)^2) ≤ (fixedBulkDeficit lam s)^2 := by + have hi := spectralGood_fixed_bulk hh hs hs1 hcost hlam hspace + change _ ≤ fixedBulkDeficit lam s ∧ fixedBulkDeficit lam s ≤ _ ∧ _ at hi + refine ⟨lt_of_lt_of_le (by positivity) hi.1,?_,hi.2.2⟩ + have ht := mul_le_mul_of_nonneg_right hi.2.1 (by positivity : 0 ≤ 2*s) + simpa only [div_div_eq_mul_div,div_one] using ht.trans_eq (show 3*(n+2:ℝ)*Real.sqrt s*(2*s) = 6*((n+2:ℝ)*s*Real.sqrt s) by ring) + +lemma spectralGood_sphere_moment {n : ℕ} {lam : Fin (n+2) → ℝ} {h s : ℝ} + (hh : 0 ≤ h) (hs : 0 < s) (hs1 : s ≤ 1) + (hcost : traceCost (n+1) h s ≤ 1/100) (hlam : lam ∈ spectralGood (n+1) h s) + (hspace : 32768 ≤ (n+2:ℝ)*s*Real.sqrt s) + (h0 : |lam 0-2| ≤ s/4) (h1 : |lam 1-2| ≤ s/4) (i : Fin (n+2)) : + (∫ u : unitSphere (Fin (n+2)), ((Real.sqrt (n+2) • u.val) i)^2 + ∂sphereTilted lam 1 (Real.sqrt (n+2))) ≤ + 16*Real.exp (6*((n+2:ℝ)*s*Real.sqrt s))*(fixedEdgeVariance lam s i:ℝ) := by + have hv := spectralGood_fixed_variance hh hs hs1 hcost hlam hspace + have hd := fixedBulkDeficit_bounds hh hs hs1 hcost hlam hspace + have hn : (0:ℝ) < n+2 := by positivity + have hm : 0 < (1:ℝ)/(2*s) := by positivity + have hz (j) : fixedEdgeVariance lam s j ≠ 0 := fixedEdgeVariance_pos hv.1 j + have hq (j) : (fixedEdgeVariance lam s j:ℝ)⁻¹ = 2+s-1*lam j := by + simpa only [one_mul] using fixedEdgeVariance_inverse hv.1 j + have hb := sphereTilted_coordinate_sq_upper_all lam 1 (2+s) (fixedEdgeVariance lam s) hz hq hn hm + (fixedEdgeVariance_lower hs hv.1 0 h0) (fixedEdgeVariance_lower hs hv.1 1 h1) hd.1 + (by unfold fixedBulkDeficit; ring) hd.2.2 i + apply hb.trans + have he := Real.exp_le_exp.mpr hd.2.1 + have hx := mul_le_mul_of_nonneg_left he (show 0 ≤ 16*(fixedEdgeVariance lam s i:ℝ) by positivity) + simpa only [mul_assoc,mul_comm,mul_left_comm] using hx + +lemma spectralGood_sphere_overlap {n : ℕ} {lam : Fin (n+2) → ℝ} {h s : ℝ} + (hh : 0 ≤ h) (hs : 0 < s) (hs1 : s ≤ 1) + (hcost : traceCost (n+1) h s ≤ 1/100) (hlam : lam ∈ spectralGood (n+1) h s) + (hspace : 32768 ≤ (n+2:ℝ)*s*Real.sqrt s) + (h0 : |lam 0-2| ≤ s/4) (h1 : |lam 1-2| ≤ s/4) : + (∫ p : unitSphere (Fin (n+2)) × unitSphere (Fin (n+2)), + (inner ℝ (Real.sqrt (n+2) • p.1.val) (Real.sqrt (n+2) • p.2.val))^2 + ∂((sphereTilted lam 1 (Real.sqrt (n+2))).prod (sphereTilted lam 1 (Real.sqrt (n+2))))) ≤ + (16*Real.exp (6*((n+2:ℝ)*s*Real.sqrt s)))^2*(16*(n+2)/Real.sqrt s) := by + exact (sphereTilted_overlap_bound lam 1 (Real.sqrt (n+2)) _ _ + (spectralGood_sphere_moment hh hs hs1 hcost hlam hspace h0 h1)).trans + (mul_le_mul_of_nonneg_left (spectralGood_fixed_variance hh hs hs1 hcost hlam hspace).2.2.2 + (sq_nonneg _)) + +lemma spectralGood_sphere_partition_lower {n : ℕ} {lam : Fin (n+2) → ℝ} {h s : ℝ} + (hh : 0 ≤ h) (hs : 0 < s) (hs1 : s ≤ 1) + (hcost : traceCost (n+1) h s ≤ 1/100) (hlam : lam ∈ spectralGood (n+1) h s) + (hspace : 32768 ≤ (n+2:ℝ)*s*Real.sqrt s) + (h0 : |lam 0-2| ≤ s/4) (h1 : |lam 1-2| ≤ s/4) : + (s/4)*Real.exp (-6*((n+2:ℝ)*s*Real.sqrt s))* + Real.exp ((n+2)*sphericalVariational lam 1) ≤ spherePartition lam 1 (Real.sqrt (n+2)) := by + have hv := spectralGood_fixed_variance hh hs hs1 hcost hlam hspace + have hd := fixedBulkDeficit_bounds hh hs hs1 hcost hlam hspace + have hz (j) : fixedEdgeVariance lam s j ≠ 0 := fixedEdgeVariance_pos hv.1 j + have hb := spherePartition_fixed_lower (n := n) lam (fixedEdgeVariance lam s) hz + (fixedEdgeVariance_inverse hv.1) (by positivity : 0 < (1:ℝ)/(2*s)) + (fixedEdgeVariance_lower hs hv.1 0 h0) (fixedEdgeVariance_lower hs hv.1 1 h1) hd.1 + (by unfold fixedBulkDeficit; ring) hd.2.2 + apply le_trans _ hb + apply mul_le_mul_of_nonneg_right _ (Real.exp_pos _).le + have hc : s/4 ≤ Real.pi*gaussianPairPrefactor (fixedEdgeVariance lam s 0) (fixedEdgeVariance lam s 1) := by + have hp := gaussianPairPrefactor_lower (by positivity : 0 < 2/s) (hz 0) (hz 1) (hv.2.1 0) (hv.2.1 1) + convert hp using 1 + field_simp + ring + apply mul_le_mul hc _ (Real.exp_pos _).le ((by positivity : (0:ℝ) ≤ s/4).trans hc) + apply Real.exp_le_exp.mpr + linarith [hd.2.1] + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/PathEnergy.lean b/lean/OAI/MathematicalPhysics/CriticalSK/PathEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..be962fb177529193c8b663fad14fe2504f15c49a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/PathEnergy.lean @@ -0,0 +1,272 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open MeasureTheory ProbabilityTheory + +open scoped ENNReal NNReal + +open scoped BigOperators InnerProductSpace + +open Module + +open scoped BigOperators ENNReal NNReal Real Topology + +open MeasureTheory ProbabilityTheory Filter + +open scoped BigOperators NNReal + +open scoped BigOperators + +namespace CriticalSK + +def edgeCoeff (n i : ℕ) : ℝ := Real.sqrt (1 - (i + 1 : ℝ) / (n + 1)) + +def pathEnergy (n : ℕ) (u : ℕ → ℝ) : ℝ := + 2 * ∑ i ∈ Finset.range (n + 1), u i ^ 2 - + 2 * ∑ i ∈ Finset.range n, edgeCoeff n i * u i * u (i + 1) + +lemma path_energy_identity (n : ℕ) (c u : ℕ → ℝ) (hc : c n = 0) : + 2 * (∑ i ∈ Finset.range (n + 1), u i ^ 2) - + 2 * (∑ i ∈ Finset.range n, c i * u i * u (i + 1)) = + (∑ i ∈ Finset.range n, c i * (u (i + 1) - u i) ^ 2) + + ∑ i ∈ Finset.range (n + 1), + (2 - c i - if i = 0 then 0 else c (i - 1)) * u i ^ 2 := by + have hl : (∑ i ∈ Finset.range (n + 1), + (if i = 0 then (0 : ℝ) else c (i - 1)) * u i ^ 2) = + ∑ i ∈ Finset.range n, c i * u (i + 1) ^ 2 := by + rw [Finset.sum_range_succ'] + simp + have hr : (∑ i ∈ Finset.range (n + 1), c i * u i ^ 2) = + ∑ i ∈ Finset.range n, c i * u i ^ 2 := by + rw [Finset.sum_range_succ, hc, zero_mul, add_zero] + have hg : (∑ i ∈ Finset.range n, c i * (u (i + 1) - u i) ^ 2) = + (∑ i ∈ Finset.range n, c i * u i ^ 2) + + (∑ i ∈ Finset.range n, c i * u (i + 1) ^ 2) - + 2 * ∑ i ∈ Finset.range n, c i * u i * u (i + 1) := by + rw [Finset.mul_sum, ← Finset.sum_add_distrib, ← Finset.sum_sub_distrib] + apply Finset.sum_congr rfl + intro i _ + ring + simp only [sub_mul, Finset.sum_sub_distrib, ← Finset.mul_sum] + rw [hl, hr, hg] + ring + +lemma edgeCoeff_nonneg (n i : ℕ) : 0 ≤ edgeCoeff n i := Real.sqrt_nonneg _ + +lemma edgeCoeff_last (n : ℕ) : edgeCoeff n n = 0 := by + simp [edgeCoeff, show (n + 1 : ℝ) ≠ 0 by positivity] + +lemma edgeCoeff_upper (n i : ℕ) (hi : i ≤ n) : + edgeCoeff n i ≤ 1 - (i + 1 : ℝ) / (2 * (n + 1)) := by + have hn : (0 : ℝ) < n + 1 := by positivity + have hit : (i + 1 : ℝ) ≤ n + 1 := by exact_mod_cast Nat.succ_le_succ hi + have ht : 0 ≤ (i + 1 : ℝ) / (n + 1) := by positivity + have ht1 : (i + 1 : ℝ) / (n + 1) ≤ 1 := (div_le_one hn).mpr hit + have hs := Real.sq_sqrt (by linarith : 0 ≤ 1 - (i + 1 : ℝ) / (n + 1)) + have hd : (i + 1 : ℝ) / (2 * (n + 1)) = ((i + 1 : ℝ) / (n + 1)) / 2 := by rw [div_div]; ring + dsimp [edgeCoeff] + rw [hd] + nlinarith [Real.sqrt_nonneg (1 - (i + 1 : ℝ) / (n + 1)), + sq_nonneg ((i + 1 : ℝ) / (n + 1))] + +lemma edgeCoeff_le_one (n i : ℕ) (hi : i ≤ n) : edgeCoeff n i ≤ 1 := + (edgeCoeff_upper n i hi).trans (sub_le_self _ (by positivity)) + +lemma edge_deficit (n i : ℕ) (hi : i ≤ n) : + (i + 1 : ℝ) / (2 * (n + 1)) ≤ + 2 - edgeCoeff n i - if i = 0 then 0 else edgeCoeff n (i - 1) := by + have h := edgeCoeff_upper n i hi + split_ifs with hi0 + · linarith + · have hprev := edgeCoeff_le_one n (i - 1) (by omega) + linarith + +lemma pathEnergy_expansion (n : ℕ) (u : ℕ → ℝ) : + pathEnergy n u = + (∑ i ∈ Finset.range n, edgeCoeff n i * (u (i + 1) - u i) ^ 2) + + ∑ i ∈ Finset.range (n + 1), + (2 - edgeCoeff n i - if i = 0 then 0 else edgeCoeff n (i - 1)) * u i ^ 2 := + path_energy_identity n (edgeCoeff n) u (edgeCoeff_last n) + +lemma pathEnergy_controls (n : ℕ) (u : ℕ → ℝ) : + (∑ i ∈ Finset.range n, edgeCoeff n i * (u (i + 1) - u i) ^ 2) + + (∑ i ∈ Finset.range (n + 1), (i + 1 : ℝ) / (2 * (n + 1)) * u i ^ 2) ≤ + pathEnergy n u := by + rw [pathEnergy_expansion] + gcongr with i hi + exact edge_deficit n i (by simpa using Nat.le_of_lt_succ (Finset.mem_range.mp hi)) + +lemma pathEnergy_nonneg (n : ℕ) (u : ℕ → ℝ) : 0 ≤ pathEnergy n u := + (by + unfold edgeCoeff + positivity : 0 ≤ + (∑ i ∈ Finset.range n, edgeCoeff n i * (u (i + 1) - u i) ^ 2) + + (∑ i ∈ Finset.range (n + 1), (i + 1 : ℝ) / (2 * (n + 1)) * u i ^ 2)).trans + (pathEnergy_controls n u) + +lemma pathEnergy_weighted_mass (n : ℕ) (u : ℕ → ℝ) : + (∑ i ∈ Finset.range (n + 1), (i + 1 : ℝ) / (n + 1) * u i ^ 2) ≤ + 2 * pathEnergy n u := by + have h := pathEnergy_controls n u + have hg : 0 ≤ ∑ i ∈ Finset.range n, edgeCoeff n i * (u (i + 1) - u i) ^ 2 := by + unfold edgeCoeff + positivity + have hs : (∑ i ∈ Finset.range (n + 1), (i + 1 : ℝ) / (n + 1) * u i ^ 2) = + 2 * ∑ i ∈ Finset.range (n + 1), (i + 1 : ℝ) / (2 * (n + 1)) * u i ^ 2 := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + field_simp + rw [hs] + linarith + +lemma pathEnergy_weighted_gradient (n : ℕ) (u : ℕ → ℝ) : + (∑ i ∈ Finset.range n, edgeCoeff n i * (u (i + 1) - u i) ^ 2) ≤ + pathEnergy n u := by + have h := pathEnergy_controls n u + have hp : 0 ≤ ∑ i ∈ Finset.range (n + 1), + (i + 1 : ℝ) / (2 * (n + 1)) * u i ^ 2 := by positivity + linarith + +lemma pathEnergy_tail (n : ℕ) (u : ℕ → ℝ) (s : Finset ℕ) + (hs : s ⊆ Finset.range (n + 1)) (r : ℝ) + (hr : ∀ i ∈ s, r ≤ (i + 1 : ℝ) / (n + 1)) : + r * (∑ i ∈ s, u i ^ 2) ≤ 2 * pathEnergy n u := by + calc + _ = ∑ i ∈ s, r * u i ^ 2 := Finset.mul_sum .. + _ ≤ ∑ i ∈ s, (i + 1 : ℝ) / (n + 1) * u i ^ 2 := by + gcongr with i hi + exact hr i hi + _ ≤ ∑ i ∈ Finset.range (n + 1), (i + 1 : ℝ) / (n + 1) * u i ^ 2 := by + apply Finset.sum_le_sum_of_subset_of_nonneg hs + intros + positivity + _ ≤ _ := pathEnergy_weighted_mass n u + +lemma edgeCoeff_lower_half (n i : ℕ) (hi : 2 * (i + 1) ≤ n + 1) : + 1 / 2 ≤ edgeCoeff n i := by + have hn : (0 : ℝ) < n + 1 := by positivity + have hi' : 2 * (i + 1 : ℝ) ≤ n + 1 := by exact_mod_cast hi + have ht : (i + 1 : ℝ) / (n + 1) ≤ 1 / 2 := by + apply (div_le_iff₀ hn).mpr + linarith + have hs := Real.sq_sqrt (by linarith : 0 ≤ 1 - (i + 1 : ℝ) / (n + 1)) + have hp := edgeCoeff_nonneg n i + dsimp [edgeCoeff] at * + nlinarith + +lemma edge_gradient_control (n i : ℕ) (u : ℕ → ℝ) : + (u (i + 1) - u i) ^ 2 ≤ + 2 * edgeCoeff n i * (u (i + 1) - u i) ^ 2 + + 4 * ((i + 1 : ℝ) / (n + 1) * u i ^ 2 + + (i + 2 : ℝ) / (n + 1) * u (i + 1) ^ 2) := by + by_cases hi : 2 * (i + 1) ≤ n + 1 + · have hc := edgeCoeff_lower_half n i hi + have hm : 0 ≤ (i + 1 : ℝ) / (n + 1) * u i ^ 2 + + (i + 2 : ℝ) / (n + 1) * u (i + 1) ^ 2 := by positivity + nlinarith [sq_nonneg (u (i + 1) - u i)] + · have hi' : (n + 1 : ℝ) ≤ 2 * (i + 1) := by exact_mod_cast (by omega : n + 1 ≤ 2 * (i + 1)) + have hn : (0 : ℝ) < n + 1 := by positivity + have h1 : 1 / 2 ≤ (i + 1 : ℝ) / (n + 1) := by + apply (le_div_iff₀ hn).mpr + linarith + have h2 : 1 / 2 ≤ (i + 2 : ℝ) / (n + 1) := by + apply (le_div_iff₀ hn).mpr + linarith + have hm1 := mul_le_mul_of_nonneg_right h1 (sq_nonneg (u i)) + have hm2 := mul_le_mul_of_nonneg_right h2 (sq_nonneg (u (i + 1))) + have hg : 0 ≤ edgeCoeff n i * (u (i + 1) - u i) ^ 2 := + mul_nonneg (edgeCoeff_nonneg n i) (sq_nonneg _) + nlinarith [sq_nonneg (u i + u (i + 1))] + +lemma pathEnergy_gradient (n : ℕ) (u : ℕ → ℝ) : + (∑ i ∈ Finset.range n, (u (i + 1) - u i) ^ 2) ≤ 18 * pathEnergy n u := by + let mass : ℕ → ℝ := fun i => (i + 1 : ℝ) / (n + 1) * u i ^ 2 + have hm0 : ∀ i, 0 ≤ mass i := by intro i; dsimp [mass]; positivity + have hm1 : (∑ i ∈ Finset.range n, mass i) ≤ ∑ i ∈ Finset.range (n + 1), mass i := by + rw [Finset.sum_range_succ] + linarith [hm0 n] + have hm2 : (∑ i ∈ Finset.range n, mass (i + 1)) ≤ ∑ i ∈ Finset.range (n + 1), mass i := by + rw [Finset.sum_range_succ'] + linarith [hm0 0] + have hm := pathEnergy_weighted_mass n u + change (∑ i ∈ Finset.range (n + 1), mass i) ≤ _ at hm + have hg := pathEnergy_weighted_gradient n u + calc + _ ≤ ∑ i ∈ Finset.range n, + (2 * edgeCoeff n i * (u (i + 1) - u i) ^ 2 + 4 * (mass i + mass (i + 1))) := by + apply Finset.sum_le_sum + intro i _ + simpa [mass, Nat.cast_add, Nat.cast_one, add_assoc, one_add_one_eq_two] using edge_gradient_control n i u + _ = 2 * (∑ i ∈ Finset.range n, edgeCoeff n i * (u (i + 1) - u i) ^ 2) + + 4 * ((∑ i ∈ Finset.range n, mass i) + (∑ i ∈ Finset.range n, mass (i + 1))) := by + simp only [mul_assoc, Finset.sum_add_distrib, ← Finset.mul_sum] + _ ≤ _ := by linarith + +lemma square_weight_variation (s : Finset ℕ) (u : ℕ → ℝ) : + (∑ i ∈ s, |u (i + 1) ^ 2 - u i ^ 2|) ^ 2 ≤ + (∑ i ∈ s, (u (i + 1) - u i) ^ 2) * + (2 * ∑ i ∈ s, (u i ^ 2 + u (i + 1) ^ 2)) := by + have h := Finset.sum_sq_le_sum_mul_sum_of_sq_le_mul s + (r := fun i => |u (i + 1) ^ 2 - u i ^ 2|) + (f := fun i => (u (i + 1) - u i) ^ 2) + (g := fun i => 2 * (u i ^ 2 + u (i + 1) ^ 2)) + (fun _ _ => sq_nonneg _) (by intros; positivity) ?_ + · simpa only [← Finset.mul_sum] using h + · intro i _ + rw [sq_abs] + have h := sq_nonneg (u (i + 1) - u i) + nlinarith [sq_nonneg ((u (i + 1) - u i) ^ 2)] + +lemma product_weight_variation (s : Finset ℕ) (u : ℕ → ℝ) : + (∑ i ∈ s, |u (i + 1) * u (i + 2) - u i * u (i + 1)|) ^ 2 ≤ + (2 * ∑ i ∈ s, ((u (i + 1) - u i) ^ 2 + (u (i + 2) - u (i + 1)) ^ 2)) * + (∑ i ∈ s, u (i + 1) ^ 2) := by + have h := Finset.sum_sq_le_sum_mul_sum_of_sq_le_mul s + (r := fun i => |u (i + 1) * u (i + 2) - u i * u (i + 1)|) + (f := fun i => 2 * ((u (i + 1) - u i) ^ 2 + (u (i + 2) - u (i + 1)) ^ 2)) + (g := fun i => u (i + 1) ^ 2) + (by intros; positivity) (fun _ _ => sq_nonneg _) ?_ + · simpa only [← Finset.mul_sum] using h + · intro i _ + rw [sq_abs] + have he : (u (i + 1) * u (i + 2) - u i * u (i + 1)) ^ 2 = + (u (i + 2) - u i) ^ 2 * u (i + 1) ^ 2 := by ring + rw [he] + apply mul_le_mul_of_nonneg_right _ (sq_nonneg _) + nlinarith [sq_nonneg (u (i + 2) - 2 * u (i + 1) + u i)] + +lemma pathEnergy_le_four_mass (n : ℕ) (u : ℕ → ℝ) : + pathEnergy n u ≤ 4 * ∑ i ∈ Finset.range (n + 1), u i ^ 2 := by + have hm1 : (∑ i ∈ Finset.range n, u i ^ 2) ≤ ∑ i ∈ Finset.range (n + 1), u i ^ 2 := by + rw [Finset.sum_range_succ] + linarith [sq_nonneg (u n)] + have hm2 : (∑ i ∈ Finset.range n, u (i + 1) ^ 2) ≤ ∑ i ∈ Finset.range (n + 1), u i ^ 2 := by + rw [Finset.sum_range_succ'] + linarith [sq_nonneg (u 0)] + have he : -2 * (∑ i ∈ Finset.range n, edgeCoeff n i * u i * u (i + 1)) ≤ + (∑ i ∈ Finset.range n, u i ^ 2) + (∑ i ∈ Finset.range n, u (i + 1) ^ 2) := by + rw [Finset.mul_sum, ← Finset.sum_add_distrib] + apply Finset.sum_le_sum + intro i hi + have hci := edgeCoeff_le_one n i (Nat.le_of_lt (Finset.mem_range.mp hi)) + have hcn := edgeCoeff_nonneg n i + have hprod : -2 * u i * u (i + 1) ≤ u i ^ 2 + u (i + 1) ^ 2 := by + nlinarith [sq_nonneg (u i + u (i + 1))] + have hmul := mul_le_mul_of_nonneg_left hprod hcn + have hmass := mul_le_mul_of_nonneg_right hci + (add_nonneg (sq_nonneg (u i)) (sq_nonneg (u (i + 1)))) + nlinarith + unfold pathEnergy + linarith + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/PathSpectra.lean b/lean/OAI/MathematicalPhysics/CriticalSK/PathSpectra.lean new file mode 100644 index 0000000000000000000000000000000000000000..1b5a7eb713d92777c7c5dc9e6614d5c31c386f60 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/PathSpectra.lean @@ -0,0 +1,1028 @@ +import OAI.MathematicalPhysics.CriticalSK.MinMax +import OAI.MathematicalPhysics.CriticalSK.PathEnergy + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open MeasureTheory ProbabilityTheory + +open scoped ENNReal NNReal + +open scoped BigOperators InnerProductSpace + +open Module + +open scoped BigOperators ENNReal NNReal Real Topology + +open MeasureTheory ProbabilityTheory Filter + +open scoped BigOperators NNReal + +open scoped BigOperators + +open Matrix Polynomial +open scoped BigOperators Topology +open Filter +namespace CriticalSK + +def edgeTent (m b i : ℕ) : ℝ := (min (min (i - b) m) (4 * m - (i - b)) : ℕ) + +lemma edgeTent_nonneg (m b i : ℕ) : 0 ≤ edgeTent m b i := by unfold edgeTent; positivity + +lemma edgeTent_le (m b i : ℕ) : edgeTent m b i ≤ m := by + unfold edgeTent + exact_mod_cast (min_le_left _ _).trans (min_le_right _ _) + +lemma edgeTent_zero_left {m b i : ℕ} (hi : i ≤ b) : edgeTent m b i = 0 := by + simp [edgeTent, Nat.sub_eq_zero_of_le hi] + +lemma edgeTent_zero_right {m b i : ℕ} (hi : b + 4*m ≤ i) : edgeTent m b i = 0 := by + have h : 4*m ≤ i-b := by omega + simp [edgeTent, Nat.sub_eq_zero_of_le h] + +lemma edgeTent_plateau {m b i : ℕ} (hlo : b+m ≤ i) (hhi : i ≤ b+3*m) : + edgeTent m b i = m := by + have h1 : m ≤ i-b := by omega + have h2 : m ≤ 4*m-(i-b) := by omega + simp [edgeTent, min_eq_right h1, min_eq_left h2] + +lemma edgeTent_lipschitz (m b i : ℕ) : |edgeTent m b (i+1) - edgeTent m b i| ≤ 1 := by + unfold edgeTent + rw [abs_le] + have h1 : min (min (i+1-b) m) (4*m-(i+1-b)) ≤ min (min (i-b) m) (4*m-(i-b)) + 1 := by omega + have h2 : min (min (i-b) m) (4*m-(i-b)) ≤ min (min (i+1-b) m) (4*m-(i+1-b)) + 1 := by omega + have hh1 : ((min (min (i+1-b) m) (4*m-(i+1-b)) : ℕ) : ℝ) ≤ ((min (min (i-b) m) (4*m-(i-b)) : ℕ) : ℝ) + 1 := by exact_mod_cast h1 + have hh2 : ((min (min (i-b) m) (4*m-(i-b)) : ℕ) : ℝ) ≤ ((min (min (i+1-b) m) (4*m-(i+1-b)) : ℕ) : ℝ) + 1 := by exact_mod_cast h2 + constructor <;> linarith + +lemma edgeTent_gradient_support {m b i : ℕ} (hi : i ∉ Finset.Ico b (b+4*m)) : + edgeTent m b (i+1) - edgeTent m b i = 0 := by + simp only [Finset.mem_Ico, not_and_or, not_le, not_lt] at hi + rcases hi with hi | hi + · rw [edgeTent_zero_left (by omega), edgeTent_zero_left (by omega), sub_self] + · rw [edgeTent_zero_right (by omega), edgeTent_zero_right hi, sub_self] + +lemma edgeTent_gradient (m b n : ℕ) : + (∑ i ∈ Finset.range n, (edgeTent m b (i+1) - edgeTent m b i)^2) ≤ 4 * m := by + have hpoint (i : ℕ) : (edgeTent m b (i+1) - edgeTent m b i)^2 ≤ + if i ∈ Finset.Ico b (b+4*m) then (1 : ℝ) else 0 := by + split_ifs with hi + · have h := edgeTent_lipschitz m b i + nlinarith [sq_abs (edgeTent m b (i+1) - edgeTent m b i), abs_nonneg (edgeTent m b (i+1) - edgeTent m b i)] + · rw [edgeTent_gradient_support hi]; norm_num + calc + _ ≤ ∑ i ∈ Finset.range n, if i ∈ Finset.Ico b (b+4*m) then (1 : ℝ) else 0 := + Finset.sum_le_sum (fun i _ => hpoint i) + _ ≤ ∑ i ∈ Finset.Ico b (b+4*m), (1 : ℝ) := by + rw [← Finset.sum_filter] + apply Finset.sum_le_sum_of_subset_of_nonneg + · intro i hi; exact (Finset.mem_filter.mp hi).2 + · intros; positivity + _ = 4*m := by simp + +lemma edgeTent_mass {m b n : ℕ} (hfit : b+2*m ≤ n+1) : + (m : ℝ)^3 ≤ ∑ i ∈ Finset.range (n+1), edgeTent m b i ^ 2 := by + calc + (m : ℝ)^3 = ∑ i ∈ Finset.Ico (b+m) (b+2*m), (m : ℝ)^2 := by + have h : b+2*m-(b+m) = m := by omega + simp only [Finset.sum_const, Nat.card_Ico, h, nsmul_eq_mul] + ring + _ = ∑ i ∈ Finset.Ico (b+m) (b+2*m), edgeTent m b i ^ 2 := by + apply Finset.sum_congr rfl + intro i hi + rw [edgeTent_plateau (Finset.mem_Ico.mp hi).1 (by have := (Finset.mem_Ico.mp hi).2; omega)] + _ ≤ ∑ i ∈ Finset.range (n+1), edgeTent m b i ^ 2 := by + apply Finset.sum_le_sum_of_subset_of_nonneg + · intro i hi + simp only [Finset.mem_range] + have := (Finset.mem_Ico.mp hi).2 + omega + · intros; positivity + +lemma edgeCoeff_lower (n i : ℕ) (hi : i ≤ n) : + 1 - (i+1 : ℝ)/(n+1) ≤ edgeCoeff n i := by + have hn : (0 : ℝ) < n+1 := by positivity + have ht : (i+1 : ℝ) ≤ n+1 := by exact_mod_cast Nat.succ_le_succ hi + have h0 : 0 ≤ 1 - (i+1 : ℝ)/(n+1) := sub_nonneg.mpr ((div_le_one hn).mpr ht) + have h1 : 1 - (i+1 : ℝ)/(n+1) ≤ 1 := sub_le_self _ (by positivity) + dsimp [edgeCoeff] + have hs := Real.sq_sqrt h0 + nlinarith [Real.sqrt_nonneg (1 - (i+1 : ℝ)/(n+1)), mul_nonneg h0 (sub_nonneg.mpr h1)] + +lemma edge_potential_upper {n i : ℕ} (hi : i ≤ n) (hi0 : i ≠ 0) : + 2 - edgeCoeff n i - edgeCoeff n (i-1) ≤ 2*(i+1 : ℝ)/(n+1) := by + have h1 := edgeCoeff_lower n i hi + have h2 := edgeCoeff_lower n (i-1) (by omega) + have h3 : (i-1+1 : ℕ) = i := by omega + have h4 : ((i-1 : ℕ) : ℝ) + 1 = i := by exact_mod_cast h3 + have h5 : (i : ℝ)/(n+1) ≤ (i+1 : ℝ)/(n+1) := by gcongr; linarith + rw [h4] at h2 + rw [mul_div_assoc] + linarith + +lemma edgeTent_energy {m b n : ℕ} (_hfit : b+4*m ≤ n) : + pathEnergy n (edgeTent m b) ≤ 4*m + (2*(b+4*m+1 : ℝ)/(n+1)) * + (∑ i ∈ Finset.range (n+1), edgeTent m b i ^ 2) := by + rw [pathEnergy_expansion] + apply add_le_add + · calc + _ ≤ ∑ i ∈ Finset.range n, (edgeTent m b (i+1)-edgeTent m b i)^2 := by + apply Finset.sum_le_sum + intro i hi + exact mul_le_of_le_one_left (sq_nonneg _) (edgeCoeff_le_one n i (by have := Finset.mem_range.mp hi; omega)) + _ ≤ 4*m := edgeTent_gradient m b n + · rw [Finset.mul_sum] + apply Finset.sum_le_sum + intro i hi + by_cases hi0 : i = 0 + · subst i; rw [edgeTent_zero_left (by omega)]; simp + · simp only [ite_eq_right hi0] + by_cases hit : b+4*m ≤ i + · rw [edgeTent_zero_right hit]; simp + · apply mul_le_mul_of_nonneg_right _ (sq_nonneg _) + apply (edge_potential_upper (by have := Finset.mem_range.mp hi; omega) hi0).trans + gcongr + exact_mod_cast (show i ≤ b+4*m by omega) + +lemma edgeTent_mul_zero {m b d i : ℕ} (hgap : b+4*m ≤ d) : + edgeTent m b i * edgeTent m d i = 0 := by + by_cases h : i ≤ d + · rw [edgeTent_zero_left h, mul_zero] + · rw [edgeTent_zero_right (by omega), zero_mul] + +lemma edgeTent_adj_mul_zero {m b d i : ℕ} (hgap : b+4*m ≤ d) : + edgeTent m b i * edgeTent m d (i+1) = 0 := by + by_cases h : i+1 ≤ d + · rw [edgeTent_zero_left h, mul_zero] + · rw [edgeTent_zero_right (by omega), zero_mul] + +lemma edgeTent_adj_mul_zero' {m b d i : ℕ} (hgap : b+4*m ≤ d) : + edgeTent m d i * edgeTent m b (i+1) = 0 := by + by_cases h : i ≤ d + · rw [edgeTent_zero_left h, zero_mul] + · rw [edgeTent_zero_right (m := m) (b := b) (i := i+1) (by omega), mul_zero] + +lemma separated_tents {m k l i : ℕ} (hkl : k ≠ l) : + edgeTent m (4*m*k) i * edgeTent m (4*m*l) i = 0 := by + rcases lt_or_gt_of_ne hkl with h | h + · apply edgeTent_mul_zero + nlinarith + · rw [mul_comm] + apply edgeTent_mul_zero + nlinarith + +lemma separated_tents_adj {m k l i : ℕ} (hkl : k ≠ l) : + edgeTent m (4*m*k) i * edgeTent m (4*m*l) (i+1) = 0 := by + rcases lt_or_gt_of_ne hkl with h | h + · apply edgeTent_adj_mul_zero + nlinarith + · apply edgeTent_adj_mul_zero' + nlinarith + +lemma sum_mul_diagonal {ι : Type*} [Fintype ι] (u v c : ι → ℝ) + (huv : ∀ i j, i ≠ j → u i * v j = 0) : + (∑ i, c i * u i) * (∑ i, c i * v i) = ∑ i, c i ^ 2 * u i * v i := by + classical + rw [Finset.sum_mul] + apply Finset.sum_congr rfl + intro i _ + rw [Finset.mul_sum, Finset.sum_eq_single i] + · ring + · intro j _ hji + calc + _ = (c i * c j) * (u i * v j) := by ring + _ = 0 := by rw [huv i j hji.symm, mul_zero] + · simp + +def tentCombination {r : ℕ} (m : ℕ) (c : Fin r → ℝ) (i : ℕ) : ℝ := + ∑ k, c k * edgeTent m (4*m*k.val) i + +lemma tentCombination_sq {r : ℕ} (m : ℕ) (c : Fin r → ℝ) (i : ℕ) : + tentCombination m c i ^ 2 = ∑ k, c k ^ 2 * edgeTent m (4*m*k.val) i ^ 2 := by + rw [sq, tentCombination, sum_mul_diagonal] + · apply Finset.sum_congr rfl + intros + ring + · intro k l hkl + exact separated_tents (fun h => hkl (Fin.ext h)) + +lemma tentCombination_adj {r : ℕ} (m : ℕ) (c : Fin r → ℝ) (i : ℕ) : + tentCombination m c i * tentCombination m c (i+1) = + ∑ k, c k ^ 2 * edgeTent m (4*m*k.val) i * edgeTent m (4*m*k.val) (i+1) := by + exact sum_mul_diagonal _ _ _ (fun k l hkl => separated_tents_adj (fun h => hkl (Fin.ext h))) + +lemma tentCombination_mass {r : ℕ} (m n : ℕ) (c : Fin r → ℝ) : + (∑ i ∈ Finset.range (n+1), tentCombination m c i ^ 2) = + ∑ k, c k ^ 2 * ∑ i ∈ Finset.range (n+1), edgeTent m (4*m*k.val) i ^ 2 := by + simp only [tentCombination_sq, Finset.mul_sum] + rw [Finset.sum_comm] + +lemma tentCombination_energy {r : ℕ} (m n : ℕ) (c : Fin r → ℝ) : + pathEnergy n (tentCombination m c) = + ∑ k, c k ^ 2 * pathEnergy n (edgeTent m (4*m*k.val)) := by + simp only [pathEnergy, tentCombination_sq, tentCombination_adj, + mul_assoc, mul_sub, Finset.mul_sum, Finset.sum_sub_distrib] + rw [Finset.sum_comm (s := Finset.range (n+1)), Finset.sum_comm (s := Finset.range n)] + congr 1 <;> apply Finset.sum_congr rfl <;> intro k _ + · apply Finset.sum_congr rfl + intros + ring + · apply Finset.sum_congr rfl + intros + ring + +lemma edgeTent_rayleigh {m b n : ℕ} (hm : 0 < m) (hfit : b+4*m ≤ n) : + pathEnergy n (edgeTent m b) ≤ + (4/(m : ℝ)^2 + 2*(b+4*m+1 : ℝ)/(n+1)) * + ∑ i ∈ Finset.range (n+1), edgeTent m b i ^ 2 := by + have hmR : (0 : ℝ) < m := by exact_mod_cast hm + have hmass := edgeTent_mass (m := m) (b := b) (n := n) (by omega) + have h := mul_le_mul_of_nonneg_left hmass (show 0 ≤ 4/(m : ℝ)^2 by positivity) + have he : 4/(m : ℝ)^2 * (m : ℝ)^3 = 4*m := by field_simp + rw [he] at h + have henergy := edgeTent_energy hfit + nlinarith + +lemma tentCombination_rayleigh {m n r : ℕ} (hm : 0 < m) (hfit : 4*m*r ≤ n) + (c : Fin r → ℝ) : + pathEnergy n (tentCombination m c) ≤ + (4/(m : ℝ)^2 + 2*(4*m*r+1 : ℝ)/(n+1)) * + ∑ i ∈ Finset.range (n+1), tentCombination m c i ^ 2 := by + rw [tentCombination_mass, tentCombination_energy, Finset.mul_sum] + apply Finset.sum_le_sum + intro k _ + have hk : 4*m*k.val+4*m ≤ 4*m*r := by nlinarith [k.isLt] + have h := edgeTent_rayleigh hm (hk.trans hfit) + have h' : 4/(m : ℝ)^2 + 2*(4*m*k.val+4*m+1 : ℝ)/(n+1) ≤ + 4/(m : ℝ)^2 + 2*(4*m*r+1 : ℝ)/(n+1) := by + gcongr + exact_mod_cast (by nlinarith [k.isLt] : 4*m*k.val+4*m ≤ 4*m*r) + push_cast at h + have hmass : 0 ≤ ∑ i ∈ Finset.range (n+1), edgeTent m (4*m*k.val) i ^ 2 := by positivity + have hbound := h.trans (mul_le_mul_of_nonneg_right h' hmass) + have hscaled := mul_le_mul_of_nonneg_left hbound (sq_nonneg (c k)) + convert hscaled using 1 + ring + +lemma tentCombination_probe {m r : ℕ} (c : Fin r → ℝ) (k : Fin r) : + tentCombination m c (4*m*k.val+m) = c k * m := by + classical + rw [tentCombination, Finset.sum_eq_single k] + · rw [edgeTent_plateau (by omega) (by omega)] + · intro l _ hlk + by_cases hm : m = 0 + · subst m + simp [edgeTent] + have h := separated_tents (m := m) (i := 4*m*k.val+m) + (show l.val ≠ k.val from fun h => hlk (Fin.ext h)) + rw [edgeTent_plateau (m := m) (b := 4*m*k.val) (i := 4*m*k.val+m) (by omega) (by omega)] at h + have hz : edgeTent m (4*m*l.val) (4*m*k.val+m) = 0 := + (mul_eq_zero.mp h).resolve_right (by exact_mod_cast hm) + rw [hz, mul_zero] + · simp + +def tentMap (m n r : ℕ) : (Fin r → ℝ) →ₗ[ℝ] EuclideanSpace ℝ (Fin (n+1)) where + toFun c := WithLp.toLp 2 (fun i => tentCombination m c i.val) + map_add' c d := by + ext i + simp only [tentCombination, Pi.add_apply, PiLp.add_apply, + add_mul, Finset.sum_add_distrib] + map_smul' a c := by + ext i + simp only [tentCombination, Pi.smul_apply, smul_eq_mul, + PiLp.smul_apply, RingHom.id_apply, mul_assoc, Finset.mul_sum] + +lemma tentMap_injective {m n r : ℕ} (hm : 0 < m) (hfit : 4*m*r ≤ n) : + Function.Injective (tentMap m n r) := by + intro c d h + funext k + have hidx : 4*m*k.val+m < n+1 := by nlinarith [k.isLt] + have he := congrArg (fun u : EuclideanSpace ℝ (Fin (n+1)) => + u ⟨4*m*k.val+m, hidx⟩) h + change tentCombination m c (4*m*k.val+m) = tentCombination m d (4*m*k.val+m) at he + rw [tentCombination_probe, tentCombination_probe] at he + exact mul_right_cancel₀ (by exact_mod_cast (Nat.ne_of_gt hm)) he + +lemma tentMap_rank {m n r : ℕ} (hm : 0 < m) (hfit : 4*m*r ≤ n) : + finrank ℝ (LinearMap.range (tentMap m n r)) = r := by + rw [← LinearEquiv.finrank_eq (LinearEquiv.ofInjective _ (tentMap_injective hm hfit))] + simp + +lemma tentMap_mass (m n r : ℕ) (c : Fin r → ℝ) : + (∑ i ∈ Finset.range (n+1), tentCombination m c i ^ 2) = ‖tentMap m n r c‖ ^ 2 := by + rw [EuclideanSpace.norm_sq_eq] + simp only [tentMap, LinearMap.coe_mk, AddHom.coe_mk, PiLp.toLp_apply, + Real.norm_eq_abs, sq_abs] + exact (Fin.sum_univ_eq_sum_range _ _).symm + +lemma eigenvalue_lower_of_subspace {E : Type*} [NormedAddCommGroup E] + [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] + {T : E →ₗ[ℝ] E} (hT : T.IsSymmetric) {n : ℕ} (hn : finrank ℝ E = n) + (S : Submodule ℝ E) (i : Fin n) {a : ℝ} + (hdim : i.val < finrank ℝ S) + (hquad : ∀ x : E, x ∈ S → ‖x‖ = 1 → a ≤ inner ℝ x (T x)) : + a ≤ hT.eigenvalues hn i := by + let b := hT.eigenvectorBasis hn + let U := basisSpan b (Finset.Ici i) + have hnot : ¬ Disjoint S U := by + intro hd + have h := Submodule.finrank_add_finrank_le_of_disjoint hd + rw [show U = basisSpan b (Finset.Ici i) from rfl, basisSpan_finrank, + Fin.card_Ici, hn] at h + omega + rw [Submodule.disjoint_def] at hnot + push Not at hnot + obtain ⟨x, hxS, hxU, hx⟩ := hnot + let y := ‖x‖⁻¹ • x + have hy : ‖y‖ = 1 := by + rw [norm_smul, Real.norm_eq_abs, abs_inv, abs_of_nonneg (norm_nonneg _)] + exact inv_mul_cancel₀ (norm_ne_zero_iff.mpr hx) + have hlow := hquad y (S.smul_mem _ hxS) hy + have hupp := basisQuadratic_le b (hT.eigenvalues hn) (Finset.Ici i) + (U.smul_mem ‖x‖⁻¹ hxU) hy (fun j hj => hT.eigenvalues_antitone hn (Finset.mem_Ici.mp hj)) + rw [eigenbasisQuadratic_eq] at hupp + exact hlow.trans hupp + +def scaledHermite (a : ℝ) : ℕ → Polynomial ℝ + | 0 => 1 + | k + 1 => X * scaledHermite a k - C a * derivative (scaledHermite a k) + +@[simp] lemma scaledHermite_zero (a : ℝ) : scaledHermite a 0 = 1 := rfl + +lemma scaledHermite_succ (a : ℝ) (k : ℕ) : + scaledHermite a (k + 1) = X * scaledHermite a k - C a * derivative (scaledHermite a k) := rfl + +lemma derivative_scaledHermite_succ (a : ℝ) (k : ℕ) : + derivative (scaledHermite a (k + 1)) = C (k + 1 : ℝ) * scaledHermite a k := by + induction k with + | zero => simp [scaledHermite] + | succ k ih => + rw [scaledHermite_succ a (k + 1), derivative_sub, derivative_mul, derivative_X, + one_mul, ih, derivative_mul, derivative_C, zero_mul, zero_add] + rw [derivative_mul, derivative_C, zero_mul, zero_add] + rw [scaledHermite_succ a k] + simp only [Nat.cast_add, Nat.cast_one, map_add, map_one] + ring + +lemma scaledHermite_three_term (a : ℝ) (k : ℕ) : + scaledHermite a (k + 2) = X * scaledHermite a (k + 1) - + C (a * (k + 1)) * scaledHermite a k := by + rw [show k + 2 = (k + 1) + 1 by omega, scaledHermite_succ, + derivative_scaledHermite_succ, map_mul, mul_assoc] + +lemma scaledHermite_differential (a : ℝ) (k : ℕ) : + C a * derivative (derivative (scaledHermite a k)) - + X * derivative (scaledHermite a k) + C (k : ℝ) * scaledHermite a k = 0 := by + have h := derivative_scaledHermite_succ a k + rw [scaledHermite_succ, derivative_sub, derivative_mul, derivative_X, + one_mul, derivative_mul, derivative_C, zero_mul, zero_add] at h + simp only [map_add, map_one] at h + linear_combination -h + +lemma scaledHermite_degree_gap (a : ℝ) (p : Polynomial ℝ) (hp : p ≠ 0) : + (C a * derivative p).degree < (X * p).degree := by + by_cases ha : a = 0 + · simp only [ha, map_zero, zero_mul, degree_zero] + exact degree_ne_bot.mpr (mul_ne_zero X_ne_zero hp) |>.bot_lt + · rw [degree_C_mul ha, mul_comm X p] + exact degree_derivative_le.trans_lt (degree_lt_degree_mul_X hp) + +lemma scaledHermite_monic (a : ℝ) (k : ℕ) : (scaledHermite a k).Monic := by + induction k with + | zero => simp + | succ k ih => + rw [scaledHermite_succ] + exact (monic_X.mul ih).sub_of_left (scaledHermite_degree_gap a _ ih.ne_zero) + +lemma scaledHermite_degree (a : ℝ) (k : ℕ) : (scaledHermite a k).degree = k := by + induction k with + | zero => simp + | succ k ih => + rw [scaledHermite_succ, degree_sub_eq_left_of_degree_lt + (scaledHermite_degree_gap a _ (scaledHermite_monic a k).ne_zero), mul_comm X _, + degree_mul_X, ih] + norm_cast + +lemma det_tridiagonal_step {R : Type*} [CommRing R] (k : ℕ) + (A : Matrix (Fin (k + 2)) (Fin (k + 2)) R) + (hrow : ∀ j : Fin k, A 0 j.succ.succ = 0) + (hcol : ∀ i : Fin k, A i.succ.succ 0 = 0) : + A.det = A 0 0 * (A.submatrix Fin.succ Fin.succ).det - + A 0 1 * A 1 0 * (A.submatrix (Fin.succ ∘ Fin.succ) (Fin.succ ∘ Fin.succ)).det := by + have hminor : (A.submatrix Fin.succ (1 : Fin (k + 2)).succAbove).det = + A 1 0 * (A.submatrix (Fin.succ ∘ Fin.succ) (Fin.succ ∘ Fin.succ)).det := by + rw [det_succ_column_zero, Fin.sum_univ_succ] + simp only [Matrix.submatrix_apply, Fin.val_zero, pow_zero, one_mul, + Fin.succ_zero_eq_one, Fin.one_succAbove_zero, hcol, mul_zero, zero_mul, + Finset.sum_const_zero, add_zero, submatrix_submatrix, Fin.succAbove_zero] + congr 2 + rw [det_succ_row_zero, Fin.sum_univ_succ, Fin.sum_univ_succ] + simp only [Fin.val_zero, pow_zero, one_mul, Fin.succAbove_zero, Fin.val_succ, + Fin.succ_zero_eq_one, hminor, hrow, mul_zero, zero_mul, + Finset.sum_const_zero, add_zero, Fin.val_one, pow_one, neg_one_mul] + ring + +def jacobi (a : ℝ) (k : ℕ) : Matrix (Fin k) (Fin k) ℝ := fun i j => + if i.val + 1 = j.val then Real.sqrt (a * ((k : ℝ) - 1 - i.val)) + else if j.val + 1 = i.val then Real.sqrt (a * ((k : ℝ) - 1 - j.val)) else 0 + +lemma jacobi_diagonal (a : ℝ) (k : ℕ) (i : Fin k) : jacobi a k i i = 0 := by + simp [jacobi] + +lemma jacobi_symmetric (a : ℝ) (k : ℕ) : (jacobi a k).IsSymm := by + ext i j + dsimp [jacobi, Matrix.transpose] + split_ifs with h₁ h₂ h₃ <;> first | rfl | omega + +lemma jacobi_tail (a : ℝ) (k : ℕ) : + (jacobi a (k + 1)).submatrix Fin.succ Fin.succ = jacobi a k := by + ext i j + simp only [Matrix.submatrix_apply, jacobi, Fin.val_succ, Nat.add_right_cancel_iff, + Nat.cast_add, Nat.cast_one] + split_ifs <;> congr 1 <;> ring + +lemma jacobi_row_zero (a : ℝ) (k : ℕ) (j : Fin k) : jacobi a (k + 2) 0 j.succ.succ = 0 := by + simp [jacobi] + +lemma jacobi_col_zero (a : ℝ) (k : ℕ) (i : Fin k) : jacobi a (k + 2) i.succ.succ 0 = 0 := by + simp [jacobi] + +lemma jacobi_first_super (a : ℝ) (k : ℕ) : + jacobi a (k + 2) 0 1 = Real.sqrt (a * (k + 1)) := by + simp [jacobi] + congr 1 + ring + +lemma jacobi_first_sub (a : ℝ) (k : ℕ) : + jacobi a (k + 2) 1 0 = Real.sqrt (a * (k + 1)) := by + simp [jacobi] + congr 1 + ring + +lemma charmatrix_jacobi_tail (a : ℝ) (k : ℕ) : + ((jacobi a (k + 1)).charmatrix).submatrix Fin.succ Fin.succ = + (jacobi a k).charmatrix := by + ext i j + by_cases hij : i = j + · subst j + simp [jacobi_diagonal] + · simp [hij, charmatrix_apply_ne, ← jacobi_tail a k] + +lemma jacobi_charpoly_step {a : ℝ} (ha : 0 ≤ a) (k : ℕ) : + (jacobi a (k + 2)).charpoly = X * (jacobi a (k + 1)).charpoly - + C (a * (k + 1)) * (jacobi a k).charpoly := by + have hr (j : Fin k) : (jacobi a (k + 2)).charmatrix 0 j.succ.succ = 0 := by + rw [charmatrix_apply_ne _ _ _ (by simp only [ne_eq, Fin.ext_iff, Fin.val_zero, Fin.val_succ]; omega), jacobi_row_zero] + simp + have hc (i : Fin k) : (jacobi a (k + 2)).charmatrix i.succ.succ 0 = 0 := by + rw [charmatrix_apply_ne _ _ _ (by simp only [ne_eq, Fin.ext_iff, Fin.val_zero, Fin.val_succ]; omega), jacobi_col_zero] + simp + unfold Matrix.charpoly + rw [det_tridiagonal_step k _ hr hc, charmatrix_apply_eq, jacobi_diagonal, + map_zero, sub_zero, charmatrix_jacobi_tail, + charmatrix_apply_ne _ _ _ (by simp only [ne_eq, Fin.ext_iff, Fin.val_zero, Fin.val_one]; omega : (0 : Fin (k + 2)) ≠ 1), + charmatrix_apply_ne _ _ _ (by simp only [ne_eq, Fin.ext_iff, Fin.val_zero, Fin.val_one]; omega : (1 : Fin (k + 2)) ≠ 0), + jacobi_first_super, jacobi_first_sub, neg_mul_neg, ← map_mul, + ← sq, Real.sq_sqrt (by positivity)] + congr 2 + rw [← submatrix_submatrix, charmatrix_jacobi_tail, charmatrix_jacobi_tail] + +lemma jacobi_charpoly {a : ℝ} (ha : 0 ≤ a) (k : ℕ) : + (jacobi a k).charpoly = scaledHermite a k := by + induction k using Nat.twoStepInduction with + | zero => simp + | one => + have hz : jacobi a 1 = 0 := by ext i j; fin_cases i; fin_cases j; simp [jacobi] + simp [hz, scaledHermite] + | more k h0 h1 => rw [jacobi_charpoly_step ha, h0, h1, scaledHermite_three_term] + +lemma finset_sum_indicator_le_one {ι : Type*} [Fintype ι] (p : ι → Prop) + [DecidablePred p] (hp : ∀ i j, p i → p j → i = j) : + (∑ i, if p i then (1 : ℝ) else 0) ≤ 1 := by + classical + by_cases hex : ∃ i, p i + · obtain ⟨i, hi⟩ := hex + have heq : ∀ j, p j ↔ j = i := fun j => ⟨fun hj => hp j i hj hi, fun h => h ▸ hi⟩ + simp_rw [heq] + simp + · simp [not_exists.mp hex] + +lemma jacobi_row_norm_bound (n : ℕ) (i : Fin n) : + ∑ j : Fin n, ‖jacobi (n : ℝ)⁻¹ n i j‖ ≤ 2 := by + have hn : (0 : ℝ) < n := Nat.cast_pos.mpr (Nat.zero_lt_of_lt i.isLt) + have hentry (k : Fin n) : Real.sqrt ((n : ℝ)⁻¹ * ((n : ℝ) - 1 - k.val)) ≤ 1 := by + apply Real.sqrt_le_one.mpr + have hk : (0 : ℝ) ≤ k.val := Nat.cast_nonneg _ + apply (inv_mul_le_iff₀ hn).mpr + linarith + have hpoint (j : Fin n) : ‖jacobi (n : ℝ)⁻¹ n i j‖ ≤ + (if i.val + 1 = j.val then 1 else 0) + (if j.val + 1 = i.val then 1 else 0) := by + unfold jacobi + split_ifs <;> simp only [Real.norm_eq_abs, abs_of_nonneg (Real.sqrt_nonneg _), + norm_zero] <;> linarith [hentry i, hentry j] + have h₁ := finset_sum_indicator_le_one (fun j : Fin n => i.val + 1 = j.val) + (fun j k hj hk => Fin.ext (by omega)) + have h₂ := finset_sum_indicator_le_one (fun j : Fin n => j.val + 1 = i.val) + (fun j k hj hk => Fin.ext (by omega)) + have hb := Finset.sum_le_sum (fun j (_ : j ∈ (Finset.univ : Finset (Fin n))) => hpoint j) + rw [Finset.sum_add_distrib] at hb + linarith + +lemma jacobi_hermitian (a : ℝ) (n : ℕ) : (jacobi a n).IsHermitian := + Matrix.isHermitian_iff_isSymm.mpr (jacobi_symmetric a n) + +lemma jacobi_eigenvalue_bound (n : ℕ) (i : Fin n) : + |(jacobi_hermitian (n : ℝ)⁻¹ n).eigenvalues i| ≤ 2 := by + let hA := jacobi_hermitian (n : ℝ)⁻¹ n + have he : Module.End.HasEigenvalue (Matrix.toLin' (jacobi (n : ℝ)⁻¹ n)) + (hA.eigenvalues i) := by + apply Module.End.hasEigenvalue_of_hasEigenvector + refine ⟨Module.End.mem_eigenspace_iff.mpr (hA.mulVec_eigenvectorBasis i), ?_⟩ + intro h + apply hA.eigenvectorBasis.orthonormal.ne_zero i + ext j + exact congrFun h j + obtain ⟨j, hj⟩ := eigenvalue_mem_ball he + rw [Metric.mem_closedBall, jacobi_diagonal, dist_zero_right, Real.norm_eq_abs] at hj + exact hj.trans ((Finset.sum_le_univ_sum_of_nonneg (fun _ => norm_nonneg _)).trans + (jacobi_row_norm_bound n j)) + +section + +def semicircleResolvent (s : ℝ) : ℝ := (2 + s - Real.sqrt (s * (4 + s))) / 2 + +def empiricalResolvent {ι : Type*} [Fintype ι] (e : ι → ℝ) (s : ℝ) : ℝ := + (Fintype.card ι : ℝ)⁻¹ * ∑ i, (s + e i)⁻¹ + +def empiricalResolventSquare {ι : Type*} [Fintype ι] (e : ι → ℝ) (s : ℝ) : ℝ := + (Fintype.card ι : ℝ)⁻¹ * ∑ i, (s + e i)⁻¹ ^ 2 + +lemma semicircle_discriminant_pos {s : ℝ} (hs : 0 < s) : 0 < s * (4 + s) := by positivity + +lemma semicircleResolvent_pos {s : ℝ} (hs : 0 < s) : 0 < semicircleResolvent s := by + have hn := Real.sqrt_nonneg (s * (4 + s)) + have hsq := Real.sq_sqrt (semicircle_discriminant_pos hs).le + unfold semicircleResolvent + nlinarith + +lemma semicircleResolvent_le_one {s : ℝ} (hs : 0 ≤ s) : semicircleResolvent s ≤ 1 := by + have hn := Real.sqrt_nonneg (s * (4 + s)) + have hsq := Real.sq_sqrt (show 0 ≤ s * (4 + s) by positivity) + unfold semicircleResolvent + nlinarith + +lemma semicircleResolvent_deficit {s : ℝ} (hs : 0 ≤ s) : + 1 - semicircleResolvent s ≤ Real.sqrt s := by + have hn := Real.sqrt_nonneg (s * (4 + s)) + have hsq := Real.sq_sqrt (show 0 ≤ s * (4 + s) by positivity) + have hb := Real.sqrt_nonneg s + have hb2 := Real.sq_sqrt hs + unfold semicircleResolvent + nlinarith [mul_nonneg hs hb] + +lemma semicircleResolvent_difference {s : ℝ} (hs : 0 ≤ s) : + semicircleResolvent (s / 2) - semicircleResolvent s ≤ Real.sqrt s := by + have := semicircleResolvent_le_one (show 0 ≤ s / 2 by positivity) + have := semicircleResolvent_deficit hs + linarith + +lemma semicircle_discriminant_lower {s : ℝ} (hs : 0 ≤ s) : + 2 * Real.sqrt s ≤ Real.sqrt (s * (4 + s)) := by + have hn := Real.sqrt_nonneg (s * (4 + s)) + have hsq := Real.sq_sqrt (show 0 ≤ s * (4 + s) by positivity) + have hb := Real.sqrt_nonneg s + have hb2 := Real.sq_sqrt hs + nlinarith + +variable {ι : Type*} [Fintype ι] [Nonempty ι] (e : ι → ℝ) (he : ∀ i, 0 ≤ e i) + +include he + +lemma empiricalResolvent_pos {s : ℝ} (hs : 0 < s) : 0 < empiricalResolvent e s := by + unfold empiricalResolvent + apply mul_pos (inv_pos.mpr (Nat.cast_pos.mpr Fintype.card_pos)) + exact Finset.sum_pos (fun i _ => inv_pos.mpr (add_pos_of_pos_of_nonneg hs (he i))) Finset.univ_nonempty + +lemma empiricalResolventSquare_pos {s : ℝ} (hs : 0 < s) : 0 < empiricalResolventSquare e s := by + unfold empiricalResolventSquare + apply mul_pos (inv_pos.mpr (Nat.cast_pos.mpr Fintype.card_pos)) + exact Finset.sum_pos (fun i _ => sq_pos_of_pos (inv_pos.mpr + (add_pos_of_pos_of_nonneg hs (he i)))) Finset.univ_nonempty + +lemma empiricalResolvent_le_inv {s : ℝ} (hs : 0 < s) : empiricalResolvent e s ≤ s⁻¹ := by + have hn : (0 : ℝ) < Fintype.card ι := Nat.cast_pos.mpr Fintype.card_pos + calc + _ ≤ (Fintype.card ι : ℝ)⁻¹ * ∑ _i : ι, s⁻¹ := by + apply mul_le_mul_of_nonneg_left _ (inv_nonneg.mpr hn.le) + apply Finset.sum_le_sum + intro i _ + exact (inv_le_inv₀ (add_pos_of_pos_of_nonneg hs (he i)) hs).mpr (le_add_of_nonneg_right (he i)) + _ = s⁻¹ := by simp [hn.ne'] + +omit [Nonempty ι] in +lemma empiricalResolvent_continuousOn : ContinuousOn (empiricalResolvent e) (Set.Ioi 0) := by + apply ContinuousOn.const_mul + apply continuousOn_finsetSum + intro i _ + apply ContinuousOn.inv₀ (continuousOn_id.add continuousOn_const) + intro s hs + exact ne_of_gt (add_pos_of_pos_of_nonneg hs (he i)) + +omit [Nonempty ι] in +lemma empiricalResolvent_hasDerivAt {s : ℝ} (hs : 0 < s) : + HasDerivAt (empiricalResolvent e) (-empiricalResolventSquare e s) s := by + have h (i : ι) : HasDerivAt (fun u : ℝ => (u + e i)⁻¹) (-(s + e i)⁻¹ ^ 2) s := by + convert! ((hasDerivAt_id s).add_const (e i)).inv (ne_of_gt + (add_pos_of_pos_of_nonneg hs (he i))) using 1 + simp only [neg_div, one_div, inv_pow, id_eq] + convert! (HasDerivAt.fun_sum (u := Finset.univ) (fun i _ => h i)).const_mul + (Fintype.card ι : ℝ)⁻¹ using 1 + simp only [empiricalResolventSquare, Finset.sum_neg_distrib, mul_neg] + +lemma empiricalResolvent_square_difference {s : ℝ} (hs : 0 < s) : + empiricalResolventSquare e s ≤ 2 / s * + (empiricalResolvent e (s / 2) - empiricalResolvent e s) := by + have hn : (0 : ℝ) < Fintype.card ι := Nat.cast_pos.mpr Fintype.card_pos + have hpoint (i : ι) : (s + e i)⁻¹ ^ 2 ≤ 2 / s * ((s / 2 + e i)⁻¹ - (s + e i)⁻¹) := by + have hi : 0 < s + e i := by linarith [he i] + have hi2 : 0 < s / 2 + e i := by linarith [he i] + have hval : 2 / s * ((s / 2 + e i)⁻¹ - (s + e i)⁻¹) = + ((s / 2 + e i) * (s + e i))⁻¹ := by + rw [inv_sub_inv hi2.ne' hi.ne', + show s + e i - (s / 2 + e i) = s / 2 by ring, ← mul_div_assoc, + show 2 / s * (s / 2) = 1 by field_simp, one_div] + rw [hval, inv_pow] + apply (inv_le_inv₀ (sq_pos_of_pos hi) (mul_pos hi2 hi)).mpr + nlinarith + unfold empiricalResolventSquare empiricalResolvent + calc + _ ≤ (Fintype.card ι : ℝ)⁻¹ * ∑ i, 2 / s * ((s / 2 + e i)⁻¹ - (s + e i)⁻¹) := + mul_le_mul_of_nonneg_left (Finset.sum_le_sum (fun i _ => hpoint i)) (inv_nonneg.mpr hn.le) + _ = _ := by rw [← Finset.mul_sum, Finset.sum_sub_distrib]; ring + +lemma empiricalResolvent_lt_midpoint + (hR : ∀ s : ℝ, 0 < s → + (empiricalResolvent e s) ^ 2 - (2 + s) * empiricalResolvent e s + 1 = + empiricalResolventSquare e s / Fintype.card ι) + {s : ℝ} (hs : 0 < s) : empiricalResolvent e s < (2 + s) / 2 := by + by_contra hbad + have hn : (0 : ℝ) < Fintype.card ι := Nat.cast_pos.mpr Fintype.card_pos + let f : ℝ → ℝ := fun u => (2 + u) / 2 - empiricalResolvent e u + have hfs : f s ≤ 0 := by dsimp [f]; linarith + have hft : 0 ≤ f (s + 2) := by + have hb := empiricalResolvent_le_inv e he (show 0 < s + 2 by linarith) + have hinv : (s + 2)⁻¹ ≤ 1 := (inv_le_one₀ (by linarith)).mpr (by linarith) + dsimp [f] + linarith + have hc : ContinuousOn f (Set.Icc s (s + 2)) := by + apply ContinuousOn.sub + · exact (continuous_const.add continuous_id).continuousOn.div_const 2 + · exact (empiricalResolvent_continuousOn e he).mono (fun u hu => lt_of_lt_of_le hs hu.1) + obtain ⟨u, hu, hzero⟩ := intermediate_value_Icc (show s ≤ s + 2 by linarith) hc ⟨hfs, hft⟩ + have hu0 : 0 < u := lt_of_lt_of_le hs hu.1 + have hid := hR u hu0 + have ht : 0 < empiricalResolventSquare e u / Fintype.card ι := + div_pos (empiricalResolventSquare_pos e he hu0) hn + dsimp [f] at hzero + nlinarith + +lemma empiricalResolvent_lt_semicircle + (hR : ∀ s : ℝ, 0 < s → + (empiricalResolvent e s) ^ 2 - (2 + s) * empiricalResolvent e s + 1 = + empiricalResolventSquare e s / Fintype.card ι) + {s : ℝ} (hs : 0 < s) : empiricalResolvent e s < semicircleResolvent s := by + have hn : (0 : ℝ) < Fintype.card ι := Nat.cast_pos.mpr Fintype.card_pos + have hmid := empiricalResolvent_lt_midpoint e he hR hs + have hid := hR s hs + have ht : 0 < empiricalResolventSquare e s / Fintype.card ι := + div_pos (empiricalResolventSquare_pos e he hs) hn + have hsq := Real.sq_sqrt (semicircle_discriminant_pos hs).le + have hpos := Real.sqrt_nonneg (s * (4 + s)) + unfold semicircleResolvent + nlinarith + +lemma empiricalResolvent_root_difference + (hR : ∀ s : ℝ, 0 < s → + (empiricalResolvent e s) ^ 2 - (2 + s) * empiricalResolvent e s + 1 = + empiricalResolventSquare e s / Fintype.card ι) + {s : ℝ} (hs : 0 < s) : + 0 ≤ semicircleResolvent s - empiricalResolvent e s ∧ + semicircleResolvent s - empiricalResolvent e s ≤ + empiricalResolventSquare e s / + ((Fintype.card ι : ℝ) * Real.sqrt (s * (4 + s))) := by + have hd := (empiricalResolvent_lt_semicircle e he hR hs).le + refine ⟨sub_nonneg.mpr hd, ?_⟩ + have hn : (0 : ℝ) < Fintype.card ι := Nat.cast_pos.mpr Fintype.card_pos + have hpos : 0 < Real.sqrt (s * (4 + s)) := Real.sqrt_pos.mpr (semicircle_discriminant_pos hs) + have hsq := Real.sq_sqrt (semicircle_discriminant_pos hs).le + have hid := hR s hs + apply (le_div_iff₀ (mul_pos hn hpos)).mpr + have hid' := (eq_div_iff hn.ne').mp hid + unfold semicircleResolvent at * + nlinarith [sq_nonneg ((2 + s - Real.sqrt (s * (4 + s))) / 2 - empiricalResolvent e s)] + +lemma empiricalResolventSquare_bound + (hR : ∀ s : ℝ, 0 < s → + (empiricalResolvent e s) ^ 2 - (2 + s) * empiricalResolvent e s + 1 = + empiricalResolventSquare e s / Fintype.card ι) + {s : ℝ} (hs : 0 < s) + (hscale : 4 ≤ (Fintype.card ι : ℝ) * s * Real.sqrt (s * (4 + s))) : + empiricalResolventSquare e s ≤ 4 / Real.sqrt s := by + have hn : (0 : ℝ) < Fintype.card ι := Nat.cast_pos.mpr Fintype.card_pos + have hsp := Real.sqrt_pos.mpr hs + have hsq := Real.sq_sqrt hs.le + have hdisc := Real.sqrt_pos.mpr (semicircle_discriminant_pos hs) + have hd := empiricalResolvent_root_difference e he hR hs + have hhalf := (empiricalResolvent_lt_semicircle e he hR (show 0 < s / 2 by positivity)).le + have hdiff := semicircleResolvent_difference hs.le + have hb := empiricalResolvent_square_difference e he hs + have hT := (empiricalResolventSquare_pos e he hs).le + have hd' : 2 * (semicircleResolvent s - empiricalResolvent e s) ≤ + s * empiricalResolventSquare e s / 2 := by + have hden : 0 < (Fintype.card ι : ℝ) * Real.sqrt (s * (4 + s)) := mul_pos hn hdisc + have hmul := (le_div_iff₀ hden).mp hd.2 + have hscl : 4 ≤ s * ((Fintype.card ι : ℝ) * Real.sqrt (s * (4 + s))) := by nlinarith + have hm := mul_le_mul_of_nonneg_right hscl hd.1 + have hm2 := mul_le_mul_of_nonneg_left hmul hs.le + nlinarith + have hb' : s * empiricalResolventSquare e s ≤ + 2 * (empiricalResolvent e (s / 2) - empiricalResolvent e s) := by + have := (mul_le_mul_of_nonneg_left hb hs.le) + field_simp at this + nlinarith + apply (le_div_iff₀ hsp).mpr + have hmain : s * empiricalResolventSquare e s ≤ 4 * Real.sqrt s := by linarith + have := mul_le_mul_of_nonneg_right hmain hsp.le + nlinarith + +lemma empiricalResolvent_error_bound + (hR : ∀ s : ℝ, 0 < s → + (empiricalResolvent e s) ^ 2 - (2 + s) * empiricalResolvent e s + 1 = + empiricalResolventSquare e s / Fintype.card ι) + {s : ℝ} (hs : 0 < s) + (hscale : 4 ≤ (Fintype.card ι : ℝ) * s * Real.sqrt (s * (4 + s))) : + 0 ≤ semicircleResolvent s - empiricalResolvent e s ∧ + semicircleResolvent s - empiricalResolvent e s ≤ 2 / ((Fintype.card ι : ℝ) * s) := by + have hn : (0 : ℝ) < Fintype.card ι := Nat.cast_pos.mpr Fintype.card_pos + have hsp := Real.sqrt_pos.mpr hs + have hsq := Real.sq_sqrt hs.le + have hdisc := Real.sqrt_pos.mpr (semicircle_discriminant_pos hs) + have hd := empiricalResolvent_root_difference e he hR hs + refine ⟨hd.1, ?_⟩ + have hT := empiricalResolventSquare_bound e he hR hs hscale + have hlow := semicircle_discriminant_lower hs.le + have hd' := (le_div_iff₀ (mul_pos hn hdisc)).mp hd.2 + have hT' := (le_div_iff₀ hsp).mp hT + have hm := mul_le_mul_of_nonneg_right hd' hsp.le + have hlow' := mul_le_mul_of_nonneg_left hlow (mul_nonneg hd.1 hn.le) + have hlow'' := mul_le_mul_of_nonneg_right hlow' hsp.le + apply (le_div_iff₀ (mul_pos hn hs)).mpr + nlinarith + +lemma empiricalResolvent_counting {s : ℝ} (hs : 0 < s) : + ((Finset.univ.filter (fun i => e i ≤ s)).card : ℝ) ≤ + 4 * (Fintype.card ι : ℝ) * s ^ 2 * empiricalResolventSquare e s := by + classical + have hn : (0 : ℝ) < Fintype.card ι := Nat.cast_pos.mpr Fintype.card_pos + have hpoint (i : ι) (hi : e i ≤ s) : 1 ≤ 4 * s ^ 2 * (s + e i)⁻¹ ^ 2 := by + have hsi : 0 < s + e i := by linarith [he i] + rw [inv_pow, ← div_eq_mul_inv, le_div_iff₀ (sq_pos_of_pos hsi)] + nlinarith [he i] + calc + _ = ∑ _i ∈ Finset.univ.filter (fun i => e i ≤ s), (1 : ℝ) := by simp + _ ≤ ∑ i ∈ Finset.univ.filter (fun i => e i ≤ s), 4 * s ^ 2 * (s + e i)⁻¹ ^ 2 := + Finset.sum_le_sum (fun i hi => hpoint i (Finset.mem_filter.mp hi).2) + _ ≤ ∑ i : ι, 4 * s ^ 2 * (s + e i)⁻¹ ^ 2 := + Finset.sum_le_univ_sum_of_nonneg (fun _ => by positivity) + _ = _ := by + unfold empiricalResolventSquare + rw [← Finset.mul_sum] + field_simp + +end + +open Matrix Polynomial Filter + +noncomputable def jacobiGaps (n : ℕ) (i : Fin n) : ℝ := + 2 - (jacobi_hermitian (n : ℝ)⁻¹ n).eigenvalues i + +lemma jacobiGaps_nonneg (n : ℕ) (i : Fin n) : 0 ≤ jacobiGaps n i := by + have := (abs_le.mp (jacobi_eigenvalue_bound n i)).2 + exact sub_nonneg.mpr this + +lemma hermitian_charpoly_derivative_ratio {ι : Type*} [Fintype ι] [DecidableEq ι] + (A : Matrix ι ι ℝ) (hA : A.IsHermitian) {z : ℝ} (hz : A.charpoly.eval z ≠ 0) : + A.charpoly.derivative.eval z / A.charpoly.eval z = ∑ i, (z - hA.eigenvalues i)⁻¹ := by + rw [hA.splits_charpoly.eval_derivative_div_eval_of_ne_zero hz, + hA.roots_charpoly_eq_eigenvalues, Multiset.map_map] + simp [one_div] + +lemma jacobi_charpoly_nonzero {n : ℕ} {s : ℝ} (hs : 0 < s) : + (jacobi (n : ℝ)⁻¹ n).charpoly.eval (2 + s) ≠ 0 := by + rw [(jacobi_hermitian (n : ℝ)⁻¹ n).charpoly_eq, eval_prod] + apply Finset.prod_ne_zero_iff.mpr + intro i _ + simp only [eval_sub, eval_X, eval_C, RCLike.ofReal_real_eq_id, id_eq] + have := jacobiGaps_nonneg n i + dsimp [jacobiGaps] at this + linarith + +lemma jacobi_logarithmic_ratio {n : ℕ} {s : ℝ} (hs : 0 < s) : + (jacobi (n : ℝ)⁻¹ n).charpoly.derivative.eval (2 + s) / + (jacobi (n : ℝ)⁻¹ n).charpoly.eval (2 + s) = + (n : ℝ) * empiricalResolvent (jacobiGaps n) s := by + by_cases hn : n = 0 + · subst n + simp [empiricalResolvent] + · rw [hermitian_charpoly_derivative_ratio _ (jacobi_hermitian (n : ℝ)⁻¹ n) + (jacobi_charpoly_nonzero hs)] + simp only [empiricalResolvent, Fintype.card_fin, ← mul_assoc, + mul_inv_cancel₀ (show (n : ℝ) ≠ 0 from Nat.cast_ne_zero.mpr hn), one_mul] + apply Finset.sum_congr rfl + intro i _ + congr 1 + simp [jacobiGaps] + ring + +lemma jacobi_riccati {n : ℕ} (hn : 0 < n) {s : ℝ} (hs : 0 < s) : + (empiricalResolvent (jacobiGaps n) s) ^ 2 - + (2 + s) * empiricalResolvent (jacobiGaps n) s + 1 = + empiricalResolventSquare (jacobiGaps n) s / n := by + let : NeZero n := ⟨hn.ne'⟩ + have hnR : (0 : ℝ) < n := Nat.cast_pos.mpr hn + let p := (jacobi (n : ℝ)⁻¹ n).charpoly + have hp : p.eval (2 + s) ≠ 0 := jacobi_charpoly_nonzero hs + have hpd : HasDerivAt (fun u : ℝ => p.eval (2 + u)) (p.derivative.eval (2 + s)) s := by + convert! (p.hasDerivAt (2 + s)).comp s ((hasDerivAt_id s).const_add 2) using 1 + simp only [mul_one] + have hpdd : HasDerivAt (fun u : ℝ => p.derivative.eval (2 + u)) + (p.derivative.derivative.eval (2 + s)) s := by + convert! (p.derivative.hasDerivAt (2 + s)).comp s ((hasDerivAt_id s).const_add 2) using 1 + simp only [mul_one] + have hratio : HasDerivAt (fun u : ℝ => (n : ℝ)⁻¹ * + (p.derivative.eval (2 + u) / p.eval (2 + u))) + ((n : ℝ)⁻¹ * ((p.derivative.derivative.eval (2 + s) * p.eval (2 + s) - + p.derivative.eval (2 + s) * p.derivative.eval (2 + s)) / p.eval (2 + s)^2)) s := by + convert! (hpdd.div hpd hp).const_mul (n : ℝ)⁻¹ using 1 + have hlocal : (fun u : ℝ => (n : ℝ)⁻¹ * + (p.derivative.eval (2 + u) / p.eval (2 + u))) =ᶠ[𝓝 s] + empiricalResolvent (jacobiGaps n) := by + filter_upwards [Ioi_mem_nhds hs] with u hu + rw [jacobi_logarithmic_ratio hu, ← mul_assoc, inv_mul_cancel₀ hnR.ne', one_mul] + have hder := (hratio.congr_of_eventuallyEq hlocal.symm).unique + (empiricalResolvent_hasDerivAt (jacobiGaps n) (jacobiGaps_nonneg n) hs) + have hode := congrArg (Polynomial.eval (2 + s)) (scaledHermite_differential (n : ℝ)⁻¹ n) + rw [← jacobi_charpoly (inv_nonneg.mpr hnR.le) n] at hode + rw [eval_zero] at hode + change (C (n : ℝ)⁻¹ * p.derivative.derivative - X * p.derivative + C (n : ℝ) * p).eval (2 + s) = 0 at hode + simp only [eval_add, eval_sub, eval_mul, eval_C, eval_X] at hode + have hv := jacobi_logarithmic_ratio (n := n) hs + change p.derivative.eval (2 + s) / p.eval (2 + s) = + (n : ℝ) * empiricalResolvent (jacobiGaps n) s at hv + change (n : ℝ)⁻¹ * ((p.derivative.derivative.eval (2 + s) * p.eval (2 + s) - + p.derivative.eval (2 + s) * p.derivative.eval (2 + s)) / p.eval (2 + s)^2) = + -empiricalResolventSquare (jacobiGaps n) s at hder + field_simp [hnR.ne', hp] at hode hv hder ⊢ + rw [hv] at hode hder + have hh : (n : ℝ) * p.eval (2 + s) ^ 2 * + ((n : ℝ) * (empiricalResolvent (jacobiGaps n) s * + (empiricalResolvent (jacobiGaps n) s - (2 + s)) + 1) - + empiricalResolventSquare (jacobiGaps n) s) = 0 := by + linear_combination p.eval (2 + s) * hode - hder + exact sub_eq_zero.mp ((mul_eq_zero.mp hh).resolve_left + (mul_ne_zero hnR.ne' (pow_ne_zero 2 hp))) + +lemma jacobi_resolvent_estimates {n : ℕ} (hn : 0 < n) {s : ℝ} (hs : 0 < s) + (hscale : 2 ≤ (n : ℝ) * s * Real.sqrt s) : + empiricalResolventSquare (jacobiGaps n) s ≤ 4 / Real.sqrt s ∧ + 0 ≤ semicircleResolvent s - empiricalResolvent (jacobiGaps n) s ∧ + semicircleResolvent s - empiricalResolvent (jacobiGaps n) s ≤ 2 / (n * s) := by + let : NeZero n := ⟨hn.ne'⟩ + have hR : ∀ u : ℝ, 0 < u → + (empiricalResolvent (jacobiGaps n) u) ^ 2 - + (2 + u) * empiricalResolvent (jacobiGaps n) u + 1 = + empiricalResolventSquare (jacobiGaps n) u / Fintype.card (Fin n) := by + intro u hu + simpa using (jacobi_riccati hn hu) + have hscale' : 4 ≤ (Fintype.card (Fin n) : ℝ) * s * Real.sqrt (s * (4 + s)) := by + have := mul_le_mul_of_nonneg_left (semicircle_discriminant_lower hs.le) + (show 0 ≤ (n : ℝ) * s by positivity) + simp only [Fintype.card_fin] + nlinarith + exact ⟨empiricalResolventSquare_bound _ (jacobiGaps_nonneg n) hR hs hscale', + by simpa using empiricalResolvent_error_bound _ (jacobiGaps_nonneg n) hR hs hscale'⟩ + +lemma jacobi_gap_counting {n : ℕ} (hn : 0 < n) {s : ℝ} (hs : 0 < s) + (hscale : 2 ≤ (n : ℝ) * s * Real.sqrt s) : + ((Finset.univ.filter (fun i => jacobiGaps n i ≤ s)).card : ℝ) ≤ + 16 * (n : ℝ) * s * Real.sqrt s := by + let : NeZero n := ⟨hn.ne'⟩ + have hc := empiricalResolvent_counting _ (jacobiGaps_nonneg n) hs + have ht := (jacobi_resolvent_estimates hn hs hscale).1 + have hsp := Real.sqrt_pos.mpr hs + have hsq := Real.sq_sqrt hs.le + calc + _ ≤ 4 * (n : ℝ) * s ^ 2 * empiricalResolventSquare (jacobiGaps n) s := by simpa using hc + _ ≤ 4 * (n : ℝ) * s ^ 2 * (4 / Real.sqrt s) := by gcongr + _ = _ := by field_simp; nlinarith + +def pathOperator (n : ℕ) : EuclideanSpace ℝ (Fin (n+1)) →ₗ[ℝ] + EuclideanSpace ℝ (Fin (n+1)) := Matrix.toLpLin 2 2 (jacobi ((n+1 : ℝ)⁻¹) (n+1)) + +lemma pathOperator_symmetric (n : ℕ) : (pathOperator n).IsSymmetric := + Matrix.isSymmetric_toEuclideanLin_iff.mpr (jacobi_hermitian _ _) + +lemma jacobi_edgeCoeff (n : ℕ) (i j : Fin (n+1)) : + jacobi (n+1 : ℝ)⁻¹ (n+1) i j = + (if i.val+1=j.val then edgeCoeff n i.val else 0) + + (if j.val+1=i.val then edgeCoeff n j.val else 0) := by + have hs (k : Fin (n+1)) : + Real.sqrt ((n+1 : ℝ)⁻¹ * ((n+1 : ℝ)-1-k.val)) = edgeCoeff n k.val := by + unfold edgeCoeff + congr 1 + field_simp + ring + simp only [jacobi, Nat.cast_add, Nat.cast_one, hs] + split_ifs with h h' h' <;> try rfl + · omega + · simp + · simp + · simp + +lemma directed_neighbor_sum (n : ℕ) (u : ℕ → ℝ) : + (∑ i : Fin (n+1), ∑ j : Fin (n+1), + (if i.val+1=j.val then edgeCoeff n i.val else 0) * u i.val * u j.val) = + ∑ i ∈ Finset.range n, edgeCoeff n i * u i * u (i+1) := by + rw [Fin.sum_univ_castSucc] + have hl : (∑ j : Fin (n+1), + (if (Fin.last n).val+1=j.val then edgeCoeff n (Fin.last n).val else 0) * + u (Fin.last n).val * u j.val) = 0 := by + apply Finset.sum_eq_zero + intro j _ + rw [ite_eq_right (by have := j.isLt; simp only [Fin.val_last]; omega), zero_mul, zero_mul] + rw [hl, add_zero, ← Fin.sum_univ_eq_sum_range] + apply Finset.sum_congr rfl + intro i _ + rw [Finset.sum_eq_single i.succ] + · simp + · intro j _ hj + rw [ite_eq_right (fun h => hj (Fin.ext (by simpa using h.symm))), zero_mul, zero_mul] + · simp + +lemma pathOperator_inner (n : ℕ) (u : ℕ → ℝ) : + inner ℝ (WithLp.toLp 2 (fun i : Fin (n+1) => u i.val)) + (pathOperator n (WithLp.toLp 2 (fun i : Fin (n+1) => u i.val))) = + 2 * ∑ i ∈ Finset.range n, edgeCoeff n i * u i * u (i+1) := by + simp only [pathOperator, Matrix.toLpLin_apply, EuclideanSpace.inner_eq_star_dotProduct, + Pi.star_apply, star_trivial, dotProduct, Matrix.mulVec, + jacobi_edgeCoeff, add_mul, Finset.sum_add_distrib] + have hlo : (∑ i : Fin (n+1), (∑ j : Fin (n+1), + (if i.val+1=j.val then edgeCoeff n i.val else 0) * u j.val) * u i.val) = + ∑ i ∈ Finset.range n, edgeCoeff n i * u i * u (i+1) := by + convert directed_neighbor_sum n u using 1 + apply Finset.sum_congr rfl + intro i _ + rw [Finset.sum_mul] + apply Finset.sum_congr rfl + intros + ring + have hhi : (∑ i : Fin (n+1), (∑ j : Fin (n+1), + (if j.val+1=i.val then edgeCoeff n j.val else 0) * u j.val) * u i.val) = + ∑ i ∈ Finset.range n, edgeCoeff n i * u i * u (i+1) := by + simp only [Finset.sum_mul] + rw [Finset.sum_comm] + exact directed_neighbor_sum n u + rw [hlo, hhi] + ring + +lemma pathOperator_tent_rayleigh {m n r : ℕ} (hm : 0 < m) (hfit : 4*m*r ≤ n) + (c : Fin r → ℝ) : + (2-(4/(m : ℝ)^2 + 2*(4*m*r+1 : ℝ)/(n+1))) * ‖tentMap m n r c‖^2 ≤ + inner ℝ (tentMap m n r c) (pathOperator n (tentMap m n r c)) := by + have h := tentCombination_rayleigh hm hfit c + rw [pathEnergy, tentMap_mass] at h + change _ ≤ inner ℝ (WithLp.toLp 2 (fun i : Fin (n+1) => tentCombination m c i.val)) + (pathOperator n (WithLp.toLp 2 (fun i : Fin (n+1) => tentCombination m c i.val))) + rw [pathOperator_inner] + nlinarith + +lemma pathOperator_eigenvalue_lower {m n r : ℕ} (hm : 0 < m) (hfit : 4*m*r ≤ n) + (i : Fin (n+1)) (hi : i.val < r) : + 2-(4/(m : ℝ)^2 + 2*(4*m*r+1 : ℝ)/(n+1)) ≤ + (pathOperator_symmetric n).eigenvalues (by simp) i := by + apply eigenvalue_lower_of_subspace (pathOperator_symmetric n) (by simp) + (LinearMap.range (tentMap m n r)) i + · rw [tentMap_rank hm hfit] + exact hi + · rintro x ⟨c, rfl⟩ hx + have h := pathOperator_tent_rayleigh hm hfit c + simpa only [hx, one_pow, mul_one] using h + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/Powers.lean b/lean/OAI/MathematicalPhysics/CriticalSK/Powers.lean new file mode 100644 index 0000000000000000000000000000000000000000..28738af591cced6a7057192ebd9fd86883deedeb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/Powers.lean @@ -0,0 +1,166 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open MeasureTheory ProbabilityTheory + +open scoped ENNReal NNReal + +open scoped BigOperators InnerProductSpace + +open Module + +open scoped BigOperators ENNReal NNReal Real Topology + +open MeasureTheory ProbabilityTheory Filter + +open scoped BigOperators NNReal + +open scoped BigOperators + +open Matrix Polynomial + +open scoped BigOperators Topology + +open Filter + +namespace CriticalSK + +lemma rpow_three_eighth_sub_le {s x y : ℝ} (hs : 0 < s) (hsx : s ≤ x) (hxy : x ≤ y) : + y ^ (3 / 8 : ℝ) - x ^ (3 / 8 : ℝ) ≤ + (3 / 8 : ℝ) * s ^ (-5 / 8 : ℝ) * (y - x) := by + have hx : 0 < x := hs.trans_le hsx + have hd (z : ℝ) (hz : z ∈ Set.Icc x y) : + HasDerivWithinAt (fun z : ℝ => z ^ (3 / 8 : ℝ)) + ((3 / 8 : ℝ) * z ^ (-5 / 8 : ℝ)) (Set.Icc x y) z := by + have h := (Real.hasDerivAt_rpow_const (p := (3 / 8 : ℝ)) + (Or.inl (ne_of_gt (hx.trans_le hz.1)))).hasDerivWithinAt (s := Set.Icc x y) + norm_num at h ⊢ + exact h + have hb (z : ℝ) (hz : z ∈ Set.Ico x y) : + ‖(3 / 8 : ℝ) * z ^ (-5 / 8 : ℝ)‖ ≤ (3 / 8 : ℝ) * s ^ (-5 / 8 : ℝ) := by + have hz0 : 0 ≤ z := (hx.trans_le hz.1).le + rw [Real.norm_eq_abs, abs_of_nonneg (by positivity : 0 ≤ (3 / 8 : ℝ) * z ^ (-5 / 8 : ℝ))] + exact mul_le_mul_of_nonneg_left (Real.rpow_le_rpow_of_nonpos hs (hsx.trans hz.1) (by norm_num)) (by norm_num) + have h := norm_image_sub_le_of_norm_deriv_le_segment' hd hb y ⟨hxy, le_rfl⟩ + exact (le_abs_self _).trans h + +lemma rpow_three_eighth_mono {x y : ℝ} (hx : 0 ≤ x) (hxy : x ≤ y) : + x ^ (3 / 8 : ℝ) ≤ y ^ (3 / 8 : ℝ) := Real.rpow_le_rpow hx hxy (by norm_num) + +def edgeError (A B C s e : ℝ) : ℝ := A * (e + s) ^ (3 / 8 : ℝ) + B + C * e + +lemma edgeError_mono {A B C s : ℝ} (hA : 0 ≤ A) (hC : 0 ≤ C) (hs : 0 < s) : + MonotoneOn (edgeError A B C s) (Set.Ici 0) := by + intro x hx y _hy hxy + change 0 ≤ x at hx + dsimp [edgeError] + gcongr + +lemma edgeError_increment {A B C s x y : ℝ} (hA : 0 ≤ A) (hs : 0 < s) + (hx : 0 ≤ x) (hxy : x ≤ y) : + edgeError A B C s y - edgeError A B C s x ≤ + (A * (3 / 8 : ℝ) * s ^ (-5 / 8 : ℝ) + C) * (y - x) := by + have h := mul_le_mul_of_nonneg_left (rpow_three_eighth_sub_le hs + (show s ≤ x + s by linarith) (show x + s ≤ y + s by linarith)) hA + dsimp [edgeError] + nlinarith + +lemma edgeError_gap_comparison_mono {A B C s : ℝ} + (hA : 0 ≤ A) (hC : 0 ≤ C) (hs : 0 < s) + (hsmall : A * (3 / 8 : ℝ) * s ^ (-5 / 8 : ℝ) + C ≤ 1) : + MonotoneOn (fun e => e + edgeError A B C s e) (Set.Ici 0) ∧ + MonotoneOn (fun e => e - edgeError A B C s e) (Set.Ici 0) := by + constructor + · intro x hx y hy hxy + have := edgeError_mono (B := B) hA hC hs hx hy hxy + linarith + · intro x hx y _hy hxy + have h := edgeError_increment (B := B) (C := C) hA hs hx hxy + have h' := mul_le_mul_of_nonneg_right hsmall (sub_nonneg.mpr hxy) + linarith + +lemma edgeError_eigenvalue_comparison_mono {A B C s : ℝ} + (hA : 0 ≤ A) (hC : 0 ≤ C) (hs : 0 < s) + (hsmall : A * (3 / 8 : ℝ) * s ^ (-5 / 8 : ℝ) + C ≤ 1) : + MonotoneOn (fun v => v + edgeError A B C s (2 - v)) (Set.Iic 2) ∧ + MonotoneOn (fun v => v - edgeError A B C s (2 - v)) (Set.Iic 2) := by + obtain ⟨hp, hm⟩ := edgeError_gap_comparison_mono (B := B) hA hC hs hsmall + constructor + · intro x hx y hy hxy + have h := hm (show 0 ≤ 2 - y by exact sub_nonneg.mpr hy) + (show 0 ≤ 2 - x by exact sub_nonneg.mpr hx) (by linarith : 2 - y ≤ 2 - x) + linarith + · intro x hx y hy hxy + have h := hp (show 0 ≤ 2 - y by exact sub_nonneg.mpr hy) + (show 0 ≤ 2 - x by exact sub_nonneg.mpr hx) (by linarith : 2 - y ≤ 2 - x) + linarith + +lemma edgeError_relative {A B C s t e : ℝ} (hA : 0 ≤ A) (hB : 0 ≤ B) + (hC : 0 ≤ C) (hs : 0 < s) (hst : s ≤ t) (he : 0 ≤ e) : + edgeError A B C s e ≤ (A * s ^ (-5 / 8 : ℝ) + B / s + C) * (t + e) := by + have hes : 0 < e + s := by linarith + have ht : 0 < t + e := by linarith + have hp : (e + s) ^ (3 / 8 : ℝ) = (e + s) * (e + s) ^ (-5 / 8 : ℝ) := by + nth_rw 2 [← Real.rpow_one (e + s)] + rw [← Real.rpow_add hes] + norm_num + have hp' : (e + s) ^ (3 / 8 : ℝ) ≤ s ^ (-5 / 8 : ℝ) * (t + e) := by + rw [hp] + calc + _ ≤ (e + s) * s ^ (-5 / 8 : ℝ) := mul_le_mul_of_nonneg_left + (Real.rpow_le_rpow_of_nonpos hs (by linarith) (by norm_num)) hes.le + _ ≤ _ := by + have : 0 ≤ s ^ (-5 / 8 : ℝ) := by positivity + nlinarith + have hb : B ≤ (B / s) * (t + e) := by + have : B / s * s = B := div_mul_cancel₀ B hs.ne' + have : 0 ≤ B / s := div_nonneg hB hs.le + nlinarith [div_mul_cancel₀ B hs.ne'] + have hc : C * e ≤ C * (t + e) := by nlinarith [hs.trans_le hst] + dsimp [edgeError] + nlinarith [mul_le_mul_of_nonneg_left hp' hA] + +open Set MeasureTheory Filter + +lemma third_power_square {x : ℝ} (hx : 0 ≤ x) : (x^(1/3:ℝ))^2 = x^(2/3:ℝ) := by + rw [← Real.rpow_mul_natCast hx] + norm_num + +lemma fifth_third_power {x : ℝ} (hx : 0 < x) : x^(5/3:ℝ) = x*x^(2/3:ℝ) := by + rw [show (5/3:ℝ) = 1+2/3 by ring,Real.rpow_add hx,Real.rpow_one] + +open Set Filter MeasureTheory + +lemma rpow_ratio_tendsto_zero {a ε : ℝ} (hε : 0 < ε) : + Tendsto (fun n : ℕ => (n:ℝ)^(a-ε)/(n:ℝ)^a) atTop (𝓝 0) := by + have hh := (tendsto_rpow_neg_atTop hε).comp tendsto_natCast_atTop_atTop + apply hh.congr' + filter_upwards [eventually_gt_atTop 0] with n hn + simp only [Function.comp_def] + rw [← Real.rpow_sub (Nat.cast_pos.mpr hn)] + congr 1 + ring + +lemma ceil_rpow_ratio_tendsto_zero {a ε : ℝ} (ha : 0 < a) (hε : 0 < ε) : + Tendsto (fun n : ℕ => (⌈(n:ℝ)^(a-ε)⌉₊:ℝ)/(n:ℝ)^a) atTop (𝓝 0) := by + have he := (rpow_ratio_tendsto_zero (a := a) hε).add + (((tendsto_rpow_neg_atTop ha).comp tendsto_natCast_atTop_atTop)) + rw [zero_add] at he + apply squeeze_zero' (Filter.Eventually.of_forall (fun n => by positivity)) _ he + filter_upwards [eventually_gt_atTop 0] with n hn + have hc := (Nat.ceil_lt_add_one (show 0 ≤ (n:ℝ)^(a-ε) by positivity)).le + have hp : 0 < (n:ℝ)^a := Real.rpow_pos_of_pos (Nat.cast_pos.mpr hn) a + calc + _ ≤ ((n:ℝ)^(a-ε)+1)/(n:ℝ)^a := div_le_div_of_nonneg_right hc hp.le + _ = _ := by simp only [Function.comp_def]; rw [add_div,one_div,Real.rpow_neg (Nat.cast_nonneg n)] + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/Rayleigh.lean b/lean/OAI/MathematicalPhysics/CriticalSK/Rayleigh.lean new file mode 100644 index 0000000000000000000000000000000000000000..04f1932f2bc7a9161669dc21088a13873dd5faf7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/Rayleigh.lean @@ -0,0 +1,626 @@ +import OAI.MathematicalPhysics.CriticalSK.Cavity +import OAI.MathematicalPhysics.CriticalSK.Covariance + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +namespace CriticalSK + +section + +open Set Filter MeasureTheory ProbabilityTheory + +variable {n : ℕ} + +@[simp] lemma abs_spinValue (b : Bool) : |spinValue b| = 1 := by cases b <;> norm_num [spinValue] + +lemma cavityOverlapCoord_abs_le_one (i : Fin n) (x y : Spin n) : |cavityOverlapCoord i x y| ≤ 1 := by + have hn : 0 < (n:ℝ) := by exact_mod_cast Nat.zero_lt_of_lt i.isLt + rw [cavityOverlapCoord,abs_div,abs_of_pos hn,div_le_one hn] + calc + |∑ j ∈ Finset.univ.erase i, spinValue (x j)*spinValue (y j)| ≤ ∑ j ∈ Finset.univ.erase i, |spinValue (x j)*spinValue (y j)| := Finset.abs_sum_le_sum_abs _ _ + _ = (n:ℝ)-1 := by + simp only [abs_mul,abs_spinValue,mul_one,Finset.sum_const,nsmul_eq_mul,mul_one] + rw [Finset.card_erase_of_mem (Finset.mem_univ i),Finset.card_univ,Fintype.card_fin,Nat.cast_sub (by have := i.isLt; omega),Nat.cast_one] + _ ≤ (n:ℝ) := by linarith + +lemma cavityNormalization_join (i : Fin n) (u : Incident i → ℝ) (v : Nonincident i → ℝ) : + cavityNormalization ((cavitySplit i).symm (u,v)) i = + coshMixture (gibbs ((cavitySplit i).symm (0,v))) (fun (x : Spin n) (e : Incident i) => incidentCoeff i x e.val) u := by + simp only [cavityNormalization,delete_cavityJoin,mean,coshMixture,localField_cavityJoin,gaussianLinear] + +lemma cavityOverlap_join (i : Fin n) (u : Incident i → ℝ) (v : Nonincident i → ℝ) : + cavityOverlap ((cavitySplit i).symm (u,v)) i = + ∑ x, ∑ y, gibbs ((cavitySplit i).symm (0,v)) x*gibbs ((cavitySplit i).symm (0,v)) y*cavityOverlapCoord i x y^2 := by + simp only [cavityOverlap,delete_cavityJoin,mean,Finset.mul_sum,mul_assoc] + +lemma incident_variance_bound (i : Fin n) : (n:ℝ)⁻¹*((n:ℝ)-1) ≤ 1 := by + have hn : 0 < (n:ℝ) := by exact_mod_cast Nat.zero_lt_of_lt i.isLt + calc + _ ≤ (n:ℝ)⁻¹*(n:ℝ) := mul_le_mul_of_nonneg_left (by linarith) (inv_nonneg.mpr hn.le) + _ = 1 := inv_mul_cancel₀ hn.ne' + +lemma incident_scaled_product (i : Fin n) (x y : Spin n) : + (n:ℝ)⁻¹*(∑ e : Incident i, incidentCoeff i x e.val*incidentCoeff i y e.val) = cavityOverlapCoord i x y := by + have hn : (n:ℝ) ≠ 0 := by exact_mod_cast (ne_of_gt (Nat.zero_lt_of_lt i.isLt)) + rw [incident_coeff_product,← mul_assoc,inv_mul_cancel₀ hn,one_mul] + +lemma cavity_conditional_mean (i : Fin n) (v : Nonincident i → ℝ) : + Integrable (fun u => cavityNormalization ((cavitySplit i).symm (u,v)) i) (incidentLaw i) ∧ + (∫ u, cavityNormalization ((cavitySplit i).symm (u,v)) i ∂incidentLaw i) = Real.exp ((n:ℝ)⁻¹*((n:ℝ)-1)/2) := by + change Integrable (fun u => cavityNormalization ((cavitySplit i).symm (u,v)) i) (gaussianScalarPi (n:ℝ≥0)⁻¹) ∧ _ + simp_rw [cavityNormalization_join] + refine ⟨coshMixture_integrable (n:ℝ≥0)⁻¹ (gibbs ((cavitySplit i).symm (0,v))) (fun (x : Spin n) (e : Incident i) => incidentCoeff i x e.val), ?_⟩ + change (∫ u, coshMixture (gibbs ((cavitySplit i).symm (0,v))) (fun (x : Spin n) (e : Incident i) => incidentCoeff i x e.val) u ∂gaussianScalarPi (n:ℝ≥0)⁻¹) = _ + + simpa only [NNReal.coe_inv,NNReal.coe_natCast] using coshMixture_integral (n:ℝ≥0)⁻¹ (gibbs_sum _) (fun (x : Spin n) (e : Incident i) => incidentCoeff i x e.val) (incident_coeff_square i) + +lemma cavity_conditional_pow (i : Fin n) (v : Nonincident i → ℝ) (m : ℕ) : + Integrable (fun u => cavityNormalization ((cavitySplit i).symm (u,v)) i^m) (incidentLaw i) ∧ + (∫ u, cavityNormalization ((cavitySplit i).symm (u,v)) i^m ∂incidentLaw i) ≤ 2*Real.exp ((m:ℝ)^2/2) := by + have hh := coshMixture_pow_integrable_bound (n:ℝ≥0)⁻¹ (gibbs_nonneg ((cavitySplit i).symm (0,v))) (gibbs_sum _) (fun (x : Spin n) (e : Incident i) => incidentCoeff i x e.val) (incident_coeff_square i) m + simp only [NNReal.coe_inv,NNReal.coe_natCast] at hh + simp_rw [cavityNormalization_join] + refine ⟨hh.1,hh.2.trans ?_⟩ + apply mul_le_mul_of_nonneg_left _ (by norm_num) + apply Real.exp_le_exp.mpr + nlinarith [mul_le_mul_of_nonneg_left (incident_variance_bound i) (sq_nonneg (m:ℝ))] + +lemma cavity_conditional_variance (i : Fin n) (v : Nonincident i → ℝ) : + Integrable (fun u => (cavityNormalization ((cavitySplit i).symm (u,v)) i-Real.exp ((n:ℝ)⁻¹*((n:ℝ)-1)/2))^2) (incidentLaw i) ∧ + (∫ u, (cavityNormalization ((cavitySplit i).symm (u,v)) i-Real.exp ((n:ℝ)⁻¹*((n:ℝ)-1)/2))^2 ∂incidentLaw i) ≤ + Real.exp 1*(Real.exp 1-1)*cavityOverlap ((cavitySplit i).symm (0,v)) i := by + have hc (x y : Spin n) : |((n:ℝ≥0)⁻¹:ℝ)*(∑ e : Incident i, incidentCoeff i x e.val*incidentCoeff i y e.val)| ≤ 1 := by + simpa only [NNReal.coe_inv,NNReal.coe_natCast,incident_scaled_product] using cavityOverlapCoord_abs_le_one i x y + have hh := coshMixture_centered_integrable_bound (n:ℝ≥0)⁻¹ (gibbs_nonneg ((cavitySplit i).symm (0,v))) (gibbs_sum _) (fun (x : Spin n) (e : Incident i) => incidentCoeff i x e.val) (incident_coeff_square i) hc + simp only [NNReal.coe_inv,NNReal.coe_natCast,incident_scaled_product] at hh + simp_rw [← cavityNormalization_join] at hh + rw [← cavityOverlap_join i 0 v] at hh + refine ⟨hh.1,hh.2.trans ?_⟩ + exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr (incident_variance_bound i)) (by linarith [Real.add_one_le_exp 1])) (cavityOverlap_nonneg _ i) + +lemma deleteDisorder_continuous (i : Fin n) : Continuous (fun W : Disorder n => deleteDisorder W i) := by + apply continuous_pi + intro e + by_cases he : e.val.1=i ∨ e.val.2=i + · simp only [deleteDisorder,ite_eq_left he]; exact continuous_const + · simp only [deleteDisorder,ite_eq_right he]; exact continuous_apply e + +lemma localField_continuous (i : Fin n) (x : Spin n) : Continuous (fun W : Disorder n => localField W i x) := by + unfold localField + fun_prop + +lemma cavityNormalization_continuous (i : Fin n) : Continuous (fun W : Disorder n => cavityNormalization W i) := by + unfold cavityNormalization mean + apply continuous_finsetSum + intro x _ + exact ((gibbs_continuous x).comp (deleteDisorder_continuous i)).mul (Real.continuous_cosh.comp (localField_continuous i x)) + +lemma cavityOverlap_continuous (i : Fin n) : Continuous (fun W : Disorder n => cavityOverlap W i) := by + unfold cavityOverlap mean + apply continuous_finsetSum + intro x _ + apply ((gibbs_continuous x).comp (deleteDisorder_continuous i)).mul + apply continuous_finsetSum + intro y _ + exact ((gibbs_continuous y).comp (deleteDisorder_continuous i)).mul continuous_const + +lemma cavity_event_identity (i : Fin n) {E : Set (Disorder n)} (hE : MeasurableSet E) : + (disorderLaw n).real E = ∫ v, (incidentLaw i).real {u | (cavitySplit i).symm (u,v) ∈ E} ∂nonincidentLaw i := + preserving_product_event_real _ _ _ _ (cavitySplit_preserving i).symm hE + +lemma cavity_conditional_tail (i : Fin n) (v : Nonincident i → ℝ) {b : ℝ} (hb : 0 < b) (m : ℕ) : + (incidentLaw i).real {u | b ≤ cavityNormalization ((cavitySplit i).symm (u,v)) i} ≤ 2*Real.exp ((m:ℝ)^2/2)/b^m := by + obtain ⟨hi,hh⟩ := cavity_conditional_pow i v m + have ht := integral_dominates_event (E := {u | b ≤ cavityNormalization ((cavitySplit i).symm (u,v)) i}) + (hi.div_const (b^m)) (fun u => div_nonneg (pow_nonneg (by linarith [cavityNormalization_ge_one ((cavitySplit i).symm (u,v)) i]) _) (pow_nonneg hb.le _)) + (fun u hu => by + apply (le_div_iff₀ (pow_pos hb _)).mpr + rw [one_mul] + exact pow_le_pow_left₀ hb.le hu _) + rw [integral_div] at ht + exact ht.trans (div_le_div_of_nonneg_right hh (pow_nonneg hb.le _)) + +lemma cavity_tail (i : Fin n) {b : ℝ} (hb : 0 < b) (m : ℕ) : + (disorderLaw n).real {W | b ≤ cavityNormalization W i} ≤ 2*Real.exp ((m:ℝ)^2/2)/b^m := by + rw [cavity_event_identity i (measurableSet_le measurable_const (cavityNormalization_continuous i).measurable)] + calc + _ ≤ ∫ _v, 2*Real.exp ((m:ℝ)^2/2)/b^m ∂nonincidentLaw i := + integral_mono_of_nonneg (ae_of_all _ (fun _ => measureReal_nonneg)) (integrable_const _) (ae_of_all _ (fun v => cavity_conditional_tail i v hb m)) + _ = _ := by simp + +lemma all_cavity_tail {b : ℝ} (hb : 0 < b) (m : ℕ) : + (disorderLaw n).real {W | ∃ i, b ≤ cavityNormalization W i} ≤ (n:ℝ)*(2*Real.exp ((m:ℝ)^2/2)/b^m) := by + have he : {W : Disorder n | ∃ i, b ≤ cavityNormalization W i} = ⋃ i : Fin n, {W | b ≤ cavityNormalization W i} := by ext W; simp + rw [he] + calc + _ ≤ ∑ i : Fin n, (disorderLaw n).real {W | b ≤ cavityNormalization W i} := measureReal_iUnion_fintype_le _ + _ ≤ ∑ _i : Fin n, 2*Real.exp ((m:ℝ)^2/2)/b^m := Finset.sum_le_sum (fun i _ => cavity_tail i hb m) + _ = _ := by simp + +lemma cavity_conditional_clipped (i : Fin n) (v : Nonincident i → ℝ) {r : ℝ} (hr : 0 ≤ r) : + (incidentLaw i).real {u | Real.exp 1+1 < cavityNormalization ((cavitySplit i).symm (u,v)) i ∧ cavityOverlap ((cavitySplit i).symm (u,v)) i ≤ r} ≤ + Real.exp 1*(Real.exp 1-1)*r := by + have he (u : Incident i → ℝ) : cavityOverlap ((cavitySplit i).symm (u,v)) i = cavityOverlap ((cavitySplit i).symm (0,v)) i := by + rw [cavityOverlap_join,cavityOverlap_join] + by_cases hR : cavityOverlap ((cavitySplit i).symm (0,v)) i ≤ r + · obtain ⟨hi,hh⟩ := cavity_conditional_variance i v + have hm : Real.exp ((n:ℝ)⁻¹*((n:ℝ)-1)/2) ≤ Real.exp 1 := + Real.exp_le_exp.mpr (by linarith [incident_variance_bound i]) + have ht := integral_dominates_event (E := {u | Real.exp 1+1 < cavityNormalization ((cavitySplit i).symm (u,v)) i ∧ cavityOverlap ((cavitySplit i).symm (u,v)) i ≤ r}) hi (fun _ => sq_nonneg _) (fun u hu => by + have hz := hu.1 + nlinarith [sq_nonneg (cavityNormalization ((cavitySplit i).symm (u,v)) i-Real.exp ((n:ℝ)⁻¹*((n:ℝ)-1)/2)-1)]) + exact ht.trans (hh.trans (mul_le_mul_of_nonneg_left hR (mul_nonneg (Real.exp_pos _).le (by linarith [Real.add_one_le_exp 1])))) + · have hset : {u | Real.exp 1+1 < cavityNormalization ((cavitySplit i).symm (u,v)) i ∧ cavityOverlap ((cavitySplit i).symm (u,v)) i ≤ r} = ∅ := by + ext u + simp only [mem_ofPred_eq,he,mem_empty_iff_false,iff_false,not_and] + exact fun _ => hR + rw [hset,measureReal_empty] + exact mul_nonneg (mul_nonneg (Real.exp_pos _).le (by linarith [Real.add_one_le_exp 1])) hr + +lemma cavityClipped_measurable (i : Fin n) (r : ℝ) : MeasurableSet {W : Disorder n | Real.exp 1+1 < cavityNormalization W i ∧ cavityOverlap W i ≤ r} := + (measurableSet_lt measurable_const (cavityNormalization_continuous i).measurable).inter (measurableSet_le (cavityOverlap_continuous i).measurable measurable_const) + +lemma cavity_clipped (i : Fin n) {r : ℝ} (hr : 0 ≤ r) : + (disorderLaw n).real {W | Real.exp 1+1 < cavityNormalization W i ∧ cavityOverlap W i ≤ r} ≤ Real.exp 1*(Real.exp 1-1)*r := by + rw [cavity_event_identity i (cavityClipped_measurable i r)] + calc + _ ≤ ∫ _v, Real.exp 1*(Real.exp 1-1)*r ∂nonincidentLaw i := + integral_mono_of_nonneg (ae_of_all _ (fun _ => measureReal_nonneg)) (integrable_const _) (ae_of_all _ (fun v => cavity_conditional_clipped i v hr)) + _ = _ := by simp + +noncomputable def cavityClippedCount (W : Disorder n) (r : ℝ) : ℝ := + ∑ i : Fin n, if Real.exp 1+1 < cavityNormalization W i ∧ cavityOverlap W i ≤ r then 1 else 0 + +lemma cavityClippedCount_nonneg (W : Disorder n) (r : ℝ) : 0 ≤ cavityClippedCount W r := by + apply Finset.sum_nonneg + intro i _ + split_ifs <;> norm_num + +lemma cavityClippedCount_integrable (r : ℝ) : Integrable (fun W : Disorder n => cavityClippedCount W r) (disorderLaw n) := by + unfold cavityClippedCount + apply integrable_finsetSum + intro i _ + refine ((integrable_const (μ := disorderLaw n) (1:ℝ)).indicator (cavityClipped_measurable i r)).congr (ae_of_all _ ?_) + intro W + by_cases hW : Real.exp 1+1 < cavityNormalization W i ∧ cavityOverlap W i ≤ r <;> simp [hW] + +lemma cavityClippedCount_expectation {r : ℝ} (hr : 0 ≤ r) : + (∫ W, cavityClippedCount W r ∂disorderLaw n) ≤ (n:ℝ)*(Real.exp 1*(Real.exp 1-1)*r) := by + unfold cavityClippedCount + rw [integral_finsetSum] + · calc + _ = ∑ i : Fin n, (disorderLaw n).real {W | Real.exp 1+1 < cavityNormalization W i ∧ cavityOverlap W i ≤ r} := by + apply Finset.sum_congr rfl + intro i _ + simpa only [Set.indicator, mem_ofPred_eq, Pi.one_apply] using integral_indicator_one (μ := disorderLaw n) (cavityClipped_measurable i r) + _ ≤ ∑ _i : Fin n, Real.exp 1*(Real.exp 1-1)*r := Finset.sum_le_sum (fun i _ => cavity_clipped i hr) + _ = _ := by simp + · intro i _ + refine ((integrable_const (μ := disorderLaw n) (1:ℝ)).indicator (cavityClipped_measurable i r)).congr (ae_of_all _ ?_) + intro W + by_cases hW : Real.exp 1+1 < cavityNormalization W i ∧ cavityOverlap W i ≤ r <;> simp [hW] + +lemma cavityClippedCount_tail {r b : ℝ} (hr : 0 ≤ r) (hb : 0 < b) : + (disorderLaw n).real {W | b ≤ cavityClippedCount W r} ≤ (n:ℝ)*(Real.exp 1*(Real.exp 1-1)*r)/b := by + have ht := integral_dominates_event (μ := disorderLaw n) (E := {W | b ≤ cavityClippedCount W r}) ((cavityClippedCount_integrable r).div_const b) + (fun W => div_nonneg (cavityClippedCount_nonneg W r) hb.le) (fun W hW => (le_div_iff₀ hb).mpr (by simpa using hW)) + rw [integral_div] at ht + exact ht.trans (div_le_div_of_nonneg_right (cavityClippedCount_expectation hr) hb.le) + +end + +section + +open Set Filter MeasureTheory + +variable {n : ℕ} (W : Disorder n) + +lemma variance_linear_nonneg (a : Fin n → ℝ) : 0 ≤ variance W (linearObservable a) := mean_nonneg _ (fun _ => sq_nonneg _) + +lemma variance_linear_norm_bound (a : Fin n → ℝ) : variance W (linearObservable a) ≤ covarianceNorm W*(∑ i, a i^2) := by + have hh := variance_linear_le_norm W (WithLp.toLp 2 a) + rwa [EuclideanSpace.real_norm_sq_eq] at hh + +lemma linear_dirichlet_coeff_bound (A : Finset (Fin n)) (a : Fin n → ℝ) {B : ℝ} (_hB : 0 ≤ B) + (hz : ∀ i ∈ A, cavityNormalization W i ≤ B) : + (∑ i ∈ A, a i^2) ≤ B^2*dirichlet W (linearObservable a) := by + have ht (i : Fin n) (hi : i ∈ A) : a i^2 ≤ B^2*(alphaSite W i*a i^2) := by + have hZ := cavityNormalization_ge_one W i + have hα := alphaSite_pos W i + have hsq := pow_le_pow_left₀ (by linarith : 0 ≤ cavityNormalization W i) (hz i hi) 2 + have hh := alphaSite_normalization W i + have hmul := mul_le_mul_of_nonneg_left hsq hα.le + have hn : 1 ≤ B^2*alphaSite W i := by nlinarith + nlinarith [mul_le_mul_of_nonneg_right hn (sq_nonneg (a i))] + calc + _ ≤ ∑ i ∈ A, B^2*(alphaSite W i*a i^2) := Finset.sum_le_sum ht + _ = B^2*(∑ i ∈ A, alphaSite W i*a i^2) := by rw [Finset.mul_sum] + _ ≤ B^2*(∑ i : Fin n, alphaSite W i*a i^2) := by + apply mul_le_mul_of_nonneg_left _ (sq_nonneg B) + exact Finset.sum_le_sum_of_subset_of_nonneg (Finset.subset_univ A) (fun i _ _ => mul_nonneg (alphaSite_pos W i).le (sq_nonneg _)) + _ = _ := by rw [dirichlet_linear_eq] + +def restrictCoeff (A : Finset (Fin n)) (a : Fin n → ℝ) : Fin n → ℝ := fun i => if i ∈ A then a i else 0 + +lemma restrictCoeff_sum_sq (A : Finset (Fin n)) (a : Fin n → ℝ) : + (∑ i : Fin n, restrictCoeff A a i^2) = ∑ i ∈ A, a i^2 := by + simp [restrictCoeff,ite_pow,Finset.sum_ite_mem] + +lemma restrictCoeff_linear (A : Finset (Fin n)) (a : Fin n → ℝ) (x : Spin n) : + linearObservable (restrictCoeff A a) x = ∑ i ∈ A, a i*spinValue (x i) := by + simp [linearObservable,restrictCoeff,ite_mul,Finset.sum_ite_mem] + +lemma restrictCoeff_linear_sq (A : Finset (Fin n)) (a : Fin n → ℝ) (x : Spin n) : + linearObservable (restrictCoeff A a) x^2 ≤ (A.card:ℝ)*(∑ i ∈ A, a i^2) := by + rw [restrictCoeff_linear] + have hh := Finset.sum_mul_sq_le_sq_mul_sq A a (fun i => spinValue (x i)) + simp only [spinValue_sq,Finset.sum_const,nsmul_eq_mul,mul_one] at hh + nlinarith + +lemma variance_linear_split_bound (A : Finset (Fin n)) (a : Fin n → ℝ) {B K : ℝ} + (hB : 0 ≤ B) (hK : 0 ≤ K) (hzG : ∀ i ∈ A, cavityNormalization W i ≤ B) + (hzB : ∀ i ∈ Aᶜ, cavityNormalization W i ≤ K) : + variance W (linearObservable a) ≤ + (2*B^2*covarianceNorm W+2*(Aᶜ.card:ℝ)*K^2)*dirichlet W (linearObservable a) := by + have hsplit (x : Spin n) : linearObservable a x = linearObservable (restrictCoeff A a) x+linearObservable (restrictCoeff Aᶜ a) x := by + rw [restrictCoeff_linear,restrictCoeff_linear,Finset.sum_add_sum_compl] + rfl + have hv : variance W (linearObservable a) ≤ 2*variance W (linearObservable (restrictCoeff A a))+2*variance W (linearObservable (restrictCoeff Aᶜ a)) := by + simp only [variance,mean_linearObservable,sub_zero] + rw [← mean_const_mul,← mean_const_mul,← mean_add] + apply mean_mono + intro x + rw [hsplit] + nlinarith [sq_nonneg (linearObservable (restrictCoeff A a) x-linearObservable (restrictCoeff Aᶜ a) x)] + have hG := variance_linear_norm_bound W (restrictCoeff A a) + rw [restrictCoeff_sum_sq] at hG + have hGB := linear_dirichlet_coeff_bound W A a hB hzG + have hBC := linear_dirichlet_coeff_bound W Aᶜ a hK hzB + have hVB : variance W (linearObservable (restrictCoeff Aᶜ a)) ≤ (Aᶜ.card:ℝ)*(∑ i ∈ Aᶜ, a i^2) := by + rw [variance,mean_linearObservable] + simp only [sub_zero] + exact (mean_mono W (restrictCoeff_linear_sq Aᶜ a)).trans_eq (mean_const _ _) + have hN : 0 ≤ covarianceNorm W := norm_nonneg _ + have hC : 0 ≤ (Aᶜ.card:ℝ) := Nat.cast_nonneg _ + nlinarith [mul_le_mul_of_nonneg_left hGB hN,mul_le_mul_of_nonneg_left hBC hC] + +lemma linear_ratio_global_bound (a : Fin n → ℝ) (ha : a ≠ 0) : + variance W (linearObservable a)/dirichlet W (linearObservable a) ≤ + covarianceNorm W*(∑ i : Fin n, cavityNormalization W i)^2 := by + let B := ∑ i : Fin n, cavityNormalization W i + have hB : 0 ≤ B := Finset.sum_nonneg fun i _ => by linarith [cavityNormalization_ge_one W i] + have hZ (i : Fin n) (_ : i ∈ Finset.univ) : cavityNormalization W i ≤ B := + Finset.single_le_sum (fun j _ => by linarith [cavityNormalization_ge_one W j]) (Finset.mem_univ i) + have hd := linear_dirichlet_coeff_bound W Finset.univ a hB hZ + have hV := variance_linear_norm_bound W a + apply (div_le_iff₀ (dirichlet_linear_pos W ha)).mpr + have hN : 0 ≤ covarianceNorm W := norm_nonneg _ + nlinarith [mul_le_mul_of_nonneg_left hd hN] + +lemma linear_ratios_bdd : BddAbove {r : ℝ | ∃ a : Fin n → ℝ, a ≠ 0 ∧ r = variance W (linearObservable a)/dirichlet W (linearObservable a)} := by + refine ⟨covarianceNorm W*(∑ i : Fin n, cavityNormalization W i)^2,?_⟩ + rintro r ⟨a,ha,rfl⟩ + exact linear_ratio_global_bound W a ha + +lemma linear_ratios_nonempty (hn : 0 < n) : Set.Nonempty {r : ℝ | ∃ a : Fin n → ℝ, a ≠ 0 ∧ r = variance W (linearObservable a)/dirichlet W (linearObservable a)} := by + refine ⟨_,(fun _ => 1),?_,rfl⟩ + intro hh + have he := congrFun hh ⟨0,hn⟩ + norm_num at he + +lemma linear_ratio_le (a : Fin n → ℝ) (ha : a ≠ 0) : + variance W (linearObservable a)/dirichlet W (linearObservable a) ≤ linearRayleigh W := + le_csSup (linear_ratios_bdd W) ⟨a,ha,rfl⟩ + +lemma linearRayleigh_split_bound (hn : 0 < n) (A : Finset (Fin n)) {B K : ℝ} + (hB : 0 ≤ B) (hK : 0 ≤ K) (hzG : ∀ i ∈ A, cavityNormalization W i ≤ B) + (hzB : ∀ i ∈ Aᶜ, cavityNormalization W i ≤ K) : + linearRayleigh W ≤ 2*B^2*covarianceNorm W+2*(Aᶜ.card:ℝ)*K^2 := by + apply csSup_le (linear_ratios_nonempty W hn) + rintro r ⟨a,ha,rfl⟩ + exact (div_le_iff₀ (dirichlet_linear_pos W ha)).mpr (variance_linear_split_bound W A a hB hK hzG hzB) + +lemma linearRayleigh_smallBall (a : Fin n → ℝ) (ha : ∑ i, a i^2 = 1) {b : ℝ} (hb : 0 ≤ b) : + b^2*(1-linearSmallBall W a b) ≤ linearRayleigh W := by + have hane : a ≠ 0 := by intro hh; simp only [hh,Pi.zero_apply,zero_pow (by norm_num : (2:ℕ) ≠ 0),Finset.sum_const_zero] at ha; norm_num at ha + have hd := dirichlet_linear_le W a + rw [ha] at hd + have hdp := dirichlet_linear_pos W hane + have hV := variance_linear_nonneg W a + have hr : variance W (linearObservable a) ≤ variance W (linearObservable a)/dirichlet W (linearObservable a) := + (le_div_iff₀ hdp).mpr (by nlinarith) + exact (variance_linear_smallBall W a hb).trans (hr.trans (linear_ratio_le W a hane)) + +end + +section + +open Set Filter MeasureTheory + +variable {n : ℕ} + +lemma variance_linear_continuous (a : Fin n → ℝ) : Continuous (fun W : Disorder n => variance W (linearObservable a)) := by + simp_rw [variance,mean_linearObservable] + simp only [sub_zero,mean] + apply continuous_finsetSum + intro x _ + exact (gibbs_continuous x).mul continuous_const + +lemma alphaSite_continuous (i : Fin n) : Continuous (fun W : Disorder n => alphaSite W i) := by + unfold alphaSite mean + apply continuous_finsetSum + intro x _ + exact (gibbs_continuous x).mul (((Real.continuous_cosh.comp (localField_continuous i x)).inv₀ (fun _ => (Real.cosh_pos _).ne')).pow 2) + +lemma dirichlet_linear_continuous (a : Fin n → ℝ) : Continuous (fun W : Disorder n => dirichlet W (linearObservable a)) := by + simp only [dirichlet_linear_eq] + apply continuous_finsetSum + intro i _ + exact (alphaSite_continuous i).mul continuous_const + +lemma linear_ratio_continuous (a : Fin n → ℝ) (ha : a ≠ 0) : + Continuous (fun W : Disorder n => variance W (linearObservable a)/dirichlet W (linearObservable a)) := + (variance_linear_continuous a).div (dirichlet_linear_continuous a) (fun W => (dirichlet_linear_pos W ha).ne') + +lemma linearRayleigh_eq_iSup (W : Disorder n) : linearRayleigh W = + ⨆ a : {a : Fin n → ℝ // a ≠ 0}, variance W (linearObservable a.val)/dirichlet W (linearObservable a.val) := by + change sSup _ = sSup _ + congr 1 + ext r + constructor + · rintro ⟨a,ha,rfl⟩ + exact ⟨⟨a,ha⟩,rfl⟩ + · rintro ⟨a,rfl⟩ + exact ⟨a.val,a.property,rfl⟩ + +lemma linearRayleigh_measurable (n : ℕ) : Measurable (linearRayleigh (n := n)) := by + have hh : LowerSemicontinuous (linearRayleigh (n := n)) := by + change LowerSemicontinuous (fun W : Disorder n => linearRayleigh W) + simp_rw [linearRayleigh_eq_iSup] + apply lowerSemicontinuous_ciSup + · intro W + refine ⟨covarianceNorm W*(∑ i : Fin n, cavityNormalization W i)^2,?_⟩ + rintro r ⟨a,rfl⟩ + exact linear_ratio_global_bound W a.val a.property + · intro a + exact (linear_ratio_continuous a.val a.property).lowerSemicontinuous + exact hh.measurable + +end + +open Set Filter MeasureTheory + +lemma shift_rpow_neg_tendsto {p : ℝ} (hp : 0 < p) : Tendsto (fun n : ℕ => (n+4:ℝ)^(-p)) atTop (𝓝 0) := by + have hh := (tendsto_rpow_neg_atTop hp).comp ((tendsto_natCast_atTop_atTop (R := ℝ)).comp (tendsto_add_atTop_nat 4)) + simpa only [Function.comp_def,Nat.cast_add,Nat.cast_ofNat] using hh + +lemma cavity_max_rate_identity {x : ℝ} (hx : 0 < x) : + x*(2*Real.exp 20000/(x^(1/100:ℝ))^200) = (2*Real.exp 20000)*x^(-1:ℝ) := by + rw [← Real.rpow_mul_natCast hx.le] + norm_num + rw [Real.rpow_neg_one] + field_simp + +lemma cavity_count_rate_identity {x : ℝ} (hx : 0 < x) : + x*(Real.exp 1*(Real.exp 1-1)*x^(-1/2:ℝ))/x^(3/5:ℝ) = (Real.exp 1*(Real.exp 1-1))*x^(-1/10:ℝ) := by + calc + _ = (Real.exp 1*(Real.exp 1-1))*(x^((1:ℝ))*x^(-1/2:ℝ)/x^(3/5:ℝ)) := by rw [Real.rpow_one]; ring + _ = _ := by rw [← Real.rpow_add hx,← Real.rpow_sub hx]; congr 2; norm_num + +lemma cavity_overlap_rate_identity {x : ℝ} (hx : 0 < x) : + 2*(x^(1/100:ℝ))^2*(x^(-3/5:ℝ)+x⁻¹^2)/x^(-1/2:ℝ) = + 2*(x^(-2/25:ℝ)+x^(-37/25:ℝ)) := by + have he : x⁻¹^2 = x^(-2:ℝ) := by rw [Real.rpow_neg hx.le,Real.rpow_two,inv_pow] + rw [he,← Real.rpow_mul_natCast hx.le] + norm_num only [Nat.cast_ofNat] + calc + _ = 2*((x^(1/100*2:ℝ)*x^(-3/5:ℝ)/x^(-1/2:ℝ))+(x^(1/100*2:ℝ)*x^(-2:ℝ)/x^(-1/2:ℝ))) := by ring_nf + _ = _ := by rw [← Real.rpow_add hx,← Real.rpow_sub hx,← Real.rpow_add hx,← Real.rpow_sub hx]; congr 2 <;> norm_num + +lemma cavity_overlap_rate_eventually : ∀ᶠ n : ℕ in atTop, + 2*((n+4:ℝ)^(1/100:ℝ))^2*((n+4:ℝ)^(-3/5:ℝ)+(n+4:ℝ)⁻¹^2) ≤ (n+4:ℝ)^(-1/2:ℝ) := by + have hh := ((shift_rpow_neg_tendsto (by norm_num : (0:ℝ)<2/25)).add (shift_rpow_neg_tendsto (by norm_num : (0:ℝ)<37/25))).const_mul 2 + simp only [mul_zero,add_zero] at hh + filter_upwards [hh.eventually (gt_mem_nhds (by norm_num : (0:ℝ)<1))] with n hn + apply (div_le_one (by positivity : (0:ℝ)<(n+4:ℝ)^(-1/2:ℝ))).mp + rw [cavity_overlap_rate_identity (by positivity)] + simpa only [neg_div] using hn.le + +lemma rayleigh_error_rate_identity {x : ℝ} (hx : 0 < x) : + (x^(3/5:ℝ)*(x^(1/100:ℝ))^2)/x^(2/3:ℝ) = x^(-7/150:ℝ) := by + rw [← Real.rpow_mul_natCast hx.le,← Real.rpow_add hx,← Real.rpow_sub hx] + norm_num + +lemma rayleigh_error_rate_eventually : ∀ᶠ n : ℕ in atTop, + (n+4:ℝ)^(3/5:ℝ)*((n+4:ℝ)^(1/100:ℝ))^2 ≤ (n+4:ℝ)^(2/3:ℝ) := by + filter_upwards [(shift_rpow_neg_tendsto (by norm_num : (0:ℝ)<7/150)).eventually (gt_mem_nhds (by norm_num : (0:ℝ)<1))] with n hn + apply (div_le_one (by positivity : (0:ℝ)<(n+4:ℝ)^(2/3:ℝ))).mp + rw [rayleigh_error_rate_identity (by positivity)] + simpa only [neg_div] using hn.le + +lemma cavity_max_tail_zero : Tendsto (fun n : ℕ => (disorderLaw (n+4)).real + {W | ∃ i, (n+4:ℝ)^(1/100:ℝ) ≤ cavityNormalization W i}) atTop (𝓝 0) := by + apply squeeze_zero (fun _ => measureReal_nonneg) + (g := fun n : ℕ => (2*Real.exp 20000)*(n+4:ℝ)^(-1:ℝ)) + · intro n + have hh := all_cavity_tail (n := n+4) (by positivity : (0:ℝ)<(n+4:ℝ)^(1/100:ℝ)) 200 + norm_num only [Nat.cast_add,Nat.cast_ofNat] at hh + rwa [cavity_max_rate_identity (by positivity)] at hh + · simpa using (shift_rpow_neg_tendsto (by norm_num : (0:ℝ)<1)).const_mul (2*Real.exp 20000) + +lemma cavity_count_tail_zero : Tendsto (fun n : ℕ => (disorderLaw (n+4)).real + {W | (n+4:ℝ)^(3/5:ℝ) ≤ cavityClippedCount W ((n+4:ℝ)^(-1/2:ℝ))}) atTop (𝓝 0) := by + apply squeeze_zero (fun _ => measureReal_nonneg) + (g := fun n : ℕ => (Real.exp 1*(Real.exp 1-1))*(n+4:ℝ)^(-1/10:ℝ)) + · intro n + have hh := cavityClippedCount_tail (n := n+4) (by positivity : (0:ℝ)≤(n+4:ℝ)^(-1/2:ℝ)) (by positivity : (0:ℝ)<(n+4:ℝ)^(3/5:ℝ)) + norm_num only [Nat.cast_add,Nat.cast_ofNat] at hh + simp only [← neg_div] at hh + rwa [cavity_count_rate_identity (by positivity)] at hh + · simpa only [mul_zero,neg_div] using (shift_rpow_neg_tendsto (by norm_num : (0:ℝ)<1/10)).const_mul (Real.exp 1*(Real.exp 1-1)) + +lemma cavity_overlap_tail_zero : Tendsto (fun n : ℕ => (disorderLaw (n+4)).real + {W | (n+4:ℝ)^(-3/5:ℝ) ≤ gibbsOverlap W}) atTop (𝓝 0) := by + apply tendsto_order.mpr + constructor + · intro a ha + exact Eventually.of_forall (fun _ => ha.trans_le measureReal_nonneg) + · intro a ha + obtain ⟨C,_hC,hp⟩ := natural_GibbsOverlap_tight ha + have ht : Tendsto (fun n : ℕ => (n+4:ℝ)^(1/15:ℝ)) atTop atTop := by + have hh := (tendsto_rpow_atTop (by norm_num : (0:ℝ)<1/15)).comp ((tendsto_natCast_atTop_atTop (R := ℝ)).comp (tendsto_add_atTop_nat 4)) + simpa only [Function.comp_def,Nat.cast_add,Nat.cast_ofNat] using hh + filter_upwards [hp,tendsto_atTop.mp ht C] with n hn hCn + refine lt_of_le_of_lt (measureReal_mono ?_) hn + intro W hW + change C/(n+4:ℝ)^(2/3:ℝ) ≤ gibbsOverlap W + change (n+4:ℝ)^(-3/5:ℝ) ≤ gibbsOverlap W at hW + apply le_trans _ hW + apply (div_le_iff₀ (by positivity : (0:ℝ)<(n+4:ℝ)^(2/3:ℝ))).mpr + rw [← Real.rpow_add (by positivity : (0:ℝ) cavityNormalization W i ≤ Real.exp 1+1) + have hcard : (Aᶜ.card:ℝ) = cavityClippedCount W ((n+4:ℝ)^(-1/2:ℝ)) := by + rw [cavityClippedCount] + have he (i : Fin (n+4)) : i ∈ Aᶜ ↔ Real.exp 1+1 < cavityNormalization W i := by simp [A] + calc + _ = ∑ i : Fin (n+4), if i ∈ Aᶜ then (1:ℝ) else 0 := by rw [← Finset.sum_filter]; simp only [Finset.filter_mem_eq_inter,Finset.univ_inter,Finset.sum_const,nsmul_eq_mul,mul_one] + _ = _ := by + apply Finset.sum_congr rfl + intro i _ + simp only [he,hR i,and_true] + have hb := linearRayleigh_split_bound W (by omega : 0 (Finset.mem_filter.mp hi).2) (fun i _ => (hZ i).le) + rw [hcard] at hb + have hm := mul_le_mul_of_nonneg_right hC.le (sq_nonneg ((n+4:ℝ)^(1/100:ℝ))) + linarith + +lemma linearRayleigh_cavity_comparison : ∀ α : ℝ, 0 < α → ∀ᶠ n : ℕ in atTop, + (disorderLaw (n+4)).real {W | 2*(Real.exp 1+1)^2*covarianceNorm W+2*(n+4:ℝ)^(2/3:ℝ) < linearRayleigh W} < α := by + intro α hα + filter_upwards [cavity_overlap_rate_eventually,rayleigh_error_rate_eventually, + cavity_max_tail_zero.eventually (gt_mem_nhds (show 0<α/3 by positivity)), + cavity_overlap_tail_zero.eventually (gt_mem_nhds (show 0<α/3 by positivity)), + cavity_count_tail_zero.eventually (gt_mem_nhds (show 0<α/3 by positivity))] with n hr he hZ hQ hC + have hs : {W : Disorder (n+4) | 2*(Real.exp 1+1)^2*covarianceNorm W+2*(n+4:ℝ)^(2/3:ℝ) < linearRayleigh W} ⊆ + ({W | ∃ i, (n+4:ℝ)^(1/100:ℝ) ≤ cavityNormalization W i} ∪ {W | (n+4:ℝ)^(-3/5:ℝ) ≤ gibbsOverlap W}) ∪ + {W | (n+4:ℝ)^(3/5:ℝ) ≤ cavityClippedCount W ((n+4:ℝ)^(-1/2:ℝ))} := by + intro W hW + by_contra hh + simp only [mem_union,mem_ofPred_eq,not_or,not_exists,not_le] at hh + exact (not_lt_of_ge (rayleigh_cavity_good_bound n W hr he hh.1.1 hh.1.2 hh.2)) hW + have hp := (measureReal_mono (μ := disorderLaw (n+4)) hs).trans (measureReal_union_le _ _) + have hp' := measureReal_union_le (μ := disorderLaw (n+4)) + {W | ∃ i, (n+4:ℝ)^(1/100:ℝ) ≤ cavityNormalization W i} {W | (n+4:ℝ)^(-3/5:ℝ) ≤ gibbsOverlap W} + linarith + +lemma linearRayleigh_lower_tight {α : ℝ} (hα : 0 < α) : + ∃ c : ℝ, 0 < c ∧ ∀ᶠ n : ℕ in atTop, (disorderLaw (n+4)).real + {W | linearRayleigh W ≤ c*(n+4:ℝ)^(2/3:ℝ)} < α := by + obtain ⟨b,hb,hp⟩ := natural_smallBall_tight (by norm_num : (0:ℝ) < 1/2) hα + refine ⟨b^2/2,by positivity,?_⟩ + filter_upwards [hp] with n hn + refine lt_of_le_of_lt (measureReal_mono ?_) hn + intro W hW u hu + have husq : ∑ i, u i^2 = 1 := by + rw [← EuclideanSpace.real_norm_sq_eq u,hu,one_pow] + have hV := linearRayleigh_smallBall W (fun i => u i) husq (show 0 ≤ b*(n+4:ℝ)^(1/3:ℝ) by positivity) + rw [mul_pow,third_power_square (by positivity : (0:ℝ) ≤ n+4)] at hV + change linearRayleigh W ≤ b^2/2*(n+4:ℝ)^(2/3:ℝ) at hW + have hP : 0 < b^2*(n+4:ℝ)^(2/3:ℝ) := by positivity + nlinarith + +lemma linearRayleigh_upper_tight {α : ℝ} (hα : 0 < α) : + ∃ C : ℝ, 0 < C ∧ ∀ᶠ n : ℕ in atTop, (disorderLaw (n+4)).real + {W | C*(n+4:ℝ)^(2/3:ℝ) ≤ linearRayleigh W} < α := by + obtain ⟨K,hK,hp⟩ := covariance_upper_tight (show 0<α/2 by positivity) + let C := 2*(Real.exp 1+1)^2*K+3 + refine ⟨C,by dsimp [C]; positivity,?_⟩ + filter_upwards [hp,linearRayleigh_cavity_comparison (α/2) (by positivity)] with n hn hc + have hs : {W : Disorder (n+4) | C*(n+4:ℝ)^(2/3:ℝ) ≤ linearRayleigh W} ⊆ + {W | K*(n+4:ℝ)^(2/3:ℝ) ≤ covarianceNorm W} ∪ + {W | 2*(Real.exp 1+1)^2*covarianceNorm W+2*(n+4:ℝ)^(2/3:ℝ) < linearRayleigh W} := by + intro W hW + by_cases hh : K*(n+4:ℝ)^(2/3:ℝ) ≤ covarianceNorm W + · exact Or.inl hh + · right + change C*(n+4:ℝ)^(2/3:ℝ) ≤ linearRayleigh W at hW + have hN := lt_of_not_ge hh + have hmul := mul_lt_mul_of_pos_left hN (show 0<2*(Real.exp 1+1)^2 by positivity) + dsimp only [C] at hW + have hpN : 0<(n+4:ℝ)^(2/3:ℝ) := by positivity + change 2*(Real.exp 1+1)^2*covarianceNorm W+2*(n+4:ℝ)^(2/3:ℝ) < linearRayleigh W + nlinarith + have hb := (measureReal_mono (μ := disorderLaw (n+4)) hs).trans (measureReal_union_le _ _) + linarith + +theorem linearRayleigh_natural_scale (M : ℕ → ℝ) (hMpos : ∀ n, 0 < M n) (hM : Tendsto M atTop atTop) : + Tendsto (fun n => (disorderLaw n).real {W | + (n:ℝ)^(2/3:ℝ)/M n ≤ linearRayleigh W ∧ linearRayleigh W ≤ M n*(n:ℝ)^(2/3:ℝ)}) atTop (𝓝 1) := by + apply (tendsto_add_atTop_iff_nat 4).mp + have hh := tight_interval_limit (fun n => disorderLaw (n+4)) (fun _ W => linearRayleigh W) + (fun n => linearRayleigh_measurable (n+4)) + (fun n => (n+4:ℝ)^(2/3:ℝ)) (fun _ => by positivity) + (fun _ hα => linearRayleigh_lower_tight hα) (fun _ hα => linearRayleigh_upper_tight hα) + (fun n => M (n+4)) (fun n => hMpos (n+4)) (hM.comp (tendsto_add_atTop_nat 4)) + simpa only [Nat.cast_add,Nat.cast_ofNat] using hh + +lemma probability_intersection_tendsto_one {X : ℕ → Type*} [∀ n, MeasurableSpace (X n)] + (μ : ∀ n, Measure (X n)) [∀ n, IsProbabilityMeasure (μ n)] + (A B : ∀ n, Set (X n)) (_hA : ∀ n, MeasurableSet (A n)) (hB : ∀ n, MeasurableSet (B n)) + (hpA : Tendsto (fun n => (μ n).real (A n)) atTop (𝓝 1)) + (hpB : Tendsto (fun n => (μ n).real (B n)) atTop (𝓝 1)) : + Tendsto (fun n => (μ n).real (A n ∩ B n)) atTop (𝓝 1) := by + apply tendsto_of_tendsto_of_tendsto_of_le_of_le (g := fun n => (μ n).real (A n)+(μ n).real (B n)-1) (h := fun _ => (1:ℝ)) + · simpa using (hpA.add hpB).sub_const 1 + · exact tendsto_const_nhds + · intro n + have hadd := measureReal_union_add_inter (μ := μ n) (s := A n) (hB n) + have hle : (μ n).real (A n ∪ B n) ≤ 1 := measureReal_le_one + linarith + · exact fun _ => measureReal_le_one + +theorem covariance_and_linear_tests (M : ℕ → ℝ) + (hMpos : ∀ n, 0 < M n) (hM : Tendsto M atTop atTop) : + Tendsto (fun n : ℕ => (disorderLaw n {W | + (n : ℝ) ^ ((2 : ℝ) / 3) / M n ≤ covarianceNorm W ∧ + covarianceNorm W ≤ M n * (n : ℝ) ^ ((2 : ℝ) / 3) ∧ + (n : ℝ) ^ ((2 : ℝ) / 3) / M n ≤ linearRayleigh W ∧ + linearRayleigh W ≤ M n * (n : ℝ) ^ ((2 : ℝ) / 3)}).toReal) atTop (𝓝 1) := by + have hh := probability_intersection_tendsto_one disorderLaw + (fun n => {W | (n:ℝ)^(2/3:ℝ)/M n ≤ covarianceNorm W ∧ covarianceNorm W ≤ M n*(n:ℝ)^(2/3:ℝ)}) + (fun n => {W | (n:ℝ)^(2/3:ℝ)/M n ≤ linearRayleigh W ∧ linearRayleigh W ≤ M n*(n:ℝ)^(2/3:ℝ)}) + (fun n => (measurableSet_le measurable_const (covarianceNorm_continuous n).measurable).inter (measurableSet_le (covarianceNorm_continuous n).measurable measurable_const)) + (fun n => (measurableSet_le measurable_const (linearRayleigh_measurable n)).inter (measurableSet_le (linearRayleigh_measurable n) measurable_const)) + (covariance_natural_scale M hMpos hM) (linearRayleigh_natural_scale M hMpos hM) + simpa only [Set.inter_def,Set.mem_ofPred_eq,and_assoc,Measure.real] using hh + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/RelaxationBounds.lean b/lean/OAI/MathematicalPhysics/CriticalSK/RelaxationBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..66915d35b6ccb4e1b721ba5ac0b43dff0e0aef9b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/RelaxationBounds.lean @@ -0,0 +1,169 @@ +import OAI.MathematicalPhysics.CriticalSK.VariationalDefinitions + +namespace OAI + +noncomputable section +open scoped BigOperators Topology NNReal ENNReal +open MeasureTheory ProbabilityTheory Filter +namespace CriticalSK + +section FullRelaxation +variable {n : ℕ} (W : Disorder n) + +lemma kernel_energy_pair_identity (K : Matrix (Spin n) (Spin n) ℝ) + (hrow : ∀ x, ∑ y, K x y = 1) + (hstat : ∀ y, ∑ x, gibbs W x * K x y = gibbs W y) + (f : Spin n → ℝ) : + mean W (fun x => ∑ y, K x y * (f x - f y) ^ 2) = + 2 * mean W (fun x => f x * (f x - K.mulVec f x)) := by + have ht (x : Spin n) : (∑ y, K x y * (f x - f y) ^ 2) = + (f x ^ 2 - 2 * (f x * K.mulVec f x)) + K.mulVec (fun y => f y ^ 2) x := by + calc + _ = ∑ y, (K x y * f x ^ 2 - 2 * (f x * (K x y * f y)) + K x y * f y ^ 2) := by + apply Finset.sum_congr rfl + intro y _ + ring + _ = _ := by + simp only [Finset.sum_add_distrib, Finset.sum_sub_distrib, ← Finset.mul_sum, + ← Finset.sum_mul, hrow, one_mul, Matrix.mulVec, dotProduct] + simp_rw [ht] + rw [mean_add, mean_sub, mean_const_mul, mean_kernel W K hstat] + have he (x : Spin n) : f x * (f x - K.mulVec f x) = + f x ^ 2 - f x * K.mulVec f x := by ring + simp_rw [he] + rw [mean_sub] + ring + +lemma variance_pair_identity (f : Spin n → ℝ) : + mean W (fun x => ∑ y, gibbs W y * (f x - f y) ^ 2) = 2 * variance W f := by + have hh := kernel_energy_pair_identity W (fun _ y => gibbs W y) + (fun _ => gibbs_sum W) + (fun y => by simp only [← Finset.sum_mul, gibbs_sum, one_mul]) f + have hmul (x : Spin n) : + Matrix.mulVec (fun _ y : Spin n => gibbs W y) f x = mean W f := rfl + simp_rw [hmul] at hh + rw [hh] + congr 1 + have he (x : Spin n) : f x * (f x - mean W f) = f x ^ 2 - f x * mean W f := by ring + simp_rw [he] + rw [mean_sub, mean_mul_const] + have hs := mean_square_center_identity W f 0 + simp only [sub_zero] at hs + nlinarith + +lemma kernel_energy_minorization (K : Matrix (Spin n) (Spin n) ℝ) + (hrow : ∀ x, ∑ y, K x y = 1) + (hstat : ∀ y, ∑ x, gibbs W x * K x y = gibbs W y) + {c : ℝ} (hminor : ∀ x y, c * gibbs W y ≤ K x y) (f : Spin n → ℝ) : + c * variance W f ≤ mean W (fun x => f x * (f x - K.mulVec f x)) := by + have hh : c * mean W (fun x => ∑ y, gibbs W y * (f x - f y) ^ 2) ≤ + mean W (fun x => ∑ y, K x y * (f x - f y) ^ 2) := by + rw [← mean_const_mul] + apply mean_mono + intro x + rw [Finset.mul_sum] + apply Finset.sum_le_sum + intro y _ + simpa only [mul_assoc] using mul_le_mul_of_nonneg_right (hminor x y) (sq_nonneg (f x - f y)) + rw [variance_pair_identity, kernel_energy_pair_identity W K hrow hstat] at hh + linarith + +lemma exists_finite_poincare (hn : 0 < n) : + ∃ C : ℝ, 0 < C ∧ ∀ f : Spin n → ℝ, variance W f ≤ C * dirichlet W f := by + classical + let T : Finset ℝ := Finset.univ.image (fun p : Spin n × Spin n => (discreteKernel W ^ n) p.1 p.2) + have hT : T.Nonempty := Finset.Nonempty.image Finset.univ_nonempty _ + let c := T.min' hT + have hc : 0 < c := by + obtain ⟨p, _, hp⟩ := Finset.mem_image.mp (Finset.min'_mem T hT) + dsimp only [c] + rw [← hp] + exact discreteKernel_power_pos W hn p.1 p.2 + have hminor : ∀ x y, c * gibbs W y ≤ (discreteKernel W ^ n) x y := by + intro x y + calc + _ ≤ c := by simpa only [mul_one] using mul_le_mul_of_nonneg_left (gibbs_le_one W y) hc.le + _ ≤ _ := Finset.min'_le T _ (Finset.mem_image.mpr ⟨(x, y), Finset.mem_univ _, rfl⟩) + refine ⟨c⁻¹, inv_pos.mpr hc, fun f => ?_⟩ + have hlow := kernel_energy_minorization W (discreteKernel W ^ n) + (kernel_pow_sum (discreteKernel_sum W hn) n) + (kernel_pow_stationary (discreteKernel_stationary W hn) n) hminor f + have hup := discrete_inner_increment_le W hn n f + rw [div_self (Nat.cast_ne_zero.mpr (Nat.ne_of_gt hn)), one_mul] at hup + have hh : c * variance W f ≤ dirichlet W f := hlow.trans hup + have := (le_div_iff₀ hc).mpr (by simpa only [mul_comm] using hh) + simpa only [div_eq_mul_inv, mul_comm] using this + +lemma variance_nonneg_full (f : Spin n → ℝ) : 0 ≤ variance W f := + mean_nonneg W (fun _ => sq_nonneg _) + +lemma dirichlet_le_sites_variance (f : Spin n → ℝ) : + dirichlet W f ≤ (n : ℝ) * variance W f := by + calc + _ ≤ ∑ _i : Fin n, variance W f := by + apply Finset.sum_le_sum + intro i _ + exact siteAverage_least_squares W i f (fun _ => mean W f) (fun _ _ _ => rfl) + _ = _ := by simp + +lemma variance_linear_pos_full {a : Fin n → ℝ} (ha : a ≠ 0) : + 0 < variance W (linearObservable a) := by + have hdpos := dirichlet_linear_pos W ha + have hd := dirichlet_le_sites_variance W (linearObservable a) + by_contra h + have ht := mul_nonpos_of_nonneg_of_nonpos (Nat.cast_nonneg n) (le_of_not_gt h) + linarith + +lemma full_ratios_bdd (hn : 0 < n) : + BddAbove {r : ℝ | ∃ f : Spin n → ℝ, 0 < variance W f ∧ + r = variance W f / dirichlet W f} := by + obtain ⟨C, hC, hgap⟩ := exists_finite_poincare W hn + refine ⟨C, ?_⟩ + rintro r ⟨f, hf, rfl⟩ + have hd : 0 < dirichlet W f := by + by_contra h + have ht := mul_nonpos_of_nonneg_of_nonpos hC.le (le_of_not_gt h) + have hh := hgap f + linarith + exact (div_le_iff₀ hd).mpr (hgap f) + +lemma linearRayleigh_le_relaxationTime (hn : 0 < n) : + linearRayleigh W ≤ relaxationTime W := by + apply csSup_le (linear_ratios_nonempty W hn) + rintro r ⟨a, ha, rfl⟩ + exact le_csSup (full_ratios_bdd W hn) ⟨linearObservable a, variance_linear_pos_full W ha, rfl⟩ + +end FullRelaxation + +theorem critical_relaxation_lower_bound (δ : ℝ) (hδ : 0 < δ) : + Tendsto (fun n => (disorderLaw n).real + {W | (n : ℝ) ^ (2 / 3 - δ) ≤ relaxationTime W}) atTop (𝓝 1) := by + let M : ℕ → ℝ := fun n => if n = 0 then 1 else (n : ℝ) ^ δ + have hMpos : ∀ n, 0 < M n := by + intro n + by_cases hn : n = 0 + · simp [M, hn] + · simpa only [M, ite_eq_right hn] using Real.rpow_pos_of_pos (Nat.cast_pos.mpr (Nat.pos_of_ne_zero hn)) δ + have hMeq : (fun n : ℕ => (n : ℝ) ^ δ) =ᶠ[atTop] M := by + filter_upwards [eventually_gt_atTop 0] with n hn + simp [M, Nat.ne_of_gt hn] + have hM : Tendsto M atTop atTop := + ((tendsto_rpow_atTop hδ).comp tendsto_natCast_atTop_atTop).congr' hMeq + have hp := linearRayleigh_natural_scale M hMpos hM + apply tendsto_order.mpr + constructor + · intro a ha + filter_upwards [(tendsto_order.mp hp).1 a ha, eventually_gt_atTop 0] with n hn hnpos + refine lt_of_lt_of_le hn (measureReal_mono ?_) + intro W hW + have hlo : (n : ℝ) ^ (2 / 3 - δ) ≤ linearRayleigh W := by + rw [Real.rpow_sub (Nat.cast_pos.mpr hnpos)] + simpa only [M, ite_eq_right (Nat.ne_of_gt hnpos)] using hW.1 + exact hlo.trans (linearRayleigh_le_relaxationTime W hnpos) + · intro a ha + exact Filter.Eventually.of_forall (fun _ => lt_of_le_of_lt measureReal_le_one ha) + +end CriticalSK +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/Resolvent.lean b/lean/OAI/MathematicalPhysics/CriticalSK/Resolvent.lean new file mode 100644 index 0000000000000000000000000000000000000000..43d27ae2707dac3d3c8d2ae6b8c2c26c1e24ae5e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/Resolvent.lean @@ -0,0 +1,443 @@ +import OAI.MathematicalPhysics.CriticalSK.PathSpectra +import OAI.MathematicalPhysics.CriticalSK.Powers +import OAI.MathematicalPhysics.CriticalSK.TriNoise + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open MeasureTheory ProbabilityTheory + +open scoped ENNReal NNReal + +open scoped BigOperators InnerProductSpace + +open Module + +open scoped BigOperators ENNReal NNReal Real Topology + +open MeasureTheory ProbabilityTheory Filter + +open scoped BigOperators NNReal + +open scoped BigOperators + +open Matrix Polynomial + +open scoped BigOperators Topology + +open Filter + +namespace CriticalSK + + +lemma directed_neighbor_sum_general (n : ℕ) (b u : ℕ → ℝ) : + (∑ i : Fin (n+1), ∑ j : Fin (n+1), + (if i.val+1=j.val then b i.val else 0)*u i.val*u j.val) = + ∑ i ∈ Finset.range n, b i*u i*u (i+1) := by + rw [Fin.sum_univ_castSucc] + have hl : (∑ j : Fin (n+1), + (if (Fin.last n).val+1=j.val then b (Fin.last n).val else 0)*u (Fin.last n).val*u j.val) = 0 := by + apply Finset.sum_eq_zero + intro j _ + rw [ite_eq_right (by have := j.isLt; simp only [Fin.val_last]; omega),zero_mul,zero_mul] + rw [hl,add_zero,← Fin.sum_univ_eq_sum_range] + apply Finset.sum_congr rfl + intro i _ + rw [Finset.sum_eq_single i.succ] + · simp + · intro j _ hj + rw [ite_eq_right (fun h => hj (Fin.ext (by simpa using h.symm))),zero_mul,zero_mul] + · simp + +def triSampleMatrix (n : ℕ) (ω : TriSample n) : Matrix (Fin (n+1)) (Fin (n+1)) ℝ := + fun i j => (if i=j then ω.1 i.val else 0)+ + (if i.val+1=j.val then chi (chiRowDim n i.val) (ω.2 i.val)/Real.sqrt (n+1:ℝ) else 0)+ + (if j.val+1=i.val then chi (chiRowDim n j.val) (ω.2 j.val)/Real.sqrt (n+1:ℝ) else 0) + +lemma triSampleMatrix_hermitian (n : ℕ) (ω : TriSample n) : (triSampleMatrix n ω).IsHermitian := by + ext i j + simp only [Matrix.conjTranspose_apply,star_trivial,triSampleMatrix] + by_cases h : i=j + · subst j; ring + · simp only [ite_eq_right h,ite_eq_right (Ne.symm h),zero_add,add_comm] + +def triSampleOperator (n : ℕ) (ω : TriSample n) : EuclideanSpace ℝ (Fin (n+1)) →ₗ[ℝ] + EuclideanSpace ℝ (Fin (n+1)) := Matrix.toLpLin 2 2 (triSampleMatrix n ω) + +lemma triSampleOperator_symmetric (n : ℕ) (ω : TriSample n) : (triSampleOperator n ω).IsSymmetric := + Matrix.isSymmetric_toEuclideanLin_iff.mpr (triSampleMatrix_hermitian n ω) + +lemma generic_tridiagonal_quadratic (n : ℕ) (d b u : ℕ → ℝ) : + (∑ i : Fin (n+1), ∑ j : Fin (n+1), + ((if i=j then d i.val else 0)+(if i.val+1=j.val then b i.val else 0)+ + (if j.val+1=i.val then b j.val else 0))*u j.val*u i.val) = + (∑ i ∈ Finset.range (n+1), d i*u i^2)+2*(∑ i ∈ Finset.range n, b i*u i*u (i+1)) := by + simp only [add_mul,Finset.sum_add_distrib] + have hd : (∑ i : Fin (n+1), ∑ j : Fin (n+1), (if i=j then d i.val else 0)*u j.val*u i.val) = + ∑ i ∈ Finset.range (n+1), d i*u i^2 := by + rw [← Fin.sum_univ_eq_sum_range] + apply Finset.sum_congr rfl + intro i _ + rw [Finset.sum_eq_single i] + · simp; ring + · intro j _ hj; simp [Ne.symm hj] + · simp + have hlo : (∑ i : Fin (n+1), ∑ j : Fin (n+1), + (if i.val+1=j.val then b i.val else 0)*u j.val*u i.val) = + ∑ i ∈ Finset.range n, b i*u i*u (i+1) := by + convert directed_neighbor_sum_general n b u using 1 + apply Finset.sum_congr rfl + intro i _ + apply Finset.sum_congr rfl + intros + ring + have hhi : (∑ i : Fin (n+1), ∑ j : Fin (n+1), + (if j.val+1=i.val then b j.val else 0)*u j.val*u i.val) = + ∑ i ∈ Finset.range n, b i*u i*u (i+1) := by + rw [Finset.sum_comm] + exact directed_neighbor_sum_general n b u + rw [hd,hlo,hhi] + ring + +lemma triSampleOperator_inner (n : ℕ) (ω : TriSample n) (u : ℕ → ℝ) : + inner ℝ (WithLp.toLp 2 (fun i : Fin (n+1) => u i.val)) + (triSampleOperator n ω (WithLp.toLp 2 (fun i : Fin (n+1) => u i.val))) = triForm n ω u := by + simp only [triSampleOperator,Matrix.toLpLin_apply,EuclideanSpace.inner_eq_star_dotProduct, + Pi.star_apply,star_trivial,dotProduct,Matrix.mulVec,triSampleMatrix,Finset.sum_mul] + exact generic_tridiagonal_quadratic n ω.1 (fun i => chi (chiRowDim n i) (ω.2 i)/Real.sqrt (n+1:ℝ)) u + +def extendPath (n : ℕ) (x : EuclideanSpace ℝ (Fin (n+1))) (i : ℕ) : ℝ := + if hi : i extendPath n x i.val)) = x := by + ext i + simp only [extendPath,dite_eq_left i.isLt] + +lemma extendPath_mass (n : ℕ) (x : EuclideanSpace ℝ (Fin (n+1))) : + (∑ i ∈ Finset.range (n+1), extendPath n x i^2) = ‖x‖^2 := by + rw [← Fin.sum_univ_eq_sum_range,EuclideanSpace.real_norm_sq_eq] + apply Finset.sum_congr rfl + intro i _ + simp only [extendPath,dite_eq_left i.isLt] + +lemma pathOperator_energy (n : ℕ) (x : EuclideanSpace ℝ (Fin (n+1))) : + inner ℝ x (pathOperator n x) = 2*‖x‖^2-pathEnergy n (extendPath n x) := by + have h := pathOperator_inner n (extendPath n x) + rw [extendPath_restrict] at h + rw [h,pathEnergy,extendPath_mass] + ring + +lemma pathOperator_inner_le_two (n : ℕ) (x : EuclideanSpace ℝ (Fin (n+1))) (hx : ‖x‖=1) : + inner ℝ x (pathOperator n x) ≤ 2 := by + rw [pathOperator_energy,hx] + have := pathEnergy_nonneg n (extendPath n x) + linarith + +lemma pathOperator_eigenvalue_le_two (n : ℕ) (i : Fin (n+1)) : + (pathOperator_symmetric n).eigenvalues (by simp) i ≤ 2 := by + let h := pathOperator_symmetric n + have hh := pathOperator_inner_le_two n (h.eigenvectorBasis (by simp) i) ((h.eigenvectorBasis (by simp)).norm_eq_one i) + rw [h.apply_eigenvectorBasis] at hh + simpa only [inner_smul_right,real_inner_self_eq_norm_sq, + (h.eigenvectorBasis (by simp)).norm_eq_one i,one_pow,mul_one, + RCLike.ofReal_real_eq_id,id_eq] using hh + +lemma triSampleOperator_form_good (n : ℕ) {ω : TriSample n} {h s : ℝ} + (hh : 0 ≤ h) (hs : scaleEnergy (Nat.clog 8 (n+1)) 0 ≤ s) (hω : ω ∉ triBad n h) + (x : EuclideanSpace ℝ (Fin (n+1))) (hx : ‖x‖=1) : + |inner ℝ x (triSampleOperator n ω x)-inner ℝ x (pathOperator n x)| ≤ + formError n h s (2-inner ℝ x (pathOperator n x)) := by + have hmass : (∑ i ∈ Finset.range (n+1), extendPath n x i^2) = 1 := by rw [extendPath_mass,hx]; norm_num + have hc := triForm_good n hh hs hω (extendPath n x) + (fun i hi => dite_eq_right (by omega)) hmass + have ht := triSampleOperator_inner n ω (extendPath n x) + rw [extendPath_restrict] at ht + rw [ht,pathOperator_energy,hx] + simp only [one_pow,mul_one] + convert hc using 1 + congr 1 + ring + +open MeasureTheory Set + +lemma weighted_resolvent_integrable {s e : ℝ} (hs : 0 < s) (he : 0 ≤ e) : + IntegrableOn (fun t : ℝ => t^(-5/8:ℝ)/(t+e)^2) (Ioi s) := by + apply (integrableOn_Ioi_rpow_of_lt (by norm_num : (-21/8:ℝ) < -1) hs).mono' + · exact ((measurable_id.pow_const _).div ((measurable_id.add_const e).pow_const 2)).aestronglyMeasurable + · filter_upwards [ae_restrict_mem measurableSet_Ioi] with t ht + have ht0 : 0 < t := hs.trans ht + rw [Real.norm_eq_abs,abs_of_nonneg (by positivity)] + calc + t^(-5/8:ℝ)/(t+e)^2 ≤ t^(-5/8:ℝ)/t^2 := by gcongr; linarith + _ = t^(-21/8:ℝ) := by + rw [← Real.rpow_two,← Real.rpow_sub ht0] + norm_num + +lemma fractional_power_integral_bound {s e : ℝ} (hs : 0 < s) (he : 0 ≤ e) : + (s+e)^(-13/8:ℝ) ≤ (13/2:ℝ)*(∫ t : ℝ in Ioi s, t^(-5/8:ℝ)/(t+e)^2) := by + have hx : 0 < s+e := by positivity + have hlo : (∫ t : ℝ in Ioi (s+e), (1/4:ℝ)*t^(-21/8:ℝ)) ≤ + ∫ t : ℝ in Ioi (s+e), t^(-5/8:ℝ)/(t+e)^2 := by + apply integral_mono_ae ((integrableOn_Ioi_rpow_of_lt (by norm_num : (-21/8:ℝ)< -1) hx).const_mul _) (weighted_resolvent_integrable hx he) + filter_upwards [ae_restrict_mem measurableSet_Ioi] with t ht + have ht0 : 0 < t := hx.trans ht + have het : e ≤ t := by change s+e < t at ht; linarith + calc + (1/4:ℝ)*t^(-21/8:ℝ) = t^(-5/8:ℝ)/(2*t)^2 := by + have hp : t^(-21/8:ℝ) = t^(-5/8:ℝ)/t^2 := by + rw [← Real.rpow_two,← Real.rpow_sub ht0]; norm_num + rw [hp]; ring + _ ≤ _ := by gcongr; linarith + have hmono : (∫ t : ℝ in Ioi (s+e), t^(-5/8:ℝ)/(t+e)^2) ≤ + ∫ t : ℝ in Ioi s, t^(-5/8:ℝ)/(t+e)^2 := by + apply integral_mono_measure (Measure.restrict_mono_set _ (Ioi_subset_Ioi (by linarith))) _ + (weighted_resolvent_integrable hs he) + filter_upwards [ae_restrict_mem measurableSet_Ioi] with t ht + exact div_nonneg (Real.rpow_nonneg (hs.trans ht).le _) (sq_nonneg _) + rw [integral_const_mul,integral_Ioi_rpow_of_lt (by norm_num : (-21/8:ℝ)< -1) hx] at hlo + norm_num at hlo + linarith + +lemma fractional_trace_bound {ι : Type*} [Fintype ι] (e : ι → ℝ) (he : ∀ i, 0 ≤ e i) + {s C : ℝ} (hs : 0 < s) + (htrace : ∀ t : ℝ, s ≤ t → (∑ i, (t+e i)⁻¹^2) ≤ C / Real.sqrt t) : + (∑ i, (s+e i)^(-13/8:ℝ)) ≤ 52*C*s^(-1/8:ℝ) := by + have hint (i : ι) := weighted_resolvent_integrable hs (he i) + have hsum := Finset.sum_le_sum (s := Finset.univ) (fun i _ => fractional_power_integral_bound hs (he i)) + simp only [← Finset.mul_sum] at hsum + rw [← integral_finsetSum _ (fun i _ => hint i)] at hsum + have hi := integrable_finsetSum Finset.univ (fun i _ => hint i) + have hupper : (∫ t : ℝ in Ioi s, ∑ i, t^(-5/8:ℝ)/(t+e i)^2) ≤ + ∫ t : ℝ in Ioi s, C*t^(-9/8:ℝ) := by + apply integral_mono_ae hi ((integrableOn_Ioi_rpow_of_lt (by norm_num : (-9/8:ℝ)< -1) hs).const_mul C) + filter_upwards [ae_restrict_mem measurableSet_Ioi] with t ht + have ht0 : 0 < t := hs.trans ht + calc + (∑ i, t^(-5/8:ℝ)/(t+e i)^2) = t^(-5/8:ℝ)*(∑ i, (t+e i)⁻¹^2) := by + rw [Finset.mul_sum]; apply Finset.sum_congr rfl; intro i _; simp only [inv_pow,div_eq_mul_inv] + _ ≤ t^(-5/8:ℝ)*(C/Real.sqrt t) := mul_le_mul_of_nonneg_left (htrace t ht.le) (by positivity) + _ = C*t^(-9/8:ℝ) := by + rw [Real.sqrt_eq_rpow] + have hp : t^(-5/8:ℝ)/t^(1/2:ℝ) = t^(-9/8:ℝ) := by rw [← Real.rpow_sub ht0]; norm_num + calc + _ = C*(t^(-5/8:ℝ)/t^(1/2:ℝ)) := by ring + _ = _ := by rw [hp] + rw [integral_const_mul,integral_Ioi_rpow_of_lt (by norm_num : (-9/8:ℝ)< -1) hs] at hupper + norm_num at hupper + nlinarith + + + +open MeasureTheory Set + +lemma inverse_perturbation_bound {x d E : ℝ} (hx : 0 < x) (hclose : |d-x| ≤ E) + (hsmall : E ≤ x/2) : 0 < d ∧ |d⁻¹-x⁻¹| ≤ 2*E/x^2 ∧ d⁻¹^2 ≤ 4*x⁻¹^2 := by + have hd : 0 < d := by have := (abs_le.mp hclose).1; linarith + have hdx : x/2 ≤ d := by have := (abs_le.mp hclose).1; linarith + have he : 0 ≤ E := (abs_nonneg _).trans hclose + refine ⟨hd,?_,?_⟩ + · have hid : d⁻¹-x⁻¹ = (x-d)/(d*x) := by field_simp + rw [hid,abs_div,abs_of_pos (mul_pos hd hx),abs_sub_comm] + calc + |d-x|/(d*x) ≤ E/(d*x) := by gcongr + _ ≤ E/((x/2)*x) := div_le_div_of_nonneg_left he (by positivity) + (mul_le_mul_of_nonneg_right hdx hx.le) + _ = 2*E/x^2 := by field_simp + · have hinv : d⁻¹ ≤ 2*x⁻¹ := by + have hh := one_div_le_one_div_of_le (by positivity : 0 < x/2) hdx + have heq : (x/2)⁻¹ = 2*x⁻¹ := by field_simp + simpa only [one_div,heq] using hh + calc + d⁻¹^2 ≤ (2*x⁻¹)^2 := pow_le_pow_left₀ (inv_nonneg.mpr hd.le) hinv 2 + _ = _ := by ring + +lemma inverse_perturbation_bound' {x d E : ℝ} (hx : 0 < x) (hclose : |d-x| ≤ E) + (hsmall : E ≤ x/2) : |d⁻¹-x⁻¹| ≤ 2*E/x^2 := + (inverse_perturbation_bound hx hclose hsmall).2.1 + +lemma resolvent_trace_transfer {ι : Type*} [Fintype ι] (e lam : ι → ℝ) + {A B C s₀ s D : ℝ} (he : ∀ i, 0 ≤ e i) (hA : 0 ≤ A) (hB : 0 ≤ B) (hC : 0 ≤ C) + (hs₀ : 0 < s₀) (hs : s₀ ≤ s) + (hclose : ∀ i, |lam i-(2-e i)| ≤ edgeError A B C s₀ (e i)) + (hsmall : A*s₀^(-5/8:ℝ)+B/s₀+C ≤ 1/2) + (htrace : ∀ t : ℝ, s ≤ t → (∑ i, (t+e i)⁻¹^2) ≤ D / Real.sqrt t) : + (∀ i, 0 < 2+s-lam i) ∧ + (∑ i, (2+s-lam i)⁻¹^2) ≤ 4*D/Real.sqrt s ∧ + |(∑ i, (2+s-lam i)⁻¹)-(∑ i, (s+e i)⁻¹)| ≤ + 104*A*D*s^(-1/8:ℝ)+2*B*(D/Real.sqrt s)+2*C*(∑ i, (s+e i)⁻¹) := by + have hspos : 0 < s := hs₀.trans_le hs + have hrel (i : ι) : edgeError A B C s₀ (e i) ≤ (s+e i)/2 := by + have hh := edgeError_relative hA hB hC hs₀ hs (he i) + have hei := he i + exact hh.trans ((mul_le_mul_of_nonneg_right hsmall (by positivity)).trans_eq (by ring)) + have hc (i : ι) : |(2+s-lam i)-(s+e i)| ≤ edgeError A B C s₀ (e i) := by + convert hclose i using 1 + rw [show 2+s-lam i-(s+e i) = -(lam i-(2-e i)) by ring,abs_neg] + have hh (i : ι) := inverse_perturbation_bound (add_pos_of_pos_of_nonneg hspos (he i)) (hc i) (hrel i) + refine ⟨fun i => (hh i).1,?_,?_⟩ + · calc + _ ≤ ∑ i, 4*(s+e i)⁻¹^2 := Finset.sum_le_sum (fun i _ => (hh i).2.2) + _ = 4*∑ i, (s+e i)⁻¹^2 := by rw [Finset.mul_sum] + _ ≤ _ := by simpa only [mul_div_assoc] using mul_le_mul_of_nonneg_left (htrace s le_rfl) (by norm_num : (0:ℝ) ≤ 4) + · have hpoint (i : ι) : 2*edgeError A B C s₀ (e i)/(s+e i)^2 ≤ + 2*A*(s+e i)^(-13/8:ℝ)+2*B*(s+e i)⁻¹^2+2*C*(s+e i)⁻¹ := by + have hei := he i + have hx : 0 < s+e i := by positivity + have hexp : (e i+s₀)^(3/8:ℝ) ≤ (s+e i)^(3/8:ℝ) := + Real.rpow_le_rpow (by positivity) (by linarith) (by norm_num) + have hp : (s+e i)^(3/8:ℝ)/(s+e i)^2 = (s+e i)^(-13/8:ℝ) := by + rw [← Real.rpow_two,← Real.rpow_sub hx]; norm_num + have hCe : C*e i ≤ C*(s+e i) := by gcongr; linarith + calc + _ ≤ 2*(A*(s+e i)^(3/8:ℝ)+B+C*(s+e i))/(s+e i)^2 := by + unfold edgeError; gcongr + _ = _ := by rw [show 2*(A*(s+e i)^(3/8:ℝ)+B+C*(s+e i))/(s+e i)^2 = + 2*A*((s+e i)^(3/8:ℝ)/(s+e i)^2)+2*B*(s+e i)⁻¹^2+2*C*(s+e i)⁻¹ by field_simp,hp] + calc + _ = |∑ i, ((2+s-lam i)⁻¹-(s+e i)⁻¹)| := by rw [Finset.sum_sub_distrib] + _ ≤ ∑ i, |(2+s-lam i)⁻¹-(s+e i)⁻¹| := Finset.abs_sum_le_sum_abs _ _ + _ ≤ ∑ i, (2*A*(s+e i)^(-13/8:ℝ)+2*B*(s+e i)⁻¹^2+2*C*(s+e i)⁻¹) := + Finset.sum_le_sum (fun i _ => (hh i).2.1.trans (hpoint i)) + _ = 2*A*(∑ i, (s+e i)^(-13/8:ℝ))+2*B*(∑ i, (s+e i)⁻¹^2)+2*C*(∑ i, (s+e i)⁻¹) := by + simp only [Finset.sum_add_distrib,Finset.mul_sum] + _ ≤ _ := by + have hf := fractional_trace_bound e he hspos htrace + have ht := htrace s le_rfl + nlinarith [mul_le_mul_of_nonneg_left hf (by positivity : 0 ≤ 2*A), + mul_le_mul_of_nonneg_left ht (by positivity : 0 ≤ 2*B)] + + +def formA (n : ℕ) (h : ℝ) : ℝ := + 41472 * Real.sqrt (32 * (entryVariance n : ℝ)) * (h + 1) * + ((2 : ℝ)^(Nat.clog 8 (n + 1))) ^ (1 / 4 : ℝ) + +def formB (n : ℕ) : ℝ := 8 / (n+1) + +def formC (n : ℕ) : ℝ := 16 / Real.sqrt (n+1:ℝ) + +lemma formError_eq (n : ℕ) (h s e : ℝ) : + formError n h s e = edgeError (formA n h) (formB n) (formC n) s e := rfl + +lemma formA_nonneg (n : ℕ) {h : ℝ} (hh : 0 ≤ h) : 0 ≤ formA n h := by unfold formA; positivity + +lemma formB_nonneg (n : ℕ) : 0 ≤ formB n := by unfold formB; positivity + +lemma formC_nonneg (n : ℕ) : 0 ≤ formC n := by unfold formC; positivity + +def orderedJacobiGaps (n : ℕ) (i : Fin (n+1)) : ℝ := + 2-(pathOperator_symmetric n).eigenvalues (by simp) i + +def sampleEigenvalues (n : ℕ) (ω : TriSample n) : Fin (n+1) → ℝ := + (triSampleOperator_symmetric n ω).eigenvalues (by simp) + +lemma orderedJacobiGaps_nonneg (n : ℕ) (i : Fin (n+1)) : 0 ≤ orderedJacobiGaps n i := + sub_nonneg.mpr (pathOperator_eigenvalue_le_two n i) + +lemma triSample_eigenvalue_good (n : ℕ) {ω : TriSample n} {h s : ℝ} + (hh : 0 ≤ h) (hs : 0 < s) (hscale : scaleEnergy (Nat.clog 8 (n+1)) 0 ≤ s) + (hsmall : formA n h*(3/8:ℝ)*s^(-5/8:ℝ)+formC n ≤ 1) + (hω : ω ∉ triBad n h) (i : Fin (n+1)) : + |sampleEigenvalues n ω i-(2-orderedJacobiGaps n i)| ≤ + edgeError (formA n h) (formB n) (formC n) s (orderedJacobiGaps n i) := by + have hm := edgeError_eigenvalue_comparison_mono (B := formB n) + (formA_nonneg n hh) (formC_nonneg n) hs hsmall + have he := eigenvalue_form_comparison (triSampleOperator_symmetric n ω) (pathOperator_symmetric n) + (by simp) hm.1 hm.2 (pathOperator_eigenvalue_le_two n) + (pathOperator_inner_le_two n) + (fun x hx => by simpa only [← formError_eq] using triSampleOperator_form_good n hh hscale hω x hx) i + simpa only [sampleEigenvalues,orderedJacobiGaps,sub_sub_cancel] using he + +lemma symmetric_eigenvalue_sum_congr {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + [FiniteDimensional ℝ E] {T : E →ₗ[ℝ] E} (hT : T.IsSymmetric) + {m n : ℕ} (hm : Module.finrank ℝ E = m) (hn : Module.finrank ℝ E = n) (f : ℝ → ℝ) : + (∑ i, f (hT.eigenvalues hm i)) = ∑ i, f (hT.eigenvalues hn i) := by + subst m + subst n + rfl + +lemma sum_orderedJacobiGaps (n : ℕ) (f : ℝ → ℝ) : + (∑ i, f (orderedJacobiGaps n i)) = ∑ i, f (jacobiGaps (n+1) i) := by + let e : Fin (Fintype.card (Fin (n+1))) ≃ Fin (n+1) := + Fintype.equivOfCardEq (Fintype.card_fin _) + have hh := Equiv.sum_comp e (fun i => f (jacobiGaps (n+1) i)) + simp only [jacobiGaps,Matrix.IsHermitian.eigenvalues,e,Equiv.symm_apply_apply] at hh + calc + _ = ∑ i, f (2-(jacobi_hermitian (n+1:ℝ)⁻¹ (n+1)).eigenvalues₀ i) := + symmetric_eigenvalue_sum_congr (pathOperator_symmetric n) (by simp) finrank_euclideanSpace (fun x => f (2-x)) + _ = _ := by + simpa only [jacobiGaps,Matrix.IsHermitian.eigenvalues,Nat.cast_add,Nat.cast_one] using hh + +lemma orderedJacobi_trace (n : ℕ) {s : ℝ} (hs : 0 < s) + (hscale : 2 ≤ (n+1:ℝ)*s*Real.sqrt s) : + (∑ i, (s+orderedJacobiGaps n i)⁻¹^2) ≤ 4*(n+1:ℝ)/Real.sqrt s ∧ + |(∑ i, (s+orderedJacobiGaps n i)⁻¹)/(n+1)-semicircleResolvent s| ≤ 2/((n+1:ℝ)*s) ∧ + (∑ i, (s+orderedJacobiGaps n i)⁻¹) ≤ n+1 := by + have ht := jacobi_resolvent_estimates (Nat.succ_pos n) hs (by simpa using hscale) + have hn : (0:ℝ) < n+1 := by positivity + have hR := semicircleResolvent_le_one hs.le + rw [sum_orderedJacobiGaps n (fun e => (s+e)⁻¹^2), + sum_orderedJacobiGaps n (fun e => (s+e)⁻¹)] + simp only [empiricalResolventSquare,empiricalResolvent,Fintype.card_fin,Nat.cast_succ] at ht + refine ⟨?_,?_,?_⟩ + · calc + _ = (n+1:ℝ)*((n+1:ℝ)⁻¹*(∑ i, (s+jacobiGaps (n+1) i)⁻¹^2)) := by field_simp + _ ≤ (n+1:ℝ)*(4/Real.sqrt s) := mul_le_mul_of_nonneg_left ht.1 hn.le + _ = _ := by ring + · rw [div_eq_mul_inv,mul_comm,abs_sub_comm,abs_of_nonneg ht.2.1] + exact ht.2.2 + · have hsum : (n+1:ℝ)⁻¹*(∑ i, (s+jacobiGaps (n+1) i)⁻¹) ≤ 1 := by linarith [ht.2.1] + have hmul := mul_le_mul_of_nonneg_left hsum hn.le + simpa only [← mul_assoc,mul_inv_cancel₀ hn.ne',one_mul,mul_one] using hmul + +lemma triSample_resolvent_good (n : ℕ) {ω : TriSample n} {h s₀ s : ℝ} + (hh : 0 ≤ h) (hs₀ : 0 < s₀) (hs : s₀ ≤ s) + (hscale : scaleEnergy (Nat.clog 8 (n+1)) 0 ≤ s₀) + (hsmall : formA n h*s₀^(-5/8:ℝ)+formB n/s₀+formC n ≤ 1/2) + (hspace : 2 ≤ (n+1:ℝ)*s₀*Real.sqrt s₀) + (hω : ω ∉ triBad n h) : + (∀ i, 0 < 2+s-sampleEigenvalues n ω i) ∧ + (∑ i, (2+s-sampleEigenvalues n ω i)⁻¹^2)/(n+1) ≤ 16/Real.sqrt s ∧ + |(∑ i, (2+s-sampleEigenvalues n ω i)⁻¹)/(n+1)-semicircleResolvent s| ≤ + 416*formA n h*s^(-1/8:ℝ)+8*formB n/Real.sqrt s+2*formC n+2/((n+1:ℝ)*s) := by + have hn : (0:ℝ) < n+1 := by positivity + have hspos : 0 < s := hs₀.trans_le hs + have hA := formA_nonneg n hh + have hB := formB_nonneg n + have hC := formC_nonneg n + have hmono : formA n h*(3/8:ℝ)*s₀^(-5/8:ℝ)+formC n ≤ 1 := by + have : 0 ≤ formB n/s₀ := by positivity + have : 0 ≤ formA n h*s₀^(-5/8:ℝ) := by positivity + nlinarith + have hsc (t : ℝ) (hst : s ≤ t) : 2 ≤ (n+1:ℝ)*t*Real.sqrt t := by + have htpos : 0 < t := hspos.trans_le hst + exact hspace.trans (mul_le_mul (mul_le_mul_of_nonneg_left (hs.trans hst) hn.le) + (Real.sqrt_le_sqrt (hs.trans hst)) (Real.sqrt_nonneg _) (by positivity)) + have hc := resolvent_trace_transfer (orderedJacobiGaps n) (sampleEigenvalues n ω) + (orderedJacobiGaps_nonneg n) hA hB hC hs₀ hs + (triSample_eigenvalue_good n hh hs₀ hscale hmono hω) hsmall + (fun t hst => (orderedJacobi_trace n (hspos.trans_le hst) (hsc t hst)).1) + have hd := orderedJacobi_trace n hspos (hsc s le_rfl) + refine ⟨hc.1,?_,?_⟩ + · apply (div_le_iff₀ hn).mpr + convert hc.2.1 using 1 + all_goals first | rfl | ring + · have hdif : |(∑ i, (2+s-sampleEigenvalues n ω i)⁻¹)/(n+1)- + (∑ i, (s+orderedJacobiGaps n i)⁻¹)/(n+1)| ≤ + 416*formA n h*s^(-1/8:ℝ)+8*formB n/Real.sqrt s+2*formC n := by + rw [← sub_div,abs_div,abs_of_pos hn] + apply (div_le_iff₀ hn).mpr + calc + _ ≤ _ := hc.2.2 + _ ≤ 104*formA n h*(4*(n+1))*s^(-1/8:ℝ)+2*formB n*(4*(n+1)/Real.sqrt s)+2*formC n*(n+1) := by gcongr; exact hd.2.2 + _ = _ := by ring + exact (abs_sub_le _ _ _).trans (add_le_add hdif hd.2.1) + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/Saddle.lean b/lean/OAI/MathematicalPhysics/CriticalSK/Saddle.lean new file mode 100644 index 0000000000000000000000000000000000000000..bb689abdac235d45aed3f9cba199e551d8201501 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/Saddle.lean @@ -0,0 +1,237 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open MeasureTheory ProbabilityTheory + +open scoped ENNReal NNReal + +open scoped BigOperators InnerProductSpace + +open Module + +open scoped BigOperators ENNReal NNReal Real Topology + +open MeasureTheory ProbabilityTheory Filter + +open scoped BigOperators NNReal + +open scoped BigOperators + +open Matrix Polynomial + +open scoped BigOperators Topology + +open Filter + +namespace CriticalSK + +variable {ι : Type*} [Fintype ι] [Nonempty ι] + +def saddleSum (lam : ι → ℝ) (a z : ℝ) : ℝ := ∑ i, (z - a * lam i)⁻¹ + +lemma saddleSum_strictAnti (lam : ι → ℝ) (a x y : ℝ) + (hx : ∀ i, 0 < x - a * lam i) (hxy : x < y) : + saddleSum lam a y < saddleSum lam a x := by + classical + have hi : ∀ i, (y - a * lam i)⁻¹ < (x - a * lam i)⁻¹ := by + intro i + simpa only [one_div] using + one_div_lt_one_div_of_lt (hx i) (show x - a * lam i < y - a * lam i by linarith) + apply Finset.sum_lt_sum + · intro i _ + exact (hi i).le + · obtain ⟨i⟩ := ‹Nonempty ι› + exact ⟨i, Finset.mem_univ i, hi i⟩ + +theorem spherical_saddle_existsUnique (lam : ι → ℝ) (a : ℝ) (ha : 0 ≤ a) + (top : ι) (htop : ∀ i, lam i ≤ lam top) : + ∃! z : ℝ, (∀ i, 0 < z - a * lam i) ∧ + saddleSum lam a z = Fintype.card ι := by + classical + let N : ℝ := Fintype.card ι + have hNpos : 0 < N := by + dsimp [N] + exact_mod_cast (Fintype.card_pos : 0 < Fintype.card ι) + have hNge : 1 ≤ N := by + dsimp [N] + exact_mod_cast (Nat.succ_le_iff.mpr (Fintype.card_pos : 0 < Fintype.card ι)) + have hNinv : 0 < N⁻¹ := inv_pos.mpr hNpos + have hNinv_le : N⁻¹ ≤ 1 := (inv_le_one₀ hNpos).mpr hNge + let l : ℝ := a * lam top + N⁻¹ + let u : ℝ := a * lam top + 1 + have hgap : ∀ z ∈ Set.Icc l u, ∀ i, 0 < z - a * lam i := by + intro z hz i + have hm := mul_le_mul_of_nonneg_left (htop i) ha + have hzlo : a * lam top + N⁻¹ ≤ z := hz.1 + linarith + have hlu : l ≤ u := by dsimp [l, u]; linarith + have hcont : ContinuousOn (saddleSum lam a) (Set.Icc l u) := by + unfold saddleSum + apply continuousOn_finsetSum + intro i _ + exact (continuousOn_id.sub continuousOn_const).inv₀ + (fun z hz => ne_of_gt (hgap z hz i)) + have hl : N ≤ saddleSum lam a l := by + calc + N = (l - a * lam top)⁻¹ := by simp [l] + _ ≤ ∑ i, (l - a * lam i)⁻¹ := by + apply Finset.single_le_sum (f := fun i : ι => (l - a * lam i)⁻¹) + · intro i _ + exact inv_nonneg.mpr (le_of_lt (hgap l ⟨le_rfl, hlu⟩ i)) + · exact Finset.mem_univ top + have hu : saddleSum lam a u ≤ N := by + calc + _ ≤ ∑ _i : ι, (1 : ℝ) := by + apply Finset.sum_le_sum + intro i _ + have hden : 1 ≤ u - a * lam i := by + have hm := mul_le_mul_of_nonneg_left (htop i) ha + dsimp [u] + linarith + exact (inv_le_one₀ (by linarith : 0 < u - a * lam i)).mpr hden + _ = N := by simp [N] + obtain ⟨z, hz, hroot⟩ := intermediate_value_Icc' hlu hcont ⟨hu, hl⟩ + refine ⟨z, ⟨hgap z hz, hroot⟩, ?_⟩ + intro y hy + rcases lt_trichotomy y z with h | h | h + · have := saddleSum_strictAnti lam a y z hy.1 h + rw [hy.2, hroot] at this + exact False.elim (lt_irrefl N this) + · exact h + · have := saddleSum_strictAnti lam a z y (hgap z hz) h + rw [hy.2, hroot] at this + exact False.elim (lt_irrefl N this) + +def sphericalObjective (lam : ι → ℝ) (a z : ℝ) : ℝ := + (z - 1) / 2 - (∑ i, Real.log (z - a * lam i)) / (2 * Fintype.card ι) + +lemma log_tangent_bound {x y : ℝ} (hx : 0 < x) (hy : 0 < y) : + Real.log y - Real.log x ≤ (y - x) / x := by + have h := Real.log_le_sub_one_of_pos (div_pos hy hx) + rw [Real.log_div (ne_of_gt hy) (ne_of_gt hx)] at h + convert h using 1 + field_simp + +lemma log_tangent_strict {x y : ℝ} (hx : 0 < x) (hy : 0 < y) (hxy : y ≠ x) : + Real.log y - Real.log x < (y - x) / x := by + have hh : y / x ≠ 1 := by + intro h + exact hxy ((div_eq_one_iff_eq (ne_of_gt hx)).mp h) + have h := Real.log_lt_sub_one_of_pos (div_pos hy hx) hh + rw [Real.log_div (ne_of_gt hy) (ne_of_gt hx)] at h + convert h using 1 + field_simp + +theorem spherical_saddle_strict_min (lam : ι → ℝ) (a z : ℝ) + (hz : ∀ i, 0 < z - a * lam i) + (hroot : saddleSum lam a z = Fintype.card ι) + (y : ℝ) (hy : ∀ i, 0 < y - a * lam i) (hyz : y ≠ z) : + sphericalObjective lam a z < sphericalObjective lam a y := by + classical + have hlog : ∀ i, Real.log (y - a * lam i) - Real.log (z - a * lam i) < + (y - z) * (z - a * lam i)⁻¹ := by + intro i + have hne : y - a * lam i ≠ z - a * lam i := by + intro h + exact hyz (by linarith) + convert log_tangent_strict (hz i) (hy i) hne using 1; ring + have hsum : (∑ i, Real.log (y - a * lam i)) - + (∑ i, Real.log (z - a * lam i)) < (y - z) * Fintype.card ι := by + rw [← Finset.sum_sub_distrib, ← hroot] + unfold saddleSum + rw [Finset.mul_sum] + apply Finset.sum_lt_sum + · intro i _ + exact (hlog i).le + · obtain ⟨i⟩ := ‹Nonempty ι› + exact ⟨i, Finset.mem_univ i, hlog i⟩ + have hNpos : 0 < (Fintype.card ι : ℝ) := by + exact_mod_cast (Fintype.card_pos : 0 < Fintype.card ι) + unfold sphericalObjective + have h := (div_lt_div_iff_of_pos_right (show 0 < 2 * (Fintype.card ι : ℝ) by positivity)).mpr hsum + have heq : ((y - z) * (Fintype.card ι : ℝ)) / (2 * Fintype.card ι) = (y - z) / 2 := by + field_simp + rw [heq, sub_div] at h + linarith + +lemma spherical_saddle_min (lam : ι → ℝ) (a z : ℝ) + (hz : ∀ i, 0 < z - a * lam i) + (hroot : saddleSum lam a z = Fintype.card ι) + (y : ℝ) (hy : ∀ i, 0 < y - a * lam i) : + sphericalObjective lam a z ≤ sphericalObjective lam a y := by + by_cases h : y = z + · subst y + exact le_rfl + · exact (spherical_saddle_strict_min lam a z hz hroot y hy h).le + +omit [Nonempty ι] in +lemma spherical_saddle_upper (lam : ι → ℝ) (a z : ℝ) (ha : 0 ≤ a) + (top : ι) (htop : ∀ i, lam i ≤ lam top) + (hroot : saddleSum lam a z = Fintype.card ι) : + z ≤ 1 + a * lam top := by + classical + by_contra! h + have hi : ∀ i, (z - a * lam i)⁻¹ < 1 := by + intro i + have hm := mul_le_mul_of_nonneg_left (htop i) ha + have hden : 1 < z - a * lam i := by linarith + simpa using one_div_lt_one_div_of_lt zero_lt_one hden + have hs : saddleSum lam a z < ∑ _i : ι, (1 : ℝ) := by + apply Finset.sum_lt_sum + · intro i _ + exact (hi i).le + · exact ⟨top, Finset.mem_univ top, hi top⟩ + simp [hroot] at hs + +omit [Nonempty ι] in +lemma spherical_saddle_lower (lam : ι → ℝ) (a z : ℝ) (ha : 0 ≤ a) + (bot : ι) (hbot : ∀ i, lam bot ≤ lam i) + (hz : ∀ i, 0 < z - a * lam i) + (hroot : saddleSum lam a z = Fintype.card ι) : + 1 + a * lam bot ≤ z := by + classical + by_contra! h + have hi : ∀ i, 1 < (z - a * lam i)⁻¹ := by + intro i + have hm := mul_le_mul_of_nonneg_left (hbot i) ha + have hden : z - a * lam i < 1 := by linarith + simpa using one_div_lt_one_div_of_lt (hz i) hden + have hs : (∑ _i : ι, (1 : ℝ)) < saddleSum lam a z := by + apply Finset.sum_lt_sum + · intro i _ + exact (hi i).le + · exact ⟨bot, Finset.mem_univ bot, hi bot⟩ + simp [hroot] at hs + +omit [Nonempty ι] in +theorem spherical_saddle_variance_bounds (lam : ι → ℝ) (a z : ℝ) + (ha : 0 ≤ a) (ha2 : a ≤ 2) + (top : ι) (htop : ∀ i, lam i ≤ lam top) + (hbounded : ∀ i, |lam i| ≤ 3) + (hz : ∀ i, 0 < z - a * lam i) + (hroot : saddleSum lam a z = Fintype.card ι) : + ∀ i, (1 / 13 : ℝ) ≤ (z - a * lam i)⁻¹ ∧ + (z - a * lam i)⁻¹ ≤ Fintype.card ι := by + classical + have hupper := spherical_saddle_upper lam a z ha top htop hroot + intro i + constructor + · have hltop : lam top ≤ 3 := (abs_le.mp (hbounded top)).2 + have hli : -3 ≤ lam i := (abs_le.mp (hbounded i)).1 + have hm := mul_le_mul_of_nonneg_left (show lam top - lam i ≤ 6 by linarith) ha + have hden : z - a * lam i ≤ 13 := by nlinarith + simpa only [one_div] using one_div_le_one_div_of_le (hz i) hden + · rw [← hroot] + exact Finset.single_le_sum + (fun j _ => inv_nonneg.mpr (hz j).le) (Finset.mem_univ i) + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/SaddleLimit.lean b/lean/OAI/MathematicalPhysics/CriticalSK/SaddleLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..25087f8ba006d2a4de66edda67440899708a44b7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/SaddleLimit.lean @@ -0,0 +1,454 @@ +import OAI.MathematicalPhysics.CriticalSK.PartitionBounds + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open scoped BigOperators ENNReal NNReal Real Topology + +open MeasureTheory ProbabilityTheory Filter + +open scoped ENNReal NNReal + +open scoped BigOperators NNReal + +open scoped BigOperators + +open scoped BigOperators InnerProductSpace + +open Module + +open Matrix Polynomial + +open scoped BigOperators Topology + +open Filter + +open scoped BigOperators NNReal ENNReal Topology Pointwise Matrix.Norms.Elementwise + +open Set Metric MeasureTheory MeasureTheory.Measure + +open scoped ENNReal NNReal BigOperators + +open MeasureTheory ProbabilityTheory + +open scoped ENNReal NNReal Topology + +open MeasureTheory MeasureTheory.Measure Set Metric + +open scoped NNReal ENNReal BigOperators + +open scoped NNReal ENNReal + +open ProbabilityTheory + +open Metric Set MeasureTheory + +open scoped ENNReal Pointwise + +open MeasureTheory Filter Set Real + +namespace CriticalSK + +section + +variable {ι : Type*} [Fintype ι] [Nonempty ι] + +lemma saddleRadius_le_iff (lam : ι → ℝ) {a r : ℝ} (ha : 0 < a) (hr : spectralTop lam < r) : + saddleRadius lam a ≤ r ↔ spectralStieltjes lam r ≤ a := by + have hs := saddleRadius_spec lam ha + constructor + · intro h + rw [← hs.2] + exact (spectralStieltjes_strictAnti lam).antitoneOn hs.1 hr h + · intro h + by_contra hc + have he := spectralStieltjes_strictAnti lam hr hs.1 (lt_of_not_ge hc) + rw [hs.2] at he + exact (not_lt_of_ge h) he + +lemma le_saddleRadius_iff (lam : ι → ℝ) {a r : ℝ} (ha : 0 < a) (hr : spectralTop lam < r) : + r ≤ saddleRadius lam a ↔ a ≤ spectralStieltjes lam r := by + have hs := saddleRadius_spec lam ha + constructor + · intro h + rw [← hs.2] + exact (spectralStieltjes_strictAnti lam).antitoneOn hr hs.1 h + · intro h + by_contra hc + have he := spectralStieltjes_strictAnti lam hs.1 hr (lt_of_not_ge hc) + rw [hs.2] at he + exact (not_lt_of_ge h) he + +lemma semicircleResolvent_gt_from_inverse {s x : ℝ} (hs : 0 < s) (hx : x ≤ 1) + (h : s*x < (1-x)^2) : x < semicircleResolvent s := by + have hsq := Real.sq_sqrt (show 0 ≤ s*(4+s) by positivity) + have hp : 0 < 2+s-2*x := by linarith + have hr : Real.sqrt (s*(4+s)) < 2+s-2*x := by nlinarith + unfold semicircleResolvent + linarith + +lemma semicircleResolvent_subcritical_margin {u : ℝ} (hu : 0 < u) (hu1 : u ≤ 1/4) : + 1-u+(1/100)*Real.sqrt ((9/10)*u^2/(1-u)) < + semicircleResolvent ((9/10)*u^2/(1-u)) := by + have hden : 0 < 1-u := by linarith + have hs : 0 < (9/10:ℝ)*u^2/(1-u) := by positivity + have hpoly : ((9/10:ℝ)*u^2/(1-u))*(1-(49/50)*u) < (1-(1-(49/50)*u))^2 := by + rw [div_mul_eq_mul_div] + apply (div_lt_iff₀ hden).mpr + nlinarith [sq_pos_of_pos hu,mul_nonneg (sq_nonneg u) (show 0 ≤ 1/4-u by linarith)] + have hx := semicircleResolvent_gt_from_inverse hs (show 1-(49/50:ℝ)*u ≤ 1 by linarith) hpoly + have hsqrt : Real.sqrt ((9/10:ℝ)*u^2/(1-u)) ≤ 2*u := by + apply Real.sqrt_le_iff.mpr + constructor + · positivity + · apply (div_le_iff₀ hden).mpr + nlinarith [mul_nonneg (sq_nonneg u) (show 0 ≤ 1/4-u by linarith)] + linarith + +lemma subcritical_test_scale {s₀ u : ℝ} (hs₀ : 0 ≤ s₀) (hu : 0 < u) + (hu1 : u ≤ 1/4) (hum : 16*s₀ ≤ u^2) : + s₀ ≤ (9/10:ℝ)*u^2/(1-u) ∧ (9/10:ℝ)*u^2/(1-u) ≤ 1 := by + have hden : 0 < 1-u := by linarith + constructor + · apply (le_div_iff₀ hden).mpr + nlinarith + · apply (div_le_iff₀ hden).mpr + nlinarith [sq_nonneg (u-1/4)] + +lemma saddleRadius_subcritical_lower (lam : ι → ℝ) {s₀ u : ℝ} + (hs₀ : 0 ≤ s₀) (hedge : spectralTop lam < 2+s₀) + (hres : ∀ s ∈ Icc s₀ 1, |spectralStieltjes lam (2+s)-semicircleResolvent s| ≤ (1/100)*Real.sqrt s) + (hu : 0 < u) (hu1 : u ≤ 1/4) (hum : 16*s₀ ≤ u^2) : + 2+(9/10)*u^2/(1-u) ≤ saddleRadius lam (1-u) := by + have hs := subcritical_test_scale hs₀ hu hu1 hum + have htest := hres _ hs + have hmargin := semicircleResolvent_subcritical_margin hu hu1 + have hle : 1-u ≤ spectralStieltjes lam (2+(9/10)*u^2/(1-u)) := by + have hh := (abs_le.mp htest).1 + linarith + exact (le_saddleRadius_iff lam (by linarith) (by linarith)).mpr hle + +def saddlePairDeficit (lam : ι → ℝ) (q : ℝ) : ℝ := + sphericalVariational lam (1+q)+sphericalVariational lam (1-q)-2*sphericalVariational lam 1 + +def saddlePairSlope (lam : ι → ℝ) (u : ℝ) : ℝ := + (saddleRadius lam (1+u)-(1+u)⁻¹)/2-(saddleRadius lam (1-u)-(1-u)⁻¹)/2 + +lemma saddlePairDeficit_zero (lam : ι → ℝ) : saddlePairDeficit lam 0 = 0 := by + simp [saddlePairDeficit]; ring + +lemma saddlePairDeficit_hasDerivAt (lam : ι → ℝ) {u : ℝ} (hu : |u| < 1) : + HasDerivAt (saddlePairDeficit lam) (saddlePairSlope lam u) u := by + have h1 := (sphericalVariational_hasDerivAt lam (show 0 < 1+u by linarith [(abs_lt.mp hu).1])).comp u + ((hasDerivAt_const u 1).add (hasDerivAt_id u)) + have h2 := (sphericalVariational_hasDerivAt lam (show 0 < 1-u by linarith [(abs_lt.mp hu).2])).comp u + ((hasDerivAt_const u 1).sub (hasDerivAt_id u)) + convert! ((h1.add h2).sub_const (2*sphericalVariational lam 1)) using 1 + simp only [saddlePairSlope,zero_add,zero_sub,mul_one,mul_neg_one] + ring + +lemma saddlePairDeficit_continuousOn (lam : ι → ℝ) : ContinuousOn (saddlePairDeficit lam) (Icc 0 1) := by + have h1 := (sphericalVariational_continuousOn lam).comp (continuous_const.add continuous_id).continuousOn + (show MapsTo (fun q : ℝ => 1+q) (Icc 0 1) (Ici 0) by intro q hq; simp only [mem_Ici]; linarith [hq.1]) + have h2 := (sphericalVariational_continuousOn lam).comp (continuous_const.sub continuous_id).continuousOn + (show MapsTo (fun q : ℝ => 1-q) (Icc 0 1) (Ici 0) by intro q hq; simp only [mem_Ici]; linarith [hq.2]) + exact (h1.add h2).sub continuousOn_const + +lemma subcritical_coefficient {u : ℝ} (hu : 0 ≤ u) (hu1 : u ≤ 1/4) : + (1:ℝ)/3 ≤ 1/(2*(1+u))-1/(20*(1-u)) := by + have hP : 0 < 1+u := by linarith + have hM : 0 < 1-u := by linarith + have hD : 0 < 1-u^2 := by nlinarith + have he : 1/(2*(1+u))-1/(20*(1-u)) = (9-11*u)/(20*(1-u^2)) := by + field_simp + ring + rw [he] + apply (le_div_iff₀ (by positivity)).mpr + nlinarith [mul_nonneg (show 0 ≤ 1/4-u by linarith) (show 0 ≤ 7/5-u by linarith)] + +lemma subcritical_short_coefficient {u : ℝ} (hu : 0 ≤ u) (hu1 : u ≤ 1/4) : + u/(1-u^2) ≤ u+u^2/3 := by + have hD : 0 < 1-u^2 := by nlinarith + apply (div_le_iff₀ hD).mpr + have hp : 0 ≤ 1-3*u-u^2 := by nlinarith + nlinarith [mul_nonneg (sq_nonneg u) hp] + +lemma saddlePairSlope_small_bound (lam : ι → ℝ) {s₀ u : ℝ} + (hs₀ : 0 ≤ s₀) (hedge : spectralTop lam < 2+s₀) (hlow : 2-s₀ ≤ spectralTop lam) + (hres₀ : spectralStieltjes lam (2+s₀) ≤ 1) + (hres : ∀ s ∈ Icc s₀ 1, |spectralStieltjes lam (2+s)-semicircleResolvent s| ≤ (1/100)*Real.sqrt s) + (hu : 0 < u) (hu1 : u ≤ 1/4) : + saddlePairSlope lam u ≤ u-u^2/3+12*s₀ := by + have hP : 0 < 1+u := by linarith + have hM : 0 < 1-u := by linarith + have hD : 0 < 1-u^2 := by nlinarith + have hp : saddleRadius lam (1+u) ≤ 2+s₀ := + (saddleRadius_le_iff lam hP hedge).mpr (by linarith) + by_cases hum : 16*s₀ ≤ u^2 + · have hm := saddleRadius_subcritical_lower lam hs₀ hedge hres hu hu1 hum + have halg : (2+s₀-(1+u)⁻¹)/2-((2+(9/10)*u^2/(1-u))-(1-u)⁻¹)/2 = + u-u^2*(1/(2*(1+u))-1/(20*(1-u)))+s₀/2 := by + field_simp + ring + have hc := subcritical_coefficient hu.le hu1 + unfold saddlePairSlope + nlinarith [mul_le_mul_of_nonneg_left hc (sq_nonneg u)] + · have hm : 2-s₀ < saddleRadius lam (1-u) := hlow.trans_lt (saddleRadius_spec lam hM).1 + have halg : (2+s₀-(1+u)⁻¹)/2-(2-s₀-(1-u)⁻¹)/2 = s₀+u/(1-u^2) := by + field_simp + ring + have hc := subcritical_short_coefficient hu.le hu1 + unfold saddlePairSlope + nlinarith + +lemma saddlePairDeficit_small_bound (lam : ι → ℝ) {s₀ q : ℝ} + (hs₀ : 0 ≤ s₀) (hedge : spectralTop lam < 2+s₀) (hlow : 2-s₀ ≤ spectralTop lam) + (hres₀ : spectralStieltjes lam (2+s₀) ≤ 1) + (hres : ∀ s ∈ Icc s₀ 1, |spectralStieltjes lam (2+s)-semicircleResolvent s| ≤ (1/100)*Real.sqrt s) + (hq : q ∈ Icc 0 (1/4)) : + saddlePairDeficit lam q ≤ q^2/2-q^3/9+12*s₀*q := by + let g : ℝ → ℝ := fun u => u^2/2-u^3/9+12*s₀*u + have hg : Continuous g := by dsimp [g]; fun_prop + have hdg (u : ℝ) : HasDerivAt g (u-u^2/3+12*s₀) u := by + convert! ((((hasDerivAt_id u).pow 2).div_const 2).sub (((hasDerivAt_id u).pow 3).div_const 9)).add + ((hasDerivAt_id u).const_mul (12*s₀)) using 1 + simp only [id_eq] + ring + have hD (u : ℝ) (hu : u ∈ Ioo 0 q) : + HasDerivAt (fun u => saddlePairDeficit lam u-g u) + (saddlePairSlope lam u-(u-u^2/3+12*s₀)) u := by + exact (saddlePairDeficit_hasDerivAt lam (by rw [abs_of_pos hu.1]; linarith [hu.2,hq.2])).sub (hdg u) + have hc : ContinuousOn (fun u => saddlePairDeficit lam u-g u) (Icc 0 q) := + ((saddlePairDeficit_continuousOn lam).mono (fun _ hu => ⟨hu.1,by linarith [hu.2,hq.2]⟩)).sub hg.continuousOn + have hmono := antitoneOn_of_deriv_nonpos (convex_Icc 0 q) hc + (fun u hu => (hD u (by rwa [interior_Icc] at hu)).differentiableAt.differentiableWithinAt) + (fun u hu => by + rw [interior_Icc] at hu + rw [(hD u hu).deriv] + have hh := saddlePairSlope_small_bound lam hs₀ hedge hlow hres₀ hres hu.1 (by linarith [hu.2,hq.2]) + linarith) + have hh := hmono (show (0:ℝ) ∈ Icc 0 q from ⟨le_refl 0,hq.1⟩) (show q ∈ Icc 0 q from ⟨hq.1,le_refl q⟩) hq.1 + simpa [g,saddlePairDeficit_zero] using hh + +lemma saddlePairDeficit_shrinking_cubic (lam : ι → ℝ) {s₀ q : ℝ} + (hs₀ : 0 ≤ s₀) (hedge : spectralTop lam < 2+s₀) (hlow : 2-s₀ ≤ spectralTop lam) + (hres₀ : spectralStieltjes lam (2+s₀) ≤ 1) + (hres : ∀ s ∈ Icc s₀ 1, |spectralStieltjes lam (2+s)-semicircleResolvent s| ≤ (1/100)*Real.sqrt s) + (hq : q ∈ Icc 0 (1/4)) (hscale : 216*s₀ ≤ q^2) : + saddlePairDeficit lam q ≤ q^2/2-q^3/18 := by + have hh := saddlePairDeficit_small_bound lam hs₀ hedge hlow hres₀ hres hq + nlinarith [mul_le_mul_of_nonneg_right hscale hq.1] + +end + +section + +lemma semicircleResolvent_lt_from_inverse {s x : ℝ} (hs : 0 < s) (hx : x ≤ 1) + (h : (1-x)^2 < s*x) : semicircleResolvent s < x := by + have hsq := Real.sq_sqrt (show 0 ≤ s*(4+s) by positivity) + have hn := Real.sqrt_nonneg (s*(4+s)) + have hp : 0 < 2+s-2*x := by linarith + have hr : 2+s-2*x < Real.sqrt (s*(4+s)) := by nlinarith + unfold semicircleResolvent + linarith + +lemma subcritical_radius_gap {a : ℝ} (ha : 0 < a) (ha1 : a < 1) : 2 < a+a⁻¹ := by + have hsq : 0 < (1-a)^2 := sq_pos_of_pos (by linarith) + have heq : (a+a⁻¹-2)*a = (1-a)^2 := by field_simp; ring + nlinarith + +variable {ι : ℕ → Type*} [∀ n, Fintype (ι n)] [∀ n, Nonempty (ι n)] + +lemma saddleRadius_subcritical_tendsto (lam : (n : ℕ) → ι n → ℝ) + (htop : Tendsto (fun n => spectralTop (lam n)) atTop (𝓝 2)) + (hres : ∀ s > 0, Tendsto (fun n => spectralStieltjes (lam n) (2+s)) atTop (𝓝 (semicircleResolvent s))) + {a : ℝ} (ha : 0 < a) (ha1 : a < 1) : + Tendsto (fun n => saddleRadius (lam n) a) atTop (𝓝 (a+a⁻¹)) := by + apply Metric.tendsto_nhds.mpr + intro ε hε + let δ := min (ε/2) ((a+a⁻¹-2)/2) + have hδ : 0 < δ := lt_min (by positivity) (by linarith [subcritical_radius_gap ha ha1]) + have hδε : δ < ε := lt_of_le_of_lt (min_le_left _ _) (by linarith) + have hδr : δ ≤ (a+a⁻¹-2)/2 := min_le_right _ _ + have hminus : 0 < a+a⁻¹-2-δ := by linarith + have hplus : 0 < a+a⁻¹-2+δ := by linarith + have he : (a+a⁻¹-2)*a = (1-a)^2 := by field_simp; ring + have hRm : a < semicircleResolvent (a+a⁻¹-2-δ) := + semicircleResolvent_gt_from_inverse hminus ha1.le (by nlinarith) + have hRp : semicircleResolvent (a+a⁻¹-2+δ) < a := + semicircleResolvent_lt_from_inverse hplus ha1.le (by nlinarith) + have hm := (hres _ hminus).eventually (lt_mem_nhds hRm) + have hp := (hres _ hplus).eventually (gt_mem_nhds hRp) + have ht := htop.eventually (gt_mem_nhds (show (2:ℝ) < a+a⁻¹-δ by linarith)) + filter_upwards [hm,hp,ht] with n hnm hnp hnt + have hshadowMinus : 2+(a+a⁻¹-2-δ) = a+a⁻¹-δ := by ring + have hshadowPlus : 2+(a+a⁻¹-2+δ) = a+a⁻¹+δ := by ring + rw [hshadowMinus] at hnm + rw [hshadowPlus] at hnp + have hlow := (le_saddleRadius_iff (lam n) ha hnt).mpr hnm.le + have hupp := (saddleRadius_le_iff (lam n) ha (by linarith : spectralTop (lam n) < a+a⁻¹+δ)).mpr hnp.le + rw [Real.dist_eq,abs_lt] + constructor <;> linarith + +lemma sphericalVariational_deriv_tendsto (lam : (n : ℕ) → ι n → ℝ) + (htop : Tendsto (fun n => spectralTop (lam n)) atTop (𝓝 2)) + (hres : ∀ s > 0, Tendsto (fun n => spectralStieltjes (lam n) (2+s)) atTop (𝓝 (semicircleResolvent s))) + {a : ℝ} (ha : 0 < a) (ha1 : a < 1) : + Tendsto (fun n => deriv (sphericalVariational (lam n)) a) atTop (𝓝 (a/2)) := by + have h := ((saddleRadius_subcritical_tendsto lam htop hres ha ha1).sub_const a⁻¹).div_const 2 + simpa only [add_sub_cancel_right, (sphericalVariational_hasDerivAt _ ha).deriv] using h + +def saddleSubcriticalError {κ : Type*} [Fintype κ] [Nonempty κ] (lam : κ → ℝ) : ℝ := + ∫ a in (0:ℝ)..1, |deriv (sphericalVariational lam) a-a/2| + +lemma saddleSubcriticalError_tendsto (lam : (n : ℕ) → ι n → ℝ) + (hbound : ∀ᶠ n in atTop, ∀ i, |lam n i| ≤ 3) + (htop : Tendsto (fun n => spectralTop (lam n)) atTop (𝓝 2)) + (hres : ∀ s > 0, Tendsto (fun n => spectralStieltjes (lam n) (2+s)) atTop (𝓝 (semicircleResolvent s))) : + Tendsto (fun n => saddleSubcriticalError (lam n)) atTop (𝓝 0) := by + have hmeas (n : ℕ) : AEStronglyMeasurable (fun a => |deriv (sphericalVariational (lam n)) a-a/2|) + (volume.restrict (Ioo (0:ℝ) 1)) := + ((measurable_deriv _).sub (measurable_id.div_const 2)).abs.aestronglyMeasurable + have hdom : ∀ᶠ n in atTop, ∀ᵐ a ∂volume.restrict (Ioo (0:ℝ) 1), + ‖|deriv (sphericalVariational (lam n)) a-a/2|‖ ≤ 2 := by + filter_upwards [hbound] with n hn + filter_upwards [ae_restrict_mem measurableSet_Ioo] with a ha + rw [norm_eq_abs,abs_abs,(sphericalVariational_hasDerivAt _ ha.1).deriv] + calc + _ ≤ |(saddleRadius (lam n) a-a⁻¹)/2|+|a/2| := abs_sub _ _ + _ ≤ 3/2+a/2 := by + rw [abs_of_pos (div_pos ha.1 (by norm_num) : 0 < a/2)] + exact add_le_add (sphericalVariational_slope_bound _ ha.1 hn) (le_refl _) + _ ≤ 2 := by linarith [ha.2] + have hlim : ∀ᵐ a ∂volume.restrict (Ioo (0:ℝ) 1), + Tendsto (fun n => |deriv (sphericalVariational (lam n)) a-a/2|) atTop (𝓝 0) := by + filter_upwards [ae_restrict_mem measurableSet_Ioo] with a ha + simpa using ((sphericalVariational_deriv_tendsto lam htop hres ha.1 ha.2).sub_const (a/2)).abs + have hint : Integrable (fun _ : ℝ => (2:ℝ)) (volume.restrict (Ioo (0:ℝ) 1)) := by + exact (continuousOn_const.integrableOn_Icc (μ := volume) (a := (0:ℝ)) (b := 1)).mono_set Ioo_subset_Icc_self + have hh := tendsto_integral_filter_of_dominated_convergence (fun _ : ℝ => (2:ℝ)) + (Eventually.of_forall hmeas) hdom hint hlim + simpa only [saddleSubcriticalError,intervalIntegral.integral_of_le (by norm_num : (0:ℝ) ≤ 1), + integral_Ioc_eq_integral_Ioo,integral_zero] using hh + +end + +open Set Filter + +lemma spectralGood_reference (n : ℕ) {h s : ℝ} (hh : 0 ≤ h) (hs : 0 ≤ s) : + (fun i => 2-orderedJacobiGaps n i) ∈ spectralGood n h s := by + intro i + simp only [sub_self,abs_zero] + unfold edgeError + exact add_nonneg (add_nonneg (mul_nonneg (formA_nonneg n hh) (Real.rpow_nonneg (add_nonneg (orderedJacobiGaps_nonneg n i) hs) _)) + (formB_nonneg n)) (mul_nonneg (formC_nonneg n) (orderedJacobiGaps_nonneg n i)) + +lemma spectralGood_natural_controls {h L : ℝ} (hh : 0 ≤ h) (hL : 1696 ≤ L) + (hcost : edgeFixedCost h L < 1/100) : + ∀ᶠ n : ℕ in atTop, ∀ lam ∈ spectralGood n h (naturalEdgeScale n L), + (∀ i, |lam i| ≤ 3) ∧ |spectralTop lam-2| ≤ naturalEdgeScale n L := by + have hLp : 0 < L := lt_of_lt_of_le (by norm_num) hL + have hc := traceCost_natural_eventually hh hLp hcost + have hs := (naturalEdgeScale_tendsto L).eventually (gt_mem_nhds (by norm_num : (0:ℝ) < 1)) + filter_upwards [hc,hs,edgeLength_tents_eventually] with n hn hns hnfit + intro lam hlam + have hp := naturalEdgeScale_pos n hLp + refine ⟨spectralGood_bounded n hh hp hns.le (by norm_num : (1/100:ℝ) ≤ 1/5) hn hlam,?_⟩ + have hlow := (abs_le.mp (spectralGood_top_close hh hL hns.le hnfit hn hlam 0 (by simp))).1 + have hlu := le_spectralTop lam 0 + obtain ⟨i,hi⟩ := spectralTop_attained lam + have hu := spectralGood_top_upper n hh hp hns.le (by norm_num : (1/100:ℝ) ≤ 1) hn hlam i + rw [hi] at hu + exact abs_le.mpr ⟨by linarith,by linarith⟩ + +lemma spectralGood_natural_top_tendsto {h L : ℝ} (hh : 0 ≤ h) (hL : 1696 ≤ L) + (hcost : edgeFixedCost h L < 1/100) (lam : (n : ℕ) → Fin (n+1) → ℝ) + (hgood : ∀ᶠ n in atTop, lam n ∈ spectralGood n h (naturalEdgeScale n L)) : + Tendsto (fun n => spectralTop (lam n)) atTop (𝓝 2) := by + rw [Metric.tendsto_nhds] + intro ε hε + filter_upwards [spectralGood_natural_controls hh hL hcost,hgood, + (naturalEdgeScale_tendsto L).eventually (gt_mem_nhds hε)] with n hn hng hne + rw [Real.dist_eq] + exact (hn (lam n) hng).2.trans_lt hne + +lemma traceError_fixed_tendsto {h s : ℝ} (hh : 0 ≤ h) (hs : 0 < s) : + Tendsto (fun n : ℕ => 416*formA n h*s^(-1/8:ℝ)+8*formB n/Real.sqrt s+ + 2*formC n+2/((n+1:ℝ)*s)) atTop (𝓝 0) := by + have hA := ((formA_tendsto hh).const_mul 416).mul_const (s^(-1/8:ℝ)) + have hB := (formB_tendsto.const_mul 8).div_const (Real.sqrt s) + have hC := formC_tendsto.const_mul 2 + have hN : Tendsto (fun n : ℕ => ((n:ℝ)+1)*s) atTop atTop := + (tendsto_natCast_atTop_atTop.atTop_add (tendsto_const_nhds (x := (1:ℝ)))).atTop_mul_const hs + simpa only [mul_zero,zero_mul,zero_div,zero_add] using ((hA.add hB).add hC).add (hN.const_div_atTop (2:ℝ)) + +lemma spectralGood_natural_resolvent_tendsto {h L : ℝ} (hh : 0 ≤ h) (hL : 1696 ≤ L) + (hcost : edgeFixedCost h L < 1/100) (hspace : 16 ≤ L*Real.sqrt L) + (lam : (n : ℕ) → Fin (n+1) → ℝ) + (hgood : ∀ᶠ n in atTop, lam n ∈ spectralGood n h (naturalEdgeScale n L)) + (s : ℝ) (hs : 0 < s) : + Tendsto (fun n => spectralStieltjes (lam n) (2+s)) atTop (𝓝 (semicircleResolvent s)) := by + have hLp : 0 < L := lt_of_lt_of_le (by norm_num) hL + rw [Metric.tendsto_nhds] + intro ε hε + filter_upwards [traceCost_natural_eventually hh hLp hcost,hgood, + (naturalEdgeScale_tendsto L).eventually (gt_mem_nhds (by norm_num : (0:ℝ) < 1)), + (naturalEdgeScale_tendsto L).eventually (gt_mem_nhds hs), + (traceError_fixed_tendsto hh hs).eventually (gt_mem_nhds hε)] with n hnc hng hn1 hns hne + have hp := naturalEdgeScale_pos n hLp + have hsmall := (traceCost_small n hh hp hn1.le hnc).trans (by norm_num : (1/100:ℝ) ≤ 1/2) + have hsc : 2 ≤ (n+1:ℝ)*naturalEdgeScale n L*Real.sqrt (naturalEdgeScale n L) := by + have hx := (naturalEdgeScale_space n hLp).1 + linarith + have ht := (spectralGood_resolvent n hh hp hns.le hsmall hsc hng).2.2 + rw [Real.dist_eq] + apply lt_of_le_of_lt _ hne + simpa only [spectralStieltjes,Fintype.card_fin,Nat.cast_add,Nat.cast_one,div_eq_mul_inv,mul_comm] using ht + +lemma spectralGood_natural_saddle_tendsto {h L : ℝ} (hh : 0 ≤ h) (hL : 1696 ≤ L) + (hcost : edgeFixedCost h L < 1/100) (hspace : 16 ≤ L*Real.sqrt L) + (lam : (n : ℕ) → Fin (n+1) → ℝ) + (hgood : ∀ᶠ n in atTop, lam n ∈ spectralGood n h (naturalEdgeScale n L)) : + Tendsto (fun n => saddleSubcriticalError (lam n)) atTop (𝓝 0) := by + apply saddleSubcriticalError_tendsto lam + · filter_upwards [spectralGood_natural_controls hh hL hcost,hgood] with n hn hng + exact (hn (lam n) hng).1 + · exact spectralGood_natural_top_tendsto hh hL hcost lam hgood + · exact spectralGood_natural_resolvent_tendsto hh hL hcost hspace lam hgood + +lemma spectralGood_saddle_uniform {h L : ℝ} (hh : 0 ≤ h) (hL : 1696 ≤ L) + (hcost : edgeFixedCost h L < 1/100) (hspace : 16 ≤ L*Real.sqrt L) + {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ n : ℕ in atTop, ∀ lam ∈ spectralGood n h (naturalEdgeScale n L), + saddleSubcriticalError lam+naturalEdgeScale n L/2 < ε := by + classical + let bad (n : ℕ) (lam : Fin (n+1) → ℝ) : Prop := + lam ∈ spectralGood n h (naturalEdgeScale n L) ∧ ε ≤ saddleSubcriticalError lam+naturalEdgeScale n L/2 + let lam (n : ℕ) : Fin (n+1) → ℝ := + if hb : ∃ x, bad n x then Classical.choose hb else fun i => 2-orderedJacobiGaps n i + have hg (n) : lam n ∈ spectralGood n h (naturalEdgeScale n L) := by + dsimp only [lam] + split + · exact (Classical.choose_spec ‹∃ x, bad n x›).1 + · exact spectralGood_reference n hh (naturalEdgeScale_pos n (lt_of_lt_of_le (by norm_num) hL)).le + have hlim := (spectralGood_natural_saddle_tendsto hh hL hcost hspace lam (Eventually.of_forall hg)).add + ((naturalEdgeScale_tendsto L).div_const 2) + have hlim' : Tendsto (fun n => saddleSubcriticalError (lam n)+naturalEdgeScale n L/2) atTop (𝓝 0) := by + simpa only [zero_div,add_zero] using hlim + filter_upwards [hlim'.eventually (gt_mem_nhds hε)] with n hn + intro x hx + by_contra hnot + have hex : ∃ y, bad n y := ⟨x,hx,le_of_not_gt hnot⟩ + have hh := (Classical.choose_spec hex).2 + have he : lam n = Classical.choose hex := dite_eq_left hex + rw [he] at hn + exact (not_lt_of_ge hh) hn + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/SmallBall.lean b/lean/OAI/MathematicalPhysics/CriticalSK/SmallBall.lean new file mode 100644 index 0000000000000000000000000000000000000000..e64b06c10de2ae3d51f8a16b6d9a11cfd5726590 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/SmallBall.lean @@ -0,0 +1,316 @@ +import OAI.MathematicalPhysics.CriticalSK.DisorderTransfer +import OAI.MathematicalPhysics.CriticalSK.OrientationLimits + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open scoped BigOperators ENNReal NNReal Real Topology + +open MeasureTheory ProbabilityTheory Filter + +open scoped ENNReal NNReal + +open scoped BigOperators NNReal + +open scoped BigOperators + +open scoped BigOperators InnerProductSpace + +open Module + +open Matrix Polynomial + +open scoped BigOperators Topology + +open Filter + +open scoped BigOperators NNReal ENNReal Topology Pointwise Matrix.Norms.Elementwise + +open Set Metric MeasureTheory MeasureTheory.Measure + +open scoped ENNReal NNReal BigOperators + +open MeasureTheory ProbabilityTheory + +open scoped ENNReal NNReal Topology + +open MeasureTheory MeasureTheory.Measure Set Metric + +open scoped NNReal ENNReal BigOperators + +open scoped NNReal ENNReal + +open ProbabilityTheory + +open Metric Set MeasureTheory + +open scoped ENNReal Pointwise + +open MeasureTheory Filter Set Real + +open Finset Real + +open scoped BigOperators ENNReal Topology + +open Set MeasureTheory + +open scoped BigOperators ENNReal + +open MeasureTheory + +open Finset Real Filter + +open scoped Topology + +namespace CriticalSK + +section + +lemma gaussian_inverse_sqrt_bound {s v : ℝ} (hs : 0 < s) (hv : 1/(2*s) ≤ v) : + (Real.sqrt (2*Real.pi*v))⁻¹ ≤ Real.sqrt s := by + have hv0 : 0 < v := (by positivity : (0:ℝ) < 1/(2*s)).trans_le hv + have hp : 1 ≤ Real.pi := by linarith [Real.two_le_pi] + have hprod : 1 ≤ 2*Real.pi*v*s := by + have hh := (div_le_iff₀ (by positivity : (0:ℝ) < 2*s)).mp hv + have hhs : 0 ≤ 2*v*s := by positivity + nlinarith [mul_le_mul_of_nonneg_right hp hhs] + have hr : 1 ≤ Real.sqrt (2*Real.pi*v)*Real.sqrt s := by + rw [← Real.sqrt_mul (by positivity)] + simpa using Real.sqrt_le_sqrt hprod + rw [inv_eq_one_div,div_le_iff₀ (Real.sqrt_pos.mpr (by positivity))] + nlinarith + +lemma spectralGood_sphere_smallBall {n : ℕ} {lam : Fin (n+3) → ℝ} {h s b : ℝ} + (hh : 0 ≤ h) (hs : 0 < s) (hs1 : s ≤ 1) + (hcost : traceCost (n+2) h s ≤ 1/100) (hlam : lam ∈ spectralGood (n+2) h s) + (hspace : 32768 ≤ (n+3:ℝ)*s*Real.sqrt s) + (h0 : |lam 0-2| ≤ s/4) (h1 : |lam 1-2| ≤ s/4) (h2 : |lam 2-2| ≤ s/4) + (hb : 0 ≤ b) : + (sphereTilted lam 1 (Real.sqrt (n+3))).real + {u : unitSphere (Fin (n+3)) | |(Real.sqrt (n+3) • u.val) 2| ≤ b} ≤ + 4*b*Real.sqrt s*Real.exp (6*((n+3:ℝ)*s*Real.sqrt s)) := by + have hv := spectralGood_fixed_variance (n := n+1) hh hs hs1 hcost hlam + (by norm_num only [Nat.cast_add,Nat.cast_one,Nat.cast_ofNat,add_assoc]; exact hspace) + have hd := fixedBulkDeficit_bounds (n := n+1) hh hs hs1 hcost hlam + (by norm_num only [Nat.cast_add,Nat.cast_one,Nat.cast_ofNat,add_assoc]; exact hspace) + norm_num only [Nat.cast_add,Nat.cast_one,Nat.cast_ofNat,add_assoc] at hv hd + have hn : (0:ℝ) < n+3 := by positivity + have hroot : 0 < Real.sqrt (n+3:ℝ) := Real.sqrt_pos.mpr hn + have hm : 0 < (1:ℝ)/(2*s) := by positivity + have hz (j) : fixedEdgeVariance lam s j ≠ 0 := fixedEdgeVariance_pos hv.1 j + have hq (j) : (fixedEdgeVariance lam s j:ℝ)⁻¹ = 2+s-1*lam j := by + simpa only [one_mul] using fixedEdgeVariance_inverse hv.1 j + have hb' := sphereTilted_smallBall lam 1 (2+s) (fixedEdgeVariance lam s) hz hq hn hm + (fixedEdgeVariance_lower hs hv.1 0 h0) (fixedEdgeVariance_lower hs hv.1 1 h1) hd.1 + (div_nonneg hb hroot.le) (by unfold fixedBulkDeficit; push_cast; ring) hd.2.2 + have hset : {u : unitSphere (Fin (n+3)) | |u.val (0 : Fin (n+1)).succ.succ| ≤ b/Real.sqrt (n+3)} = + {u : unitSphere (Fin (n+3)) | |(Real.sqrt (n+3) • u.val) 2| ≤ b} := by + ext u + change |u.val 2| ≤ b/Real.sqrt (n+3) ↔ |Real.sqrt (n+3)*u.val 2| ≤ b + rw [abs_mul,abs_of_nonneg hroot.le,le_div_iff₀ hroot,mul_comm] + rw [hset] at hb' + have hsq := gaussian_inverse_sqrt_bound hs (fixedEdgeVariance_lower hs hv.1 2 h2) + have he := Real.exp_le_exp.mpr hd.2.1 + have hb'' : (sphereTilted lam 1 (Real.sqrt (n+3))).real + {u : unitSphere (Fin (n+3)) | |(Real.sqrt (n+3) • u.val) 2| ≤ b} ≤ + 4*b*(Real.sqrt (2*Real.pi*(fixedEdgeVariance lam s 2:ℝ)))⁻¹*Real.exp (fixedBulkDeficit lam s/((1:ℝ)/(2*s))) := by + simpa only [Measure.real,div_mul_cancel₀ _ hroot.ne',show (0:Fin (n+1)).succ.succ = (2:Fin (n+3)) from rfl] using hb' + exact hb''.trans (mul_le_mul (mul_le_mul_of_nonneg_left hsq (by positivity)) he + (Real.exp_pos _).le (by positivity)) + +open Set MeasureTheory Filter + +def naturalSmallBallConstant (L : ℝ) : ℝ := 4*Real.sqrt L*Real.exp (6*(L*Real.sqrt L)) + +lemma spectralGood_natural_sphere_bounds {h L : ℝ} (hh : 0 ≤ h) (hL : 262144 ≤ L) + (hcost : edgeFixedCost h L < 1/100) : + ∀ᶠ n : ℕ in atTop, ∀ lam ∈ spectralGood (n+3) h (naturalEdgeScale (n+3) L), + (∀ b : ℝ, 0 ≤ b → (sphereTilted lam 1 (Real.sqrt (n+4))).real + {u : unitSphere (Fin (n+4)) | |(Real.sqrt (n+4) • u.val) 2| ≤ b*(n+4:ℝ)^(1/3:ℝ)} ≤ + naturalSmallBallConstant L*b) ∧ + ((∑ i, (∫ u : unitSphere (Fin (n+4)), ((Real.sqrt (n+4) • u.val) i)^2 + ∂sphereTilted lam 1 (Real.sqrt (n+4)))^2)/(n+4:ℝ)^2 ≤ naturalOverlapRate (n+3) L) := by + have hLp : 0 < L := by linarith + have hLa : 1696 ≤ L := by linarith + have hc := (tendsto_add_atTop_nat 3).eventually (traceCost_natural_eventually hh hLp hcost) + have hs := (tendsto_add_atTop_nat 3).eventually + ((naturalEdgeScale_tendsto L).eventually (gt_mem_nhds (by norm_num : (0:ℝ) < 1))) + have hf := (tendsto_add_atTop_nat 3).eventually edgeLength_tents_eventually + filter_upwards [hc,hs,hf] with n hnc hns hnf + intro lam hlam + let s := naturalEdgeScale (n+3) L + have hsp : 0 < s := naturalEdgeScale_pos (n+3) hLp + have hsm : s ≤ 1 := hns.le + have hspace := naturalEdgeScale_space (n+3) hLp + norm_num only [Nat.cast_add,Nat.cast_ofNat] at hspace + rw [show (n:ℝ)+3+1=n+4 by ring] at hspace + have hsc : 32768 ≤ (n+4:ℝ)*s*Real.sqrt s := by + have hl := largeL_space hL + linarith [hspace.1] + have hclose (i : Fin (n+4)) (hi : i.val < 3) : |lam i-2| ≤ s/4 := + spectralGood_top_close hh hLa hsm hnf hnc hlam i hi + have hexp : Real.exp (6*((n+4:ℝ)*s*Real.sqrt s)) ≤ Real.exp (6*(L*Real.sqrt L)) := + Real.exp_le_exp.mpr (by linarith [hspace.2]) + constructor + · intro b hb + have hball := spectralGood_sphere_smallBall (n := n+1) hh hsp hsm hnc hlam + (by norm_num only [Nat.cast_add,Nat.cast_ofNat,add_assoc]; exact hsc) + (hclose 0 (by simp)) (hclose 1 (by simp)) (hclose 2 (by change 2 < 3; omega)) + (show 0 ≤ b*(n+4:ℝ)^(1/3:ℝ) by positivity) + norm_num only [Nat.cast_add,Nat.cast_ofNat,add_assoc] at hball + have hr := natural_smallBall_rate (n+3) hLp.le + norm_num only [Nat.cast_add,Nat.cast_ofNat] at hr + rw [show (n:ℝ)+3+1=n+4 by ring] at hr + apply hball.trans + have hm : 4*(b*(n+4:ℝ)^(1/3:ℝ))*Real.sqrt s ≤ 4*b*Real.sqrt L := by + simpa only [mul_assoc,mul_left_comm,mul_comm] using mul_le_mul_of_nonneg_left hr (show 0 ≤ 4*b by positivity) + have ht := mul_le_mul hm hexp (Real.exp_pos _).le (show 0 ≤ 4*b*Real.sqrt L by positivity) + simpa only [naturalSmallBallConstant,mul_assoc,mul_left_comm,mul_comm] using ht + · have hsphere := spectralGood_sphere_overlap (n := n+2) hh hsp hsm hnc hlam + (by norm_num only [Nat.cast_add,Nat.cast_ofNat,add_assoc]; exact hsc) + (hclose 0 (by simp)) (hclose 1 (by simp)) + norm_num only [Nat.cast_add,Nat.cast_ofNat,add_assoc] at hsphere + rw [sphereTilted_overlap_moment] at hsphere + have hA : (16*Real.exp (6*((n+4:ℝ)*s*Real.sqrt s)))^2 ≤ (16*Real.exp (6*(L*Real.sqrt L)))^2 := + pow_le_pow_left₀ (by positivity) (mul_le_mul_of_nonneg_left hexp (by norm_num)) 2 + have hx := hsphere.trans (mul_le_mul_of_nonneg_right hA (show 0 ≤ 16*(n+4)/Real.sqrt s by positivity)) + have ht := div_le_div_of_nonneg_right hx (sq_nonneg (n+4:ℝ)) + apply ht.trans_eq + unfold naturalOverlapRate + norm_num only [Nat.cast_add,Nat.cast_ofNat] + rw [show (n:ℝ)+3+1=n+4 by ring] + dsimp only [s] + field_simp [(Real.sqrt_pos.mpr hsp).ne'] + +lemma spectralGood_orientation_overlap {h L : ℝ} (hh : 0 ≤ h) (hL : 262144 ≤ L) + (hcost : edgeFixedCost h L < 1/100) {ε : ℝ} (hε : 0 < ε) : + ∀ᶠ n : ℕ in atTop, ∀ lam ∈ spectralGood (n+3) h (naturalEdgeScale (n+3) L), + (∫ U, rotatedCubePair lam (fun q => q^2) U ∂orthogonalHaar (Fin (n+4))) / + spherePartition lam 1 (Real.sqrt (n+4))^2 ≤ + (1+ε)*naturalOverlapRate (n+3) L+naturalOrientationTail (n+3) L := by + have ho := (tendsto_add_atTop_nat 4).eventually (orientation_normalized_overlap_bound ε hε) + filter_upwards [naturalOrientationInputs hh hL hcost, spectralGood_natural_sphere_bounds hh hL hcost,ho] with n hn hb hv + intro lam hlam + have hi := hn lam hlam + obtain ⟨u,v,hu,hv',huv⟩ := orthogonal_equal_norm_pair (n+2) (Real.sqrt (n+4)) (Real.sqrt_nonneg _) + have hh := hv lam u v _ _ + (by simpa only [Nat.cast_add,Nat.cast_ofNat] using hu) + (by simpa only [Nat.cast_add,Nat.cast_ofNat] using hv') huv hi.bounded hi.Kpos hi.partitionLower hi.scaleNonneg + hi.topUpper hi.topLower hi.trace hi.traceUniform hi.cutoff hi.saddle + have hsphere := sphereOverlap_density_weighted_moment n lam (Real.sqrt_pos.mpr (by positivity : (0:ℝ) < n+4)) hu hv' huv + have hroot : Real.sqrt (n+4:ℝ)^4 = (n+4:ℝ)^2 := by + rw [show (4:ℕ) = 2*2 by omega,pow_mul,Real.sq_sqrt (by positivity)] + rw [hroot] at hsphere + norm_num only [Nat.cast_add,Nat.cast_ofNat] at hh + rw [hsphere] at hh + apply hh.trans + have ht := add_le_add_right (mul_le_mul_of_nonneg_left (hb lam hlam).2 + (show 0 ≤ 1+ε by linarith)) (naturalOrientationTail (n+3) L) + simpa only [naturalOrientationTail,Nat.cast_add,Nat.cast_ofNat,show (n:ℝ)+3+1=n+4 by ring, + show (n:ℝ)+3+2=n+4+1 by ring, show n+3+1=n+4 by omega, add_comm] using ht + +end + +open Set MeasureTheory Filter + +instance disorderLaw_probability (n : ℕ) : IsProbabilityMeasure (disorderLaw n) := by + unfold disorderLaw + infer_instance + +lemma goe_natural_spectral_bad {h L : ℝ} (hh : 0 ≤ h) (hL : 262144 ≤ L) + (hcost : edgeFixedCost h L < 1/100) : + ∀ᶠ n : ℕ in atTop, (goeLaw (Fin (n+1)) (goeScale n)).real + (matrixOrderedEigenvalues ⁻¹' (spectralGood n h (naturalEdgeScale n L))ᶜ) ≤ 32*Real.exp (-h^2) := by + have hLp : 0 < L := by linarith + have hL1 : 1 ≤ L := by linarith + filter_upwards [traceCost_natural_eventually hh hLp hcost, + (naturalEdgeScale_tendsto L).eventually (gt_mem_nhds (by norm_num : (0:ℝ) < 1))] with n hc hs + apply goe_spectral_bad_probability n hh (naturalEdgeScale_pos n hLp) (naturalEdgeScale_base n hL1) + have ht := traceCost_small n hh (naturalEdgeScale_pos n hLp) hs.le hc + have hA : 0 ≤ formA n h*(naturalEdgeScale n L)^(-5/8:ℝ) := by + exact mul_nonneg (formA_nonneg n hh) (Real.rpow_nonneg (naturalEdgeScale_pos n hLp).le _) + have hB : 0 ≤ formB n / naturalEdgeScale n L := div_nonneg (formB_nonneg n) (naturalEdgeScale_pos n hLp).le + nlinarith + +lemma disorder_goe_event (n : ℕ) {E : Set (Disorder (n+1))} (hE : MeasurableSet E) : + (disorderLaw (n+1)).real E = (goeLaw (Fin (n+1)) (goeScale n)).real (gaussianDisorder ⁻¹' E) := by + rw [← goe_disorder_law n] + unfold Measure.real + rw [Measure.map_apply (gaussianDisorder_measurable _) hE] + +lemma natural_smallBallObstruction_probability {h L : ℝ} (hh : 0 ≤ h) (hL : 262144 ≤ L) + (hcost : edgeFixedCost h L < 1/100) {ε : ℝ} (hε : 0 < ε) {b δ : ℝ} (hb : 0 ≤ b) (hδ : 0 < δ) : + ∀ᶠ n : ℕ in atTop, (disorderLaw (n+4)).real + (smallBallObstruction (n+4) (b*(n+4:ℝ)^(1/3:ℝ)) δ) ≤ + 32*Real.exp (-h^2)+(2*naturalSmallBallConstant L*b+4*(ε+naturalOrientationTail (n+3) L))/δ := by + have hspectral := (tendsto_add_atTop_nat 3).eventually (goe_natural_spectral_bad hh hL hcost) + filter_upwards [hspectral,spectralGood_natural_sphere_bounds hh hL hcost, + spectralGood_orientation_variance hh hL hcost hε] with n hn hball hvar + rw [disorder_goe_event (n+3) (smallBallObstruction_closed _ _ _).measurableSet] + let G : Set (GaussianMatrix (Fin (n+4))) := matrixOrderedEigenvalues ⁻¹' spectralGood (n+3) h (naturalEdgeScale (n+3) L) + have hG : MeasurableSet G := (spectralGood_measurable _ _ _).preimage (matrixOrderedEigenvalues_measurable _) + have he := goe_event_from_orbit_bound (goeScale (n+3)) + ((smallBallObstruction_closed _ _ _).measurableSet.preimage (gaussianDisorder_measurable _)) hG + (show 0 ≤ (2*naturalSmallBallConstant L*b+4*(ε+naturalOrientationTail (n+3) L))/δ from by + unfold naturalSmallBallConstant naturalOrientationTail; positivity) + (fun A hAG hA => by + have hbnd := haar_smallBallObstruction_bound (by omega : 0 < n+4) A hA + (b*(n+4:ℝ)^(1/3:ℝ)) hδ (2 : Fin (n+4)) + apply hbnd.trans + apply div_le_div_of_nonneg_right _ hδ.le + have hB := (hball (matrixOrderedEigenvalues A) hAG).1 b hb + have hV := hvar (matrixOrderedEigenvalues A) hAG + simpa only [Nat.cast_add,Nat.cast_ofNat,mul_assoc] using + add_le_add (mul_le_mul_of_nonneg_left hB (by norm_num : (0:ℝ) ≤ 2)) + (mul_le_mul_of_nonneg_left hV (by norm_num : (0:ℝ) ≤ 4))) + exact he.trans (add_le_add hn le_rfl) + +lemma naturalSmallBallConstant_pos {L : ℝ} (hL : 0 < L) : 0 < naturalSmallBallConstant L := by + unfold naturalSmallBallConstant + positivity + +lemma exists_spectral_failure_parameter {α : ℝ} (hα : 0 < α) : + ∃ h : ℝ, 0 ≤ h ∧ 32*Real.exp (-h^2) < α := by + have hh : Tendsto (fun h : ℝ => -h^2) atTop atBot := + tendsto_neg_atTop_atBot.comp (tendsto_pow_atTop (by norm_num : 2 ≠ 0)) + have ht : Tendsto (fun h : ℝ => 32*Real.exp (-h^2)) atTop (𝓝 0) := by + simpa using (Real.tendsto_exp_atBot.comp hh).const_mul 32 + exact ((eventually_ge_atTop 0).and (ht.eventually (gt_mem_nhds hα))).exists + +lemma natural_smallBall_tight {δ α : ℝ} (hδ : 0 < δ) (hα : 0 < α) : + ∃ b : ℝ, 0 < b ∧ ∀ᶠ n : ℕ in atTop, (disorderLaw (n+4)).real + (smallBallObstruction (n+4) (b*(n+4:ℝ)^(1/3:ℝ)) δ) < α := by + obtain ⟨h,hh,hfail⟩ := exists_spectral_failure_parameter (show 0 < α/4 by positivity) + obtain ⟨L,hL,hcost⟩ := ((eventually_ge_atTop (262144:ℝ)).and + ((edgeFixedCost_tendsto h).eventually (gt_mem_nhds (by norm_num : (0:ℝ) < 1/100)))).exists + have hLp : 0 < L := by linarith + let C := naturalSmallBallConstant L + have hC : 0 < C := naturalSmallBallConstant_pos hLp + let b := α*δ/(16*C) + let ε := α*δ/32 + have hb : 0 < b := by dsimp [b]; positivity + have hε : 0 < ε := by dsimp [ε]; positivity + refine ⟨b,hb,?_⟩ + have ht : Tendsto (fun n : ℕ => naturalOrientationTail (n+3) L) atTop (𝓝 0) := by + have hs := (naturalOrientationTail_scaled_tendsto hLp 0).comp (tendsto_add_atTop_nat 3) + simpa only [Function.comp_def,Real.rpow_zero,one_mul] using hs + filter_upwards [natural_smallBallObstruction_probability hh hL hcost hε hb.le hδ, + ht.eventually (gt_mem_nhds hε)] with n hn htail + apply lt_of_le_of_lt hn + have hbc : 2*C*b = α*δ/8 := by dsimp only [b]; field_simp; ring + change 32*Real.exp (-h^2)+(2*C*b+4*(ε+naturalOrientationTail (n+3) L))/δ < α + rw [hbc] + have hfrac : (α*δ/8+4*(ε+naturalOrientationTail (n+3) L))/δ < 3*α/4 := by + apply (div_lt_iff₀ hδ).mpr + dsimp only [ε] at htail ⊢ + nlinarith + linarith + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/SphereGeometry.lean b/lean/OAI/MathematicalPhysics/CriticalSK/SphereGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..fbab64bd49f682a18af7164290c4ee095f341de6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/SphereGeometry.lean @@ -0,0 +1,1444 @@ +import OAI.MathematicalPhysics.CriticalSK.SpinModel + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open MeasureTheory ProbabilityTheory + +open scoped ENNReal NNReal + +open scoped BigOperators InnerProductSpace + +open Module + +open scoped BigOperators ENNReal NNReal Real Topology + +open MeasureTheory ProbabilityTheory Filter + +open scoped BigOperators NNReal + +open scoped BigOperators + +open Matrix Polynomial + +open scoped BigOperators Topology + +open Filter + +open scoped BigOperators NNReal ENNReal Topology Pointwise Matrix.Norms.Elementwise + +open Set Metric MeasureTheory MeasureTheory.Measure + +open scoped ENNReal NNReal Topology +open MeasureTheory MeasureTheory.Measure Set Metric +open scoped BigOperators ENNReal Topology +open Set MeasureTheory +open scoped BigOperators ENNReal +open MeasureTheory +namespace CriticalSK + + +section + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +lemma orthogonal_entry_bound (U : Matrix.orthogonalGroup ι ℝ) (i j : ι) : + |(U : Matrix ι ι ℝ) i j| ≤ 1 := by + have h : (∑ k : ι, ((U : Matrix ι ι ℝ) k j)^2) = 1 := by + have he := congrArg (fun A : Matrix ι ι ℝ => A j j) (Unitary.star_mul_self_of_mem U.property) + simpa only [Matrix.mul_apply, Matrix.star_apply, star_trivial, Matrix.one_apply_eq, + ← sq] using he + have hl : ((U : Matrix ι ι ℝ) i j)^2 ≤ 1 := by + rw [← h] + exact Finset.single_le_sum (f := fun k => ((U : Matrix ι ι ℝ) k j)^2) + (fun k _ => sq_nonneg _) (Finset.mem_univ i) + nlinarith [sq_abs ((U : Matrix ι ι ℝ) i j), abs_nonneg ((U : Matrix ι ι ℝ) i j)] + +instance orthogonalGroup_compactSpace : CompactSpace (Matrix.orthogonalGroup ι ℝ) := by + apply isCompact_iff_compactSpace.mp + apply Metric.isCompact_of_isClosed_isBounded (isClosed_unitary (R := Matrix ι ι ℝ)) + apply Metric.isBounded_iff_subset_closedBall (0 : Matrix ι ι ℝ) |>.mpr + refine ⟨1, ?_⟩ + intro A hA + rw [mem_closedBall, dist_zero_right] + apply (pi_norm_le_iff_of_nonneg (by norm_num : (0:ℝ) ≤ 1)).mpr + intro i + apply (pi_norm_le_iff_of_nonneg (by norm_num : (0:ℝ) ≤ 1)).mpr + intro j + exact orthogonal_entry_bound ⟨A,hA⟩ i j + +instance orthogonalGroup_measurableSpace : MeasurableSpace (Matrix.orthogonalGroup ι ℝ) := + borel _ + +instance orthogonalGroup_borelSpace : BorelSpace (Matrix.orthogonalGroup ι ℝ) := ⟨rfl⟩ + +def orthogonalHaar (ι : Type*) [Fintype ι] [DecidableEq ι] : + Measure (Matrix.orthogonalGroup ι ℝ) := + Measure.haarMeasure ⟨⟨univ, isCompact_univ⟩, by simpa only [interior_univ] using Set.univ_nonempty⟩ + +instance orthogonalHaar_probability : IsProbabilityMeasure (orthogonalHaar ι) := by + constructor + exact Measure.haarMeasure_self + +instance orthogonalHaar_leftInvariant : IsMulLeftInvariant (orthogonalHaar ι) := by + unfold orthogonalHaar + infer_instance + +instance orthogonalHaar_haar : IsHaarMeasure (orthogonalHaar ι) := by + unfold orthogonalHaar + infer_instance + +instance orthogonalHaar_rightInvariant : IsMulRightInvariant (orthogonalHaar ι) := by + constructor + intro g + let ν := (orthogonalHaar ι).map (· * g) + have hν : IsProbabilityMeasure ν := inferInstance + have he := isMulInvariant_eq_smul_of_compactSpace ν (orthogonalHaar ι) + have hf := congrArg (fun μ : Measure (Matrix.orthogonalGroup ι ℝ) => μ univ) he + simp only [measure_univ, Measure.smul_apply, ENNReal.smul_def, smul_eq_mul, mul_one] at hf + have hf' : haarScalarFactor ν (orthogonalHaar ι) = 1 := by exact_mod_cast hf.symm + rw [hf', one_smul] at he + exact he + +lemma euclideanMatrix_mul_apply (A B : Matrix ι ι ℝ) (x : EuclideanSpace ℝ ι) : + (A*B).toEuclideanLin x = A.toEuclideanLin (B.toEuclideanLin x) := by + exact congrArg (fun L : EuclideanSpace ℝ ι →ₗ[ℝ] EuclideanSpace ℝ ι => L x) + (Matrix.toLpLin_mul 2 2 2 A B) + +lemma euclideanMatrix_one_apply (x : EuclideanSpace ℝ ι) : + (1 : Matrix ι ι ℝ).toEuclideanLin x = x := by + simp only [Matrix.toEuclideanLin, Matrix.toLpLin_one, LinearMap.id_apply] + +lemma orthogonal_inner_map (U : Matrix.orthogonalGroup ι ℝ) (x y : EuclideanSpace ℝ ι) : + inner ℝ ((U : Matrix ι ι ℝ).toEuclideanLin x) ((U : Matrix ι ι ℝ).toEuclideanLin y) = + inner ℝ x y := by + rw [← LinearMap.adjoint_inner_right, ← Matrix.toEuclideanLin_conjTranspose_eq_adjoint, + ← euclideanMatrix_mul_apply] + rw [← Matrix.star_eq_conjTranspose, Unitary.star_mul_self_of_mem U.property, + euclideanMatrix_one_apply] + +def orthogonalIsometry (U : Matrix.orthogonalGroup ι ℝ) : + EuclideanSpace ℝ ι ≃ₗᵢ[ℝ] EuclideanSpace ℝ ι where + toLinearMap := (U : Matrix ι ι ℝ).toEuclideanLin + invFun := (star (U : Matrix ι ι ℝ)).toEuclideanLin + left_inv x := by + change (star (U : Matrix ι ι ℝ)).toEuclideanLin ((U : Matrix ι ι ℝ).toEuclideanLin x) = x + rw [← euclideanMatrix_mul_apply, Unitary.star_mul_self_of_mem U.property, + euclideanMatrix_one_apply] + right_inv x := by + change (U : Matrix ι ι ℝ).toEuclideanLin ((star (U : Matrix ι ι ℝ)).toEuclideanLin x) = x + rw [← euclideanMatrix_mul_apply, Unitary.mul_star_self_of_mem U.property, + euclideanMatrix_one_apply] + norm_map' := (LinearMap.norm_map_iff_inner_map_map _).mpr (orthogonal_inner_map U) + +lemma orthogonalIsometry_apply (U : Matrix.orthogonalGroup ι ℝ) (x : EuclideanSpace ℝ ι) (i : ι) : + orthogonalIsometry U x i = ∑ j, (U : Matrix ι ι ℝ) i j * x j := rfl + +lemma orthogonalIsometry_mul (U V : Matrix.orthogonalGroup ι ℝ) (x : EuclideanSpace ℝ ι) : + orthogonalIsometry (U*V) x = orthogonalIsometry U (orthogonalIsometry V x) := + euclideanMatrix_mul_apply _ _ _ + +lemma orthogonalIsometry_continuous : + Continuous (fun p : Matrix.orthogonalGroup ι ℝ × EuclideanSpace ℝ ι => orthogonalIsometry p.1 p.2) := by + change Continuous (fun p : Matrix.orthogonalGroup ι ℝ × EuclideanSpace ℝ ι => + WithLp.toLp 2 (fun i => ∑ j, (p.1 : Matrix ι ι ℝ) i j * p.2 j)) + apply (PiLp.continuous_toLp 2 (fun _ : ι => ℝ)).comp + apply continuous_pi + intro i + apply continuous_finsetSum + intro j _ + have hU : Continuous (fun p : Matrix.orthogonalGroup ι ℝ × EuclideanSpace ℝ ι => + (p.1 : Matrix ι ι ℝ)) := continuous_subtype_val.comp continuous_fst + exact ((continuous_apply j).comp ((continuous_apply i).comp hU)).mul + ((PiLp.continuous_apply 2 _ j).comp continuous_snd) + +lemma orthogonalIsometry_fixed_continuous (x : EuclideanSpace ℝ ι) : + Continuous (fun U : Matrix.orthogonalGroup ι ℝ => orthogonalIsometry U x) := by + change Continuous (fun U : Matrix.orthogonalGroup ι ℝ => + WithLp.toLp 2 (fun i => ∑ j, (U : Matrix ι ι ℝ) i j * x j)) + apply (PiLp.continuous_toLp 2 (fun _ : ι => ℝ)).comp + apply continuous_pi + intro i + apply continuous_finsetSum + intro j _ + have hU : Continuous (fun U : Matrix.orthogonalGroup ι ℝ => (U : Matrix ι ι ℝ)) := + continuous_subtype_val + exact ((continuous_apply j).comp ((continuous_apply i).comp hU)).mul continuous_const + +def matrixOfIsometry (U : EuclideanSpace ℝ ι ≃ₗᵢ[ℝ] EuclideanSpace ℝ ι) : Matrix.orthogonalGroup ι ℝ := + ⟨U.toMatrix (EuclideanSpace.basisFun ι ℝ).toBasis (EuclideanSpace.basisFun ι ℝ).toBasis, + U.toMatrix_mem_unitaryGroup _ _⟩ + +lemma orthogonalIsometry_matrixOfIsometry (U : EuclideanSpace ℝ ι ≃ₗᵢ[ℝ] EuclideanSpace ℝ ι) : + orthogonalIsometry (matrixOfIsometry U) = U := by + ext x i + change (Matrix.toEuclideanLin (LinearMap.toMatrix (EuclideanSpace.basisFun ι ℝ).toBasis + (EuclideanSpace.basisFun ι ℝ).toBasis U.toLinearMap) x) i = U x i + rw [Matrix.toEuclideanLin_eq_toLin_orthonormal, Matrix.toLin_toMatrix] + rfl + +lemma orthogonal_transitive {x y : EuclideanSpace ℝ ι} (hxy : ‖x‖ = ‖y‖) : + ∃ U : Matrix.orthogonalGroup ι ℝ, orthogonalIsometry U x = y := by + refine ⟨matrixOfIsometry (Submodule.reflection (ℝ ∙ (x-y))ᗮ), ?_⟩ + rw [orthogonalIsometry_matrixOfIsometry] + exact Submodule.reflection_sub hxy + +end + + +section + +variable {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] + +def sphereMap (U : E ≃ₗᵢ[ℝ] E) (u : sphere (0:E) 1) : sphere (0:E) 1 := + ⟨U u.val, mem_sphere_zero_iff_norm.mpr (by rw [U.norm_map]; exact mem_sphere_zero_iff_norm.mp u.property)⟩ + +lemma sphereMap_continuous (U : E ≃ₗᵢ[ℝ] E) : Continuous (sphereMap U) := by + exact (U.continuous.comp continuous_subtype_val).subtype_mk _ + +lemma sphereMap_symm (U : E ≃ₗᵢ[ℝ] E) (u : sphere (0:E) 1) : + sphereMap U (sphereMap U.symm u) = u := by + apply Subtype.ext + exact U.apply_symm_apply u.val + +lemma sphereMap_cone_preimage (U : E ≃ₗᵢ[ℝ] E) (A : Set (sphere (0:E) 1)) : + Ioo (0:ℝ) 1 • (Subtype.val '' (sphereMap U ⁻¹' A)) = + U ⁻¹' (Ioo (0:ℝ) 1 • (Subtype.val '' A)) := by + ext x + constructor + · rintro ⟨r, hr, y, ⟨u, hu, rfl⟩, rfl⟩ + exact ⟨r, hr, U u.val, ⟨sphereMap U u, hu, rfl⟩, (U.map_smul r u.val).symm⟩ + · rintro ⟨r, hr, y, ⟨u, hu, rfl⟩, hy⟩ + refine ⟨r, hr, U.symm u.val, ⟨sphereMap U.symm u, ?_, rfl⟩, ?_⟩ + · change sphereMap U (sphereMap U.symm u) ∈ A + rwa [sphereMap_symm] + · apply U.injective + rw [U.map_smul, U.apply_symm_apply] + exact hy + +variable [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] + +lemma sphereMap_preserving (U : E ≃ₗᵢ[ℝ] E) : + MeasurePreserving (sphereMap U) (volume : Measure E).toSphere + (volume : Measure E).toSphere := by + constructor + · exact (sphereMap_continuous U).measurable + · ext A hA + rw [Measure.map_apply (sphereMap_continuous U).measurable hA, + Measure.toSphere_apply' _ ((sphereMap_continuous U).measurable hA), + Measure.toSphere_apply' _ hA, sphereMap_cone_preimage, + U.measurePreserving.measure_preimage_emb U.toHomeomorph.measurableEmbedding] + +end + + +section + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +abbrev unitSphere (ι : Type*) [Fintype ι] := Metric.sphere (0 : EuclideanSpace ℝ ι) 1 + +def orthogonalSphere (U : Matrix.orthogonalGroup ι ℝ) (u : unitSphere ι) : unitSphere ι := + sphereMap (orthogonalIsometry U) u + +lemma orthogonalSphere_continuous : + Continuous (fun p : Matrix.orthogonalGroup ι ℝ × unitSphere ι => orthogonalSphere p.1 p.2) := by + exact (orthogonalIsometry_continuous.comp (continuous_fst.prodMk + (continuous_subtype_val.comp continuous_snd))).subtype_mk _ + +lemma orthogonalSphere_mul (U V : Matrix.orthogonalGroup ι ℝ) (u : unitSphere ι) : + orthogonalSphere (U*V) u = orthogonalSphere U (orthogonalSphere V u) := by + apply Subtype.ext + exact orthogonalIsometry_mul U V u.val + +lemma orthogonalSphere_transitive (u w : unitSphere ι) : + ∃ U : Matrix.orthogonalGroup ι ℝ, orthogonalSphere U u = w := by + obtain ⟨U,hU⟩ := orthogonal_transitive + ((mem_sphere_zero_iff_norm.mp u.property).trans (mem_sphere_zero_iff_norm.mp w.property).symm) + exact ⟨U, Subtype.ext hU⟩ + +lemma orthogonalSphere_integral (U : Matrix.orthogonalGroup ι ℝ) (f : unitSphere ι → ℝ) : + (∫ u, f (orthogonalSphere U u) ∂(volume : Measure (EuclideanSpace ℝ ι)).toSphere) = + ∫ u, f u ∂(volume : Measure (EuclideanSpace ℝ ι)).toSphere := by + apply (sphereMap_preserving (orthogonalIsometry U)).integral_comp + apply (sphereMap_continuous (orthogonalIsometry U)).measurableEmbedding + intro u w h + apply Subtype.ext + exact (orthogonalIsometry U).injective (congrArg Subtype.val h) + +lemma orthogonal_orbit_integral_eq (f : unitSphere ι → ℝ) (u w : unitSphere ι) : + (∫ U, f (orthogonalSphere U u) ∂orthogonalHaar ι) = + ∫ U, f (orthogonalSphere U w) ∂orthogonalHaar ι := by + obtain ⟨V,hV⟩ := orthogonalSphere_transitive u w + rw [← hV] + simp_rw [← orthogonalSphere_mul] + exact (integral_mul_right_eq_self (fun U => f (orthogonalSphere U u)) V).symm + +variable [Nonempty ι] + +def sphereArea : ℝ := (volume : Measure (EuclideanSpace ℝ ι)).toSphere.real Set.univ + +def sphereAverage (f : unitSphere ι → ℝ) : ℝ := + (∫ u, f u ∂(volume : Measure (EuclideanSpace ℝ ι)).toSphere) / sphereArea (ι := ι) + +omit [DecidableEq ι] in +lemma sphereArea_pos : 0 < sphereArea (ι := ι) := by + exact ENNReal.toReal_pos ((measure_univ_pos.mpr (Measure.toSphere_ne_zero _)).ne') + (measure_ne_top _ _) + +lemma orthogonal_first_moment (f : unitSphere ι → ℝ) (hf : Continuous f) (u : unitSphere ι) : + (∫ U, f (orthogonalSphere U u) ∂orthogonalHaar ι) = sphereAverage f := by + let σ := (volume : Measure (EuclideanSpace ℝ ι)).toSphere + let J := fun w : unitSphere ι => ∫ U, f (orthogonalSphere U w) ∂orthogonalHaar ι + have hc : Continuous (fun p : Matrix.orthogonalGroup ι ℝ × unitSphere ι => + f (orthogonalSphere p.1 p.2)) := hf.comp orthogonalSphere_continuous + have hi : Integrable (fun p : Matrix.orthogonalGroup ι ℝ × unitSphere ι => + f (orthogonalSphere p.1 p.2)) ((orthogonalHaar ι).prod σ) := by + simpa only [integrableOn_univ] using hc.continuousOn.integrableOn_compact isCompact_univ + have he : sphereArea (ι := ι) * J u = ∫ w, f w ∂σ := by + calc + _ = ∫ _w : unitSphere ι, J u ∂σ := by + rw [integral_const, smul_eq_mul] + rfl + _ = ∫ w : unitSphere ι, J w ∂σ := integral_congr_ae + (Filter.Eventually.of_forall (fun w => orthogonal_orbit_integral_eq f u w)) + _ = ∫ U, ∫ w : unitSphere ι, f (orthogonalSphere U w) ∂σ ∂orthogonalHaar ι := + (integral_integral_swap hi).symm + _ = ∫ _U : Matrix.orthogonalGroup ι ℝ, ∫ w : unitSphere ι, f w ∂σ ∂orthogonalHaar ι := by + apply integral_congr_ae + exact Filter.Eventually.of_forall (fun U => orthogonalSphere_integral U f) + _ = _ := by simp + exact (eq_div_iff (ne_of_gt (sphereArea_pos (ι := ι)))).mpr (by simpa only [mul_comm] using he) + +end + + +section + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι] + +def sphereUniform : Measure (unitSphere ι) := + ((volume : Measure (EuclideanSpace ℝ ι)).toSphere Set.univ)⁻¹ • + (volume : Measure (EuclideanSpace ℝ ι)).toSphere + +instance sphereUniform_probability : IsProbabilityMeasure (sphereUniform (ι := ι)) := by + constructor + rw [sphereUniform, Measure.smul_apply, smul_eq_mul] + exact ENNReal.inv_mul_cancel (measure_univ_pos.mpr (Measure.toSphere_ne_zero _)).ne' + (measure_ne_top _ _) + +omit [DecidableEq ι] [Nonempty ι] in +lemma sphereUniform_integral (f : unitSphere ι → ℝ) : + (∫ u, f u ∂sphereUniform) = sphereAverage f := by + rw [sphereUniform, integral_smul_measure, ENNReal.toReal_inv, smul_eq_mul] + exact inv_mul_eq_div _ _ + +lemma orthogonal_sphere_preserving (u : unitSphere ι) : + MeasurePreserving (fun U => orthogonalSphere U u) (orthogonalHaar ι) sphereUniform := by + have hc : Continuous (fun U : Matrix.orthogonalGroup ι ℝ => orthogonalSphere U u) := by + apply Continuous.subtype_mk + exact orthogonalIsometry_fixed_continuous u.val + refine ⟨hc.measurable, ?_⟩ + apply ext_of_forall_integral_eq_of_IsFiniteMeasure + intro f + rw [integral_map hc.measurable.aemeasurable f.continuous.measurable.aestronglyMeasurable, + sphereUniform_integral] + exact orthogonal_first_moment f f.continuous u + +end + + +section + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +lemma orthogonal_pair_transitive {x y x' y' : EuclideanSpace ℝ ι} + (hx : ‖x‖ = ‖x'‖) (hy : ‖y‖ = ‖y'‖) + (hxy : inner ℝ x y = inner ℝ x' y') : + ∃ U : Matrix.orthogonalGroup ι ℝ, + orthogonalIsometry U x = x' ∧ orthogonalIsometry U y = y' := by + let A := Submodule.reflection (ℝ ∙ (x-x'))ᗮ + have hA : A x = x' := Submodule.reflection_sub hx + let B := Submodule.reflection (ℝ ∙ (A y-y'))ᗮ + have hBx : B x' = x' := by + apply Submodule.reflection_mem_subspace_eq_self + rw [Submodule.mem_orthogonal_singleton_iff_inner_left, inner_sub_right] + have he : inner ℝ x' (A y) = inner ℝ x y := by + rw [← hA, A.inner_map_map] + rw [he, hxy, sub_self] + have hBy : B (A y) = y' := Submodule.reflection_sub ((A.norm_map y).trans hy) + refine ⟨matrixOfIsometry (A.trans B), ?_, ?_⟩ + · rw [orthogonalIsometry_matrixOfIsometry] + change B (A x) = x' + rw [hA, hBx] + · rw [orthogonalIsometry_matrixOfIsometry] + exact hBy + +lemma orthogonal_pair_integral_eq (f : EuclideanSpace ℝ ι → EuclideanSpace ℝ ι → ℝ) + {x y x' y' : EuclideanSpace ℝ ι} (hx : ‖x‖ = ‖x'‖) (hy : ‖y‖ = ‖y'‖) + (hxy : inner ℝ x y = inner ℝ x' y') : + (∫ U, f (orthogonalIsometry U x) (orthogonalIsometry U y) ∂orthogonalHaar ι) = + ∫ U, f (orthogonalIsometry U x') (orthogonalIsometry U y') ∂orthogonalHaar ι := by + obtain ⟨V,hVx,hVy⟩ := orthogonal_pair_transitive hx hy hxy + rw [← hVx, ← hVy] + simp_rw [← orthogonalIsometry_mul] + exact (integral_mul_right_eq_self + (fun U => f (orthogonalIsometry U x) (orthogonalIsometry U y)) V).symm + +lemma orthogonal_pair_swap (f : EuclideanSpace ℝ ι → EuclideanSpace ℝ ι → ℝ) + {x y : EuclideanSpace ℝ ι} (hxy : ‖x‖ = ‖y‖) : + (∫ U, f (orthogonalIsometry U x) (orthogonalIsometry U y) ∂orthogonalHaar ι) = + ∫ U, f (orthogonalIsometry U y) (orthogonalIsometry U x) ∂orthogonalHaar ι := by + exact orthogonal_pair_integral_eq f hxy hxy.symm (real_inner_comm _ _) + +def diagonalEnergy (lam : ι → ℝ) (x : EuclideanSpace ℝ ι) : ℝ := ∑ i, lam i * x i ^ 2 + +omit [DecidableEq ι] in +lemma diagonalEnergy_continuous (lam : ι → ℝ) : Continuous (diagonalEnergy lam) := by + apply continuous_finsetSum + intro i _ + exact continuous_const.mul ((PiLp.continuous_apply 2 _ i).pow 2) + +lemma orthogonalHaar_integrable {f : Matrix.orthogonalGroup ι ℝ → ℝ} (hf : Continuous f) : + Integrable f (orthogonalHaar ι) := by + simpa only [integrableOn_univ] using hf.continuousOn.integrableOn_compact isCompact_univ + +def pairIntegrand (lam : ι → ℝ) (x y : EuclideanSpace ℝ ι) (q : ℝ) + (U : Matrix.orthogonalGroup ι ℝ) : ℝ := + Real.exp (((1+q)*diagonalEnergy lam (orthogonalIsometry U x) + + (1-q)*diagonalEnergy lam (orthogonalIsometry U y))/2) + +def pairMoment (lam : ι → ℝ) (x y : EuclideanSpace ℝ ι) (q : ℝ) : ℝ := + ∫ U, pairIntegrand lam x y q U ∂orthogonalHaar ι + +lemma pairIntegrand_continuous (lam : ι → ℝ) (x y : EuclideanSpace ℝ ι) (q : ℝ) : + Continuous (pairIntegrand lam x y q) := by + have hx := (diagonalEnergy_continuous lam).comp (orthogonalIsometry_fixed_continuous x) + have hy := (diagonalEnergy_continuous lam).comp (orthogonalIsometry_fixed_continuous y) + exact ((continuous_const.mul hx).add (continuous_const.mul hy)).div_const 2 |>.rexp + +lemma pairMoment_nonneg (lam : ι → ℝ) (x y : EuclideanSpace ℝ ι) (q : ℝ) : + 0 ≤ pairMoment lam x y q := integral_nonneg (fun _ => (Real.exp_pos _).le) + +lemma pairMoment_even (lam : ι → ℝ) {x y : EuclideanSpace ℝ ι} + (hxy : ‖x‖ = ‖y‖) (q : ℝ) : pairMoment lam x y (-q) = pairMoment lam x y q := by + unfold pairMoment pairIntegrand + rw [orthogonal_pair_swap (fun a b => Real.exp (((1+-q)*diagonalEnergy lam a + + (1- -q)*diagonalEnergy lam b)/2)) hxy] + apply integral_congr_ae + filter_upwards [] with U + congr 1 + ring + +lemma exp_pair_cosh (A D q : ℝ) : + Real.exp ((A+D)/2) * Real.cosh (q*(A-D)/2) = + (Real.exp (((1+q)*A+(1-q)*D)/2) + Real.exp (((1-q)*A+(1+q)*D)/2))/2 := by + rw [Real.cosh_eq, ← mul_div_assoc, mul_add, ← Real.exp_add, ← Real.exp_add] + congr 2 <;> ring_nf + +lemma pairMoment_cosh (lam : ι → ℝ) {x y : EuclideanSpace ℝ ι} + (hxy : ‖x‖ = ‖y‖) (q : ℝ) : + pairMoment lam x y q = ∫ U, + Real.exp ((diagonalEnergy lam (orthogonalIsometry U x) + + diagonalEnergy lam (orthogonalIsometry U y))/2) * + Real.cosh (q*(diagonalEnergy lam (orthogonalIsometry U x) - + diagonalEnergy lam (orthogonalIsometry U y))/2) ∂orthogonalHaar ι := by + simp_rw [exp_pair_cosh] + have hf (U : Matrix.orthogonalGroup ι ℝ) : + Real.exp (((1-q)*diagonalEnergy lam (orthogonalIsometry U x)+ + (1+q)*diagonalEnergy lam (orthogonalIsometry U y))/2) = pairIntegrand lam x y (-q) U := by + unfold pairIntegrand + congr 1 + ring + simp_rw [hf] + rw [integral_div] + change pairMoment lam x y q = + (∫ U, pairIntegrand lam x y q U + pairIntegrand lam x y (-q) U ∂orthogonalHaar ι)/2 + rw [integral_add (orthogonalHaar_integrable (pairIntegrand_continuous lam x y q)) + (orthogonalHaar_integrable (pairIntegrand_continuous lam x y (-q)))] + change pairMoment lam x y q = (pairMoment lam x y q + pairMoment lam x y (-q))/2 + rw [pairMoment_even lam hxy] + ring + +lemma pairMoment_mono_abs (lam : ι → ℝ) {x y : EuclideanSpace ℝ ι} + (hxy : ‖x‖ = ‖y‖) {q r : ℝ} (hqr : |q| ≤ |r|) : + pairMoment lam x y q ≤ pairMoment lam x y r := by + rw [pairMoment_cosh lam hxy q, pairMoment_cosh lam hxy r] + have hx := (diagonalEnergy_continuous lam).comp (orthogonalIsometry_fixed_continuous x) + have hy := (diagonalEnergy_continuous lam).comp (orthogonalIsometry_fixed_continuous y) + have hc (t : ℝ) : Continuous (fun U : Matrix.orthogonalGroup ι ℝ => + Real.exp ((diagonalEnergy lam (orthogonalIsometry U x) + + diagonalEnergy lam (orthogonalIsometry U y))/2) * + Real.cosh (t*(diagonalEnergy lam (orthogonalIsometry U x) - + diagonalEnergy lam (orthogonalIsometry U y))/2)) := by + exact ((hx.add hy).div_const 2).rexp.mul + (Real.continuous_cosh.comp ((continuous_const.mul (hx.sub hy)).div_const 2)) + apply integral_mono (orthogonalHaar_integrable (hc q)) (orthogonalHaar_integrable (hc r)) + intro U + apply mul_le_mul_of_nonneg_left _ (Real.exp_pos _).le + apply Real.cosh_le_cosh.mpr + simp only [abs_div, abs_mul] + exact div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_right hqr (abs_nonneg _)) (abs_nonneg _) + +end + + +section + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι] + +def spherePartition (lam : ι → ℝ) (a r : ℝ) : ℝ := + sphereAverage (fun u => Real.exp (a / 2 * diagonalEnergy lam (r • u.val))) + +omit [DecidableEq ι] [Nonempty ι] in +lemma sphere_energy_continuous (lam : ι → ℝ) (a r : ℝ) : + Continuous (fun u : unitSphere ι => Real.exp (a / 2 * diagonalEnergy lam (r • u.val))) := by + have hscale : Continuous (fun u : unitSphere ι => r • (u.val : EuclideanSpace ℝ ι)) := + (continuous_const_smul r).comp continuous_subtype_val + have henergy := (diagonalEnergy_continuous lam).comp hscale + exact (henergy.const_mul (a / 2)).rexp + +lemma orthogonal_scaled_partition (lam : ι → ℝ) (a r : ℝ) (u : unitSphere ι) : + (∫ U, Real.exp (a / 2 * diagonalEnergy lam (orthogonalIsometry U (r • u.val))) + ∂orthogonalHaar ι) = spherePartition lam a r := by + calc + _ = ∫ U, Real.exp (a / 2 * diagonalEnergy lam (r • (orthogonalSphere U u).val)) + ∂orthogonalHaar ι := by + apply integral_congr_ae + filter_upwards [] with U + rw [(orthogonalIsometry U).map_smul] + rfl + _ = _ := orthogonal_first_moment _ (sphere_energy_continuous lam a r) u + +lemma orthogonal_radial_partition (lam : ι → ℝ) (a : ℝ) {r : ℝ} (hr : 0 < r) + (x : EuclideanSpace ℝ ι) (hx : ‖x‖ = r) : + (∫ U, Real.exp (a/2 * diagonalEnergy lam (orthogonalIsometry U x)) ∂orthogonalHaar ι) = + spherePartition lam a r := by + have hu : ‖r⁻¹ • x‖ = 1 := by + rw [norm_smul, Real.norm_of_nonneg (inv_nonneg.mpr hr.le), hx, inv_mul_cancel₀ hr.ne'] + let u : unitSphere ι := ⟨r⁻¹ • x, mem_sphere_zero_iff_norm.mpr hu⟩ + have he : r • u.val = x := by + change r • (r⁻¹ • x) = x + rw [smul_smul, mul_inv_cancel₀ hr.ne', one_smul] + calc + _ = ∫ U, Real.exp (a/2 * diagonalEnergy lam (orthogonalIsometry U (r • u.val))) + ∂orthogonalHaar ι := by simp only [he] + _ = _ := orthogonal_scaled_partition lam a r u + +end + + +section + +lemma cubeVector_norm {n : ℕ} (x : Spin n) : ‖cubeVector x‖ = Real.sqrt n := by + apply (sq_eq_sq₀ (norm_nonneg _) (Real.sqrt_nonneg _)).mp + rw [Real.sq_sqrt (Nat.cast_nonneg _), EuclideanSpace.real_norm_sq_eq] + change ∑ i : Fin n, spinValue (x i)^2 = (n : ℝ) + simp only [spinValue_sq, Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul, + mul_one] + +def rotatedCubePartition {n : ℕ} (lam : Fin n → ℝ) (a : ℝ) + (U : Matrix.orthogonalGroup (Fin n) ℝ) : ℝ := + (Fintype.card (Spin n) : ℝ)⁻¹ * ∑ x : Spin n, + Real.exp (a/2 * diagonalEnergy lam (orthogonalIsometry U (cubeVector x))) + +lemma rotatedCubePartition_first_moment {n : ℕ} (hn : 0 < n) (lam : Fin n → ℝ) (a : ℝ) : + (∫ U, rotatedCubePartition lam a U ∂orthogonalHaar (Fin n)) = + spherePartition lam a (Real.sqrt n) := by + let : Nonempty (Fin n) := ⟨⟨0, hn⟩⟩ + unfold rotatedCubePartition + rw [integral_const_mul, integral_finsetSum] + · simp_rw [orthogonal_radial_partition lam a (Real.sqrt_pos.mpr (Nat.cast_pos.mpr hn)) + _ (cubeVector_norm _)] + rw [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, ← mul_assoc, + inv_mul_cancel₀ (by exact_mod_cast Fintype.card_ne_zero (α := Spin n)), one_mul] + · intro x _ + apply orthogonalHaar_integrable + exact (continuous_const.mul ((diagonalEnergy_continuous lam).comp + (orthogonalIsometry_fixed_continuous (cubeVector x)))).rexp + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +def overlapPlus (u v : EuclideanSpace ℝ ι) (q : ℝ) : EuclideanSpace ℝ ι := + Real.sqrt ((1+q)/2) • u + Real.sqrt ((1-q)/2) • v + +def overlapMinus (u v : EuclideanSpace ℝ ι) (q : ℝ) : EuclideanSpace ℝ ι := + Real.sqrt ((1+q)/2) • u - Real.sqrt ((1-q)/2) • v + +omit [DecidableEq ι] in +lemma overlapPair_gram {u v : EuclideanSpace ℝ ι} {r q : ℝ} + (hu : ‖u‖ = r) (hv : ‖v‖ = r) (horth : inner ℝ u v = 0) (hq : |q| ≤ 1) : + ‖overlapPlus u v q‖ = r ∧ ‖overlapMinus u v q‖ = r ∧ + inner ℝ (overlapPlus u v q) (overlapMinus u v q) = q * r^2 := by + have hp : 0 ≤ (1+q)/2 := by linarith [(abs_le.mp hq).1] + have hm : 0 ≤ (1-q)/2 := by linarith [(abs_le.mp hq).2] + have hpu := Real.sq_sqrt hp + have hmu := Real.sq_sqrt hm + have horth' : inner ℝ v u = 0 := by rw [real_inner_comm, horth] + have huu : inner ℝ u u = r^2 := by rw [real_inner_self_eq_norm_sq, hu] + have hvv : inner ℝ v v = r^2 := by rw [real_inner_self_eq_norm_sq, hv] + have hr : 0 ≤ r := hu ▸ norm_nonneg u + have hplus : ‖overlapPlus u v q‖^2 = r^2 := by + rw [← real_inner_self_eq_norm_sq] + simp only [overlapPlus, inner_add_left, inner_add_right, real_inner_smul_left, + real_inner_smul_right, horth, horth', huu, hvv] + nlinarith + have hminus : ‖overlapMinus u v q‖^2 = r^2 := by + rw [← real_inner_self_eq_norm_sq] + simp only [overlapMinus, inner_sub_left, inner_sub_right, real_inner_smul_left, + real_inner_smul_right, horth, horth', huu, hvv] + nlinarith + refine ⟨(sq_eq_sq₀ (norm_nonneg _) hr).mp hplus, + (sq_eq_sq₀ (norm_nonneg _) hr).mp hminus, ?_⟩ + simp only [overlapPlus, overlapMinus, inner_add_left, inner_sub_right, + real_inner_smul_left, real_inner_smul_right, horth, horth', huu, hvv] + nlinarith + +omit [DecidableEq ι] in +lemma diagonalEnergy_overlap (lam : ι → ℝ) (u v : EuclideanSpace ℝ ι) {q : ℝ} + (hq : |q| ≤ 1) : + diagonalEnergy lam (overlapPlus u v q) + diagonalEnergy lam (overlapMinus u v q) = + (1+q)*diagonalEnergy lam u + (1-q)*diagonalEnergy lam v := by + have hp : 0 ≤ (1+q)/2 := by linarith [(abs_le.mp hq).1] + have hm : 0 ≤ (1-q)/2 := by linarith [(abs_le.mp hq).2] + have hpu := Real.sq_sqrt hp + have hmu := Real.sq_sqrt hm + unfold diagonalEnergy + rw [← Finset.sum_add_distrib, Finset.mul_sum, Finset.mul_sum, ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro i _ + simp only [overlapPlus, overlapMinus, PiLp.add_apply, PiLp.sub_apply, PiLp.smul_apply, + smul_eq_mul] + calc + _ = 2 * lam i * (Real.sqrt ((1+q)/2))^2 * (u i)^2 + + 2 * lam i * (Real.sqrt ((1-q)/2))^2 * (v i)^2 := by ring + _ = _ := by rw [hpu, hmu]; ring + +lemma pair_energy_orbit (lam : ι → ℝ) {x y u v : EuclideanSpace ℝ ι} {r q : ℝ} + (hx : ‖x‖ = r) (hy : ‖y‖ = r) (hu : ‖u‖ = r) (hv : ‖v‖ = r) + (horth : inner ℝ u v = 0) (hq : |q| ≤ 1) (hxy : inner ℝ x y = q*r^2) : + (∫ U, Real.exp ((diagonalEnergy lam (orthogonalIsometry U x) + + diagonalEnergy lam (orthogonalIsometry U y))/2) ∂orthogonalHaar ι) = + pairMoment lam u v q := by + obtain ⟨hplus,hminus,hgram⟩ := overlapPair_gram hu hv horth hq + rw [orthogonal_pair_integral_eq + (fun a b => Real.exp ((diagonalEnergy lam a + diagonalEnergy lam b)/2)) + (hx.trans hplus.symm) (hy.trans hminus.symm) (hxy.trans hgram.symm)] + unfold pairMoment pairIntegrand + apply integral_congr_ae + filter_upwards [] with U + have hplus' : orthogonalIsometry U (overlapPlus u v q) = + overlapPlus (orthogonalIsometry U u) (orthogonalIsometry U v) q := by + simp only [overlapPlus, map_add, map_smul] + have hminus' : orthogonalIsometry U (overlapMinus u v q) = + overlapMinus (orthogonalIsometry U u) (orthogonalIsometry U v) q := by + simp only [overlapMinus, map_sub, map_smul] + rw [hplus', hminus', diagonalEnergy_overlap lam _ _ hq] + +end + + +section + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +lemma pairMoment_continuous (lam : ι → ℝ) (u v : EuclideanSpace ℝ ι) : + Continuous (pairMoment lam u v) := by + have hu : Continuous (fun p : ℝ × Matrix.orthogonalGroup ι ℝ => + diagonalEnergy lam (orthogonalIsometry p.2 u)) := + ((diagonalEnergy_continuous lam).comp (orthogonalIsometry_fixed_continuous u)).comp + continuous_snd + have hv : Continuous (fun p : ℝ × Matrix.orthogonalGroup ι ℝ => + diagonalEnergy lam (orthogonalIsometry p.2 v)) := + ((diagonalEnergy_continuous lam).comp (orthogonalIsometry_fixed_continuous v)).comp + continuous_snd + have hc : Continuous (fun p : ℝ × Matrix.orthogonalGroup ι ℝ => + pairIntegrand lam u v p.1 p.2) := + ((((continuous_const.add continuous_fst).mul hu).add + ((continuous_const.sub continuous_fst).mul hv)).div_const 2).rexp + have hi := continuous_parametric_integral_of_continuous (μ := orthogonalHaar ι) + (f := fun q U => pairIntegrand lam u v q U) hc (s := Set.univ) isCompact_univ + change Continuous (fun q : ℝ => ∫ U, pairIntegrand lam u v q U ∂orthogonalHaar ι) + simpa only [setIntegral_univ] using hi + +variable [Nonempty ι] + +omit [Nonempty ι] in +lemma sphereUniform_rotation_preserving (U : Matrix.orthogonalGroup ι ℝ) : + MeasurePreserving (orthogonalSphere U) (sphereUniform (ι := ι)) sphereUniform := + (sphereMap_preserving (orthogonalIsometry U)).smul_measure _ + +omit [Nonempty ι] in +lemma orthogonalSphere_injective (U : Matrix.orthogonalGroup ι ℝ) : + Function.Injective (orthogonalSphere U) := by + intro x y h + apply Subtype.ext + exact (orthogonalIsometry U).injective (congrArg Subtype.val h) + +omit [Nonempty ι] in +lemma orthogonalSphere_fixed_continuous (U : Matrix.orthogonalGroup ι ℝ) : + Continuous (orthogonalSphere U) := sphereMap_continuous (orthogonalIsometry U) + +lemma spherePair_rotation_integral (U : Matrix.orthogonalGroup ι ℝ) + (f : unitSphere ι × unitSphere ι → ℝ) : + (∫ p, f (orthogonalSphere U p.1, orthogonalSphere U p.2) + ∂(sphereUniform.prod sphereUniform)) = ∫ p, f p ∂(sphereUniform.prod sphereUniform) := by + have hp := (sphereUniform_rotation_preserving U).prod (sphereUniform_rotation_preserving U) + have hc : Continuous (Prod.map (orthogonalSphere U) (orthogonalSphere U)) := + (orthogonalSphere_fixed_continuous U).prodMap (orthogonalSphere_fixed_continuous U) + have hinj : Function.Injective (Prod.map (orthogonalSphere U) (orthogonalSphere U)) := by + intro a b h + exact Prod.ext (orthogonalSphere_injective U (congrArg Prod.fst h)) + (orthogonalSphere_injective U (congrArg Prod.snd h)) + exact hp.integral_comp (hc.measurableEmbedding hinj) f + +omit [Fintype ι] [DecidableEq ι] [Nonempty ι] in +lemma continuous_pair_first {A B C D : Type*} [TopologicalSpace A] [TopologicalSpace B] + [TopologicalSpace C] [TopologicalSpace D] {f : A × B → D} (hf : Continuous f) : + Continuous (fun z : A × (B × C) => f (z.1, z.2.1)) := + hf.comp (continuous_fst.prodMk (continuous_fst.comp continuous_snd)) + +omit [Fintype ι] [DecidableEq ι] [Nonempty ι] in +lemma continuous_pair_second {A B C D : Type*} [TopologicalSpace A] [TopologicalSpace B] + [TopologicalSpace C] [TopologicalSpace D] {f : A × C → D} (hf : Continuous f) : + Continuous (fun z : A × (B × C) => f (z.1, z.2.2)) := + hf.comp (continuous_fst.prodMk (continuous_snd.comp continuous_snd)) + +omit [Nonempty ι] in +lemma spherePair_first_continuous : + Continuous (fun z : Matrix.orthogonalGroup ι ℝ × (unitSphere ι × unitSphere ι) => + orthogonalSphere z.1 z.2.1) := + continuous_pair_first (orthogonalSphere_continuous (ι := ι)) + +omit [Nonempty ι] in +lemma spherePair_second_continuous : + Continuous (fun z : Matrix.orthogonalGroup ι ℝ × (unitSphere ι × unitSphere ι) => + orthogonalSphere z.1 z.2.2) := + continuous_pair_second (orthogonalSphere_continuous (ι := ι)) + +omit [Nonempty ι] in +lemma spherePair_action_continuous : + Continuous (fun z : Matrix.orthogonalGroup ι ℝ × (unitSphere ι × unitSphere ι) => + (orthogonalSphere z.1 z.2.1, orthogonalSphere z.1 z.2.2)) := + (spherePair_first_continuous (ι := ι)).prodMk (spherePair_second_continuous (ι := ι)) + +lemma spherePair_haar_average (f : unitSphere ι × unitSphere ι → ℝ) (hf : Continuous f) : + (∫ p, ∫ U, f (orthogonalSphere U p.1, orthogonalSphere U p.2) ∂orthogonalHaar ι + ∂(sphereUniform.prod sphereUniform)) = ∫ p, f p ∂(sphereUniform.prod sphereUniform) := by + have hc : Continuous (fun z : Matrix.orthogonalGroup ι ℝ × (unitSphere ι × unitSphere ι) => + f (orthogonalSphere z.1 z.2.1, orthogonalSphere z.1 z.2.2)) := + hf.comp spherePair_action_continuous + have hi : Integrable (fun z : Matrix.orthogonalGroup ι ℝ × (unitSphere ι × unitSphere ι) => + f (orthogonalSphere z.1 z.2.1, orthogonalSphere z.1 z.2.2)) + ((orthogonalHaar ι).prod (sphereUniform.prod sphereUniform)) := by + simpa only [integrableOn_univ] using hc.continuousOn.integrableOn_compact isCompact_univ + rw [← integral_integral_swap hi] + simp only [spherePair_rotation_integral, integral_const, probReal_univ, one_smul] + +omit [DecidableEq ι] [Nonempty ι] in +lemma sphere_inner_abs_le_one (x y : unitSphere ι) : |inner ℝ x.val y.val| ≤ 1 := by + have h := abs_real_inner_le_norm x.val y.val + simpa only [mem_sphere_zero_iff_norm.mp x.property, mem_sphere_zero_iff_norm.mp y.property, + one_mul] using h + +def spherePairEnergy (lam : ι → ℝ) (r : ℝ) (p : unitSphere ι × unitSphere ι) : ℝ := + Real.exp ((diagonalEnergy lam (r • p.1.val) + diagonalEnergy lam (r • p.2.val))/2) + +omit [DecidableEq ι] [Nonempty ι] in +lemma spherePairEnergy_factor (lam : ι → ℝ) (r : ℝ) (p : unitSphere ι × unitSphere ι) : + spherePairEnergy lam r p = + Real.exp (1 / 2 * diagonalEnergy lam (r • p.1.val)) * + Real.exp (1 / 2 * diagonalEnergy lam (r • p.2.val)) := by + rw [← Real.exp_add] + unfold spherePairEnergy + congr 1 + ring + +omit [DecidableEq ι] [Nonempty ι] in +lemma spherePairEnergy_continuous (lam : ι → ℝ) (r : ℝ) : Continuous (spherePairEnergy lam r) := by + have hf := sphere_energy_continuous lam 1 r + have he : spherePairEnergy lam r = fun p : unitSphere ι × unitSphere ι => + Real.exp (1 / 2 * diagonalEnergy lam (r • p.1.val)) * + Real.exp (1 / 2 * diagonalEnergy lam (r • p.2.val)) := funext (spherePairEnergy_factor lam r) + rw [he] + exact (hf.comp continuous_fst).mul (hf.comp continuous_snd) + +omit [DecidableEq ι] in +lemma spherePairEnergy_integral (lam : ι → ℝ) (r : ℝ) : + (∫ p, spherePairEnergy lam r p ∂(sphereUniform.prod sphereUniform)) = + (spherePartition lam 1 r)^2 := by + simp_rw [spherePairEnergy_factor] + let f : unitSphere ι → ℝ := fun u => Real.exp (1 / 2 * diagonalEnergy lam (r • u.val)) + change (∫ p, f p.1 * f p.2 ∂((sphereUniform (ι := ι)).prod sphereUniform)) = _ + rw [integral_prod_mul f f, sphereUniform_integral] + exact (pow_two _).symm + +lemma spectrum_pair_second_moment (lam : ι → ℝ) {u v : EuclideanSpace ℝ ι} {r : ℝ} + (hu : ‖u‖ = r) (hv : ‖v‖ = r) (horth : inner ℝ u v = 0) : + (∫ p : unitSphere ι × unitSphere ι, pairMoment lam u v (inner ℝ p.1.val p.2.val) + ∂(sphereUniform.prod sphereUniform)) = (spherePartition lam 1 r)^2 := by + have hr : 0 ≤ r := hu ▸ norm_nonneg u + have hnorm (x : unitSphere ι) : ‖r • x.val‖ = r := by + rw [norm_smul, Real.norm_of_nonneg hr, mem_sphere_zero_iff_norm.mp x.property, mul_one] + have he (p : unitSphere ι × unitSphere ι) : + pairMoment lam u v (inner ℝ p.1.val p.2.val) = + ∫ U, spherePairEnergy lam r (orthogonalSphere U p.1, orthogonalSphere U p.2) + ∂orthogonalHaar ι := by + have hxy : inner ℝ (r • p.1.val) (r • p.2.val) = inner ℝ p.1.val p.2.val * r^2 := by + rw [real_inner_smul_left, real_inner_smul_right] + ring + rw [← pair_energy_orbit lam (hnorm p.1) (hnorm p.2) hu hv horth + (sphere_inner_abs_le_one p.1 p.2) hxy] + apply integral_congr_ae + filter_upwards [] with U + simp only [spherePairEnergy, orthogonalSphere, sphereMap, map_smul] + simp_rw [he] + rw [spherePair_haar_average _ (spherePairEnergy_continuous lam r), spherePairEnergy_integral] + +def sphereOverlapLaw (ι : Type*) [Fintype ι] : Measure ℝ := + ((sphereUniform (ι := ι)).prod sphereUniform).map + (fun p : unitSphere ι × unitSphere ι => inner ℝ p.1.val p.2.val) + +lemma sphereOverlap_second_moment (lam : ι → ℝ) {u v : EuclideanSpace ℝ ι} {r : ℝ} + (hu : ‖u‖ = r) (hv : ‖v‖ = r) (horth : inner ℝ u v = 0) : + (∫ q, pairMoment lam u v q ∂sphereOverlapLaw ι) = (spherePartition lam 1 r)^2 := by + have hc : Continuous (fun p : unitSphere ι × unitSphere ι => inner ℝ p.1.val p.2.val) := + (continuous_subtype_val.comp continuous_fst).inner (continuous_subtype_val.comp continuous_snd) + rw [sphereOverlapLaw, integral_map hc.measurable.aemeasurable + (pairMoment_continuous lam u v).aestronglyMeasurable] + exact spectrum_pair_second_moment lam hu hv horth + +end + +section + +def spinProduct {n : ℕ} (x y : Spin n) : Spin n := fun i => x i == y i + +lemma spinValue_beq (a b : Bool) : spinValue (a == b) = spinValue a * spinValue b := by + cases a <;> cases b <;> norm_num [spinValue] + +lemma spinProduct_involution {n : ℕ} (x : Spin n) : Function.Involutive (spinProduct x) := by + intro y + funext i + change (x i == (x i == y i)) = y i + cases x i <;> cases y i <;> rfl + +def spinProductEquiv {n : ℕ} (x : Spin n) : Spin n ≃ Spin n := + (spinProduct_involution x).toPerm + +def signMean {n : ℕ} (x : Spin n) : ℝ := (∑ i, spinValue (x i)) / n + +lemma cubeOverlap_signMean {n : ℕ} (x y : Spin n) : + cubeOverlap x y = signMean (spinProduct x y) := by + unfold cubeOverlap signMean cubeVector + rw [EuclideanSpace.inner_toLp_toLp] + simp only [star_trivial, dotProduct, spinProduct, spinValue_beq, mul_comm] + +lemma cubeOverlap_abs_le_one {n : ℕ} (x y : Spin n) : |cubeOverlap x y| ≤ 1 := by + rcases Nat.eq_zero_or_pos n with rfl | hn + · simp [cubeOverlap] + have h := abs_real_inner_le_norm (cubeVector x) (cubeVector y) + rw [cubeVector_norm, cubeVector_norm, ← sq, Real.sq_sqrt (Nat.cast_nonneg _)] at h + unfold cubeOverlap + rw [abs_div, show |(n : ℝ)| = n from abs_of_nonneg (Nat.cast_nonneg n)] + exact (div_le_one (Nat.cast_pos.mpr hn)).mpr h + +lemma cubeOverlap_gram {n : ℕ} (hn : 0 < n) (x y : Spin n) : + inner ℝ (cubeVector x) (cubeVector y) = cubeOverlap x y * (Real.sqrt n)^2 := by + rw [Real.sq_sqrt (Nat.cast_nonneg _)] + exact (div_mul_cancel₀ _ (Nat.cast_ne_zero.mpr hn.ne')).symm + +lemma cubeOverlap_sum {n : ℕ} (x : Spin n) (f : ℝ → ℝ) : + (∑ y : Spin n, f (cubeOverlap x y)) = ∑ y : Spin n, f (signMean y) := by + simp_rw [cubeOverlap_signMean] + exact (spinProductEquiv x).sum_comp (fun y => f (signMean y)) + +lemma cubeOverlap_average {n : ℕ} (f : ℝ → ℝ) : + (Fintype.card (Spin n) : ℝ)⁻¹ ^ 2 * ∑ x : Spin n, ∑ y : Spin n, f (cubeOverlap x y) = + (Fintype.card (Spin n) : ℝ)⁻¹ * ∑ y : Spin n, f (signMean y) := by + simp_rw [cubeOverlap_sum] + rw [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] + have hn : (Fintype.card (Spin n) : ℝ) ≠ 0 := by exact_mod_cast Fintype.card_ne_zero + field_simp + +def spinFinsetEquiv (n : ℕ) : Spin n ≃ Finset (Fin n) where + toFun x := Finset.univ.filter fun i => x i = true + invFun s := fun i => decide (i ∈ s) + left_inv x := by + funext i + simp + right_inv s := by + ext i + simp + +lemma signMean_finset {n : ℕ} (hn : 0 < n) (x : Spin n) : + signMean x = -1 + 2 * ((spinFinsetEquiv n x).card : ℝ) / n := by + have he : (∑ i : Fin n, spinValue (x i)) = + 2 * ((spinFinsetEquiv n x).card : ℝ) - n := by + have hv (i : Fin n) : spinValue (x i) = (if x i = true then 2 else 0) - 1 := by + cases x i <;> norm_num [spinValue] + simp_rw [hv, Finset.sum_sub_distrib] + simp [spinFinsetEquiv, Finset.sum_ite, mul_comm] + rw [signMean, he] + field_simp [Nat.cast_ne_zero.mpr hn.ne'] + ring + +lemma finset_card_sum (n : ℕ) (f : ℕ → ℝ) : + (∑ s : Finset (Fin n), f s.card) = + ∑ k ∈ Finset.range (n+1), (Nat.choose n k : ℝ) * f k := by + have hm (s : Finset (Fin n)) (_ : s ∈ Finset.univ) : s.card ∈ Finset.range (n+1) := by + simp only [Finset.mem_range] + exact Nat.lt_succ_of_le (by simpa using s.card_le_univ) + rw [← Finset.sum_fiberwise_of_maps_to' hm f] + simp only [Finset.sum_const, Finset.univ_filter_card_eq, Finset.card_powersetCard, + Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] + +lemma cubeOverlap_binomial_sum {n : ℕ} (hn : 0 < n) (f : ℝ → ℝ) : + (Fintype.card (Spin n) : ℝ)⁻¹ ^ 2 * ∑ x : Spin n, ∑ y : Spin n, f (cubeOverlap x y) = + (2 : ℝ)⁻¹ ^ n * ∑ k ∈ Finset.range (n+1), + (Nat.choose n k : ℝ) * f (-1 + 2 * (k : ℝ) / n) := by + rw [cubeOverlap_average] + simp_rw [signMean_finset hn] + rw [(spinFinsetEquiv n).sum_comp (fun s => f (-1 + 2 * (s.card : ℝ) / n)), + finset_card_sum n (fun k => f (-1 + 2 * (k : ℝ) / n))] + congr 1 + simp [Spin, inv_pow] + +lemma rotatedCubePartition_continuous {n : ℕ} (lam : Fin n → ℝ) (a : ℝ) : + Continuous (rotatedCubePartition lam a) := by + apply Continuous.const_mul + apply continuous_finsetSum + intro x _ + exact (continuous_const.mul ((diagonalEnergy_continuous lam).comp + (orthogonalIsometry_fixed_continuous (cubeVector x)))).rexp + +lemma rotatedCubePartition_square {n : ℕ} (lam : Fin n → ℝ) + (U : Matrix.orthogonalGroup (Fin n) ℝ) : + rotatedCubePartition lam 1 U ^ 2 = + (Fintype.card (Spin n) : ℝ)⁻¹ ^ 2 * ∑ x : Spin n, ∑ y : Spin n, + Real.exp ((diagonalEnergy lam (orthogonalIsometry U (cubeVector x)) + + diagonalEnergy lam (orthogonalIsometry U (cubeVector y)))/2) := by + unfold rotatedCubePartition + rw [mul_pow, pow_two (∑ _, _), Finset.sum_mul_sum] + simp_rw [← Real.exp_add] + congr 1 + apply Finset.sum_congr rfl + intro x _ + apply Finset.sum_congr rfl + intro y _ + congr 1 + ring + +lemma cube_pair_energy_continuous {n : ℕ} (lam : Fin n → ℝ) (x y : Spin n) : + Continuous (fun U : Matrix.orthogonalGroup (Fin n) ℝ => + Real.exp ((diagonalEnergy lam (orthogonalIsometry U (cubeVector x)) + + diagonalEnergy lam (orthogonalIsometry U (cubeVector y)))/2)) := by + have hx := (diagonalEnergy_continuous lam).comp (orthogonalIsometry_fixed_continuous (cubeVector x)) + have hy := (diagonalEnergy_continuous lam).comp (orthogonalIsometry_fixed_continuous (cubeVector y)) + exact ((hx.add hy).div_const 2).rexp + +lemma rotatedCubePartition_second_moment {n : ℕ} (hn : 0 < n) (lam : Fin n → ℝ) + {u v : EuclideanSpace ℝ (Fin n)} (hu : ‖u‖ = Real.sqrt n) (hv : ‖v‖ = Real.sqrt n) + (horth : inner ℝ u v = 0) : + (∫ U, rotatedCubePartition lam 1 U ^ 2 ∂orthogonalHaar (Fin n)) = + (2 : ℝ)⁻¹ ^ n * ∑ k ∈ Finset.range (n+1), + (Nat.choose n k : ℝ) * pairMoment lam u v (-1 + 2 * (k : ℝ) / n) := by + have hi (x y : Spin n) := orthogonalHaar_integrable (cube_pair_energy_continuous lam x y) + simp_rw [rotatedCubePartition_square] + rw [integral_const_mul] + rw [integral_finsetSum _ (fun x _ => integrable_finsetSum _ (fun y _ => hi x y))] + have hinner (x : Spin n) : (∫ U, ∑ y : Spin n, + Real.exp ((diagonalEnergy lam (orthogonalIsometry U (cubeVector x)) + + diagonalEnergy lam (orthogonalIsometry U (cubeVector y)))/2) ∂orthogonalHaar (Fin n)) = + ∑ y : Spin n, pairMoment lam u v (cubeOverlap x y) := by + rw [integral_finsetSum _ (fun y _ => hi x y)] + apply Finset.sum_congr rfl + intro y _ + exact pair_energy_orbit lam (cubeVector_norm x) (cubeVector_norm y) hu hv horth + (cubeOverlap_abs_le_one x y) (cubeOverlap_gram hn x y) + simp_rw [hinner] + exact cubeOverlap_binomial_sum hn _ + +section + +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] + [MeasurableSpace E] [BorelSpace E] [Nontrivial E] + +lemma integral_polar (μ : Measure E) [μ.IsAddHaarMeasure] (f : E → ℝ) : + (∫ x, f x ∂μ) = ∫ p : sphere (0 : E) 1 × Ioi (0 : ℝ), + f (p.2.val • p.1.val) ∂μ.toSphere.prod (volumeIoiPow (Module.finrank ℝ E - 1)) := by + calc + _ = ∫ x : ({(0)}ᶜ : Set E), f x.val ∂(μ.comap (↑)) := by + rw [integral_subtype_comap (measurableSet_singleton _).compl f, + restrict_compl_singleton] + _ = _ := by + simpa only [Function.comp_def, Homeomorph.symm_apply_apply, homeomorphUnitSphereProd_symm_apply_coe] using + μ.measurePreserving_homeomorphUnitSphereProd.integral_comp + (Homeomorph.measurableEmbedding _) (fun p : sphere (0 : E) 1 × Ioi (0 : ℝ) => + f ((homeomorphUnitSphereProd E).symm p).val) + +lemma radial_map_preserving (μ : Measure E) [μ.IsAddHaarMeasure] : + MeasurePreserving (fun p : sphere (0 : E) 1 × Ioi (0 : ℝ) => p.2.val • p.1.val) + (μ.toSphere.prod (volumeIoiPow (Module.finrank ℝ E - 1))) μ := by + have hs : MeasurePreserving (Subtype.val : ({(0)}ᶜ : Set E) → E) + (μ.comap Subtype.val) μ := by + simpa only [restrict_compl_singleton] using + (measurePreserving_subtype_coe (μa := μ) (measurableSet_singleton (0 : E)).compl) + exact hs.comp (MeasurePreserving.symm (homeomorphUnitSphereProd E).toMeasurableEquiv + μ.measurePreserving_homeomorphUnitSphereProd) + +lemma lintegral_polar (μ : Measure E) [μ.IsAddHaarMeasure] {f : E → ℝ≥0∞} + (hf : Measurable f) : + (∫⁻ x, f x ∂μ) = ∫⁻ p : sphere (0 : E) 1 × Ioi (0 : ℝ), + f (p.2.val • p.1.val) ∂μ.toSphere.prod (volumeIoiPow (Module.finrank ℝ E - 1)) := + ((radial_map_preserving μ).lintegral_comp hf).symm + +end + +section + +def radialGaussian (n : ℕ) : ℝ≥0∞ := + ∫⁻ r : ℝ in Ioi 0, ENNReal.ofReal (r^(n-1) * Real.exp (-r^2)) + +lemma radialGaussian_finite (n : ℕ) : radialGaussian n < ⊤ := by + apply Integrable.lintegral_lt_top + have h := integrableOn_rpow_mul_exp_neg_mul_sq (by norm_num : (0 : ℝ) < 1) + (lt_of_lt_of_le (by norm_num : (-1 : ℝ) < 0) (Nat.cast_nonneg (n-1))) + simp only [Real.rpow_natCast, neg_one_mul] at h + change Integrable _ (volume.restrict (Ioi 0)) at h + exact h + +lemma radialGaussian_pos (n : ℕ) : 0 < radialGaussian n := by + rw [radialGaussian, setLIntegral_pos_iff (by fun_prop)] + have he : Function.support (fun r : ℝ => ENNReal.ofReal (r^(n-1) * Real.exp (-r^2))) ∩ + Ioi 0 = Ioi 0 := by + apply inter_eq_right.mpr + intro r hr + exact (ENNReal.ofReal_pos.mpr (mul_pos (pow_pos hr _) (Real.exp_pos _))).ne' + rw [he, Real.volume_Ioi] + exact ENNReal.zero_lt_top + +lemma lintegral_scale_pos {a : ℝ} (ha : 0 < a) (f : ℝ → ℝ≥0∞) : + (∫⁻ x, f x) = ∫⁻ t : ℝ, ENNReal.ofReal a * f (a*t) := by + have hi : (fun t : ℝ => a*t) '' Set.univ = Set.univ := + Set.image_univ_of_surjective (fun x => ⟨x/a, mul_div_cancel₀ x ha.ne'⟩) + have h := lintegral_image_eq_lintegral_abs_deriv_mul (s := Set.univ) (f' := fun _ => a) MeasurableSet.univ + (fun t _ => by convert! ((hasDerivAt_id t).const_mul a).hasDerivWithinAt (s := Set.univ) using 1; simp only [mul_one]) + (mul_right_injective₀ ha.ne').injOn f + simpa only [hi, setLIntegral_univ, abs_of_pos ha] using h + +lemma lintegral_scale_pos_Ioi {a : ℝ} (ha : 0 < a) (f : ℝ → ℝ≥0∞) : + (∫⁻ x in Ioi 0, f x) = ∫⁻ t in Ioi 0, ENNReal.ofReal a * f (a*t) := by + have hi : (fun t : ℝ => a*t) '' Ioi 0 = Ioi 0 := by + ext x + constructor + · rintro ⟨t, ht, rfl⟩ + exact mul_pos ha ht + · intro hx + exact ⟨x/a, div_pos hx ha, mul_div_cancel₀ x ha.ne'⟩ + have h := lintegral_image_eq_lintegral_abs_deriv_mul (s := Ioi (0 : ℝ)) (f' := fun _ => a) measurableSet_Ioi + (fun t _ => by convert! ((hasDerivAt_id t).const_mul a).hasDerivWithinAt (s := Ioi (0 : ℝ)) using 1; simp only [mul_one]) + (mul_right_injective₀ ha.ne').injOn f + simpa only [hi, abs_of_pos ha] using h + +lemma radialGaussian_scaled (k : ℕ) {c : ℝ} (hc : 0 < c) : + (∫⁻ r : ℝ in Ioi 0, ENNReal.ofReal (r^k * Real.exp (-(c*r)^2))) = + ENNReal.ofReal (c⁻¹^(k+1)) * radialGaussian (k+1) := by + rw [lintegral_scale_pos_Ioi (inv_pos.mpr hc)] + have he (r : ℝ) : + ENNReal.ofReal c⁻¹ * ENNReal.ofReal ((c⁻¹*r)^k * Real.exp (-(c*(c⁻¹*r))^2)) = + ENNReal.ofReal (c⁻¹^(k+1)) * ENNReal.ofReal (r^k * Real.exp (-r^2)) := by + rw [mul_inv_cancel_left₀ hc.ne', mul_pow, ← ENNReal.ofReal_mul (inv_nonneg.mpr hc.le), + ← ENNReal.ofReal_mul (pow_nonneg (inv_nonneg.mpr hc.le) _)] + congr 1 + rw [pow_succ] + ring + simp_rw [he] + rw [lintegral_const_mul' _ _ ENNReal.ofReal_ne_top] + rfl + +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] + [MeasurableSpace E] [BorelSpace E] [Nontrivial E] + +lemma radialGaussian_polar (μ : Measure E) [μ.IsAddHaarMeasure] {g : E → ℝ≥0∞} + (hg : Measurable g) (hhom : ∀ (r : ℝ), 0 < r → ∀ x : E, g (r • x) = g x) : + (∫⁻ x, ENNReal.ofReal (Real.exp (-‖x‖^2)) * g x ∂μ) = + (∫⁻ u : sphere (0 : E) 1, g u.val ∂μ.toSphere) * radialGaussian (Module.finrank ℝ E) := by + rw [lintegral_polar μ (by fun_prop)] + have he (p : sphere (0 : E) 1 × Ioi (0 : ℝ)) : + ENNReal.ofReal (Real.exp (-‖p.2.val • p.1.val‖^2)) * g (p.2.val • p.1.val) = + g p.1.val * ENNReal.ofReal (Real.exp (-p.2.val^2)) := by + rw [hhom _ p.2.property, norm_smul, Real.norm_of_nonneg p.2.property.le, + mem_sphere_zero_iff_norm.mp p.1.property, mul_one, mul_comm] + simp_rw [he] + rw [lintegral_prod_mul (f := fun u : sphere (0 : E) 1 => g u.val) + (g := fun r : Ioi (0 : ℝ) => ENNReal.ofReal (Real.exp (-r.val^2))) (by fun_prop) (by fun_prop)] + congr 1 + rw [volumeIoiPow, lintegral_withDensity_eq_lintegral_mul + (f := fun r : Ioi (0 : ℝ) => ENNReal.ofReal (r.val^(Module.finrank ℝ E-1))) + (g := fun r : Ioi (0 : ℝ) => ENNReal.ofReal (Real.exp (-r.val^2))) _ (by fun_prop) (by fun_prop)] + calc + _ = ∫⁻ r : Ioi (0 : ℝ), ENNReal.ofReal (r.val^(Module.finrank ℝ E-1) * Real.exp (-r.val^2)) + ∂volume.comap Subtype.val := by + apply lintegral_congr + intro r + exact (ENNReal.ofReal_mul (pow_nonneg r.property.le _)).symm + _ = _ := lintegral_subtype_comap (μ := volume) (s := Ioi (0 : ℝ)) measurableSet_Ioi + (fun r : ℝ => ENNReal.ofReal (r^(Module.finrank ℝ E-1) * Real.exp (-r^2))) + +end + +lemma volumeIoiPow_lintegral (k : ℕ) {f : ℝ → ℝ≥0∞} (hf : Measurable f) : + (∫⁻ r : Ioi (0 : ℝ), f r.val ∂volumeIoiPow k) = + ∫⁻ r : ℝ in Ioi 0, ENNReal.ofReal (r^k) * f r := by + rw [volumeIoiPow, lintegral_withDensity_eq_lintegral_mul _ + (f := fun r : Ioi (0 : ℝ) => ENNReal.ofReal (r.val^k)) + (g := fun r : Ioi (0 : ℝ) => f r.val) (by fun_prop) (by fun_prop)] + exact lintegral_subtype_comap (μ := volume) (s := Ioi (0 : ℝ)) measurableSet_Ioi + (fun r : ℝ => ENNReal.ofReal (r^k) * f r) + +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] + [MeasurableSpace E] [BorelSpace E] [Nontrivial E] + +lemma lintegral_radial_norm (μ : Measure E) [μ.IsAddHaarMeasure] {f : ℝ → ℝ≥0∞} + (hf : Measurable f) : + (∫⁻ x, f ‖x‖ ∂μ) = μ.toSphere Set.univ * + ∫⁻ r : ℝ in Ioi 0, ENNReal.ofReal (r^(Module.finrank ℝ E-1)) * f r := by + rw [lintegral_polar μ (f := fun x => f ‖x‖) (by fun_prop)] + have he (p : sphere (0 : E) 1 × Ioi (0 : ℝ)) : + f ‖p.2.val • p.1.val‖ = (1 : ℝ≥0∞) * f p.2.val := by + rw [norm_smul, Real.norm_of_nonneg p.2.property.le, + mem_sphere_zero_iff_norm.mp p.1.property, mul_one, one_mul] + simp_rw [he] + rw [lintegral_prod_mul (f := fun _ : sphere (0 : E) 1 => (1 : ℝ≥0∞)) + (g := fun r : Ioi (0 : ℝ) => f r.val) (by fun_prop) (by fun_prop), + lintegral_const, one_mul, volumeIoiPow_lintegral _ hf] + +end + +def sphereRatio (t : ℝ) : ℝ := t / Real.sqrt (1+t^2) + +def sphereRatioInv (q : ℝ) : ℝ := q / Real.sqrt (1-q^2) + +lemma sphereRatio_den_pos (t : ℝ) : 0 < 1+t^2 := by positivity + +lemma sphereRatio_sq (t : ℝ) : sphereRatio t ^ 2 = t^2/(1+t^2) := by + rw [sphereRatio, div_pow, Real.sq_sqrt (sphereRatio_den_pos t).le] + +lemma one_sub_sphereRatio_sq (t : ℝ) : 1-sphereRatio t ^ 2 = 1/(1+t^2) := by + rw [sphereRatio_sq] + field_simp + ring + +lemma sphereRatio_mem (t : ℝ) : sphereRatio t ∈ Ioo (-1 : ℝ) 1 := by + have hp : 0 < 1-sphereRatio t^2 := by rw [one_sub_sphereRatio_sq]; positivity + constructor <;> nlinarith [sq_nonneg (sphereRatio t + 1), sq_nonneg (sphereRatio t - 1)] + +lemma sphereRatioInv_den_pos {q : ℝ} (hq : q ∈ Ioo (-1 : ℝ) 1) : + 0 < 1-q^2 := by nlinarith [hq.1, hq.2] + +lemma one_add_sphereRatioInv_sq {q : ℝ} (hq : q ∈ Ioo (-1 : ℝ) 1) : + 1+sphereRatioInv q ^ 2 = 1/(1-q^2) := by + rw [sphereRatioInv, div_pow, Real.sq_sqrt (sphereRatioInv_den_pos hq).le] + field_simp [(sphereRatioInv_den_pos hq).ne'] + ring + +lemma sphereRatio_left_inverse (t : ℝ) : sphereRatioInv (sphereRatio t) = t := by + unfold sphereRatioInv + rw [one_sub_sphereRatio_sq, Real.sqrt_div (by norm_num), Real.sqrt_one] + unfold sphereRatio + simpa only [div_one] using + div_div_div_cancel_right₀ (Real.sqrt_ne_zero'.mpr (sphereRatio_den_pos t)) t 1 + +lemma sphereRatio_right_inverse {q : ℝ} (hq : q ∈ Ioo (-1 : ℝ) 1) : + sphereRatio (sphereRatioInv q) = q := by + unfold sphereRatio + rw [one_add_sphereRatioInv_sq hq, Real.sqrt_div (by norm_num), Real.sqrt_one] + unfold sphereRatioInv + simpa only [div_one] using + div_div_div_cancel_right₀ (Real.sqrt_ne_zero'.mpr (sphereRatioInv_den_pos hq)) q 1 + +lemma sphereRatio_injective : Function.Injective sphereRatio := + Function.LeftInverse.injective sphereRatio_left_inverse + +lemma sphereRatioInv_injOn : Set.InjOn sphereRatioInv (Ioo (-1 : ℝ) 1) := by + intro q hq r hr he + have := congrArg sphereRatio he + simpa only [sphereRatio_right_inverse hq, sphereRatio_right_inverse hr] using this + +lemma sphereRatioInv_image : sphereRatioInv '' Ioo (-1 : ℝ) 1 = Set.univ := by + apply Set.eq_univ_of_forall + intro t + exact ⟨sphereRatio t, sphereRatio_mem t, sphereRatio_left_inverse t⟩ + +lemma sphereRatioInv_hasDerivAt {q : ℝ} (hq : q ∈ Ioo (-1 : ℝ) 1) : + HasDerivAt sphereRatioInv (1/(Real.sqrt (1-q^2))^3) q := by + have hder := (hasDerivAt_id q).div + (((hasDerivAt_const q 1).sub ((hasDerivAt_id q).pow 2)).sqrt + (sphereRatioInv_den_pos hq).ne') + (Real.sqrt_ne_zero'.mpr (sphereRatioInv_den_pos hq)) + convert! hder using 1 + have hs := Real.sq_sqrt (sphereRatioInv_den_pos hq).le + have hn := (Real.sqrt_ne_zero'.mpr (sphereRatioInv_den_pos hq)) + dsimp only [Pi.sub_apply, Pi.pow_apply, id_eq] + norm_num only [Nat.cast_ofNat, Nat.reduceSub, pow_one, one_mul, mul_one, zero_sub] + field_simp [hn] + nlinarith + +lemma sphereRatioInv_continuousOn : ContinuousOn sphereRatioInv (Ioo (-1 : ℝ) 1) := + fun _ hq => (sphereRatioInv_hasDerivAt hq).continuousAt.continuousWithinAt + +def sphereOverlapShape (n : ℕ) (q : ℝ) : ℝ := (Real.sqrt (1-q^2))^(n-3) + +lemma sphereRatioInv_jacobian_shape {n : ℕ} (hn : 3 ≤ n) {q : ℝ} + (hq : q ∈ Ioo (-1 : ℝ) 1) : + |1/(Real.sqrt (1-q^2))^3| * (Real.sqrt (1+sphereRatioInv q^2))⁻¹ ^ n = + sphereOverlapShape n q := by + have hs : 0 < Real.sqrt (1-q^2) := Real.sqrt_pos.mpr (sphereRatioInv_den_pos hq) + rw [abs_of_pos (by positivity), one_add_sphereRatioInv_sq hq, + Real.sqrt_div (by norm_num), Real.sqrt_one] + simp only [one_div, inv_inv] + rw [mul_comm, ← div_eq_mul_inv] + exact (pow_sub₀ _ hs.ne' hn).symm + +lemma sphereRatio_integral {n : ℕ} (hn : 3 ≤ n) (f : ℝ → ℝ≥0∞) : + (∫⁻ t : ℝ, ENNReal.ofReal ((Real.sqrt (1+t^2))⁻¹ ^ n) * f (sphereRatio t)) = + ∫⁻ q in Ioo (-1 : ℝ) 1, ENNReal.ofReal (sphereOverlapShape n q) * f q := by + have h := lintegral_image_eq_lintegral_abs_deriv_mul measurableSet_Ioo + (fun q hq => (sphereRatioInv_hasDerivAt hq).hasDerivWithinAt) sphereRatioInv_injOn + (fun t => ENNReal.ofReal ((Real.sqrt (1+t^2))⁻¹ ^ n) * f (sphereRatio t)) + rw [sphereRatioInv_image, setLIntegral_univ] at h + rw [h] + apply setLIntegral_congr_fun measurableSet_Ioo + intro q hq + dsimp only + rw [sphereRatio_right_inverse hq, ← mul_assoc, ← ENNReal.ofReal_mul (abs_nonneg _), + sphereRatioInv_jacobian_shape hn hq] + +def cylinderKernel (f : ℝ → ℝ≥0∞) (s r : ℝ) : ℝ≥0∞ := + ENNReal.ofReal (Real.exp (-(s^2+r^2))) * f (s / Real.sqrt (s^2+r^2)) + +lemma cylinderKernel_measurable {f : ℝ → ℝ≥0∞} (hf : Measurable f) : + Measurable (Function.uncurry (cylinderKernel f)) := by + unfold cylinderKernel Function.uncurry + fun_prop + +lemma scaled_ratio {r : ℝ} (hr : 0 < r) (t : ℝ) : + r*t / Real.sqrt ((r*t)^2+r^2) = sphereRatio t := by + rw [show (r*t)^2+r^2 = r^2*(1+t^2) by ring, + Real.sqrt_mul (sq_nonneg r), Real.sqrt_sq hr.le] + exact mul_div_mul_left t _ hr.ne' + +lemma cylinderKernel_scaled {r : ℝ} (hr : 0 < r) (t : ℝ) (f : ℝ → ℝ≥0∞) : + cylinderKernel f (r*t) r = + ENNReal.ofReal (Real.exp (-(Real.sqrt (1+t^2)*r)^2)) * f (sphereRatio t) := by + unfold cylinderKernel + rw [scaled_ratio hr] + congr 3 + simp only [mul_pow, Real.sq_sqrt (sphereRatio_den_pos t).le] + ring + +lemma cylinder_scalar_scale {f : ℝ → ℝ≥0∞} {r : ℝ} (hr : 0 < r) : + (∫⁻ s : ℝ, cylinderKernel f s r) = + ENNReal.ofReal r * ∫⁻ t : ℝ, + ENNReal.ofReal (Real.exp (-(Real.sqrt (1+t^2)*r)^2)) * f (sphereRatio t) := by + rw [lintegral_scale_pos hr] + simp_rw [cylinderKernel_scaled hr] + exact lintegral_const_mul' _ _ ENNReal.ofReal_ne_top + +lemma cylinder_radius_integral (k : ℕ) {f : ℝ → ℝ≥0∞} (hf : Measurable f) : + (∫⁻ r : ℝ in Ioi 0, ENNReal.ofReal (r^k) * ∫⁻ s : ℝ, cylinderKernel f s r) = + radialGaussian (k+2) * ∫⁻ t : ℝ, + ENNReal.ofReal ((Real.sqrt (1+t^2))⁻¹^(k+2)) * f (sphereRatio t) := by + calc + _ = ∫⁻ r : ℝ in Ioi 0, ∫⁻ t : ℝ, ENNReal.ofReal (r^(k+1)) * + (ENNReal.ofReal (Real.exp (-(Real.sqrt (1+t^2)*r)^2)) * f (sphereRatio t)) := by + apply setLIntegral_congr_fun measurableSet_Ioi + intro r hr + dsimp only + rw [cylinder_scalar_scale hr, ← mul_assoc, ← ENNReal.ofReal_mul (pow_nonneg hr.le _), + ← pow_succ, ← lintegral_const_mul' _ _ ENNReal.ofReal_ne_top] + _ = ∫⁻ t : ℝ, ∫⁻ r : ℝ in Ioi 0, ENNReal.ofReal (r^(k+1)) * + (ENNReal.ofReal (Real.exp (-(Real.sqrt (1+t^2)*r)^2)) * f (sphereRatio t)) := by + apply lintegral_lintegral_swap + unfold sphereRatio + fun_prop + _ = ∫⁻ t : ℝ, ENNReal.ofReal ((Real.sqrt (1+t^2))⁻¹^(k+2)) * + radialGaussian (k+2) * f (sphereRatio t) := by + apply lintegral_congr + intro t + calc + _ = (∫⁻ r : ℝ in Ioi 0, ENNReal.ofReal (r^(k+1) * Real.exp (-(Real.sqrt (1+t^2)*r)^2))) * + f (sphereRatio t) := by + rw [← lintegral_mul_const _ (by fun_prop)] + apply setLIntegral_congr_fun measurableSet_Ioi + intro r hr + dsimp only + rw [ENNReal.ofReal_mul (pow_nonneg hr.le _), mul_assoc] + _ = _ := by rw [radialGaussian_scaled _ (Real.sqrt_pos.mpr (sphereRatio_den_pos t))] + _ = _ := by + simp_rw [mul_assoc, mul_left_comm _ (radialGaussian (k+2))] + exact lintegral_const_mul' _ _ (radialGaussian_finite _).ne + +def euclidSplit (n : ℕ) (x : EuclideanSpace ℝ (Fin (n+1))) : ℝ × EuclideanSpace ℝ (Fin n) := + (x 0, WithLp.toLp 2 (fun i => x i.succ)) + +lemma euclidSplit_preserving (n : ℕ) : + MeasurePreserving (euclidSplit n) volume (volume.prod volume) := by + have hs := (measurePreserving_piFinSuccAbove (fun _ : Fin (n+1) => (volume : Measure ℝ)) 0).comp + (PiLp.volume_preserving_ofLp (Fin (n+1))) + have ht := (MeasurePreserving.id (volume : Measure ℝ)).prod + (PiLp.volume_preserving_toLp (Fin n)) + exact ht.comp hs + +lemma euclidSplit_norm_sq (n : ℕ) (x : EuclideanSpace ℝ (Fin (n+1))) : + ‖x‖^2 = (euclidSplit n x).1^2 + ‖(euclidSplit n x).2‖^2 := by + rw [EuclideanSpace.norm_sq_eq, Fin.sum_univ_succ, EuclideanSpace.norm_sq_eq] + simp only [euclidSplit, WithLp.ofLp_toLp, Real.norm_eq_abs, sq_abs] + +lemma euclidSplit_norm (n : ℕ) (x : EuclideanSpace ℝ (Fin (n+1))) : + ‖x‖ = Real.sqrt ((euclidSplit n x).1^2 + ‖(euclidSplit n x).2‖^2) := by + rw [← euclidSplit_norm_sq, Real.sqrt_sq (norm_nonneg x)] + +lemma euclidSplit_integral (n : ℕ) {f : ℝ → ℝ≥0∞} (hf : Measurable f) : + (∫⁻ x : EuclideanSpace ℝ (Fin (n+1)), + ENNReal.ofReal (Real.exp (-‖x‖^2)) * f (x 0 / ‖x‖)) = + ∫⁻ p : ℝ × EuclideanSpace ℝ (Fin n), + ENNReal.ofReal (Real.exp (-(p.1^2 + ‖p.2‖^2))) * + f (p.1 / Real.sqrt (p.1^2 + ‖p.2‖^2)) ∂volume.prod volume := by + have hm : Measurable (fun p : ℝ × EuclideanSpace ℝ (Fin n) => + ENNReal.ofReal (Real.exp (-(p.1^2 + ‖p.2‖^2))) * + f (p.1 / Real.sqrt (p.1^2 + ‖p.2‖^2))) := by fun_prop + rw [← (euclidSplit_preserving n).lintegral_comp hm] + apply lintegral_congr + intro x + rw [← euclidSplit_norm_sq, Real.sqrt_sq (norm_nonneg x)] + rfl + +lemma gaussian_cylinder_volume (n : ℕ) {f : ℝ → ℝ≥0∞} (hf : Measurable f) : + (∫⁻ x : EuclideanSpace ℝ (Fin (n+3)), + ENNReal.ofReal (Real.exp (-‖x‖^2)) * f (x 0 / ‖x‖)) = + (volume : Measure (EuclideanSpace ℝ (Fin (n+2)))).toSphere Set.univ * + radialGaussian (n+3) * ∫⁻ t : ℝ, + ENNReal.ofReal ((Real.sqrt (1+t^2))⁻¹^(n+3)) * f (sphereRatio t) := by + rw [euclidSplit_integral (n+2) hf] + change (∫⁻ p : ℝ × EuclideanSpace ℝ (Fin (n+2)), cylinderKernel f p.1 ‖p.2‖ + ∂volume.prod volume) = _ + rw [lintegral_prod _ (by unfold cylinderKernel; fun_prop)] + have ht (s : ℝ) : (∫⁻ y : EuclideanSpace ℝ (Fin (n+2)), cylinderKernel f s ‖y‖) = + (volume : Measure (EuclideanSpace ℝ (Fin (n+2)))).toSphere Set.univ * + ∫⁻ r : ℝ in Ioi 0, ENNReal.ofReal (r^(n+1)) * cylinderKernel f s r := by + simpa only [finrank_euclideanSpace, Fintype.card_fin, show n+2-1=n+1 by omega] using + (lintegral_radial_norm (volume : Measure (EuclideanSpace ℝ (Fin (n+2)))) + (f := fun r => cylinderKernel f s r) (by unfold cylinderKernel; fun_prop)) + simp_rw [ht] + rw [lintegral_const_mul' _ _ (measure_ne_top _ _)] + calc + _ = (volume : Measure (EuclideanSpace ℝ (Fin (n+2)))).toSphere Set.univ * + ∫⁻ r : ℝ in Ioi 0, ENNReal.ofReal (r^(n+1)) * ∫⁻ s : ℝ, cylinderKernel f s r := by + congr 1 + rw [lintegral_lintegral_swap (by unfold cylinderKernel Function.uncurry; fun_prop)] + apply lintegral_congr + intro r + exact lintegral_const_mul' _ _ ENNReal.ofReal_ne_top + _ = _ := by rw [cylinder_radius_integral _ hf, ← mul_assoc] + +lemma gaussian_coordinate_polar (n : ℕ) {f : ℝ → ℝ≥0∞} (hf : Measurable f) : + (∫⁻ x : EuclideanSpace ℝ (Fin (n+3)), + ENNReal.ofReal (Real.exp (-‖x‖^2)) * f (x 0 / ‖x‖)) = + (∫⁻ u : sphere (0 : EuclideanSpace ℝ (Fin (n+3))) 1, + f (u.val 0) ∂(volume : Measure (EuclideanSpace ℝ (Fin (n+3)))).toSphere) * + radialGaussian (n+3) := by + have hm : Measurable (fun x : EuclideanSpace ℝ (Fin (n+3)) => f (x 0 / ‖x‖)) := by fun_prop + have hhom (r : ℝ) (hr : 0 < r) (x : EuclideanSpace ℝ (Fin (n+3))) : + f ((r • x) 0 / ‖r • x‖) = f (x 0 / ‖x‖) := by + rw [norm_smul, Real.norm_of_nonneg hr.le] + change f (r * x 0 / (r * ‖x‖)) = _ + rw [mul_div_mul_left _ _ hr.ne'] + have h := radialGaussian_polar volume hm hhom + simp only [finrank_euclideanSpace, Fintype.card_fin, + mem_sphere_zero_iff_norm.mp (Subtype.property _), div_one] at h + exact h + +lemma sphere_coordinate_lintegral (n : ℕ) {f : ℝ → ℝ≥0∞} (hf : Measurable f) : + (∫⁻ u : sphere (0 : EuclideanSpace ℝ (Fin (n+3))) 1, + f (u.val 0) ∂(volume : Measure (EuclideanSpace ℝ (Fin (n+3)))).toSphere) = + (volume : Measure (EuclideanSpace ℝ (Fin (n+2)))).toSphere Set.univ * + ∫⁻ q in Ioo (-1 : ℝ) 1, ENNReal.ofReal (sphereOverlapShape (n+3) q) * f q := by + apply (ENNReal.mul_left_inj (radialGaussian_pos (n+3)).ne' (radialGaussian_finite (n+3)).ne).mp + rw [← gaussian_coordinate_polar n hf, gaussian_cylinder_volume n hf, + sphereRatio_integral (by omega : 3 ≤ n+3)] + ac_rfl + +def overlapShapeMeasure (n : ℕ) : Measure ℝ := + (volume.restrict (Ioo (-1 : ℝ) 1)).withDensity (fun q => ENNReal.ofReal (sphereOverlapShape n q)) + +def normalizedOverlapShape (n : ℕ) : Measure ℝ := + ((overlapShapeMeasure n) Set.univ)⁻¹ • overlapShapeMeasure n + +lemma overlapShapeMeasure_lintegral (n : ℕ) {f : ℝ → ℝ≥0∞} (hf : Measurable f) : + (∫⁻ q, f q ∂overlapShapeMeasure n) = + ∫⁻ q in Ioo (-1 : ℝ) 1, ENNReal.ofReal (sphereOverlapShape n q) * f q := by + rw [overlapShapeMeasure, lintegral_withDensity_eq_lintegral_mul _ (by unfold sphereOverlapShape; fun_prop) hf] + rfl + +lemma overlapShapeMeasure_univ (n : ℕ) : + overlapShapeMeasure n Set.univ = ∫⁻ q in Ioo (-1 : ℝ) 1, ENNReal.ofReal (sphereOverlapShape n q) := by + rw [← lintegral_one, overlapShapeMeasure_lintegral n measurable_const] + simp only [mul_one] + +lemma sphereUniform_coordinate_lintegral (n : ℕ) {f : ℝ → ℝ≥0∞} (hf : Measurable f) : + (∫⁻ u : unitSphere (Fin (n+3)), f (u.val 0) ∂sphereUniform) = + ∫⁻ q, f q ∂normalizedOverlapShape (n+3) := by + let A := (volume : Measure (EuclideanSpace ℝ (Fin (n+2)))).toSphere Set.univ + have hA0 : A ≠ 0 := (measure_univ_pos.mpr (Measure.toSphere_ne_zero _)).ne' + have hAt : A ≠ ⊤ := measure_ne_top _ _ + have hfull : (volume : Measure (EuclideanSpace ℝ (Fin (n+3)))).toSphere Set.univ = + A * overlapShapeMeasure (n+3) Set.univ := by + have h := sphere_coordinate_lintegral n (f := fun _ => 1) measurable_const + simpa only [lintegral_one, mul_one, overlapShapeMeasure_univ, A] using h + rw [sphereUniform, lintegral_smul_measure, smul_eq_mul, sphere_coordinate_lintegral n hf, + hfull, ENNReal.mul_inv (Or.inl hA0) (Or.inl hAt), normalizedOverlapShape, + lintegral_smul_measure, smul_eq_mul, overlapShapeMeasure_lintegral _ hf] + change (A⁻¹ * (overlapShapeMeasure (n+3) Set.univ)⁻¹) * (A * _) = _ + rw [mul_assoc, mul_left_comm _ A, ENNReal.inv_mul_cancel_left hA0 hAt] + +def firstUnit (n : ℕ) : unitSphere (Fin (n+1)) := + ⟨EuclideanSpace.single 0 1, mem_sphere_zero_iff_norm.mpr (by simp)⟩ + +lemma sphere_inner_coordinate_lintegral (n : ℕ) {f : ℝ → ℝ≥0∞} (hf : Measurable f) + (u : unitSphere (Fin (n+1))) : + (∫⁻ v : unitSphere (Fin (n+1)), f (inner ℝ u.val v.val) ∂sphereUniform) = + ∫⁻ v : unitSphere (Fin (n+1)), f (v.val 0) ∂sphereUniform := by + obtain ⟨U, hU⟩ := orthogonalSphere_transitive (firstUnit n) u + have hm : Measurable (fun v : unitSphere (Fin (n+1)) => f (inner ℝ u.val v.val)) := by fun_prop + rw [← (sphereUniform_rotation_preserving U).lintegral_comp hm] + apply lintegral_congr + intro v + congr 1 + rw [← hU] + change inner ℝ (orthogonalIsometry U (firstUnit n).val) (orthogonalIsometry U v.val) = _ + rw [(orthogonalIsometry U).inner_map_map] + simp only [firstUnit, EuclideanSpace.inner_single_left, map_one, one_mul] + +lemma sphereOverlapLaw_lintegral (n : ℕ) {f : ℝ → ℝ≥0∞} (hf : Measurable f) : + (∫⁻ q, f q ∂sphereOverlapLaw (Fin (n+3))) = + ∫⁻ q, f q ∂normalizedOverlapShape (n+3) := by + rw [sphereOverlapLaw, lintegral_map hf (by fun_prop), + lintegral_prod _ (by fun_prop)] + simp_rw [sphere_inner_coordinate_lintegral (n+2) hf] + rw [lintegral_const, measure_univ, mul_one, sphereUniform_coordinate_lintegral n hf] + +lemma sphereOverlapLaw_density (n : ℕ) : + sphereOverlapLaw (Fin (n+3)) = normalizedOverlapShape (n+3) := by + apply Measure.ext_of_lintegral + exact fun _ hf => sphereOverlapLaw_lintegral n hf + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/SphereSaddle.lean b/lean/OAI/MathematicalPhysics/CriticalSK/SphereSaddle.lean new file mode 100644 index 0000000000000000000000000000000000000000..38014efcc53d0a1d88910b6e39243c514d7ae9e3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/SphereSaddle.lean @@ -0,0 +1,1504 @@ +import OAI.MathematicalPhysics.CriticalSK.GaussianMoments +import OAI.MathematicalPhysics.CriticalSK.SphereGeometry + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open MeasureTheory ProbabilityTheory + +open scoped ENNReal NNReal + +open scoped BigOperators InnerProductSpace + +open Module + +open scoped BigOperators ENNReal NNReal Real Topology + +open MeasureTheory ProbabilityTheory Filter + +open scoped BigOperators NNReal + +open scoped BigOperators + +open Matrix Polynomial + +open scoped BigOperators Topology + +open Filter + +open scoped BigOperators NNReal ENNReal Topology Pointwise Matrix.Norms.Elementwise + +open Set Metric MeasureTheory MeasureTheory.Measure + +open scoped ENNReal NNReal Topology + +open MeasureTheory MeasureTheory.Measure Set Metric + +open scoped BigOperators ENNReal Topology + +open Set MeasureTheory + +open scoped BigOperators ENNReal + +open MeasureTheory + +open Finset Real + +open Finset Real Filter + +open scoped Topology + +open MeasureTheory Filter Set Real + +open scoped ENNReal NNReal BigOperators + +open scoped NNReal ENNReal BigOperators +open scoped NNReal ENNReal +open ProbabilityTheory +namespace CriticalSK + + + +section + +variable {ι : Type*} [Fintype ι] + +def gaussianPiPDF (v : ι → ℝ≥0) (x : ι → ℝ) : ℝ := + ∏ i, gaussianPDFReal 0 (v i) (x i) + +lemma gaussianPiPDF_nonneg (v : ι → ℝ≥0) (x : ι → ℝ) : 0 ≤ gaussianPiPDF v x := by + exact Finset.prod_nonneg (fun i _ => gaussianPDFReal_nonneg _ _ _) + +lemma gaussianPiPDF_integrable (v : ι → ℝ≥0) : Integrable (gaussianPiPDF v) := + Integrable.fintype_prod (fun i => integrable_gaussianPDFReal 0 (v i)) + +lemma gaussianPi_density (v : ι → ℝ≥0) (hv : ∀ i, v i ≠ 0) : + Measure.pi (fun i => gaussianReal 0 (v i)) = + volume.withDensity (fun x => ENNReal.ofReal (gaussianPiPDF v x)) := by + apply Measure.pi_eq + intro s hs + rw [withDensity_apply _ (MeasurableSet.univ_pi hs), + ← ofReal_integral_eq_lintegral_ofReal (gaussianPiPDF_integrable v).integrableOn + (Filter.Eventually.of_forall (gaussianPiPDF_nonneg v))] + change ENNReal.ofReal (∫ x, gaussianPiPDF v x + ∂(Measure.pi (fun _ : ι => (volume : Measure ℝ))).restrict (Set.univ.pi s)) = _ + rw [Measure.restrict_pi_pi] + simp only [gaussianPiPDF] + rw [integral_fintype_prod_eq_prod] + rw [ENNReal.ofReal_prod_of_nonneg] + · apply Finset.prod_congr rfl + intro i _ + rw [gaussianReal_of_var_ne_zero _ (hv i), withDensity_apply _ (hs i)] + exact ofReal_integral_eq_lintegral_ofReal + (integrable_gaussianPDFReal 0 (v i)).integrableOn + (Filter.Eventually.of_forall (gaussianPDFReal_nonneg 0 (v i))) + · intro i _ + exact integral_nonneg (gaussianPDFReal_nonneg 0 (v i)) + +lemma gaussianPiPDF_continuous (v : ι → ℝ≥0) : Continuous (gaussianPiPDF v) := by + unfold gaussianPiPDF gaussianPDFReal + fun_prop + +lemma map_density_of_preserving {X Y : Type*} [MeasurableSpace X] [MeasurableSpace Y] + {μ : Measure X} {ν : Measure Y} {T : X → Y} (hT : MeasurePreserving T μ ν) + (w : Y → ℝ≥0∞) (hw : Measurable w) : + (μ.withDensity (fun x => w (T x))).map T = ν.withDensity w := by + ext A hA + rw [Measure.map_apply hT.measurable hA, withDensity_apply _ (hT.measurable hA), + withDensity_apply _ hA] + exact hT.setLIntegral_comp_preimage hA hw + +def diagonalGaussian (v : ι → ℝ≥0) : Measure (EuclideanSpace ℝ ι) := + (Measure.pi (fun i => gaussianReal 0 (v i))).map (WithLp.toLp 2 : (ι → ℝ) → EuclideanSpace ℝ ι) + +lemma density_toLp (w : (ι → ℝ) → ℝ≥0∞) (hw : Measurable w) : + ((volume : Measure (ι → ℝ)).withDensity w).map (WithLp.toLp 2 : (ι → ℝ) → EuclideanSpace ℝ ι) = volume.withDensity + (fun x : EuclideanSpace ℝ ι => w (WithLp.ofLp x)) := by + have hm : Measurable (fun x : EuclideanSpace ℝ ι => w (WithLp.ofLp x)) := + hw.comp (WithLp.measurable_ofLp 2 _) + simpa only [WithLp.ofLp_toLp] using + map_density_of_preserving (PiLp.volume_preserving_toLp ι) + (fun x : EuclideanSpace ℝ ι => w (WithLp.ofLp x)) hm + +lemma diagonalGaussian_density (v : ι → ℝ≥0) (hv : ∀ i, v i ≠ 0) : + diagonalGaussian v = volume.withDensity + (fun x : EuclideanSpace ℝ ι => ENNReal.ofReal (gaussianPiPDF v (WithLp.ofLp x))) := by + change (Measure.pi (fun i => gaussianReal 0 (v i))).map (WithLp.toLp 2 : (ι → ℝ) → EuclideanSpace ℝ ι) = _ + rw [gaussianPi_density v hv] + exact density_toLp _ (gaussianPiPDF_continuous v).measurable.ennreal_ofReal + +instance diagonalGaussian_probability (v : ι → ℝ≥0) : IsProbabilityMeasure (diagonalGaussian v) := by + unfold diagonalGaussian + infer_instance + +lemma euclideanGaussianPDF_continuous (v : ι → ℝ≥0) : + Continuous (fun x : EuclideanSpace ℝ ι => gaussianPiPDF v x) := + (gaussianPiPDF_continuous v).comp (PiLp.continuous_ofLp 2 _) + +lemma euclideanGaussianPDF_integrable (v : ι → ℝ≥0) : + Integrable (fun x : EuclideanSpace ℝ ι => gaussianPiPDF v x) := by + exact (PiLp.volume_preserving_ofLp ι).integrable_comp + (gaussianPiPDF_integrable v).aestronglyMeasurable |>.mpr (gaussianPiPDF_integrable v) + +end + +section + +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] + [MeasurableSpace E] [BorelSpace E] [Nontrivial E] + +lemma integral_polar_iterated (μ : Measure E) [μ.IsAddHaarMeasure] {f : E → ℝ} + (hf : Integrable f μ) : + (∫ x, f x ∂μ) = ∫ r : Ioi (0 : ℝ), ∫ u : sphere (0 : E) 1, + f (r.val • u.val) ∂μ.toSphere ∂volumeIoiPow (Module.finrank ℝ E - 1) := by + rw [integral_polar μ f] + exact integral_prod_symm _ + ((radial_map_preserving μ).integrable_comp hf.aestronglyMeasurable |>.mpr hf) + +omit [Nontrivial E] in +lemma angular_integral_continuous (μ : Measure E) [μ.IsAddHaarMeasure] + [ProperSpace E] {f : E → ℝ} (hf : Continuous f) (A : Set (sphere (0 : E) 1)) : + Continuous (fun r : ℝ => ∫ u : sphere (0 : E) 1, f (r • u.val) ∂μ.toSphere.restrict A) := by + have h : Continuous (Function.uncurry (fun r : ℝ => fun u : sphere (0 : E) 1 => + f (r • u.val))) := hf.comp (continuous_fst.smul (continuous_subtype_val.comp continuous_snd)) + simpa only [Measure.restrict_univ] using + (continuous_parametric_integral_of_continuous (μ := μ.toSphere.restrict A) h + (isCompact_univ : IsCompact (Set.univ : Set (sphere (0 : E) 1)))) + +lemma integral_polar_real (μ : Measure E) [μ.IsAddHaarMeasure] {f : E → ℝ} + (hf : Integrable f μ) : + (∫ x, f x ∂μ) = ∫ r in Ioi (0 : ℝ), r ^ (Module.finrank ℝ E - 1) * + ∫ u : sphere (0 : E) 1, f (r • u.val) ∂μ.toSphere := by + rw [integral_polar_iterated μ hf, Measure.volumeIoiPow, + integral_withDensity_eq_integral_toReal_smul (by fun_prop) + (Filter.Eventually.of_forall (fun _ => ENNReal.ofReal_lt_top))] + rw [integral_subtype_comap measurableSet_Ioi + (fun r : ℝ => (ENNReal.ofReal (r ^ (Module.finrank ℝ E - 1))).toReal • + ∫ u : sphere (0 : E) 1, f (r • u.val) ∂μ.toSphere)] + apply setIntegral_congr_fun measurableSet_Ioi + intro r hr + dsimp only + rw [ENNReal.toReal_ofReal (pow_nonneg hr.le _)] + rfl + +def normShell (a b : ℝ) : Set E := {x | a < ‖x‖ ∧ ‖x‖ ≤ b} + +omit [NormedSpace ℝ E] [FiniteDimensional ℝ E] [Nontrivial E] in +lemma normShell_measurable (a b : ℝ) : MeasurableSet (normShell (E := E) a b) := + (measurableSet_lt measurable_const measurable_norm).inter + (measurableSet_le measurable_norm measurable_const) + +omit [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] [Nontrivial E] in +lemma normShell_radial (a b : ℝ) (r : Ioi (0 : ℝ)) (u : sphere (0 : E) 1) : + r.val • u.val ∈ normShell a b ↔ r.val ∈ Ioc a b := by + have hu : ‖u.val‖ = 1 := mem_sphere_zero_iff_norm.mp u.property + simp only [normShell, Set.mem_ofPred_eq, norm_smul, Real.norm_eq_abs, abs_of_pos r.property.out, + hu, mul_one, Set.mem_Ioc] + +lemma normShell_integral (μ : Measure E) [μ.IsAddHaarMeasure] {f : E → ℝ} + (hf : Integrable f μ) {a b : ℝ} (ha : 0 ≤ a) : + (∫ x in normShell a b, f x ∂μ) = ∫ r in Ioc a b, + r ^ (Module.finrank ℝ E - 1) * ∫ u : sphere (0 : E) 1, f (r • u.val) ∂μ.toSphere := by + rw [← integral_indicator (normShell_measurable a b), + integral_polar_real μ (hf.indicator (normShell_measurable a b))] + calc + _ = ∫ r in Ioi (0 : ℝ), (Ioc a b).indicator + (fun r => r ^ (Module.finrank ℝ E - 1) * + ∫ u : sphere (0 : E) 1, f (r • u.val) ∂μ.toSphere) r := by + apply setIntegral_congr_fun measurableSet_Ioi + intro r hr + have hh (u : sphere (0 : E) 1) := normShell_radial a b ⟨r, hr⟩ u + by_cases hab : r ∈ Ioc a b + · simp only [Set.indicator_of_mem hab] + congr 1 + apply integral_congr_ae + exact Filter.Eventually.of_forall (fun u => Set.indicator_of_mem ((hh u).mpr hab) f) + · simp only [Set.indicator_of_notMem hab] + have hz : (∫ u : sphere (0 : E) 1, + (normShell a b).indicator f (r • u.val) ∂μ.toSphere) = 0 := by + apply integral_eq_zero_of_ae + exact Filter.Eventually.of_forall (fun u => Set.indicator_of_notMem + (fun h => hab ((hh u).mp h)) f) + rw [hz, mul_zero] + _ = _ := by + rw [setIntegral_indicator measurableSet_Ioc] + have hsub : Ioc a b ⊆ Ioi (0 : ℝ) := fun _ h => lt_of_le_of_lt ha h.1 + rw [Set.inter_eq_right.mpr hsub] + +def radialDensity (μ : Measure E) (f : E → ℝ) (r : ℝ) : ℝ := + r ^ (Module.finrank ℝ E - 1) * ∫ u : sphere (0 : E) 1, f (r • u.val) ∂μ.toSphere + +omit [Nontrivial E] in +lemma radialDensity_continuous (μ : Measure E) [μ.IsAddHaarMeasure] [ProperSpace E] + {f : E → ℝ} (hf : Continuous f) : Continuous (radialDensity μ f) := by + have h := angular_integral_continuous μ hf Set.univ + simp only [Measure.restrict_univ] at h + exact (continuous_id.pow _).mul h + +lemma normShell_density (μ : Measure E) [μ.IsAddHaarMeasure] {f : E → ℝ} + (hf : Integrable f μ) (hfn : ∀ x, 0 ≤ f x) {a b : ℝ} (ha : 0 ≤ a) : + μ.withDensity (fun x => ENNReal.ofReal (f x)) (normShell a b) = + ENNReal.ofReal (∫ r in Ioc a b, radialDensity μ f r) := by + rw [withDensity_apply _ (normShell_measurable a b), + ← ofReal_integral_eq_lintegral_ofReal hf.integrableOn (Filter.Eventually.of_forall hfn), + normShell_integral μ hf ha] + rfl + +lemma normShell_density_real (μ : Measure E) [μ.IsAddHaarMeasure] {f : E → ℝ} + (hf : Integrable f μ) (hfn : ∀ x, 0 ≤ f x) {a b : ℝ} (ha : 0 ≤ a) : + (μ.withDensity (fun x => ENNReal.ofReal (f x)) (normShell a b)).toReal = + ∫ r in Ioc a b, radialDensity μ f r := by + rw [normShell_density μ hf hfn ha, ENNReal.toReal_ofReal] + apply setIntegral_nonneg measurableSet_Ioc + intro r hr + exact mul_nonneg (pow_nonneg (le_trans ha hr.1.le) _) (integral_nonneg (fun u => hfn _)) + +lemma normShell_density_limit (μ : Measure E) [μ.IsAddHaarMeasure] [ProperSpace E] + {f : E → ℝ} (hf : Integrable f μ) (hfc : Continuous f) (hfn : ∀ x, 0 ≤ f x) + {r : ℝ} (hr : 0 < r) : + Filter.Tendsto (fun δ : ℝ => + (μ.withDensity (fun x => ENNReal.ofReal (f x)) (normShell r (r+δ))).toReal / δ) + (nhdsWithin 0 (Ioi 0)) (𝓝 (radialDensity μ f r)) := by + have hq := radialDensity_continuous μ hfc + have hd : HasDerivAt (fun b : ℝ => ∫ t in r..b, radialDensity μ f t) + (radialDensity μ f r) r := + intervalIntegral.integral_hasDerivAt_right (IntervalIntegrable.refl) + hq.stronglyMeasurable.stronglyMeasurableAtFilter hq.continuousAt + apply hd.tendsto_slope_zero_right.congr' + filter_upwards [self_mem_nhdsWithin] with δ hδ + rw [normShell_density_real μ hf hfn hr.le, + intervalIntegral.integral_same, sub_zero, smul_eq_mul, + intervalIntegral.integral_of_le (by linarith [hδ.out] : r ≤ r+δ)] + exact mul_comm _ _ + +def squareNormShell (s δ : ℝ) : Set E := {x | s < ‖x‖^2 ∧ ‖x‖^2 ≤ s+δ} + +omit [NormedSpace ℝ E] [FiniteDimensional ℝ E] [Nontrivial E] in +lemma squareNormShell_measurable (s δ : ℝ) : MeasurableSet (squareNormShell (E := E) s δ) := + (measurableSet_lt measurable_const (measurable_norm.pow_const 2)).inter + (measurableSet_le (measurable_norm.pow_const 2) measurable_const) + +omit [NormedSpace ℝ E] [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] [Nontrivial E] in +lemma squareNormShell_eq {s δ : ℝ} (hs : 0 ≤ s) (hδ : 0 ≤ δ) : + squareNormShell (E := E) s δ = normShell (Real.sqrt s) (Real.sqrt (s+δ)) := by + ext x + have h1 := Real.sq_sqrt hs + have h2 := Real.sq_sqrt (by linarith : 0 ≤ s+δ) + have h3 := Real.sqrt_nonneg s + have h4 := Real.sqrt_nonneg (s+δ) + have h5 := norm_nonneg x + change (s < ‖x‖^2 ∧ ‖x‖^2 ≤ s+δ) ↔ (Real.sqrt s < ‖x‖ ∧ ‖x‖ ≤ Real.sqrt (s+δ)) + constructor <;> intro h <;> constructor <;> nlinarith [h.1, h.2] + +lemma squareNormShell_density_limit (μ : Measure E) [μ.IsAddHaarMeasure] [ProperSpace E] + {f : E → ℝ} (hf : Integrable f μ) (hfc : Continuous f) (hfn : ∀ x, 0 ≤ f x) + {s : ℝ} (hs : 0 < s) : + Filter.Tendsto (fun δ : ℝ => + (μ.withDensity (fun x => ENNReal.ofReal (f x)) (squareNormShell s δ)).toReal / δ) + (nhdsWithin 0 (Ioi 0)) (𝓝 (radialDensity μ f (Real.sqrt s) / (2 * Real.sqrt s))) := by + have hq := radialDensity_continuous μ hfc + have hd : HasDerivAt (fun t : ℝ => ∫ r in Real.sqrt s..t, radialDensity μ f r) + (radialDensity μ f (Real.sqrt s)) (Real.sqrt s) := + intervalIntegral.integral_hasDerivAt_right IntervalIntegrable.refl + hq.stronglyMeasurable.stronglyMeasurableAtFilter hq.continuousAt + have hd' := hd.comp s (Real.hasDerivAt_sqrt hs.ne') + have hh := hd'.tendsto_slope_zero_right + simp only [Function.comp_def, mul_one_div] at hh + apply hh.congr' + filter_upwards [self_mem_nhdsWithin] with δ hδ + have hδ0 : 0 < δ := hδ.out + rw [squareNormShell_eq hs.le hδ0.le, + normShell_density_real μ hf hfn (Real.sqrt_nonneg _), intervalIntegral.integral_same, + sub_zero, smul_eq_mul, intervalIntegral.integral_of_le (Real.sqrt_le_sqrt (by linarith))] + exact mul_comm _ _ + +end + +section + +def splitPair (n : ℕ) (x : Fin (n+2) → ℝ) : (ℝ × ℝ) × (Fin n → ℝ) := + ((x 0, x 1), fun i => x i.succ.succ) + +lemma splitPair_preserving (n : ℕ) (μ : Fin (n+2) → Measure ℝ) [∀ i, SigmaFinite (μ i)] : + MeasurePreserving (splitPair n) (Measure.pi μ) + (((μ 0).prod (μ 1)).prod (Measure.pi (fun i => μ i.succ.succ))) := by + have h1 := measurePreserving_piFinSuccAbove μ 0 + have h2 := (MeasurePreserving.id (μ 0)).prod + (measurePreserving_piFinSuccAbove (fun i : Fin (n+1) => μ i.succ) 0) + have h3 := (measurePreserving_prodAssoc (μ 0) (μ 1) + (Measure.pi fun i : Fin n => μ i.succ.succ)).symm + exact h3.comp (h2.comp h1) + +lemma splitPair_square_sum (n : ℕ) (x : Fin (n+2) → ℝ) : + (∑ i, x i^2) = x 0^2 + x 1^2 + ∑ i : Fin n, x i.succ.succ^2 := by + rw [Fin.sum_univ_succ, Fin.sum_univ_succ] + simp only [Fin.succ_zero_eq_one] + ring + +section + +def squareDisk (s : ℝ) : Set (ℝ × ℝ) := {p | p.1 ^ 2 + p.2 ^ 2 ≤ s} + +def squareAnnulus (s δ : ℝ) : Set (ℝ × ℝ) := + {p | s < p.1 ^ 2 + p.2 ^ 2 ∧ p.1 ^ 2 + p.2 ^ 2 ≤ s + δ} + +lemma squareDisk_measurable (s : ℝ) : MeasurableSet (squareDisk s) := by + exact measurableSet_le (by fun_prop) measurable_const + +lemma squareAnnulus_measurable (s δ : ℝ) : MeasurableSet (squareAnnulus s δ) := by + exact (measurableSet_lt measurable_const + (show Measurable (fun p : ℝ × ℝ => p.1 ^ 2 + p.2 ^ 2) by fun_prop)).inter + (measurableSet_le (show Measurable (fun p : ℝ × ℝ => p.1 ^ 2 + p.2 ^ 2) by fun_prop) measurable_const) + +lemma squareDisk_complex {s : ℝ} (hs : 0 ≤ s) : + Complex.measurableEquivRealProd ⁻¹' squareDisk s = + Metric.closedBall (0 : ℂ) (Real.sqrt s) := by + ext z + simp only [Set.mem_preimage, squareDisk, Set.mem_ofPred_eq, + Complex.measurableEquivRealProd_apply, Metric.mem_closedBall, dist_zero_right] + rw [show z.re ^ 2 + z.im ^ 2 = ‖z‖ ^ 2 by rw [Complex.sq_norm, Complex.normSq_apply]; ring] + exact (Real.le_sqrt (norm_nonneg _) hs).symm + +lemma volume_squareDisk {s : ℝ} (hs : 0 ≤ s) : + volume (squareDisk s) = ENNReal.ofReal (Real.pi * s) := by + rw [← Complex.volume_preserving_equiv_real_prod.measure_preimage + (squareDisk_measurable s).nullMeasurableSet, squareDisk_complex hs, Complex.volume_closedBall, + ← ENNReal.ofReal_pow (Real.sqrt_nonneg _), Real.sq_sqrt hs] + rw [← ENNReal.ofReal_coe_nnreal, NNReal.coe_real_pi, ← ENNReal.ofReal_mul hs, mul_comm] + +lemma squareAnnulus_sdiff (s δ : ℝ) : + squareAnnulus s δ = squareDisk (s+δ) \ squareDisk s := by + ext p + simp [squareAnnulus, squareDisk, and_comm] + +lemma volume_squareAnnulus {s δ : ℝ} (hs : 0 ≤ s) (hδ : 0 ≤ δ) : + volume (squareAnnulus s δ) = ENNReal.ofReal (Real.pi * δ) := by + rw [squareAnnulus_sdiff, measure_sdiff (by + intro p hp + change p.1 ^ 2 + p.2 ^ 2 ≤ s at hp + change p.1 ^ 2 + p.2 ^ 2 ≤ s+δ + linarith) (squareDisk_measurable s).nullMeasurableSet (by + rw [volume_squareDisk hs] + exact ENNReal.ofReal_ne_top)] + rw [volume_squareDisk (by linarith), volume_squareDisk hs, + ← ENNReal.ofReal_sub _ (by positivity)] + congr 1 + ring + +def gaussianPairPrefactor (a b : ℝ≥0) : ℝ := + (Real.sqrt (2 * Real.pi * a) * Real.sqrt (2 * Real.pi * b))⁻¹ + +lemma gaussianPairPrefactor_nonneg (a b : ℝ≥0) : 0 ≤ gaussianPairPrefactor a b := by + unfold gaussianPairPrefactor + positivity + +lemma gaussianPair_density (a b : ℝ≥0) (x y : ℝ) : + gaussianPDFReal 0 a x * gaussianPDFReal 0 b y = + gaussianPairPrefactor a b * Real.exp (-(x^2/(2*a) + y^2/(2*b))) := by + simp only [gaussianPDFReal, sub_zero, gaussianPairPrefactor, mul_inv, neg_div] + rw [show (Real.sqrt (2*Real.pi*a))⁻¹ * Real.exp (-(x^2/(2*a))) * + ((Real.sqrt (2*Real.pi*b))⁻¹ * Real.exp (-(y^2/(2*b)))) = + ((Real.sqrt (2*Real.pi*a))⁻¹ * (Real.sqrt (2*Real.pi*b))⁻¹) * + (Real.exp (-(x^2/(2*a))) * Real.exp (-(y^2/(2*b)))) by ring, + ← Real.exp_add, ← neg_add] + +lemma gaussianPair_density_upper (a b : ℝ≥0) (x y : ℝ) : + gaussianPDFReal 0 a x * gaussianPDFReal 0 b y ≤ gaussianPairPrefactor a b := by + rw [gaussianPair_density] + have h : Real.exp (-(x^2/(2*a) + y^2/(2*b))) ≤ 1 := + Real.exp_le_one_iff.mpr (neg_nonpos.mpr (by positivity)) + simpa only [mul_one] using + mul_le_mul_of_nonneg_left h (gaussianPairPrefactor_nonneg a b) + +lemma gaussianPair_density_lower {a b : ℝ≥0} {m R x y : ℝ} + (hm : 0 < m) (hma : m ≤ a) (hmb : m ≤ b) (hR : x^2+y^2 ≤ R) : + gaussianPairPrefactor a b * Real.exp (-R/(2*m)) ≤ + gaussianPDFReal 0 a x * gaussianPDFReal 0 b y := by + rw [gaussianPair_density] + apply mul_le_mul_of_nonneg_left _ (gaussianPairPrefactor_nonneg a b) + apply Real.exp_le_exp.mpr + have hxa : x^2/(2*a) ≤ x^2/(2*m) := + div_le_div_of_nonneg_left (sq_nonneg x) (by positivity) (by linarith) + have hyb : y^2/(2*b) ≤ y^2/(2*m) := + div_le_div_of_nonneg_left (sq_nonneg y) (by positivity) (by linarith) + have hsum : x^2/(2*a) + y^2/(2*b) ≤ R/(2*m) := by + calc + _ ≤ x^2/(2*m) + y^2/(2*m) := add_le_add hxa hyb + _ = (x^2+y^2)/(2*m) := by ring + _ ≤ _ := div_le_div_of_nonneg_right hR (by positivity) + rw [neg_div] + exact neg_le_neg hsum + +lemma gaussianPair_apply {a b : ℝ≥0} (ha : a ≠ 0) (hb : b ≠ 0) (s : Set (ℝ × ℝ)) : + ((gaussianReal 0 a).prod (gaussianReal 0 b)) s = + ∫⁻ p in s, ENNReal.ofReal (gaussianPDFReal 0 a p.1 * gaussianPDFReal 0 b p.2) := by + rw [gaussianReal_of_var_ne_zero _ ha, gaussianReal_of_var_ne_zero _ hb, + prod_withDensity (measurable_gaussianPDF _ _) (measurable_gaussianPDF _ _), + withDensity_apply' _ s] + apply lintegral_congr + intro p + exact (ENNReal.ofReal_mul (gaussianPDFReal_nonneg _ _ _)).symm + +lemma gaussianPair_annulus_upper {a b : ℝ≥0} (ha : a ≠ 0) (hb : b ≠ 0) + {s δ : ℝ} (hs : 0 ≤ s) (hδ : 0 ≤ δ) : + ((gaussianReal 0 a).prod (gaussianReal 0 b)) (squareAnnulus s δ) ≤ + ENNReal.ofReal (Real.pi * δ * gaussianPairPrefactor a b) := by + rw [gaussianPair_apply ha hb] + calc + _ ≤ ∫⁻ _p in squareAnnulus s δ, ENNReal.ofReal (gaussianPairPrefactor a b) := by + apply lintegral_mono + intro p + exact ENNReal.ofReal_le_ofReal (gaussianPair_density_upper a b p.1 p.2) + _ = _ := by + rw [lintegral_const, Measure.restrict_apply_univ, volume_squareAnnulus hs hδ, + ← ENNReal.ofReal_mul (gaussianPairPrefactor_nonneg _ _), mul_comm] + +lemma gaussianPair_annulus_lower {a b : ℝ≥0} {m s δ : ℝ} + (hm : 0 < m) (hma : m ≤ a) (hmb : m ≤ b) (hs : 0 ≤ s) (hδ : 0 ≤ δ) : + ENNReal.ofReal (Real.pi * δ * gaussianPairPrefactor a b * Real.exp (-(s+δ)/(2*m))) ≤ + ((gaussianReal 0 a).prod (gaussianReal 0 b)) (squareAnnulus s δ) := by + have ha : a ≠ 0 := by intro h; simp only [h, NNReal.coe_zero] at hma; linarith + have hb : b ≠ 0 := by intro h; simp only [h, NNReal.coe_zero] at hmb; linarith + rw [gaussianPair_apply ha hb] + calc + _ = ∫⁻ _p in squareAnnulus s δ, + ENNReal.ofReal (gaussianPairPrefactor a b * Real.exp (-(s+δ)/(2*m))) := by + rw [lintegral_const, Measure.restrict_apply_univ, volume_squareAnnulus hs hδ, + ← ENNReal.ofReal_mul (mul_nonneg (gaussianPairPrefactor_nonneg _ _) + (Real.exp_pos _).le)] + congr 1 + ring + _ ≤ _ := by + apply lintegral_mono_ae + apply (ae_restrict_iff' (squareAnnulus_measurable s δ)).mpr + exact ae_of_all _ (fun p hp => ENNReal.ofReal_le_ofReal + (gaussianPair_density_lower hm hma hmb hp.2)) + +lemma volume_squareAnnulus_le {s δ : ℝ} (hδ : 0 ≤ δ) : + volume (squareAnnulus s δ) ≤ ENNReal.ofReal (Real.pi * δ) := by + by_cases hs : 0 ≤ s + · exact le_of_eq (volume_squareAnnulus hs hδ) + · have hsn : s < 0 := lt_of_not_ge hs + by_cases ht : 0 ≤ s+δ + · have hsub : squareAnnulus s δ ⊆ squareDisk (s+δ) := fun _ h => h.2 + calc + _ ≤ volume (squareDisk (s+δ)) := measure_mono hsub + _ = ENNReal.ofReal (Real.pi*(s+δ)) := volume_squareDisk ht + _ ≤ _ := ENNReal.ofReal_le_ofReal (mul_le_mul_of_nonneg_left (by linarith) Real.pi_pos.le) + · have hset : squareAnnulus s δ = ∅ := by + apply Set.eq_empty_iff_forall_notMem.mpr + intro p hp + have hh := add_nonneg (sq_nonneg p.1) (sq_nonneg p.2) + exact ht (le_trans hh hp.2) + rw [hset, measure_empty] + exact bot_le + +lemma gaussianPair_annulus_upper_all {a b : ℝ≥0} (ha : a ≠ 0) (hb : b ≠ 0) + (s : ℝ) {δ : ℝ} (hδ : 0 ≤ δ) : + ((gaussianReal 0 a).prod (gaussianReal 0 b)) (squareAnnulus s δ) ≤ + ENNReal.ofReal (Real.pi * δ * gaussianPairPrefactor a b) := by + rw [gaussianPair_apply ha hb] + calc + _ ≤ ∫⁻ _p in squareAnnulus s δ, ENNReal.ofReal (gaussianPairPrefactor a b) := by + exact lintegral_mono (fun p => ENNReal.ofReal_le_ofReal (gaussianPair_density_upper a b p.1 p.2)) + _ ≤ ENNReal.ofReal (gaussianPairPrefactor a b) * ENNReal.ofReal (Real.pi * δ) := by + rw [lintegral_const, Measure.restrict_apply_univ] + exact mul_le_mul_of_nonneg_left (volume_squareAnnulus_le hδ) bot_le + _ = _ := by + rw [← ENNReal.ofReal_mul (gaussianPairPrefactor_nonneg _ _), mul_comm] + +variable {Ω : Type*} [MeasurableSpace Ω] + +def sumSquareShell (Z : Ω → ℝ) (s δ : ℝ) : Set ((ℝ × ℝ) × Ω) := + {p | s < p.1.1^2 + p.1.2^2 + Z p.2 ∧ p.1.1^2 + p.1.2^2 + Z p.2 ≤ s+δ} + +lemma sumSquareShell_measurable {Z : Ω → ℝ} (hZ : Measurable Z) (s δ : ℝ) : + MeasurableSet (sumSquareShell Z s δ) := by + have h : Measurable (fun p : (ℝ × ℝ) × Ω => p.1.1^2 + p.1.2^2 + Z p.2) := by fun_prop + exact (measurableSet_lt measurable_const h).inter (measurableSet_le h measurable_const) + +lemma sumSquareShell_apply (μ : Measure (ℝ × ℝ)) (ν : Measure Ω) [SFinite μ] [SFinite ν] + {Z : Ω → ℝ} (hZ : Measurable Z) (s δ : ℝ) : + (μ.prod ν) (sumSquareShell Z s δ) = ∫⁻ ω, μ (squareAnnulus (s-Z ω) δ) ∂ν := by + rw [Measure.prod_apply_symm (sumSquareShell_measurable hZ s δ)] + apply lintegral_congr + intro ω + congr 1 + ext p + simp only [Set.mem_preimage, sumSquareShell, squareAnnulus, Set.mem_ofPred_eq] + constructor <;> intro h <;> constructor <;> linarith [h.1, h.2] + +lemma gaussianPair_bulk_upper {ν : Measure Ω} [IsProbabilityMeasure ν] + {Z : Ω → ℝ} (hZ : Measurable Z) {a b : ℝ≥0} (ha : a ≠ 0) (hb : b ≠ 0) + (s : ℝ) {δ : ℝ} (hδ : 0 ≤ δ) : + (((gaussianReal 0 a).prod (gaussianReal 0 b)).prod ν) (sumSquareShell Z s δ) ≤ + ENNReal.ofReal (Real.pi * δ * gaussianPairPrefactor a b) := by + rw [sumSquareShell_apply _ _ hZ] + calc + _ ≤ ∫⁻ _ : Ω, ENNReal.ofReal (Real.pi * δ * gaussianPairPrefactor a b) ∂ν := + lintegral_mono (fun ω => gaussianPair_annulus_upper_all ha hb (s-Z ω) hδ) + _ = _ := by simp + +lemma gaussianPair_bulk_lower {ν : Measure Ω} [IsProbabilityMeasure ν] + {Z : Ω → ℝ} (hZ : Measurable Z) {a b : ℝ≥0} {m s R δ : ℝ} + (hm : 0 < m) (hma : m ≤ a) (hmb : m ≤ b) (hδ : 0 ≤ δ) : + ENNReal.ofReal (Real.pi * δ * gaussianPairPrefactor a b * Real.exp (-(R+δ)/(2*m))) * + ν {ω | s-R ≤ Z ω ∧ Z ω ≤ s} ≤ + (((gaussianReal 0 a).prod (gaussianReal 0 b)).prod ν) (sumSquareShell Z s δ) := by + rw [sumSquareShell_apply _ _ hZ] + let A := {ω | s-R ≤ Z ω ∧ Z ω ≤ s} + have hA : MeasurableSet A := + (measurableSet_le measurable_const hZ).inter (measurableSet_le hZ measurable_const) + calc + _ = ∫⁻ _ω in A, ENNReal.ofReal + (Real.pi * δ * gaussianPairPrefactor a b * Real.exp (-(R+δ)/(2*m))) ∂ν := by + rw [lintegral_const, Measure.restrict_apply_univ] + _ ≤ ∫⁻ ω in A, ((gaussianReal 0 a).prod (gaussianReal 0 b)) + (squareAnnulus (s-Z ω) δ) ∂ν := by + apply lintegral_mono_ae + filter_upwards [ae_restrict_mem hA] with ω hω + apply le_trans _ (gaussianPair_annulus_lower hm hma hmb (sub_nonneg.mpr hω.2) hδ) + apply ENNReal.ofReal_le_ofReal + apply mul_le_mul_of_nonneg_left _ (mul_nonneg (mul_nonneg Real.pi_pos.le hδ) (gaussianPairPrefactor_nonneg _ _)) + apply Real.exp_le_exp.mpr + apply (div_le_div_iff_of_pos_right (by positivity : 0 < 2*m)).mpr + linarith [hω.1] + _ ≤ _ := setLIntegral_le_lintegral _ _ + +end + +section + +lemma fourth_power_le_exp (x : ℝ) : x ^ 4 ≤ 32 * Real.exp (x^2/4) := by + have h := Real.pow_div_factorial_le_exp (x^2/4) (by positivity) 2 + norm_num at h + nlinarith + +lemma gaussian_fourth_integrable : Integrable (fun x : ℝ => x^4) (gaussianReal 0 1) := by + apply ((gaussian_square_integrable (1/4) (by norm_num)).const_mul 32).mono' (by fun_prop) + filter_upwards with x + rw [Real.norm_eq_abs, abs_of_nonneg (by positivity : 0 ≤ x^4)] + simpa only [div_eq_mul_inv, one_mul, mul_comm] using fourth_power_le_exp x + +lemma gaussian_fourth_bound : (∫ x : ℝ, x ^ 4 ∂gaussianReal 0 1) ≤ 64 := by + calc + _ ≤ ∫ x : ℝ, 32 * Real.exp ((1/4) * x^2) ∂gaussianReal 0 1 := + integral_mono gaussian_fourth_integrable + ((gaussian_square_integrable (1/4) (by norm_num)).const_mul 32) + (fun x => by simpa only [div_eq_mul_inv, one_mul, mul_comm] using fourth_power_le_exp x) + _ = 32 * (Real.sqrt (1/2))⁻¹ := by + rw [integral_const_mul, gaussian_square_integral _ (by norm_num)] + norm_num + _ ≤ 64 := by + have hs : (1/2 : ℝ) ≤ Real.sqrt (1/2) := by + apply Real.le_sqrt (by norm_num) (by norm_num) |>.mpr + norm_num + have hh : (Real.sqrt (1/2))⁻¹ ≤ 2 := by + calc + _ ≤ (1/2 : ℝ)⁻¹ := (inv_le_inv₀ (by positivity) (by norm_num)).mpr hs + _ = 2 := by norm_num + linarith + +lemma gaussian_as_scaled (v : ℝ≥0) : gaussianReal 0 v = + (gaussianReal 0 1).map (fun x : ℝ => Real.sqrt v * x) := by + rw [gaussianReal_map_const_mul] + congr 1 + · simp + · apply NNReal.coe_injective + simp [Real.sq_sqrt v.coe_nonneg] + +lemma gaussian_fourth_integrable_var (v : ℝ≥0) : + Integrable (fun x : ℝ => x^4) (gaussianReal 0 v) := by + rw [gaussian_as_scaled] + apply (integrable_map_measure (by fun_prop) (by fun_prop)).mpr + simpa only [Function.comp_def, mul_pow] using gaussian_fourth_integrable.const_mul ((Real.sqrt v)^4) + +lemma gaussian_fourth_bound_var (v : ℝ≥0) : + (∫ x : ℝ, x^4 ∂gaussianReal 0 v) ≤ 64 * (v:ℝ)^2 := by + rw [gaussian_as_scaled, integral_map (by fun_prop) (by fun_prop)] + simp_rw [mul_pow] + rw [integral_const_mul] + have hs : (Real.sqrt (v:ℝ))^4 = (v:ℝ)^2 := by + rw [show (4:ℕ)=2*2 by rfl, pow_mul, Real.sq_sqrt v.coe_nonneg] + rw [hs] + exact (mul_le_mul_of_nonneg_left gaussian_fourth_bound (sq_nonneg (v:ℝ))).trans_eq (mul_comm _ _) + +lemma gaussian_square_memLp (v : ℝ≥0) : + MemLp (fun x : ℝ => x^2) 2 (gaussianReal 0 v) := by + apply (memLp_two_iff_integrable_sq (by fun_prop)).mpr + simpa only [← pow_mul] using gaussian_fourth_integrable_var v + +lemma gaussian_square_mean (v : ℝ≥0) : + (∫ x : ℝ, x^2 ∂gaussianReal 0 v) = v := by + have h := variance_eq_sub (μ := gaussianReal 0 v) (X := id) (memLp_id_gaussianReal 2) + simpa only [variance_id_gaussianReal, id_eq, Pi.pow_apply, integral_id_gaussianReal, + zero_pow (by norm_num : 2 ≠ 0), sub_zero] using h.symm + +lemma gaussian_square_variance (v : ℝ≥0) : + Var[(fun x : ℝ => x^2); gaussianReal 0 v] ≤ 64 * (v:ℝ)^2 := by + rw [variance_eq_sub (gaussian_square_memLp v), gaussian_square_mean] + have h : (∫ x : ℝ, (x^2)^2 ∂gaussianReal 0 v) ≤ 64 * (v:ℝ)^2 := by + simpa only [← pow_mul] using gaussian_fourth_bound_var v + simpa only [Pi.pow_apply] using (sub_le_self _ (sq_nonneg (v:ℝ))).trans h + +variable {ι : Type*} [Fintype ι] + +def piSquareSum (x : ι → ℝ) : ℝ := ∑ i, x i ^ 2 + +lemma piSquareSum_memLp (v : ι → ℝ≥0) : + MemLp (piSquareSum (ι := ι)) 2 (Measure.pi (fun i => gaussianReal 0 (v i))) := by + exact memLp_finsetSum _ (fun i _ => (gaussian_square_memLp (v i)).comp_measurePreserving + (measurePreserving_eval _ i)) + +lemma piSquareSum_mean (v : ι → ℝ≥0) : + (∫ x, piSquareSum x ∂Measure.pi (fun i => gaussianReal 0 (v i))) = ∑ i, (v i : ℝ) := by + unfold piSquareSum + rw [integral_finsetSum Finset.univ (f := fun (i : ι) (x : ι → ℝ) => x i ^ 2) + (fun i _ => integrable_comp_eval (μ := fun i => gaussianReal 0 (v i)) (i := i) + ((gaussian_square_memLp (v i)).integrable (by norm_num)))] + apply Finset.sum_congr rfl + intro i _ + rw [integral_comp_eval (μ := fun i => gaussianReal 0 (v i)) (i := i) (f := fun x : ℝ => x^2) (by fun_prop)] + exact gaussian_square_mean (v i) + +lemma piSquareSum_variance (v : ι → ℝ≥0) : + Var[piSquareSum (ι := ι); Measure.pi (fun i => gaussianReal 0 (v i))] ≤ + 64 * ∑ i, (v i : ℝ)^2 := by + have he : piSquareSum (ι := ι) = ∑ i, (fun x : ι → ℝ => x i^2) := by + funext x + simp only [piSquareSum, Finset.sum_apply] + rw [he, variance_sum_pi (X := fun (_ : ι) (x : ℝ) => x^2) + (fun i => gaussian_square_memLp (v i)), Finset.mul_sum] + exact Finset.sum_le_sum (fun i _ => gaussian_square_variance (v i)) + +lemma piSquareSum_tail (v : ι → ℝ≥0) {d : ℝ} (hd : 0 < d) : + (Measure.pi (fun i => gaussianReal 0 (v i))) {x | d ≤ |piSquareSum x - ∑ i, (v i : ℝ)|} ≤ + ENNReal.ofReal (64 * (∑ i, (v i : ℝ)^2) / d^2) := by + have ht := meas_ge_le_variance_div_sq (piSquareSum_memLp v) hd + rw [piSquareSum_mean] at ht + refine ht.trans (ENNReal.ofReal_le_ofReal ?_) + exact div_le_div_of_nonneg_right (piSquareSum_variance v) (sq_nonneg d) + +lemma piSquareSum_bulk_mass (v : ι → ℝ≥0) {s d : ℝ} (hd : 0 < d) + (hmean : (∑ i, (v i : ℝ)) = s-d) + (hvar : 128 * (∑ i, (v i : ℝ)^2) ≤ d^2) : + (1/2 : ℝ≥0∞) ≤ (Measure.pi (fun i => gaussianReal 0 (v i))) + {x | s-2*d ≤ piSquareSum x ∧ piSquareSum x ≤ s} := by + let μ := Measure.pi (fun i => gaussianReal 0 (v i)) + let A := {x : ι → ℝ | s-2*d ≤ piSquareSum x ∧ piSquareSum x ≤ s} + have hA : MeasurableSet A := by + have hS : Measurable (piSquareSum (ι := ι)) := by unfold piSquareSum; fun_prop + exact (measurableSet_le measurable_const hS).inter (measurableSet_le hS measurable_const) + have hsub : Aᶜ ⊆ {x : ι → ℝ | d ≤ |piSquareSum x - ∑ i, (v i : ℝ)|} := by + intro x hx + change ¬ (s-2*d ≤ piSquareSum x ∧ piSquareSum x ≤ s) at hx + rw [Set.mem_ofPred_eq, hmean, le_abs] + push Not at hx + by_cases hh : s-2*d ≤ piSquareSum x + · left; linarith [hx hh] + · right; linarith + have ht : μ Aᶜ ≤ (1/2:ℝ≥0∞) := by + apply (measure_mono hsub).trans ((piSquareSum_tail v hd).trans _) + rw [show (1/2 : ℝ≥0∞) = ENNReal.ofReal (1/2) by rw [ENNReal.ofReal_div_of_pos (by norm_num)]; norm_num] + apply ENNReal.ofReal_le_ofReal + apply (div_le_iff₀ (sq_pos_of_pos hd)).mpr + linarith + have hsum : μ A + μ Aᶜ = 1 := by + rw [measure_add_measure_compl hA, measure_univ] + have hfin : μ A ≠ ∞ := measure_ne_top _ _ + have hreal := congrArg ENNReal.toReal hsum + rw [ENNReal.toReal_add hfin (measure_ne_top _ _), ENNReal.toReal_one] at hreal + have ht' := ENNReal.toReal_mono (by norm_num : (1/2:ℝ≥0∞) ≠ ∞) ht + norm_num at ht' + apply (ENNReal.toReal_le_toReal (by norm_num) hfin).mp + norm_num + linarith + +end + +section + +open Set Filter + +variable {n : ℕ} + +lemma diagonalGaussian_shell_split (v : Fin (n+2) → ℝ≥0) (s δ : ℝ) : + diagonalGaussian v (squareNormShell s δ) = + (((gaussianReal 0 (v 0)).prod (gaussianReal 0 (v 1))).prod + (Measure.pi fun i : Fin n => gaussianReal 0 (v i.succ.succ))) + (sumSquareShell piSquareSum s δ) := by + rw [diagonalGaussian, Measure.map_apply (WithLp.measurable_toLp 2 _) + (squareNormShell_measurable s δ)] + rw [← (splitPair_preserving n (fun i => gaussianReal 0 (v i))).measure_preimage + (sumSquareShell_measurable (by unfold piSquareSum; fun_prop) s δ).nullMeasurableSet] + congr 1 + ext x + simp only [Set.mem_preimage, squareNormShell, sumSquareShell, Set.mem_ofPred_eq, + EuclideanSpace.real_norm_sq_eq, splitPair, piSquareSum] + rw [splitPair_square_sum] + +lemma diagonalGaussian_shell_upper (v : Fin (n+2) → ℝ≥0) + (h0 : v 0 ≠ 0) (h1 : v 1 ≠ 0) (s : ℝ) {δ : ℝ} (hδ : 0 ≤ δ) : + diagonalGaussian v (squareNormShell s δ) ≤ + ENNReal.ofReal (Real.pi * δ * gaussianPairPrefactor (v 0) (v 1)) := by + rw [diagonalGaussian_shell_split] + exact gaussianPair_bulk_upper (by unfold piSquareSum; fun_prop) h0 h1 s hδ + +lemma diagonalGaussian_shell_lower (v : Fin (n+2) → ℝ≥0) {m s d δ : ℝ} + (hm : 0 < m) (hm0 : m ≤ v 0) (hm1 : m ≤ v 1) (hδ : 0 ≤ δ) (hd : 0 < d) + (hmean : (∑ i : Fin n, (v i.succ.succ : ℝ)) = s-d) + (hvar : 128 * (∑ i : Fin n, (v i.succ.succ : ℝ)^2) ≤ d^2) : + ENNReal.ofReal (Real.pi * δ * gaussianPairPrefactor (v 0) (v 1) * + Real.exp (-(2*d+δ)/(2*m)) / 2) ≤ diagonalGaussian v (squareNormShell s δ) := by + rw [diagonalGaussian_shell_split] + have hl := gaussianPair_bulk_lower + (ν := Measure.pi fun i : Fin n => gaussianReal 0 (v i.succ.succ)) + (Z := piSquareSum) (by unfold piSquareSum; fun_prop) (s := s) (R := 2*d) + hm hm0 hm1 hδ + have hp := piSquareSum_bulk_mass (fun i : Fin n => v i.succ.succ) hd hmean hvar + apply le_trans _ hl + calc + _ = ENNReal.ofReal (Real.pi * δ * gaussianPairPrefactor (v 0) (v 1) * + Real.exp (-(2*d+δ)/(2*m))) * (1/2 : ℝ≥0∞) := by + rw [ENNReal.ofReal_div_of_pos (by norm_num), ENNReal.ofReal_ofNat, div_eq_mul_inv] + congr 1 + norm_num + _ ≤ _ := mul_le_mul_of_nonneg_left hp bot_le + +def diagonalSquareDensity {ι : Type*} [Fintype ι] (v : ι → ℝ≥0) (s : ℝ) : ℝ := + radialDensity volume (fun x : EuclideanSpace ℝ ι => gaussianPiPDF v x) (Real.sqrt s) / + (2 * Real.sqrt s) + +lemma diagonalSquareDensity_limit {ι : Type*} [Fintype ι] [Nonempty ι] + (v : ι → ℝ≥0) (hv : ∀ i, v i ≠ 0) {s : ℝ} (hs : 0 < s) : + Tendsto (fun δ : ℝ => (diagonalGaussian v (squareNormShell s δ)).toReal / δ) + (nhdsWithin 0 (Ioi 0)) (𝓝 (diagonalSquareDensity v s)) := by + rw [diagonalGaussian_density v hv] + exact squareNormShell_density_limit volume (euclideanGaussianPDF_integrable v) + (euclideanGaussianPDF_continuous v) (fun x => gaussianPiPDF_nonneg v x) hs + +lemma diagonalSquareDensity_upper (v : Fin (n+2) → ℝ≥0) (hv : ∀ i, v i ≠ 0) + {s : ℝ} (hs : 0 < s) : + diagonalSquareDensity v s ≤ Real.pi * gaussianPairPrefactor (v 0) (v 1) := by + apply le_of_tendsto (diagonalSquareDensity_limit v hv hs) + filter_upwards [self_mem_nhdsWithin] with δ hδ + have hδ0 : 0 < δ := hδ.out + have h := ENNReal.toReal_mono (ENNReal.ofReal_ne_top) + (diagonalGaussian_shell_upper v (hv 0) (hv 1) s hδ0.le) + have hp := gaussianPairPrefactor_nonneg (v 0) (v 1) + rw [ENNReal.toReal_ofReal (by positivity)] at h + apply (div_le_iff₀ hδ0).mpr + nlinarith + +lemma diagonalSquareDensity_lower (v : Fin (n+2) → ℝ≥0) (hv : ∀ i, v i ≠ 0) + {m s d : ℝ} (hs : 0 < s) (hm : 0 < m) (hm0 : m ≤ v 0) (hm1 : m ≤ v 1) + (hd : 0 < d) (hmean : (∑ i : Fin n, (v i.succ.succ : ℝ)) = s-d) + (hvar : 128 * (∑ i : Fin n, (v i.succ.succ : ℝ)^2) ≤ d^2) : + Real.pi * gaussianPairPrefactor (v 0) (v 1) * Real.exp (-d/m) / 2 ≤ + diagonalSquareDensity v s := by + have hc : Continuous (fun δ : ℝ => Real.pi * gaussianPairPrefactor (v 0) (v 1) * + Real.exp (-(2*d+δ)/(2*m)) / 2) := by fun_prop + have ht := (hc.continuousAt (x := 0)).tendsto.mono_left + (nhdsWithin_le_nhds (s := Ioi (0 : ℝ))) + have ht' : Tendsto (fun δ : ℝ => Real.pi * gaussianPairPrefactor (v 0) (v 1) * + Real.exp (-(2*d+δ)/(2*m)) / 2) (nhdsWithin 0 (Ioi 0)) + (𝓝 (Real.pi * gaussianPairPrefactor (v 0) (v 1) * Real.exp (-d/m) / 2)) := by + have he : -(2*d+(0:ℝ))/(2*m) = -d/m := by ring + simpa only [he] using ht + apply le_of_tendsto_of_tendsto ht' (diagonalSquareDensity_limit v hv hs) + filter_upwards [self_mem_nhdsWithin] with δ hδ + have hδ0 : 0 < δ := hδ.out + have h := ENNReal.toReal_mono (measure_ne_top _ _) + (diagonalGaussian_shell_lower v hm hm0 hm1 hδ0.le hd hmean hvar) + have hp := gaussianPairPrefactor_nonneg (v 0) (v 1) + rw [ENNReal.toReal_ofReal (by positivity)] at h + apply (le_div_iff₀ hδ0).mpr + nlinarith + +end + +section + +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [FiniteDimensional ℝ E] + [MeasurableSpace E] [BorelSpace E] + +def radialEval (p : sphere (0 : E) 1 × Ioi (0 : ℝ)) : E := p.2.val • p.1.val + +lemma radialEval_embedding : MeasurableEmbedding (radialEval (E := E)) := by + exact (MeasurableEmbedding.subtype_coe (measurableSet_singleton (0 : E)).compl).comp + (Homeomorph.measurableEmbedding (homeomorphUnitSphereProd E).symm) + +def radialCone (A : Set (sphere (0 : E) 1)) : Set E := radialEval '' (A ×ˢ Set.univ) + +lemma radialCone_measurable {A : Set (sphere (0 : E) 1)} (hA : MeasurableSet A) : + MeasurableSet (radialCone A) := radialEval_embedding.measurableSet_image' (hA.prod .univ) + +lemma radialCone_mem (A : Set (sphere (0 : E) 1)) (r : Ioi (0 : ℝ)) (u : sphere (0 : E) 1) : + r.val • u.val ∈ radialCone A ↔ u ∈ A := by + have h := radialEval_embedding.injective.mem_set_image (s := A ×ˢ Set.univ) (a := (u,r)) + simpa only [radialCone, radialEval, Set.mem_prod, Set.mem_univ, and_true] using h + +lemma angular_indicator_integral (μ : Measure E) [μ.IsAddHaarMeasure] (f : E → ℝ) + {A : Set (sphere (0 : E) 1)} (hA : MeasurableSet A) {r : ℝ} (hr : 0 < r) : + (∫ u : sphere (0 : E) 1, (radialCone A).indicator f (r • u.val) ∂μ.toSphere) = + ∫ u in A, f (r • u.val) ∂μ.toSphere := by + rw [← integral_indicator hA] + apply integral_congr_ae + filter_upwards with u + have hh := radialCone_mem A ⟨r, hr⟩ u + by_cases hu : u ∈ A + · simp only [Set.indicator_of_mem hu, Set.indicator_of_mem (hh.mpr hu)] + · simp only [Set.indicator_of_notMem hu, Set.indicator_of_notMem (fun h => hu (hh.mp h))] + +def radialDensityOn (μ : Measure E) (f : E → ℝ) (A : Set (sphere (0 : E) 1)) (r : ℝ) : ℝ := + r ^ (Module.finrank ℝ E - 1) * ∫ u in A, f (r • u.val) ∂μ.toSphere + +lemma radialDensityOn_continuous (μ : Measure E) [μ.IsAddHaarMeasure] [ProperSpace E] + {f : E → ℝ} (hf : Continuous f) (A : Set (sphere (0 : E) 1)) : + Continuous (radialDensityOn μ f A) := + (continuous_id.pow _).mul (angular_integral_continuous μ hf A) + +variable [Nontrivial E] + +lemma normShell_cone_density_real (μ : Measure E) [μ.IsAddHaarMeasure] {f : E → ℝ} + (hf : Integrable f μ) (hfn : ∀ x, 0 ≤ f x) {A : Set (sphere (0 : E) 1)} + (hA : MeasurableSet A) {a b : ℝ} (ha : 0 ≤ a) : + (μ.withDensity (fun x => ENNReal.ofReal (f x)) (normShell a b ∩ radialCone A)).toReal = + ∫ r in Ioc a b, radialDensityOn μ f A r := by + have hind : (fun x => ENNReal.ofReal ((radialCone A).indicator f x)) = + (radialCone A).indicator (fun x => ENNReal.ofReal (f x)) := by + funext x + by_cases h : x ∈ radialCone A <;> simp [h] + have hw := normShell_density_real μ (hf.indicator (radialCone_measurable hA)) + (fun x => Set.indicator_nonneg (fun x _ => hfn x) x) (b := b) ha + rw [hind, withDensity_indicator (radialCone_measurable hA), + ← restrict_withDensity (radialCone_measurable hA), + Measure.restrict_apply (normShell_measurable a b)] at hw + rw [hw] + apply setIntegral_congr_fun measurableSet_Ioc + intro r hr + simp only [radialDensity, radialDensityOn, + angular_indicator_integral μ f hA (lt_of_le_of_lt ha hr.1)] + +lemma squareNormShell_cone_density_limit (μ : Measure E) [μ.IsAddHaarMeasure] [ProperSpace E] + {f : E → ℝ} (hf : Integrable f μ) (hfc : Continuous f) (hfn : ∀ x, 0 ≤ f x) + {A : Set (sphere (0 : E) 1)} (hA : MeasurableSet A) {s : ℝ} (hs : 0 < s) : + Filter.Tendsto (fun δ : ℝ => + (μ.withDensity (fun x => ENNReal.ofReal (f x)) (squareNormShell s δ ∩ radialCone A)).toReal / δ) + (nhdsWithin 0 (Ioi 0)) (𝓝 (radialDensityOn μ f A (Real.sqrt s) / (2 * Real.sqrt s))) := by + have hq := radialDensityOn_continuous μ hfc A + have hd : HasDerivAt (fun t : ℝ => ∫ r in Real.sqrt s..t, radialDensityOn μ f A r) + (radialDensityOn μ f A (Real.sqrt s)) (Real.sqrt s) := + intervalIntegral.integral_hasDerivAt_right IntervalIntegrable.refl + hq.stronglyMeasurable.stronglyMeasurableAtFilter hq.continuousAt + have hd' := hd.comp s (Real.hasDerivAt_sqrt hs.ne') + have hh := hd'.tendsto_slope_zero_right + simp only [Function.comp_def, mul_one_div] at hh + apply hh.congr' + filter_upwards [self_mem_nhdsWithin] with δ hδ + have hδ0 : 0 < δ := hδ.out + rw [squareNormShell_eq hs.le hδ0.le, + normShell_cone_density_real μ hf hfn hA (Real.sqrt_nonneg _), intervalIntegral.integral_same, + sub_zero, smul_eq_mul, intervalIntegral.integral_of_le (Real.sqrt_le_sqrt (by linarith))] + exact mul_comm _ _ + +end + +section + +variable {Ω : Type*} [MeasurableSpace Ω] + +lemma gaussianPair_bulk_restricted_upper {ν : Measure Ω} [SFinite ν] + {Z : Ω → ℝ} (hZ : Measurable Z) {a b : ℝ≥0} (ha : a ≠ 0) (hb : b ≠ 0) + {B : Set Ω} (hB : MeasurableSet B) (s : ℝ) {δ : ℝ} (hδ : 0 ≤ δ) : + (((gaussianReal 0 a).prod (gaussianReal 0 b)).prod ν) + (sumSquareShell Z s δ ∩ Prod.snd ⁻¹' B) ≤ + ENNReal.ofReal (Real.pi * δ * gaussianPairPrefactor a b) * ν B := by + rw [Measure.prod_apply_symm ((sumSquareShell_measurable hZ s δ).inter + (hB.preimage measurable_snd)), ← Measure.restrict_apply_univ (μ := ν) (s := B), + ← lintegral_const, ← lintegral_indicator hB] + apply lintegral_mono + intro ω + by_cases hω : ω ∈ B + · rw [Set.indicator_of_mem hω] + convert gaussianPair_annulus_upper_all ha hb (s-Z ω) hδ using 2 + ext p + simp only [Set.mem_preimage, Set.mem_inter_iff, sumSquareShell, squareAnnulus, + Set.mem_ofPred_eq, hω, and_true] + constructor <;> intro h <;> constructor <;> linarith [h.1, h.2] + · rw [Set.indicator_of_notMem hω] + suffices he : (fun p : ℝ × ℝ => (p, ω)) ⁻¹' (sumSquareShell Z s δ ∩ Prod.snd ⁻¹' B) = ∅ by + dsimp only + rw [he, measure_empty] + apply Set.eq_empty_iff_forall_notMem.mpr + intro p hp + exact hω hp.2 + +lemma gaussian_density_upper (v : ℝ≥0) (x : ℝ) : + gaussianPDFReal 0 v x ≤ (Real.sqrt (2 * Real.pi * v))⁻¹ := by + unfold gaussianPDFReal + rw [sub_zero] + have h : Real.exp (-(x^2/(2*v))) ≤ 1 := + Real.exp_le_one_iff.mpr (neg_nonpos.mpr (by positivity)) + simpa only [neg_div, mul_one] using mul_le_mul_of_nonneg_left h (by positivity : + 0 ≤ (Real.sqrt (2*Real.pi*v))⁻¹) + +lemma gaussian_smallBall_upper {v : ℝ≥0} (hv : v ≠ 0) (T : ℝ) : + gaussianReal 0 v {x : ℝ | |x| ≤ T} ≤ + ENNReal.ofReal (2*T*(Real.sqrt (2*Real.pi*v))⁻¹) := by + have he : {x : ℝ | |x| ≤ T} = Set.Icc (-T) T := by + ext x + simp only [Set.mem_ofPred_eq, Set.mem_Icc, abs_le] + rw [he, gaussianReal_of_var_ne_zero _ hv, withDensity_apply _ measurableSet_Icc] + calc + _ ≤ ∫⁻ _x in Set.Icc (-T) T, ENNReal.ofReal ((Real.sqrt (2*Real.pi*v))⁻¹) := by + exact lintegral_mono (fun x => ENNReal.ofReal_le_ofReal (gaussian_density_upper v x)) + _ = _ := by + rw [lintegral_const, Measure.restrict_apply_univ, Real.volume_Icc, + ← ENNReal.ofReal_mul (by positivity)] + congr 1 + ring + +end + +open Set Filter + +variable {n : ℕ} + +lemma diagonalGaussian_shell_restricted_upper (v : Fin (n+2) → ℝ≥0) + (h0 : v 0 ≠ 0) (h1 : v 1 ≠ 0) {B : Set (Fin n → ℝ)} (hB : MeasurableSet B) + (s : ℝ) {δ : ℝ} (hδ : 0 ≤ δ) : + diagonalGaussian v (squareNormShell s δ ∩ + {x : EuclideanSpace ℝ (Fin (n+2)) | (fun i : Fin n => x i.succ.succ) ∈ B}) ≤ + ENNReal.ofReal (Real.pi * δ * gaussianPairPrefactor (v 0) (v 1)) * + (Measure.pi fun i : Fin n => gaussianReal 0 (v i.succ.succ)) B := by + have hB' : MeasurableSet {x : EuclideanSpace ℝ (Fin (n+2)) | + (fun i : Fin n => x i.succ.succ) ∈ B} := hB.preimage (by fun_prop) + rw [diagonalGaussian, Measure.map_apply (WithLp.measurable_toLp 2 _) + ((squareNormShell_measurable s δ).inter hB')] + have he : (WithLp.toLp 2 : (Fin (n+2) → ℝ) → EuclideanSpace ℝ (Fin (n+2))) ⁻¹' + (squareNormShell s δ ∩ {x | (fun i : Fin n => x i.succ.succ) ∈ B}) = + splitPair n ⁻¹' (sumSquareShell piSquareSum s δ ∩ Prod.snd ⁻¹' B) := by + ext x + simp only [Set.mem_preimage, Set.mem_inter_iff, squareNormShell, sumSquareShell, + Set.mem_ofPred_eq, EuclideanSpace.real_norm_sq_eq, splitPair, piSquareSum] + rw [splitPair_square_sum] + rw [he, (splitPair_preserving n (fun i => gaussianReal 0 (v i))).measure_preimage + ((sumSquareShell_measurable (by unfold piSquareSum; fun_prop) s δ).inter + (hB.preimage measurable_snd)).nullMeasurableSet] + exact gaussianPair_bulk_restricted_upper (by unfold piSquareSum; fun_prop) h0 h1 hB s hδ + +lemma radialCone_coordinate_bound {ι : Type*} [Fintype ι] {i : ι} {b K : ℝ} + (hb : 0 ≤ b) {x : EuclideanSpace ℝ ι} + (hx : x ∈ radialCone {u : sphere (0 : EuclideanSpace ℝ ι) 1 | |u.val i| ≤ b}) + (hn : ‖x‖^2 ≤ K) : |x i| ≤ b * Real.sqrt K := by + rcases hx with ⟨⟨u,r⟩, ⟨hu,_⟩, rfl⟩ + have hr0 : 0 < r.val := r.property + have hu' : |u.val i| ≤ b := hu + have huN : ‖u.val‖ = 1 := mem_sphere_zero_iff_norm.mp u.property + have hn' : r.val^2 ≤ K := by + simpa only [radialEval, norm_smul, Real.norm_eq_abs, abs_of_pos hr0, huN, mul_one] using hn + have hK : 0 ≤ K := (sq_nonneg r.val).trans hn' + have hr : r.val ≤ Real.sqrt K := (Real.le_sqrt hr0.le hK).mpr hn' + change |(r.val • u.val) i| ≤ _ + simp only [PiLp.smul_apply, smul_eq_mul, abs_mul, abs_of_pos hr0] + exact (mul_le_mul_of_nonneg_left hu' hr0.le).trans (by nlinarith) + +lemma diagonalGaussian_shell_cone_upper (v : Fin (n+3) → ℝ≥0) + (hv : ∀ i, v i ≠ 0) {s δ b : ℝ} (hδ : 0 ≤ δ) (hb : 0 ≤ b) : + diagonalGaussian v (squareNormShell s δ ∩ + radialCone {u : sphere (0 : EuclideanSpace ℝ (Fin (n+3))) 1 | + |u.val (0 : Fin (n+1)).succ.succ| ≤ b}) ≤ + ENNReal.ofReal (Real.pi * δ * gaussianPairPrefactor (v 0) (v 1) * + (2*(b*Real.sqrt (s+δ))*(Real.sqrt (2*Real.pi*v (0 : Fin (n+1)).succ.succ))⁻¹)) := by + let B := {x : Fin (n+1) → ℝ | |x 0| ≤ b * Real.sqrt (s+δ)} + have hB : MeasurableSet B := by + exact measurableSet_le (by fun_prop) measurable_const + have hsub : squareNormShell s δ ∩ + radialCone {u : sphere (0 : EuclideanSpace ℝ (Fin (n+3))) 1 | + |u.val (0 : Fin (n+1)).succ.succ| ≤ b} ⊆ + squareNormShell s δ ∩ + {x : EuclideanSpace ℝ (Fin (n+3)) | (fun i : Fin (n+1) => x i.succ.succ) ∈ B} := by + intro x hx + exact ⟨hx.1, radialCone_coordinate_bound hb hx.2 hx.1.2⟩ + apply (measure_mono hsub).trans + apply (diagonalGaussian_shell_restricted_upper v (hv 0) (hv 1) hB s hδ).trans + have he : (Measure.pi fun i : Fin (n+1) => gaussianReal 0 (v i.succ.succ)) B = + gaussianReal 0 (v (0 : Fin (n+1)).succ.succ) {y : ℝ | |y| ≤ b*Real.sqrt (s+δ)} := by + exact (measurePreserving_eval (fun i : Fin (n+1) => gaussianReal 0 (v i.succ.succ)) 0).measure_preimage + (measurableSet_le (measurable_id.abs) measurable_const).nullMeasurableSet + rw [he] + calc + _ ≤ ENNReal.ofReal (Real.pi * δ * gaussianPairPrefactor (v 0) (v 1)) * + ENNReal.ofReal (2*(b*Real.sqrt (s+δ))*(Real.sqrt (2*Real.pi*v (0 : Fin (n+1)).succ.succ))⁻¹) := + mul_le_mul_of_nonneg_left (gaussian_smallBall_upper (hv _) _) bot_le + _ = _ := (ENNReal.ofReal_mul (by + exact mul_nonneg (mul_nonneg Real.pi_pos.le hδ) (gaussianPairPrefactor_nonneg _ _))).symm + +def diagonalSquareDensityOn {ι : Type*} [Fintype ι] (v : ι → ℝ≥0) + (A : Set (sphere (0 : EuclideanSpace ℝ ι) 1)) (s : ℝ) : ℝ := + radialDensityOn volume (fun x : EuclideanSpace ℝ ι => gaussianPiPDF v x) A (Real.sqrt s) / + (2*Real.sqrt s) + +lemma diagonalSquareDensityOn_limit {ι : Type*} [Fintype ι] [Nonempty ι] + (v : ι → ℝ≥0) (hv : ∀ i, v i ≠ 0) + {A : Set (sphere (0 : EuclideanSpace ℝ ι) 1)} (hA : MeasurableSet A) + {s : ℝ} (hs : 0 < s) : + Tendsto (fun δ : ℝ => (diagonalGaussian v (squareNormShell s δ ∩ radialCone A)).toReal / δ) + (nhdsWithin 0 (Ioi 0)) (𝓝 (diagonalSquareDensityOn v A s)) := by + rw [diagonalGaussian_density v hv] + exact squareNormShell_cone_density_limit volume (euclideanGaussianPDF_integrable v) + (euclideanGaussianPDF_continuous v) (fun x => gaussianPiPDF_nonneg v x) hA hs + +lemma diagonalSquareDensityOn_smallBall (v : Fin (n+3) → ℝ≥0) (hv : ∀ i, v i ≠ 0) + {s b : ℝ} (hs : 0 < s) (hb : 0 ≤ b) : + diagonalSquareDensityOn v + {u : sphere (0 : EuclideanSpace ℝ (Fin (n+3))) 1 | + |u.val (0 : Fin (n+1)).succ.succ| ≤ b} s ≤ + Real.pi * gaussianPairPrefactor (v 0) (v 1) * + (2*(b*Real.sqrt s)*(Real.sqrt (2*Real.pi*v (0 : Fin (n+1)).succ.succ))⁻¹) := by + have hc : Continuous (fun δ : ℝ => Real.pi * gaussianPairPrefactor (v 0) (v 1) * + (2*(b*Real.sqrt (s+δ))*(Real.sqrt (2*Real.pi*v (0 : Fin (n+1)).succ.succ))⁻¹)) := by fun_prop + have ht := (hc.continuousAt (x := 0)).tendsto.mono_left + (nhdsWithin_le_nhds (s := Ioi (0 : ℝ))) + simp only [add_zero] at ht + apply le_of_tendsto_of_tendsto + (diagonalSquareDensityOn_limit v hv (measurableSet_le (by fun_prop) measurable_const) hs) ht + filter_upwards [self_mem_nhdsWithin] with δ hδ + have hδ0 : 0 < δ := hδ.out + have h := ENNReal.toReal_mono ENNReal.ofReal_ne_top + (diagonalGaussian_shell_cone_upper v hv (s := s) hδ0.le hb) + have hp := gaussianPairPrefactor_nonneg (v 0) (v 1) + rw [ENNReal.toReal_ofReal (by positivity)] at h + apply (div_le_iff₀ hδ0).mpr + nlinarith + +end + +section + +variable {ι : Type*} [Fintype ι] [Nonempty ι] + +lemma sphereAverage_one : sphereAverage (fun _ : unitSphere ι => (1:ℝ)) = 1 := by + unfold sphereAverage sphereArea + simp only [integral_const, smul_eq_mul, mul_one] + exact div_self (ne_of_gt (sphereArea_pos (ι := ι))) + +def gaussianPiPrefactor (v : ι → ℝ≥0) : ℝ := ∏ i, (Real.sqrt (2 * Real.pi * v i))⁻¹ + +omit [Nonempty ι] in +lemma gaussianPiPDF_exp (v : ι → ℝ≥0) (x : ι → ℝ) : + gaussianPiPDF v x = gaussianPiPrefactor v * Real.exp (-∑ i, x i ^ 2 / (2*v i)) := by + simp only [gaussianPiPDF, gaussianPDFReal, sub_zero, Finset.prod_mul_distrib, + gaussianPiPrefactor, ← Real.exp_sum, ← Finset.sum_neg_distrib, neg_div] + +omit [Nonempty ι] in +lemma gaussianPiPrefactor_pos {v : ι → ℝ≥0} (hv : ∀ i, v i ≠ 0) : + 0 < gaussianPiPrefactor v := by + apply Finset.prod_pos + intro i _ + have hvi : 0 < (v i : ℝ) := NNReal.coe_pos.mpr (pos_iff_ne_zero.mpr (hv i)) + positivity + +omit [Nonempty ι] in +lemma unitSphere_sum_sq (u : unitSphere ι) : ∑ i, u.val i ^ 2 = 1 := by + have hn : ‖u.val‖ = 1 := mem_sphere_zero_iff_norm.mp u.property + simpa only [hn, one_pow] using (EuclideanSpace.real_norm_sq_eq u.val).symm + +omit [Nonempty ι] in +lemma sphereGaussianPDF {lam : ι → ℝ} {v : ι → ℝ≥0} {z a : ℝ} + (hq : ∀ i, (v i : ℝ)⁻¹ = z - a * lam i) (r : ℝ) (u : unitSphere ι) : + gaussianPiPDF v (WithLp.ofLp (r • u.val)) = gaussianPiPrefactor v * Real.exp (-z*r^2/2) * + Real.exp (a/2 * diagonalEnergy lam (r • u.val)) := by + rw [gaussianPiPDF_exp, mul_assoc, ← Real.exp_add] + congr 2 + have hsum : ∑ i, (r • u.val) i ^ 2 / (2 * v i) = + z*r^2/2 - a/2 * diagonalEnergy lam (r • u.val) := by + simp only [diagonalEnergy, PiLp.smul_apply, smul_eq_mul] + calc + _ = ∑ i, (z*r^2/2 * u.val i^2 - a/2 * (lam i*(r*u.val i)^2)) := by + apply Finset.sum_congr rfl + intro i _ + rw [div_eq_mul_inv, mul_inv, hq i] + ring + _ = _ := by + rw [Finset.sum_sub_distrib, ← Finset.mul_sum, unitSphere_sum_sq, mul_one, + ← Finset.mul_sum] + rw [hsum] + ring + +lemma radialDensity_spherePartition {lam : ι → ℝ} {v : ι → ℝ≥0} {z a : ℝ} + (hq : ∀ i, (v i : ℝ)⁻¹ = z - a * lam i) (r : ℝ) : + radialDensity volume (fun x : EuclideanSpace ℝ ι => gaussianPiPDF v x) r = + r ^ (Fintype.card ι - 1) * gaussianPiPrefactor v * Real.exp (-z*r^2/2) * + sphereArea (ι := ι) * spherePartition lam a r := by + unfold radialDensity spherePartition sphereAverage + simp only [finrank_euclideanSpace] + simp_rw [sphereGaussianPDF hq] + rw [integral_const_mul] + have ha := ne_of_gt (sphereArea_pos (ι := ι)) + field_simp + +lemma spherePartition_zero (lam : ι → ℝ) (r : ℝ) : spherePartition lam 0 r = 1 := by + simpa only [spherePartition, zero_div, zero_mul, Real.exp_zero] using sphereAverage_one (ι := ι) + +lemma spherePartition_pos (lam : ι → ℝ) (a r : ℝ) : 0 < spherePartition lam a r := by + apply div_pos _ sphereArea_pos + have hc : Continuous (fun u : unitSphere ι => Real.exp (a/2*diagonalEnergy lam (r • u.val))) := by + unfold diagonalEnergy + fun_prop + have hi : Integrable (fun u : unitSphere ι => Real.exp (a/2*diagonalEnergy lam (r • u.val))) + (volume : Measure (EuclideanSpace ℝ ι)).toSphere := by + simpa only [integrableOn_univ] using hc.continuousOn.integrableOn_compact isCompact_univ + let _ : NeZero (volume : Measure (EuclideanSpace ℝ ι)).toSphere := ⟨Measure.toSphere_ne_zero _⟩ + exact integral_exp_pos hi + +lemma radialDensity_standard (r : ℝ) : + radialDensity volume (fun x : EuclideanSpace ℝ ι => gaussianPiPDF (fun _ => 1) x) r = + r ^ (Fintype.card ι - 1) * gaussianPiPrefactor (fun _ : ι => 1) * Real.exp (-r^2/2) * + sphereArea (ι := ι) := by + have h := radialDensity_spherePartition (lam := fun _ : ι => (0:ℝ)) + (v := fun _ => 1) (z := 1) (a := 0) (by norm_num) r + simpa only [spherePartition_zero, mul_one, neg_mul, one_mul] using h + +lemma radialDensity_standard_pos {r : ℝ} (hr : 0 < r) : + 0 < radialDensity volume (fun x : EuclideanSpace ℝ ι => gaussianPiPDF (fun _ => 1) x) r := by + rw [radialDensity_standard] + exact mul_pos (mul_pos (mul_pos (pow_pos hr _) (gaussianPiPrefactor_pos (by simp))) + (Real.exp_pos _)) sphereArea_pos + +lemma spherical_radial_ratio {lam : ι → ℝ} {v : ι → ℝ≥0} {z a r : ℝ} + (hq : ∀ i, (v i : ℝ)⁻¹ = z - a * lam i) (hr : 0 < r) : + radialDensity volume (fun x : EuclideanSpace ℝ ι => gaussianPiPDF v x) r / + radialDensity volume (fun x : EuclideanSpace ℝ ι => gaussianPiPDF (fun _ => 1) x) r = + gaussianPiPrefactor v / gaussianPiPrefactor (fun _ : ι => 1) * + Real.exp (-(z-1)*r^2/2) * spherePartition lam a r := by + rw [radialDensity_spherePartition hq, radialDensity_standard] + have hE : Real.exp (-(z-1)*r^2/2) = Real.exp (-z*r^2/2) / Real.exp (-r^2/2) := by + rw [← Real.exp_sub] + congr 1 + ring + rw [hE] + have h1 := ne_of_gt (gaussianPiPrefactor_pos (v := fun _ : ι => 1) (by simp)) + have h2 := ne_of_gt (sphereArea_pos (ι := ι)) + have h3 := ne_of_gt (pow_pos hr (Fintype.card ι - 1)) + have h4 := ne_of_gt (Real.exp_pos (-r^2/2)) + field_simp + +end + +section + +variable {ι : Type*} [Fintype ι] [Nonempty ι] + +def sphereTilted (lam : ι → ℝ) (a r : ℝ) : Measure (unitSphere ι) := + (ENNReal.ofReal (∫ u : unitSphere ι, Real.exp (a / 2 * diagonalEnergy lam (r • u.val)) + ∂(volume : Measure (EuclideanSpace ℝ ι)).toSphere))⁻¹ • + (volume : Measure (EuclideanSpace ℝ ι)).toSphere.withDensity + (fun u => ENNReal.ofReal (Real.exp (a / 2 * diagonalEnergy lam (r • u.val)))) + +omit [Nonempty ι] in +lemma sphereWeight_integrable (lam : ι → ℝ) (a r : ℝ) : + Integrable (fun u : unitSphere ι => Real.exp (a / 2 * diagonalEnergy lam (r • u.val))) + (volume : Measure (EuclideanSpace ℝ ι)).toSphere := by + have hc : Continuous (fun u : unitSphere ι => Real.exp (a / 2 * diagonalEnergy lam (r • u.val))) := by + unfold diagonalEnergy; fun_prop + simpa only [integrableOn_univ] using hc.continuousOn.integrableOn_compact isCompact_univ + +lemma sphereWeight_integral_pos (lam : ι → ℝ) (a r : ℝ) : + 0 < ∫ u : unitSphere ι, Real.exp (a/2 * diagonalEnergy lam (r • u.val)) + ∂(volume : Measure (EuclideanSpace ℝ ι)).toSphere := by + have h := spherePartition_pos lam a r + exact (div_pos_iff.mp h).elim (fun h => h.1) + (fun h => False.elim (not_lt_of_ge (sphereArea_pos (ι := ι)).le h.2)) + +instance sphereTilted_probability (lam : ι → ℝ) (a r : ℝ) : + IsProbabilityMeasure (sphereTilted lam a r) := by + constructor + rw [sphereTilted, Measure.smul_apply, smul_eq_mul, withDensity_apply _ MeasurableSet.univ, + setLIntegral_univ, ← ofReal_integral_eq_lintegral_ofReal (sphereWeight_integrable lam a r) + (Filter.Eventually.of_forall (fun u => (Real.exp_pos _).le))] + exact ENNReal.inv_mul_cancel (ne_of_gt (ENNReal.ofReal_pos.mpr (sphereWeight_integral_pos lam a r))) + ENNReal.ofReal_ne_top + +lemma sphereTilted_apply_real (lam : ι → ℝ) (a r : ℝ) {A : Set (unitSphere ι)} (hA : MeasurableSet A) : + (sphereTilted lam a r A).toReal = + (∫ u in A, Real.exp (a/2 * diagonalEnergy lam (r • u.val)) + ∂(volume : Measure (EuclideanSpace ℝ ι)).toSphere) / + (∫ u : unitSphere ι, Real.exp (a/2 * diagonalEnergy lam (r • u.val)) + ∂(volume : Measure (EuclideanSpace ℝ ι)).toSphere) := by + rw [sphereTilted, Measure.smul_apply, smul_eq_mul, withDensity_apply _ hA, + ← ofReal_integral_eq_lintegral_ofReal (sphereWeight_integrable lam a r).integrableOn + (Filter.Eventually.of_forall (fun u => (Real.exp_pos _).le)), + ENNReal.toReal_mul, ENNReal.toReal_inv, + ENNReal.toReal_ofReal (sphereWeight_integral_pos lam a r).le, + ENNReal.toReal_ofReal (integral_nonneg (fun u => (Real.exp_pos _).le))] + ring + +lemma sphereTilted_density_ratio {lam : ι → ℝ} {v : ι → ℝ≥0} {z a s : ℝ} + (hv : ∀ i, v i ≠ 0) (hq : ∀ i, (v i : ℝ)⁻¹ = z - a * lam i) (hs : 0 < s) + {A : Set (unitSphere ι)} (hA : MeasurableSet A) : + (sphereTilted lam a (Real.sqrt s) A).toReal = + diagonalSquareDensityOn v A s / diagonalSquareDensity v s := by + rw [sphereTilted_apply_real lam a _ hA] + unfold diagonalSquareDensityOn diagonalSquareDensity radialDensityOn radialDensity + simp_rw [sphereGaussianPDF hq] + rw [integral_const_mul, integral_const_mul] + have h1 := ne_of_gt (gaussianPiPrefactor_pos hv) + have h2 := ne_of_gt (Real.exp_pos (-z*(Real.sqrt s)^2/2)) + have h3 := ne_of_gt (pow_pos (Real.sqrt_pos.mpr hs) (Module.finrank ℝ (EuclideanSpace ℝ ι) - 1)) + have h4 := ne_of_gt (sphereWeight_integral_pos lam a (Real.sqrt s)) + have h5 := ne_of_gt (Real.sqrt_pos.mpr hs) + field_simp + +end + +section + +variable {n : ℕ} + +lemma gaussianPairPrefactor_pos {a b : ℝ≥0} (ha : a ≠ 0) (hb : b ≠ 0) : + 0 < gaussianPairPrefactor a b := by + have ha' : 0 < (a:ℝ) := NNReal.coe_pos.mpr (pos_iff_ne_zero.mpr ha) + have hb' : 0 < (b:ℝ) := NNReal.coe_pos.mpr (pos_iff_ne_zero.mpr hb) + unfold gaussianPairPrefactor + positivity + +lemma sphereTilted_smallBall (lam : Fin (n+3) → ℝ) (a z : ℝ) + (v : Fin (n+3) → ℝ≥0) (hv : ∀ i, v i ≠ 0) + (hq : ∀ i, (v i : ℝ)⁻¹ = z-a*lam i) + {s m d b : ℝ} (hs : 0 < s) (hm : 0 < m) (hm0 : m ≤ v 0) (hm1 : m ≤ v 1) + (hd : 0 < d) (hb : 0 ≤ b) + (hmean : (∑ i : Fin (n+1), (v i.succ.succ : ℝ)) = s-d) + (hvar : 128 * (∑ i : Fin (n+1), (v i.succ.succ : ℝ)^2) ≤ d^2) : + (sphereTilted lam a (Real.sqrt s) + {u : unitSphere (Fin (n+3)) | |u.val (0 : Fin (n+1)).succ.succ| ≤ b}).toReal ≤ + 4 * (b * Real.sqrt s) * (Real.sqrt (2*Real.pi*v (0 : Fin (n+1)).succ.succ))⁻¹ * + Real.exp (d/m) := by + rw [sphereTilted_density_ratio hv hq hs (measurableSet_le (by fun_prop) measurable_const)] + have hl := diagonalSquareDensity_lower v hv hs hm hm0 hm1 hd hmean hvar + have hu := diagonalSquareDensityOn_smallBall v hv hs hb + have hP := mul_pos Real.pi_pos (gaussianPairPrefactor_pos (hv 0) (hv 1)) + have hp : 0 < diagonalSquareDensity v s := + (div_pos (mul_pos hP (Real.exp_pos _)) (by norm_num)).trans_le hl + apply (div_le_iff₀ hp).mpr + have hC : 0 ≤ 4 * (b*Real.sqrt s) * + (Real.sqrt (2*Real.pi*v (0 : Fin (n+1)).succ.succ))⁻¹ * Real.exp (d/m) := by positivity + apply hu.trans + apply le_trans _ (mul_le_mul_of_nonneg_left hl hC) + have he : Real.exp (d/m) * Real.exp (-d/m) = 1 := by + rw [← Real.exp_add, show d/m + -d/m = 0 by ring, Real.exp_zero] + apply le_of_eq + symm + calc + _ = (Real.pi * gaussianPairPrefactor (v 0) (v 1) * + (2*(b*Real.sqrt s)*(Real.sqrt (2*Real.pi*v (0 : Fin (n+1)).succ.succ))⁻¹)) * + (Real.exp (d/m) * Real.exp (-d/m)) := by ring + _ = _ := by rw [he, mul_one] + +end + +section + +lemma gaussian_square_pdf_le_double {v : ℝ≥0} (hv : v ≠ 0) (x : ℝ) : + x^2 * gaussianPDFReal 0 v x ≤ 8 * (v:ℝ) * gaussianPDFReal 0 (2*v) x := by + have hvp : 0 < (v:ℝ) := NNReal.coe_pos.mpr (pos_iff_ne_zero.mpr hv) + have hs : 0 < Real.sqrt (2*Real.pi*v) := by positivity + have hs2 : 0 < Real.sqrt (2*Real.pi*(2*v:ℝ≥0)) := by positivity + have hsle : Real.sqrt (2*Real.pi*(2*v:ℝ≥0)) ≤ 2 * Real.sqrt (2*Real.pi*v) := by + rw [Real.sqrt_le_iff] + constructor + · positivity + · push_cast + nlinarith [Real.sq_sqrt (by positivity : 0 ≤ 2*Real.pi*(v:ℝ))] + have hpre : (Real.sqrt (2*Real.pi*v))⁻¹ ≤ + 2 * (Real.sqrt (2*Real.pi*(2*v:ℝ≥0)))⁻¹ := by + have hd : 1 / Real.sqrt (2*Real.pi*v) ≤ 2 / Real.sqrt (2*Real.pi*(2*v:ℝ≥0)) := + (div_le_div_iff₀ hs hs2).mpr (by simpa only [one_mul] using hsle) + simpa only [one_div, div_eq_mul_inv, one_mul] using hd + let t : ℝ := x^2/(4*v) + have ht : t ≤ Real.exp t := (le_add_of_nonneg_right (by norm_num : (0:ℝ) ≤ 1)).trans + (Real.add_one_le_exp t) + have ht' := mul_le_mul_of_nonneg_right ht (le_of_lt (Real.exp_pos (-2*t))) + have hmul : Real.exp t * Real.exp (-2*t) = Real.exp (-t) := by + rw [← Real.exp_add]; congr 1; ring + rw [hmul] at ht' + have he : x^2 * Real.exp (-(x^2/(2*v))) ≤ 4*v * Real.exp (-(x^2/(4*v))) := by + have hh := mul_le_mul_of_nonneg_left ht' (show 0 ≤ 4*(v:ℝ) by positivity) + have ha : -2*t = -(x^2/(2*v)) := by dsimp [t]; field_simp; ring + have hb : 4*(v:ℝ)*t = x^2 := by dsimp [t]; field_simp + rw [ha, ← mul_assoc, hb] at hh + exact hh + unfold gaussianPDFReal + simp only [sub_zero, NNReal.coe_mul, NNReal.coe_ofNat] + have he' : x^2 * Real.exp (-(x^2/(2*v))) ≤ + 4*v * Real.exp (-(x^2/(2*(2*v)))) := by convert he using 2; congr 2; ring + calc + _ = (Real.sqrt (2*Real.pi*v))⁻¹ * (x^2 * Real.exp (-(x^2/(2*v)))) := by ring_nf + _ ≤ (Real.sqrt (2*Real.pi*v))⁻¹ * (4*v * Real.exp (-(x^2/(2*(2*v))))) := + mul_le_mul_of_nonneg_left he' (by positivity) + _ ≤ (2*(Real.sqrt (2*Real.pi*(2*v)))⁻¹) * + (4*v * Real.exp (-(x^2/(2*(2*v))))) := + mul_le_mul_of_nonneg_right hpre (by positivity) + _ = _ := by ring_nf + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +lemma gaussianPiPDF_square_le_double (v : ι → ℝ≥0) (i : ι) (hv : v i ≠ 0) (x : ι → ℝ) : + x i ^ 2 * gaussianPiPDF v x ≤ + 8*(v i:ℝ) * gaussianPiPDF (Function.update v i (2*v i)) x := by + unfold gaussianPiPDF + rw [← Finset.mul_prod_erase Finset.univ _ (Finset.mem_univ i)] + rw [← Finset.mul_prod_erase Finset.univ + (fun j => gaussianPDFReal 0 (Function.update v i (2*v i) j) (x j)) (Finset.mem_univ i)] + rw [Function.update_self] + have he : (∏ j ∈ Finset.univ.erase i, + gaussianPDFReal 0 (Function.update v i (2*v i) j) (x j)) = + ∏ j ∈ Finset.univ.erase i, gaussianPDFReal 0 (v j) (x j) := by + apply Finset.prod_congr rfl + intro j hj + rw [Function.update_of_ne (Finset.ne_of_mem_erase hj)] + rw [he, ← mul_assoc, ← mul_assoc] + exact mul_le_mul_of_nonneg_right (gaussian_square_pdf_le_double hv (x i)) + (Finset.prod_nonneg (fun j _ => gaussianPDFReal_nonneg 0 (v j) (x j))) + +end + +section + +variable {ι : Type*} [Fintype ι] [Nonempty ι] + +lemma sphereTilted_integral (lam : ι → ℝ) (a r : ℝ) (F : unitSphere ι → ℝ) : + (∫ u, F u ∂sphereTilted lam a r) = + (∫ u : unitSphere ι, Real.exp (a/2*diagonalEnergy lam (r • u.val)) * F u + ∂(volume : Measure (EuclideanSpace ℝ ι)).toSphere) / + (∫ u : unitSphere ι, Real.exp (a/2*diagonalEnergy lam (r • u.val)) + ∂(volume : Measure (EuclideanSpace ℝ ι)).toSphere) := by + rw [sphereTilted, integral_smul_measure, + integral_withDensity_eq_integral_toReal_smul (by unfold diagonalEnergy; fun_prop) + (Filter.Eventually.of_forall (fun _ => ENNReal.ofReal_lt_top))] + simp only [ENNReal.toReal_inv, ENNReal.toReal_ofReal (sphereWeight_integral_pos lam a r).le, + ENNReal.toReal_ofReal (Real.exp_pos _).le, smul_eq_mul] + ring + +lemma sphereTilted_gaussian_integral {lam : ι → ℝ} {v : ι → ℝ≥0} {z a : ℝ} + (hv : ∀ i, v i ≠ 0) (hq : ∀ i, (v i : ℝ)⁻¹ = z-a*lam i) + (r : ℝ) (F : unitSphere ι → ℝ) : + (∫ u, F u ∂sphereTilted lam a r) = + (∫ u : unitSphere ι, gaussianPiPDF v (r • u.val) * F u + ∂(volume : Measure (EuclideanSpace ℝ ι)).toSphere) / + (∫ u : unitSphere ι, gaussianPiPDF v (r • u.val) + ∂(volume : Measure (EuclideanSpace ℝ ι)).toSphere) := by + rw [sphereTilted_integral] + simp_rw [← WithLp.ofLp_smul, sphereGaussianPDF hq, mul_assoc (gaussianPiPrefactor v * Real.exp (-z*r^2/2)), + integral_const_mul] + have h1 := ne_of_gt (gaussianPiPrefactor_pos hv) + have h2 := ne_of_gt (Real.exp_pos (-z*r^2/2)) + field_simp + +omit [Nonempty ι] in +lemma angular_continuous_integrable {f : EuclideanSpace ℝ ι → ℝ} (hf : Continuous f) (r : ℝ) : + Integrable (fun u : unitSphere ι => f (r • u.val)) + (volume : Measure (EuclideanSpace ℝ ι)).toSphere := by + have hc : Continuous (fun u : unitSphere ι => f (r • u.val)) := hf.comp (by fun_prop) + simpa only [integrableOn_univ] using hc.continuousOn.integrableOn_compact isCompact_univ + +omit [Nonempty ι] in +def gaussianSquareCoordinateDensity (v : ι → ℝ≥0) (i : ι) (s : ℝ) : ℝ := + radialDensity volume (fun x : EuclideanSpace ℝ ι => x i^2 * gaussianPiPDF v x) (Real.sqrt s) / + (2*Real.sqrt s) + +lemma sphereTilted_coordinate_sq {lam : ι → ℝ} {v : ι → ℝ≥0} {z a s : ℝ} + (hv : ∀ i, v i ≠ 0) (hq : ∀ i, (v i:ℝ)⁻¹ = z-a*lam i) (hs : 0 < s) (i : ι) : + (∫ u : unitSphere ι, ((Real.sqrt s • u.val) i)^2 ∂sphereTilted lam a (Real.sqrt s)) = + gaussianSquareCoordinateDensity v i s / diagonalSquareDensity v s := by + rw [sphereTilted_gaussian_integral hv hq] + unfold gaussianSquareCoordinateDensity diagonalSquareDensity radialDensity + simp_rw [mul_comm (gaussianPiPDF v _)] + have h1 := ne_of_gt (pow_pos (Real.sqrt_pos.mpr hs) (Module.finrank ℝ (EuclideanSpace ℝ ι) - 1)) + have h2 := ne_of_gt (Real.sqrt_pos.mpr hs) + field_simp + rfl + +omit [Nonempty ι] in +lemma gaussianSquareCoordinateDensity_le_double [DecidableEq ι] (v : ι → ℝ≥0) (i : ι) + (hv : v i ≠ 0) {s : ℝ} (hs : 0 < s) : + gaussianSquareCoordinateDensity v i s ≤ + 8*(v i:ℝ)*diagonalSquareDensity (Function.update v i (2*v i)) s := by + have hi : (∫ u : unitSphere ι, + ((Real.sqrt s • u.val) i)^2 * gaussianPiPDF v (WithLp.ofLp (Real.sqrt s • u.val)) + ∂(volume : Measure (EuclideanSpace ℝ ι)).toSphere) ≤ + 8*(v i:ℝ) * (∫ u : unitSphere ι, + gaussianPiPDF (Function.update v i (2*v i)) (WithLp.ofLp (Real.sqrt s • u.val)) + ∂(volume : Measure (EuclideanSpace ℝ ι)).toSphere) := by + rw [← integral_const_mul] + apply integral_mono + (angular_continuous_integrable ((by fun_prop : Continuous (fun x : EuclideanSpace ℝ ι => x i^2)).mul + (euclideanGaussianPDF_continuous v)) _) + ((angular_continuous_integrable (euclideanGaussianPDF_continuous _) _).const_mul _) + intro u + exact gaussianPiPDF_square_le_double v i hv _ + have hh := div_le_div_of_nonneg_right + (mul_le_mul_of_nonneg_left hi (show 0 ≤ (Real.sqrt s)^(Module.finrank ℝ (EuclideanSpace ℝ ι)-1) by positivity)) + (show 0 ≤ 2*Real.sqrt s by positivity) + unfold gaussianSquareCoordinateDensity diagonalSquareDensity radialDensity + convert hh using 1 + ring + +end + +variable {n : ℕ} + +lemma gaussianSquareCoordinateDensity_upper (v : Fin (n+2) → ℝ≥0) (hv : ∀ i, v i ≠ 0) + (i : Fin (n+2)) (h0 : i ≠ 0) (h1 : i ≠ 1) {s : ℝ} (hs : 0 < s) : + gaussianSquareCoordinateDensity v i s ≤ + 8*(v i:ℝ)*Real.pi*gaussianPairPrefactor (v 0) (v 1) := by + let v' := Function.update v i (2*v i) + have hv' : ∀ j, v' j ≠ 0 := by + intro j + by_cases hj : j=i + · subst j + simpa only [v', Function.update_self] using mul_ne_zero (by norm_num : (2:ℝ≥0) ≠ 0) (hv i) + · simpa only [v', Function.update_of_ne hj] using hv j + have hh := mul_le_mul_of_nonneg_left (diagonalSquareDensity_upper v' hv' hs) + (show 0 ≤ 8*(v i:ℝ) by positivity) + have he0 : v' 0 = v 0 := Function.update_of_ne h0.symm _ _ + have he1 : v' 1 = v 1 := Function.update_of_ne h1.symm _ _ + rw [he0, he1] at hh + exact (gaussianSquareCoordinateDensity_le_double v i (hv i) hs).trans + (hh.trans_eq (by ring)) + +lemma sphereTilted_coordinate_sq_upper (lam : Fin (n+2) → ℝ) (a z : ℝ) + (v : Fin (n+2) → ℝ≥0) (hv : ∀ i, v i ≠ 0) + (hq : ∀ i, (v i:ℝ)⁻¹ = z-a*lam i) + {s m d : ℝ} (hs : 0 < s) (hm : 0 < m) (hm0 : m ≤ v 0) (hm1 : m ≤ v 1) + (hd : 0 < d) (hmean : (∑ j : Fin n, (v j.succ.succ : ℝ)) = s-d) + (hvar : 128*(∑ j : Fin n, (v j.succ.succ : ℝ)^2) ≤ d^2) + (i : Fin (n+2)) (h0 : i ≠ 0) (h1 : i ≠ 1) : + (∫ u : unitSphere (Fin (n+2)), ((Real.sqrt s • u.val) i)^2 + ∂sphereTilted lam a (Real.sqrt s)) ≤ 16*(v i:ℝ)*Real.exp (d/m) := by + rw [sphereTilted_coordinate_sq hv hq hs] + have hl := diagonalSquareDensity_lower v hv hs hm hm0 hm1 hd hmean hvar + have hp : 0 < diagonalSquareDensity v s := + (div_pos (mul_pos (mul_pos Real.pi_pos (gaussianPairPrefactor_pos (hv 0) (hv 1))) + (Real.exp_pos _)) (by norm_num)).trans_le hl + apply (div_le_iff₀ hp).mpr + apply (gaussianSquareCoordinateDensity_upper v hv i h0 h1 hs).trans + apply le_trans _ (mul_le_mul_of_nonneg_left hl (show 0 ≤ 16*(v i:ℝ)*Real.exp (d/m) by positivity)) + have he : Real.exp (d/m) * Real.exp (-d/m) = 1 := by + rw [← Real.exp_add, show d/m + -d/m = 0 by ring, Real.exp_zero] + apply le_of_eq + symm + calc + _ = (8*(v i:ℝ)*Real.pi*gaussianPairPrefactor (v 0) (v 1)) * + (Real.exp (d/m) * Real.exp (-d/m)) := by ring + _ = _ := by rw [he, mul_one] + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/SpinModel.lean b/lean/OAI/MathematicalPhysics/CriticalSK/SpinModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..0ac78b56cac3f583f6a7dfca16ad99e49f575027 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/SpinModel.lean @@ -0,0 +1,146 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open scoped BigOperators NNReal ENNReal Topology Pointwise Matrix.Norms.Elementwise +open Set Metric MeasureTheory MeasureTheory.Measure +open MeasureTheory ProbabilityTheory +open scoped ENNReal NNReal +open scoped BigOperators InnerProductSpace +open Module +open scoped BigOperators ENNReal NNReal Real Topology +open MeasureTheory ProbabilityTheory Filter +open scoped BigOperators NNReal +open scoped BigOperators +open Matrix Polynomial +open scoped BigOperators Topology +open Filter +namespace CriticalSK + +section + +abbrev Spin (n : ℕ) := Fin n → Bool + +abbrev Edge (n : ℕ) := {p : Fin n × Fin n // p.1 < p.2} + +abbrev Disorder (n : ℕ) := Edge n → ℝ + +def spinValue (b : Bool) : ℝ := if b then 1 else -1 + +def hamiltonian {n : ℕ} (W : Disorder n) (x : Spin n) : ℝ := + ∑ e : Edge n, W e * spinValue (x e.val.1) * spinValue (x e.val.2) + +def partition {n : ℕ} (W : Disorder n) : ℝ := + ∑ x : Spin n, Real.exp (hamiltonian W x) + +def gibbs {n : ℕ} (W : Disorder n) (x : Spin n) : ℝ := + Real.exp (hamiltonian W x) / partition W + +def disorderLaw (n : ℕ) : Measure (Disorder n) := + Measure.pi fun _ : Edge n => gaussianReal 0 (n : ℝ≥0)⁻¹ + +def sameExcept {n : ℕ} (i : Fin n) (x y : Spin n) : Prop := + ∀ j, j ≠ i → y j = x j + +instance {n : ℕ} (i : Fin n) (x y : Spin n) : Decidable (sameExcept i x y) := + Classical.propDecidable _ + +def siteKernel {n : ℕ} (W : Disorder n) (i : Fin n) : Matrix (Spin n) (Spin n) ℝ := + fun x y => if sameExcept i x y then + gibbs W y / (∑ z : Spin n, if sameExcept i x z then gibbs W z else 0) + else 0 + +def discreteKernel {n : ℕ} (W : Disorder n) : Matrix (Spin n) (Spin n) ℝ := + (n : ℝ)⁻¹ • ∑ i : Fin n, siteKernel W i + +def generator {n : ℕ} (W : Disorder n) : Matrix (Spin n) (Spin n) ℝ := + ∑ i : Fin n, (siteKernel W i - 1) + +def continuousKernel {n : ℕ} (W : Disorder n) (t : ℝ) : + Matrix (Spin n) (Spin n) ℝ := + NormedSpace.exp (t • generator W) + +def totalVariation {n : ℕ} (W : Disorder n) (p : Spin n → ℝ) : ℝ := + (1 / 2 : ℝ) * ∑ y : Spin n, |p y - gibbs W y| + +def continuousDistance {n : ℕ} (W : Disorder n) (t : ℝ) (x : Spin n) : ℝ := + totalVariation W (continuousKernel W t x) + +def discreteDistance {n : ℕ} (W : Disorder n) (k : ℕ) (x : Spin n) : ℝ := + totalVariation W ((discreteKernel W ^ k) x) + +def continuousMixingTime {n : ℕ} (W : Disorder n) : ℝ := + sInf {t : ℝ | 0 ≤ t ∧ ∀ x, continuousDistance W t x ≤ 1 / 4} + +def discreteMixingTime {n : ℕ} (W : Disorder n) : ℕ := + sInf {k : ℕ | ∀ x, discreteDistance W k x ≤ 1 / 4} + +def mean {n : ℕ} (W : Disorder n) (f : Spin n → ℝ) : ℝ := + ∑ x : Spin n, gibbs W x * f x + +def variance {n : ℕ} (W : Disorder n) (f : Spin n → ℝ) : ℝ := + mean W (fun x => (f x - mean W f) ^ 2) + +def dirichlet {n : ℕ} (W : Disorder n) (f : Spin n → ℝ) : ℝ := + ∑ i : Fin n, mean W (fun x => (f x - ∑ y : Spin n, siteKernel W i x y * f y) ^ 2) + +def linearObservable {n : ℕ} (a : Fin n → ℝ) (x : Spin n) : ℝ := + ∑ i : Fin n, a i * spinValue (x i) + +def covariance {n : ℕ} (W : Disorder n) : Matrix (Fin n) (Fin n) ℝ := + fun i j => mean W (fun x => + (spinValue (x i) - mean W (fun y => spinValue (y i))) * + (spinValue (x j) - mean W (fun y => spinValue (y j)))) + +def covarianceNorm {n : ℕ} (W : Disorder n) : ℝ := + ‖(covariance W).toEuclideanLin.toContinuousLinearMap‖ + +def linearRayleigh {n : ℕ} (W : Disorder n) : ℝ := + sSup {r : ℝ | ∃ a : Fin n → ℝ, a ≠ 0 ∧ + r = variance W (linearObservable a) / dirichlet W (linearObservable a)} + +def continuousGoodMass {n : ℕ} (W : Disorder n) (t : ℝ) : ℝ := + ∑ x : Spin n, if 1 / 4 < continuousDistance W t x then gibbs W x else 0 + +def discreteGoodMass {n : ℕ} (W : Disorder n) (k : ℕ) : ℝ := + ∑ x : Spin n, if 1 / 4 < discreteDistance W k x then gibbs W x else 0 + +variable {n : ℕ} (W : Disorder n) + +@[simp] lemma spinValue_sq (b : Bool) : spinValue b ^ 2 = 1 := by + cases b <;> norm_num [spinValue] + +end + +section + +def cubeVector {n : ℕ} (x : Spin n) : EuclideanSpace ℝ (Fin n) := + WithLp.toLp 2 (fun i => spinValue (x i)) + +def cubeOverlap {n : ℕ} (x y : Spin n) : ℝ := inner ℝ (cubeVector x) (cubeVector y) / n + +instance {n : ℕ} (i : Fin n) (x y : Spin n) : Decidable (sameExcept i x y) := + Classical.propDecidable _ + +instance {n : ℕ} (i : Fin n) (x y : Spin n) : Decidable (sameExcept i x y) := + Classical.propDecidable _ + +open Set MeasureTheory + +def gibbsOverlap {n : ℕ} (W : Disorder n) : ℝ := + ∑ x : Spin n, ∑ y : Spin n, gibbs W x*gibbs W y*(cubeOverlap x y)^2 + +end + +instance {n : ℕ} (i : Fin n) (x y : Spin n) : Decidable (sameExcept i x y) := + Classical.propDecidable _ + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/ThresholdContraction.lean b/lean/OAI/MathematicalPhysics/CriticalSK/ThresholdContraction.lean new file mode 100644 index 0000000000000000000000000000000000000000..1381fb9ef91be58412b1d20440a77d251f575165 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/ThresholdContraction.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.CriticalSK.Main + +namespace OAI + +noncomputable section +open scoped BigOperators Topology NNReal ENNReal +open MeasureTheory ProbabilityTheory Filter +namespace CriticalSK + +section ThresholdComparison +variable {ι : Type*} [Fintype ι] + +lemma kernel_centered_l1_bound {K : Matrix ι ι ℝ} {μ p : ι → ℝ} {c : ℝ} + (hmass : ∑ x, p x = ∑ x, μ x) + (hstat : ∀ y, ∑ x, μ x * K x y = μ y) + (hbound : ∀ x, ∑ y, |K x y - μ y| ≤ c) : + (∑ y, |(∑ x, p x * K x y) - μ y|) ≤ c * ∑ x, |p x - μ x| := by + have hid (y : ι) : (∑ x, p x * K x y) - μ y = + ∑ x, (p x - μ x) * (K x y - μ y) := by + simp only [sub_mul, mul_sub, Finset.sum_sub_distrib, ← Finset.sum_mul, + hstat, hmass] + ring + simp_rw [hid] + calc + _ ≤ ∑ y, ∑ x, |(p x - μ x) * (K x y - μ y)| := + Finset.sum_le_sum (fun _ _ => Finset.abs_sum_le_sum_abs _ _) + _ = ∑ x, |p x - μ x| * ∑ y, |K x y - μ y| := by + simp_rw [abs_mul] + rw [Finset.sum_comm] + simp_rw [Finset.mul_sum] + _ ≤ ∑ x, |p x - μ x| * c := + Finset.sum_le_sum (fun x _ => mul_le_mul_of_nonneg_left (hbound x) (abs_nonneg _)) + _ = _ := by rw [← Finset.sum_mul, mul_comm] + +variable [DecidableEq ι] + +lemma kernel_power_tv_bound {K : Matrix ι ι ℝ} {μ : ι → ℝ} {c : ℝ} + (hK : ∀ x y, 0 ≤ K x y) (hμ : ∀ y, 0 ≤ μ y) + (hrow : ∀ x, ∑ y, K x y = 1) (hmass : ∑ y, μ y = 1) + (hstat : ∀ y, ∑ x, μ x * K x y = μ y) + (hc : 0 ≤ c) (hbound : ∀ x, (1 / 2 : ℝ) * ∑ y, |K x y - μ y| ≤ c / 2) + (k : ℕ) (x : ι) : + (1 / 2 : ℝ) * ∑ y, |(K ^ k) x y - μ y| ≤ c ^ k := by + have hb : ∀ z, ∑ y, |K z y - μ y| ≤ c := fun z => by linarith [hbound z] + have hpow : ∀ k : ℕ, ∀ z, ∑ y, |(K ^ k) z y - μ y| ≤ 2 * c ^ k := by + intro k + induction k with + | zero => + intro z + simpa using kernel_row_l1_le_two (K := K ^ 0) + (kernel_pow_nonneg hK 0) hμ (kernel_pow_sum hrow 0) hmass z + | succ k ih => + intro z + rw [pow_succ] + simp only [Matrix.mul_apply] + calc + _ ≤ c * ∑ y, |(K ^ k) z y - μ y| := + kernel_centered_l1_bound ((kernel_pow_sum hrow k z).trans hmass.symm) hstat hb + _ ≤ c * (2 * c ^ k) := mul_le_mul_of_nonneg_left (ih z) hc + _ = 2 * c ^ (k + 1) := by rw [pow_succ]; ring + linarith [hpow k x] + +end ThresholdComparison + +end CriticalSK +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/ThresholdMixing.lean b/lean/OAI/MathematicalPhysics/CriticalSK/ThresholdMixing.lean new file mode 100644 index 0000000000000000000000000000000000000000..2bb6e43616ef082a9c6250b45adc72db7e0c1ea3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/ThresholdMixing.lean @@ -0,0 +1,143 @@ +import OAI.MathematicalPhysics.CriticalSK.VariationalDefinitions +import OAI.MathematicalPhysics.CriticalSK.ThresholdContraction + +namespace OAI + +noncomputable section +open scoped BigOperators Topology NNReal ENNReal +open MeasureTheory ProbabilityTheory Filter +namespace CriticalSK + +section SKThresholdComparison +variable {n : ℕ} (W : Disorder n) + +lemma continuousKernel_nat_mul (t : ℝ) (k : ℕ) : + continuousKernel W ((k : ℝ) * t) = continuousKernel W t ^ k := by + induction k with + | zero => simp [continuousKernel] + | succ k ih => + rw [Nat.cast_add, Nat.cast_one, add_mul, one_mul, continuousKernel_add, ih, + pow_succ] + +lemma continuousDistance_iteration (hn : 0 < n) {t ε : ℝ} (ht : 0 ≤ t) + (hε : 0 ≤ ε) (hb : ∀ x, continuousDistance W t x ≤ ε) (k : ℕ) (x : Spin n) : + continuousDistance W ((k : ℝ) * t) x ≤ (2 * ε) ^ k := by + have hh := kernel_power_tv_bound (continuousKernel_nonneg W hn t ht) + (gibbs_nonneg W) (continuousKernel_sum W hn t) (gibbs_sum W) + (continuousKernel_stationary W hn t) (mul_nonneg (by norm_num) hε) + (show ∀ x, (1 / 2 : ℝ) * ∑ y, |continuousKernel W t x y - gibbs W y| ≤ + (2 * ε) / 2 by simpa only [continuousDistance, totalVariation, + mul_div_cancel_left₀ _ (by norm_num : (2 : ℝ) ≠ 0)] using hb) + k x + simpa only [continuousDistance, totalVariation, continuousKernel_nat_mul] using hh + +lemma discreteDistance_iteration (hn : 0 < n) {l : ℕ} {ε : ℝ} + (hε : 0 ≤ ε) (hb : ∀ x, discreteDistance W l x ≤ ε) (k : ℕ) (x : Spin n) : + discreteDistance W (l * k) x ≤ (2 * ε) ^ k := by + have hh := kernel_power_tv_bound (kernel_pow_nonneg (discreteKernel_nonneg W) l) + (gibbs_nonneg W) (kernel_pow_sum (discreteKernel_sum W hn) l) (gibbs_sum W) + (kernel_pow_stationary (discreteKernel_stationary W hn) l) + (mul_nonneg (by norm_num) hε) + (show ∀ x, (1 / 2 : ℝ) * ∑ y, |(discreteKernel W ^ l) x y - gibbs W y| ≤ + (2 * ε) / 2 by simpa only [discreteDistance, totalVariation, + mul_div_cancel_left₀ _ (by norm_num : (2 : ℝ) ≠ 0)] using hb) + k x + simpa only [discreteDistance, totalVariation, pow_mul] using hh + +lemma continuousMixingAt_set_nonempty (hn : 0 < n) {ε : ℝ} (hε : 0 < ε) : + {t : ℝ | 0 ≤ t ∧ ∀ x, continuousDistance W t x ≤ ε}.Nonempty := by + obtain ⟨t, ht, hb⟩ := continuous_mixing_set_nonempty W hn + obtain ⟨m, hm⟩ := exists_pow_lt_of_lt_one hε (by norm_num : (2 * (1 / 4) : ℝ) < 1) + refine ⟨(m : ℝ) * t, mul_nonneg (Nat.cast_nonneg _) ht, fun x => ?_⟩ + exact (continuousDistance_iteration W hn ht (by norm_num) hb m x).trans hm.le + +lemma discreteMixingAt_set_nonempty (hn : 0 < n) {ε : ℝ} (hε : 0 < ε) : + {k : ℕ | ∀ x, discreteDistance W k x ≤ ε}.Nonempty := by + obtain ⟨l, hb⟩ := discrete_mixing_set_nonempty W hn + obtain ⟨m, hm⟩ := exists_pow_lt_of_lt_one hε (by norm_num : (2 * (1 / 4) : ℝ) < 1) + exact ⟨l * m, fun x => (discreteDistance_iteration W hn (by norm_num) hb m x).trans hm.le⟩ + +lemma continuousMixingAt_quarter_comparison (hn : 0 < n) {ε : ℝ} (hε : 0 < ε) + {m : ℕ} (hm : 0 < m) (hpow : (2 * ε) ^ m ≤ 1 / 4) : + continuousMixingTime W ≤ (m : ℝ) * continuousMixingAt W ε := by + have hmR : (0 : ℝ) < m := Nat.cast_pos.mpr hm + suffices h : continuousMixingTime W / (m : ℝ) ≤ continuousMixingAt W ε by + simpa only [mul_comm] using (div_le_iff₀ hmR).mp h + apply le_csInf (continuousMixingAt_set_nonempty W hn hε) + intro t ht + apply (div_le_iff₀ hmR).mpr + have hb : ∀ x, continuousDistance W ((m : ℝ) * t) x ≤ 1 / 4 := fun x => + (continuousDistance_iteration W hn ht.1 hε.le ht.2 m x).trans hpow + simpa only [mul_comm] using continuousMixingTime_le_of_distance W + (mul_nonneg hmR.le ht.1) hb + +lemma discreteMixingAt_quarter_comparison (hn : 0 < n) {ε : ℝ} (hε : 0 < ε) + {m : ℕ} (hpow : (2 * ε) ^ m ≤ 1 / 4) : + discreteMixingTime W ≤ m * discreteMixingAt W ε := by + have hb : ∀ x, discreteDistance W (discreteMixingAt W ε) x ≤ ε := + Nat.sInf_mem (discreteMixingAt_set_nonempty W hn hε) + have hqm : ∀ x, discreteDistance W (discreteMixingAt W ε * m) x ≤ 1 / 4 := fun x => + (discreteDistance_iteration W hn hε.le hb m x).trans hpow + simpa only [mul_comm] using discreteMixingTime_le_of_distance W hqm + +end SKThresholdComparison + +lemma exists_threshold_amplification {ε : ℝ} (hεhalf : ε < 1 / 2) : + ∃ m : ℕ, 0 < m ∧ (2 * ε) ^ m ≤ 1 / 4 := by + obtain ⟨m, hm⟩ := exists_pow_lt_of_lt_one (by norm_num : (0 : ℝ) < 1 / 4) + (by linarith : 2 * ε < 1) + refine ⟨m, ?_, hm.le⟩ + by_contra h + have he : m = 0 := by omega + norm_num [he] at hm + +theorem critical_mixing_lower_bounds_at (ε : ℝ) (hε : 0 < ε) + (hεhalf : ε < 1 / 2) (δ : ℝ) (hδ : 0 < δ) : + Tendsto (fun n => (disorderLaw n).real + {W | (n : ℝ) ^ (2 / 3 - δ) ≤ continuousMixingAt W ε}) atTop (𝓝 1) ∧ + Tendsto (fun n => (disorderLaw n).real + {W | (n : ℝ) ^ (5 / 3 - δ) ≤ (discreteMixingAt W ε : ℝ)}) atTop (𝓝 1) := by + obtain ⟨m, hm, hpow⟩ := exists_threshold_amplification hεhalf + have hmR : (0 : ℝ) < m := Nat.cast_pos.mpr hm + constructor + · have hscale : Tendsto (fun n : ℕ => ((m : ℝ) * (n : ℝ) ^ (2 / 3 - δ)) / + (n : ℝ) ^ (2 / 3 : ℝ)) atTop (𝓝 0) := by + simpa only [mul_div_assoc, mul_zero] using + (rpow_ratio_tendsto_zero (a := 2 / 3) hδ).const_mul (m : ℝ) + have hp := continuousMixingTime_lower_limit + (fun n => (m : ℝ) * (n : ℝ) ^ (2 / 3 - δ)) (fun _ => by positivity) hscale + apply tendsto_order.mpr + constructor + · intro a ha + filter_upwards [(tendsto_order.mp hp).1 a ha, eventually_gt_atTop 0] with n hn hnpos + refine lt_of_lt_of_le hn (measureReal_mono ?_) + intro W hW + have hc := continuousMixingAt_quarter_comparison W hnpos hε hm hpow + exact (mul_le_mul_iff_right₀ hmR).mp (show (m : ℝ) * (n : ℝ) ^ (2 / 3 - δ) ≤ + (m : ℝ) * continuousMixingAt W ε from hW.trans hc) + · intro a ha + exact Filter.Eventually.of_forall (fun _ => lt_of_le_of_lt measureReal_le_one ha) + · have hscale : Tendsto (fun n : ℕ => + ((m * ⌈(n : ℝ) ^ (5 / 3 - δ)⌉₊ : ℕ) : ℝ) / (n : ℝ) ^ (5 / 3 : ℝ)) + atTop (𝓝 0) := by + simpa only [Nat.cast_mul, mul_div_assoc, mul_zero] using + (ceil_rpow_ratio_tendsto_zero (a := 5 / 3) (by norm_num) hδ).const_mul (m : ℝ) + have hp := discreteMixingTime_lower_limit (fun n => m * ⌈(n : ℝ) ^ (5 / 3 - δ)⌉₊) hscale + apply tendsto_order.mpr + constructor + · intro a ha + filter_upwards [(tendsto_order.mp hp).1 a ha, eventually_gt_atTop 0] with n hn hnpos + refine lt_of_lt_of_le hn (measureReal_mono ?_) + intro W hW + have hc := discreteMixingAt_quarter_comparison W hnpos hε hpow + have hh : m * ⌈(n : ℝ) ^ (5 / 3 - δ)⌉₊ ≤ m * discreteMixingAt W ε := hW.trans hc + have hcast : (m : ℝ) * (⌈(n : ℝ) ^ (5 / 3 - δ)⌉₊ : ℝ) ≤ + (m : ℝ) * (discreteMixingAt W ε : ℝ) := by exact_mod_cast hh + exact (Nat.le_ceil _).trans ((mul_le_mul_iff_right₀ hmR).mp hcast) + · intro a ha + exact Filter.Eventually.of_forall (fun _ => lt_of_le_of_lt measureReal_le_one ha) + +end CriticalSK +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/TriNoise.lean b/lean/OAI/MathematicalPhysics/CriticalSK/TriNoise.lean new file mode 100644 index 0000000000000000000000000000000000000000..4125fc6f1319a8b9262e667131d6f1e22ddafb29 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/TriNoise.lean @@ -0,0 +1,664 @@ +import OAI.MathematicalPhysics.CriticalSK.BlockEnergy + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology NNReal ENNReal + +open scoped BigOperators ENNReal NNReal Real Topology +open MeasureTheory ProbabilityTheory Filter +open scoped ENNReal NNReal +open scoped BigOperators NNReal +open scoped BigOperators +open scoped BigOperators InnerProductSpace +open Module +open Matrix Polynomial +open scoped BigOperators Topology +open Filter +open scoped BigOperators NNReal ENNReal Topology Pointwise Matrix.Norms.Elementwise +open Set Metric MeasureTheory MeasureTheory.Measure +open scoped ENNReal NNReal BigOperators +open MeasureTheory ProbabilityTheory +open scoped ENNReal NNReal Topology +open MeasureTheory MeasureTheory.Measure Set Metric +open scoped NNReal ENNReal BigOperators +open scoped NNReal ENNReal +open ProbabilityTheory +open Metric Set MeasureTheory +open scoped ENNReal Pointwise +open MeasureTheory Filter Set Real +open Finset Real +open scoped BigOperators ENNReal Topology +open Set MeasureTheory +open scoped BigOperators ENNReal +open MeasureTheory +open Finset Real Filter +open scoped Topology +namespace CriticalSK + +section + +def scaleLength (J j : ℕ) : ℕ := 2 ^ (J - j) + +def scaleRoot (J j : ℕ) : ℝ := (2 : ℝ)^j / (2 : ℝ)^J + +def scaleEnergy (J j : ℕ) : ℝ := scaleRoot J j ^ 2 + +lemma scaleLength_pos (J j : ℕ) : 0 < scaleLength J j := by + unfold scaleLength + positivity + +lemma scaleRoot_pos (J j : ℕ) : 0 < scaleRoot J j := by + unfold scaleRoot + positivity + +lemma scaleEnergy_pos (J j : ℕ) : 0 < scaleEnergy J j := sq_pos_of_pos (scaleRoot_pos J j) + +lemma scale_length_root_eq_one {J j : ℕ} (hj : j ≤ J) : + (scaleLength J j : ℝ) * scaleRoot J j = 1 := by + unfold scaleLength scaleRoot + push_cast + rw [← mul_div_assoc, ← pow_add, Nat.sub_add_cancel hj, div_self (by positivity)] + +lemma scale_last (J : ℕ) : scaleRoot J (J + 1) = 2 := by + unfold scaleRoot + rw [pow_succ] + field_simp + +lemma scale_length_root {J j : ℕ} (hj : j ≤ J + 1) : + 1 ≤ (scaleLength J j : ℝ) * scaleRoot J j ∧ + (scaleLength J j : ℝ) * scaleRoot J j ≤ 2 := by + by_cases h : j ≤ J + · rw [scale_length_root_eq_one h] + norm_num + · have : j = J + 1 := by omega + subst j + simp [scaleLength, scale_last] + +lemma scaleEnergy_step (J j : ℕ) : scaleEnergy J (j + 1) = 4 * scaleEnergy J j := by + unfold scaleEnergy scaleRoot + rw [pow_succ] + ring + +lemma energy_first_scale (J : ℕ) {e : ℝ} (hen : 0 ≤ e) (he : e ≤ 4) : + ∃ j ≤ J + 1, e ≤ scaleEnergy J j ∧ + scaleEnergy J j ≤ 4 * (e + scaleEnergy J 0) := by + by_cases he0 : e ≤ scaleEnergy J 0 + · exact ⟨0, by omega, he0, by nlinarith [scaleEnergy_pos J 0]⟩ + · have hex : ∃ j, e ≤ scaleEnergy J j := ⟨J + 1, by norm_num [scaleEnergy, scale_last]; exact he⟩ + let j := Nat.find hex + have hj : j ≤ J + 1 := Nat.find_min' hex (by norm_num [scaleEnergy, scale_last]; exact he) + have hj0 : 0 < j := by + by_contra! h + have : j = 0 := Nat.eq_zero_of_le_zero h + exact he0 (this ▸ Nat.find_spec hex) + have hprev : scaleEnergy J (j - 1) < e := lt_of_not_ge (Nat.find_min hex (by omega)) + refine ⟨j, hj, Nat.find_spec hex, ?_⟩ + have heq : j - 1 + 1 = j := by omega + rw [← heq, scaleEnergy_step] + nlinarith [scaleEnergy_pos J 0] + +lemma scale_shell_geometry {N J j : ℕ} (hN : (N : ℝ) ≤ ((2 : ℝ)^J) ^ 3) + (hj : j ≤ J + 1) : + (N : ℝ) * scaleEnergy J j ≤ (8 : ℝ)^j * scaleLength J j := by + have hscale := (scale_length_root hj).1 + have hp : (8 : ℝ)^j = ((2 : ℝ)^j)^3 := by + rw [← pow_mul, mul_comm j 3, pow_mul] + norm_num + have hm : 0 < (2 : ℝ)^J := by positivity + have ht : 0 < (2 : ℝ)^j := by positivity + unfold scaleRoot at hscale + rw [← mul_div_assoc, le_div_iff₀ hm] at hscale + unfold scaleEnergy scaleRoot + rw [div_pow, ← mul_div_assoc, div_le_iff₀ (sq_pos_of_pos hm), hp] + have hmul := mul_le_mul_of_nonneg_right hN (sq_nonneg ((2 : ℝ)^j)) + have hmul2 := mul_le_mul_of_nonneg_right hscale + (by positivity : 0 ≤ ((2 : ℝ)^j)^2 * ((2 : ℝ)^J)^2) + nlinarith + +lemma dyadic_cube_scale (N : ℕ) (hN : 0 < N) : + (N : ℝ) ≤ ((2 : ℝ)^(Nat.clog 8 N)) ^ 3 ∧ + ((2 : ℝ)^(Nat.clog 8 N)) ^ 3 ≤ 8 * N := by + have he : ((2 : ℝ)^Nat.clog 8 N) ^ 3 = (8 : ℝ)^Nat.clog 8 N := by + rw [← pow_mul, mul_comm (Nat.clog 8 N) 3, pow_mul] + norm_num + rw [he] + constructor + · exact_mod_cast Nat.le_pow_clog (by decide : 1 < 8) N + · by_cases hn : N = 1 + · subst N + norm_num [Nat.clog_one_right] + · have hn' : 1 < N := by omega + have hi := Nat.pow_pred_clog_lt_self (by decide : 1 < 8) hn' + have hj := Nat.clog_pos (by decide : 1 < 8) hn' + have hid : Nat.clog 8 N = (Nat.clog 8 N).pred + 1 := by + simpa only [Nat.succ_eq_add_one] using (Nat.succ_pred_eq_of_pos hj).symm + rw [hid, pow_succ] + have hi' : (8 : ℝ)^(Nat.clog 8 N).pred < N := by exact_mod_cast hi + linarith + +lemma natural_le_exponential_quarter (j : ℕ) : + (j + 1 : ℝ) ≤ 8 * ((2 : ℝ)^j) ^ (1 / 4 : ℝ) := by + have hl : (1 / 2 : ℝ) ≤ Real.log 2 := by + have := Real.one_sub_inv_le_log_of_pos (by norm_num : (0 : ℝ) < 2) + norm_num at this ⊢ + exact this + rw [Real.rpow_def_of_pos (by positivity), Real.log_pow] + have he := Real.add_one_le_exp ((j : ℝ) * Real.log 2 * (1 / 4 : ℝ)) + have hj : (0 : ℝ) ≤ j := by positivity + nlinarith + +lemma block_scale_factor {d t e : ℝ} (hd : 0 < d) (ht : 0 < t) + (hdt : 1 ≤ d * t) (hdt2 : d * t ≤ 2) (he : 0 ≤ e) (het : e ≤ t^2) : + Real.sqrt d * (1 / d + 13 * Real.sqrt e) ≤ 27 * Real.sqrt t := by + have hsd := Real.sq_sqrt hd.le + have hst := Real.sq_sqrt ht.le + have hse := Real.sq_sqrt he + have hsd0 := Real.sqrt_pos.mpr hd + have hst0 := Real.sqrt_pos.mpr ht + have hsmall : Real.sqrt d / d ≤ Real.sqrt t := by + apply (div_le_iff₀ hd).mpr + have hmul := mul_le_mul_of_nonneg_right hdt hd.le + apply (sq_le_sq₀ (Real.sqrt_nonneg _) (by positivity)).mp + rw [hsd, mul_pow, hst] + nlinarith + have hlarge : Real.sqrt d * Real.sqrt e ≤ 2 * Real.sqrt t := by + have hm := mul_le_mul_of_nonneg_left het hd.le + have hm2 := mul_le_mul_of_nonneg_right hdt2 ht.le + apply (sq_le_sq₀ (by positivity) (by positivity)).mp + rw [mul_pow, mul_pow, hsd, hse, hst] + nlinarith + calc + _ = Real.sqrt d / d + 13 * (Real.sqrt d * Real.sqrt e) := by ring + _ ≤ Real.sqrt t + 13 * (2 * Real.sqrt t) := by linarith + _ = _ := by ring + +lemma scale_block_factor {J j : ℕ} (hj : j ≤ J + 1) {e : ℝ} + (he : 0 ≤ e) (het : e ≤ scaleEnergy J j) : + Real.sqrt (scaleLength J j) * (1 / scaleLength J j + 13 * Real.sqrt e) ≤ + 27 * Real.sqrt (scaleRoot J j) := + block_scale_factor (by exact_mod_cast scaleLength_pos J j) (scaleRoot_pos J j) + (scale_length_root hj).1 (scale_length_root hj).2 he het + +lemma scale_weight_absorption (J j : ℕ) {e s h : ℝ} (hh : 0 ≤ h) (hes : 0 ≤ e + s) + (hscale : scaleEnergy J j ≤ 4 * (e + s)) : + (h + j + 1) * Real.sqrt (scaleRoot J j) ≤ + 16 * (h + 1) * ((2 : ℝ)^J) ^ (1 / 4 : ℝ) * (e + s) ^ (3 / 8 : ℝ) := by + have hj : (0 : ℝ) ≤ j := by positivity + have ht := scaleRoot_pos J j + have hm : (0 : ℝ) < (2 : ℝ)^J := by positivity + have hlin : h + j + 1 ≤ (h + 1) * (j + 1) := by nlinarith + have hcoef := natural_le_exponential_quarter j + have hfactor : ((2 : ℝ)^j) ^ (1 / 4 : ℝ) * Real.sqrt (scaleRoot J j) = + ((2 : ℝ)^J) ^ (1 / 4 : ℝ) * (scaleEnergy J j) ^ (3 / 8 : ℝ) := by + have htdef : (2 : ℝ)^j = (2 : ℝ)^J * scaleRoot J j := by + unfold scaleRoot + field_simp + rw [htdef, Real.mul_rpow hm.le ht.le, Real.sqrt_eq_rpow] + unfold scaleEnergy + rw [← Real.rpow_natCast (scaleRoot J j) 2, ← Real.rpow_mul ht.le, + mul_assoc, ← Real.rpow_add ht] + norm_num + have hfour : (4 : ℝ) ^ (3 / 8 : ℝ) ≤ 2 := by + have hp := Real.rpow_le_rpow_of_exponent_le (by norm_num : (1 : ℝ) ≤ 4) + (by norm_num : (3 / 8 : ℝ) ≤ 1 / 2) + simpa only [← Real.sqrt_eq_rpow, show Real.sqrt 4 = 2 by norm_num] using hp + have henergy : (scaleEnergy J j) ^ (3 / 8 : ℝ) ≤ 2 * (e + s) ^ (3 / 8 : ℝ) := by + calc + _ ≤ (4 * (e + s)) ^ (3 / 8 : ℝ) := Real.rpow_le_rpow (scaleEnergy_pos J j).le hscale (by norm_num) + _ = (4 : ℝ) ^ (3 / 8 : ℝ) * (e + s) ^ (3 / 8 : ℝ) := Real.mul_rpow (by norm_num) hes + _ ≤ _ := mul_le_mul_of_nonneg_right hfour (Real.rpow_nonneg hes _) + calc + _ ≤ ((h + 1) * (j + 1)) * Real.sqrt (scaleRoot J j) := + mul_le_mul_of_nonneg_right hlin (Real.sqrt_nonneg _) + _ ≤ ((h + 1) * (8 * ((2 : ℝ)^j) ^ (1 / 4 : ℝ))) * Real.sqrt (scaleRoot J j) := by + gcongr + _ = 8 * (h + 1) * (((2 : ℝ)^J) ^ (1 / 4 : ℝ) * (scaleEnergy J j) ^ (3 / 8 : ℝ)) := by + rw [← hfactor] + ring + _ ≤ 8 * (h + 1) * (((2 : ℝ)^J) ^ (1 / 4 : ℝ) * (2 * (e + s) ^ (3 / 8 : ℝ))) := by + gcongr + _ = _ := by ring + +variable {Ω : Type*} [MeasurableSpace Ω] + +omit [MeasurableSpace Ω] in +lemma good_scale_prefix {X : ℕ → Ω → ℝ} {c : ℝ≥0} {J N : ℕ} {h : ℝ} {ω : Ω} + (hh : 0 ≤ h) + (hω : ω ∉ multiscaleBad X c (fun j => scaleLength J j - 1) (J + 2) N h) + {j r b k : ℕ} (hj : j ≤ J + 1) (hr : r < N) (hb : b ∈ blockShell j r) + (hk : k < scaleLength J j) : + |∑ i ∈ Finset.range (k + 1), X (b * scaleLength J j + i) ω| ≤ + (Real.sqrt (32 * (c : ℝ)) * Real.sqrt (scaleLength J j)) * (h + j + r + 1) := by + have hd := scaleLength_pos J j + have he : scaleLength J j - 1 + 1 = scaleLength J j := by omega + have hp := good_multiscale_prefix_all hω (j := j) (r := r) (b := b) + (by omega) (by omega) hb (k := k) (by omega) + simpa only [he] using hp.trans (blockThreshold_length_bound c (scaleLength J j) j r hd hh) + +lemma selected_scale_form_bound {J j : ℕ} {e s h c a : ℝ} + (hj : j ≤ J + 1) (he : 0 ≤ e) (hs : 0 ≤ s) (hh : 0 ≤ h) (_hc : 0 ≤ c) + (heσ : e ≤ scaleEnergy J j) (hσ : scaleEnergy J j ≤ 4 * (e + s)) + (ha : a ≤ 32 * (Real.sqrt (32 * c) * Real.sqrt (scaleLength J j)) * + (h + j + 1) * (1 / scaleLength J j + 13 * Real.sqrt e)) : + a ≤ 13824 * Real.sqrt (32 * c) * (h + 1) * ((2 : ℝ)^J) ^ (1 / 4 : ℝ) * + (e + s) ^ (3 / 8 : ℝ) := by + calc + a ≤ 32 * Real.sqrt (32 * c) * (h + j + 1) * + (Real.sqrt (scaleLength J j) * (1 / scaleLength J j + 13 * Real.sqrt e)) := by + convert ha using 1 + ring + _ ≤ 32 * Real.sqrt (32 * c) * (h + j + 1) * (27 * Real.sqrt (scaleRoot J j)) := + mul_le_mul_of_nonneg_left (scale_block_factor hj he heσ) (by positivity) + _ = 864 * Real.sqrt (32 * c) * ((h + j + 1) * Real.sqrt (scaleRoot J j)) := by ring + _ ≤ 864 * Real.sqrt (32 * c) * + (16 * (h + 1) * ((2 : ℝ)^J) ^ (1 / 4 : ℝ) * (e + s) ^ (3 / 8 : ℝ)) := + mul_le_mul_of_nonneg_left (scale_weight_absorption J j hh (add_nonneg he hs) hσ) (by positivity) + _ = _ := by ring + +omit [MeasurableSpace Ω] in +lemma centered_square_form_good {X : ℕ → Ω → ℝ} {c : ℝ≥0} (n : ℕ) {h s : ℝ} {ω : Ω} + (hh : 0 ≤ h) (hs : scaleEnergy (Nat.clog 8 (n + 1)) 0 ≤ s) + (hω : ω ∉ multiscaleBad X c (fun j => scaleLength (Nat.clog 8 (n + 1)) j - 1) + (Nat.clog 8 (n + 1) + 2) (n + 1) h) + (u : ℕ → ℝ) (hu : ∀ i, n + 1 ≤ i → u i = 0) + (hnorm : (∑ i ∈ Finset.range (n + 1), u i^2) = 1) : + |∑ i ∈ Finset.range (n + 1), X i ω * u i^2| ≤ + 13824 * Real.sqrt (32 * (c : ℝ)) * (h + 1) * + ((2 : ℝ)^(Nat.clog 8 (n + 1))) ^ (1 / 4 : ℝ) * + (pathEnergy n u + s) ^ (3 / 8 : ℝ) := by + have he0 := pathEnergy_nonneg n u + have he4 : pathEnergy n u ≤ 4 := by simpa only [hnorm, mul_one] using pathEnergy_le_four_mass n u + obtain ⟨j, hj, heσ, hσ⟩ := energy_first_scale (Nat.clog 8 (n + 1)) he0 he4 + have hsize := scale_shell_geometry (dyadic_cube_scale (n + 1) (by omega)).1 hj + have hscale := square_multiscale_prefix (fun i => X i ω) n j + (scaleLength (Nat.clog 8 (n + 1)) j) (scaleLength_pos _ _) u hu hnorm + (scaleEnergy_pos _ _) hh (by positivity) heσ (by exact_mod_cast hsize) + (fun r hr b _ hb k hk => good_scale_prefix hh hω hj hr hb hk) + exact selected_scale_form_bound hj he0 ((scaleEnergy_pos _ _).le.trans hs) hh c.prop + heσ (hσ.trans (by linarith)) hscale + +omit [MeasurableSpace Ω] in +lemma centered_product_form_good {X : ℕ → Ω → ℝ} {c : ℝ≥0} (n : ℕ) {h s : ℝ} {ω : Ω} + (hh : 0 ≤ h) (hs : scaleEnergy (Nat.clog 8 (n + 1)) 0 ≤ s) + (hω : ω ∉ multiscaleBad X c (fun j => scaleLength (Nat.clog 8 (n + 1)) j - 1) + (Nat.clog 8 (n + 1) + 2) (n + 1) h) + (u : ℕ → ℝ) (hu : ∀ i, n + 1 ≤ i → u i = 0) + (hnorm : (∑ i ∈ Finset.range (n + 1), u i^2) = 1) : + |∑ i ∈ Finset.range (n + 1), X i ω * (u i * u (i + 1))| ≤ + 13824 * Real.sqrt (32 * (c : ℝ)) * (h + 1) * + ((2 : ℝ)^(Nat.clog 8 (n + 1))) ^ (1 / 4 : ℝ) * + (pathEnergy n u + s) ^ (3 / 8 : ℝ) := by + have he0 := pathEnergy_nonneg n u + have he4 : pathEnergy n u ≤ 4 := by simpa only [hnorm, mul_one] using pathEnergy_le_four_mass n u + obtain ⟨j, hj, heσ, hσ⟩ := energy_first_scale (Nat.clog 8 (n + 1)) he0 he4 + have hsize := scale_shell_geometry (dyadic_cube_scale (n + 1) (by omega)).1 hj + have hscale := product_multiscale_prefix (fun i => X i ω) n j + (scaleLength (Nat.clog 8 (n + 1)) j) (scaleLength_pos _ _) u hu hnorm + (scaleEnergy_pos _ _) hh (by positivity) heσ (by exact_mod_cast hsize) + (fun r hr b _ hb k hk => good_scale_prefix hh hω hj hr hb hk) + exact selected_scale_form_bound hj he0 ((scaleEnergy_pos _ _).le.trans hs) hh c.prop + heσ (hσ.trans (by linarith)) hscale + +end + +lemma edgeCoeff_sqrt_div (n i : ℕ) (hi : i ≤ n) : + edgeCoeff n i = Real.sqrt (n - i : ℕ) / Real.sqrt (n + 1 : ℝ) := by + rw [edgeCoeff, ← Real.sqrt_div (by positivity)] + congr 1 + rw [Nat.cast_sub hi] + field_simp + ring + +lemma chi_scaled_bias_bound (n i : ℕ) (hi : i < n) : + (Real.sqrt (n - i : ℕ) - ∫ x, chi (n - i) x ∂standardGaussianProduct (n - i)) / + Real.sqrt (n + 1 : ℝ) ≤ + 4 / (n + 1) + (4 / Real.sqrt (n + 1 : ℝ)) * ((i + 1 : ℝ) / (n + 1)) := by + have hN : (0 : ℝ) < n + 1 := by positivity + have hsN : 0 < Real.sqrt (n + 1 : ℝ) := Real.sqrt_pos.mpr hN + have hm : 0 < n - i := by omega + have hsm : 0 < Real.sqrt (n - i : ℕ) := Real.sqrt_pos.mpr (Nat.cast_pos.mpr hm) + have hb := (chi_mean_bias (n - i) hm).2 + have hb2 := chi_bias_le_two (n - i) hm + by_cases hearly : 2 * (i + 1 : ℝ) ≤ n + 1 + · have hdiff : (n + 1 : ℝ) / 2 ≤ (n - i : ℕ) := by + rw [Nat.cast_sub (by omega)] + linarith + have hroot : Real.sqrt (n + 1 : ℝ) ≤ 2 * Real.sqrt (n - i : ℕ) := by + have hsqN := Real.sq_sqrt hN.le + have hd0 : (0 : ℝ) ≤ (n - i : ℕ) := Nat.cast_nonneg _ + have hsqD := Real.sq_sqrt hd0 + nlinarith [Real.sqrt_nonneg (n + 1 : ℝ), Real.sqrt_nonneg (n - i : ℕ)] + have hbound : (Real.sqrt (n - i : ℕ) - ∫ x, chi (n - i) x ∂standardGaussianProduct (n - i)) / + Real.sqrt (n + 1 : ℝ) ≤ 4 / (n + 1) := by + apply (div_le_iff₀ hsN).mpr + have hprod : 2 / Real.sqrt (n - i : ℕ) ≤ 4 / Real.sqrt (n + 1 : ℝ) := by + apply (div_le_div_iff₀ hsm hsN).mpr + linarith + have hid : 4 / (n + 1 : ℝ) * Real.sqrt (n + 1 : ℝ) = 4 / Real.sqrt (n + 1 : ℝ) := by + have hsq := Real.sq_sqrt hN.le + field_simp + nlinarith + rw [hid] + exact hb.trans hprod + exact hbound.trans (le_add_of_nonneg_right (by positivity)) + · have hlate : (1 / 2 : ℝ) ≤ (i + 1 : ℝ) / (n + 1) := by + apply (le_div_iff₀ hN).mpr + push Not at hearly + linarith + calc + _ ≤ 2 / Real.sqrt (n + 1 : ℝ) := div_le_div_of_nonneg_right hb2 hsN.le + _ ≤ (4 / Real.sqrt (n + 1 : ℝ)) * ((i + 1 : ℝ) / (n + 1)) := by + have := mul_le_mul_of_nonneg_left hlate (show 0 ≤ 4 / Real.sqrt (n + 1 : ℝ) by positivity) + calc + 2 / Real.sqrt (n + 1 : ℝ) = (4 / Real.sqrt (n + 1 : ℝ)) * (1 / 2) := by ring + _ ≤ _ := this + _ ≤ _ := le_add_of_nonneg_left (by positivity) + +lemma weighted_neighbor_sum (n : ℕ) (u w : ℕ → ℝ) + (hw0 : ∀ i, 0 ≤ w i) (hw : ∀ i, w i ≤ w (i + 1)) : + (∑ i ∈ Finset.range n, w i * (u i ^ 2 + u (i + 1) ^ 2)) ≤ + 2 * ∑ i ∈ Finset.range (n + 1), w i * u i ^ 2 := by + have ha : (∑ i ∈ Finset.range n, w i * u i ^ 2) ≤ + ∑ i ∈ Finset.range (n + 1), w i * u i ^ 2 := by + rw [Finset.sum_range_succ] + exact le_add_of_nonneg_right (mul_nonneg (hw0 _) (sq_nonneg _)) + have hb : (∑ i ∈ Finset.range n, w i * u (i + 1) ^ 2) ≤ + ∑ i ∈ Finset.range (n + 1), w i * u i ^ 2 := by + calc + _ ≤ ∑ i ∈ Finset.range n, w (i + 1) * u (i + 1) ^ 2 := by + apply Finset.sum_le_sum + intro i _ + exact mul_le_mul_of_nonneg_right (hw i) (sq_nonneg _) + _ ≤ _ := by + rw [Finset.sum_range_succ'] + exact le_add_of_nonneg_right (mul_nonneg (hw0 _) (sq_nonneg _)) + simp_rw [mul_add, Finset.sum_add_distrib] + linarith + +lemma weighted_edge_form (n : ℕ) (u a : ℕ → ℝ) {B C : ℝ} + (hB : 0 ≤ B) (hC : 0 ≤ C) + (ha : ∀ i < n, |a i| ≤ B + C * ((i + 1 : ℝ) / (n + 1))) : + 2 * |∑ i ∈ Finset.range n, a i * u i * u (i + 1)| ≤ + 2 * B * (∑ i ∈ Finset.range (n + 1), u i ^ 2) + 4 * C * pathEnergy n u := by + let w (i : ℕ) : ℝ := B + C * ((i + 1 : ℝ) / (n + 1)) + have hw0 : ∀ i, 0 ≤ w i := by intro i; dsimp [w]; positivity + have hw : ∀ i, w i ≤ w (i + 1) := by + intro i + dsimp [w] + gcongr + norm_num + have habs : 2 * |∑ i ∈ Finset.range n, a i * u i * u (i + 1)| ≤ + ∑ i ∈ Finset.range n, w i * (u i ^ 2 + u (i + 1) ^ 2) := by + calc + _ ≤ 2 * ∑ i ∈ Finset.range n, |a i * u i * u (i + 1)| := + mul_le_mul_of_nonneg_left (Finset.abs_sum_le_sum_abs _ _) (by norm_num) + _ = ∑ i ∈ Finset.range n, |a i| * (2 * |u i * u (i + 1)|) := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + simp only [abs_mul] + ring + _ ≤ _ := by + apply Finset.sum_le_sum + intro i hi + apply mul_le_mul (ha i (Finset.mem_range.mp hi)) ?_ (by positivity) (hw0 i) + nlinarith [sq_nonneg (|u i| - |u (i + 1)|), sq_abs (u i), sq_abs (u (i + 1)), + show |u i * u (i + 1)| = |u i| * |u (i + 1)| from abs_mul _ _] + have hid : (∑ i ∈ Finset.range (n + 1), w i * u i ^ 2) = + B * (∑ i ∈ Finset.range (n + 1), u i ^ 2) + + C * (∑ i ∈ Finset.range (n + 1), (i + 1 : ℝ) / (n + 1) * u i ^ 2) := by + simp only [w, add_mul, mul_assoc, Finset.sum_add_distrib, Finset.mul_sum] + have hvari := pathEnergy_weighted_mass n u + have hn := habs.trans (weighted_neighbor_sum n u w hw0 hw) + rw [hid] at hn + nlinarith [mul_le_mul_of_nonneg_left hvari hC] + +lemma chi_mean_form_bias (n : ℕ) (u : ℕ → ℝ) : + 2 * |∑ i ∈ Finset.range n, + (((∫ x, chi (n - i) x ∂standardGaussianProduct (n - i)) / Real.sqrt (n + 1 : ℝ)) - + edgeCoeff n i) * u i * u (i + 1)| ≤ + 8 / (n + 1) * (∑ i ∈ Finset.range (n + 1), u i ^ 2) + + 16 / Real.sqrt (n + 1 : ℝ) * pathEnergy n u := by + have hb := weighted_edge_form n u + (fun i => (∫ x, chi (n - i) x ∂standardGaussianProduct (n - i)) / Real.sqrt (n + 1 : ℝ) - + edgeCoeff n i) + (B := 4 / (n + 1)) (C := 4 / Real.sqrt (n + 1 : ℝ)) (by positivity) (by positivity) ?_ + · convert hb using 1 + ring + intro i hi + rw [edgeCoeff_sqrt_div n i (by omega), ← sub_div] + rw [abs_div, abs_of_nonneg (Real.sqrt_nonneg _), abs_sub_comm, + abs_of_nonneg (chi_mean_bias (n - i) (by omega)).1] + exact chi_scaled_bias_bound n i hi + +def entryVariance (n : ℕ) : ℝ≥0 := ⟨2 * (48 * Real.exp 1 + 4) / (n + 1), by positivity⟩ + +lemma entryVariance_pos (n : ℕ) : 0 < entryVariance n := by + change 0 < 2 * (48 * Real.exp 1 + 4) / (n + 1 : ℝ) + positivity + +lemma subGaussian_enlarge {Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} {X : Ω → ℝ} + {c d : ℝ≥0} (h : HasSubgaussianMGF X c μ) (hcd : c ≤ d) : HasSubgaussianMGF X d μ := by + refine ⟨h.integrable_exp_mul, fun t => (h.mgf_le t).trans ?_⟩ + apply Real.exp_le_exp.mpr + gcongr + +lemma diagonalRows_common_subGaussian (n i : ℕ) : + HasSubgaussianMGF (fun ω : ℕ → ℝ => ω i) (entryVariance n) (diagonalLaw n) := by + apply subGaussian_enlarge (diagonalRows_subGaussian n i) + change 2 / (n + 1 : ℝ) ≤ 2 * (48 * Real.exp 1 + 4) / (n + 1) + gcongr + have := Real.exp_pos (1 : ℝ) + linarith + +abbrev TriSample (n : ℕ) := (ℕ → ℝ) × ChiRows n + +def triLaw (n : ℕ) : Measure (TriSample n) := (diagonalLaw n).prod (chiRowLaw n) + +instance (n : ℕ) : IsProbabilityMeasure (triLaw n) := by + unfold triLaw + infer_instance + +def entryBad {Ω : Type*} (n : ℕ) (X : ℕ → Ω → ℝ) (h : ℝ) : Set Ω := + multiscaleBad X (entryVariance n) (fun j => scaleLength (Nat.clog 8 (n + 1)) j - 1) + (Nat.clog 8 (n + 1) + 2) (n + 1) h + +def triBad (n : ℕ) (h : ℝ) : Set (TriSample n) := + Prod.fst ⁻¹' entryBad n (fun i (ω : ℕ → ℝ) => ω i) h ∪ + Prod.snd ⁻¹' entryBad n (scaledChiRow n) h + +lemma entryBad_measurable {Ω : Type*} [MeasurableSpace Ω] (n : ℕ) (X : ℕ → Ω → ℝ) + (hX : ∀ i, Measurable (X i)) (h : ℝ) : MeasurableSet (entryBad n X h) := + multiscaleBad_measurable X hX _ _ _ _ _ + +lemma triBad_measurable (n : ℕ) (h : ℝ) : MeasurableSet (triBad n h) := + ((entryBad_measurable n _ (fun i => measurable_pi_apply i) h).preimage measurable_fst).union + ((entryBad_measurable n _ (scaledChiRow_measurable n) h).preimage measurable_snd) + +lemma triBad_probability (n : ℕ) (h : ℝ) : + (triLaw n).real (triBad n h) ≤ 32 * Real.exp (-h ^ 2) := by + have ha : (diagonalLaw n).real (entryBad n (fun i (ω : ℕ → ℝ) => ω i) h) ≤ + 16 * Real.exp (-h ^ 2) := + multiscaleBad_probability (fun i => (measurable_pi_apply i).stronglyMeasurable) + (diagonalRows_independent n) (diagonalRows_common_subGaussian n) (diagonalRows_mean n) + (entryVariance_pos n) _ _ _ _ + have hb : (chiRowLaw n).real (entryBad n (scaledChiRow n) h) ≤ + 16 * Real.exp (-h ^ 2) := + multiscaleBad_probability (fun i => (scaledChiRow_measurable n i).stronglyMeasurable) + (scaledChiRows_independent n) (scaledChiRow_subGaussian n) (scaledChiRow_mean n) + (entryVariance_pos n) _ _ _ _ + have hU := measureReal_union_le (μ := triLaw n) + (Prod.fst ⁻¹' entryBad n (fun i (ω : ℕ → ℝ) => ω i) h) + (Prod.snd ⁻¹' entryBad n (scaledChiRow n) h) + have heA : Prod.fst ⁻¹' entryBad n (fun i (ω : ℕ → ℝ) => ω i) h = + (entryBad n (fun i (ω : ℕ → ℝ) => ω i) h) ×ˢ (Set.univ : Set (ChiRows n)) := by ext; simp + have heB : Prod.snd ⁻¹' entryBad n (scaledChiRow n) h = + (Set.univ : Set (ℕ → ℝ)) ×ˢ (entryBad n (scaledChiRow n) h) := by ext; simp + simpa only [triBad, heA, heB, triLaw, measureReal_prod_prod, probReal_univ, mul_one, one_mul] + using hU.trans (by simpa only [heA, heB, triLaw, measureReal_prod_prod, probReal_univ, + mul_one, one_mul] using (show _ + _ ≤ 32 * Real.exp (-h ^ 2) by linarith [ha, hb])) + +def triForm (n : ℕ) (ω : TriSample n) (u : ℕ → ℝ) : ℝ := + (∑ i ∈ Finset.range (n + 1), ω.1 i * u i ^ 2) + + 2 * ∑ i ∈ Finset.range n, + (chi (chiRowDim n i) (ω.2 i) / Real.sqrt (n + 1 : ℝ)) * u i * u (i + 1) + +lemma triForm_decomposition (n : ℕ) (ω : TriSample n) (u : ℕ → ℝ) : + triForm n ω u - (2 * (∑ i ∈ Finset.range (n + 1), u i ^ 2) - pathEnergy n u) = + (∑ i ∈ Finset.range (n + 1), ω.1 i * u i ^ 2) + + 2 * (∑ i ∈ Finset.range n, scaledChiRow n i ω.2 * (u i * u (i + 1))) + + 2 * (∑ i ∈ Finset.range n, + (((∫ x, chi (n - i) x ∂standardGaussianProduct (n - i)) / Real.sqrt (n + 1 : ℝ)) - + edgeCoeff n i) * u i * u (i + 1)) := by + unfold triForm pathEnergy + have he : (∑ i ∈ Finset.range n, + (chi (chiRowDim n i) (ω.2 i) / Real.sqrt (n + 1 : ℝ)) * u i * u (i + 1)) = + (∑ i ∈ Finset.range n, edgeCoeff n i * u i * u (i + 1)) + + (∑ i ∈ Finset.range n, scaledChiRow n i ω.2 * (u i * u (i + 1))) + + (∑ i ∈ Finset.range n, + (((∫ x, chi (n - i) x ∂standardGaussianProduct (n - i)) / Real.sqrt (n + 1 : ℝ)) - + edgeCoeff n i) * u i * u (i + 1)) := by + rw [← Finset.sum_add_distrib, ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro i hi + have hd : chiRowDim n i = n - i := by unfold chiRowDim; have := Finset.mem_range.mp hi; omega + have hmean : (∫ y, chi (chiRowDim n i) y ∂standardGaussianProduct (chiRowDim n i)) = + (∫ y, chi (n - i) y ∂standardGaussianProduct (n - i)) := by rw [hd] + simp only [scaledChiRow, centeredChiRow] + rw [hmean] + ring + rw [he] + ring + +def formError (n : ℕ) (h s e : ℝ) : ℝ := + 41472 * Real.sqrt (32 * (entryVariance n : ℝ)) * (h + 1) * + ((2 : ℝ)^(Nat.clog 8 (n + 1))) ^ (1 / 4 : ℝ) * (e + s) ^ (3 / 8 : ℝ) + + 8 / (n + 1) + 16 / Real.sqrt (n + 1 : ℝ) * e + +lemma triForm_good (n : ℕ) {h s : ℝ} {ω : TriSample n} + (hh : 0 ≤ h) (hs : scaleEnergy (Nat.clog 8 (n + 1)) 0 ≤ s) + (hω : ω ∉ triBad n h) (u : ℕ → ℝ) (hu : ∀ i, n + 1 ≤ i → u i = 0) + (hnorm : (∑ i ∈ Finset.range (n + 1), u i ^ 2) = 1) : + |triForm n ω u - (2 - pathEnergy n u)| ≤ formError n h s (pathEnergy n u) := by + have hA : ω.1 ∉ entryBad n (fun i (a : ℕ → ℝ) => a i) h := by + intro ha + exact hω (Or.inl ha) + have hB : ω.2 ∉ entryBad n (scaledChiRow n) h := by + intro hb + exact hω (Or.inr hb) + have ha := centered_square_form_good n hh hs hA u hu hnorm + have hb := centered_product_form_good n hh hs hB u hu hnorm + have hbias := chi_mean_form_bias n u + rw [hnorm, mul_one] at hbias + have heB : (∑ i ∈ Finset.range (n + 1), scaledChiRow n i ω.2 * (u i * u (i + 1))) = + ∑ i ∈ Finset.range n, scaledChiRow n i ω.2 * (u i * u (i + 1)) := by + rw [Finset.sum_range_succ, hu (n + 1) (by omega)] + ring + rw [heB] at hb + have he := triForm_decomposition n ω u + rw [hnorm, mul_one] at he + rw [he] + have habs := abs_add_le + ((∑ i ∈ Finset.range (n + 1), ω.1 i * u i ^ 2) + + 2 * (∑ i ∈ Finset.range n, scaledChiRow n i ω.2 * (u i * u (i + 1)))) + (2 * (∑ i ∈ Finset.range n, + (((∫ x, chi (n - i) x ∂standardGaussianProduct (n - i)) / Real.sqrt (n + 1 : ℝ)) - + edgeCoeff n i) * u i * u (i + 1))) + have habs2 := abs_add_le + (∑ i ∈ Finset.range (n + 1), ω.1 i * u i ^ 2) + (2 * (∑ i ∈ Finset.range n, scaledChiRow n i ω.2 * (u i * u (i + 1)))) + simp only [abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 2)] at habs habs2 + dsimp only [formError] + linarith + +instance (n : ℕ) : IsProbabilityMeasure (triLaw n) := by + unfold triLaw + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (triLaw n) := by + unfold triLaw + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (triLaw n) := by + unfold triLaw + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (triLaw n) := by + unfold triLaw + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (triLaw n) := by + unfold triLaw + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (triLaw n) := by + unfold triLaw + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (triLaw n) := by + unfold triLaw + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (triLaw n) := by + unfold triLaw + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (triLaw n) := by + unfold triLaw + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (triLaw n) := by + unfold triLaw + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (triLaw n) := by + unfold triLaw + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (triLaw n) := by + unfold triLaw + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (triLaw n) := by + unfold triLaw + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (triLaw n) := by + unfold triLaw + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (triLaw n) := by + unfold triLaw + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (triLaw n) := by + unfold triLaw + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (triLaw n) := by + unfold triLaw + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (triLaw n) := by + unfold triLaw + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (triLaw n) := by + unfold triLaw + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (triLaw n) := by + unfold triLaw + infer_instance + +instance (n : ℕ) : IsProbabilityMeasure (triLaw n) := by + unfold triLaw + infer_instance + +end CriticalSK + +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/CriticalSK/VariationalDefinitions.lean b/lean/OAI/MathematicalPhysics/CriticalSK/VariationalDefinitions.lean new file mode 100644 index 0000000000000000000000000000000000000000..ca652a5d75164ff1bd545fa6f03c18b53dd5cd91 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/CriticalSK/VariationalDefinitions.lean @@ -0,0 +1,36 @@ +import OAI.MathematicalPhysics.CriticalSK.Main + +namespace OAI + +noncomputable section +open scoped BigOperators Topology NNReal ENNReal +open MeasureTheory ProbabilityTheory Filter +namespace CriticalSK + +def continuousMixingAt {n : ℕ} (W : Disorder n) (ε : ℝ) : ℝ := + sInf {t : ℝ | 0 ≤ t ∧ ∀ x, continuousDistance W t x ≤ ε} + +def discreteMixingAt {n : ℕ} (W : Disorder n) (ε : ℝ) : ℕ := + sInf {k : ℕ | ∀ x, discreteDistance W k x ≤ ε} + +def entropy {n : ℕ} (W : Disorder n) (g : Spin n → ℝ) : ℝ := + mean W (fun x => g x * Real.log (g x)) - mean W g * Real.log (mean W g) + +def relaxationTime {n : ℕ} (W : Disorder n) : ℝ := + sSup {r : ℝ | ∃ f : Spin n → ℝ, 0 < variance W f ∧ + r = variance W f / dirichlet W f} + +def logSobolevConstant {n : ℕ} (W : Disorder n) : ℝ := + sSup {r : ℝ | ∃ f : Spin n → ℝ, 0 < entropy W (fun x => f x ^ 2) ∧ + r = entropy W (fun x => f x ^ 2) / dirichlet W f} + +def ExponentInProbability (X : (n : ℕ) → Disorder n → ℝ) (a : ℝ) : Prop := + ∀ δ : ℝ, 0 < δ → + Tendsto (fun n : ℕ => (disorderLaw n).real + {W | (n : ℝ) ^ (a - δ) ≤ X n W ∧ X n W ≤ (n : ℝ) ^ (a + δ)}) + atTop (𝓝 1) + +end CriticalSK +end + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates.lean new file mode 100644 index 0000000000000000000000000000000000000000..9c047edf6868e53b2771dfd27f6e016ca2838bcb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates.lean @@ -0,0 +1,30 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ApproximateNullLimit +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryMatchingExclusion +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.CompactFamilyIntegral +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ComplexPowerBound +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ContinuousCoordinateStableOrbit +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ContinuousDiagonalStableOrbit +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ContinuousHalfLineBound +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ContinuousSampledFrame +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.CorrectedTorusFrame +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.FreeLimitingModel +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.FreePhysicalGeneralizedExclusion +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.FreeRadialEquation +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.FreeSimpleZeros +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.InteriorDerivativeLipschitz +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.KernelOperatorBound +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.LaguerreRapidDecay +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.LowWeightInterpolation +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.MatchingBasisChange +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.MatchingMatrixSimpleZero +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.MixedFourierLocalization +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.RationalComplexMatrix +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.RectangleHomotopyCount +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.RectangleRouche +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ScaledLatticeKernel +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.SimilarityLimit +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.TailCone +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.UniformHorizontalExclusion +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ZeroTailParameterContinuity + +/-! Exact arithmetic and complex-analytic certificates for profile matching. -/ diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/AnalyticMatchingColumn.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/AnalyticMatchingColumn.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd4a3d1267451d1f845e0b6c7ea07398b87994ce --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/AnalyticMatchingColumn.lean @@ -0,0 +1,96 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.NormalizedMatchingColumns +import OAI.MathematicalPhysics.DefocusingNLS.Profile.SlowParameterHolomorphy + +namespace OAI + +/-! # The analytic boundary column and its normalized tail representation -/ + +open Matrix + +namespace DefocusingNLS + +/-- The derivative-shift formula gives an explicitly analytic boundary column. -/ +noncomputable def slowBoundaryColumn (q : ℂ) (m : ℕ) (s : ℂ) : Fin 2 → ℂ := + ![regularizedSlowSolution q m (-s), q * regularizedSlowSolution (q + 1) (m + 1) (-s)] + +theorem slowBoundaryColumn_eq_jet (q : ℂ) (m : ℕ) (s : ℂ) + (hq : -1 < q.re) (hsre : s.re = 0) (hsim : s.im ≠ 0) : + slowBoundaryColumn q m s = + ![regularizedSlowSolution q m (-s), -deriv (regularizedSlowSolution q m) (-s)] := by + have hs0 : -s ≠ 0 := neg_ne_zero.mpr (fun h => hsim (by simp [h])) + have hd := (hasDerivAt_regularizedSlowSolution_shift_closed q m (-s) hq + (by simp [hsre]) hs0).deriv + simp [slowBoundaryColumn, hd] + +theorem differentiableAt_slowBoundaryColumn (q : ℂ) (m : ℕ) (s : ℂ) + (hq : -1 < q.re) (hsre : s.re = 0) (hsim : s.im ≠ 0) : + DifferentiableAt ℂ (fun z => slowBoundaryColumn z m s) q := by + have hs0 : -s ≠ 0 := neg_ne_zero.mpr (fun h => hsim (by simp [h])) + have hq' : -1 < (q + 1).re := by change -1 < q.re + 1; linarith + have h₀ := differentiableAt_regularizedSlowSolution_parameter_closed q m (-s) hq + (by simp [hsre]) hs0 + have h₁ := differentiableAt_regularizedSlowSolution_parameter_closed (q + 1) (m + 1) + (-s) hq' (by simp [hsre]) hs0 + apply differentiableAt_pi.mpr + intro i + fin_cases i + · change DifferentiableAt ℂ (fun z => regularizedSlowSolution z m (-s)) q + exact h₀ + · change DifferentiableAt ℂ (fun z => z * regularizedSlowSolution (z + 1) (m + 1) (-s)) q + convert! differentiableAt_id.mul (h₁.comp q (differentiableAt_id.add_const 1)) using 1 + +theorem analyticOnNhd_slowBoundaryColumn (m : ℕ) (s : ℂ) + (hsre : s.re = 0) (hsim : s.im ≠ 0) : + AnalyticOnNhd ℂ (fun q => slowBoundaryColumn q m s) {q : ℂ | -1 < q.re} := by + apply DifferentiableOn.analyticOnNhd _ (isOpen_lt continuous_const Complex.continuous_re) + intro q hq + exact (differentiableAt_slowBoundaryColumn q m s hq hsre hsim).differentiableWithinAt + +theorem slowBoundaryColumn_ne_zero (q : ℂ) (m : ℕ) (s : ℂ) + (hq : -1 < q.re) (hsre : s.re = 0) (hsim : s.im ≠ 0) : + slowBoundaryColumn q m s ≠ 0 := by + rw [slowBoundaryColumn_eq_jet q m s hq hsre hsim] + intro hz + have h₀ := congrFun hz 0 + have h₁ := congrFun hz 1 + simp only [Matrix.cons_val_zero, Matrix.cons_val_one, Pi.zero_apply] at h₀ h₁ + have hs0 : -s ≠ 0 := neg_ne_zero.mpr (fun h => hsim (by simp [h])) + exact (regularizedSlowSolution_jet_nonzero q m (-s) hq (by simp [hsre]) hs0).elim + (fun h => h h₀) (fun h => h (neg_eq_zero.mp h₁)) + +theorem normalizedMatching_tail_disk (σ : ℝ) (ℓ K : ℕ) (q s : ℂ) + (hσ : -(1 / 32 : ℝ) ≤ σ) (hK : 3 ≤ K) + (hq : q.re = σ + (ℓ : ℝ) / 2) (hsre : s.re = 0) (hsim : s.im ≠ 0) : + normalizedMatchingC q (ℓ + 6) s K ≠ 0 ∧ + Complex.normSq (normalizedMatchingB q (ℓ + 6) s K / + normalizedMatchingC q (ℓ + 6) s K + s / ((ℓ : ℝ) + 5 : ℂ)) < + Complex.normSq (s / ((ℓ : ℝ) + 5 : ℂ)) := by + have hq' : -1 < q.re := by rw [hq]; linarith [Nat.cast_nonneg (α := ℝ) ℓ] + have hp := shiftedPochhammer_ne_zero q (K - 1) hq' + obtain ⟨hC, hd⟩ := normalizedSlow_tail_disk σ ℓ K q s hσ hK hq hsre hsim + refine ⟨div_ne_zero hC hp, ?_⟩ + have he : normalizedMatchingB q (ℓ + 6) s K / normalizedMatchingC q (ℓ + 6) s K = + normalizedSlowB q (ℓ + 6) s K / normalizedSlowC q (ℓ + 6) s K := by + unfold normalizedMatchingB normalizedMatchingC + field_simp + rwa [he] + +/-- The backward image of the ratio column differs from the true analytic +boundary column by the explicit nonzero tail scalar. -/ +theorem normalizedMatching_ratio_column (q : ℂ) (M K : ℕ) (s : ℂ) + (hK : 0 < K) (hq : -1 < q.re) (hsre : s.re = 0) (hsim : s.im ≠ 0) + (hC : normalizedMatchingC q (M + 1) s K ≠ 0) : + backwardProduct M s q K *ᵥ + ![normalizedMatchingB q (M + 1) s K / normalizedMatchingC q (M + 1) s K, 1] = + (normalizedMatchingC q (M + 1) s K)⁻¹ • slowBoundaryColumn q (M + 1) s := by + have hv : ![normalizedMatchingB q (M + 1) s K / normalizedMatchingC q (M + 1) s K, 1] = + (normalizedMatchingC q (M + 1) s K)⁻¹ • + ![normalizedMatchingB q (M + 1) s K, normalizedMatchingC q (M + 1) s K] := by + ext i + fin_cases i <;> simp [div_eq_mul_inv, mul_comm, hC] + rw [hv, Matrix.mulVec_smul, normalizedMatching_backwardProduct q M K s hK hq hsre hsim, + slowBoundaryColumn_eq_jet q (M + 1) s hq hsre hsim] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ApproximateNullLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ApproximateNullLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..0169a42bd4b1bf6a042ccee058ec02cc5dc84690 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ApproximateNullLimit.lean @@ -0,0 +1,34 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.UniformCutoffLimit + +namespace OAI + +/-! # Preservation of a null limit under arbitrarily close null approximations -/ + +open Filter Topology + +namespace DefocusingNLS + +theorem tendsto_zero_of_null_approximations {E : Type*} [SeminormedAddCommGroup E] + (f : ℕ → E) + (happrox : ∀ ε : ℝ, 0 < ε → ∃ g : ℕ → E, Tendsto g atTop (𝓝 0) ∧ + ∀ᶠ n in atTop, ‖f n - g n‖ ≤ ε) : + Tendsto f atTop (𝓝 0) := by + rw [Metric.tendsto_atTop] + intro ε hε + obtain ⟨g, hg, hclose⟩ := happrox (ε / 2) (by positivity) + have hs : ∀ᶠ n in atTop, ‖g n‖ < ε / 2 := by + obtain ⟨n₁, hn₁⟩ := Metric.tendsto_atTop.mp hg (ε / 2) (by positivity) + exact eventually_atTop.2 ⟨n₁, fun n hn => by + simpa only [dist_zero_right] using hn₁ n hn⟩ + obtain ⟨n₀, hn₀⟩ := eventually_atTop.1 (hclose.and hs) + refine ⟨n₀, ?_⟩ + intro n hn + rw [dist_zero_right] + have h := hn₀ n hn + calc + ‖f n‖ ≤ ‖f n - g n‖ + ‖g n‖ := norm_le_norm_sub_add _ _ + _ < ε := by linarith [h.1, h.2] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryCertificateArithmetic.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryCertificateArithmetic.lean new file mode 100644 index 0000000000000000000000000000000000000000..6fe7cf7c4d54098f14a610bd88fae350145a9b40 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryCertificateArithmetic.lean @@ -0,0 +1,85 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.PolynomialEnclosure + +namespace OAI + +/-! # The integer boundary certificate recipe + +The depth-eight forward recurrence gives coefficient enclosures for the +boundary determinant and its homogeneous chart transforms. +-/ + +namespace DefocusingNLS.BoundaryCertificate +open GaussianEnclosure + +abbrev EnclosurePolynomial := List GaussianEnclosure + +def coefficient (r i e : ℤ) : GaussianEnclosure := ⟨⟨r, i⟩, e⟩ +def constant (r : ℤ) : EnclosurePolynomial := [coefficient r 0 0] + +def sharpAux : Bool → EnclosurePolynomial → EnclosurePolynomial + | _, [] => [] + | false, a :: as => conj a :: sharpAux true as + | true, a :: as => neg (conj a) :: sharpAux false as + +def sharp (as : EnclosurePolynomial) : EnclosurePolynomial := sharpAux false as + +abbrev Row := EnclosurePolynomial × EnclosurePolynomial +abbrev State := Row × Row + +def step (ell n : ℕ) (xy : State) : State := + let M := constant (100000000 * (ell + 5)) + let s := [coefficient 0 270506819 2] + let t := [coefficient ((50000000 : ℤ) * ((ell : ℤ) + 2 * (n : ℤ)) - 3125000) (-33477607) 2, + coefficient 0 100000000 0] + let d := subPolynomial t M + let x₀ := addPolynomial (mulPolynomial t xy.1.1) (mulPolynomial s xy.2.1) + let x₁ := addPolynomial (mulPolynomial t xy.1.2) (mulPolynomial s xy.2.2) + ((x₀, x₁), (subPolynomial (mulPolynomial d xy.2.1) x₀, + subPolynomial (mulPolynomial d xy.2.2) x₁)) + +def state (ell : ℕ) : ℕ → State + | 0 => ((constant 1, constant 0), (constant 0, constant 1)) + | n + 1 => step ell n (state ell n) + +def hermitian (ell : ℕ) (x y z w : EnclosurePolynomial) : EnclosurePolynomial := + addPolynomial + (mulPolynomial (mulPolynomial (constant (100000000 * (ell + 5))) (conjPolynomial x)) z) + (mulPolynomial [coefficient 0 270506819 2] + (subPolynomial (mulPolynomial (conjPolynomial x) w) (mulPolynomial (conjPolynomial y) z))) + +def symmetrize (p : EnclosurePolynomial) : EnclosurePolynomial := addPolynomial p (sharp p) + +def determinant (ell : ℕ) : EnclosurePolynomial := + let xy := state ell 8 + let A := symmetrize (hermitian ell xy.1.1 xy.2.1 xy.1.1 xy.2.1) + let D := symmetrize (hermitian ell xy.1.2 xy.2.2 xy.1.2 xy.2.2) + let C := symmetrize (hermitian ell xy.1.1 xy.2.1 xy.1.2 xy.2.2) + subPolynomial (mulPolynomial A D) (mulPolynomial C (conjPolynomial C)) + +/-- The degree-30 real-even truncation. Its use requires the structural proof. -/ +def evenCoefficients (ell : ℕ) : List GaussianEnclosure := + (List.range 16).map fun j => + let a := (determinant ell)[2 * j]?.getD zero + coefficient a.center.re 0 a.error + +def transformAux (U V J : ℤ) : List GaussianEnclosure → + EnclosurePolynomial × EnclosurePolynomial → EnclosurePolynomial × EnclosurePolynomial + | [], qm => qm + | a :: as, qm => + let q := addPolynomial (mulPolynomial qm.1 [coefficient U 0 0, coefficient V 0 0]) + (mulPolynomial qm.2 [a]) + let m := mulPolynomial qm.2 [coefficient 1 0 0, coefficient J 0 0] + transformAux U V J as (q, m) + +def transformed (ell : ℕ) (U V J : ℤ) : EnclosurePolynomial := + (transformAux U V J (evenCoefficients ell).reverse (constant 0, constant 1)).1 + +def coefficientPositive (a : GaussianEnclosure) : Bool := + decide (a.error < a.center.re) + +def positiveFirst16 (p : EnclosurePolynomial) : Bool := + ((List.range 16).map fun n => coefficientPositive (p[n]?.getD zero)).all id + +end DefocusingNLS.BoundaryCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryCertificatePositivity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryCertificatePositivity.lean new file mode 100644 index 0000000000000000000000000000000000000000..eda71459a45c4d7397b207d520876d57cd85fc97 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryCertificatePositivity.lean @@ -0,0 +1,28 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryCertificateArithmetic + +namespace OAI + +namespace DefocusingNLS.BoundaryCertificate + +/-- Exact positivity of the first transformed boundary enclosure. -/ +theorem row_zero_first_positive : positiveFirst16 (transformed 0 0 1 1) = true := by + decide +kernel + +theorem row_zero_second_positive : positiveFirst16 (transformed 0 1 10 1) = true := by decide +kernel +theorem row_zero_third_positive : positiveFirst16 (transformed 0 10 1 0) = true := by decide +kernel + +theorem row_one_first_positive : positiveFirst16 (transformed 1 0 1 1) = true := by decide +kernel +theorem row_one_second_positive : positiveFirst16 (transformed 1 1 10 1) = true := by decide +kernel +theorem row_one_third_positive : positiveFirst16 (transformed 1 10 1 0) = true := by decide +kernel + +theorem row_two_first_positive : positiveFirst16 (transformed 2 0 1 1) = true := by decide +kernel +theorem row_two_second_positive : positiveFirst16 (transformed 2 1 10 1) = true := by decide +kernel +theorem row_two_third_positive : positiveFirst16 (transformed 2 10 1 0) = true := by decide +kernel + +theorem row_three_first_positive : positiveFirst16 (transformed 3 0 1 1) = true := by decide +kernel +theorem row_three_second_positive : positiveFirst16 (transformed 3 1 10 1) = true := by decide +kernel +theorem row_three_third_positive : positiveFirst16 (transformed 3 10 1 0) = true := by decide +kernel + +end DefocusingNLS.BoundaryCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryCertificateSemantics.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryCertificateSemantics.lean new file mode 100644 index 0000000000000000000000000000000000000000..cf56d31de31972202e5545e867699ac458053d49 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryCertificateSemantics.lean @@ -0,0 +1,92 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryCertificateArithmetic +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryHermitianPolynomial + +namespace OAI + +/-! # Soundness of the boundary coefficient recipe -/ + +open Polynomial + +namespace DefocusingNLS.GaussianEnclosure + +theorem realPart_pos {a : GaussianEnclosure} {z : ℂ} (ha : a.Encloses z) + (hpos : a.error < a.center.re) : 0 < z.re := by + have h := (Complex.abs_re_le_norm (z - (a.center : ℂ))).trans ha + have hp : (a.error : ℝ) < (a.center.re : ℝ) := by exact_mod_cast hpos + rw [Complex.sub_re, ← GaussianInt.intCast_re] at h + have hlow := (abs_le.mp h).1 + linarith + +theorem realPart_sound {a : GaussianEnclosure} {z : ℂ} (ha : a.Encloses z) : + (⟨⟨a.center.re, 0⟩, a.error⟩ : GaussianEnclosure).Encloses (z.re : ℂ) := by + have h := (Complex.abs_re_le_norm (z - (a.center : ℂ))).trans ha + rw [Complex.sub_re, ← GaussianInt.intCast_re] at h + change ‖(z.re : ℂ) - (GaussianInt.toComplex ⟨a.center.re, 0⟩)‖ ≤ _ + have hc : GaussianInt.toComplex ⟨a.center.re, 0⟩ = ((a.center.re : ℝ) : ℂ) := by + rw [GaussianInt.toComplex_def', Int.cast_zero, zero_mul, add_zero] + norm_cast + rw [hc, ← Complex.ofReal_sub, Complex.norm_real, Real.norm_eq_abs] + exact h + +end DefocusingNLS.GaussianEnclosure + +namespace DefocusingNLS.BoundaryCertificate +open GaussianEnclosure + +theorem constant_sound (n : ℤ) : EnclosesPolynomial (constant n) (C (n : ℂ)) := by + refine ⟨(n : ℂ), 0, ?_, rfl, by simp⟩ + simp [coefficient, Encloses, GaussianInt.toComplex_def] + +theorem sharpPolynomial_cons (z : ℂ) (p : Polynomial ℂ) : + sharpPolynomial (C z + X * p) = C (star z) - X * sharpPolynomial p := by + simp only [sharpPolynomial, conjugatePolynomial, Polynomial.map_add, Polynomial.map_mul, + map_C, map_X, add_comp, mul_comp, C_comp, X_comp] + simp only [map_neg, map_one, neg_one_mul, starRingEnd_apply] + ring + +theorem sharpAux_sound (b : Bool) {as : List GaussianEnclosure} {p : Polynomial ℂ} + (hp : EnclosesPolynomial as p) : + EnclosesPolynomial (sharpAux b as) (if b then -sharpPolynomial p else sharpPolynomial p) := by + induction as generalizing b p with + | nil => + change p = 0 at hp + subst p + cases b <;> simp [sharpAux, EnclosesPolynomial, sharpPolynomial, conjugatePolynomial] + | cons a as ih => + obtain ⟨z, q, hz, hq, rfl⟩ := hp + cases b + · refine ⟨star z, -sharpPolynomial q, conj_sound hz, ih true hq, ?_⟩ + change sharpPolynomial (C z + X * q) = C (star z) + X * (-sharpPolynomial q) + rw [sharpPolynomial_cons] + ring + · refine ⟨-star z, sharpPolynomial q, neg_sound (conj_sound hz), ih false hq, ?_⟩ + change -sharpPolynomial (C z + X * q) = C (-star z) + X * sharpPolynomial q + rw [sharpPolynomial_cons, map_neg] + ring + +theorem sharp_sound {as : List GaussianEnclosure} {p : Polynomial ℂ} + (hp : EnclosesPolynomial as p) : EnclosesPolynomial (sharp as) (sharpPolynomial p) := + sharpAux_sound false hp + +theorem symmetrize_sound {as : List GaussianEnclosure} {p : Polynomial ℂ} + (hp : EnclosesPolynomial as p) : + EnclosesPolynomial (symmetrize as) (p + sharpPolynomial p) := + addPolynomial_sound hp (sharp_sound hp) + +theorem hermitian_sound (ell : ℕ) (s : ℂ) + (hs : EnclosesPolynomial [coefficient 0 270506819 2] (C s)) + {x y z w : List GaussianEnclosure} {X Y Z W : Polynomial ℂ} + (hx : EnclosesPolynomial x X) (hy : EnclosesPolynomial y Y) + (hz : EnclosesPolynomial z Z) (hw : EnclosesPolynomial w W) : + EnclosesPolynomial (hermitian ell x y z w) + (C ((100000000 * (ell + 5) : ℤ) : ℂ) * conjugatePolynomial X * Z + + C s * (conjugatePolynomial X * W - conjugatePolynomial Y * Z)) := + addPolynomial_sound + (mulPolynomial_sound (mulPolynomial_sound (constant_sound _) (conjPolynomial_sound hx)) hz) + (mulPolynomial_sound hs (subPolynomial_sound + (mulPolynomial_sound (conjPolynomial_sound hx) hw) + (mulPolynomial_sound (conjPolynomial_sound hy) hz))) + +end DefocusingNLS.BoundaryCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryChartCover.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryChartCover.lean new file mode 100644 index 0000000000000000000000000000000000000000..bb065d62f882171ca829713b16fc157e05943a0b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryChartCover.lean @@ -0,0 +1,33 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryEvenPolynomial + +namespace OAI + +/-! # The three positive half-line charts cover every squared frequency -/ + +namespace DefocusingNLS.BoundaryCertificate + +theorem nonnegative_chart_cover (w : ℝ) (hw : 0 ≤ w) : + (∃ t : ℝ, 0 ≤ t ∧ w = t / (1 + t)) ∨ + (∃ t : ℝ, 0 ≤ t ∧ w = (1 + 10 * t) / (1 + t)) ∨ + (∃ t : ℝ, 0 ≤ t ∧ w = 10 + t) := by + by_cases h₁ : w < 1 + · left + refine ⟨w / (1 - w), div_nonneg hw (by linarith), ?_⟩ + have hd : 1 - w ≠ 0 := by linarith + have ht : 1 + w / (1 - w) ≠ 0 := by positivity + field_simp + ring + · by_cases h₁₀ : w < 10 + · right; left + refine ⟨(w - 1) / (10 - w), div_nonneg (by linarith) (by linarith), ?_⟩ + have hd : 10 - w ≠ 0 := by linarith + have hq : 0 ≤ (w - 1) / (10 - w) := div_nonneg (by linarith) (by linarith) + have ht : 1 + (w - 1) / (10 - w) ≠ 0 := by linarith + field_simp + ring + · right; right + exact ⟨w - 10, by linarith, by ring⟩ + +end DefocusingNLS.BoundaryCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryDeterminantPositivity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryDeterminantPositivity.lean new file mode 100644 index 0000000000000000000000000000000000000000..76a3c2360e6c2d83a09776d8477e4b9442ab24e9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryDeterminantPositivity.lean @@ -0,0 +1,79 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryChartCover + +namespace OAI + +/-! # Positivity of the coherent raw boundary determinant -/ + +open Polynomial + +namespace DefocusingNLS.BoundaryCertificate + +attribute [local irreducible] GaussianEnclosure.EnclosesPolynomial + rawDeterminant evenValues homogeneousHorner transformed + +theorem certificate_first (ell : Fin 4) : positiveFirst16 (transformed ell 0 1 1) = true := by + fin_cases ell + · exact row_zero_first_positive + · exact row_one_first_positive + · exact row_two_first_positive + · exact row_three_first_positive + +theorem certificate_second (ell : Fin 4) : positiveFirst16 (transformed ell 1 10 1) = true := by + fin_cases ell + · exact row_zero_second_positive + · exact row_one_second_positive + · exact row_two_second_positive + · exact row_three_second_positive + +theorem certificate_third (ell : Fin 4) : positiveFirst16 (transformed ell 10 1 0) = true := by + fin_cases ell + · exact row_zero_third_positive + · exact row_one_third_positive + · exact row_two_third_positive + · exact row_three_third_positive + +theorem chart_value_positive (ell : Fin 4) (b Z t : ℝ) + (hb : |100000000 * b - 33477607| ≤ 2) (hZ : |100000000 * Z - 270506819| ≤ 2) + (ht : 0 ≤ t) (U V J : ℤ) (hd : 0 < 1 + (J : ℝ) * t) + (hcert : positiveFirst16 (transformed ell U V J) = true) : + 0 < ((coefficientPolynomial (evenValues ell b Z)).eval + ((((U : ℝ) + (V : ℝ) * t) / (1 + (J : ℝ) * t) : ℝ) : ℂ)).re := by + have hn : (chartNumerator U V).eval (t : ℂ) = ((((U : ℝ) + (V : ℝ) * t) : ℝ) : ℂ) := by + simp [chartNumerator] + ring + have hden : (chartDenominator J).eval (t : ℂ) = (((1 + (J : ℝ) * t) : ℝ) : ℂ) := by + simp [chartDenominator] + ring + have hden0 : (chartDenominator J).eval (t : ℂ) ≠ 0 := by + rw [hden] + exact Complex.ofReal_ne_zero.mpr hd.ne' + have h := homogeneousHorner_positive ell b Z t hb hZ ht U V J hcert + rw [homogeneousHorner_eval U V J _ _ hden0, hn, hden] at h + have hlen : (evenValues ell b Z).length - 1 = 15 := by simp [evenValues] + rw [hlen, ← Complex.ofReal_div, ← Complex.ofReal_pow] at h + simp only [Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero] at h + exact pos_of_mul_pos_right h (pow_nonneg hd.le 15) + +/-- The entire parameter box, including repeated coherent occurrences of b,Z, +has strictly positive determinant at every real frequency. -/ +theorem rawDeterminant_positive (ell : Fin 4) (b Z v : ℝ) + (hb : |100000000 * b - 33477607| ≤ 2) (hZ : |100000000 * Z - 270506819| ≤ 2) : + 0 < ((rawDeterminant ell b Z).eval (v : ℂ)).re := by + rw [rawDeterminant_eval_square] + rcases nonnegative_chart_cover (v ^ 2) (sq_nonneg v) with h | h | h + · obtain ⟨t, ht, he⟩ := h + rw [he] + simpa using chart_value_positive ell b Z t hb hZ ht 0 1 1 + (by norm_num; linarith) (certificate_first ell) + · obtain ⟨t, ht, he⟩ := h + rw [he] + simpa using chart_value_positive ell b Z t hb hZ ht 1 10 1 + (by norm_num; linarith) (certificate_second ell) + · obtain ⟨t, ht, he⟩ := h + rw [he] + simpa using chart_value_positive ell b Z t hb hZ ht 10 1 0 + (by norm_num) (certificate_third ell) + +end DefocusingNLS.BoundaryCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryDiagonalCertificate.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryDiagonalCertificate.lean new file mode 100644 index 0000000000000000000000000000000000000000..5a0ad93637e2461efd9a415f4cec89be745b6579 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryDiagonalCertificate.lean @@ -0,0 +1,47 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryDeterminantPositivity + +namespace OAI + +/-! # A positive first diagonal value for the boundary Hermitian matrix -/ + +open Polynomial + +namespace DefocusingNLS.BoundaryCertificate +open GaussianEnclosure + +def firstDiagonal (ell : ℕ) : EnclosurePolynomial := + let xy := state ell 8 + symmetrize (hermitian ell xy.1.1 xy.2.1 xy.1.1 xy.2.1) + +theorem firstDiagonal_zero_positive (ell : Fin 4) : + ((firstDiagonal ell)[0]?.getD zero).error < + ((firstDiagonal ell)[0]?.getD zero).center.re := by + fin_cases ell <;> decide +kernel + +noncomputable def rawFirstDiagonal (ell : ℕ) (b Z : ℝ) : Polynomial ℂ := + reflectedHermitianPolynomial (scaledMass ell) (scaledShift Z) + (stateMatrix (polynomialState ell b Z 8)) 0 0 + +attribute [local irreducible] state polynomialState + +theorem rawFirstDiagonal_sound (ell : ℕ) (b Z : ℝ) + (hb : |100000000 * b - 33477607| ≤ 2) (hZ : |100000000 * Z - 270506819| ≤ 2) : + EnclosesPolynomial (firstDiagonal ell) (rawFirstDiagonal ell b Z) := by + obtain ⟨hx₀, _, hy₀, _⟩ := state_sound ell b Z hb hZ 8 + have h := symmetrize_sound (hermitian_sound ell _ (inputS_sound Z hZ) hx₀ hy₀ hx₀ hy₀) + convert h using 1 <;> + simp [firstDiagonal, rawFirstDiagonal, reflectedHermitianPolynomial, hermitianPolynomial, + stateMatrix, scaledMass, scaledShift] + +attribute [local irreducible] EnclosesPolynomial firstDiagonal rawFirstDiagonal + +theorem rawFirstDiagonal_at_zero_pos (ell : Fin 4) (b Z : ℝ) + (hb : |100000000 * b - 33477607| ≤ 2) (hZ : |100000000 * Z - 270506819| ≤ 2) : + 0 < ((rawFirstDiagonal ell b Z).eval 0).re := by + rw [← coeff_zero_eq_eval_zero] + exact realPart_pos (coefficient_sound (rawFirstDiagonal_sound ell b Z hb hZ) 0) + (firstDiagonal_zero_positive ell) + +end DefocusingNLS.BoundaryCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryEnclosureDeterminant.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryEnclosureDeterminant.lean new file mode 100644 index 0000000000000000000000000000000000000000..091d40af5d71b9bf8602a533730eb21b4760c372 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryEnclosureDeterminant.lean @@ -0,0 +1,99 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryEnclosureStateLink + +namespace OAI + +/-! # Structural identities for the determinant enclosed by the certificate -/ + +open Polynomial + +namespace DefocusingNLS.BoundaryCertificate +open GaussianEnclosure + +attribute [local irreducible] polynomialState state + +noncomputable def rawDeterminant (ell : ℕ) (b Z : ℝ) : Polynomial ℂ := + let T := stateMatrix (polynomialState ell b Z 8) + let S := reflectedHermitianPolynomial (scaledMass ell) (scaledShift Z) T + S 0 0 * S 1 1 - S 0 1 * conjugatePolynomial (S 0 1) + +theorem rawDeterminant_sound (ell : ℕ) (b Z : ℝ) + (hb : |100000000 * b - 33477607| ≤ 2) (hZ : |100000000 * Z - 270506819| ≤ 2) : + EnclosesPolynomial (determinant ell) (rawDeterminant ell b Z) := by + convert determinant_sound ell b Z hb hZ using 1 + simp only [rawDeterminant, reflectedHermitianPolynomial, hermitianPolynomial, + stateMatrix, Matrix.of_apply, Matrix.cons_val_zero, Matrix.cons_val_one, + scaledMass, scaledShift] + norm_cast + +theorem conjugatePolynomial_comp_scale (p : Polynomial ℂ) : + conjugatePolynomial (p.comp variableScale) = (conjugatePolynomial p).comp variableScale := by + have hc : (starRingEnd ℂ) (100000000 : ℂ) = 100000000 := + map_ofNat (starRingEnd ℂ) 100000000 + simp [conjugatePolynomial, variableScale, Polynomial.map_comp, hc] + +theorem sharpPolynomial_comp_scale (p : Polynomial ℂ) : + sharpPolynomial (p.comp variableScale) = (sharpPolynomial p).comp variableScale := by + rw [sharpPolynomial, conjugatePolynomial_comp_scale, comp_assoc, sharpPolynomial, comp_assoc] + congr 1 + simp only [variableScale, mul_comp, C_comp, X_comp] + ring + +theorem hermitianPolynomial_comp_scale (M : ℝ) (s : ℂ) + (T : Matrix (Fin 2) (Fin 2) (Polynomial ℂ)) (i j : Fin 2) : + hermitianPolynomial M s (fun a b => (T a b).comp variableScale) i j = + (hermitianPolynomial M s T i j).comp variableScale := by + simp only [hermitianPolynomial, conjugatePolynomial_comp_scale, add_comp, mul_comp, + sub_comp, C_comp] + +theorem reflectedHermitianPolynomial_comp_scale (M : ℝ) (s : ℂ) + (T : Matrix (Fin 2) (Fin 2) (Polynomial ℂ)) (i j : Fin 2) : + reflectedHermitianPolynomial M s (fun a b => (T a b).comp variableScale) i j = + (reflectedHermitianPolynomial M s T i j).comp variableScale := by + simp only [reflectedHermitianPolynomial, hermitianPolynomial_comp_scale, + sharpPolynomial_comp_scale, add_comp] + +theorem rawDeterminant_eq (ell : ℕ) (b Z : ℝ) : + rawDeterminant ell b Z = + (boundaryDeterminantPolynomial (scaledMass ell) (scaledShift Z) + (fun n => scaledConstant ell n b) 8).comp variableScale := by + have hT : stateMatrix (polynomialState ell b Z 8) = + fun i j => (boundaryForwardProduct (scaledMass ell) (scaledShift Z) + (fun n => scaledConstant ell n b) 8 i j).comp variableScale := by + apply Matrix.ext + intro i j + exact polynomialState_matrix ell b Z 8 i j + simp only [rawDeterminant, hT, reflectedHermitianPolynomial_comp_scale, + conjugatePolynomial_comp_scale, boundaryDeterminantPolynomial, sub_comp, mul_comp] + +theorem rawDeterminant_degree (ell : ℕ) (b Z : ℝ) : (rawDeterminant ell b Z).natDegree ≤ 30 := by + rw [rawDeterminant_eq] + have h := boundaryDeterminantPolynomial_degree (scaledMass ell) (scaledShift Z) + (fun n => scaledConstant ell n b) 8 (by decide) (by simp [scaledShift]) + calc + _ ≤ (boundaryDeterminantPolynomial (scaledMass ell) (scaledShift Z) + (fun n => scaledConstant ell n b) 8).natDegree * variableScale.natDegree := natDegree_comp_le + _ ≤ 30 := by simpa [variableScale] using h + +theorem rawDeterminant_coeff_im (ell : ℕ) (b Z : ℝ) (n : ℕ) : + ((rawDeterminant ell b Z).coeff n).im = 0 := by + rw [rawDeterminant_eq] + simp only [variableScale, comp_C_mul_X_coeff] + have hn : ((100000000 : ℂ) ^ n).im = 0 := by + have he : (100000000 : ℂ) = ((100000000 : ℝ) : ℂ) := by norm_num + rw [he, ← Complex.ofReal_pow] + rfl + rw [Complex.mul_im] + rw [boundaryDeterminantPolynomial_coeff_im (scaledMass ell) (scaledShift Z) + (fun n => scaledConstant ell n b) 8 n (by simp [scaledShift]), hn] + ring + +theorem rawDeterminant_coeff_odd (ell : ℕ) (b Z : ℝ) (n : ℕ) (hn : Odd n) : + (rawDeterminant ell b Z).coeff n = 0 := by + rw [rawDeterminant_eq] + simp only [variableScale, comp_C_mul_X_coeff] + rw [boundaryDeterminantPolynomial_coeff_odd (scaledMass ell) (scaledShift Z) + (fun n => scaledConstant ell n b) 8 n (by simp [scaledShift]) hn, zero_mul] + +end DefocusingNLS.BoundaryCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryEnclosureInputs.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryEnclosureInputs.lean new file mode 100644 index 0000000000000000000000000000000000000000..d1c6ac3abc5d82c4ccaea0888d7790666bffca4b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryEnclosureInputs.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryCertificateSemantics + +namespace OAI + +/-! # Parameter-box inputs to the exact boundary enclosure -/ + +open Polynomial + +namespace DefocusingNLS.BoundaryCertificate +open GaussianEnclosure + +def inputReal (ell n : ℕ) : ℤ := 50000000 * ((ell : ℤ) + 2 * (n : ℤ)) - 3125000 + +noncomputable def inputS (Z : ℝ) : Polynomial ℂ := C (Complex.I * (100000000 * Z : ℝ)) + +noncomputable def inputT (ell n : ℕ) (b : ℝ) : Polynomial ℂ := + C ((inputReal ell n : ℂ) - Complex.I * (100000000 * b : ℝ)) + + X * C (Complex.I * (100000000 : ℝ)) + +theorem inputS_sound (Z : ℝ) (hZ : |100000000 * Z - 270506819| ≤ 2) : + EnclosesPolynomial [coefficient 0 270506819 2] (inputS Z) := by + refine ⟨Complex.I * (100000000 * Z : ℝ), 0, ?_, rfl, by simp [inputS]⟩ + change ‖Complex.I * (100000000 * Z : ℝ) - + ((⟨0, 270506819⟩ : GaussianInt) : ℂ)‖ ≤ 2 + have he : Complex.I * (100000000 * Z : ℝ) - + ((⟨0, 270506819⟩ : GaussianInt) : ℂ) = + ((100000000 * Z - 270506819 : ℝ) : ℂ) * Complex.I := by + rw [GaussianInt.toComplex_def'] + push_cast + ring + rw [he, norm_mul, Complex.norm_real, Real.norm_eq_abs, Complex.norm_I, mul_one] + exact hZ + +theorem inputT_sound (ell n : ℕ) (b : ℝ) (hb : |100000000 * b - 33477607| ≤ 2) : + EnclosesPolynomial + [coefficient (inputReal ell n) (-33477607) 2, coefficient 0 100000000 0] + (inputT ell n b) := by + refine ⟨(inputReal ell n : ℂ) - Complex.I * (100000000 * b : ℝ), + C (Complex.I * (100000000 : ℝ)), ?_, ?_, rfl⟩ + · change ‖(inputReal ell n : ℂ) - Complex.I * (100000000 * b : ℝ) - + ((⟨inputReal ell n, -33477607⟩ : GaussianInt) : ℂ)‖ ≤ 2 + have he : (inputReal ell n : ℂ) - Complex.I * (100000000 * b : ℝ) - + ((⟨inputReal ell n, -33477607⟩ : GaussianInt) : ℂ) = + ((100000000 * b - 33477607 : ℝ) : ℂ) * (-Complex.I) := by + rw [GaussianInt.toComplex_def'] + push_cast + ring + rw [he, norm_mul, Complex.norm_real, Real.norm_eq_abs, norm_neg, Complex.norm_I, mul_one] + exact hb + · refine ⟨Complex.I * (100000000 : ℝ), 0, ?_, rfl, by simp⟩ + norm_num [Encloses, coefficient, GaussianInt.toComplex_def', mul_comm] + +end DefocusingNLS.BoundaryCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryEnclosureState.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryEnclosureState.lean new file mode 100644 index 0000000000000000000000000000000000000000..de5ce106ca0f0c86e61e0438172d65197c7ecf1e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryEnclosureState.lean @@ -0,0 +1,83 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryEnclosureInputs + +namespace OAI + +/-! # Soundness of the complete uncertain forward recurrence -/ + +open Polynomial + +namespace DefocusingNLS.BoundaryCertificate +open GaussianEnclosure + +abbrev PolynomialState := ((Polynomial ℂ × Polynomial ℂ) × (Polynomial ℂ × Polynomial ℂ)) + +noncomputable def polynomialStep (M s t : Polynomial ℂ) (xy : PolynomialState) : PolynomialState := + let x₀ := t * xy.1.1 + s * xy.2.1 + let x₁ := t * xy.1.2 + s * xy.2.2 + ((x₀, x₁), ((t - M) * xy.2.1 - x₀, (t - M) * xy.2.2 - x₁)) + +noncomputable def polynomialState (ell : ℕ) (b Z : ℝ) : ℕ → PolynomialState + | 0 => ((1, 0), (0, 1)) + | n + 1 => polynomialStep (C ((100000000 * (ell + 5) : ℤ) : ℂ)) + (inputS Z) (inputT ell n b) (polynomialState ell b Z n) + +def EnclosesState (xy : State) (pq : PolynomialState) : Prop := + EnclosesPolynomial xy.1.1 pq.1.1 ∧ EnclosesPolynomial xy.1.2 pq.1.2 ∧ + EnclosesPolynomial xy.2.1 pq.2.1 ∧ EnclosesPolynomial xy.2.2 pq.2.2 + +theorem step_sound (ell n : ℕ) (b Z : ℝ) + (hb : |100000000 * b - 33477607| ≤ 2) (hZ : |100000000 * Z - 270506819| ≤ 2) + {xy : State} {pq : PolynomialState} (h : EnclosesState xy pq) : + EnclosesState (step ell n xy) + (polynomialStep (C ((100000000 * (ell + 5) : ℤ) : ℂ)) (inputS Z) (inputT ell n b) pq) := by + obtain ⟨hx₀, hx₁, hy₀, hy₁⟩ := h + have ht := inputT_sound ell n b hb + have hs := inputS_sound Z hZ + have hM := constant_sound (100000000 * (ell + 5)) + have hd := subPolynomial_sound ht hM + have hx₀' := addPolynomial_sound (mulPolynomial_sound ht hx₀) (mulPolynomial_sound hs hy₀) + have hx₁' := addPolynomial_sound (mulPolynomial_sound ht hx₁) (mulPolynomial_sound hs hy₁) + exact ⟨hx₀', hx₁', subPolynomial_sound (mulPolynomial_sound hd hy₀) hx₀', + subPolynomial_sound (mulPolynomial_sound hd hy₁) hx₁'⟩ + +/-- Every coefficient enclosure is valid for the same actual parameter pair. -/ +theorem state_sound (ell : ℕ) (b Z : ℝ) + (hb : |100000000 * b - 33477607| ≤ 2) (hZ : |100000000 * Z - 270506819| ≤ 2) + (n : ℕ) : EnclosesState (state ell n) (polynomialState ell b Z n) := by + induction n with + | zero => + exact ⟨by simpa [state, polynomialState] using constant_sound 1, + by simpa [state, polynomialState] using constant_sound 0, + by simpa [state, polynomialState] using constant_sound 0, + by simpa [state, polynomialState] using constant_sound 1⟩ + | succ n ih => exact step_sound ell n b Z hb hZ ih + +attribute [local irreducible] state polynomialState + +/-- The raw determinant enclosure bounds the coherent determinant before any +reality, parity or degree truncation is applied. -/ +theorem determinant_sound (ell : ℕ) (b Z : ℝ) + (hb : |100000000 * b - 33477607| ≤ 2) (hZ : |100000000 * Z - 270506819| ≤ 2) : + let pq := polynomialState ell b Z 8 + let M := ((100000000 * (ell + 5) : ℤ) : ℂ) + let s := Complex.I * (100000000 * Z : ℝ) + let A := C M * conjugatePolynomial pq.1.1 * pq.1.1 + + C s * (conjugatePolynomial pq.1.1 * pq.2.1 - conjugatePolynomial pq.2.1 * pq.1.1) + let D := C M * conjugatePolynomial pq.1.2 * pq.1.2 + + C s * (conjugatePolynomial pq.1.2 * pq.2.2 - conjugatePolynomial pq.2.2 * pq.1.2) + let C' := C M * conjugatePolynomial pq.1.1 * pq.1.2 + + C s * (conjugatePolynomial pq.1.1 * pq.2.2 - conjugatePolynomial pq.2.1 * pq.1.2) + EnclosesPolynomial (determinant ell) + ((A + sharpPolynomial A) * (D + sharpPolynomial D) - + (C' + sharpPolynomial C') * conjugatePolynomial (C' + sharpPolynomial C')) := by + obtain ⟨hx₀, hx₁, hy₀, hy₁⟩ := state_sound ell b Z hb hZ 8 + have hs := inputS_sound Z hZ + have hA := symmetrize_sound (hermitian_sound ell _ hs hx₀ hy₀ hx₀ hy₀) + have hD := symmetrize_sound (hermitian_sound ell _ hs hx₁ hy₁ hx₁ hy₁) + have hC := symmetrize_sound (hermitian_sound ell _ hs hx₀ hy₀ hx₁ hy₁) + exact subPolynomial_sound (mulPolynomial_sound hA hD) + (mulPolynomial_sound hC (conjPolynomial_sound hC)) + +end DefocusingNLS.BoundaryCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryEnclosureStateLink.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryEnclosureStateLink.lean new file mode 100644 index 0000000000000000000000000000000000000000..641c5a46ad2864c1b77135e137fba446d120538f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryEnclosureStateLink.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryEnclosureState +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryPolynomialParity + +namespace OAI + +/-! # The coherent enclosure state is the polynomial forward matrix -/ + +open Polynomial Matrix + +namespace DefocusingNLS.BoundaryCertificate + +attribute [local irreducible] polynomialState + +noncomputable def stateMatrix (pq : PolynomialState) : Matrix (Fin 2) (Fin 2) (Polynomial ℂ) := + !![pq.1.1, pq.1.2; pq.2.1, pq.2.2] + +noncomputable def scaledConstant (ell n : ℕ) (b : ℝ) : ℂ := + (inputReal ell n : ℂ) - Complex.I * (100000000 * b : ℝ) + +noncomputable def scaledMass (ell : ℕ) : ℝ := (100000000 * (ell + 5) : ℤ) + +noncomputable def scaledShift (Z : ℝ) : ℂ := Complex.I * (100000000 * Z : ℝ) + +noncomputable def variableScale : Polynomial ℂ := C (100000000 : ℂ) * X + +theorem polynomialStep_matrix (M s t : Polynomial ℂ) (pq : PolynomialState) : + stateMatrix (polynomialStep M s t pq) = + (!![t, s; -t, t - M - s] : Matrix (Fin 2) (Fin 2) (Polynomial ℂ)) * stateMatrix pq := by + apply Matrix.ext + intro i j + fin_cases i <;> fin_cases j <;> + simp [stateMatrix, polynomialStep, Matrix.mul_apply, Fin.sum_univ_two] <;> ring + +theorem inputT_eq_comp (ell n : ℕ) (b : ℝ) : + inputT ell n b = (boundaryLinear (scaledConstant ell n b)).comp variableScale := by + have hc : C (Complex.I * (100000000 : ℝ)) = + C Complex.I * C (100000000 : ℂ) := by norm_num [map_mul] + simp only [inputT, boundaryLinear, scaledConstant, variableScale, add_comp, + mul_comp, C_comp, X_comp, hc] + ring + +theorem boundaryForwardStep_scaled_comp (ell n : ℕ) (b Z : ℝ) (i j : Fin 2) : + ((boundaryForwardStep (scaledMass ell) (scaledShift Z) (scaledConstant ell n b) i j).comp + variableScale) = + (!![inputT ell n b, inputS Z; -inputT ell n b, + inputT ell n b - C ((100000000 * (ell + 5) : ℤ) : ℂ) - inputS Z] : + Matrix (Fin 2) (Fin 2) (Polynomial ℂ)) i j := by + fin_cases i <;> fin_cases j <;> + simp [boundaryForwardStep, ← inputT_eq_comp, inputS, scaledShift, scaledMass] + +/-- This identity connects the exact uncertain-coefficient recursion to the +parameter-uniform polynomial degree and parity theorems. -/ +theorem polynomialState_matrix (ell : ℕ) (b Z : ℝ) (K : ℕ) (i j : Fin 2) : + stateMatrix (polynomialState ell b Z K) i j = + (boundaryForwardProduct (scaledMass ell) (scaledShift Z) + (fun n => scaledConstant ell n b) K i j).comp variableScale := by + induction K generalizing i j with + | zero => fin_cases i <;> fin_cases j <;> simp [polynomialState, stateMatrix, boundaryForwardProduct] + | succ K ih => + rw [polynomialState, polynomialStep_matrix] + simp only [Matrix.mul_apply, Fin.sum_univ_two, ih, boundaryForwardProduct, + add_comp, mul_comp] + rw [boundaryForwardStep_scaled_comp, boundaryForwardStep_scaled_comp] + +end DefocusingNLS.BoundaryCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryEvenCoefficients.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryEvenCoefficients.lean new file mode 100644 index 0000000000000000000000000000000000000000..83691447a306bca5e5d0efd68ae9728a45d4756d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryEvenCoefficients.lean @@ -0,0 +1,51 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryEnclosureDeterminant +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryHornerTransform +import Mathlib.Data.List.Forall2 + +namespace OAI + +/-! # Extracting the coherent determinant's even coefficients -/ + +open Polynomial + +namespace DefocusingNLS.BoundaryCertificate +open GaussianEnclosure + +attribute [local irreducible] rawDeterminant determinant state polynomialState + +noncomputable def evenValues (ell : ℕ) (b Z : ℝ) : List ℂ := + (List.range 16).map fun j => (rawDeterminant ell b Z).coeff (2 * j) + +theorem evenCoefficients_sound (ell : ℕ) (b Z : ℝ) + (hb : |100000000 * b - 33477607| ≤ 2) (hZ : |100000000 * Z - 270506819| ≤ 2) : + List.Forall₂ (fun a z => a.Encloses z) (evenCoefficients ell) (evenValues ell b Z) := by + rw [evenCoefficients, evenValues, List.forall₂_map_left_iff, + List.forall₂_map_right_iff, List.forall₂_same] + intro j _ + have h := realPart_sound (coefficient_sound (rawDeterminant_sound ell b Z hb hZ) (2 * j)) + have hr : (((rawDeterminant ell b Z).coeff (2 * j)).re : ℂ) = + (rawDeterminant ell b Z).coeff (2 * j) := by + apply Complex.ext + · rfl + · simpa only [Complex.ofReal_im] using (rawDeterminant_coeff_im ell b Z (2 * j)).symm + rw [hr] at h + exact h + +attribute [local irreducible] transformAux polynomialTransformAux evenCoefficients evenValues + +/-- The actual homogeneous transform is enclosed by precisely the list whose +sixteen coefficient inequalities were checked in the kernel. -/ +theorem transformed_sound (ell : ℕ) (b Z : ℝ) + (hb : |100000000 * b - 33477607| ≤ 2) (hZ : |100000000 * Z - 270506819| ≤ 2) + (U V J : ℤ) : + EnclosesPolynomial (transformed ell U V J) + (homogeneousHorner U V J (evenValues ell b Z)) := by + have h := transformAux_sound U V J (q := constant 0) (m := constant 1) (Q := 0) (M := 1) + (List.forall₂_reverse_iff.mpr (evenCoefficients_sound ell b Z hb hZ)) + (by simpa using constant_sound 0) (by simpa using constant_sound 1) + rw [polynomialTransformAux_reverse] at h + exact h.1 + +end DefocusingNLS.BoundaryCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryEvenPolynomial.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryEvenPolynomial.lean new file mode 100644 index 0000000000000000000000000000000000000000..52533e10f21fa5444b6ae84ce3706f26a1cc2547 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryEvenPolynomial.lean @@ -0,0 +1,54 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryHornerEvaluation +import Mathlib.Algebra.Polynomial.Expand + +namespace OAI + +/-! # Recovering the raw determinant from its sixteen even coefficients -/ + +open Polynomial + +namespace DefocusingNLS.BoundaryCertificate + +attribute [local irreducible] rawDeterminant determinant state polynomialState + +theorem coefficientPolynomial_coeff (as : List ℂ) (n : ℕ) : + (coefficientPolynomial as).coeff n = as[n]?.getD 0 := by + induction as generalizing n with + | nil => simp [coefficientPolynomial] + | cons a as ih => + cases n with + | zero => simp [coefficientPolynomial] + | succ n => simp [coefficientPolynomial, coeff_X_mul, ih] + +theorem coefficientPolynomial_evenValues (ell : ℕ) (b Z : ℝ) (n : ℕ) : + (coefficientPolynomial (evenValues ell b Z)).coeff n = + (rawDeterminant ell b Z).coeff (2 * n) := by + rw [coefficientPolynomial_coeff] + by_cases hn : n < 16 + · simp only [evenValues, List.getElem?_map, List.getElem?_range hn, Option.map_some, + Option.getD_some] + · have hn' : (List.range 16)[n]? = none := List.getElem?_eq_none (by simp; omega) + simp only [evenValues, List.getElem?_map, hn', Option.map_none, Option.getD_none] + exact (coeff_eq_zero_of_natDegree_lt ((rawDeterminant_degree ell b Z).trans_lt (by omega))).symm + +theorem rawDeterminant_eq_expand_even (ell : ℕ) (b Z : ℝ) : + expand ℂ 2 (coefficientPolynomial (evenValues ell b Z)) = rawDeterminant ell b Z := by + ext n + rw [coeff_expand (by decide : 0 < 2)] + split_ifs with hd + · rw [coefficientPolynomial_evenValues] + congr 1 + omega + · rcases Nat.even_or_odd n with he | ho + · exact (hd he.two_dvd).elim + · exact (rawDeterminant_coeff_odd ell b Z n ho).symm + +theorem rawDeterminant_eval_square (ell : ℕ) (b Z v : ℝ) : + (rawDeterminant ell b Z).eval (v : ℂ) = + (coefficientPolynomial (evenValues ell b Z)).eval ((v ^ 2 : ℝ) : ℂ) := by + rw [← rawDeterminant_eq_expand_even, expand_eval] + norm_cast + +end DefocusingNLS.BoundaryCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryFormEvaluation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryFormEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..25d0608a763449fba36778778a71cbc15bc3536d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryFormEvaluation.lean @@ -0,0 +1,64 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryDiagonalCertificate +import Mathlib.Topology.Algebra.Polynomial + +namespace OAI + +/-! # Evaluation of the certified Hermitian polynomial -/ + +open Polynomial Matrix + +namespace DefocusingNLS + +theorem conjugatePolynomial_eval_real (p : Polynomial ℂ) (v : ℝ) : + (conjugatePolynomial p).eval (v : ℂ) = star (p.eval (v : ℂ)) := by + simpa [conjugatePolynomial] using + (Polynomial.eval_map_apply (p := p) (starRingEnd ℂ) (v : ℂ)) + +theorem sharpPolynomial_eval_real (p : Polynomial ℂ) (v : ℝ) : + (sharpPolynomial p).eval (v : ℂ) = star (p.eval ((-v : ℝ) : ℂ)) := by + simp only [sharpPolynomial, eval_comp, eval_mul, eval_C, eval_X] + simpa using conjugatePolynomial_eval_real p (-v) + +theorem hermitianPolynomial_eval (M : ℝ) (s : ℂ) + (T : Matrix (Fin 2) (Fin 2) (Polynomial ℂ)) (v : ℝ) (i j : Fin 2) : + (hermitianPolynomial M s T i j).eval (v : ℂ) = + forwardFormEntry M s (fun a b => (T a b).eval (v : ℂ)) i j := by + simp only [hermitianPolynomial, eval_add, eval_mul, eval_sub, eval_C, + conjugatePolynomial_eval_real, forwardFormEntry] + +theorem forwardFormEntry_conjugate (M : ℝ) (s : ℂ) + (T : Matrix (Fin 2) (Fin 2) ℂ) (i j : Fin 2) : + star (forwardFormEntry M s T i j) = + forwardFormEntry M (star s) (fun a b => star (T a b)) i j := by + simp only [forwardFormEntry, star_add, star_mul, star_sub, + Complex.star_def, Complex.conj_ofReal] + ring + +/-- Reflection of the polynomial is exactly the second conjugate channel. -/ +theorem reflectedHermitianPolynomial_eval (M : ℝ) (s : ℂ) + (T : Matrix (Fin 2) (Fin 2) (Polynomial ℂ)) (v : ℝ) (i j : Fin 2) : + (reflectedHermitianPolynomial M s T i j).eval (v : ℂ) = + forwardFormEntry M s (fun a b => (T a b).eval (v : ℂ)) i j + + forwardFormEntry M (star s) (fun a b => star ((T a b).eval ((-v : ℝ) : ℂ))) i j := by + rw [reflectedHermitianPolynomial, eval_add, sharpPolynomial_eval_real, + hermitianPolynomial_eval, hermitianPolynomial_eval] + exact congrArg (fun z => forwardFormEntry M s (fun a b => (T a b).eval (v : ℂ)) i j + z) + (forwardFormEntry_conjugate M s (fun a b => (T a b).eval ((-v : ℝ) : ℂ)) i j) + +theorem reflectedHermitianPolynomial_eval_diagonal (M : ℝ) (s : ℂ) + (T : Matrix (Fin 2) (Fin 2) (Polynomial ℂ)) (hs : s.re = 0) (v : ℝ) (i : Fin 2) : + (reflectedHermitianPolynomial M s T i i).eval (v : ℂ) = + (((reflectedHermitianPolynomial M s T i i).eval (v : ℂ)).re : ℂ) := by + have h := congrArg (fun p : Polynomial ℂ => p.eval (v : ℂ)) + (reflectedHermitian_conjugate_transpose M s T hs i i) + rw [conjugatePolynomial_eval_real] at h + have hi := congrArg Complex.im h + simp only [Complex.star_def, Complex.conj_im] at hi + apply Complex.ext + · rfl + · simp only [Complex.ofReal_im] + linarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryForwardScaling.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryForwardScaling.lean new file mode 100644 index 0000000000000000000000000000000000000000..106f0119d1689f9ac69bfaf9387bf72f5d4c0cf8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryForwardScaling.lean @@ -0,0 +1,74 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryPositiveForm + +namespace OAI + +/-! # Removal of the integer scaling in the boundary certificate -/ + +open Polynomial Matrix + +namespace DefocusingNLS.BoundaryCertificate + +noncomputable def boundaryQ (ell : ℕ) (b v : ℝ) : ℂ := + (((ell : ℝ) / 2 - 1 / 32 : ℝ) : ℂ) + Complex.I * (v - b : ℝ) + +theorem inputT_eval_scaled (ell n : ℕ) (b v : ℝ) : + (inputT ell n b).eval (v : ℂ) = + (100000000 : ℂ) * (boundaryQ ell b v + n) := by + simp only [inputT, eval_add, eval_C, eval_mul, eval_X, boundaryQ, inputReal] + push_cast + ring + +attribute [local irreducible] polynomialState + +theorem polynomialState_eval_scaled (ell : ℕ) (b Z v : ℝ) (N : ℕ) (i j : Fin 2) : + ((stateMatrix (polynomialState ell b Z N)) i j).eval (v : ℂ) = + (100000000 : ℂ) ^ N * forwardProduct (ell + 5) (Complex.I * Z) + (boundaryQ ell b v) N i j := by + induction N generalizing i j with + | zero => fin_cases i <;> fin_cases j <;> simp [polynomialState, stateMatrix, forwardProduct] + | succ N ih => + rw [polynomialState, polynomialStep_matrix] + simp only [Matrix.mul_apply, Fin.sum_univ_two, eval_add, eval_mul, ih] + have ht := inputT_eval_scaled ell N b v + fin_cases i <;> fin_cases j <;> + simp [forwardProduct, forwardMatrix, Matrix.mul_apply, Fin.sum_univ_two, + eval_sub, eval_neg, eval_C, inputS, ht, pow_succ] <;> ring + +theorem forwardProduct_conjugate (M : ℝ) (s q : ℂ) (N : ℕ) (i j : Fin 2) : + star (forwardProduct (M : ℂ) s q N i j) = + forwardProduct (M : ℂ) (star s) (star q) N i j := by + induction N generalizing i j with + | zero => fin_cases i <;> fin_cases j <;> simp [forwardProduct] + | succ N ih => + simp only [forwardProduct, Matrix.mul_apply, Fin.sum_univ_two, star_add, star_mul, ih] + have hs (a c : Fin 2) : star (forwardMatrix (M : ℂ) s (q + N) a c) = + forwardMatrix (M : ℂ) (star s) (star q + N) a c := by + fin_cases a <;> fin_cases c <;> simp [forwardMatrix] + rw [hs, hs] + ring + +theorem boundaryQ_conjugate (ell : ℕ) (b v : ℝ) : + star (boundaryQ ell b (-v)) = boundaryQ ell (-b) v := by + simp only [boundaryQ, star_add, star_mul, Complex.star_def, Complex.conj_ofReal, + Complex.conj_I] + push_cast + ring + +theorem coneForm_scale_parameters (h M : ℝ) (s B C : ℂ) : + coneForm (h * M) ((h : ℂ) * s) B C = h * coneForm M s B C := by + simp only [coneForm, Complex.mul_re, Complex.mul_im, Complex.ofReal_re, + Complex.ofReal_im, zero_mul, sub_zero] + ring + +theorem matrixCone_real_scaling (h a M : ℝ) (s : ℂ) + (T : Matrix (Fin 2) (Fin 2) ℂ) (w : Fin 2 → ℂ) : + matrixCone (h * M) ((h : ℂ) * s) ((a : ℂ) • T) w = + h * a ^ 2 * matrixCone M s T w := by + simp only [matrixCone, Matrix.smul_mulVec, Pi.smul_apply, smul_eq_mul] + rw [coneForm_scale, coneForm_scale_parameters] + simp only [Complex.normSq_ofReal] + ring + +end DefocusingNLS.BoundaryCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryHermitianPolynomial.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryHermitianPolynomial.lean new file mode 100644 index 0000000000000000000000000000000000000000..59a0f391ef95f9db1fd802bd4ba7bee1ac86d259 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryHermitianPolynomial.lean @@ -0,0 +1,87 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryPolynomial +import Mathlib.Algebra.Polynomial.Eval.Degree + +namespace OAI + +/-! # Hermitian polynomial and its reflected boundary sum -/ + +open Polynomial Matrix + +namespace DefocusingNLS + +noncomputable def conjugatePolynomial (p : Polynomial ℂ) : Polynomial ℂ := + p.map (starRingEnd ℂ) + +noncomputable def sharpPolynomial (p : Polynomial ℂ) : Polynomial ℂ := + (conjugatePolynomial p).comp (C (-1) * X) + +theorem coeff_conjugatePolynomial (p : Polynomial ℂ) (n : ℕ) : + (conjugatePolynomial p).coeff n = star (p.coeff n) := by + simp [conjugatePolynomial] + +theorem coeff_sharpPolynomial (p : Polynomial ℂ) (n : ℕ) : + (sharpPolynomial p).coeff n = star (p.coeff n) * (-1) ^ n := by + rw [sharpPolynomial, comp_C_mul_X_coeff, coeff_conjugatePolynomial] + +theorem conjugatePolynomial_degree (p : Polynomial ℂ) : + (conjugatePolynomial p).natDegree ≤ p.natDegree := natDegree_map_le + +theorem sharpPolynomial_degree (p : Polynomial ℂ) : + (sharpPolynomial p).natDegree ≤ p.natDegree := by + apply natDegree_le_iff_coeff_eq_zero.mpr + intro n hn + rw [coeff_sharpPolynomial, coeff_eq_zero_of_natDegree_lt hn, star_zero, zero_mul] + +noncomputable def hermitianPolynomial (M : ℝ) (s : ℂ) + (T : Matrix (Fin 2) (Fin 2) (Polynomial ℂ)) (i j : Fin 2) : Polynomial ℂ := + C (M : ℂ) * conjugatePolynomial (T 0 i) * T 0 j + + C s * (conjugatePolynomial (T 0 i) * T 1 j - conjugatePolynomial (T 1 i) * T 0 j) + +theorem hermitianPolynomial_degree (M : ℝ) (s : ℂ) + (T : Matrix (Fin 2) (Fin 2) (Polynomial ℂ)) (K : ℕ) + (hT : ∀ i j, (T i j).natDegree ≤ K) (i j : Fin 2) : + (hermitianPolynomial M s T i j).natDegree ≤ 2 * K := by + have hp (a b c d : Fin 2) : + (conjugatePolynomial (T a b) * T c d).natDegree ≤ 2 * K := by + exact natDegree_mul_le.trans ((add_le_add + ((conjugatePolynomial_degree _).trans (hT a b)) (hT c d)).trans (by omega)) + apply natDegree_add_le_of_degree_le + · simpa only [mul_assoc] using + (natDegree_C_mul_le (M : ℂ) (conjugatePolynomial (T 0 i) * T 0 j)).trans (hp ..) + · exact (natDegree_C_mul_le _ _).trans + ((natDegree_sub_le_of_le (hp 0 i 1 j) (hp 1 i 0 j)).trans (by simp)) + +theorem hermitianPolynomial_top (M : ℝ) (s : ℂ) + (T : Matrix (Fin 2) (Fin 2) (Polynomial ℂ)) (K : ℕ) + (hT : ∀ i j, (T i j).natDegree ≤ K) (i j : Fin 2) : + (hermitianPolynomial M s T i j).coeff (2 * K) = + forwardFormEntry M s (fun a b => (T a b).coeff K) i j := by + have hc (a b c d : Fin 2) : + (conjugatePolynomial (T a b) * T c d).coeff (2 * K) = + star ((T a b).coeff K) * (T c d).coeff K := by + rw [show 2 * K = K + K by omega, coeff_mul_add_eq_of_natDegree_le + ((conjugatePolynomial_degree _).trans (hT a b)) (hT c d), coeff_conjugatePolynomial] + simp only [hermitianPolynomial, mul_assoc, coeff_add, coeff_C_mul, coeff_sub, hc, + forwardFormEntry] + +noncomputable def reflectedHermitianPolynomial (M : ℝ) (s : ℂ) + (T : Matrix (Fin 2) (Fin 2) (Polynomial ℂ)) (i j : Fin 2) : Polynomial ℂ := + hermitianPolynomial M s T i j + sharpPolynomial (hermitianPolynomial M s T i j) + +theorem reflectedHermitianPolynomial_degree (M : ℝ) (s : ℂ) + (T : Matrix (Fin 2) (Fin 2) (Polynomial ℂ)) (K : ℕ) + (hT : ∀ i j, (T i j).natDegree ≤ K) (i j : Fin 2) : + (reflectedHermitianPolynomial M s T i j).natDegree ≤ 2 * K := + natDegree_add_le_of_degree_le (hermitianPolynomial_degree M s T K hT i j) + ((sharpPolynomial_degree _).trans (hermitianPolynomial_degree M s T K hT i j)) + +theorem reflectedHermitianPolynomial_coefficient (M : ℝ) (s : ℂ) + (T : Matrix (Fin 2) (Fin 2) (Polynomial ℂ)) (i j : Fin 2) (n : ℕ) : + (reflectedHermitianPolynomial M s T i j).coeff n = + (hermitianPolynomial M s T i j).coeff n + + star ((hermitianPolynomial M s T i j).coeff n) * (-1) ^ n := by + simp only [reflectedHermitianPolynomial, coeff_add, coeff_sharpPolynomial] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryHornerEvaluation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryHornerEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..f10fbba4591cdcd5619041d6adcceb48fd0e4027 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryHornerEvaluation.lean @@ -0,0 +1,80 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryEvenCoefficients +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryPositiveEvaluation + +namespace OAI + +/-! # Degree and rational-substitution identity for the chart transform -/ + +open Polynomial + +namespace DefocusingNLS.BoundaryCertificate + +noncomputable def coefficientPolynomial : List ℂ → Polynomial ℂ + | [] => 0 + | a :: as => C a + X * coefficientPolynomial as + +theorem chartNumerator_degree (U V : ℤ) : (chartNumerator U V).natDegree ≤ 1 := by + apply natDegree_add_le_of_degree_le + · simp + · exact natDegree_mul_le.trans (by simp) + +theorem chartDenominator_degree (J : ℤ) : (chartDenominator J).natDegree ≤ 1 := by + apply natDegree_add_le_of_degree_le + · simp + · exact natDegree_mul_le.trans (by simp) + +theorem homogeneousHorner_cons_degree (U V J : ℤ) (a : ℂ) (as : List ℂ) : + (homogeneousHorner U V J (a :: as)).natDegree ≤ as.length := by + induction as generalizing a with + | nil => simp [homogeneousHorner] + | cons b as ih => + change (C a * chartDenominator J ^ (b :: as).length + + chartNumerator U V * homogeneousHorner U V J (b :: as)).natDegree ≤ (b :: as).length + apply natDegree_add_le_of_degree_le + · exact (natDegree_C_mul_le _ _).trans + ((natDegree_pow_le_of_le _ (chartDenominator_degree J)).trans (by simp)) + · exact natDegree_mul_le.trans ((add_le_add (chartNumerator_degree U V) (ih b)).trans (by simp; omega)) + +theorem homogeneousHorner_degree (U V J : ℤ) (as : List ℂ) : + (homogeneousHorner U V J as).natDegree ≤ as.length - 1 := by + cases as with + | nil => simp [homogeneousHorner] + | cons a as => simpa using homogeneousHorner_cons_degree U V J a as + +theorem homogeneousHorner_eval (U V J : ℤ) (as : List ℂ) (x : ℂ) + (hd : (chartDenominator J).eval x ≠ 0) : + (homogeneousHorner U V J as).eval x = + (chartDenominator J).eval x ^ (as.length - 1) * + (coefficientPolynomial as).eval ((chartNumerator U V).eval x / (chartDenominator J).eval x) := by + induction as with + | nil => simp [homogeneousHorner, coefficientPolynomial] + | cons a as ih => + cases as with + | nil => simp [homogeneousHorner, coefficientPolynomial] + | cons b as => + conv_lhs => rw [homogeneousHorner] + simp only [eval_add, eval_mul, eval_C, eval_pow, List.length_cons] + rw [ih] + simp only [coefficientPolynomial, eval_add, eval_C, eval_mul, eval_X, + List.length_cons, Nat.add_sub_cancel] + field_simp [hd] + ring + +attribute [local irreducible] GaussianEnclosure.EnclosesPolynomial + homogeneousHorner evenValues transformed + +/-- Each of the three exact certificate charts is strictly positive on its +nonnegative parameter half-line, throughout the actual parameter box. -/ +theorem homogeneousHorner_positive (ell : Fin 4) (b Z w : ℝ) + (hb : |100000000 * b - 33477607| ≤ 2) (hZ : |100000000 * Z - 270506819| ≤ 2) + (hw : 0 ≤ w) (U V J : ℤ) + (hcert : positiveFirst16 (transformed ell U V J) = true) : + 0 < ((homogeneousHorner U V J (evenValues ell b Z)).eval (w : ℂ)).re := by + apply positive_eval_of_positiveFirst16 _ _ hcert (transformed_sound ell b Z hb hZ U V J) + · have hd := homogeneousHorner_degree U V J (evenValues ell b Z) + simpa [evenValues] using hd + · exact hw + +end DefocusingNLS.BoundaryCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryHornerTransform.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryHornerTransform.lean new file mode 100644 index 0000000000000000000000000000000000000000..97c317bab58a2624288ab8c8921ab1e091aa0e7b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryHornerTransform.lean @@ -0,0 +1,82 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryCertificateSemantics + +namespace OAI + +/-! # Sound homogeneous Horner transforms for the three certificate charts -/ + +open Polynomial + +namespace DefocusingNLS.BoundaryCertificate +open GaussianEnclosure + +noncomputable def chartNumerator (U V : ℤ) : Polynomial ℂ := C (U : ℂ) + X * C (V : ℂ) +noncomputable def chartDenominator (J : ℤ) : Polynomial ℂ := 1 + X * C (J : ℂ) + +noncomputable def polynomialTransformAux (U V J : ℤ) : List ℂ → + Polynomial ℂ × Polynomial ℂ → Polynomial ℂ × Polynomial ℂ + | [], qm => qm + | a :: as, qm => polynomialTransformAux U V J as + (qm.1 * chartNumerator U V + qm.2 * C a, qm.2 * chartDenominator J) + +noncomputable def homogeneousHorner (U V J : ℤ) : List ℂ → Polynomial ℂ + | [] => 0 + | a :: as => C a * chartDenominator J ^ as.length + chartNumerator U V * homogeneousHorner U V J as + +theorem chartNumerator_sound (U V : ℤ) : + EnclosesPolynomial [coefficient U 0 0, coefficient V 0 0] (chartNumerator U V) := by + refine ⟨(U : ℂ), C (V : ℂ), ?_, ?_, rfl⟩ + · simpa [constant] using coefficient_sound (constant_sound U) 0 + · exact constant_sound V + +theorem chartDenominator_sound (J : ℤ) : + EnclosesPolynomial [coefficient 1 0 0, coefficient J 0 0] (chartDenominator J) := by + simpa [chartDenominator, chartNumerator] using chartNumerator_sound 1 J + +theorem polynomialTransformAux_append (U V J : ℤ) (as bs : List ℂ) + (qm : Polynomial ℂ × Polynomial ℂ) : + polynomialTransformAux U V J (as ++ bs) qm = + polynomialTransformAux U V J bs (polynomialTransformAux U V J as qm) := by + induction as generalizing qm with + | nil => rfl + | cons a as ih => exact ih _ + +theorem polynomialTransformAux_second (U V J : ℤ) (as : List ℂ) + (qm : Polynomial ℂ × Polynomial ℂ) : + (polynomialTransformAux U V J as qm).2 = qm.2 * chartDenominator J ^ as.length := by + induction as generalizing qm with + | nil => simp [polynomialTransformAux] + | cons a as ih => + rw [polynomialTransformAux, ih] + simp only [List.length_cons, pow_succ] + ring + +theorem polynomialTransformAux_reverse (U V J : ℤ) (as : List ℂ) : + (polynomialTransformAux U V J as.reverse (0, 1)).1 = homogeneousHorner U V J as := by + induction as with + | nil => rfl + | cons a as ih => + rw [List.reverse_cons, polynomialTransformAux_append] + simp only [polynomialTransformAux] + rw [ih, polynomialTransformAux_second] + simp only [one_mul, List.length_reverse, homogeneousHorner] + ring + +theorem transformAux_sound (U V J : ℤ) {as : List GaussianEnclosure} {zs : List ℂ} + (has : List.Forall₂ (fun a z => a.Encloses z) as zs) + {q m : EnclosurePolynomial} {Q M : Polynomial ℂ} + (hq : EnclosesPolynomial q Q) (hm : EnclosesPolynomial m M) : + EnclosesPolynomial (transformAux U V J as (q, m)).1 + (polynomialTransformAux U V J zs (Q, M)).1 ∧ + EnclosesPolynomial (transformAux U V J as (q, m)).2 + (polynomialTransformAux U V J zs (Q, M)).2 := by + induction has generalizing q m Q M with + | nil => exact ⟨hq, hm⟩ + | @cons a z as zs hz htail ih => + apply ih + · exact addPolynomial_sound (mulPolynomial_sound hq (chartNumerator_sound U V)) + (mulPolynomial_sound hm ⟨z, 0, hz, rfl, by simp⟩) + · exact mulPolynomial_sound hm (chartDenominator_sound J) + +end DefocusingNLS.BoundaryCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryMatchingExclusion.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryMatchingExclusion.lean new file mode 100644 index 0000000000000000000000000000000000000000..0fe42b234f78318ffde05165b4081aebbffc30e5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryMatchingExclusion.lean @@ -0,0 +1,127 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryForwardScaling + +namespace OAI + +/-! # Exclusion of matching zeros on the left counting boundary -/ + +open Polynomial Matrix + +namespace DefocusingNLS.BoundaryCertificate + +attribute [local irreducible] polynomialState + +theorem boundary_forward_cones_pos (ell : Fin 4) (b Z v : ℝ) + (hb : |100000000 * b - 33477607| ≤ 2) (hZ : |100000000 * Z - 270506819| ≤ 2) + (w : Fin 2 → ℂ) (hw : w ≠ 0) : + 0 < matrixCone (ell + 5) (Complex.I * Z) + (forwardProduct (ell + 5) (Complex.I * Z) (boundaryQ ell b v) 8) w + + matrixCone (ell + 5) (-Complex.I * Z) + (forwardProduct (ell + 5) (-Complex.I * Z) (boundaryQ ell (-b) v) 8) w := by + have hp := evaluated_boundary_cones_pos ell b Z v hb hZ w hw + have h₁ : (fun i j => ((stateMatrix (polynomialState ell b Z 8)) i j).eval (v : ℂ)) = + (((100000000 : ℝ) ^ 8 : ℝ) : ℂ) • + forwardProduct (ell + 5) (Complex.I * Z) (boundaryQ ell b v) 8 := by + apply Matrix.ext + intro i j + change _ = (((100000000 : ℝ) ^ 8 : ℝ) : ℂ) * + forwardProduct (ell + 5) (Complex.I * Z) (boundaryQ ell b v) 8 i j + simpa only [Complex.ofReal_pow, Complex.ofReal_ofNat] using + polynomialState_eval_scaled ell b Z v 8 i j + have h₂ : (fun i j => star (((stateMatrix (polynomialState ell b Z 8)) i j).eval + ((-v : ℝ) : ℂ))) = (((100000000 : ℝ) ^ 8 : ℝ) : ℂ) • + forwardProduct (ell + 5) (-Complex.I * Z) (boundaryQ ell (-b) v) 8 := by + apply Matrix.ext + intro i j + change _ = (((100000000 : ℝ) ^ 8 : ℝ) : ℂ) * + forwardProduct (ell + 5) (-Complex.I * Z) (boundaryQ ell (-b) v) 8 i j + have hc := forwardProduct_conjugate (((ell : ℕ) : ℝ) + 5) (Complex.I * Z) + (boundaryQ ell b (-v)) 8 i j + push_cast at hc + rw [polynomialState_eval_scaled, star_mul, hc, boundaryQ_conjugate] + simp only [star_mul, star_pow, Complex.star_def, Complex.conj_ofNat, + Complex.conj_I, Complex.conj_ofReal, Complex.ofReal_pow, Complex.ofReal_ofNat] + rw [mul_comm (Z : ℂ) (-Complex.I)] + exact mul_comm (forwardProduct (ell + 5) (-Complex.I * Z) (boundaryQ ell (-b) v) 8 i j) + ((100000000 : ℂ) ^ 8) + have hM : scaledMass ell = (100000000 : ℝ) * ((ell : ℝ) + 5) := by + simp [scaledMass] + have hs : scaledShift Z = (100000000 : ℂ) * (Complex.I * Z) := by + simp [scaledShift] + ring + have hs' : star (scaledShift Z) = (100000000 : ℂ) * (-Complex.I * Z) := by + rw [hs] + simp + have hscale (s : ℂ) (T : Matrix (Fin 2) (Fin 2) ℂ) := + matrixCone_real_scaling (100000000 : ℝ) ((100000000 : ℝ) ^ 8) + ((ell : ℝ) + 5) s T w + simp only [Complex.ofReal_ofNat] at hscale + rw [h₁, h₂, hM, hs', hs, hscale, hscale] at hp + have ha : 0 < (100000000 : ℝ) * ((100000000 : ℝ) ^ 8) ^ 2 := by positivity + exact pos_of_mul_pos_right (by simpa only [mul_add] using hp) ha.le + +theorem boundaryQ_add_nat_ne_zero (ell n : ℕ) (b v : ℝ) : + boundaryQ ell b v + n ≠ 0 := by + intro h + have hr := congrArg Complex.re h + simp only [boundaryQ, Complex.add_re, Complex.mul_re, Complex.I_re, Complex.I_im, + Complex.ofReal_re, Complex.ofReal_im, Complex.natCast_re, zero_mul, mul_zero, + sub_zero, Complex.zero_re] at hr + have he : (16 : ℝ) * ell + 32 * n = 1 := by linarith + have hi : (16 : ℤ) * ell + 32 * n = 1 := by exact_mod_cast he + omega + +theorem boundaryQ_sub_mass_add_nat_ne_zero (ell n : ℕ) (b v : ℝ) : + boundaryQ ell b v - (ell + 5) + n ≠ 0 := by + intro h + have hr := congrArg Complex.re h + simp only [boundaryQ, Complex.add_re, Complex.sub_re, Complex.mul_re, + Complex.I_re, Complex.I_im, Complex.ofReal_re, Complex.ofReal_im, + Complex.natCast_re, zero_mul, mul_zero, sub_zero, + Complex.zero_re] at hr + norm_num at hr + have he : (32 : ℝ) * n = 16 * ell + 161 := by linarith + have hi : (32 : ℤ) * n = 16 * ell + 161 := by exact_mod_cast he + omega + +theorem boundaryQ_pochhammer_ne_zero (ell N : ℕ) (b v : ℝ) : + (ascPochhammer ℂ N).eval (boundaryQ ell b v) ≠ 0 ∧ + (ascPochhammer ℂ N).eval (boundaryQ ell b v - (ell + 5)) ≠ 0 := by + induction N with + | zero => simp + | succ N ih => + simp only [ascPochhammer_succ_eval, ne_eq, mul_eq_zero, not_or] + exact ⟨⟨ih.1, boundaryQ_add_nat_ne_zero ell N b v⟩, + ⟨ih.2, boundaryQ_sub_mass_add_nat_ne_zero ell N b v⟩⟩ + +/-- No member of the actual tail homotopy has a matching zero on the left +counting boundary. The only assumptions are the certified parameter box and +the homotopy parameter interval. -/ +theorem matchingHomotopy_left_boundary_ne_zero (ell : Fin 4) (b Z v ρ : ℝ) + (hb : |100000000 * b - 33477607| ≤ 2) (hZ : |100000000 * Z - 270506819| ≤ 2) + (hρ : 0 ≤ ρ) (hρ1 : ρ ≤ 1) : + matchingColumnDeterminant + (matchingHomotopyColumn (ell + 5) 8 (Complex.I * Z) ρ (boundaryQ ell b v)) + (matchingHomotopyColumn (ell + 5) 8 (-Complex.I * Z) ρ (boundaryQ ell (-b) v)) ≠ 0 := by + have hZ0 : Z ≠ 0 := by intro hz; rw [hz] at hZ; norm_num at hZ + have hq (b' : ℝ) : (boundaryQ ell b' v).re = -(1 / 32 : ℝ) + (ell : ℝ) / 2 := by + simp [boundaryQ] + ring + apply matchingColumnDeterminant_ne_zero_of_forward_forms (ell + 5) + (Complex.I * Z) (-Complex.I * Z) + (forwardProduct (ell + 5) (Complex.I * Z) (boundaryQ ell b v) 8) + (forwardProduct (ell + 5) (-Complex.I * Z) (boundaryQ ell (-b) v) 8) + · exact matchingHomotopyColumn_ne_zero_of_factors _ _ _ _ _ + (boundaryQ_pochhammer_ne_zero ell 8 b v).1 + (by simpa only [Nat.cast_add, Nat.cast_ofNat] using (boundaryQ_pochhammer_ne_zero ell 8 b v).2) + · exact matchingHomotopyColumn_ne_zero_of_factors _ _ _ _ _ + (boundaryQ_pochhammer_ne_zero ell 8 (-b) v).1 + (by simpa only [Nat.cast_add, Nat.cast_ofNat] using (boundaryQ_pochhammer_ne_zero ell 8 (-b) v).2) + · exact forward_matchingHomotopyColumn_cone (-(1 / 32)) ell 8 _ _ ρ (by rfl) (by decide) + (hq b) (by simp) (by simpa using hZ0) hρ hρ1 + · exact forward_matchingHomotopyColumn_cone (-(1 / 32)) ell 8 _ _ ρ (by rfl) (by decide) + (hq (-b)) (by simp) (by simpa using hZ0) hρ hρ1 + · exact boundary_forward_cones_pos ell b Z v hb hZ + +end DefocusingNLS.BoundaryCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryPolynomial.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryPolynomial.lean new file mode 100644 index 0000000000000000000000000000000000000000..d13686f0a86f4e5125a09941b3260cf346308daa --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryPolynomial.lean @@ -0,0 +1,111 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ForwardHermitianForm +import Mathlib.Algebra.Polynomial.Degree.Lemmas + +namespace OAI + +/-! # Polynomial structure of the finite forward matrix + +Only the constant coefficient depends on the spectral shift. The leading +matrix is computed for every truncation depth, independently of parameters. +-/ + +open Polynomial Matrix + +namespace DefocusingNLS + +noncomputable def boundaryLinear (a : ℂ) : Polynomial ℂ := C a + C Complex.I * X + +noncomputable def boundaryForwardStep (M : ℝ) (s a : ℂ) : + Matrix (Fin 2) (Fin 2) (Polynomial ℂ) := + !![boundaryLinear a, C s; -boundaryLinear a, boundaryLinear a - C (M : ℂ) - C s] + +noncomputable def boundaryForwardProduct (M : ℝ) (s : ℂ) (a : ℕ → ℂ) : + ℕ → Matrix (Fin 2) (Fin 2) (Polynomial ℂ) + | 0 => 1 + | K + 1 => boundaryForwardStep M s (a K) * boundaryForwardProduct M s a K + +theorem boundaryLinear_degree (a : ℂ) : (boundaryLinear a).natDegree ≤ 1 := by + apply natDegree_add_le_of_degree_le + · simp + · exact (natDegree_C_mul_le (Complex.I : ℂ) (X : Polynomial ℂ)).trans (by simp) + +theorem boundaryForwardStep_degree (M : ℝ) (s a : ℂ) (i j : Fin 2) : + (boundaryForwardStep M s a i j).natDegree ≤ 1 := by + fin_cases i <;> fin_cases j + · exact boundaryLinear_degree _ + · change (C s).natDegree ≤ 1 + simp + · change (-boundaryLinear a).natDegree ≤ 1 + simpa only [natDegree_neg] using boundaryLinear_degree a + · change (boundaryLinear a - C (M : ℂ) - C s).natDegree ≤ 1 + apply (natDegree_sub_le _ _).trans + apply max_le _ (by simp) + exact (natDegree_sub_le _ _).trans (max_le (boundaryLinear_degree _) (by simp)) + +theorem boundaryForwardProduct_degree (M : ℝ) (s : ℂ) (a : ℕ → ℂ) + (K : ℕ) (i j : Fin 2) : (boundaryForwardProduct M s a K i j).natDegree ≤ K := by + induction K generalizing i j with + | zero => fin_cases i <;> fin_cases j <;> simp [boundaryForwardProduct] + | succ K ih => + change (∑ k, boundaryForwardStep M s (a K) i k * + boundaryForwardProduct M s a K k j).natDegree ≤ K + 1 + rw [Fin.sum_univ_two] + apply natDegree_add_le_of_degree_le + · exact (natDegree_mul_le.trans (add_le_add (boundaryForwardStep_degree ..) (ih ..))).trans + (by omega) + · exact (natDegree_mul_le.trans (add_le_add (boundaryForwardStep_degree ..) (ih ..))).trans + (by omega) + +theorem boundaryLinear_mul_top (a : ℂ) (p : Polynomial ℂ) (K : ℕ) + (hp : p.natDegree ≤ K) : + (boundaryLinear a * p).coeff (K + 1) = Complex.I * p.coeff K := by + have hz : p.coeff (K + 1) = 0 := coeff_eq_zero_of_natDegree_lt (by omega) + simp [boundaryLinear, add_mul, mul_assoc, coeff_X_mul, hz] + +theorem boundaryForwardProduct_top (M : ℝ) (s : ℂ) (a : ℕ → ℂ) (K : ℕ) : + (boundaryForwardProduct M s a K 0 0).coeff K = Complex.I ^ K ∧ + (boundaryForwardProduct M s a K 0 1).coeff K = 0 ∧ + (boundaryForwardProduct M s a K 1 0).coeff K = -(K : ℂ) * Complex.I ^ K ∧ + (boundaryForwardProduct M s a K 1 1).coeff K = Complex.I ^ K := by + induction K with + | zero => simp [boundaryForwardProduct] + | succ K ih => + have hz (i j : Fin 2) : (boundaryForwardProduct M s a K i j).coeff (K + 1) = 0 := + coeff_eq_zero_of_natDegree_lt ((boundaryForwardProduct_degree M s a K i j).trans_lt (by omega)) + have ht (i j : Fin 2) := boundaryLinear_mul_top (a K) + (boundaryForwardProduct M s a K i j) K (boundaryForwardProduct_degree ..) + simp only [boundaryForwardProduct, Matrix.mul_apply, Fin.sum_univ_two, + boundaryForwardStep, Matrix.of_apply, Matrix.cons_val_zero, Matrix.cons_val_one, + sub_mul, neg_mul, coeff_add, coeff_sub, coeff_neg, coeff_C_mul, hz, mul_zero, + add_zero, sub_zero, ht, ih.1, ih.2.1, ih.2.2.1, ih.2.2.2] + push_cast + simp only [pow_succ] + constructor + · ring + constructor + · trivial + constructor <;> ring + +theorem boundaryForwardStep_eval (M : ℝ) (s a : ℂ) (v : ℝ) (i j : Fin 2) : + (boundaryForwardStep M s a i j).eval (v : ℂ) = + forwardMatrix (M : ℂ) s (a + Complex.I * v) i j := by + fin_cases i <;> fin_cases j <;> + simp [boundaryForwardStep, boundaryLinear, forwardMatrix] + +/-- Evaluation of the symbolic boundary product gives the actual forward +matching matrix on a vertical spectral line. -/ +theorem boundaryForwardProduct_eval (M : ℝ) (s q : ℂ) (v : ℝ) (K : ℕ) + (i j : Fin 2) : + (boundaryForwardProduct M s (fun n => q + n) K i j).eval (v : ℂ) = + forwardProduct (M : ℂ) s (q + Complex.I * v) K i j := by + induction K generalizing i j with + | zero => fin_cases i <;> fin_cases j <;> simp [boundaryForwardProduct, forwardProduct] + | succ K ih => + simp only [boundaryForwardProduct, forwardProduct, Matrix.mul_apply, + Fin.sum_univ_two, eval_add, eval_mul, boundaryForwardStep_eval, ih] + have h : q + (K : ℂ) + Complex.I * (v : ℂ) = q + Complex.I * v + K := by ring + rw [h] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryPolynomialDegree.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryPolynomialDegree.lean new file mode 100644 index 0000000000000000000000000000000000000000..1fa11b0993a4efe0e30ff6001e1be7c466bf4d3f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryPolynomialDegree.lean @@ -0,0 +1,165 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryHermitianPolynomial + +namespace OAI + +/-! # Structural cancellation in the boundary determinant + +The proof holds for every coherent choice of constant terms. It never uses +cancellation observed at the certificate's central parameter values. +-/ + +open Polynomial Matrix + +namespace DefocusingNLS + +noncomputable def boundaryLeadingMatrix (K : ℕ) : Matrix (Fin 2) (Fin 2) ℂ := + !![Complex.I ^ K, 0; -(K : ℂ) * Complex.I ^ K, Complex.I ^ K] + +theorem boundaryForwardProduct_top_matrix (M : ℝ) (s : ℂ) (a : ℕ → ℂ) (K : ℕ) : + (fun i j => (boundaryForwardProduct M s a K i j).coeff K) = boundaryLeadingMatrix K := by + have h := boundaryForwardProduct_top M s a K + ext i j + fin_cases i <;> fin_cases j + · exact h.1 + · exact h.2.1 + · exact h.2.2.1 + · exact h.2.2.2 + +theorem star_I_pow_mul (K : ℕ) : star (Complex.I ^ K) * Complex.I ^ K = 1 := by + rw [star_pow, ← mul_pow] + simp + +theorem forwardFormEntry_boundaryLeadingMatrix (M : ℝ) (s : ℂ) (K : ℕ) (i j : Fin 2) : + forwardFormEntry M s (boundaryLeadingMatrix K) i j = + (!![(M : ℂ), s; -s, 0] : Matrix (Fin 2) (Fin 2) ℂ) i j := by + have h := star_I_pow_mul K + have hK : star (K : ℂ) = (K : ℂ) := by simp + fin_cases i <;> fin_cases j + · change (M : ℂ) * star (Complex.I ^ K) * Complex.I ^ K + + s * (star (Complex.I ^ K) * (-(K : ℂ) * Complex.I ^ K) - + star (-(K : ℂ) * Complex.I ^ K) * Complex.I ^ K) = M + simp only [star_mul, star_neg, hK] + linear_combination (M : ℂ) * h + · change (M : ℂ) * star (Complex.I ^ K) * 0 + + s * (star (Complex.I ^ K) * Complex.I ^ K - + star (-(K : ℂ) * Complex.I ^ K) * 0) = s + simp only [mul_zero, sub_zero, zero_add] + rw [h, mul_one] + · change (M : ℂ) * star (0 : ℂ) * Complex.I ^ K + + s * (star (0 : ℂ) * (-(K : ℂ) * Complex.I ^ K) - + star (Complex.I ^ K) * Complex.I ^ K) = -s + simp only [star_zero, mul_zero, zero_mul, zero_add, zero_sub, h, mul_neg_one] + · change (M : ℂ) * star (0 : ℂ) * 0 + + s * (star (0 : ℂ) * Complex.I ^ K - star (Complex.I ^ K) * 0) = 0 + simp + +theorem boundaryHermitian_top (M : ℝ) (s : ℂ) (a : ℕ → ℂ) (K : ℕ) (i j : Fin 2) : + (hermitianPolynomial M s (boundaryForwardProduct M s a K) i j).coeff (2 * K) = + (!![(M : ℂ), s; -s, 0] : Matrix (Fin 2) (Fin 2) ℂ) i j := by + rw [hermitianPolynomial_top M s _ K (boundaryForwardProduct_degree M s a K), + boundaryForwardProduct_top_matrix, forwardFormEntry_boundaryLeadingMatrix] + +theorem boundaryReflected_top (M : ℝ) (s : ℂ) (a : ℕ → ℂ) (K : ℕ) + (hs : s.re = 0) (i j : Fin 2) : + (reflectedHermitianPolynomial M s (boundaryForwardProduct M s a K) i j).coeff (2 * K) = + (!![((2 * M : ℝ) : ℂ), 0; 0, 0] : Matrix (Fin 2) (Fin 2) ℂ) i j := by + rw [reflectedHermitianPolynomial_coefficient, boundaryHermitian_top] + have he : (-1 : ℂ) ^ (2 * K) = 1 := by rw [pow_mul]; simp + have hM : star (M : ℂ) = (M : ℂ) := Complex.conj_ofReal M + fin_cases i <;> fin_cases j <;> + simp [he, hM, star_eq_neg_of_re_zero s hs] + ring + +theorem conjugatePolynomial_add (p q : Polynomial ℂ) : + conjugatePolynomial (p + q) = conjugatePolynomial p + conjugatePolynomial q := by + simp [conjugatePolynomial] + +theorem conjugatePolynomial_sub (p q : Polynomial ℂ) : + conjugatePolynomial (p - q) = conjugatePolynomial p - conjugatePolynomial q := by + simp [conjugatePolynomial] + +theorem conjugatePolynomial_mul (p q : Polynomial ℂ) : + conjugatePolynomial (p * q) = conjugatePolynomial p * conjugatePolynomial q := by + simp [conjugatePolynomial] + +theorem conjugatePolynomial_C (z : ℂ) : conjugatePolynomial (C z) = C (star z) := by + simp [conjugatePolynomial] + +theorem conjugatePolynomial_conjugate (p : Polynomial ℂ) : + conjugatePolynomial (conjugatePolynomial p) = p := by + ext n + simp only [coeff_conjugatePolynomial, star_star] + +theorem hermitianPolynomial_conjugate (M : ℝ) (s : ℂ) + (T : Matrix (Fin 2) (Fin 2) (Polynomial ℂ)) (hs : s.re = 0) (i j : Fin 2) : + conjugatePolynomial (hermitianPolynomial M s T j i) = hermitianPolynomial M s T i j := by + have hM : star (M : ℂ) = (M : ℂ) := Complex.conj_ofReal M + simp only [hermitianPolynomial, conjugatePolynomial_add, conjugatePolynomial_mul, + conjugatePolynomial_sub, conjugatePolynomial_C, conjugatePolynomial_conjugate, + hM, star_eq_neg_of_re_zero s hs, map_neg] + ring + +theorem hermitianPolynomial_diagonal_coefficient (M : ℝ) (s : ℂ) + (T : Matrix (Fin 2) (Fin 2) (Polynomial ℂ)) (hs : s.re = 0) (i : Fin 2) (n : ℕ) : + star ((hermitianPolynomial M s T i i).coeff n) = + (hermitianPolynomial M s T i i).coeff n := by + have h := congrArg (fun p : Polynomial ℂ => p.coeff n) + (hermitianPolynomial_conjugate M s T hs i i) + simpa only [coeff_conjugatePolynomial] using h + +theorem reflectedHermitianPolynomial_diagonal_odd (M : ℝ) (s : ℂ) + (T : Matrix (Fin 2) (Fin 2) (Polynomial ℂ)) (hs : s.re = 0) (i : Fin 2) (n : ℕ) + (hn : Odd n) : (reflectedHermitianPolynomial M s T i i).coeff n = 0 := by + rw [reflectedHermitianPolynomial_coefficient, + hermitianPolynomial_diagonal_coefficient M s T hs, hn.neg_one_pow] + ring + +theorem boundaryReflected_offDiagonal_degree (M : ℝ) (s : ℂ) (a : ℕ → ℂ) + (K : ℕ) (hK : 0 < K) (hs : s.re = 0) : + (reflectedHermitianPolynomial M s (boundaryForwardProduct M s a K) 0 1).natDegree ≤ 2 * K - 1 := by + apply natDegree_le_iff_coeff_eq_zero.mpr + intro n hn + by_cases he : n = 2 * K + · subst n + exact boundaryReflected_top M s a K hs 0 1 + · exact coeff_eq_zero_of_natDegree_lt + ((reflectedHermitianPolynomial_degree M s _ K (boundaryForwardProduct_degree M s a K) 0 1).trans_lt + (by omega)) + +theorem boundaryReflected_secondDiagonal_degree (M : ℝ) (s : ℂ) (a : ℕ → ℂ) + (K : ℕ) (hK : 0 < K) (hs : s.re = 0) : + (reflectedHermitianPolynomial M s (boundaryForwardProduct M s a K) 1 1).natDegree ≤ 2 * K - 2 := by + apply natDegree_le_iff_coeff_eq_zero.mpr + intro n hn + by_cases he : n = 2 * K + · subst n + exact boundaryReflected_top M s a K hs 1 1 + by_cases ho : n = 2 * K - 1 + · apply reflectedHermitianPolynomial_diagonal_odd M s _ hs 1 n + exact ⟨K - 1, by omega⟩ + · exact coeff_eq_zero_of_natDegree_lt + ((reflectedHermitianPolynomial_degree M s _ K (boundaryForwardProduct_degree M s a K) 1 1).trans_lt + (by omega)) + +noncomputable def boundaryDeterminantPolynomial (M : ℝ) (s : ℂ) (a : ℕ → ℂ) (K : ℕ) : Polynomial ℂ := + let S := reflectedHermitianPolynomial M s (boundaryForwardProduct M s a K) + S 0 0 * S 1 1 - S 0 1 * conjugatePolynomial (S 0 1) + +/-- The cancellation required by the finite certificate is uniform throughout +its parameter box: at depth eight the determinant has degree at most thirty. -/ +theorem boundaryDeterminantPolynomial_degree (M : ℝ) (s : ℂ) (a : ℕ → ℂ) + (K : ℕ) (hK : 0 < K) (hs : s.re = 0) : + (boundaryDeterminantPolynomial M s a K).natDegree ≤ 4 * K - 2 := by + apply (natDegree_sub_le _ _).trans + apply max_le + · exact natDegree_mul_le.trans ((add_le_add + (reflectedHermitianPolynomial_degree M s _ K (boundaryForwardProduct_degree M s a K) 0 0) + (boundaryReflected_secondDiagonal_degree M s a K hK hs)).trans (by omega)) + · exact natDegree_mul_le.trans ((add_le_add + (boundaryReflected_offDiagonal_degree M s a K hK hs) + ((conjugatePolynomial_degree _).trans + (boundaryReflected_offDiagonal_degree M s a K hK hs))).trans (by omega)) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryPolynomialParity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryPolynomialParity.lean new file mode 100644 index 0000000000000000000000000000000000000000..4131401d8cedcd04d707bf2ea604ca2e62ffe3ed --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryPolynomialParity.lean @@ -0,0 +1,102 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryPolynomialDegree + +namespace OAI + +/-! # Reality and evenness of the coherent boundary determinant -/ + +open Polynomial + +namespace DefocusingNLS + +noncomputable def reflectPolynomial (p : Polynomial ℂ) : Polynomial ℂ := p.comp (C (-1) * X) + +theorem coeff_reflectPolynomial (p : Polynomial ℂ) (n : ℕ) : + (reflectPolynomial p).coeff n = p.coeff n * (-1) ^ n := by + rw [reflectPolynomial, comp_C_mul_X_coeff] + +theorem reflectPolynomial_add (p q : Polynomial ℂ) : + reflectPolynomial (p + q) = reflectPolynomial p + reflectPolynomial q := by + simp [reflectPolynomial] + +theorem reflectPolynomial_sub (p q : Polynomial ℂ) : + reflectPolynomial (p - q) = reflectPolynomial p - reflectPolynomial q := by + simp [reflectPolynomial] + +theorem reflectPolynomial_mul (p q : Polynomial ℂ) : + reflectPolynomial (p * q) = reflectPolynomial p * reflectPolynomial q := by + simp [reflectPolynomial] + +theorem reflectPolynomial_reflect (p : Polynomial ℂ) : + reflectPolynomial (reflectPolynomial p) = p := by + ext n + rw [coeff_reflectPolynomial, coeff_reflectPolynomial, mul_assoc, ← mul_pow] + simp + +theorem reflectPolynomial_conjugate (p : Polynomial ℂ) : + reflectPolynomial (conjugatePolynomial p) = conjugatePolynomial (reflectPolynomial p) := by + ext n + simp only [coeff_reflectPolynomial, coeff_conjugatePolynomial, star_mul, star_pow] + simp [mul_comm] + +theorem sharpPolynomial_eq_reflect (p : Polynomial ℂ) : + sharpPolynomial p = reflectPolynomial (conjugatePolynomial p) := rfl + +theorem reflectedHermitian_reflect_conjugate (M : ℝ) (s : ℂ) + (T : Matrix (Fin 2) (Fin 2) (Polynomial ℂ)) (i j : Fin 2) : + reflectPolynomial (reflectedHermitianPolynomial M s T i j) = + conjugatePolynomial (reflectedHermitianPolynomial M s T i j) := by + unfold reflectedHermitianPolynomial + rw [reflectPolynomial_add, conjugatePolynomial_add, sharpPolynomial_eq_reflect, + reflectPolynomial_reflect, ← reflectPolynomial_conjugate, + conjugatePolynomial_conjugate] + exact add_comm _ _ + +theorem reflectedHermitian_conjugate_transpose (M : ℝ) (s : ℂ) + (T : Matrix (Fin 2) (Fin 2) (Polynomial ℂ)) (hs : s.re = 0) (i j : Fin 2) : + conjugatePolynomial (reflectedHermitianPolynomial M s T j i) = + reflectedHermitianPolynomial M s T i j := by + unfold reflectedHermitianPolynomial + rw [conjugatePolynomial_add, sharpPolynomial_eq_reflect, ← reflectPolynomial_conjugate, + conjugatePolynomial_conjugate, hermitianPolynomial_conjugate M s T hs] + rw [sharpPolynomial_eq_reflect, hermitianPolynomial_conjugate M s T hs] + +theorem boundaryDeterminantPolynomial_real (M : ℝ) (s : ℂ) (a : ℕ → ℂ) (K : ℕ) + (hs : s.re = 0) : + conjugatePolynomial (boundaryDeterminantPolynomial M s a K) = + boundaryDeterminantPolynomial M s a K := by + unfold boundaryDeterminantPolynomial + simp only [conjugatePolynomial_sub, conjugatePolynomial_mul, + conjugatePolynomial_conjugate, + reflectedHermitian_conjugate_transpose M s _ hs 0 0, + reflectedHermitian_conjugate_transpose M s _ hs 1 1] + ring + +theorem boundaryDeterminantPolynomial_even (M : ℝ) (s : ℂ) (a : ℕ → ℂ) (K : ℕ) + (hs : s.re = 0) : + reflectPolynomial (boundaryDeterminantPolynomial M s a K) = + boundaryDeterminantPolynomial M s a K := by + unfold boundaryDeterminantPolynomial + simp only [reflectPolynomial_sub, reflectPolynomial_mul, + reflectedHermitian_reflect_conjugate, reflectPolynomial_conjugate, + reflectedHermitian_conjugate_transpose M s _ hs 0 0, + reflectedHermitian_conjugate_transpose M s _ hs 1 1, + conjugatePolynomial_conjugate] + ring + +theorem boundaryDeterminantPolynomial_coeff_im (M : ℝ) (s : ℂ) (a : ℕ → ℂ) (K n : ℕ) + (hs : s.re = 0) : ((boundaryDeterminantPolynomial M s a K).coeff n).im = 0 := by + have h := congrArg (fun p : Polynomial ℂ => (p.coeff n).im) + (boundaryDeterminantPolynomial_real M s a K hs) + simp only [coeff_conjugatePolynomial, Complex.star_def, Complex.conj_im] at h + linarith + +theorem boundaryDeterminantPolynomial_coeff_odd (M : ℝ) (s : ℂ) (a : ℕ → ℂ) (K n : ℕ) + (hs : s.re = 0) (hn : Odd n) : (boundaryDeterminantPolynomial M s a K).coeff n = 0 := by + have h := congrArg (fun p : Polynomial ℂ => p.coeff n) + (boundaryDeterminantPolynomial_even M s a K hs) + rw [coeff_reflectPolynomial, hn.neg_one_pow] at h + linear_combination (-1 / 2 : ℂ) * h + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryPositiveEvaluation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryPositiveEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..ab8ed60ac2fe5aa97252a6db7943182580c50db5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryPositiveEvaluation.lean @@ -0,0 +1,54 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryCertificatePositivity +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryCertificateSemantics + +namespace OAI + +/-! # Positive evaluation from the exact coefficient checks -/ + +open Polynomial + +namespace DefocusingNLS.BoundaryCertificate +open GaussianEnclosure + +theorem positiveFirst16_spec (as : EnclosurePolynomial) (h : positiveFirst16 as = true) + (n : ℕ) (hn : n < 16) : + (as[n]?.getD zero).error < (as[n]?.getD zero).center.re := by + have hh : ∀ j, j < 16 → (as[j]?.getD zero).error < (as[j]?.getD zero).center.re := by + simpa [positiveFirst16, coefficientPositive, List.all_eq_true] using h + exact hh n hn + +theorem positiveFirst16_coefficients (as : EnclosurePolynomial) (p : Polynomial ℂ) + (h : positiveFirst16 as = true) (hp : EnclosesPolynomial as p) + (n : ℕ) (hn : n < 16) : 0 < (p.coeff n).re := + realPart_pos (coefficient_sound hp n) (positiveFirst16_spec as h n hn) + +theorem eval_re_eq_sum16 (p : Polynomial ℂ) (hp : p.natDegree ≤ 15) (w : ℝ) : + (p.eval (w : ℂ)).re = ∑ n ∈ Finset.range 16, (p.coeff n).re * w ^ n := by + conv_lhs => rw [p.as_sum_range' 16 (by omega)] + simp only [eval_finsetSum, eval_monomial, Complex.re_sum] + apply Finset.sum_congr rfl + intro n hn + have hr : ((w : ℂ) ^ n).re = w ^ n := by + rw [← Complex.ofReal_pow] + rfl + have hi : ((w : ℂ) ^ n).im = 0 := by + rw [← Complex.ofReal_pow] + rfl + rw [Complex.mul_re, hr, hi] + ring + +/-- Every nonnegative evaluation is positive, including the constant endpoint. -/ +theorem positive_eval_of_positiveFirst16 (as : EnclosurePolynomial) (p : Polynomial ℂ) + (h : positiveFirst16 as = true) (hp : EnclosesPolynomial as p) + (hdeg : p.natDegree ≤ 15) (w : ℝ) (hw : 0 ≤ w) : 0 < (p.eval (w : ℂ)).re := by + rw [eval_re_eq_sum16 p hdeg w] + apply Finset.sum_pos' + · intro n hn + exact mul_nonneg (positiveFirst16_coefficients as p h hp n (Finset.mem_range.mp hn)).le + (pow_nonneg hw n) + · refine ⟨0, by simp, ?_⟩ + simpa using positiveFirst16_coefficients as p h hp 0 (by decide) + +end DefocusingNLS.BoundaryCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryPositiveForm.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryPositiveForm.lean new file mode 100644 index 0000000000000000000000000000000000000000..ebd049c6a1fb7b61847d4597bb370974f1052d8d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/BoundaryPositiveForm.lean @@ -0,0 +1,88 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryFormEvaluation + +namespace OAI + +/-! # The certified boundary matrix is positive definite -/ + +open Polynomial Matrix + +namespace DefocusingNLS.BoundaryCertificate + +attribute [local irreducible] polynomialState state + +noncomputable def rawBoundaryEntry (ell : ℕ) (b Z v : ℝ) (i j : Fin 2) : ℂ := + (reflectedHermitianPolynomial (scaledMass ell) (scaledShift Z) + (stateMatrix (polynomialState ell b Z 8)) i j).eval (v : ℂ) + +theorem rawBoundaryEntry_diagonal (ell : ℕ) (b Z v : ℝ) (i : Fin 2) : + rawBoundaryEntry ell b Z v i i = ((rawBoundaryEntry ell b Z v i i).re : ℂ) := + reflectedHermitianPolynomial_eval_diagonal _ _ _ (by simp [scaledShift]) v i + +theorem rawBoundaryEntry_continuous (ell : ℕ) (b Z : ℝ) (i j : Fin 2) : + Continuous (fun v => rawBoundaryEntry ell b Z v i j) := + (reflectedHermitianPolynomial (scaledMass ell) (scaledShift Z) + (stateMatrix (polynomialState ell b Z 8)) i j).continuous.comp Complex.continuous_ofReal + +theorem rawBoundaryEntry_determinant (ell : ℕ) (b Z v : ℝ) : + ((rawDeterminant ell b Z).eval (v : ℂ)).re = + (rawBoundaryEntry ell b Z v 0 0).re * (rawBoundaryEntry ell b Z v 1 1).re - + Complex.normSq (rawBoundaryEntry ell b Z v 0 1) := by + simp only [rawDeterminant, eval_sub, eval_mul, conjugatePolynomial_eval_real] + change (rawBoundaryEntry ell b Z v 0 0 * rawBoundaryEntry ell b Z v 1 1 - + rawBoundaryEntry ell b Z v 0 1 * star (rawBoundaryEntry ell b Z v 0 1)).re = _ + rw [rawBoundaryEntry_diagonal ell b Z v 0, rawBoundaryEntry_diagonal ell b Z v 1] + simp [Complex.mul_re, Complex.normSq_apply] + +theorem rawBoundaryEntry_leading_pos (ell : Fin 4) (b Z : ℝ) + (hb : |100000000 * b - 33477607| ≤ 2) (hZ : |100000000 * Z - 270506819| ≤ 2) + (v : ℝ) : 0 < (rawBoundaryEntry ell b Z v 0 0).re := by + have hdet (t : ℝ) : 0 < + (rawBoundaryEntry ell b Z t 0 0).re * (rawBoundaryEntry ell b Z t 1 1).re - + Complex.normSq (rawBoundaryEntry ell b Z t 0 1) := by + rw [← rawBoundaryEntry_determinant] + exact rawDeterminant_positive ell b Z t hb hZ + have hzero : 0 < (rawBoundaryEntry ell b Z 0 0 0).re := by + simpa only [rawBoundaryEntry, rawFirstDiagonal, Complex.ofReal_zero] using + rawFirstDiagonal_at_zero_pos ell b Z hb hZ + exact positive_leading_coefficient_of_det + (fun t => (rawBoundaryEntry ell b Z t 0 0).re) + (fun t => (rawBoundaryEntry ell b Z t 1 1).re) + (fun t => rawBoundaryEntry ell b Z t 0 1) + (Complex.continuous_re.comp (rawBoundaryEntry_continuous ell b Z 0 0)) hdet 0 hzero v + +/-- The finite boundary certificate yields a strictly positive quadratic form +at every real frequency, uniformly throughout the parameter box. -/ +theorem rawBoundaryEntry_pairForm_pos (ell : Fin 4) (b Z v : ℝ) + (hb : |100000000 * b - 33477607| ≤ 2) (hZ : |100000000 * Z - 270506819| ≤ 2) + (u w : ℂ) (huw : u ≠ 0 ∨ w ≠ 0) : + 0 < hermitianPairForm (rawBoundaryEntry ell b Z v 0 0).re + (rawBoundaryEntry ell b Z v 1 1).re (rawBoundaryEntry ell b Z v 0 1) u w := by + apply hermitianPairForm_pos _ _ _ _ _ (rawBoundaryEntry_leading_pos ell b Z hb hZ v) _ huw + rw [← rawBoundaryEntry_determinant] + exact rawDeterminant_positive ell b Z v hb hZ + +/-- A direct positivity statement for the two actual evaluated forward forms. -/ +theorem evaluated_boundary_cones_pos (ell : Fin 4) (b Z v : ℝ) + (hb : |100000000 * b - 33477607| ≤ 2) (hZ : |100000000 * Z - 270506819| ≤ 2) + (w : Fin 2 → ℂ) (hw : w ≠ 0) : + 0 < matrixCone (scaledMass ell) (scaledShift Z) + (fun i j => ((stateMatrix (polynomialState ell b Z 8)) i j).eval (v : ℂ)) w + + matrixCone (scaledMass ell) (star (scaledShift Z)) + (fun i j => star (((stateMatrix (polynomialState ell b Z 8)) i j).eval + ((-v : ℝ) : ℂ))) w := by + have he (i j : Fin 2) : rawBoundaryEntry ell b Z v i j = + forwardFormEntry (scaledMass ell) (scaledShift Z) + (fun a c => ((stateMatrix (polynomialState ell b Z 8)) a c).eval (v : ℂ)) i j + + forwardFormEntry (scaledMass ell) (star (scaledShift Z)) + (fun a c => star (((stateMatrix (polynomialState ell b Z 8)) a c).eval + ((-v : ℝ) : ℂ))) i j := + reflectedHermitianPolynomial_eval _ _ _ v i j + apply positive_sum_matrixCone _ _ _ _ _ (by simp [scaledShift]) + (by simp [scaledShift]) _ _ w hw + · simpa only [he, Complex.add_re] using rawBoundaryEntry_leading_pos ell b Z hb hZ v + · simpa only [rawBoundaryEntry_determinant, he, Complex.add_re] using + rawDeterminant_positive ell b Z v hb hZ + +end DefocusingNLS.BoundaryCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/CenteredPolynomial.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/CenteredPolynomial.lean new file mode 100644 index 0000000000000000000000000000000000000000..08ec34e36b6818b4663301e36c70ba9d9ab5755d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/CenteredPolynomial.lean @@ -0,0 +1,76 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.RootDiskArithmetic +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.MatchingPolynomialDegree +import Mathlib.Algebra.Polynomial.Taylor + +namespace OAI + +/-! # Denominator-cleared Taylor coefficients for the disk certificates -/ + +open Polynomial + +namespace DefocusingNLS.SeparatorArithmetic + +noncomputable section + +/-- The full unscaled winding polynomial, with integer coefficients. -/ +def windingPolynomial (ℓ : ℕ) : Polynomial ℤ := + ∑ n ∈ Finset.range 16, monomial n (windingCoefficient ℓ n) + +theorem coeff_windingPolynomial (ℓ j : ℕ) : + (windingPolynomial ℓ).coeff j = windingCoefficient ℓ j := by + classical + by_cases hj : j < 16 + · simp [windingPolynomial, coeff_monomial, hj] + · rw [windingCoefficient_eq_zero ℓ j (by omega)] + simp [windingPolynomial, coeff_monomial, hj] + +/-- The coefficient description holds at every order, including the vanishing +tail, so this polynomial is exactly the coefficientwise imaginary product. -/ +theorem windingPolynomial_matches_product (ℓ j : ℕ) : + (windingPolynomial ℓ).coeff j = + ((toPolynomial (backwardCoefficients ℓ).1 * + (toPolynomial (backwardCoefficients ℓ).2).map + (starRingEnd GaussianInt)).coeff j).im := by + rw [coeff_windingPolynomial, windingCoefficient_eq] + +theorem coeff_taylor_finite (A : ℕ → GaussianInt) (c : GaussianInt) + (i : ℕ) (hi : i ≤ 16) : + (taylor c (∑ n ∈ Finset.range 16, monomial n (A n))).coeff i = + ∑ j ∈ Finset.range (16 - i), + A (j + i) * (Nat.choose (j + i) i : GaussianInt) * c ^ j := by + rw [taylor_coeff, map_sum] + simp only [hasseDeriv_monomial, eval_finsetSum, eval_monomial] + conv_lhs => rw [← Nat.add_sub_of_le hi, Finset.sum_range_add] + have hzero : ∑ n ∈ Finset.range i, + (Nat.choose n i : GaussianInt) * A n * c ^ (n - i) = 0 := by + apply Finset.sum_eq_zero + intro n hn + simp only [Nat.choose_eq_zero_of_lt (Finset.mem_range.mp hn), Nat.cast_zero, + zero_mul] + rw [hzero, zero_add] + apply Finset.sum_congr rfl + intro j _ + rw [Nat.add_sub_cancel_left] + simp only [Nat.add_comm i j] + ring + +/-- Polynomial before translation, with the scaling denominator cleared. -/ +def scaledSeparatorPolynomial (ℓ : ℕ) : Polynomial GaussianInt := + ∑ n ∈ Finset.range 16, + monomial n ((windingCoefficient ℓ n * diskScale ^ (15 - n) : ℤ) : GaussianInt) + +theorem centeredCoefficient_eq (ℓ : ℕ) (c : GaussianInt) (i : ℕ) (hi : i ≤ 16) : + centeredCoefficient ℓ c i = (taylor c (scaledSeparatorPolynomial ℓ)).coeff i := by + rw [scaledSeparatorPolynomial, coeff_taylor_finite _ _ _ hi] + unfold centeredCoefficient + rw [← List.sum_toFinset _ List.nodup_range] + simp only [List.toFinset_range] + apply Finset.sum_congr rfl + intro j _ + push_cast + ring + +end +end DefocusingNLS.SeparatorArithmetic + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/CentralOutgoingCount.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/CentralOutgoingCount.lean new file mode 100644 index 0000000000000000000000000000000000000000..453faf0b66fbda5db56bfd90b2d4c9a18b402ed0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/CentralOutgoingCount.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.CentralZeroTailCount + +namespace OAI + +/-! # Conditional numerical outgoing counts at the certified central parameters -/ + +namespace DefocusingNLS + +/-- The actual outgoing determinant has the certified count, with multiplicity, +in every sufficiently tall rectangle. Only the published rectangle Rouché +proposition is assumed. -/ +theorem exists_central_outgoing_rectangle_count (hR : RectangleRouche) (ell : Fin 4) : + ∃ V : ℝ, 0 < V ∧ ∀ W : ℝ, V < W → + rectangleZeroCount W + (spectralSlowDeterminant ell (33477607 / 100000000) (270506819 / 100000000)) = + (SeparatorArithmetic.positiveRootCount ell : ℕ∞) := by + obtain ⟨V₁, hV₁, hb⟩ := exists_spectral_counting_boundary ell + obtain ⟨V₂, hV₂, hz⟩ := SeparatorArithmetic.exists_central_zeroTail_rectangle_count ell + refine ⟨max V₁ V₂, lt_of_lt_of_le hV₁ (le_max_left _ _), ?_⟩ + intro W hW + have hW₁ : V₁ < W := lt_of_le_of_lt (le_max_left _ _) hW + have hW₂ : V₂ < W := lt_of_le_of_lt (le_max_right _ _) hW + have hW0 : 0 < W := hV₁.trans hW₁ + have hZ : (270506819 / 100000000 : ℝ) ≠ 0 := by norm_num + have he : rectangleZeroCount W + (spectralHomotopyDeterminant ell (33477607 / 100000000) (270506819 / 100000000) 0) = + rectangleZeroCount W + (spectralHomotopyDeterminant ell (33477607 / 100000000) (270506819 / 100000000) 1) := by + apply rectangleZeroCount_homotopy hR W hW0 + · intro a ha z hz + exact analyticAt_spectralHomotopyDeterminant ell _ _ a z hZ hz.1 + · intro a ha z hz + exact continuousAt_joint_spectralHomotopyDeterminant ell _ _ a z hZ hz.1.1 + · intro a ha z hz + apply hb (33477607 / 100000000) (270506819 / 100000000) a z + (by norm_num) (by norm_num) ha.1 ha.2 + obtain ⟨hrect, hedge⟩ := (mem_countingRectangleBoundary_iff W z).mp hz + rcases hedge with hleft | hright | hbottom | htop + · exact Or.inl hleft + · exact Or.inr (Or.inl hright.ge) + · exact Or.inr (Or.inr ⟨hrect.1, by + rw [hbottom, abs_neg, abs_of_pos hW0] + exact hW₁⟩) + · exact Or.inr (Or.inr ⟨hrect.1, by + rw [htop, abs_of_pos hW0] + exact hW₁⟩) + exact (he.trans (rectangleZeroCount_spectralHomotopy_endpoint ell _ _ W hZ)).symm.trans + (hz W hW₂) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/CentralZeroTailCount.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/CentralZeroTailCount.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3f3f1e4d01f0305614737e8306919c89655ae10 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/CentralZeroTailCount.lean @@ -0,0 +1,72 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ZeroTailAnalyticCount + +namespace OAI + +/-! # The numerical central zero-tail count in a counting rectangle -/ + +open Polynomial + +namespace DefocusingNLS.SeparatorArithmetic + +attribute [local irreducible] spectralHomotopyDeterminant windingPolynomial + +theorem central_zeroTail_zero_of_polynomial_root (ell : ℕ) (w : ℂ) + (hw : ((windingPolynomial ell).map (Int.castRingHom ℂ)).IsRoot w) : + spectralHomotopyDeterminant ell (33477607 / 100000000) (270506819 / 100000000) + 0 (w - 1 / 32) = 0 := by + have h := windingPolynomial_eval_zeroTailDeterminant ell w + rw [hw.eq_zero, mul_zero] at h + exact (mul_eq_zero.mp h.symm).resolve_left (by norm_num) + +/-- Every sufficiently tall counting rectangle contains exactly the certified +number of zero-tail zeros, counted by their analytic orders. -/ +theorem exists_central_zeroTail_rectangle_count (ell : Fin 4) : + ∃ V : ℝ, 0 < V ∧ ∀ W : ℝ, V < W → + rectangleZeroCount W + (spectralHomotopyDeterminant ell (33477607 / 100000000) (270506819 / 100000000) 0) = + (positiveRootCount ell : ℕ∞) := by + classical + obtain ⟨V, hV, hboundary⟩ := exists_spectral_counting_boundary ell + refine ⟨V, hV, ?_⟩ + intro W hW + rw [central_zeroTail_rectangle_count] + have hfilter : + (((windingPolynomial ell).map (Int.castRingHom ℂ)).roots.toFinset.filter + (fun w => w - 1 / 32 ∈ countingRectangle W)) = + (((windingPolynomial ell).map (Int.castRingHom ℂ)).roots.toFinset.filter + (fun w => 0 ≤ w.re)) := by + ext w + simp only [Finset.mem_filter] + constructor + · rintro ⟨hw, hrect⟩ + refine ⟨hw, ?_⟩ + have hlo := hrect.1 + simp only [Complex.sub_re] at hlo + norm_num at hlo + linarith + · rintro ⟨hw, hre⟩ + have hroot : ((windingPolynomial ell).map (Int.castRingHom ℂ)).IsRoot w := + (Polynomial.mem_roots (windingPolynomial_complex_ne_zero ell)).mp + (Multiset.mem_toFinset.mp hw) + have haxis := windingPolynomial_no_axis_root ell hroot + have hwpos : 0 < w.re := lt_of_le_of_ne hre (Ne.symm haxis) + have hz0 := central_zeroTail_zero_of_polynomial_root ell w hroot + have hlo : -(1 / 32 : ℝ) < (w - (1 / 32 : ℂ)).re := by + simp only [Complex.sub_re] + norm_num + linarith + have hn := fun (he : (w - (1 / 32 : ℂ)).re = -(1 / 32 : ℝ) ∨ + 8 ≤ (w - (1 / 32 : ℂ)).re ∨ + (-(1 / 32 : ℝ) ≤ (w - (1 / 32 : ℂ)).re ∧ V < |(w - (1 / 32 : ℂ)).im|)) => + (hboundary (33477607 / 100000000) (270506819 / 100000000) 0 + (w - 1 / 32) (by norm_num) (by norm_num) le_rfl (by norm_num) he) hz0 + have hright : (w - (1 / 32 : ℂ)).re < 8 := + lt_of_not_ge (fun h => hn (Or.inr (Or.inl h))) + have hheight : |(w - (1 / 32 : ℂ)).im| < W := + (le_of_not_gt (fun h => hn (Or.inr (Or.inr ⟨hlo.le, h⟩)))).trans_lt hW + exact ⟨hw, hlo, hright, (abs_lt.mp hheight).1, (abs_lt.mp hheight).2⟩ + rw [hfilter, windingPolynomial_closed_half_plane_count] + +end DefocusingNLS.SeparatorArithmetic + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/CompactFamilyIntegral.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/CompactFamilyIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..e12743bf5f75edd6ffb7ec9cabee6324673e20c8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/CompactFamilyIntegral.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.CutoffFamilyContinuity +import Mathlib.Analysis.Calculus.ParametricIntegral + +namespace OAI + +/-! # Differentiation of a compact physical family before Fourier sampling -/ + +open Set MeasureTheory Filter Topology +open scoped RealInnerProductSpace + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +/-- A fixed compact support supplies the integrable local derivative bound. -/ +theorem hasDerivAt_compactFamily_integral (F Fd : ℝ → E → ℂ) + (hF : Continuous (Function.uncurry F)) (hFd : Continuous (Function.uncurry Fd)) + (K : Set E) (hK : IsCompact K) + (hzero : ∀ t x, x ∉ K → F t x = 0) + (hdzero : ∀ t x, x ∉ K → Fd t x = 0) + (hd : ∀ t x, HasDerivAt (fun s => F s x) (Fd t x) t) (t : ℝ) : + HasDerivAt (fun s => ∫ x, F s x) (∫ x, Fd t x) t := by + have hc (s : ℝ) : Continuous (F s) := + hF.comp (continuous_const.prodMk continuous_id) + have hdc (s : ℝ) : Continuous (Fd s) := + hFd.comp (continuous_const.prodMk continuous_id) + have hsupp (s : ℝ) : HasCompactSupport (F s) := by + apply hK.of_isClosed_subset isClosed_closure + apply closure_minimal _ hK.isClosed + intro x hx + by_contra hxK + exact hx (hzero s x hxK) + obtain ⟨B, hB⟩ := (isCompact_Icc.prod hK).exists_bound_of_continuousOn + (hFd.continuousOn : ContinuousOn (Function.uncurry Fd) (Icc (t - 1) (t + 1) ×ˢ K)) + let C : ℝ := max B 0 + let bound : E → ℝ := K.indicator (fun _ => C) + have hb : Integrable bound := + (integrableOn_const (μ := (volume : Measure E)) hK.measure_lt_top.ne).integrable_indicator + hK.measurableSet + exact (hasDerivAt_integral_of_dominated_loc_of_deriv_le + (F := F) (F' := Fd) (bound := bound) + (Ioo_mem_nhds (by linarith : t - 1 < t) (by linarith : t < t + 1)) + (Eventually.of_forall fun s => (hc s).aestronglyMeasurable) + ((hc t).integrable_of_hasCompactSupport (hsupp t)) + (hdc t).aestronglyMeasurable + (Eventually.of_forall fun x => by + intro s hs + by_cases hx : x ∈ K + · rw [show bound x = C by simp [bound, hx]] + exact (hB (s, x) ⟨⟨hs.1.le, hs.2.le⟩, hx⟩).trans (le_max_left _ _) + · rw [hdzero s x hx] + simp [bound, hx]) + hb (Eventually.of_forall fun x => fun s _ => hd s x)).2 + +/-- The same local argument differentiates the physical Fourier transform. -/ +theorem hasDerivAt_compactFamily_fourier (F Fd : ℝ → E → ℂ) + (hF : Continuous (Function.uncurry F)) (hFd : Continuous (Function.uncurry Fd)) + (K : Set E) (hK : IsCompact K) + (hzero : ∀ t x, x ∉ K → F t x = 0) + (hdzero : ∀ t x, x ∉ K → Fd t x = 0) + (hd : ∀ t x, HasDerivAt (fun s => F s x) (Fd t x) t) (t : ℝ) (ξ : E) : + HasDerivAt (fun s => radianFourierIntegral (F s) ξ) + (radianFourierIntegral (Fd t) ξ) t := by + let e : E → ℂ := fun x => Complex.exp ((-inner ℝ x ξ : ℝ) * Complex.I) + have he : Continuous e := by fun_prop + exact hasDerivAt_compactFamily_integral + (fun s x => e x * F s x) (fun s x => e x * Fd s x) + ((he.comp continuous_snd).mul hF) ((he.comp continuous_snd).mul hFd) + K hK (fun s x hx => by rw [hzero s x hx, mul_zero]) + (fun s x hx => by rw [hdzero s x hx, mul_zero]) + (fun s x => (hd s x).const_mul (e x)) t + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ComplexPowerBound.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ComplexPowerBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..7a5015e1430ba3dfa2e919b4d60d6235aeee9067 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ComplexPowerBound.lean @@ -0,0 +1,74 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.RegularizedSlowSolution +import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics +import Mathlib.Tactic + +namespace OAI + +/-! # Polynomial growth of the regularizing bracket at infinity -/ + +namespace DefocusingNLS + +theorem norm_cpow_le_rpow_max (z w : ℂ) (hz : 1 ≤ ‖z‖) : + ‖z ^ w‖ ≤ Real.exp (Real.pi * |w.im|) * ‖z‖ ^ (max w.re 0) := by + have harg : -(z.arg * w.im) ≤ Real.pi * |w.im| := by + calc + -(z.arg * w.im) ≤ |z.arg * w.im| := neg_le_abs _ + _ = |z.arg| * |w.im| := abs_mul _ _ + _ ≤ Real.pi * |w.im| := + mul_le_mul_of_nonneg_right (Complex.abs_arg_le_pi z) (abs_nonneg _) + calc + ‖z ^ w‖ ≤ ‖z‖ ^ w.re * Real.exp (-(z.arg * w.im)) := by + simpa only [div_eq_mul_inv, ← Real.exp_neg] using Complex.norm_cpow_le z w + _ ≤ ‖z‖ ^ (max w.re 0) * Real.exp (Real.pi * |w.im|) := + mul_le_mul (Real.rpow_le_rpow_of_exponent_le hz (le_max_left _ _)) + (Real.exp_le_exp.mpr harg) (Real.exp_pos _).le (Real.rpow_nonneg (norm_nonneg _) _) + _ = _ := mul_comm _ _ + +theorem norm_one_add_real_div_bounds (x : ℂ) (hx : x ≠ 0) {u : ℝ} + (hu : max 1 (2 * ‖x‖) ≤ u) : + 1 ≤ ‖1 + (u : ℂ) / x‖ ∧ + ‖1 + (u : ℂ) / x‖ ≤ (1 + ‖x‖⁻¹) * u := by + have hu1 : 1 ≤ u := (le_max_left _ _).trans hu + have hu0 : 0 ≤ u := le_trans zero_le_one hu1 + have hux : 2 * ‖x‖ ≤ u := (le_max_right _ _).trans hu + have hxpos : 0 < ‖x‖ := norm_pos_iff.mpr hx + have hnorm : ‖(u : ℂ) / x‖ = u / ‖x‖ := by + rw [norm_div, Complex.norm_of_nonneg hu0] + constructor + · have hlow := norm_sub_norm_le ((u : ℂ) / x) (-1) + rw [hnorm, norm_neg, norm_one, sub_neg_eq_add, add_comm] at hlow + have htwo : 2 ≤ u / ‖x‖ := (le_div_iff₀ hxpos).mpr hux + linarith + · calc + ‖1 + (u : ℂ) / x‖ ≤ 1 + u / ‖x‖ := by + simpa only [norm_one, hnorm] using norm_add_le (1 : ℂ) ((u : ℂ) / x) + _ ≤ u + u / ‖x‖ := by linarith + _ = (1 + ‖x‖⁻¹) * u := by ring + +theorem regularizingBracket_polynomial_bound (r x : ℂ) (hx : x ≠ 0) : + ∃ C : ℝ, 0 < C ∧ ∀ u : ℝ, max 1 (2 * ‖x‖) ≤ u → + ‖regularizingBracket r x u‖ ≤ C * u ^ (max r.re 0) := by + let a := max r.re 0 + let B := Real.exp (Real.pi * |r.im|) * (1 + ‖x‖⁻¹) ^ a + refine ⟨B + 1, by dsimp [B]; positivity, ?_⟩ + intro u hu + have hu1 : 1 ≤ u := (le_max_left _ _).trans hu + have hu0 : 0 ≤ u := le_trans zero_le_one hu1 + have hxbound := norm_one_add_real_div_bounds x hx hu + have hpow : ‖1 + (u : ℂ) / x‖ ^ a ≤ (1 + ‖x‖⁻¹) ^ a * u ^ a := by + rw [← Real.mul_rpow (by positivity) hu0] + exact Real.rpow_le_rpow (norm_nonneg _) hxbound.2 (le_max_right _ _) + have hbig := norm_cpow_le_rpow_max (1 + (u : ℂ) / x) r hxbound.1 + have huPow : 1 ≤ u ^ a := Real.one_le_rpow hu1 (le_max_right _ _) + calc + ‖regularizingBracket r x u‖ ≤ ‖(1 + (u : ℂ) / x) ^ r‖ + 1 := by + simpa only [regularizingBracket, norm_one] using + norm_sub_le ((1 + (u : ℂ) / x) ^ r) 1 + _ ≤ Real.exp (Real.pi * |r.im|) * + ((1 + ‖x‖⁻¹) ^ a * u ^ a) + u ^ a := by + exact add_le_add (hbig.trans (mul_le_mul_of_nonneg_left hpow (Real.exp_pos _).le)) huPow + _ = (B + 1) * u ^ a := by dsimp [B]; ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ContinuousCoordinateSequence.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ContinuousCoordinateSequence.lean new file mode 100644 index 0000000000000000000000000000000000000000..e15bea0e328c8af9893de8ce20bf2b949969cd43 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ContinuousCoordinateSequence.lean @@ -0,0 +1,182 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.ContinuousTorusCoordinateData +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.StableSmallRemainderContinuity +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.CutoffRemainderContinuity +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.StableEndpointCoordinateBound + +namespace OAI + +/-! # Continuous stable sequences with prescribed torus coordinates -/ + +open scoped NNReal + +universe u + +namespace DefocusingNLS + +local notation "Radius" => {L : ℝ // 1 ≤ L} + +theorem exists_continuous_coordinateStable_sequence + {F : Type*} + [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] [FiniteDimensional ℝ F] + (a δ B : ℝ) (ha : 0 < a) (hδ : 0 < δ) (hB : 0 ≤ B) + (T : ℝ≥0) (hratio : 2 * Real.exp (-(2 + a) * T / 2) ≤ 1) + (A : Radius → FourierL2 →L[ℝ] FourierL2) + (hAc : Continuous (fun q : Radius × FourierL2 => A q.1 q.2)) + (κ : Radius → FourierL2 →L[ℝ] F) + (hA : HasContinuousTorusCoordinateData (F := F) T A κ) + (ν : ℝ) (hν : 0 < ν) : + ∃ K : ℝ, 0 < K ∧ ∃ C : ℝ, 0 < C ∧ ∃ ρ : ℝ, 0 < ρ ∧ 2 * ρ ≤ δ ∧ + ∀ η : ℝ, 0 < η → ∃ L₀ : ℝ, + ∃ ζ : Radius → ℕ → F →L[ℝ] FourierL2, + ∃ π : Radius → ℕ → FourierL2 →L[ℝ] F, + (∀ L n, π L n = K • κ (expandingDiscreteRadius L T n)) ∧ + (∀ n, ContinuousOn (fun L => ζ L n) {L : Radius | L₀ ≤ L.1}) ∧ + (∀ n, Continuous (fun p : Radius × FourierL2 => π p.1 n p.2)) ∧ + (∀ L : Radius, L₀ ≤ L.1 → ∀ n, ‖ζ L n‖ ≤ 1 ∧ ‖π L n‖ ≤ C) ∧ + (∀ L : Radius, L₀ ≤ L.1 → ∀ n v, π L n (ζ L n v) = v) ∧ + ∀ (P : Type u) [TopologicalSpace P], ∀ L : P → Radius, + Continuous L → (∀ p, L₀ ≤ (L p).1) → + ∀ h : P → ℕ → {v : FourierL2 // ‖v‖ ≤ δ} → FourierL2, + (∀ n, Continuous (fun q : P × {v : FourierL2 // ‖v‖ ≤ δ} => h q.1 n q.2)) → + (∀ p n d, 0 < d → d ≤ δ → ∀ v u, ‖v.1‖ ≤ d → ‖u.1‖ ≤ d → + ‖h p n v - h p n u‖ ≤ + B * (d + (expandingDiscreteRadius (L p) T n).1 ^ (-2 - a)) * ‖v.1 - u.1‖) → + (∀ p n v, v.1 = 0 → ‖h p n v‖ ≤ + B * (expandingDiscreteRadius (L p) T n).1 ^ (-2 - a)) → + ∀ w : P → FourierL2, Continuous w → (∀ p, ‖w p‖ ≤ ρ / 4) → + (∀ p, π (L p) 0 (w p) = 0) → + ∃ z : P → ℕ → FourierL2, + (∀ n, Continuous (fun p => z p n)) ∧ + (∀ p, stableFrameProjection (ζ (L p) 0) (π (L p) 0) (z p 0) = w p) ∧ + (∀ p n, z p (n + 1) = A (expandingDiscreteRadius (L p) T n) (z p n) + + cutoffRemainderExtension δ (h p) n (z p n)) ∧ + (∀ p n, ‖z p n‖ ≤ (2 * ρ) * (1 / 2 : ℝ) ^ n) ∧ + (∀ p n, ‖z p n‖ ≤ (4 * (‖w p‖ + 2 * η)) * (1 / 2 : ℝ) ^ n) ∧ + (∀ p, ‖π (L p) 0 (z p 0)‖ ≤ ν * (‖w p‖ + 2 * η) + 2 * η) := by + obtain ⟨K, hK, C, hC, hlinear⟩ := continuous_torusCoordinateData_discrete T A κ hA + let κ₀ := min (1 / (128 * (C + 1))) (ν / (16 * C)) + let τ := min (1 / 128) (ν / 16) + have hκ₀ : 0 < κ₀ := lt_min (by positivity) (by positivity) + have hτ : 0 < τ := lt_min (by norm_num) (by positivity) + have hκsmall : κ₀ ≤ 1 / (128 * (C + 1)) := min_le_left _ _ + have hτsmall : τ ≤ 1 / 128 := min_le_left _ _ + have hflat : τ + C * κ₀ ≤ ν / 8 := by + have hkν : C * κ₀ ≤ ν / 16 := by + apply (mul_le_mul_of_nonneg_left (min_le_right _ _) hC.le).trans_eq + field_simp [hC.ne'] + have htν : τ ≤ ν / 16 := min_le_right _ _ + linarith + obtain ⟨σ, Llip, hσ, hσδ, hLlip, hlip⟩ := exists_cutoffRemainder_small_lipschitz + a B δ κ₀ ha hB hδ hκ₀ + let ρ := σ / 2 + have hρ : 0 < ρ := by dsimp [ρ]; positivity + have h2ρ : 2 * ρ = σ := by dsimp [ρ]; ring + obtain ⟨Llin, ζ, π, hκ, D, R, hinv, hR, hζc, hπc, hdata⟩ := hlinear τ hτ + have hRD : ∀ v, R (D v) = v := finiteCoordinate_rightInverse_leftInverse D R hinv + refine ⟨K, hK, C, hC, ρ, hρ, by rw [h2ρ]; exact hσδ, ?_⟩ + intro η hη + obtain ⟨Lforce, _, hforce⟩ := exists_cutoffResidual_small_scale a (C * B) (min (ρ / 8) η) ha (lt_min (by positivity) hη) + let L₀ := max Llin (max Llip Lforce) + have hL₀lip : Llip ≤ L₀ := (le_max_left _ _).trans (le_max_right _ _) + have hL₀lin : Llin ≤ L₀ := le_max_left _ _ + have hL₀force : Lforce ≤ L₀ := (le_max_right _ _).trans (le_max_right _ _) + have hL₀pos : 0 < L₀ := lt_of_lt_of_le zero_lt_one (hLlip.trans hL₀lip) + let ε := B * L₀ ^ (-2 - a) + have hε : 0 ≤ ε := mul_nonneg hB (Real.rpow_nonneg hL₀pos.le _) + have hεmin : C * ε ≤ min (ρ / 8) η := by + simpa only [ε, ← mul_assoc] using hforce L₀ hL₀force + have hεsmall : C * ε ≤ ρ / 8 := hεmin.trans (min_le_left _ _) + have hεη : C * ε ≤ η := hεmin.trans (min_le_right _ _) + refine ⟨L₀, ζ, π, hκ, ?_, hπc, + (fun L hL n => ⟨(hdata L (hL₀lin.trans hL)).2.1 n, + (hdata L (hL₀lin.trans hL)).2.2.1 n⟩), + (fun L hL => (hdata L (hL₀lin.trans hL)).1), ?_⟩ + · intro n + apply (hζc n).mono + intro L hL + exact hL₀lin.trans hL + intro P _ L hLc hL h hhc hl hz w hwc hwb hker + have hd (p : P) := hdata (L p) (hL₀lin.trans (hL p)) + have hZc (n : ℕ) : Continuous (fun p => ζ (L p) n) := + (hζc n).comp_continuous hLc (fun p => hL₀lin.trans (hL p)) + have hZjoint (n : ℕ) : Continuous (fun q : P × F => ζ (L q.1) n q.2) := + ((hZc n).comp continuous_fst).clm_apply continuous_snd + have hPjoint (n : ℕ) : Continuous (fun q : P × FourierL2 => π (L q.1) n q.2) := + (hπc n).comp ((hLc.comp continuous_fst).prodMk continuous_snd) + have hAjoint (n : ℕ) : Continuous + (fun q : P × FourierL2 => A (expandingDiscreteRadius (L q.1) T n) q.2) := + hAc.comp ((((continuous_expandingDiscreteRadius T n).comp hLc).comp + continuous_fst).prodMk continuous_snd) + have hpow (p : P) : (L p).1 ^ (-2 - a) ≤ L₀ ^ (-2 - a) := + Real.rpow_le_rpow_of_nonpos hL₀pos (hL p) (by linarith) + have hsmall (p : P) : ‖w p‖ + 2 * (C * ε) ≤ ρ / 2 := by + linarith [hwb p] + have hLipSharp : ∀ p n v u, ‖v‖ ≤ 2 * ρ → ‖u‖ ≤ 2 * ρ → + ‖cutoffRemainderExtension δ (h p) n v - cutoffRemainderExtension δ (h p) n u‖ ≤ + κ₀ * ‖v - u‖ := by + intro p n v u hv hu + have hh := cutoffRemainderExtension_lipschitz a (L p).1 T δ σ B + (lt_of_lt_of_le zero_lt_one (L p).2) T.2 ha hσ hσδ hB (h p) (hl p) + n v u (by rwa [← h2ρ]) (by rwa [← h2ρ]) + exact hh.trans (mul_le_mul_of_nonneg_right + (hlip (L p).1 (hL₀lip.trans (hL p))) (norm_nonneg _)) + have hZero : ∀ p n, ‖cutoffRemainderExtension δ (h p) n 0‖ ≤ + ε * (Real.exp (-(2 + a) * T / 2)) ^ n := by + intro p n + apply (cutoffRemainderExtension_zero_bound a (L p).1 T δ B + (lt_of_lt_of_le zero_lt_one (L p).2) hδ.le (h p) (hz p) n).trans + exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left (hpow p) hB) (by positivity) + obtain ⟨z, hzc, hz0, hzstep, hzn⟩ := exists_continuous_stableGraph_small_remainder + (fun p => ζ (L p)) (fun p => π (L p)) + (fun p n => A (expandingDiscreteRadius (L p) T n)) D R hR hinv + (fun p => (hd p).1) (fun p => (hd p).2.2.2.2.1) (fun p => (hd p).2.2.2.2.2.1) + hZjoint hPjoint hAjoint C ρ ε (Real.exp (-(2 + a) * T / 2)) hC hρ.le hε + (Real.exp_nonneg _) hratio (fun p => (hd p).2.1) (fun p => (hd p).2.2.1) + (fun p => (hd p).2.2.2.1) + (fun p n => ((hd p).2.2.2.2.2.2 n).trans hτsmall) + (fun p => cutoffRemainderExtension δ (h p)) + (continuous_cutoffRemainderExtension_on_ball δ (2 * ρ) (h2ρ ▸ hσδ) h hhc) + (fun p n v u hv hu => (hLipSharp p n v u hv hu).trans + (mul_le_mul_of_nonneg_right hκsmall (norm_nonneg _))) + hZero w hwc hker hsmall + refine ⟨z, hzc, hz0, hzstep, ?_, ?_, ?_⟩ + · intro p n + apply (hzn p n).trans + apply mul_le_mul_of_nonneg_right _ (by positivity) + linarith [hsmall p] + · intro p n + apply (hzn p n).trans + apply mul_le_mul_of_nonneg_right _ (by positivity) + linarith + + · intro p + have hzball (n : ℕ) : ‖z p n‖ ≤ 2 * ρ := by + apply (hzn p n).trans + have hpow : (1 / 2 : ℝ) ^ n ≤ 1 := pow_le_one₀ (by norm_num) (by norm_num) + calc + _ ≤ 4 * (‖w p‖ + 2 * (C * ε)) := + mul_le_of_le_one_right (by positivity) hpow + _ ≤ 2 * ρ := by linarith [hsmall p] + have hhpoint : ∀ n : ℕ, + ‖cutoffRemainderExtension δ (h p) n (z p n) - + cutoffRemainderExtension δ (h p) n 0‖ ≤ κ₀ * ‖z p n‖ := by + intro n + simpa only [sub_zero] using + hLipSharp p n (z p n) 0 (hzball n) (by simpa using mul_nonneg (by norm_num : (0 : ℝ) ≤ 2) hρ.le) + have hb := stableEndpoint_coordinate_bound (E := FourierL2) (F := F) (π (L p)) + (fun n => A (expandingDiscreteRadius (L p) T n)) D R hRD hR + C τ κ₀ ε (4 * (‖w p‖ + 2 * (C * ε))) + (Real.exp (-(2 + a) * T / 2)) hC.le hτ.le hκ₀.le hε (by positivity) + (Real.exp_nonneg _) (by linarith) (fun n => (hd p).2.2.1 n) + ((hd p).2.2.2.2.2.2) (cutoffRemainderExtension δ (h p)) (z p) + (hzstep p) (hzn p) hhpoint (hZero p) + apply hb.trans + calc + _ ≤ 2 * ((ν / 8) * (4 * (‖w p‖ + 2 * (C * ε))) + C * ε) := by + gcongr + _ = ν * (‖w p‖ + 2 * (C * ε)) + 2 * (C * ε) := by ring + _ ≤ ν * (‖w p‖ + 2 * η) + 2 * η := by gcongr + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ContinuousCoordinateStableOrbit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ContinuousCoordinateStableOrbit.lean new file mode 100644 index 0000000000000000000000000000000000000000..3e4aff628dc1d721bcf2ee140b2006bbee42753e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ContinuousCoordinateStableOrbit.lean @@ -0,0 +1,140 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.ContinuousCutoffStableOrbit +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ContinuousCoordinateSequence +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.CutoffContinuousLinearization +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.CutoffEndpointContinuity +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.StableGraphStepDecay + +namespace OAI + +/-! # The global stable graph retains its localized physical coordinates -/ + +open Set Filter Topology +open scoped SchwartzMap ContDiff NNReal + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) +local notation "Radius" => {L : ℝ // 1 ≤ L} + +def HasContinuousCoordinateStableOrbits {F : Type*} + [NormedAddCommGroup F] [NormedSpace ℝ F] + (a b k : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) + (χ : 𝓢(E, ℂ)) (hχ : HasCompactSupport (χ : E → ℂ)) + (Qp : E → ℂ) (hQp : ContDiff ℝ ∞ Qp) + (κ : Radius → FourierL2 →L[ℝ] F) : Prop := + ∀ ν : ℝ, 0 < ν → ∃ ρ : ℝ, 0 < ρ ∧ ∃ C : ℝ, 0 < C ∧ ∃ K : ℝ, 0 < K ∧ + ∀ η : ℝ, 0 < η → ∃ L₀ : ℝ, + ∃ ζ : Radius → F →L[ℝ] FourierL2, + let π := fun L => K • κ L + ContinuousOn ζ {L : Radius | L₀ ≤ L.1} ∧ + Continuous (fun q : Radius × FourierL2 => π q.1 q.2) ∧ + (∀ L : Radius, L₀ ≤ L.1 → (∀ v, π L (ζ L v) = v) ∧ ‖ζ L‖ ≤ 1 ∧ ‖π L‖ ≤ C) ∧ + ∃ G : CutoffStableParameter ρ L₀ π → FourierL2, Continuous G ∧ + ∀ p, ‖G p‖ ≤ 2 * ρ ∧ ‖G p‖ ≤ 4 * (‖p.1.2‖ + 2 * η) ∧ stableFrameProjection (ζ p.1.1) (π p.1.1) (G p) = p.1.2 ∧ + ‖π p.1.1 (G p)‖ ≤ ν * (‖p.1.2‖ + 2 * η) + 2 * η ∧ + ∃ u : ℝ → FourierL2, ∃ hu : ContinuousOn u (Ici 0), + u 0 = sampledCutoffProfileOrbit a k p.1.1.1 ha1 hk p.1.1.2 χ hχ Qp hQp 0 + G p ∧ + (∀ (S : ℝ) (hS : 0 < S), expandingSlabRestriction u hu S = + expandingPicard a b k p.1.1.1 S ha hk p.1.1.2 hS.le + (expandingNonlinearReaction a k p.1.1.1 S ha ha1 hk p.1.1.2 m) (u 0) + (expandingSlabRestriction u hu S)) ∧ + Tendsto (fun s => ‖u s - sampledCutoffProfileOrbit a k p.1.1.1 ha1 hk p.1.1.2 χ hχ Qp hQp s‖) + atTop (𝓝 0) + +attribute [local irreducible] HasContinuousCoordinateStableOrbits + HasContinuousTorusCoordinateData cutoffProfileEndpoint expandingPicard + sampledCutoffProfileOrbit expandingNonlinearReaction + +theorem exists_continuous_coordinateStable_orbits {F : Type*} + [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] [FiniteDimensional ℝ F] + (a b k : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) + (χ : 𝓢(E, ℂ)) (hχ : HasCompactSupport (χ : E → ℂ)) + (Qp : E → ℂ) (hQp : ContDiff ℝ ∞ Qp) (Q : ℝ) (hQ : 0 ≤ Q) + (hqb : ∀ L : Radius, ‖cutoffProfileCoefficient a k ha1 hk χ hχ Qp hQp L‖ ≤ Q) + (T : ℝ≥0) (hT : 0 < (T : ℝ)) + (hratio : 2 * Real.exp (-(2 + a) * T / 2) ≤ 1) + (κ : Radius → FourierL2 →L[ℝ] F) + (hlinear : HasContinuousTorusCoordinateData (F := F) T + (cutoffProfileEndpoint a b k ha ha1 hk m χ hχ Qp hQp Q hQ hqb T) κ) + (hnonlinear : HasContinuousCutoffNonlinearSteps a b k ha ha1 hk m χ hχ Qp hQp Q hQ hqb T) : + HasContinuousCoordinateStableOrbits (F := F) a b k ha ha1 hk m χ hχ Qp hQp κ := by + classical + unfold HasContinuousCoordinateStableOrbits + intro ν hν + obtain ⟨δ, Lnl, B, hδ, _, hB, V, h, hcV, hch, hsol, hV, hend, hzero, hlip⟩ := hnonlinear + obtain ⟨K, hK, C, hC, ρ, hρ, hρδ, hfamily⟩ := + exists_continuous_coordinateStable_sequence a δ B ha hδ hB.le T hratio + (cutoffProfileEndpoint a b k ha ha1 hk m χ hχ Qp hQp Q hQ hqb T) + (continuous_cutoffProfileEndpoint a b k ha ha1 hk m χ hχ Qp hQp Q hQ hqb T) κ hlinear ν hν + refine ⟨ρ, hρ, C, hC, K, hK, ?_⟩ + intro η hη + obtain ⟨Lg, ζ, π, hκ, hζc, hπc, hbound, hπζ, hseq⟩ := hfamily η hη + let L₀ := max Lg Lnl + let ζ₀ := fun L => ζ L 0 + let π₀ := fun L => K • κ L + have hpizero (L : Radius) : π L 0 = π₀ L := + (hκ L 0).trans (by rw [expandingDiscreteRadius_zero]) + let P := CutoffStableParameter ρ L₀ π₀ + let l : P → Radius := fun p => p.1.1 + let w : P → FourierL2 := fun p => p.1.2 + have hlc : Continuous l := continuous_fst.comp continuous_subtype_val + have hwc : Continuous w := continuous_snd.comp continuous_subtype_val + have hl (p : P) : Lg ≤ (l p).1 := (le_max_left _ _).trans p.2.1 + let ln := fun n (p : P) => expandingDiscreteRadius (l p) T n + have hln (n : ℕ) (p : P) : Lnl ≤ (ln n p).1 := + ((le_max_right _ _).trans p.2.1).trans (expandingDiscreteRadius_ge (l p) T n) + let r := fun n (p : P) => (⟨(ln n p).1, (ln n p).2, hln n p⟩ : {R : ℝ // 1 ≤ R ∧ Lnl ≤ R}) + have hrc (n : ℕ) : Continuous (r n) := + (continuous_subtype_val.comp ((continuous_expandingDiscreteRadius T n).comp hlc)).subtype_mk _ + let H := fun p n v => h (r n p, v) + have hHc (n : ℕ) : Continuous (fun q : P × {v : FourierL2 // ‖v‖ ≤ δ} => H q.1 n q.2) := + hch.comp (((hrc n).comp continuous_fst).prodMk continuous_snd) + obtain ⟨z, hzc, hz0, hzstep, hzn, hsharp, hflat⟩ := hseq P l hlc hl H hHc + (fun p n d hd hdδ v u hv hu => hlip d hd hdδ (r n p) v u hv hu) + (fun p n v hv => hzero (r n p, v) hv) + w hwc (fun p => p.2.2.1) (fun p => by + rw [hpizero] + exact p.2.2.2) + refine ⟨L₀, ζ₀, ?_, ?_, ?_, (fun p => z p 0), hzc 0, ?_⟩ + · apply (hζc 0).mono + intro L hL + exact (le_max_left Lg Lnl).trans hL + · have he : (fun p : Radius × FourierL2 => π₀ p.1 p.2) = + (fun p : Radius × FourierL2 => π p.1 0 p.2) := by + funext p + rw [hpizero] + rw [he] + exact hπc 0 + · intro L hL + have hLg : Lg ≤ L.1 := (le_max_left _ _).trans hL + simpa only [hpizero] using + (show (∀ v, π L 0 (ζ L 0 v) = v) ∧ ‖ζ L 0‖ ≤ 1 ∧ ‖π L 0‖ ≤ C from + ⟨hπζ L hLg 0, (hbound L hLg 0).1, (hbound L hLg 0).2⟩) + · intro p + refine ⟨by simpa using hzn p 0, by simpa using hsharp p 0, ?_, ?_, ?_⟩ + · simpa only [hpizero] using hz0 p + · simpa only [hpizero] using hflat p + · have hzδ (n : ℕ) : ‖z p n‖ ≤ δ := (hzn p n).trans ((mul_le_of_le_one_right + (by positivity : 0 ≤ 2 * ρ) (pow_le_one₀ (by norm_num : (0 : ℝ) ≤ 1 / 2) (by norm_num))).trans hρδ) + let Z := fun n => (⟨z p n, hzδ n⟩ : {f : FourierL2 // ‖f‖ ≤ δ}) + let W := fun n => V (r n p, Z n) + have hWM (n : ℕ) : W n ⟨T, T.2, le_rfl⟩ = z p (n + 1) := by + calc + _ = cutoffProfileEndpoint a b k ha ha1 hk m χ hχ Qp hQp Q hQ hqb T (ln n p) (z p n) + + H p n (Z n) := hend (r n p, Z n) + _ = cutoffProfileEndpoint a b k ha ha1 hk m χ hχ Qp hQp Q hQ hqb T (ln n p) (z p n) + + cutoffRemainderExtension δ (H p) n (z p n) := by + rw [cutoffRemainderExtension, dite_eq_left (hzδ n)] + _ = _ := (hzstep p n).symm + have hWbound (n : ℕ) : ‖W n‖ ≤ B * (‖z p n‖ + + (expandingRadius (l p).1 ((n : ℝ) * T)) ^ (-2 - a)) := hV (r n p, Z n) + have hr : Real.exp (-(2 + a) * T / 2) ≤ 1 / 2 := by linarith + have hWgeo := cutoffStep_path_geometric_bound a (l p).1 T B (2 * ρ) + (lt_of_lt_of_le zero_lt_one (l p).2) hB.le hr (z p) W (hzn p) hWbound + exact exists_cutoffGlobal_orbit_of_steps a b k (l p).1 T ha ha1 hk (l p).2 hT m χ hχ Qp hQp + (z p) W hWM (fun n => hsol (r n p, Z n)) + (B * (2 * ρ + (l p).1 ^ (-2 - a))) (1 / 2) (by norm_num) (by norm_num) hWgeo + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ContinuousDiagonalLinearStep.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ContinuousDiagonalLinearStep.lean new file mode 100644 index 0000000000000000000000000000000000000000..b081f9f188b293d8bc08e48eceb065ba8fb1957b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ContinuousDiagonalLinearStep.lean @@ -0,0 +1,59 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.ContinuousTorusAssembly +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.DiagonalRealCoordinates + +namespace OAI + +/-! # Continuous normalized linear data in the real diagonal symmetry coordinates -/ + +open scoped SchwartzMap NNReal + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) +local notation "Radius" => {L : ℝ // 1 ≤ L} + +def HasContinuousFiniteDiagonalTorusLinearSteps {H V : Type*} + [NormedAddCommGroup H] [NormedSpace ℝ H] + [NormedAddCommGroup V] [NormedSpace ℂ V] [FiniteDimensional ℂ V] + (π : H →L[ℝ] V) (A : ℝ≥0 → Radius → FourierL2 →L[ℝ] FourierL2) : Prop := + ∃ G : V →L[ℂ] V, + ∃ hspan : (⨆ lam : ℂ, Module.End.eigenspace G.toLinearMap lam) = ⊤, + ∃ hspec : ∀ (lam : ℂ) (v : V), v ≠ 0 → G v = lam • v → + lam = 0 ∨ lam = 1 ∨ lam = 1 / 2, + ∃ T₀ : ℝ, 0 ≤ T₀ ∧ ∀ T : ℝ≥0, T₀ ≤ T → + HasContinuousTorusLinearStep (F := (diagonalRealCoordinates π G hspan hspec).range) T (A T) + +theorem continuous_finiteDiagonalTorusLinearSteps_of_transfer {V : Type*} + [NormedAddCommGroup V] [NormedSpace ℂ V] [FiniteDimensional ℂ V] + (a k : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (χ : 𝓢(E, ℂ)) + (ρ : ℝ) (hρ : 0 < ρ) (hχ : ∀ y : E, ‖y‖ ≤ ρ → χ y = 1) + (π : HomogeneousY a k →L[ℝ] V) (G : V →L[ℂ] V) + (hspan : (⨆ lam : ℂ, Module.End.eigenspace G.toLinearMap lam) = ⊤) + (hspec : ∀ (lam : ℂ) (v : V), v ≠ 0 → G v = lam • v → + lam = 0 ∨ lam = 1 ∨ lam = 1 / 2) + (A : ℝ≥0 → Radius → FourierL2 →L[ℝ] FourierL2) + (hkernel : ∀ β : ℝ, 0 < β → ∃ T₀ : ℝ, 0 ≤ T₀ ∧ + ∀ T : ℝ≥0, T₀ ≤ T → ∃ L₀ : ℝ, ∀ L : Radius, L₀ ≤ L.1 → + ∀ f : FourierL2, ‖f‖ ≤ 1 → + π (homogeneousLocalizationCLM a k L.1 ha ha1 hk L.2 χ f) = 0 → ‖A T L f‖ < β) + (hcoord : ∀ T, HasContractingTorusCoordinateTransfer a k ha ha1 hk χ + (diagonalRealCoordinates π G hspan hspec) T (A T)) + (hA : ∀ T, ∃ C : ℝ, 0 ≤ C ∧ ∀ L, ‖A T L‖ ≤ C) : + HasContinuousFiniteDiagonalTorusLinearSteps π A := by + let : FiniteDimensional ℝ (SymmetryCoordinates G) := + FiniteDimensional.trans ℝ ℂ (SymmetryCoordinates G) + refine ⟨G, hspan, hspec, ?_⟩ + apply continuous_torusLinearSteps_of_transfer a k ha ha1 hk χ ρ hρ hχ + (diagonalRealCoordinates π G hspan hspec) A + · intro β hβ + obtain ⟨T₀, hT₀, hT⟩ := hkernel β hβ + refine ⟨T₀, hT₀, fun T hTT => ?_⟩ + obtain ⟨L₀, hL₀⟩ := hT T hTT + refine ⟨L₀, fun L hL f hf hz => ?_⟩ + exact hL₀ L hL f hf ((diagonalRealCoordinates_zero_iff π G hspan hspec _).mp hz) + · exact hcoord + · exact hA + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ContinuousDiagonalStableOrbit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ContinuousDiagonalStableOrbit.lean new file mode 100644 index 0000000000000000000000000000000000000000..967b641ea18f6dc7720b9c871ce2e3b5fc0c2212 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ContinuousDiagonalStableOrbit.lean @@ -0,0 +1,57 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.ContinuousCutoffStableOrbit +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ContinuousDiagonalLinearStep +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.FiniteCoordinateComplete + +namespace OAI + +/-! # Continuous finite symmetry coordinates select global stable cutoff orbits -/ + +open scoped SchwartzMap ContDiff NNReal + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) +local notation "Radius" => {L : ℝ // 1 ≤ L} + +attribute [local irreducible] diagonalRealCoordinates + +def HasContinuousFiniteDiagonalCutoffStableOrbits {V : Type*} + [NormedAddCommGroup V] [NormedSpace ℂ V] [FiniteDimensional ℂ V] + (a b k : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) + (χ : 𝓢(E, ℂ)) (hχ : HasCompactSupport (χ : E → ℂ)) + (Qp : E → ℂ) (hQp : ContDiff ℝ ∞ Qp) (π : HomogeneousY a k →L[ℝ] V) : Prop := + ∃ G : V →L[ℂ] V, + ∃ hspan : (⨆ lam : ℂ, Module.End.eigenspace G.toLinearMap lam) = ⊤, + ∃ hspec : ∀ (lam : ℂ) (v : V), v ≠ 0 → G v = lam • v → + lam = 0 ∨ lam = 1 ∨ lam = 1 / 2, + HasContinuousCutoffStableOrbits (F := (diagonalRealCoordinates π G hspan hspec).range) + a b k ha ha1 hk m χ hχ Qp hQp + +theorem continuousCutoffStableOrbits_of_linear_steps {V : Type*} + [NormedAddCommGroup V] [NormedSpace ℂ V] [FiniteDimensional ℂ V] + (a b k : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) + (χ : 𝓢(E, ℂ)) (hχ : HasCompactSupport (χ : E → ℂ)) + (Qp : E → ℂ) (hQp : ContDiff ℝ ∞ Qp) (Q : ℝ) (hQ : 0 ≤ Q) + (hqb : ∀ L : Radius, ‖cutoffProfileCoefficient a k ha1 hk χ hχ Qp hQp L‖ ≤ Q) + (π : HomogeneousY a k →L[ℝ] V) + (hlinear : HasContinuousFiniteDiagonalTorusLinearSteps π + (cutoffProfileEndpoint a b k ha ha1 hk m χ hχ Qp hQp Q hQ hqb)) + (hnonlinear : ∀ T : ℝ≥0, HasContinuousCutoffNonlinearSteps a b k ha ha1 hk m χ hχ Qp hQp Q hQ hqb T) : + HasContinuousFiniteDiagonalCutoffStableOrbits a b k ha ha1 hk m χ hχ Qp hQp π := by + obtain ⟨G, hspan, hspec, T₀, _, hT₀⟩ := hlinear + let : FiniteDimensional ℝ (SymmetryCoordinates G) := + FiniteDimensional.trans ℝ ℂ (SymmetryCoordinates G) + let F := (diagonalRealCoordinates π G hspan hspec).range + let : CompleteSpace F := finiteCoordinate_complete (diagonalRealCoordinates π G hspan hspec) + obtain ⟨M₀, hM₀, hM⟩ := exists_cutoffStep_geometric_ratio a ha + let T : ℝ≥0 := ⟨max T₀ M₀, hM₀.le.trans (le_max_right _ _)⟩ + have hT : 0 < (T : ℝ) := hM₀.trans_le (le_max_right _ _) + have hr : 2 * Real.exp (-(2 + a) * T / 2) ≤ 1 := + (hM T (le_max_right _ _)).trans (by norm_num) + refine ⟨G, hspan, hspec, ?_⟩ + exact exists_continuous_cutoffStable_orbits (F := F) a b k ha ha1 hk m χ hχ Qp hQp Q hQ hqb T hT hr + (hT₀ T (le_max_left _ _)) (hnonlinear T) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ContinuousHalfLineBound.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ContinuousHalfLineBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..0ee6497782eb4f970c91ffd869708650f407ad29 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ContinuousHalfLineBound.lean @@ -0,0 +1,51 @@ +import Mathlib.Topology.ContinuousMap.Bounded.Normed +import Mathlib.Topology.Instances.Real.Lemmas +import Mathlib.Analysis.Normed.Group.Tannery + +namespace OAI + +/-! Bounded extensions of continuous functions with a bounded tail. -/ + +open Filter Set +open scoped BoundedContinuousFunction +namespace DefocusingNLS + +variable {E : Type*} [NormedAddCommGroup E] + +theorem continuous_halfLine_bound (f : ℝ → E) (hf : Continuous f) + (h : ∃ C : ℝ, ∀ᶠ t in atTop, ‖f t‖ ≤ C) : + ∃ M : ℝ, ∀ t, 0 ≤ t → ‖f t‖ ≤ M := by + obtain ⟨C,hC⟩ := h + obtain ⟨T,hT⟩ := eventually_atTop.mp hC + obtain ⟨D,hD⟩ := (isCompact_Icc : IsCompact (Icc (0 : ℝ) (max T 0))).exists_bound_of_continuousOn + hf.continuousOn + refine ⟨max C D,?_⟩ + intro t ht + by_cases hTt : T ≤ t + · exact (hT t hTt).trans (le_max_left _ _) + · exact (hD t ⟨ht,(le_of_lt (lt_of_not_ge hTt)).trans (le_max_left _ _)⟩).trans + (le_max_right _ _) + +theorem exists_bounded_extension_nonneg (f : ℝ → E) (hf : Continuous f) + (h : ∃ C : ℝ, ∀ᶠ t in atTop, ‖f t‖ ≤ C) : + ∃ F : ℝ →ᵇ E, ∀ t, 0 ≤ t → F t=f t := by + obtain ⟨M,hM⟩ := continuous_halfLine_bound f hf h + let F : ℝ →ᵇ E := BoundedContinuousFunction.ofNormedAddCommGroup + (fun t => f (max t 0)) (hf.comp (continuous_id.max continuous_const)) M + (fun t => hM _ (le_max_right t 0)) + refine ⟨F,?_⟩ + intro t ht + change f (max t 0)=f t + rw [max_eq_left ht] + +theorem continuous_tendsto_halfLine_bounded (f : ℝ → E) (hf : Continuous f) + (a : E) (ha : Tendsto f atTop (nhds a)) : + ∃ F : ℝ →ᵇ E, ∀ t, 0 ≤ t → F t=f t := by + apply exists_bounded_extension_nonneg f hf + refine ⟨‖a‖+1,?_⟩ + filter_upwards [ha.norm.eventually (gt_mem_nhds (show ‖a‖<‖a‖+1 by linarith))] with t ht + exact ht.le + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ContinuousSampledFrame.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ContinuousSampledFrame.lean new file mode 100644 index 0000000000000000000000000000000000000000..c1b3b32cf263a389dedcfadde4312c4e70780f25 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ContinuousSampledFrame.lean @@ -0,0 +1,50 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.SchwartzSampleContinuity +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.SampledSchwartzFrame +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousLocalizationContinuity + +namespace OAI + +/-! # Continuous sampled frames and their finite coordinate matrices -/ + +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) +local notation "Radius" => {L : ℝ // 1 ≤ L} + +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] [FiniteDimensional ℝ F] + +attribute [local irreducible] sampledSchwartzFrame expandingCoordinates homogeneousLocalizationCLM + +theorem continuous_sampledSchwartzFrame (a k : ℝ) (ha1 : a < 1) (hk : 8 < k) + (B : F →ₗ[ℝ] 𝓢(E, ℂ)) : Continuous (sampledSchwartzFrame a k ha1 hk B) := by + classical + apply continuous_clm_apply.mpr + intro v + have he (L : Radius) : sampledSchwartzFrame a k ha1 hk B L v = + ∑ i, (Module.finBasis ℝ F).repr v i • + schwartzTorusSample a k L.1 ha1 hk L.2 + (radianFourierKernel (B ((Module.finBasis ℝ F) i))) := by + conv_lhs => rw [← (Module.finBasis ℝ F).sum_repr v] + simp only [map_sum, map_smul, sampledSchwartzFrame_basis] + simp_rw [he] + exact continuous_finsetSum _ (fun i _ => + (continuous_const : Continuous (fun _ : Radius => (Module.finBasis ℝ F).repr v i)).smul + (continuous_schwartzTorusSample a k ha1 hk _)) + +theorem continuous_sampledSchwartzFrame_coordinates (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (χ : 𝓢(E, ℂ)) + (π : HomogeneousY a k →L[ℝ] F) (B : F →ₗ[ℝ] 𝓢(E, ℂ)) : + Continuous (fun L : Radius => (expandingCoordinates a k ha ha1 hk χ π L).comp + (sampledSchwartzFrame a k ha1 hk B L)) := by + apply continuous_clm_apply.mpr + intro v + have hv : Continuous (fun L : Radius => sampledSchwartzFrame a k ha1 hk B L v) := + (continuous_sampledSchwartzFrame a k ha1 hk B).clm_apply continuous_const + exact (continuous_expandingCoordinates_apply a k ha ha1 hk χ π).comp + (continuous_id.prodMk hv) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/CorrectedTorusFrame.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/CorrectedTorusFrame.lean new file mode 100644 index 0000000000000000000000000000000000000000..034fb5e3877914b1a20e5aef400e3db751a75e70 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/CorrectedTorusFrame.lean @@ -0,0 +1,94 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.SampledSchwartzFrame +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.NearIdentityInverse +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.StableGraphReconstruction + +namespace OAI + +/-! # Exact, uniformly bounded right inverses of torus coordinates -/ + +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) +local notation "Radius" => {L : ℝ // 1 ≤ L} + +theorem exists_correctedTorusFrame {F : Type*} + [NormedAddCommGroup F] [NormedSpace ℝ F] [FiniteDimensional ℝ F] + (a k : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (χ : 𝓢(E, ℂ)) (ρ : ℝ) (hρ : 0 < ρ) + (hχ : ∀ y : E, ‖y‖ ≤ ρ → χ y = 1) + (π : HomogeneousY a k →L[ℝ] F) (hπ : Function.Surjective π) : + ∃ C : ℝ, 0 ≤ C ∧ ∃ L₀ : ℝ, ∀ L : Radius, L₀ ≤ L.1 → + ∃ E₀ : F →L[ℝ] FourierL2, + (expandingCoordinates a k ha ha1 hk χ π L).comp E₀ = + ContinuousLinearMap.id ℝ F ∧ ‖E₀‖ ≤ C := by + obtain ⟨B, hB⟩ := exists_homogeneousSchwartz_frame a k ha ha1 hk π hπ + obtain ⟨C, hC, hCb⟩ := sampledSchwartzFrame_uniform_bound a k ha1 hk B + obtain ⟨L₀, hL₀⟩ := sampledSchwartzFrame_coordinate_approximation a k ha ha1 hk + χ ρ hρ hχ π B hB (1 / 2) (by norm_num) + refine ⟨C * 2, mul_nonneg hC (by norm_num), L₀, ?_⟩ + intro L hL + obtain ⟨D, _, hAD, hD⟩ := exists_nearIdentity_inverse _ (hL₀ L hL) + refine ⟨(sampledSchwartzFrame a k ha1 hk B L).comp D, ?_, ?_⟩ + · rw [← ContinuousLinearMap.comp_assoc] + exact hAD + · exact (ContinuousLinearMap.opNorm_comp_le _ _).trans + (mul_le_mul (hCb L) hD (norm_nonneg _) hC) + +theorem exists_boundedTorusFrame {F : Type*} + [NormedAddCommGroup F] [NormedSpace ℝ F] [FiniteDimensional ℝ F] + (a k : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (χ : 𝓢(E, ℂ)) (ρ : ℝ) (hρ : 0 < ρ) + (hχ : ∀ y : E, ‖y‖ ≤ ρ → χ y = 1) + (π : HomogeneousY a k →L[ℝ] F) (hπ : Function.Surjective π) : + ∃ C : ℝ, 0 < C ∧ ∃ L₀ : ℝ, ∃ ζ : Radius → F →L[ℝ] FourierL2, + ∀ L : Radius, L₀ ≤ L.1 → + (expandingCoordinates a k ha ha1 hk χ π L).comp (ζ L) = + ContinuousLinearMap.id ℝ F ∧ + ‖ζ L‖ ≤ C ∧ + ‖stableFrameProjection (ζ L) (expandingCoordinates a k ha ha1 hk χ π L)‖ ≤ C := by + classical + obtain ⟨Cζ, hCζ, L₀, hframe⟩ := exists_correctedTorusFrame a k ha ha1 hk χ ρ hρ hχ π hπ + obtain ⟨CJ, hCJ, hJ⟩ := exists_homogeneousLocalization_bound a k ha ha1 hk χ + let Cπ := ‖π‖ * CJ + have hCπ : 0 ≤ Cπ := mul_nonneg (norm_nonneg _) hCJ + let ζ : Radius → F →L[ℝ] FourierL2 := fun L => + if hL : L₀ ≤ L.1 then (hframe L hL).choose else 0 + have hz (L : Radius) (hL : L₀ ≤ L.1) : + (expandingCoordinates a k ha ha1 hk χ π L).comp (ζ L) = + ContinuousLinearMap.id ℝ F ∧ ‖ζ L‖ ≤ Cζ := by + simpa only [ζ, dite_eq_left hL] using (hframe L hL).choose_spec + refine ⟨1 + Cζ + Cζ * Cπ, by positivity, L₀, ζ, ?_⟩ + intro L hL + obtain ⟨he, hb⟩ := hz L hL + have hπb : ‖expandingCoordinates a k ha ha1 hk χ π L‖ ≤ Cπ := + expandingCoordinates_norm_le a k CJ ha ha1 hk hCJ χ π hJ L + refine ⟨he, by nlinarith, ?_⟩ + calc + _ ≤ ‖ContinuousLinearMap.id ℝ FourierL2‖ + + ‖(ζ L).comp (expandingCoordinates a k ha ha1 hk χ π L)‖ := norm_sub_le _ _ + _ ≤ 1 + Cζ * Cπ := add_le_add (ContinuousLinearMap.norm_id_le) + ((ContinuousLinearMap.opNorm_comp_le _ _).trans (mul_le_mul hb hπb (norm_nonneg _) hCζ)) + _ ≤ _ := by linarith + +theorem exists_boundedTorusRangeFrame {F : Type*} + [NormedAddCommGroup F] [NormedSpace ℝ F] [FiniteDimensional ℝ F] + (a k : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (χ : 𝓢(E, ℂ)) (ρ : ℝ) (hρ : 0 < ρ) + (hχ : ∀ y : E, ‖y‖ ≤ ρ → χ y = 1) + (π : HomogeneousY a k →L[ℝ] F) : + ∃ C : ℝ, 0 < C ∧ ∃ L₀ : ℝ, ∃ ζ : Radius → π.range →L[ℝ] FourierL2, + ∀ L : Radius, L₀ ≤ L.1 → + (expandingCoordinates a k ha ha1 hk χ π.rangeRestrict L).comp (ζ L) = + ContinuousLinearMap.id ℝ π.range ∧ + ‖ζ L‖ ≤ C ∧ + ‖stableFrameProjection (ζ L) + (expandingCoordinates a k ha ha1 hk χ π.rangeRestrict L)‖ ≤ C := by + apply exists_boundedTorusFrame a k ha ha1 hk χ ρ hρ hχ π.rangeRestrict + rintro ⟨v, u, hu⟩ + exact ⟨u, Subtype.ext hu⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorCertificatePositivity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorCertificatePositivity.lean new file mode 100644 index 0000000000000000000000000000000000000000..b871c9df5b77ec24474532f7fdc1200230a97ef4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorCertificatePositivity.lean @@ -0,0 +1,21 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ExteriorCertificateRecipe + +namespace OAI + +/-! Exact positivity checks for the three finite exterior polynomials. -/ + +namespace DefocusingNLS.ExteriorCertificate + +theorem diagonal_coefficients_positive : + positiveCoefficients (realCoefficients (diagonal 270400000) 11) = true := by + decide +kernel + +theorem real_bound_coefficients_positive : positiveCoefficients realBound = true := by + decide +kernel + +theorem imaginary_bound_coefficients_positive : positiveCoefficients imaginaryBound = true := by + decide +kernel + +end DefocusingNLS.ExteriorCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorCertificateRecipe.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorCertificateRecipe.lean new file mode 100644 index 0000000000000000000000000000000000000000..993f4bdde3f847c0d4a706026ab25141fef9c67f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorCertificateRecipe.lean @@ -0,0 +1,69 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryCertificateArithmetic + +namespace OAI + +/-! The depth-five exterior certificate with a free real spatial variable. -/ + +namespace DefocusingNLS.ExteriorCertificate +open GaussianEnclosure +open BoundaryCertificate (EnclosurePolynomial coefficient constant Row State) + +def step (z₀ : ℤ) (n : ℕ) (xy : State) : State := + let M := constant 500000000 + let t := [coefficient (100000000*(n : ℤ)) (-33477607) 2] + let s := [coefficient 0 z₀ 0, coefficient 0 100000000 0] + let d := subPolynomial t M + let x₀ := addPolynomial (mulPolynomial t xy.1.1) (mulPolynomial s xy.2.1) + let x₁ := addPolynomial (mulPolynomial t xy.1.2) (mulPolynomial s xy.2.2) + ((x₀,x₁), (subPolynomial (mulPolynomial d xy.2.1) x₀, + subPolynomial (mulPolynomial d xy.2.2) x₁)) + +def state (z₀ : ℤ) : ℕ → State + | 0 => ((constant 1,constant 0),(constant 0,constant 1)) + | n+1 => step z₀ n (state z₀ n) + +def hermitian (z₀ : ℤ) (x y z w : EnclosurePolynomial) : EnclosurePolynomial := + addPolynomial + (mulPolynomial (mulPolynomial (constant 500000000) (conjPolynomial x)) z) + (mulPolynomial [coefficient 0 z₀ 0, coefficient 0 100000000 0] + (subPolynomial (mulPolynomial (conjPolynomial x) w) + (mulPolynomial (conjPolynomial y) z))) + +def diagonal (z₀ : ℤ) : EnclosurePolynomial := + let xy := state z₀ 5 + hermitian z₀ xy.1.2 xy.2.2 xy.1.2 xy.2.2 + +def lowerOffDiagonal (z₀ : ℤ) : EnclosurePolynomial := + let xy := state z₀ 5 + hermitian z₀ xy.1.2 xy.2.2 xy.1.1 xy.2.1 + +def realCoefficients (as : EnclosurePolynomial) (N : ℕ) : EnclosurePolynomial := + (List.range N).map fun n : ℕ => + let a := (as[n]?).getD zero + coefficient a.center.re 0 a.error + +def negImagCoefficients (as : EnclosurePolynomial) (N : ℕ) : EnclosurePolynomial := + (List.range N).map fun n : ℕ => + let a := (as[n]?).getD zero + coefficient (-a.center.im) 0 a.error + +def determinantMargin (z₀ : ℤ) : EnclosurePolynomial := + [coefficient (1130*100000000^10*z₀) 0 0, + coefficient (1130*100000000^11) 0 0] + +def realBound : EnclosurePolynomial := + addPolynomial (mulPolynomial (constant 43) (realCoefficients (diagonal 270400000) 11)) + (mulPolynomial (constant 1000) + (subPolynomial (realCoefficients (lowerOffDiagonal 270400000) 11) + (determinantMargin 270400000))) + +def imaginaryBound : EnclosurePolynomial := + subPolynomial (negImagCoefficients (lowerOffDiagonal 300000000) 9) + (determinantMargin 300000000) + +def positiveCoefficients (as : EnclosurePolynomial) : Bool := + as.all (fun a => decide (a.error < a.center.re)) + +end DefocusingNLS.ExteriorCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorFormBounds.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorFormBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..a2638400f7744a73f4177358ddb55161d452f7f0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorFormBounds.lean @@ -0,0 +1,76 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ExteriorImaginaryProjection + +namespace OAI + +/-! Three inequalities for the forward matrix on whole rays. -/ + +namespace DefocusingNLS.ExteriorCertificate +open Polynomial + +noncomputable def exteriorForm (b Z : ℝ) (i j : Fin 2) : ℂ := + forwardFormEntry 5 (Complex.I*(Z : ℂ)) + (forwardProduct 5 (Complex.I*(Z : ℂ)) (-Complex.I*(b : ℂ)) 5) i j + +private theorem form_eval_re (z₀ : ℤ) (b Z : ℝ) (i j : Fin 2) : + ((formPolynomial z₀ b i j).eval ((Z-(z₀ : ℝ)/100000000 : ℝ) : ℂ)).re = + (100000000 : ℝ)^11*(exteriorForm b Z i j).re := by + rw [formPolynomial_eval, show (z₀ : ℝ)/100000000+(Z-(z₀ : ℝ)/100000000)=Z by ring] + change (((100000000 : ℝ)^11 : ℂ)*exteriorForm b Z i j).re = _ + norm_num [Complex.mul_re,Complex.mul_im] + +private theorem form_eval_im (z₀ : ℤ) (b Z : ℝ) (i j : Fin 2) : + ((formPolynomial z₀ b i j).eval ((Z-(z₀ : ℝ)/100000000 : ℝ) : ℂ)).im = + (100000000 : ℝ)^11*(exteriorForm b Z i j).im := by + rw [formPolynomial_eval, show (z₀ : ℝ)/100000000+(Z-(z₀ : ℝ)/100000000)=Z by ring] + change (((100000000 : ℝ)^11 : ℂ)*exteriorForm b Z i j).im = _ + norm_num [Complex.mul_re,Complex.mul_im] + +private theorem margin_eval_re (z₀ : ℤ) (Z : ℝ) : + ((marginPolynomial z₀).eval ((Z-(z₀ : ℝ)/100000000 : ℝ) : ℂ)).re = + (100000000 : ℝ)^11*(1130*Z) := by + norm_num [marginPolynomial,Complex.mul_re,Complex.mul_im] + ring + +theorem exterior_diagonal_positive (b Z : ℝ) + (hb : |100000000*b-33477607| ≤ 2) (hZ : 2704/1000 ≤ Z) : + 0 < (exteriorForm b Z 1 1).re := by + have hv : 0 ≤ Z-(270400000 : ℝ)/100000000 := by norm_num; linarith + have h := diagonal_polynomial_positive b (Z-270400000/100000000) hb hv + have he := form_eval_re 270400000 b Z 1 1 + norm_num at h he + rw [he] at h + linarith + +theorem exterior_real_bound (b Z : ℝ) + (hb : |100000000*b-33477607| ≤ 2) (hZ : 2704/1000 ≤ Z) : + 0 < (43/1000 : ℝ)*(exteriorForm b Z 1 1).re+ + (exteriorForm b Z 1 0).re-1130*Z := by + have hv : 0 ≤ Z-(270400000 : ℝ)/100000000 := by norm_num; linarith + have h := real_bound_polynomial_positive b (Z-270400000/100000000) hb hv + simp only [realBoundPolynomial,eval_add,eval_mul,eval_C,eval_sub, + realProjection_eval,Complex.add_re,Complex.sub_re,Complex.mul_re, + Complex.ofReal_re,Complex.ofReal_im] at h + norm_num at h + have hd := form_eval_re 270400000 b Z 1 1 + have hc := form_eval_re 270400000 b Z 1 0 + have hm := margin_eval_re 270400000 Z + norm_num at hd hc hm + rw [hd,hc,hm] at h + nlinarith + +theorem exterior_imaginary_bound (b Z : ℝ) + (hb : |100000000*b-33477607| ≤ 2) (hZ : 3 ≤ Z) : + 0 < -(exteriorForm b Z 1 0).im-1130*Z := by + have hv : 0 ≤ Z-(300000000 : ℝ)/100000000 := by norm_num; linarith + have h := imaginary_bound_polynomial_positive b (Z-300000000/100000000) hb hv + simp only [imaginaryBoundPolynomial,eval_sub,negImagProjection_eval, + Complex.sub_re,Complex.neg_re,Complex.ofReal_re] at h + have hc := form_eval_im 300000000 b Z 1 0 + have hm := margin_eval_re 300000000 Z + norm_num at h hc hm + rw [hc,hm] at h + nlinarith + +end DefocusingNLS.ExteriorCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorFormDeterminant.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorFormDeterminant.lean new file mode 100644 index 0000000000000000000000000000000000000000..0ed0885cabf3ff7beaa8447406f1b97d89d9697f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorFormDeterminant.lean @@ -0,0 +1,35 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ExteriorHermitianDisk + +namespace OAI + +/-! Determinant of the transported two-dimensional Hermitian form. -/ + +namespace DefocusingNLS + +private theorem forwardFormEntry_determinant_complex (M : ℝ) (s : ℂ) + (T : Matrix (Fin 2) (Fin 2) ℂ) : + forwardFormEntry M s T 0 0*forwardFormEntry M s T 1 1- + forwardFormEntry M s T 0 1*forwardFormEntry M s T 1 0 = + s^2*T.det*star T.det := by + simp only [forwardFormEntry,Matrix.det_fin_two,star_sub,star_mul] + ring + +theorem forwardFormEntry_determinant (M Z : ℝ) (T : Matrix (Fin 2) (Fin 2) ℂ) : + (forwardFormEntry M (Complex.I*(Z : ℂ)) T 0 0).re* + (forwardFormEntry M (Complex.I*(Z : ℂ)) T 1 1).re- + Complex.normSq (forwardFormEntry M (Complex.I*(Z : ℂ)) T 0 1) = + -Z^2*Complex.normSq T.det := by + have hs : (Complex.I*(Z : ℂ)).re = 0 := by simp + have h := forwardFormEntry_determinant_complex M (Complex.I*(Z : ℂ)) T + rw [forwardFormEntry_diagonal M _ T hs 0, + forwardFormEntry_diagonal M _ T hs 1, + ← forwardFormEntry_hermitian M _ T hs 1 0] at h + have hr := congrArg Complex.re h + simp only [Complex.sub_re,Complex.mul_re,Complex.mul_im,Complex.ofReal_re, + Complex.ofReal_im,Complex.star_def,Complex.conj_re,Complex.conj_im, + Complex.I_re,Complex.I_im,pow_two,Complex.normSq_apply] at hr ⊢ + nlinarith [hr] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorFormPolynomial.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorFormPolynomial.lean new file mode 100644 index 0000000000000000000000000000000000000000..d65ab8ed5c312d0b3c7c8c26fbff84d190ebb21b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorFormPolynomial.lean @@ -0,0 +1,83 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ExteriorPolynomial +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryFormEvaluation + +namespace OAI + +/-! The certified K=5 polynomials are the actual transported exterior form. -/ + +open Polynomial Matrix +namespace DefocusingNLS.ExteriorCertificate +open GaussianEnclosure +open BoundaryCertificate (EnclosurePolynomial EnclosesState stateMatrix constant_sound) + +attribute [local irreducible] state polynomialState + +noncomputable def formPolynomial (z₀ : ℤ) (b : ℝ) (i j : Fin 2) : Polynomial ℂ := + let T := stateMatrix (polynomialState z₀ b 5) + C (500000000 : ℂ)*conjugatePolynomial (T 0 i)*T 0 j+ + inputS z₀*(conjugatePolynomial (T 0 i)*T 1 j-conjugatePolynomial (T 1 i)*T 0 j) + +private theorem hermitian_sound (z₀ : ℤ) + {x y z w : EnclosurePolynomial} {p q r t : Polynomial ℂ} + (hx : EnclosesPolynomial x p) (hy : EnclosesPolynomial y q) + (hz : EnclosesPolynomial z r) (hw : EnclosesPolynomial w t) : + EnclosesPolynomial (hermitian z₀ x y z w) + (C (500000000 : ℂ)*conjugatePolynomial p*r+ + inputS z₀*(conjugatePolynomial p*t-conjugatePolynomial q*r)) := by + exact addPolynomial_sound + (mulPolynomial_sound (mulPolynomial_sound (constant_sound 500000000) + (conjPolynomial_sound hx)) hz) + (mulPolynomial_sound (inputS_sound z₀) + (subPolynomial_sound (mulPolynomial_sound (conjPolynomial_sound hx) hw) + (mulPolynomial_sound (conjPolynomial_sound hy) hz))) + +theorem diagonal_sound (z₀ : ℤ) (b : ℝ) (hb : |100000000*b-33477607| ≤ 2) : + EnclosesPolynomial (diagonal z₀) (formPolynomial z₀ b 1 1) := by + obtain ⟨_,hx,_,hy⟩ := state_sound z₀ b hb 5 + exact hermitian_sound z₀ hx hy hx hy + +theorem lowerOffDiagonal_sound (z₀ : ℤ) (b : ℝ) (hb : |100000000*b-33477607| ≤ 2) : + EnclosesPolynomial (lowerOffDiagonal z₀) (formPolynomial z₀ b 1 0) := by + obtain ⟨hx₀,hx₁,hy₀,hy₁⟩ := state_sound z₀ b hb 5 + exact hermitian_sound z₀ hx₁ hy₁ hx₀ hy₀ + +private theorem forwardFormEntry_real_scaling (h a M : ℝ) (s : ℂ) + (T : Matrix (Fin 2) (Fin 2) ℂ) (i j : Fin 2) : + forwardFormEntry (h*M) ((h : ℂ)*s) ((a : ℂ) • T) i j = + ((h*a^2 : ℝ) : ℂ)*forwardFormEntry M s T i j := by + simp only [forwardFormEntry, Matrix.smul_apply, smul_eq_mul, star_mul, + Complex.star_def, Complex.conj_ofReal, Complex.ofReal_mul, Complex.ofReal_pow] + ring + +/-- The degree-truncated checks must be applied to this same coherent form. -/ +theorem formPolynomial_eval (z₀ : ℤ) (b v : ℝ) (i j : Fin 2) : + (formPolynomial z₀ b i j).eval (v : ℂ) = + (100000000 : ℂ)^11* + forwardFormEntry 5 (Complex.I*(((z₀ : ℝ)/100000000+v : ℝ) : ℂ)) + (forwardProduct 5 (Complex.I*(((z₀ : ℝ)/100000000+v : ℝ) : ℂ)) + (-Complex.I*(b : ℂ)) 5) i j := by + let T := forwardProduct 5 (Complex.I*(((z₀ : ℝ)/100000000+v : ℝ) : ℂ)) + (-Complex.I*(b : ℂ)) 5 + have he : (fun i j => (stateMatrix (polynomialState z₀ b 5) i j).eval (v : ℂ)) = + (100000000 : ℂ)^5 • T := by + ext i j + exact polynomialState_eval_scaled z₀ b v 5 i j + unfold formPolynomial + simp only [eval_add,eval_mul,eval_sub,eval_C,conjugatePolynomial_eval_real] + rw [inputS_eval_scaled] + change forwardFormEntry 500000000 + ((100000000 : ℂ)*(Complex.I*(((z₀ : ℝ)/100000000+v : ℝ) : ℂ))) + (fun i j => (stateMatrix (polynomialState z₀ b 5) i j).eval (v : ℂ)) i j = _ + rw [show (500000000 : ℝ) = 100000000*5 by norm_num, he] + have hscale := forwardFormEntry_real_scaling (100000000 : ℝ) + ((100000000 : ℝ)^5) 5 (Complex.I*(((z₀ : ℝ)/100000000+v : ℝ) : ℂ)) T i j + push_cast at hscale ⊢ + rw [hscale] + dsimp only [T] + push_cast + congr 1 + ring + +end DefocusingNLS.ExteriorCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorForwardDeterminant.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorForwardDeterminant.lean new file mode 100644 index 0000000000000000000000000000000000000000..2dcd12db88bf16537cc94b62420fc8437141eabd --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorForwardDeterminant.lean @@ -0,0 +1,53 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ExteriorFormBounds + +namespace OAI + +/-! The uniform determinant margin used by the exterior quotient disk. -/ + +open Matrix +namespace DefocusingNLS.ExteriorCertificate + +private theorem step_normSq (b : ℝ) (n : ℕ) : + Complex.normSq ((-Complex.I*(b : ℂ)+(n : ℂ)) * + (-Complex.I*(b : ℂ)+(n : ℂ)-5)) = + ((n : ℝ)^2+b^2)*(((n : ℝ)-5)^2+b^2) := by + rw [Complex.normSq_mul] + simp only [Complex.normSq_apply,Complex.add_re,Complex.add_im,Complex.sub_re, + Complex.sub_im,Complex.mul_re,Complex.mul_im,Complex.neg_re,Complex.neg_im, + Complex.I_re,Complex.I_im,Complex.ofReal_re,Complex.ofReal_im, + Complex.natCast_re,Complex.natCast_im,zero_mul,neg_zero,zero_add, + add_zero] + norm_num + ring + +theorem forward_det_normSq (b Z : ℝ) (K : ℕ) : + Complex.normSq (forwardProduct 5 (Complex.I*(Z : ℂ)) (-Complex.I*(b : ℂ)) K).det = + ∏ n ∈ Finset.range K, ((n : ℝ)^2+b^2)*(((n : ℝ)-5)^2+b^2) := by + induction K with + | zero => simp [forwardProduct] + | succ K ih => + rw [forwardProduct,Matrix.det_mul,Complex.normSq_mul,det_forwardMatrix,ih, + Finset.prod_range_succ,step_normSq] + ring + +theorem exterior_forward_det_bound (b Z : ℝ) (hb : |100000000*b-33477607| ≤ 2) : + ‖(forwardProduct 5 (Complex.I*(Z : ℂ)) (-Complex.I*(b : ℂ)) 5).det‖ < 1130 := by + have hb' := abs_le.mp hb + have hb2 : b^2 ≤ (335/1000 : ℝ)^2 := by nlinarith + have hp : (∏ n ∈ Finset.range 5, ((n : ℝ)^2+b^2)*(((n : ℝ)-5)^2+b^2)) ≤ + ∏ n ∈ Finset.range 5, + ((n : ℝ)^2+(335/1000 : ℝ)^2)*(((n : ℝ)-5)^2+(335/1000 : ℝ)^2) := by + apply Finset.prod_le_prod₀ + · intro n _ + positivity + · intro n _ + exact mul_le_mul (by linarith) (by linarith) (by positivity) (by positivity) + have hconst : (∏ n ∈ Finset.range 5, + ((n : ℝ)^2+(335/1000 : ℝ)^2)*(((n : ℝ)-5)^2+(335/1000 : ℝ)^2)) < 1130^2 := by + norm_num [Finset.prod_range_succ] + rw [← forward_det_normSq b Z 5,Complex.normSq_eq_norm_sq] at hp + nlinarith [norm_nonneg (forwardProduct 5 (Complex.I*(Z : ℂ)) (-Complex.I*(b : ℂ)) 5).det] + +end DefocusingNLS.ExteriorCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorHermitianDisk.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorHermitianDisk.lean new file mode 100644 index 0000000000000000000000000000000000000000..5a121fe07fdee0d23a6319d00a2abfe5b4f22dbc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorHermitianDisk.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ForwardHermitianForm + +namespace OAI + +/-! Completing the exterior Hermitian form gives its exact quotient disk. -/ + +namespace DefocusingNLS + +theorem hermitianPairForm_last_square (a d : ℝ) (c u v : ℂ) : + d*hermitianPairForm a d c u v = + Complex.normSq ((d : ℂ)*v+star c*u)+ + (a*d-Complex.normSq c)*Complex.normSq u := by + simp only [hermitianPairForm,Complex.normSq_apply,Complex.mul_re,Complex.mul_im, + Complex.add_re,Complex.add_im,Complex.star_def,Complex.conj_re,Complex.conj_im, + Complex.ofReal_re,Complex.ofReal_im] + ring + +theorem hermitianPairForm_first_ne_zero (a d : ℝ) (c u v : ℂ) + (hd : 0 < d) (hform : hermitianPairForm a d c u v ≤ 0) + (huv : u ≠ 0 ∨ v ≠ 0) : u ≠ 0 := by + intro hu + have hv := huv.resolve_left (not_not.mpr hu) + rw [hu] at hform + simp only [hermitianPairForm,Complex.normSq_zero,mul_zero,star_zero,zero_mul, + Complex.zero_re,add_zero,zero_add] at hform + exact (mul_pos hd (Complex.normSq_pos.mpr hv)).not_ge hform + +theorem hermitianPairForm_quotient_disk (a d R : ℝ) (c u v : ℂ) + (hd : 0 < d) (hR : 0 ≤ R) (hu : u ≠ 0) + (hform : hermitianPairForm a d c u v ≤ 0) + (hdet : a*d-Complex.normSq c = -R^2) : + ‖v/u+star c/(d : ℂ)‖ ≤ R/d := by + let r := v/u+star c/(d : ℂ) + have hd0 : (d : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr hd.ne' + have he : (d : ℂ)*u*r = (d : ℂ)*v+star c*u := by + dsimp only [r] + field_simp [hu,hd0] + have hsq : Complex.normSq ((d : ℂ)*v+star c*u) ≤ R^2*Complex.normSq u := by + have h := hermitianPairForm_last_square a d c u v + rw [hdet] at h + have hs := mul_nonpos_of_nonneg_of_nonpos hd.le hform + nlinarith + rw [Complex.normSq_eq_norm_sq,Complex.normSq_eq_norm_sq] at hsq + have hnorm : ‖(d : ℂ)*v+star c*u‖ ≤ R*‖u‖ := by + exact (sq_le_sq₀ (norm_nonneg _) (mul_nonneg hR (norm_nonneg _))).mp (by nlinarith) + rw [← he,norm_mul,norm_mul,Complex.norm_real,Real.norm_eq_abs,abs_of_pos hd] at hnorm + have hu0 : 0 < ‖u‖ := norm_pos_iff.mpr hu + have hm : d*‖r‖ ≤ R := by + apply (mul_le_mul_iff_left₀ hu0).mp + nlinarith + exact (le_div_iff₀ hd).mpr (by nlinarith) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorImaginaryDegree.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorImaginaryDegree.lean new file mode 100644 index 0000000000000000000000000000000000000000..43a0be3bda7c0e46ea99f08b70855a5c394ab9cc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorImaginaryDegree.lean @@ -0,0 +1,96 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ExteriorLeadingCoefficient +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ExteriorRealProjection + +namespace OAI + +/-! The highest off-diagonal coefficient is real for the entire parameter family. -/ + +open Polynomial Matrix +namespace DefocusingNLS.ExteriorCertificate +open BoundaryCertificate (stateMatrix) + +attribute [local irreducible] polynomialState + +theorem form_top_imaginary_zero (z₀ : ℤ) (b : ℝ) : + ((formPolynomial z₀ b 1 0).coeff 9).im = 0 := by + let T := stateMatrix (polynomialState z₀ b 5) + let P := stateMatrix (polynomialState z₀ b 4) + let d : ℂ := (((100000000*4 : ℤ) : ℂ)-Complex.I*(100000000*b : ℝ))-500000000 + let E : Polynomial ℂ := C d*conjugatePolynomial (T 0 1)*P 1 0- + C (star d)*conjugatePolynomial (P 1 1)*T 0 0 + have hd : inputT 4 b-C (500000000 : ℂ) = C d := by + simp only [inputT,d,map_sub] + norm_num + have hform : formPolynomial z₀ b 1 0 = + C (500000000 : ℂ)*(conjugatePolynomial (T 0 1)*T 0 0)+inputS z₀*E := by + rw [form_last_row] + rw [hd] + simp only [conjugatePolynomial,Polynomial.map_C,starRingEnd_apply] + dsimp only [E,T,P] + simp only [conjugatePolynomial] + ring + have hT (i j : Fin 2) : (T i j).natDegree ≤ 4+j.val := state_column_degree z₀ b 4 i j + have hP (i j : Fin 2) : (P i j).natDegree ≤ 3+j.val := state_column_degree z₀ b 3 i j + have hA : (conjugatePolynomial (T 0 1)*P 1 0).natDegree ≤ 8 := + natDegree_mul_le.trans (add_le_add ((conjugatePolynomial_degree _).trans (hT 0 1)) (hP 1 0)) + have hB : (conjugatePolynomial (P 1 1)*T 0 0).natDegree ≤ 8 := + natDegree_mul_le.trans (add_le_add ((conjugatePolynomial_degree _).trans (hP 1 1)) (hT 0 0)) + have hE : E.natDegree ≤ 8 := by + dsimp only [E] + rw [mul_assoc,mul_assoc] + exact (natDegree_sub_le _ _).trans (max_le + ((natDegree_C_mul_le d _).trans hA) + ((natDegree_C_mul_le (star d) _).trans hB)) + have hE9 : E.coeff 9 = 0 := coeff_eq_zero_of_natDegree_lt (hE.trans_lt (by decide)) + have hF9 : (conjugatePolynomial (T 0 1)*T 0 0).coeff 9 = + star ((T 0 1).coeff 5)*(T 0 0).coeff 4 := by + simpa only [coeff_conjugatePolynomial] using + (coeff_mul_add_eq_of_natDegree_le + (show (conjugatePolynomial (T 0 1)).natDegree ≤ 5 from + (conjugatePolynomial_degree _).trans (hT 0 1)) + (show (T 0 0).natDegree ≤ 4 from hT 0 0)) + have hA8 : (conjugatePolynomial (T 0 1)*P 1 0).coeff 8 = + star ((T 0 1).coeff 5)*(P 1 0).coeff 3 := by + simpa only [coeff_conjugatePolynomial] using + (coeff_mul_add_eq_of_natDegree_le + (show (conjugatePolynomial (T 0 1)).natDegree ≤ 5 from + (conjugatePolynomial_degree _).trans (hT 0 1)) + (show (P 1 0).natDegree ≤ 3 from hP 1 0)) + have hB8 : (conjugatePolynomial (P 1 1)*T 0 0).coeff 8 = + star ((P 1 1).coeff 4)*(T 0 0).coeff 4 := by + simpa only [coeff_conjugatePolynomial] using + (coeff_mul_add_eq_of_natDegree_le + (show (conjugatePolynomial (P 1 1)).natDegree ≤ 4 from + (conjugatePolynomial_degree _).trans (hP 1 1)) + (show (T 0 0).natDegree ≤ 4 from hT 0 0)) + have hE8 : E.coeff 8 = d*(star ((T 0 1).coeff 5)*(P 1 0).coeff 3)- + star d*(star ((P 1 1).coeff 4)*(T 0 0).coeff 4) := by + simp only [E,mul_assoc,coeff_sub,coeff_C_mul,hA8,hB8] + have ht₁ := (state_leading z₀ b 4 1).1 + have ht₀ := (state_leading z₀ b 4 0).1 + have hp₀ := (state_leading z₀ b 3 0).2 + have hp₁ := (state_leading z₀ b 3 1).2 + change (T 0 1).coeff 5 = _ at ht₁ + change (T 0 0).coeff 4 = _ at ht₀ + change (P 1 0).coeff 3 = _ at hp₀ + change (P 1 1).coeff 4 = _ at hp₁ + rw [hform,coeff_add,coeff_C_mul,coeff_inputS_mul,hE9,mul_zero,zero_add,hF9,hE8, + ht₁,ht₀,hp₀,hp₁] + norm_num [firstLeading,d,pow_succ,Complex.mul_re,Complex.mul_im] + ring + +theorem imaginary_form_degree (z₀ : ℤ) (b : ℝ) : + (negImagProjection (formPolynomial z₀ b 1 0)).natDegree ≤ 8 := by + apply natDegree_le_iff_coeff_eq_zero.mpr + intro n hn + rw [coeff_negImagProjection] + by_cases h : n=9 + · subst n + simp only [form_top_imaginary_zero,neg_zero,Complex.ofReal_zero] + · have hz : (formPolynomial z₀ b 1 0).coeff n = 0 := + coeff_eq_zero_of_natDegree_lt ((form_degree z₀ b 0).trans_lt (by simp; omega)) + simp [hz] + +end DefocusingNLS.ExteriorCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorImaginaryProjection.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorImaginaryProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..ec2bbf45ab41affaaaf8f1d2b8224ddba9551f0d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorImaginaryProjection.lean @@ -0,0 +1,61 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ExteriorImaginaryDegree +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ExteriorPolynomialInequalities + +namespace OAI + +/-! The final coefficient projection and the third exterior polynomial inequality. -/ + +open Polynomial +namespace DefocusingNLS.ExteriorCertificate +open GaussianEnclosure + +attribute [local irreducible] state polynomialState + +private theorem negImagPart_sound {a : GaussianEnclosure} {z : ℂ} (ha : a.Encloses z) : + (BoundaryCertificate.coefficient (-a.center.im) 0 a.error).Encloses (-z.im : ℂ) := by + have h := (Complex.abs_im_le_norm (z-(a.center : ℂ))).trans ha + rw [Complex.sub_im, ← GaussianInt.intCast_im] at h + change ‖(-z.im : ℂ)-GaussianInt.toComplex ⟨-a.center.im,0⟩‖ ≤ _ + have hc : GaussianInt.toComplex ⟨-a.center.im,0⟩ = ((-(a.center.im : ℝ)) : ℂ) := by + rw [GaussianInt.toComplex_def',Int.cast_zero,zero_mul,add_zero] + norm_cast + rw [hc, ← Complex.ofReal_neg, ← Complex.ofReal_neg, ← Complex.ofReal_sub,Complex.norm_real,Real.norm_eq_abs] + simpa only [BoundaryCertificate.coefficient,neg_sub_neg,abs_sub_comm] using h + +theorem negImagCoefficients_sound {as : BoundaryCertificate.EnclosurePolynomial} + {p : Polynomial ℂ} (hp : EnclosesPolynomial as p) (N : ℕ) + (hdeg : (negImagProjection p).natDegree < N) : + EnclosesPolynomial (negImagCoefficients as N) (negImagProjection p) := by + apply enclosesPolynomial_of_coefficients + intro n + by_cases hn : n < N + · rw [coeff_negImagProjection] + simpa [negImagCoefficients,List.getElem?_map,hn,BoundaryCertificate.coefficient] using + negImagPart_sound (coefficient_sound hp n) + · have hz := coeff_eq_zero_of_natDegree_lt (hdeg.trans_le (Nat.le_of_not_lt hn)) + rw [hz] + simpa [negImagCoefficients,List.getElem?_map,hn] using zero_sound + +noncomputable def imaginaryBoundPolynomial (b : ℝ) : Polynomial ℂ := + negImagProjection (formPolynomial 300000000 b 1 0)-marginPolynomial 300000000 + +theorem imaginaryBound_sound (b : ℝ) (hb : |100000000*b-33477607| ≤ 2) : + EnclosesPolynomial imaginaryBound (imaginaryBoundPolynomial b) := + subPolynomial_sound (negImagCoefficients_sound (lowerOffDiagonal_sound _ b hb) 9 + ((imaginary_form_degree _ b).trans_lt (by decide))) (margin_sound _) + +theorem imaginaryBoundPolynomial_degree (b : ℝ) : + (imaginaryBoundPolynomial b).natDegree ≤ 8 := + (natDegree_sub_le _ _).trans (max_le (imaginary_form_degree _ b) + ((margin_degree _).trans (by decide))) + +theorem imaginary_bound_polynomial_positive (b v : ℝ) + (hb : |100000000*b-33477607| ≤ 2) (hv : 0 ≤ v) : + 0 < ((imaginaryBoundPolynomial b).eval (v : ℂ)).re := + positive_eval_of_positiveCoefficients imaginaryBound (imaginaryBoundPolynomial b) 9 + (by decide) (by decide +kernel) imaginary_bound_coefficients_positive + (imaginaryBound_sound b hb) ((imaginaryBoundPolynomial_degree b).trans_lt (by decide)) v hv + +end DefocusingNLS.ExteriorCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorLeadingCoefficient.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorLeadingCoefficient.lean new file mode 100644 index 0000000000000000000000000000000000000000..797c8bb49119ee37279d1b3851c3dd00c2276efa --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorLeadingCoefficient.lean @@ -0,0 +1,50 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ExteriorPolynomialDegree + +namespace OAI + +/-! The two leading column coefficients needed for the imaginary-part cancellation. -/ + +open Polynomial Matrix +namespace DefocusingNLS.ExteriorCertificate +open BoundaryCertificate (stateMatrix polynomialStep) + +theorem coeff_inputS_mul (z₀ : ℤ) (p : Polynomial ℂ) (n : ℕ) : + (inputS z₀*p).coeff (n+1) = Complex.I*(z₀ : ℂ)*p.coeff (n+1)+ + (Complex.I*(100000000 : ℂ))*p.coeff n := by + simp only [inputS,add_mul,mul_assoc,coeff_add,coeff_C_mul,coeff_X_mul] + +noncomputable def firstLeading (b : ℝ) : Fin 2 → ℂ := + ![-Complex.I*(100000000 : ℂ)*(b : ℂ),Complex.I*(100000000 : ℂ)] + +theorem state_leading (z₀ : ℤ) (b : ℝ) (n : ℕ) (j : Fin 2) : + (stateMatrix (polynomialState z₀ b (n+1)) 0 j).coeff (n+j.val) = + (-Complex.I*(100000000 : ℂ))^n*firstLeading b j ∧ + (stateMatrix (polynomialState z₀ b (n+1)) 1 j).coeff (n+j.val) = + -((-Complex.I*(100000000 : ℂ))^n*firstLeading b j) := by + induction n with + | zero => + fin_cases j <;> + simp [polynomialState,polynomialStep,stateMatrix,inputT,inputS,firstLeading] + ring + | succ n ih => + have hz (i : Fin 2) : + (stateMatrix (polynomialState z₀ b (n+1)) i j).coeff ((n+j.val)+1) = 0 := + coeff_eq_zero_of_natDegree_lt ((state_column_degree z₀ b n i j).trans_lt + (Nat.lt_succ_self _)) + have hx : (stateMatrix (polynomialState z₀ b ((n+1)+1)) 0 j).coeff ((n+j.val)+1) = + (Complex.I*(100000000 : ℂ))* + (stateMatrix (polynomialState z₀ b (n+1)) 1 j).coeff (n+j.val) := by + rw [state_entry_succ_zero,coeff_add,coeff_inputS_mul] + simp only [inputT,coeff_C_mul,hz,mul_zero,zero_add] + have he : (n+1)+j.val = (n+j.val)+1 := by omega + constructor + · rw [he,hx,ih.2,pow_succ] + ring + · rw [he,state_entry_succ_one,sub_mul,coeff_sub,coeff_sub] + simp only [inputT,coeff_C_mul,hz,mul_zero,sub_self,zero_sub] + rw [hx,ih.2,pow_succ] + ring + +end DefocusingNLS.ExteriorCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorPolynomial.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorPolynomial.lean new file mode 100644 index 0000000000000000000000000000000000000000..1a1b3df52a1d1fdf3cf2e44a94ffbf494f999490 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorPolynomial.lean @@ -0,0 +1,109 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ExteriorCertificateRecipe +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.BoundaryEnclosureStateLink + +namespace OAI + +/-! The coherent spatial polynomial enclosed by the K=5 exterior computation. -/ + +open Polynomial Matrix +namespace DefocusingNLS.ExteriorCertificate +open GaussianEnclosure +open BoundaryCertificate (PolynomialState EnclosesState polynomialStep stateMatrix + polynomialStep_matrix constant_sound) + +noncomputable def inputS (z₀ : ℤ) : Polynomial ℂ := + C (Complex.I*(z₀ : ℂ))+X*C (Complex.I*(100000000 : ℂ)) + +noncomputable def inputT (n : ℕ) (b : ℝ) : Polynomial ℂ := + C (((100000000*(n : ℤ) : ℤ) : ℂ)-Complex.I*((100000000 : ℝ)*b : ℝ)) + +noncomputable def polynomialState (z₀ : ℤ) (b : ℝ) : ℕ → PolynomialState + | 0 => ((1,0),(0,1)) + | n+1 => polynomialStep (C (500000000 : ℂ)) (inputS z₀) (inputT n b) + (polynomialState z₀ b n) + +theorem inputS_sound (z₀ : ℤ) : + EnclosesPolynomial [BoundaryCertificate.coefficient 0 z₀ 0, + BoundaryCertificate.coefficient 0 100000000 0] (inputS z₀) := by + refine ⟨Complex.I*(z₀ : ℂ), C (Complex.I*(100000000 : ℂ)), ?_, ?_, rfl⟩ + · simp [Encloses, BoundaryCertificate.coefficient, GaussianInt.toComplex_def', mul_comm] + · refine ⟨Complex.I*(100000000 : ℂ),0,?_,rfl,by simp⟩ + norm_num [Encloses, BoundaryCertificate.coefficient, GaussianInt.toComplex_def', mul_comm] + +theorem inputT_sound (n : ℕ) (b : ℝ) (hb : |100000000*b-33477607| ≤ 2) : + EnclosesPolynomial [BoundaryCertificate.coefficient (100000000*(n : ℤ)) (-33477607) 2] + (inputT n b) := by + refine ⟨(((100000000*(n : ℤ) : ℤ) : ℂ)-Complex.I*(100000000*b : ℝ)), + 0,?_,rfl,by simp only [inputT,mul_zero,add_zero]⟩ + change ‖(((100000000*(n : ℤ) : ℤ) : ℂ)-Complex.I*(100000000*b : ℝ))- + ((⟨100000000*(n : ℤ),-33477607⟩ : GaussianInt) : ℂ)‖ ≤ 2 + have he : (((100000000*(n : ℤ) : ℤ) : ℂ)-Complex.I*(100000000*b : ℝ))- + ((⟨100000000*(n : ℤ),-33477607⟩ : GaussianInt) : ℂ) = + ((100000000*b-33477607 : ℝ) : ℂ)*(-Complex.I) := by + rw [GaussianInt.toComplex_def'] + push_cast + ring + rw [he, norm_mul, norm_neg, Complex.norm_I, mul_one, Complex.norm_real, Real.norm_eq_abs] + exact hb + +theorem step_sound (z₀ : ℤ) (n : ℕ) (b : ℝ) + (hb : |100000000*b-33477607| ≤ 2) + {xy : BoundaryCertificate.State} {pq : PolynomialState} (h : EnclosesState xy pq) : + EnclosesState (step z₀ n xy) + (polynomialStep (C (500000000 : ℂ)) (inputS z₀) (inputT n b) pq) := by + obtain ⟨hx₀,hx₁,hy₀,hy₁⟩ := h + have ht := inputT_sound n b hb + have hs := inputS_sound z₀ + have hM := constant_sound 500000000 + have hd := subPolynomial_sound ht hM + have hx₀' := addPolynomial_sound (mulPolynomial_sound ht hx₀) (mulPolynomial_sound hs hy₀) + have hx₁' := addPolynomial_sound (mulPolynomial_sound ht hx₁) (mulPolynomial_sound hs hy₁) + exact ⟨hx₀',hx₁',subPolynomial_sound (mulPolynomial_sound hd hy₀) hx₀', + subPolynomial_sound (mulPolynomial_sound hd hy₁) hx₁'⟩ + +theorem state_sound (z₀ : ℤ) (b : ℝ) (hb : |100000000*b-33477607| ≤ 2) (n : ℕ) : + EnclosesState (state z₀ n) (polynomialState z₀ b n) := by + induction n with + | zero => + exact ⟨by simpa [state,polynomialState] using constant_sound 1, + by simpa [state,polynomialState] using constant_sound 0, + by simpa [state,polynomialState] using constant_sound 0, + by simpa [state,polynomialState] using constant_sound 1⟩ + | succ n ih => exact step_sound z₀ n b hb ih + +theorem inputT_eval_scaled (n : ℕ) (b v : ℝ) : + (inputT n b).eval (v : ℂ) = + (100000000 : ℂ)*(-Complex.I*(b : ℂ)+(n : ℂ)) := by + simp only [inputT, eval_C] + push_cast + ring + +theorem inputS_eval_scaled (z₀ : ℤ) (v : ℝ) : + (inputS z₀).eval (v : ℂ) = + (100000000 : ℂ)*(Complex.I*(((z₀ : ℝ)/100000000+v : ℝ) : ℂ)) := by + simp only [inputS, eval_add, eval_mul, eval_C, eval_X] + push_cast + ring + +attribute [local irreducible] polynomialState + +/-- Evaluation gives the actual forward matrix, with its exact integer scale. -/ +theorem polynomialState_eval_scaled (z₀ : ℤ) (b v : ℝ) (N : ℕ) (i j : Fin 2) : + (stateMatrix (polynomialState z₀ b N) i j).eval (v : ℂ) = + (100000000 : ℂ)^N* + forwardProduct 5 (Complex.I*(((z₀ : ℝ)/100000000+v : ℝ) : ℂ)) + (-Complex.I*(b : ℂ)) N i j := by + induction N generalizing i j with + | zero => fin_cases i <;> fin_cases j <;> simp [polynomialState,stateMatrix,forwardProduct] + | succ N ih => + rw [polynomialState, polynomialStep_matrix] + simp only [Matrix.mul_apply, Fin.sum_univ_two, eval_add, eval_mul, ih] + have ht := inputT_eval_scaled N b v + have hs := inputS_eval_scaled z₀ v + fin_cases i <;> fin_cases j <;> + simp [forwardProduct, forwardMatrix, Matrix.mul_apply, Fin.sum_univ_two, + eval_sub, eval_neg, eval_C, ht, hs, pow_succ] <;> ring + +end DefocusingNLS.ExteriorCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorPolynomialDegree.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorPolynomialDegree.lean new file mode 100644 index 0000000000000000000000000000000000000000..dc883b1af3d33cdf65a879317a201a4b71d4ad41 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorPolynomialDegree.lean @@ -0,0 +1,123 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ExteriorFormPolynomial + +namespace OAI + +/-! The K=5 spatial form has the coherent degrees used by its certificate. -/ + +open Polynomial Matrix +namespace DefocusingNLS.ExteriorCertificate +open BoundaryCertificate (stateMatrix polynomialStep) + +theorem inputT_degree (n : ℕ) (b : ℝ) : (inputT n b).natDegree ≤ 0 := by + change (C _).natDegree ≤ 0 + rw [natDegree_C] + +theorem inputS_degree (z₀ : ℤ) : (inputS z₀).natDegree ≤ 1 := by + change (C _+X*C _).natDegree ≤ 1 + apply natDegree_add_le_of_degree_le (by rw [natDegree_C]; omega) + exact natDegree_mul_le.trans (by simp only [natDegree_X,natDegree_C,Nat.add_zero,le_refl]) + +theorem state_entry_succ_zero (z₀ : ℤ) (b : ℝ) (n : ℕ) (j : Fin 2) : + stateMatrix (polynomialState z₀ b (n+1)) 0 j = + inputT n b*stateMatrix (polynomialState z₀ b n) 0 j+ + inputS z₀*stateMatrix (polynomialState z₀ b n) 1 j := by + fin_cases j <;> rfl + +theorem state_entry_succ_one (z₀ : ℤ) (b : ℝ) (n : ℕ) (j : Fin 2) : + stateMatrix (polynomialState z₀ b (n+1)) 1 j = + (inputT n b-C (500000000 : ℂ))*stateMatrix (polynomialState z₀ b n) 1 j- + stateMatrix (polynomialState z₀ b (n+1)) 0 j := by + fin_cases j <;> rfl + +theorem state_column_degree (z₀ : ℤ) (b : ℝ) (n : ℕ) (i j : Fin 2) : + (stateMatrix (polynomialState z₀ b (n+1)) i j).natDegree ≤ n+j.val := by + induction n generalizing i j with + | zero => + have ht := inputT_degree 0 b + have hs := inputS_degree z₀ + have hd : (inputT 0 b-C (500000000 : ℂ)-inputS z₀).natDegree ≤ 1 := + (natDegree_sub_le _ _).trans (max_le + ((natDegree_sub_le _ _).trans (max_le (ht.trans (by omega)) (by rw [natDegree_C]; omega))) hs) + fin_cases i <;> fin_cases j + · simpa [polynomialState,polynomialStep,stateMatrix] using ht + · simpa [polynomialState,polynomialStep,stateMatrix] using hs + · simpa [polynomialState,polynomialStep,stateMatrix] using ht + · simpa [polynomialState,polynomialStep,stateMatrix] using hd + | succ n ih => + let P := stateMatrix (polynomialState z₀ b (n+1)) + have ht := inputT_degree (n+1) b + have hD : (inputT (n+1) b-C (500000000 : ℂ)).natDegree ≤ 0 := + (natDegree_sub_le _ _).trans (max_le ht (by rw [natDegree_C])) + have hx : (inputT (n+1) b*P 0 j+inputS z₀*P 1 j).natDegree ≤ (n+1)+j.val := by + apply natDegree_add_le_of_degree_le + · exact natDegree_mul_le.trans ((add_le_add ht (ih 0 j)).trans (by omega)) + · exact natDegree_mul_le.trans ((add_le_add (inputS_degree z₀) (ih 1 j)).trans (by omega)) + have hy : ((inputT (n+1) b-C (500000000 : ℂ))*P 1 j- + (inputT (n+1) b*P 0 j+inputS z₀*P 1 j)).natDegree ≤ (n+1)+j.val := by + apply (natDegree_sub_le _ _).trans + apply max_le _ hx + exact natDegree_mul_le.trans ((add_le_add hD (ih 1 j)).trans (by omega)) + fin_cases i + · convert! (congrArg Polynomial.natDegree + (state_entry_succ_zero z₀ b (n+1) j)).le.trans hx using 1 + · have he := state_entry_succ_one z₀ b (n+1) j + have he' := state_entry_succ_zero z₀ b (n+1) j + have he'' := he.trans (congrArg (fun v => + (inputT (n+1) b-C (500000000 : ℂ))*P 1 j-v) he') + convert! (congrArg Polynomial.natDegree he'').le.trans hy using 1 + +attribute [local irreducible] polynomialState + +theorem form_last_row (z₀ : ℤ) (b : ℝ) (i j : Fin 2) : + let T := stateMatrix (polynomialState z₀ b 5) + let P := stateMatrix (polynomialState z₀ b 4) + let d := inputT 4 b-C (500000000 : ℂ) + formPolynomial z₀ b i j = C (500000000 : ℂ)*conjugatePolynomial (T 0 i)*T 0 j+ + inputS z₀*(d*conjugatePolynomial (T 0 i)*P 1 j- + conjugatePolynomial d*conjugatePolynomial (P 1 i)*T 0 j) := by + dsimp only + have hy (k : Fin 2) : stateMatrix (polynomialState z₀ b 5) 1 k = + (inputT 4 b-C (500000000 : ℂ))*stateMatrix (polynomialState z₀ b 4) 1 k- + stateMatrix (polynomialState z₀ b 5) 0 k := by + exact state_entry_succ_one z₀ b 4 k + unfold formPolynomial + dsimp only + rw [hy i, hy j] + simp only [conjugatePolynomial, Polynomial.map_sub, Polynomial.map_mul] + ring + +/-- In particular d has degree ≤10, and the lower off-diagonal entry degree ≤9. -/ +theorem form_degree (z₀ : ℤ) (b : ℝ) (j : Fin 2) : + (formPolynomial z₀ b 1 j).natDegree ≤ 9+j.val := by + rw [form_last_row] + have hT (i j : Fin 2) := state_column_degree z₀ b 4 i j + have hP (i j : Fin 2) := state_column_degree z₀ b 3 i j + have hd : (inputT 4 b-C (500000000 : ℂ)).natDegree ≤ 0 := + natDegree_sub_le_of_le (inputT_degree 4 b) (by simp) + have hc (p : Polynomial ℂ) := conjugatePolynomial_degree p + have hfirst : (C (500000000 : ℂ)*conjugatePolynomial + (stateMatrix (polynomialState z₀ b 5) 0 1)* + stateMatrix (polynomialState z₀ b 5) 0 j).natDegree ≤ 9+j.val := by + exact natDegree_mul_le.trans + ((add_le_add ((natDegree_C_mul_le _ _).trans ((hc _).trans (hT 0 1))) + (hT 0 j)).trans (by omega)) + have ha : ((inputT 4 b-C (500000000 : ℂ))* + conjugatePolynomial (stateMatrix (polynomialState z₀ b 5) 0 1)* + stateMatrix (polynomialState z₀ b 4) 1 j).natDegree ≤ 8+j.val := by + exact natDegree_mul_le.trans + ((add_le_add (natDegree_mul_le.trans (add_le_add hd ((hc _).trans (hT 0 1)))) + (hP 1 j)).trans (by omega)) + have hb : (conjugatePolynomial (inputT 4 b-C (500000000 : ℂ))* + conjugatePolynomial (stateMatrix (polynomialState z₀ b 4) 1 1)* + stateMatrix (polynomialState z₀ b 5) 0 j).natDegree ≤ 8+j.val := by + exact natDegree_mul_le.trans + ((add_le_add (natDegree_mul_le.trans (add_le_add ((hc _).trans hd) + ((hc _).trans (hP 1 1)))) (hT 0 j)).trans (by omega)) + apply natDegree_add_le_of_degree_le hfirst + exact natDegree_mul_le.trans + ((add_le_add (inputS_degree z₀) ((natDegree_sub_le _ _).trans (max_le ha hb))).trans + (by omega)) + +end DefocusingNLS.ExteriorCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorPolynomialInequalities.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorPolynomialInequalities.lean new file mode 100644 index 0000000000000000000000000000000000000000..037c8f5d95c93f72f1fa83b8e06e5e46f6216e92 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorPolynomialInequalities.lean @@ -0,0 +1,70 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ExteriorPositiveEvaluation +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ExteriorPolynomialDegree + +namespace OAI + +/-! The first two exterior certificate inequalities for the coherent polynomial family. -/ + +open Polynomial +namespace DefocusingNLS.ExteriorCertificate +open GaussianEnclosure +open BoundaryCertificate (constant_sound) + +noncomputable def marginPolynomial (z₀ : ℤ) : Polynomial ℂ := + C ((1130*100000000^10*z₀ : ℤ) : ℂ)+X*C ((1130*100000000^11 : ℤ) : ℂ) + +theorem margin_sound (z₀ : ℤ) : + EnclosesPolynomial (determinantMargin z₀) (marginPolynomial z₀) := by + refine ⟨((1130*100000000^10*z₀ : ℤ) : ℂ), + C ((1130*100000000^11 : ℤ) : ℂ),?_,constant_sound _,rfl⟩ + simp [Encloses,BoundaryCertificate.coefficient,GaussianInt.toComplex_def'] + +noncomputable def realBoundPolynomial (b : ℝ) : Polynomial ℂ := + C 43*realProjection (formPolynomial 270400000 b 1 1)+ + C 1000*(realProjection (formPolynomial 270400000 b 1 0)-marginPolynomial 270400000) + +theorem realBound_sound (b : ℝ) (hb : |100000000*b-33477607| ≤ 2) : + EnclosesPolynomial realBound (realBoundPolynomial b) := by + have hd := realCoefficients_sound (diagonal_sound 270400000 b hb) 11 + ((form_degree 270400000 b 1).trans_lt (by decide)) + have hc := realCoefficients_sound (lowerOffDiagonal_sound 270400000 b hb) 11 + ((form_degree 270400000 b 0).trans_lt (by decide)) + exact addPolynomial_sound (mulPolynomial_sound (constant_sound 43) hd) + (mulPolynomial_sound (constant_sound 1000) (subPolynomial_sound hc (margin_sound _))) + +theorem margin_degree (z₀ : ℤ) : (marginPolynomial z₀).natDegree ≤ 1 := by + apply natDegree_add_le_of_degree_le + · exact (natDegree_C _).le.trans (by omega) + · exact natDegree_mul_le.trans (by simp) + +theorem realBoundPolynomial_degree (b : ℝ) : (realBoundPolynomial b).natDegree ≤ 10 := by + have hd : (realProjection (formPolynomial 270400000 b 1 1)).natDegree ≤ 10 := + (realProjection_degree _).trans (form_degree 270400000 b 1) + have hc : (realProjection (formPolynomial 270400000 b 1 0)).natDegree ≤ 10 := + (realProjection_degree _).trans ((form_degree 270400000 b 0).trans (by decide)) + apply natDegree_add_le_of_degree_le ((natDegree_C_mul_le 43 _).trans hd) + exact (natDegree_C_mul_le 1000 _).trans ((natDegree_sub_le _ _).trans + (max_le hc ((margin_degree _).trans (by decide)))) + +theorem diagonal_polynomial_positive (b v : ℝ) + (hb : |100000000*b-33477607| ≤ 2) (hv : 0 ≤ v) : + 0 < ((formPolynomial 270400000 b 1 1).eval (v : ℂ)).re := by + have hd := realCoefficients_sound (diagonal_sound 270400000 b hb) 11 + ((form_degree 270400000 b 1).trans_lt (by decide)) + have h := positive_eval_of_positiveCoefficients + (realCoefficients (diagonal 270400000) 11) + (realProjection (formPolynomial 270400000 b 1 1)) 11 (by decide) + (by simp [realCoefficients]) diagonal_coefficients_positive hd + (((realProjection_degree _).trans (form_degree 270400000 b 1)).trans_lt (by decide)) v hv + simpa only [realProjection_eval,Complex.ofReal_re] using h + +theorem real_bound_polynomial_positive (b v : ℝ) + (hb : |100000000*b-33477607| ≤ 2) (hv : 0 ≤ v) : + 0 < ((realBoundPolynomial b).eval (v : ℂ)).re := by + exact positive_eval_of_positiveCoefficients realBound (realBoundPolynomial b) 11 + (by decide) (by decide +kernel) real_bound_coefficients_positive + (realBound_sound b hb) ((realBoundPolynomial_degree b).trans_lt (by decide)) v hv + +end DefocusingNLS.ExteriorCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorPositiveEvaluation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorPositiveEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..bbfc727b1a2acb85b65f7bbfaae619ede821c675 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorPositiveEvaluation.lean @@ -0,0 +1,46 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ExteriorCertificatePositivity +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ExteriorRealProjection + +namespace OAI + +/-! Positive coefficient enclosures imply the actual exterior inequalities. -/ + +open Polynomial +namespace DefocusingNLS.ExteriorCertificate +open GaussianEnclosure + +theorem positiveCoefficients_get {as : BoundaryCertificate.EnclosurePolynomial} + (h : positiveCoefficients as = true) (n : ℕ) (hn : n < as.length) : + (as[n]?.getD zero).error < (as[n]?.getD zero).center.re := by + have ha : ∀ a ∈ as, a.error < a.center.re := by + simpa only [positiveCoefficients,List.all_eq_true,decide_eq_true_eq] using h + simpa only [List.getElem?_eq_getElem hn,Option.getD_some] using + ha as[n] (List.getElem_mem hn) + +private theorem eval_re_eq_sum (p : Polynomial ℂ) (N : ℕ) + (hdeg : p.natDegree < N) (v : ℝ) : + (p.eval (v : ℂ)).re = ∑ n ∈ Finset.range N, (p.coeff n).re*v^n := by + conv_lhs => rw [p.as_sum_range' N hdeg] + simp only [eval_finsetSum,eval_monomial,Complex.re_sum] + apply Finset.sum_congr rfl + intro n _ + rw [← Complex.ofReal_pow,Complex.mul_re,Complex.ofReal_re,Complex.ofReal_im] + ring + +theorem positive_eval_of_positiveCoefficients + (as : BoundaryCertificate.EnclosurePolynomial) (p : Polynomial ℂ) (N : ℕ) + (hN : 0 < N) (hlen : as.length = N) (hpos : positiveCoefficients as = true) + (hp : EnclosesPolynomial as p) (hdeg : p.natDegree < N) + (v : ℝ) (hv : 0 ≤ v) : 0 < (p.eval (v : ℂ)).re := by + have hc (n : ℕ) (hn : n < N) : 0 < (p.coeff n).re := by + apply realPart_pos (coefficient_sound hp n) + exact positiveCoefficients_get hpos n (by omega) + rw [eval_re_eq_sum p N hdeg] + apply Finset.sum_pos' + · intro n hn + exact mul_nonneg (hc n (Finset.mem_range.mp hn)).le (pow_nonneg hv n) + · exact ⟨0,Finset.mem_range.mpr hN,by simpa using hc 0 hN⟩ + +end DefocusingNLS.ExteriorCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorQuotientBounds.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorQuotientBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..48379702054e1e68fd0c545dfe29ca6974e4b4c3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorQuotientBounds.lean @@ -0,0 +1,76 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ExteriorQuotientDisk +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ExteriorForwardDeterminant + +namespace OAI + +/-! The certified real and imaginary bounds for the outgoing quotient. -/ + +namespace DefocusingNLS.ExteriorCertificate + +private theorem quotient_component_re (c : ℂ) (d : ℝ) : + (c/(d : ℂ)).re = c.re/d := by + simp [div_eq_mul_inv, ← Complex.ofReal_inv,Complex.mul_re] + +private theorem quotient_component_im (c : ℂ) (d : ℝ) : + (c/(d : ℂ)).im = c.im/d := by + simp [div_eq_mul_inv, ← Complex.ofReal_inv,Complex.mul_im] + +theorem exterior_quotient_real_bound (b Z : ℝ) + (hb : |100000000*b-33477607| ≤ 2) (hZ : 2704/1000 ≤ Z) : + ((-deriv (regularizedSlowSolution (-Complex.I*(b : ℂ)) 6) (-Complex.I*(Z : ℂ)))/ + regularizedSlowSolution (-Complex.I*(b : ℂ)) 6 (-Complex.I*(Z : ℂ))).re < 43/1000 := by + let j := (-deriv (regularizedSlowSolution (-Complex.I*(b : ℂ)) 6) (-Complex.I*(Z : ℂ)))/ + regularizedSlowSolution (-Complex.I*(b : ℂ)) 6 (-Complex.I*(Z : ℂ)) + let c := exteriorForm b Z 1 0 + let d := (exteriorForm b Z 1 1).re + let D := ‖(forwardProduct 5 (Complex.I*(Z : ℂ)) (-Complex.I*(b : ℂ)) 5).det‖ + have hd : 0 < d := exterior_diagonal_positive b Z hb hZ + have hnorm : ‖j+c/(d : ℂ)‖ ≤ Z*D/d := exterior_slow_quotient_disk b Z hb hZ + have hre := (le_abs_self (j+c/(d : ℂ)).re).trans + ((Complex.abs_re_le_norm _).trans hnorm) + rw [Complex.add_re,quotient_component_re] at hre + have hmul := (le_div_iff₀ hd).mp hre + have he : (j.re+c.re/d)*d=j.re*d+c.re := by + rw [add_mul,div_mul_cancel₀ _ hd.ne'] + rw [he] at hmul + have hD : D < 1130 := exterior_forward_det_bound b Z hb + have hR := exterior_real_bound b Z hb hZ + have hZD : Z*D < 1130*Z := by nlinarith + change j.re < 43/1000 + by_contra hn + have hh := mul_le_mul_of_nonneg_right (le_of_not_gt hn) hd.le + dsimp only [c,d] at hmul hh + nlinarith + +theorem exterior_quotient_imaginary_positive (b Z : ℝ) + (hb : |100000000*b-33477607| ≤ 2) (hZ : 3 ≤ Z) : + 0 < ((-deriv (regularizedSlowSolution (-Complex.I*(b : ℂ)) 6) (-Complex.I*(Z : ℂ)))/ + regularizedSlowSolution (-Complex.I*(b : ℂ)) 6 (-Complex.I*(Z : ℂ))).im := by + have hZ' : 2704/1000 ≤ Z := by linarith + let j := (-deriv (regularizedSlowSolution (-Complex.I*(b : ℂ)) 6) (-Complex.I*(Z : ℂ)))/ + regularizedSlowSolution (-Complex.I*(b : ℂ)) 6 (-Complex.I*(Z : ℂ)) + let c := exteriorForm b Z 1 0 + let d := (exteriorForm b Z 1 1).re + let D := ‖(forwardProduct 5 (Complex.I*(Z : ℂ)) (-Complex.I*(b : ℂ)) 5).det‖ + have hd : 0 < d := exterior_diagonal_positive b Z hb hZ' + have hnorm : ‖j+c/(d : ℂ)‖ ≤ Z*D/d := exterior_slow_quotient_disk b Z hb hZ' + have him := (neg_le_abs (j+c/(d : ℂ)).im).trans + ((Complex.abs_im_le_norm _).trans hnorm) + rw [Complex.add_im,quotient_component_im] at him + have hmul := (le_div_iff₀ hd).mp him + have he : (-(j.im+c.im/d))*d= -j.im*d-c.im := by + rw [neg_mul,add_mul,div_mul_cancel₀ _ hd.ne'] + ring + rw [he] at hmul + have hD : D < 1130 := exterior_forward_det_bound b Z hb + have hI := exterior_imaginary_bound b Z hb hZ + have hZD : Z*D < 1130*Z := by nlinarith + change 0 < j.im + by_contra hn + have hh := mul_nonpos_of_nonpos_of_nonneg (le_of_not_gt hn) hd.le + dsimp only [c,d] at hmul hh + nlinarith + +end DefocusingNLS.ExteriorCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorQuotientDisk.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorQuotientDisk.lean new file mode 100644 index 0000000000000000000000000000000000000000..c350ab9db0a4fbff1808bce571451f12c4525613 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorQuotientDisk.lean @@ -0,0 +1,49 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ExteriorSlowCone +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ExteriorFormDeterminant + +namespace OAI + +/-! Nonvanishing and the exact exterior disk for the true outgoing logarithmic derivative. -/ + +namespace DefocusingNLS.ExteriorCertificate + +theorem exterior_slow_nonzero (b Z : ℝ) + (hb : |100000000*b-33477607| ≤ 2) (hZ : 2704/1000 ≤ Z) : + regularizedSlowSolution (-Complex.I*(b : ℂ)) 6 (-Complex.I*(Z : ℂ)) ≠ 0 := by + have hZ0 : Z ≠ 0 := by linarith + have hx : (-Complex.I*(Z : ℂ)) ≠ 0 := + mul_ne_zero (neg_ne_zero.mpr Complex.I_ne_zero) (Complex.ofReal_ne_zero.mpr hZ0) + have hjet := regularizedSlowSolution_jet_nonzero (-Complex.I*(b : ℂ)) 6 + (-Complex.I*(Z : ℂ)) (by simp) (by simp) hx + exact hermitianPairForm_first_ne_zero _ _ _ _ _ + (exterior_diagonal_positive b Z hb hZ) (slow_exterior_pairForm b Z hZ0) + (hjet.imp_right neg_ne_zero.mpr) + +theorem exterior_slow_quotient_disk (b Z : ℝ) + (hb : |100000000*b-33477607| ≤ 2) (hZ : 2704/1000 ≤ Z) : + ‖(-deriv (regularizedSlowSolution (-Complex.I*(b : ℂ)) 6) (-Complex.I*(Z : ℂ)))/ + regularizedSlowSolution (-Complex.I*(b : ℂ)) 6 (-Complex.I*(Z : ℂ))+ + exteriorForm b Z 1 0/((exteriorForm b Z 1 1).re : ℂ)‖ ≤ + Z*‖(forwardProduct 5 (Complex.I*(Z : ℂ)) (-Complex.I*(b : ℂ)) 5).det‖/ + (exteriorForm b Z 1 1).re := by + have hZ0 : Z ≠ 0 := by linarith + have hd := exterior_diagonal_positive b Z hb hZ + have he := forwardFormEntry_determinant 5 Z + (forwardProduct 5 (Complex.I*(Z : ℂ)) (-Complex.I*(b : ℂ)) 5) + change (exteriorForm b Z 0 0).re*(exteriorForm b Z 1 1).re- + Complex.normSq (exteriorForm b Z 0 1) = _ at he + have hdet : (exteriorForm b Z 0 0).re*(exteriorForm b Z 1 1).re- + Complex.normSq (exteriorForm b Z 0 1) = + -(Z*‖(forwardProduct 5 (Complex.I*(Z : ℂ)) (-Complex.I*(b : ℂ)) 5).det‖)^2 := by + rw [he,Complex.normSq_eq_norm_sq] + ring + have h := hermitianPairForm_quotient_disk _ _ _ _ _ _ hd + (mul_nonneg (by linarith) (norm_nonneg _)) (exterior_slow_nonzero b Z hb hZ) + (slow_exterior_pairForm b Z hZ0) hdet + have hc : star (exteriorForm b Z 0 1) = exteriorForm b Z 1 0 := + forwardFormEntry_hermitian 5 _ _ (by simp) 1 0 + rwa [hc] at h + +end DefocusingNLS.ExteriorCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorRealProjection.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorRealProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..c0ee94eeb0c8857334ab3fec95a76afcf8ccb35e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorRealProjection.lean @@ -0,0 +1,61 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ExteriorFormPolynomial + +namespace OAI + +/-! Real and negative-imaginary coefficient projection for the exterior checks. -/ + +open Polynomial +namespace DefocusingNLS.ExteriorCertificate +open GaussianEnclosure + +noncomputable def realProjection (p : Polynomial ℂ) : Polynomial ℂ := + C (1/2 : ℂ)*(p+conjugatePolynomial p) + +noncomputable def negImagProjection (p : Polynomial ℂ) : Polynomial ℂ := + C (Complex.I/2)*(p-conjugatePolynomial p) + +theorem coeff_realProjection (p : Polynomial ℂ) (n : ℕ) : + (realProjection p).coeff n = ((p.coeff n).re : ℂ) := by + simp only [realProjection,coeff_C_mul,coeff_add,coeff_conjugatePolynomial] + apply Complex.ext <;> simp [Complex.mul_re,Complex.mul_im] + ring + +theorem coeff_negImagProjection (p : Polynomial ℂ) (n : ℕ) : + (negImagProjection p).coeff n = (-((p.coeff n).im) : ℂ) := by + simp only [negImagProjection,coeff_C_mul,coeff_sub,coeff_conjugatePolynomial] + apply Complex.ext <;> simp [Complex.mul_re,Complex.mul_im] + ring + +theorem realProjection_degree (p : Polynomial ℂ) : + (realProjection p).natDegree ≤ p.natDegree := + (natDegree_C_mul_le _ _).trans + (natDegree_add_le_of_degree_le le_rfl (conjugatePolynomial_degree p)) + +theorem realProjection_eval (p : Polynomial ℂ) (v : ℝ) : + (realProjection p).eval (v : ℂ) = ((p.eval (v : ℂ)).re : ℂ) := by + simp only [realProjection,eval_mul,eval_C,eval_add,conjugatePolynomial_eval_real] + apply Complex.ext <;> simp [Complex.mul_re,Complex.mul_im] + ring + +theorem negImagProjection_eval (p : Polynomial ℂ) (v : ℝ) : + (negImagProjection p).eval (v : ℂ) = (-((p.eval (v : ℂ)).im) : ℂ) := by + simp only [negImagProjection,eval_mul,eval_C,eval_sub,conjugatePolynomial_eval_real] + apply Complex.ext <;> simp [Complex.mul_re,Complex.mul_im] + ring + +theorem realCoefficients_sound {as : BoundaryCertificate.EnclosurePolynomial} + {p : Polynomial ℂ} (hp : EnclosesPolynomial as p) (N : ℕ) + (hdeg : p.natDegree < N) : + EnclosesPolynomial (realCoefficients as N) (realProjection p) := by + apply enclosesPolynomial_of_coefficients + intro n + rw [coeff_realProjection] + by_cases hn : n < N + · simpa [realCoefficients, List.getElem?_map, hn, BoundaryCertificate.coefficient] using + realPart_sound (coefficient_sound hp n) + · have hz := coeff_eq_zero_of_natDegree_lt (hdeg.trans_le (Nat.le_of_not_lt hn)) + simpa [realCoefficients, List.getElem?_map, hn, hz] using zero_sound + +end DefocusingNLS.ExteriorCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorSlowCone.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorSlowCone.lean new file mode 100644 index 0000000000000000000000000000000000000000..8a07c8f8b1c94360c13a86c63dc3523ceee1d474 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ExteriorSlowCone.lean @@ -0,0 +1,50 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ExteriorFormBounds +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ForwardConeTransport + +namespace OAI + +/-! The exact outgoing jet lies in the certified exterior forward cone. -/ + +namespace DefocusingNLS.ExteriorCertificate + +theorem slow_exterior_cone (b Z : ℝ) (hZ : Z ≠ 0) : + matrixCone 5 (Complex.I*(Z : ℂ)) + (forwardProduct 5 (Complex.I*(Z : ℂ)) (-Complex.I*(b : ℂ)) 5) + (slowBoundaryColumn (-Complex.I*(b : ℂ)) 6 (Complex.I*(Z : ℂ))) ≤ 0 := by + have hs : (Complex.I*(Z : ℂ)).re = 0 := by simp + have hi : (Complex.I*(Z : ℂ)).im ≠ 0 := by simpa using hZ + have hC := (normalizedMatching_tail_disk 0 0 5 (-Complex.I*(b : ℂ)) + (Complex.I*(Z : ℂ)) (by norm_num) (by decide) (by simp) hs hi).1 + have h := forward_matchingHomotopyColumn_cone 0 0 5 (-Complex.I*(b : ℂ)) + (Complex.I*(Z : ℂ)) 1 (by norm_num) (by decide) (by simp) hs hi + (by norm_num) le_rfl + norm_num only [Nat.cast_zero,zero_add] at h + change matrixCone 5 (Complex.I*(Z : ℂ)) + (forwardProduct 5 (Complex.I*(Z : ℂ)) (-Complex.I*(b : ℂ)) 5) + (matchingHomotopyColumn 5 5 (Complex.I*(Z : ℂ)) 1 (-Complex.I*(b : ℂ))) ≤ 0 at h + rw [matchingHomotopyColumn_one 5 5 _ _ (by decide) (by simp) hs hi hC, + matrixCone_smul] at h + by_contra hn + have hp := mul_pos (Complex.normSq_pos.mpr (inv_ne_zero hC)) (lt_of_not_ge hn) + linarith + +theorem slow_exterior_pairForm (b Z : ℝ) (hZ : Z ≠ 0) : + hermitianPairForm (exteriorForm b Z 0 0).re (exteriorForm b Z 1 1).re + (exteriorForm b Z 0 1) + (regularizedSlowSolution (-Complex.I*(b : ℂ)) 6 (-Complex.I*(Z : ℂ))) + (-deriv (regularizedSlowSolution (-Complex.I*(b : ℂ)) 6) (-Complex.I*(Z : ℂ))) ≤ 0 := by + have h := slow_exterior_cone b Z hZ + have he := forwardFormEntry_pairForm 5 (Complex.I*(Z : ℂ)) + (forwardProduct 5 (Complex.I*(Z : ℂ)) (-Complex.I*(b : ℂ)) 5) + (by simp) + (regularizedSlowSolution (-Complex.I*(b : ℂ)) 6 (-Complex.I*(Z : ℂ))) + (-deriv (regularizedSlowSolution (-Complex.I*(b : ℂ)) 6) (-Complex.I*(Z : ℂ))) + rw [slowBoundaryColumn_eq_jet _ _ _ (by simp) (by simp) (by simpa using hZ)] at h + unfold exteriorForm + simp only [neg_mul] at h he ⊢ + rw [he] + linarith + +end DefocusingNLS.ExteriorCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ForwardConeMonotonicity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ForwardConeMonotonicity.lean new file mode 100644 index 0000000000000000000000000000000000000000..71cbf0277ae5d85c09fb06b06c66bf0a0872bd95 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ForwardConeMonotonicity.lean @@ -0,0 +1,82 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.NormalizedForwardJet + +namespace OAI + +/-! # Positive forward cone growth to the right of the counting region -/ + +namespace DefocusingNLS + +theorem normalizedForwardJet_cone_monotone (M : ℝ) (s q : ℂ) (w : Fin 2 → ℂ) + (hs : s.re = 0) (hq : M / 2 ≤ q.re) + (hd : ∀ n : ℕ, q + n - (M : ℂ) ≠ 0) : + Monotone (fun n => coneForm M s (normalizedForwardJet M s q w n 0) + (normalizedForwardJet M s q w n 1)) := by + apply monotone_nat_of_le_succ + intro n + have h := normalizedForwardJet_increment M s q w n hs (hd n) + have hnonneg : 0 ≤ ((q + n).re - M / 2) * Complex.normSq + (normalizedForwardJet M s q w n 0 - normalizedForwardJet M s q w (n + 1) 0) := by + apply mul_nonneg _ (Complex.normSq_nonneg _) + simp only [Complex.add_re, Complex.natCast_re] + linarith [Nat.cast_nonneg (α := ℝ) n] + linarith + +theorem normalizedForwardJet_first_strict (M : ℝ) (s q : ℂ) (w : Fin 2 → ℂ) + (hs : s.re = 0) (hq : M / 2 < q.re) (hd : q - (M : ℂ) ≠ 0) + (hs0 : s ≠ 0) (hw0 : w 0 = 0) (hw1 : w 1 ≠ 0) : + coneForm M s (w 0) (w 1) < + coneForm M s (normalizedForwardJet M s q w 1 0) + (normalizedForwardJet M s q w 1 1) := by + have hfirst : normalizedForwardJet M s q w 1 0 ≠ 0 := by + rw [normalizedForwardJet_succ_first _ _ _ _ 0] + simpa [normalizedForwardJet, hw0] using div_ne_zero (mul_ne_zero hs0 hw1) hd + have h := normalizedForwardJet_increment M s q w 0 hs (by simpa using hd) + simp only [Nat.cast_zero, add_zero] at h + change coneForm M s (normalizedForwardJet M s q w 1 0) + (normalizedForwardJet M s q w 1 1) - coneForm M s (w 0) (w 1) = + (q.re - M / 2) * Complex.normSq (w 0 - normalizedForwardJet M s q w 1 0) at h + rw [hw0, zero_sub, Complex.normSq_neg] at h + rw [hw0] + + have hp := mul_pos (sub_pos.mpr hq) (Complex.normSq_pos.mpr hfirst) + linarith + +/-- Opposite initial cross terms cancel. Strict growth in one channel covers +initial vectors whose first coordinate vanishes. -/ +theorem normalizedForwardJet_sum_cone_pos (M : ℝ) (s q₁ q₂ : ℂ) + (w : Fin 2 → ℂ) (N : ℕ) (hM : 0 < M) (hs : s.re = 0) (hs0 : s ≠ 0) + (hq₁ : M / 2 < q₁.re) (hq₂ : M / 2 < q₂.re) + (hd₁ : ∀ n : ℕ, q₁ + n - (M : ℂ) ≠ 0) + (hd₂ : ∀ n : ℕ, q₂ + n - (M : ℂ) ≠ 0) (hN : 1 ≤ N) (hw : w ≠ 0) : + 0 < coneForm M s (normalizedForwardJet M s q₁ w N 0) + (normalizedForwardJet M s q₁ w N 1) + + coneForm M (-s) (normalizedForwardJet M (-s) q₂ w N 0) + (normalizedForwardJet M (-s) q₂ w N 1) := by + have hm₁ := normalizedForwardJet_cone_monotone M s q₁ w hs hq₁.le hd₁ + have hm₂ := normalizedForwardJet_cone_monotone M (-s) q₂ w (by simpa using hs) hq₂.le hd₂ + have hsum : coneForm M s (w 0) (w 1) + coneForm M (-s) (w 0) (w 1) = + M * Complex.normSq (w 0) := by + simp [coneForm] + ring + have h₂ := hm₂ (Nat.zero_le N) + change coneForm M (-s) (w 0) (w 1) ≤ _ at h₂ + by_cases hw0 : w 0 = 0 + · have hw1 : w 1 ≠ 0 := by + intro hz + apply hw + funext i + fin_cases i <;> simp [hw0, hz] + have hstrict := normalizedForwardJet_first_strict M s q₁ w hs hq₁ + (by simpa using hd₁ 0) hs0 hw0 hw1 + have h₁ := hm₁ hN + rw [hw0, Complex.normSq_zero, mul_zero] at hsum + rw [hw0] at hstrict h₂ + linarith + · have h₁ := hm₁ (Nat.zero_le N) + change coneForm M s (w 0) (w 1) ≤ _ at h₁ + have hp := mul_pos hM (Complex.normSq_pos.mpr hw0) + linarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ForwardConeTransport.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ForwardConeTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..6847ce60af973604b568a9495f8b080a819ea90c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ForwardConeTransport.lean @@ -0,0 +1,80 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.MatchingHomotopy + +namespace OAI + +/-! # Forward transport of the homotopy cone -/ + +open Matrix Polynomial + +namespace DefocusingNLS + +theorem forwardProduct_mul_backwardProduct (M s q : ℂ) (K : ℕ) : + forwardProduct M s q K * backwardProduct M s q K = + ((ascPochhammer ℂ K).eval q * (ascPochhammer ℂ K).eval (q - M)) • + (1 : Matrix (Fin 2) (Fin 2) ℂ) := by + induction K with + | zero => simp [forwardProduct, backwardProduct] + | succ K ih => + calc + _ = forwardMatrix M s (q + K) * + (forwardProduct M s q K * backwardProduct M s q K) * + backwardMatrix M s (q + K) := by + simp only [forwardProduct, backwardProduct, Matrix.mul_assoc] + _ = ((ascPochhammer ℂ K).eval q * (ascPochhammer ℂ K).eval (q - M)) • + (forwardMatrix M s (q + K) * backwardMatrix M s (q + K)) := by + rw [ih, Matrix.mul_smul, Matrix.mul_one, Matrix.smul_mul] + _ = _ := by + rw [forwardMatrix_mul_backwardMatrix, smul_smul, + ascPochhammer_succ_eval, ascPochhammer_succ_eval] + congr 1 + ring + +theorem forward_backward_apply (M s q : ℂ) (K : ℕ) (v : Fin 2 → ℂ) : + forwardProduct M s q K *ᵥ (backwardProduct M s q K *ᵥ v) = + ((ascPochhammer ℂ K).eval q * (ascPochhammer ℂ K).eval (q - M)) • v := by + rw [Matrix.mulVec_mulVec, forwardProduct_mul_backwardProduct, Matrix.smul_mulVec, + Matrix.one_mulVec] + +theorem forward_matchingHomotopyColumn (M K : ℕ) (s q : ℂ) (ρ : ℝ) : + forwardProduct M s q K *ᵥ matchingHomotopyColumn M K s ρ q = + ((ascPochhammer ℂ K).eval q * (ascPochhammer ℂ K).eval (q - M)) • + ![(ρ : ℂ) * slowTailRatio q (M + 1) K s, 1] := + forward_backward_apply M s q K _ + +/-- The finite forward image of every homotopy column has nonpositive cone. +This is the input used by the counting-boundary Hermitian form. -/ +theorem forward_matchingHomotopyColumn_cone (σ : ℝ) (ℓ K : ℕ) (q s : ℂ) (ρ : ℝ) + (hσ : -(1 / 32 : ℝ) ≤ σ) (hK : 3 ≤ K) + (hq : q.re = σ + (ℓ : ℝ) / 2) (hsre : s.re = 0) (hsim : s.im ≠ 0) + (hρ : 0 ≤ ρ) (hρ1 : ρ ≤ 1) : + coneForm ((ℓ : ℝ) + 5) s + ((forwardProduct (ℓ + 5) s q K *ᵥ matchingHomotopyColumn (ℓ + 5) K s ρ q) 0) + ((forwardProduct (ℓ + 5) s q K *ᵥ matchingHomotopyColumn (ℓ + 5) K s ρ q) 1) ≤ 0 := by + have h := forward_matchingHomotopyColumn (ℓ + 5) K s q ρ + push_cast at h + rw [h] + change coneForm ((ℓ : ℝ) + 5) s + (((ascPochhammer ℂ K).eval q * (ascPochhammer ℂ K).eval (q - ((ℓ : ℂ) + 5))) * + ((ρ : ℂ) * slowTailRatio q (ℓ + 5 + 1) K s)) + (((ascPochhammer ℂ K).eval q * (ascPochhammer ℂ K).eval (q - ((ℓ : ℂ) + 5))) * 1) ≤ 0 + rw [coneForm_scale, show ℓ + 5 + 1 = ℓ + 6 by omega] + exact mul_nonpos_of_nonneg_of_nonpos (Complex.normSq_nonneg _) + (slowTailRatio_homotopy_cone σ ℓ K q s ρ hσ hK hq hsre hsim hρ hρ1) + +/-- Avoiding the explicit forward/backward factors excludes a zero column, +without any assumption about the determinant of the two-channel problem. -/ +theorem matchingHomotopyColumn_ne_zero_of_factors (M K : ℕ) (s q : ℂ) (ρ : ℝ) + (h₁ : (ascPochhammer ℂ K).eval q ≠ 0) + (h₂ : (ascPochhammer ℂ K).eval (q - M) ≠ 0) : + matchingHomotopyColumn M K s ρ q ≠ 0 := by + intro hz + have h := forward_matchingHomotopyColumn M K s q ρ + rw [hz, Matrix.mulVec_zero] at h + have he := congrFun h 1 + change 0 = ((ascPochhammer ℂ K).eval q * (ascPochhammer ℂ K).eval (q - M)) * 1 at he + rw [mul_one] at he + exact (mul_ne_zero h₁ h₂) he.symm + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ForwardHermitianForm.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ForwardHermitianForm.lean new file mode 100644 index 0000000000000000000000000000000000000000..4a0e4eea7b9615d8822cefe5c8bff58d9a767e00 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ForwardHermitianForm.lean @@ -0,0 +1,106 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HermitianBoundaryForm + +namespace OAI + +/-! # The Hermitian matrix represented by a finite forward cone -/ + +open Matrix + +namespace DefocusingNLS + +noncomputable def forwardFormEntry (M : ℝ) (s : ℂ) (T : Matrix (Fin 2) (Fin 2) ℂ) + (i j : Fin 2) : ℂ := + (M : ℂ) * star (T 0 i) * T 0 j + + s * (star (T 0 i) * T 1 j - star (T 1 i) * T 0 j) + +theorem star_eq_neg_of_re_zero (s : ℂ) (hs : s.re = 0) : star s = -s := by + apply Complex.ext <;> simp [hs] + +theorem forwardFormEntry_hermitian (M : ℝ) (s : ℂ) (T : Matrix (Fin 2) (Fin 2) ℂ) + (hs : s.re = 0) (i j : Fin 2) : star (forwardFormEntry M s T j i) = forwardFormEntry M s T i j := by + have hM : star (M : ℂ) = (M : ℂ) := Complex.conj_ofReal M + simp only [forwardFormEntry, star_add, star_mul, star_sub, star_star, + star_eq_neg_of_re_zero s hs, hM] + ring + +theorem forwardFormEntry_diagonal (M : ℝ) (s : ℂ) (T : Matrix (Fin 2) (Fin 2) ℂ) + (hs : s.re = 0) (i : Fin 2) : forwardFormEntry M s T i i = + ((forwardFormEntry M s T i i).re : ℂ) := by + have h := congrArg Complex.im (forwardFormEntry_hermitian M s T hs i i) + simp only [Complex.star_def, Complex.conj_im] at h + apply Complex.ext + · rfl + · simp only [Complex.ofReal_im] + linarith + +theorem coneForm_as_hermitian (M : ℝ) (s u v : ℂ) (hs : s.re = 0) : + ((M : ℂ) * star u * u + s * (star u * v - star v * u)).re = 2 * coneForm M s u v := by + simp only [coneForm, Complex.normSq_apply, Complex.mul_re, Complex.mul_im, + Complex.add_re, Complex.sub_re, Complex.sub_im, Complex.star_def, + Complex.conj_re, Complex.conj_im, Complex.ofReal_re, Complex.ofReal_im, hs] + ring + +theorem hermitianPairForm_eq_quadratic (a d : ℝ) (c u v : ℂ) : + hermitianPairForm a d c u v = + ((a : ℂ) * star u * u + c * star u * v + star c * star v * u + + (d : ℂ) * star v * v).re := by + simp only [hermitianPairForm, Complex.normSq_apply, Complex.mul_re, Complex.mul_im, + Complex.add_re, Complex.star_def, Complex.conj_re, Complex.conj_im, + Complex.ofReal_re, Complex.ofReal_im] + ring + +theorem forwardFormEntry_expansion (M : ℝ) (s u v : ℂ) (T : Matrix (Fin 2) (Fin 2) ℂ) : + forwardFormEntry M s T 0 0 * star u * u + + forwardFormEntry M s T 0 1 * star u * v + + forwardFormEntry M s T 1 0 * star v * u + + forwardFormEntry M s T 1 1 * star v * v = + (M : ℂ) * star ((T *ᵥ ![u, v]) 0) * ((T *ᵥ ![u, v]) 0) + + s * (star ((T *ᵥ ![u, v]) 0) * ((T *ᵥ ![u, v]) 1) - + star ((T *ᵥ ![u, v]) 1) * ((T *ᵥ ![u, v]) 0)) := by + simp [forwardFormEntry, Matrix.mulVec, dotProduct, Fin.sum_univ_two, star_add, star_mul] + ring + +/-- The Hermitian quadratic form is twice the forward cone form. -/ +theorem forwardFormEntry_pairForm (M : ℝ) (s : ℂ) (T : Matrix (Fin 2) (Fin 2) ℂ) + (hs : s.re = 0) (u v : ℂ) : + hermitianPairForm (forwardFormEntry M s T 0 0).re (forwardFormEntry M s T 1 1).re + (forwardFormEntry M s T 0 1) u v = 2 * matrixCone M s T ![u, v] := by + rw [hermitianPairForm_eq_quadratic, + ← forwardFormEntry_diagonal M s T hs 0, ← forwardFormEntry_diagonal M s T hs 1, + forwardFormEntry_hermitian M s T hs 1 0, forwardFormEntry_expansion, + coneForm_as_hermitian M s _ _ hs] + rfl + +theorem hermitianPairForm_add (a₁ a₂ d₁ d₂ : ℝ) (c₁ c₂ u v : ℂ) : + hermitianPairForm (a₁ + a₂) (d₁ + d₂) (c₁ + c₂) u v = + hermitianPairForm a₁ d₁ c₁ u v + hermitianPairForm a₂ d₂ c₂ u v := by + simp only [hermitianPairForm, add_mul, Complex.add_re] + ring + +/-- Positive leading entry and determinant of the summed Hermitian matrix +supply the positivity needed for exclusion of matching zeros. -/ +theorem positive_sum_matrixCone (M : ℝ) (s₁ s₂ : ℂ) + (T₁ T₂ : Matrix (Fin 2) (Fin 2) ℂ) (hs₁ : s₁.re = 0) (hs₂ : s₂.re = 0) + (ha : 0 < (forwardFormEntry M s₁ T₁ 0 0).re + (forwardFormEntry M s₂ T₂ 0 0).re) + (hdet : 0 < + ((forwardFormEntry M s₁ T₁ 0 0).re + (forwardFormEntry M s₂ T₂ 0 0).re) * + ((forwardFormEntry M s₁ T₁ 1 1).re + (forwardFormEntry M s₂ T₂ 1 1).re) - + Complex.normSq (forwardFormEntry M s₁ T₁ 0 1 + forwardFormEntry M s₂ T₂ 0 1)) + (w : Fin 2 → ℂ) (hw : w ≠ 0) : + 0 < matrixCone M s₁ T₁ w + matrixCone M s₂ T₂ w := by + have hw' : w 0 ≠ 0 ∨ w 1 ≠ 0 := by + by_contra hn + push Not at hn + apply hw + ext i + fin_cases i <;> simp [hn.1, hn.2] + have h := hermitianPairForm_pos _ _ _ (w 0) (w 1) ha hdet hw' + rw [hermitianPairForm_add, forwardFormEntry_pairForm M s₁ T₁ hs₁, + forwardFormEntry_pairForm M s₂ T₂ hs₂] at h + have he : ![w 0, w 1] = w := by ext i; fin_cases i <;> rfl + rw [he] at h + linarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ForwardMatching.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ForwardMatching.lean new file mode 100644 index 0000000000000000000000000000000000000000..537a3b47f68e2d37840b13047e6a21ada51c3dc6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ForwardMatching.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.MatchingColumns + +namespace OAI + +/-! # Forward matching with its exact scalar factors -/ + +open Matrix Polynomial + +namespace DefocusingNLS + +/-- The forward matrix before division by `t-M`. -/ +noncomputable def forwardMatrix (M s t : ℂ) : Matrix (Fin 2) (Fin 2) ℂ := + !![t, s; -t, t - M - s] + +noncomputable def forwardProduct (M s q : ℂ) : ℕ → Matrix (Fin 2) (Fin 2) ℂ + | 0 => 1 + | K + 1 => forwardMatrix M s (q + K) * forwardProduct M s q K + +theorem forwardMatrix_step (M s t B C B' C' : ℂ) + (hB : (t - M) * B' = t * B + s * C) (hC : C' = C - B') : + forwardMatrix M s t *ᵥ ![B, C] = (t - M) • ![B', C'] := by + ext i + fin_cases i + · simp [forwardMatrix, Matrix.mulVec, dotProduct, Fin.sum_univ_two] + linear_combination -hB + · simp [forwardMatrix, Matrix.mulVec, dotProduct, Fin.sum_univ_two, hC] + linear_combination hB + +/-- Forward and backward matrices compose to precisely `t(t-M) I`. -/ +theorem forwardMatrix_mul_backwardMatrix (M s t : ℂ) : + forwardMatrix M s t * backwardMatrix M s t = (t * (t - M)) • (1 : Matrix (Fin 2) (Fin 2) ℂ) := by + ext i j + fin_cases i <;> fin_cases j <;> + simp [forwardMatrix, backwardMatrix, Matrix.mul_apply, Fin.sum_univ_two] <;> ring + +theorem backwardMatrix_mul_forwardMatrix (M s t : ℂ) : + backwardMatrix M s t * forwardMatrix M s t = (t * (t - M)) • (1 : Matrix (Fin 2) (Fin 2) ℂ) := by + ext i j + fin_cases i <;> fin_cases j <;> + simp [forwardMatrix, backwardMatrix, Matrix.mul_apply, Fin.sum_univ_two] <;> ring + +theorem det_forwardMatrix (M s t : ℂ) : (forwardMatrix M s t).det = t * (t - M) := by + simp [forwardMatrix, Matrix.det_fin_two] + ring + +theorem det_backwardMatrix (M s t : ℂ) : (backwardMatrix M s t).det = t * (t - M) := by + simp [backwardMatrix, Matrix.det_fin_two] + ring + +/-- Iterating forward multiplies the terminal pair by `(q-M)_K`. -/ +theorem forwardProduct_apply (M s q : ℂ) (B C : ℕ → ℂ) + (hB : ∀ n, (q + n - M) * B (n + 1) = (q + n) * B n + s * C n) + (hC : ∀ n, C (n + 1) = C n - B (n + 1)) (K : ℕ) : + forwardProduct M s q K *ᵥ ![B 0, C 0] = + (ascPochhammer ℂ K).eval (q - M) • ![B K, C K] := by + induction K with + | zero => simp [forwardProduct] + | succ K ih => + rw [forwardProduct, ← Matrix.mulVec_mulVec, ih, Matrix.mulVec_smul, + forwardMatrix_step M s (q + K) _ _ _ _ (hB K) (hC K), smul_smul, + ascPochhammer_succ_eval] + congr 1 + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeExterior.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeExterior.lean new file mode 100644 index 0000000000000000000000000000000000000000..e7bc3df01a5488dc84163294c3d94a31668ddea3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeExterior.lean @@ -0,0 +1,36 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ExteriorQuotientBounds +import OAI.MathematicalPhysics.DefocusingNLS.Profile.ProfileExistence + +namespace OAI + +/-! Part (2) of the manuscript's free matching proposition on the certified disk. -/ + +namespace DefocusingNLS.ProfileCertificate +open ExteriorCertificate + +theorem disk_free_exterior (w : Metric.closedBall (0 : ℂ) (radius : ℝ)) + (z : ℝ) (hz : (centerZ : ℝ)+w.val.im ≤ z) : + regularizedSlowSolution (-Complex.I*(((centerB : ℝ)+w.val.re : ℝ) : ℂ)) + 6 (-Complex.I*(z : ℂ)) ≠ 0 ∧ + (freeProfileJ ((centerB : ℝ)+w.val.re) z).re < 43/1000 ∧ + (3 ≤ z → 0 < (freeProfileJ ((centerB : ℝ)+w.val.re) z).im) := by + obtain ⟨hb,hZ⟩ := disk_coordinates w + have hbl := (abs_le.mp hb).1 + have hbu := (abs_le.mp hb).2 + have hZl := (abs_le.mp hZ).1 + have hb' : |100000000*((centerB : ℝ)+w.val.re)-33477607| ≤ 2 := by + apply abs_le.mpr + constructor <;> norm_num [centerB,radius] at hbl hbu ⊢ <;> linarith + have hz' : 2704/1000 ≤ z := by + norm_num [centerZ,radius] at hz hZl ⊢ + linarith + refine ⟨exterior_slow_nonzero _ z hb' hz',?_,?_⟩ + · rw [freeProfileJ_eq_log_derivative _ _ (by linarith)] + exact exterior_quotient_real_bound _ z hb' hz' + · intro hz3 + rw [freeProfileJ_eq_log_derivative _ _ (by linarith)] + exact exterior_quotient_imaginary_positive _ z hb' hz3 + +end DefocusingNLS.ProfileCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeHighAngularSpectrum.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeHighAngularSpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..5d5f6debe8944375d72e8c4c2ea291d8051e76c5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeHighAngularSpectrum.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HighAngularMatching +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralEndpointMultiplicity +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.MatchingBoundary +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.FreeLowAngularSpectrum + +namespace OAI + +/-! High-angular exclusion for the actual outgoing matching determinant. -/ + +open Matrix +namespace DefocusingNLS + +theorem free_high_angular_nonzero (ell : ℕ) (b Z : ℝ) (z : ℂ) + (hell : 4 ≤ ell) (hZ : 2704/1000 ≤ Z) (hZ' : Z ≤ 2706/1000) + (hz : -(1/32 : ℝ) ≤ z.re) : spectralSlowDeterminant ell b Z z ≠ 0 := by + let qp := spectralQ ell 1 b z + let qm := spectralQ ell (-1) b z + have hq (h : ℝ) : -1 < (spectralQ ell h b z).re := by + rw [spectralQ_re] + linarith [Nat.cast_nonneg (α := ℝ) ell] + have hZ0 : Z ≠ 0 := by linarith + intro hdet + obtain ⟨c,hc⟩ := matchingColumnDeterminant_eq_zero_imp_smul + (slowBoundaryColumn qp (ell+6) (Complex.I*Z)) + (slowBoundaryColumn qm (ell+6) (-Complex.I*Z)) + (slowBoundaryColumn_ne_zero qp (ell+6) (Complex.I*Z) (hq 1) (by simp) (by simpa using hZ0)) hdet + rw [slowBoundaryColumn_eq_jet qp (ell+6) (Complex.I*Z) (hq 1) (by simp) (by simpa using hZ0), + slowBoundaryColumn_eq_jet qm (ell+6) (-Complex.I*Z) (hq (-1)) (by simp) (by simpa using hZ0)] at hc + have hH := congrFun hc 0 + have hD := congrFun hc 1 + simp only [Matrix.cons_val_zero,Matrix.cons_val_one,Pi.smul_apply,smul_eq_mul,neg_neg, + neg_mul] at hH hD + have hD' : deriv (regularizedSlowSolution qm (ell+6)) (Complex.I*Z) = + c*deriv (regularizedSlowSolution qp (ell+6)) (-Complex.I*Z) := by + simpa only [neg_mul,mul_neg,neg_inj] using hD + have hσ (h : ℝ) : -(1/32 : ℝ) ≤ 3-((((ell+5 : ℕ) : ℂ)+1)/2-spectralQ ell h b z).re := by + simp only [Complex.sub_re,Complex.div_re,Complex.add_re,Complex.natCast_re, + spectralQ_re] + norm_num + linarith + apply highAngular_matched_jets_impossible qp qm (ell+5) Z (hq 1) (hq (-1)) (by omega) + (hσ 1) (hσ (-1)) hZ hZ' c + · simpa only [show ell+5+1=ell+6 by omega,neg_mul] using hH + · simpa only [show ell+5+1=ell+6 by omega] using hD' + +theorem free_high_angular_nonzero_on_disk (ell : ℕ) (b Z : ℝ) (z : ℂ) + (hell : 4 ≤ ell) (hD : (b,Z) ∈ freeMatchingDisk) + (hz : -(1/32 : ℝ) ≤ z.re) : spectralSlowDeterminant ell b Z z ≠ 0 := by + obtain ⟨_,hZ⟩ := freeMatchingDisk_subset_certificate_box hD + obtain ⟨hlo,hhi⟩ := abs_le.mp hZ + exact free_high_angular_nonzero ell b Z z hell (by linarith) (by linarith) hz + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeLimitingModel.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeLimitingModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..295b627ac588cffaabc272fce87659e7237342c0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeLimitingModel.lean @@ -0,0 +1,47 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.FreeRadialRegularity +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.FreeOutgoingSpectrum + +namespace OAI + +/-! An actual matched limiting profile with the complete free outgoing count. -/ + +namespace DefocusingNLS + +theorem exists_free_limiting_model (hR : RectangleRouche) : + ∃ b Z : ℝ, (b,Z) ∈ freeMatchingDisk ∧ + ContDiff ℝ 1 (freeRadialProfile b Z) ∧ freeRadialProfile b Z 0=1 ∧ + (∀ r : ℝ, 0 ≤ r → freeRadialProfile b Z r ≠ 0) ∧ + (∀ ell : ℕ, closedCountingHalfPlaneZeroCount (spectralSlowDeterminant ell b Z)= + (freeOutgoingCount ell : ℕ∞)) := by + obtain ⟨w,_,hw⟩ := ProfileCertificate.exists_diskProfile_zero + let b : ℝ := (ProfileCertificate.centerB : ℝ)+w.val.re + let Z : ℝ := (ProfileCertificate.centerZ : ℝ)+w.val.im + obtain ⟨hb,hz⟩ := ProfileCertificate.disk_coordinates w + have hZ : 0 < Z := by + have hl := (abs_le.mp hz).1 + dsimp [Z] + norm_num [ProfileCertificate.centerZ,ProfileCertificate.radius] at hl ⊢ + linarith + have hH : regularizedSlowSolution (-Complex.I*(b : ℂ)) 6 (-Complex.I*(Z : ℂ)) ≠ 0 := by + exact (ProfileCertificate.disk_free_exterior w Z le_rfl).1 + have hD : deriv (regularizedSlowSolution (-Complex.I*(b : ℂ)) 6) (-Complex.I*(Z : ℂ))=0 := by + change ProfileCertificate.freeProfileJ b Z=0 at hw + rw [ProfileCertificate.freeProfileJ_eq_log_derivative b Z hZ] at hw + exact neg_eq_zero.mp ((div_eq_zero_iff.mp hw).resolve_right hH) + have hDisk : (b,Z) ∈ freeMatchingDisk := by + have hn : ‖w.val‖ ≤ (ProfileCertificate.radius : ℝ) := by + simpa only [Metric.mem_closedBall,dist_zero_right] using w.property + have hs := sq_le_sq₀ (norm_nonneg w.val) (by norm_num [ProfileCertificate.radius]) |>.2 hn + rw [← Complex.normSq_eq_norm_sq,Complex.normSq_apply] at hs + simpa [freeMatchingDisk,b,Z,ProfileCertificate.centerB,ProfileCertificate.centerZ, + ProfileCertificate.radius,pow_two] using hs + refine ⟨b,Z,hDisk,contDiff_freeRadialProfile b Z hZ hH hD,?_,?_,?_⟩ + · exact ite_eq_left (freeProfileRadius_pos hZ).le + · intro r hr + exact freeRadialProfile_nonzero_on_disk w r hr + · intro ell + exact free_outgoing_count hR ell b Z hDisk + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeLowAngularSpectrum.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeLowAngularSpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..a46132887ac89753c63345626c5927b625b4f690 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeLowAngularSpectrum.lean @@ -0,0 +1,74 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.UniformOutgoingCount + +namespace OAI + +/-! # The low angular outgoing counts on the manuscript's parameter disk -/ + +open Set + +namespace DefocusingNLS + +/-- The exact disk in equation `free:parameter-disk`; terminating decimals are +represented as rational numbers. -/ +def freeMatchingDisk : Set (ℝ × ℝ) := + {p | (p.1 - 33477606871236 / 100000000000000) ^ 2 + + (p.2 - 270506819293654 / 100000000000000) ^ 2 ≤ (1 / 100000000 : ℝ) ^ 2} + +theorem freeMatchingDisk_subset_certificate_box {b Z : ℝ} + (h : (b, Z) ∈ freeMatchingDisk) : + |100000000 * b - 33477607| ≤ 2 ∧ |100000000 * Z - 270506819| ≤ 2 := by + change (b - 33477606871236 / 100000000000000) ^ 2 + + (Z - 270506819293654 / 100000000000000) ^ 2 ≤ (1 / 100000000 : ℝ) ^ 2 at h + have hb : |b - 33477606871236 / 100000000000000| ≤ (1 / 100000000 : ℝ) := by + nlinarith [sq_nonneg (Z - 270506819293654 / 100000000000000), + sq_abs (b - 33477606871236 / 100000000000000), + abs_nonneg (b - 33477606871236 / 100000000000000)] + have hZ : |Z - 270506819293654 / 100000000000000| ≤ (1 / 100000000 : ℝ) := by + nlinarith [sq_nonneg (b - 33477606871236 / 100000000000000), + sq_abs (Z - 270506819293654 / 100000000000000), + abs_nonneg (Z - 270506819293654 / 100000000000000)] + obtain ⟨hb₁, hb₂⟩ := abs_le.mp hb + obtain ⟨hZ₁, hZ₂⟩ := abs_le.mp hZ + constructor <;> apply abs_le.mpr <;> constructor <;> linarith + +noncomputable def closedCountingHalfPlaneZeroCount (f : ℂ → ℂ) : ℕ∞ := + ∑' z : {z : ℂ | -(1 / 32 : ℝ) ≤ z.re}, analyticOrderAt f z.1 + +theorem spectralSlowDeterminant_left_ne_zero (ell : Fin 4) (b Z : ℝ) + (hb : |100000000 * b - 33477607| ≤ 2) (hZ : |100000000 * Z - 270506819| ≤ 2) + (z : ℂ) (hz : z.re = -(1 / 32 : ℝ)) : spectralSlowDeterminant ell b Z z ≠ 0 := by + have hZ0 : Z ≠ 0 := by intro h; norm_num [h] at hZ + exact spectralSlowDeterminant_ne_zero_of_endpoint ell b Z z hZ0 hz.ge + (spectralHomotopyDeterminant_left ell b Z 1 z hb hZ (by norm_num) le_rfl hz) + +theorem closedCountingHalfPlaneZeroCount_eq_open (ell : Fin 4) (b Z : ℝ) + (hb : |100000000 * b - 33477607| ≤ 2) (hZ : |100000000 * Z - 270506819| ≤ 2) : + closedCountingHalfPlaneZeroCount (spectralSlowDeterminant ell b Z) = + countingHalfPlaneZeroCount (spectralSlowDeterminant ell b Z) := by + classical + unfold closedCountingHalfPlaneZeroCount countingHalfPlaneZeroCount + rw [tsum_subtype, tsum_subtype] + apply tsum_congr + intro z + by_cases ho : -(1 / 32 : ℝ) < z.re + · simp only [Set.indicator_apply, Set.mem_ofPred_eq, ite_eq_left ho, ite_eq_left ho.le] + · by_cases hc : -(1 / 32 : ℝ) ≤ z.re + · have he : z.re = -(1 / 32 : ℝ) := le_antisymm (le_of_not_gt ho) hc + have hz : analyticOrderAt (spectralSlowDeterminant ell b Z) z = 0 := + analyticOrderAt_eq_zero.mpr (Or.inr (spectralSlowDeterminant_left_ne_zero ell b Z hb hZ z he)) + simp only [Set.indicator_apply, Set.mem_ofPred_eq, ite_eq_left hc, ite_eq_right ho, hz] + · simp only [Set.indicator_apply, Set.mem_ofPred_eq, ite_eq_right hc, ite_eq_right ho] + +/-- The low modes of Proposition `free:main`, on its exact disk and closed +counting half-plane. -/ +theorem free_low_angular_count (hR : RectangleRouche) (ell : Fin 4) (b Z : ℝ) + (h : (b, Z) ∈ freeMatchingDisk) : + closedCountingHalfPlaneZeroCount (spectralSlowDeterminant ell b Z) = + (SeparatorArithmetic.positiveRootCount ell : ℕ∞) := by + obtain ⟨hb, hZ⟩ := freeMatchingDisk_subset_certificate_box h + exact (closedCountingHalfPlaneZeroCount_eq_open ell b Z hb hZ).trans + (outgoing_halfPlane_count hR ell b Z hb hZ) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeMatching.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeMatching.lean new file mode 100644 index 0000000000000000000000000000000000000000..0daeda0bafc4689e07ab579222cf0f51ff890898 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeMatching.lean @@ -0,0 +1,117 @@ +import Mathlib.Analysis.Complex.Basic +import Mathlib.Tactic +import Mathlib.Topology.Order.MonotoneConvergence + +namespace OAI + +/-! +# Algebra in the free exterior matching problem + +The finite-dimensional cone identity in +*Stable self-similar blowup for a supercritical defocusing Schrödinger equation +on the torus* (September 2026), Lemma `free:laguerre`, follows algebraically +from the Laguerre recurrence. +-/ + +open Filter Topology + +namespace DefocusingNLS + +/-- The real cone form in equation `free:cone-form`. -/ +noncomputable def coneForm (M : ℝ) (s B C : ℂ) : ℝ := + M / 2 * Complex.normSq B + (s * star B * C).re + +/-- The Laguerre recurrence implies its exact cone increment. -/ +theorem coneForm_increment (M : ℝ) (s t B C g : ℂ) + (hs : s.re = 0) + (hrec : t * g = -(M : ℂ) * (B - g) - s * C) : + coneForm M s (B - g) (C - (B - g)) - coneForm M s B C = + (t.re - M / 2) * Complex.normSq g := by + have hr := congrArg Complex.re hrec + have hi := congrArg Complex.im hrec + simp only [Complex.mul_re, Complex.mul_im, Complex.sub_re, Complex.sub_im, + Complex.neg_re, Complex.neg_im, Complex.ofReal_re, Complex.ofReal_im, hs, + zero_mul, zero_sub, zero_add] at hr hi + simp only [coneForm, Complex.normSq_apply, Complex.mul_re, Complex.mul_im, + Complex.sub_re, Complex.sub_im, Complex.star_def, Complex.conj_re, Complex.conj_im, hs, + zero_mul, zero_sub, zero_add] + linear_combination -g.re * hr - g.im * hi + +/-- With the paper's mode parameters, the angular degree cancels from the increment. -/ +theorem mode_coneForm_increment (σ : ℝ) (ℓ n : ℕ) (s t B C g : ℂ) + (hs : s.re = 0) (ht : t.re = σ + (ℓ : ℝ) / 2 + n) + (hrec : t * g = -((ℓ : ℝ) + 5 : ℂ) * (B - g) - s * C) : + coneForm ((ℓ : ℝ) + 5) s (B - g) (C - (B - g)) - + coneForm ((ℓ : ℝ) + 5) s B C = + (σ + n - 5 / 2) * Complex.normSq g := by + have hrec' : t * g = -(((ℓ : ℝ) + 5 : ℝ) : ℂ) * (B - g) - s * C := by + simpa using hrec + rw [coneForm_increment ((ℓ : ℝ) + 5) s t B C g hs hrec', ht] + ring + +/-- The cone increments past index three are nonnegative in the counting half-plane. -/ +theorem mode_increment_nonneg (σ : ℝ) (n : ℕ) (g : ℂ) + (hσ : -(1 / 32 : ℝ) ≤ σ) (hn : 3 ≤ n) : + 0 ≤ (σ + n - 5 / 2) * Complex.normSq g := by + have hn' : (3 : ℝ) ≤ n := by exact_mod_cast hn + have hweight : 0 ≤ σ + n - 5 / 2 := by linarith + exact mul_nonneg hweight (Complex.normSq_nonneg g) + +/-- Completing the square identifies the cone with the tail disk. -/ +theorem coneForm_square_identity (M : ℝ) (s B C : ℂ) : + Complex.normSq ((M : ℂ) * B + s * C) - Complex.normSq (s * C) = + 2 * M * coneForm M s B C := by + simp only [coneForm, Complex.normSq_apply, Complex.mul_re, Complex.mul_im, + Complex.add_re, Complex.add_im, Complex.ofReal_re, Complex.ofReal_im, + Complex.star_def, Complex.conj_re, Complex.conj_im] + ring + +/-- A strictly negative cone form implies both a nonzero denominator and the +strict disk bound used in Lemma `free:cone`. The purely imaginary specialization +`s = h * I * Z` has disk center `-s / M` and radius `Z / M`. -/ +theorem tail_disk_of_negative_cone (M : ℝ) (s B C : ℂ) + (hM : 0 < M) (hcone : coneForm M s B C < 0) : + C ≠ 0 ∧ Complex.normSq (B / C + s / (M : ℂ)) < + Complex.normSq (s / (M : ℂ)) := by + have hC : C ≠ 0 := by + intro hzero + have hn := Complex.normSq_nonneg B + simp only [hzero, coneForm, mul_zero, Complex.zero_re, add_zero] at hcone + nlinarith + have hMc : (M : ℂ) ≠ 0 := by exact_mod_cast hM.ne' + have hnegative : 2 * M * coneForm M s B C < 0 := + mul_neg_of_pos_of_neg (by linarith) hcone + have hdisk : Complex.normSq ((M : ℂ) * B + s * C) < Complex.normSq (s * C) := by + linarith [coneForm_square_identity M s B C] + refine ⟨hC, ?_⟩ + have hquot : B / C + s / (M : ℂ) = + ((M : ℂ) * B + s * C) / ((M : ℂ) * C) := by + field_simp [hC, hMc] + have hcenter : s / (M : ℂ) = s * C / ((M : ℂ) * C) := by + field_simp [hC, hMc] + rw [hquot, hcenter, Complex.normSq_div, Complex.normSq_div] + exact div_lt_div_of_pos_right hdisk (Complex.normSq_pos.mpr (mul_ne_zero hMc hC)) + +/-- Increasing cone forms that tend to zero are nonpositive; one nonzero +positive-weight increment makes the initial cone strictly negative. -/ +theorem negative_of_increasing_tail {p : ℕ → ℝ} (K : ℕ) + (hlimit : Tendsto p atTop (𝓝 0)) + (hinc : ∀ n, K ≤ n → p n ≤ p (n + 1)) + (hstrict : ∃ n, K ≤ n ∧ p n < p (n + 1)) : p K < 0 := by + have hmono : Monotone (fun n => p (n + K)) := by + apply monotone_nat_of_le_succ + intro n + simpa [Nat.add_assoc, Nat.add_left_comm, Nat.add_comm] using + hinc (n + K) (Nat.le_add_left K n) + have hzero (n : ℕ) : p (n + K) ≤ 0 := + hmono.ge_of_tendsto (hlimit.comp (tendsto_add_atTop_nat K)) n + obtain ⟨n, hn, hstrict⟩ := hstrict + have hKn : p K ≤ p n := by + simpa [Nat.sub_add_cancel hn] using hmono (Nat.zero_le (n - K)) + have hnzero : p (n + 1) ≤ 0 := by + simpa [Nat.sub_add_cancel (show K ≤ n + 1 by omega)] using hzero (n + 1 - K) + exact lt_of_le_of_lt hKn (lt_of_lt_of_le hstrict hnzero) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeOutgoingNonvanishing.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeOutgoingNonvanishing.lean new file mode 100644 index 0000000000000000000000000000000000000000..cbf0e027c0b21f57b5d221e1600fad9bd1f676d2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeOutgoingNonvanishing.lean @@ -0,0 +1,32 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.FreeOutgoingSpectrum +import Mathlib.Topology.Algebra.InfiniteSum.Order + +namespace OAI + +/-! The zero outgoing count excludes every free zero in angular degree at +least two, including the boundary of the counting half-plane. -/ + +namespace DefocusingNLS + +theorem free_outgoing_nonzero (hR : RectangleRouche) (ell : ℕ) (hell : 2 ≤ ell) + (b Z : ℝ) (hD : (b,Z) ∈ freeMatchingDisk) (lam : ℂ) + (hhalf : -(1/32 : ℝ)≤lam.re) : spectralSlowDeterminant ell b Z lam≠0 := by + have hZ : Z≠0 := by + have hh := (abs_le.mp (freeMatchingDisk_subset_certificate_box hD).2).1 + intro hz + norm_num [hz] at hh + have hc := free_outgoing_count hR ell b Z hD + have hcount : closedCountingHalfPlaneZeroCount (spectralSlowDeterminant ell b Z)=0 := by + simpa only [freeOutgoingCount,ite_eq_right (show ell≠0 by omega), + ite_eq_right (show ell≠1 by omega),Nat.cast_zero] using hc + let f := fun z : {z : ℂ | -(1/32 : ℝ)≤z.re} => + analyticOrderAt (spectralSlowDeterminant ell b Z) z.val + have hs : Summable f := ⟨_,hasSum_of_isLUB _ (isLUB_sSup (Set.range + (fun s : Finset {z : ℂ | -(1/32 : ℝ)≤z.re} => ∑ z ∈ s, f z)))⟩ + have ho : analyticOrderAt (spectralSlowDeterminant ell b Z) lam=0 := + hs.tsum_eq_zero_iff.mp hcount ⟨lam,hhalf⟩ + exact (analyticAt_spectralSlowDeterminant ell b Z lam hZ hhalf).analyticOrderAt_eq_zero.mp ho + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeOutgoingSpectrum.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeOutgoingSpectrum.lean new file mode 100644 index 0000000000000000000000000000000000000000..b05168686559c1aae3c557f0e8c76c8afa45ada4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeOutgoingSpectrum.lean @@ -0,0 +1,35 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.FreeHighAngularSpectrum + +namespace OAI + +/-! The complete free outgoing count on the manuscript's parameter disk. -/ + +namespace DefocusingNLS + +def freeOutgoingCount (ell : ℕ) : ℕ := if ell=0 then 2 else if ell=1 then 1 else 0 + +theorem free_high_angular_count (ell : ℕ) (b Z : ℝ) (hell : 4 ≤ ell) + (hD : (b,Z) ∈ freeMatchingDisk) : + closedCountingHalfPlaneZeroCount (spectralSlowDeterminant ell b Z)=0 := by + unfold closedCountingHalfPlaneZeroCount + have hz : ∀ z : {z : ℂ | -(1/32 : ℝ) ≤ z.re}, + analyticOrderAt (spectralSlowDeterminant ell b Z) z.1 = 0 := by + intro z + exact analyticOrderAt_eq_zero.mpr (Or.inr + (free_high_angular_nonzero_on_disk ell b Z z hell hD z.2)) + simp only [hz,tsum_zero] + +theorem free_outgoing_count (hR : RectangleRouche) (ell : ℕ) (b Z : ℝ) + (hD : (b,Z) ∈ freeMatchingDisk) : + closedCountingHalfPlaneZeroCount (spectralSlowDeterminant ell b Z)= + (freeOutgoingCount ell : ℕ∞) := by + by_cases hl : ell < 4 + · have h := free_low_angular_count hR ⟨ell,hl⟩ b Z hD + interval_cases ell <;> simpa [freeOutgoingCount,SeparatorArithmetic.positiveRootCount] using h + · have he : 4 ≤ ell := by omega + rw [free_high_angular_count ell b Z he hD] + simp [freeOutgoingCount,show ell≠0 by omega,show ell≠1 by omega] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreePhysicalGeneralizedExclusion.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreePhysicalGeneralizedExclusion.lean new file mode 100644 index 0000000000000000000000000000000000000000..6ecb786a9654c6632525a5ff5cb368d84580932e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreePhysicalGeneralizedExclusion.lean @@ -0,0 +1,92 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.FreePhysicalSymmetryNoChain +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralFreeChainCore +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralRobinColumnDerivative + +namespace OAI + +/-! The physical free boundary problem has no first generalized eigenvector +at a symmetry root, assuming the rectangle form of Rouché's theorem. -/ + +open Set +namespace DefocusingNLS +open ProfileCertificate +local notation "E₄" => (ℂ × ℂ) × (ℂ × ℂ) + +theorem radialFreePhysical_generalized_exclusion (hRou : RectangleRouche) (w : RadialShootingDisk) + (hw : diskProfile w=0) (ell : ℕ) (lam : ℂ) + (hs : (ell=0 ∧ (lam=0 ∨ lam=1)) ∨ (ell=1 ∧ lam=1/2)) + (R : ℝ) (hR : radialShootingR w < R) (a b : ℂ) (hab : a ≠ 0 ∨ b ≠ 0) + (U₀ U₁ : ℝ → E₄) + (hU₀ : ∀ r ∈ Icc (radialShootingR w) R, + U₀ r = a • spectralFreePositivePhysical ell (radialShootingB w) lam r + + b • spectralFreeNegativePhysical ell (radialShootingB w) lam r) + (hC₀ : spectralFreeCoreBoundary ell (radialShootingR w) (U₀ (radialShootingR w))=0) + (hC₁ : spectralFreeCoreBoundary ell (radialShootingR w) (U₁ (radialShootingR w))=0) + (hcont : ContinuousOn U₁ (Icc (radialShootingR w) R)) + (hD : ∀ r ∈ Ioo (radialShootingR w) R, HasDerivAt U₁ + (spectralFreePhysicalPairField (radialShootingB w) lam ((ell : ℂ)*((ell : ℂ)+10)) r (U₁ r) + + spectralFreeChainSource (U₀ r)) r) + (hdet : spectralValueDet + (spectralPhysicalValueMap (spectralFreePositivePhysical ell (radialShootingB w) lam R)) + (spectralPhysicalValueMap (spectralFreeNegativePhysical ell (radialShootingB w) lam R)) ≠ 0) + (hRobin : spectralPhysicalDerivativeMap (U₁ R) = + spectralJetRobin (spectralFreePositivePhysical ell (radialShootingB w) lam R) + (spectralFreeNegativePhysical ell (radialShootingB w) lam R) (spectralPhysicalValueMap (U₁ R)) + + deriv (fun z => spectralJetRobin (spectralFreePositivePhysical ell (radialShootingB w) z R) + (spectralFreeNegativePhysical ell (radialShootingB w) z R)) lam (spectralPhysicalValueMap (U₀ R))) : False := by + let L := radialShootingR w + let β := radialShootingB w + let P := spectralFreePositivePhysical ell β lam + let N := spectralFreeNegativePhysical ell β lam + let DP := fun r => deriv (fun z => spectralFreePositivePhysical ell β z r) lam + let DN := fun r => deriv (fun z => spectralFreeNegativePhysical ell β z r) lam + have hL : 0 < L := by have := (radialShooting_geometry w).2.1; dsimp [L]; linarith + have hhalf : -(1/32 : ℝ) ≤ lam.re := by + rcases hs with ⟨_,rfl | rfl⟩ | ⟨_,rfl⟩ <;> norm_num + have hq (h : ℝ) : -1 < (spectralQ ell h β lam).re := by + rw [spectralQ_re] + linarith [Nat.cast_nonneg (α := ℝ) ell] + have hlog (r : ℝ) (hr : r ∈ Icc L R) : max 0 (Real.log 4/2) < Real.log r := + spectralFreeRadius_log r ((radialShooting_geometry w).2.1.trans hr.1) + have hDP (r : ℝ) (hr : r ∈ Icc L R) : HasDerivAt DP + (spectralFreePhysicalPairField β lam ((ell : ℂ)*((ell : ℂ)+10)) r (DP r) + + spectralFreeChainSource (P r)) r := + spectralFreePositivePhysical_parameter_hasDerivAt ell β lam (hq 1) r + (hL.trans_le hr.1) (hlog r hr) + have hDN (r : ℝ) (hr : r ∈ Icc L R) : HasDerivAt DN + (spectralFreePhysicalPairField β lam ((ell : ℂ)*((ell : ℂ)+10)) r (DN r) + + spectralFreeChainSource (N r)) r := + spectralFreeNegativePhysical_parameter_hasDerivAt ell β lam (hq (-1)) r + (hL.trans_le hr.1) (hlog r hr) + have hP (r : ℝ) (hr : r ∈ Icc L R) := + spectralFreePositivePhysical_hasDerivAt ell β lam hhalf r (hL.trans_le hr.1) + have hN (r : ℝ) (hr : r ∈ Icc L R) := + spectralFreeNegativePhysical_hasDerivAt ell β lam hhalf r (hL.trans_le hr.1) + have hRR : R ∈ Icc L R := ⟨hR.le,le_rfl⟩ + obtain ⟨c,hc⟩ := spectralJetRobin_derivative_plane + (fun z => spectralFreePositivePhysical ell β z R) (fun z => spectralFreeNegativePhysical ell β z R) lam + (spectralFreePositivePhysical_analyticAt ell β lam (hq 1) R (hlog R hRR).le) + (spectralFreeNegativePhysical_analyticAt ell β lam (hq (-1)) R (hlog R hRR).le) + hdet a b (U₀ R) (U₁ R) (hU₀ R hRR) hRobin + obtain ⟨hbase,hzero⟩ := spectralFreeChain_core_coefficients β lam + ((ell : ℂ)*((ell : ℂ)+10)) L R hL hR a b U₀ U₁ P N DP DN + (spectralFreeCoreBoundaryCLM ell L) hU₀ + (by simpa only [spectralFreeCoreBoundaryCLM_apply] using hC₀) + (by simpa only [spectralFreeCoreBoundaryCLM_apply] using hC₁) + hcont hD hP hN hDP hDN c hc + simp only [spectralFreeCoreBoundaryCLM_apply] at hbase hzero + have hLL : L ∈ Icc L R := ⟨le_rfl,hR.le⟩ + have hCP := (spectralFreeCoreBoundary_hasDerivAt ell L + (fun z => spectralFreePositivePhysical ell β z L) (DP L) lam + (spectralFreePositivePhysical_analyticAt ell β lam (hq 1) L (hlog L hLL).le).differentiableAt.hasDerivAt).deriv + have hCN := (spectralFreeCoreBoundary_hasDerivAt ell L + (fun z => spectralFreeNegativePhysical ell β z L) (DN L) lam + (spectralFreeNegativePhysical_analyticAt ell β lam (hq (-1)) L (hlog L hLL).le).differentiableAt.hasDerivAt).deriv + have hno := radialFreePhysical_symmetry_no_chain hRou w hw ell lam hs a b c.1 c.2 hab hbase + apply hno + rw [hCP,hCN] + exact hzero + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreePhysicalSymmetryNoChain.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreePhysicalSymmetryNoChain.lean new file mode 100644 index 0000000000000000000000000000000000000000..ee4b58113991f08189a0e3a7cfb417358285ee03 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreePhysicalSymmetryNoChain.lean @@ -0,0 +1,50 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralFreeBasisParameter +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralCoreBoundaryLinear +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralFreeRadiusLog +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralKernelCoefficientLine +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralFreeBoundaryMultiplicity +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.FreeSymmetryNoChain + +namespace OAI + +/-! A simple determinant zero excludes chains of the physical H columns +at every symmetry root, assuming the rectangle form of Rouché's theorem. -/ + +namespace DefocusingNLS +open ProfileCertificate + +theorem radialFreePhysical_symmetry_no_chain (hR : RectangleRouche) (w : RadialShootingDisk) + (hw : diskProfile w=0) (ell : ℕ) (lam : ℂ) + (hs : (ell=0 ∧ (lam=0 ∨ lam=1)) ∨ (ell=1 ∧ lam=1/2)) : + let r := radialShootingR w + let b := radialShootingB w + let U := fun z => spectralFreeCoreBoundary ell r (spectralFreePositivePhysical ell b z r) + let V := fun z => spectralFreeCoreBoundary ell r (spectralFreeNegativePhysical ell b z r) + ∀ a b A B : ℂ, (a≠0 ∨ b≠0) → a • U lam+b • V lam=0 → + A • U lam+B • V lam+a • deriv U lam+b • deriv V lam≠0 := by + let r := radialShootingR w + let b := radialShootingB w + let U := fun z => spectralFreeCoreBoundary ell r (spectralFreePositivePhysical ell b z r) + let V := fun z => spectralFreeCoreBoundary ell r (spectralFreeNegativePhysical ell b z r) + have hgeom : 3 ≤ r := (radialShooting_geometry w).2.1 + have hr : 0 < r := by linarith + have hlog := spectralFreeRadius_log r hgeom + have hhalf : -(1/32 : ℝ) norm_num + have hq (h : ℝ) : -1 < (spectralQ ell h b lam).re := by + rw [spectralQ_re] + linarith [Nat.cast_nonneg (α := ℝ) ell] + have hU : AnalyticAt ℂ U lam := spectralFreeCoreBoundary_analyticAt ell r _ lam + (spectralFreePositivePhysical_analyticAt ell b lam (hq 1) r hlog.le) + have hV : AnalyticAt ℂ V lam := spectralFreeCoreBoundary_analyticAt ell r _ lam + (spectralFreeNegativePhysical_analyticAt ell b lam (hq (-1)) r hlog.le) + have hu : U lam ≠ 0 := spectralFreePositivePhysical_core_ne_zero ell b r lam hr hhalf.le + have horder : analyticOrderAt (fun z => matchingColumnDeterminant (U z) (V z)) lam=1 := by + change analyticOrderAt (spectralFreeCoreDeterminant ell b r) lam=1 + rw [spectralFreeCoreDeterminant_order ell b r lam hr hhalf] + simpa only [ite_eq_left hs] using radialFree_spectral_order hR w hw ell lam hhalf.le + exact matchingColumn_simple_zero_no_chain U V lam hU hV hu horder + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeRadialEquation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeRadialEquation.lean new file mode 100644 index 0000000000000000000000000000000000000000..10b3144cac473b86b18a22015335dcd60e1cf5a9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeRadialEquation.lean @@ -0,0 +1,80 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.FreeRadialProfile + +namespace OAI + +/-! The free exterior profile satisfies the radial stationary equation. -/ + +namespace DefocusingNLS + +noncomputable def freeRadialArgument (r : ℝ) : ℂ := -Complex.I*((r^2/4 : ℝ) : ℂ) +noncomputable def freeRadialTangent (r : ℝ) : ℂ := -Complex.I*((r/2 : ℝ) : ℂ) + +theorem hasDerivAt_freeRadialArgument (r : ℝ) : + HasDerivAt freeRadialArgument (freeRadialTangent r) r := by + convert! (((hasDerivAt_id r).pow 2).div_const 4).ofReal_comp.const_mul (-Complex.I) using 1 + try simp only [freeRadialTangent,id_eq] + push_cast + ring + +theorem hasDerivAt_freeRadialTangent (r : ℝ) : + HasDerivAt freeRadialTangent (-Complex.I/2) r := by + convert! ((hasDerivAt_id r).div_const 2).ofReal_comp.const_mul (-Complex.I) using 1 + try simp only [freeRadialTangent,id_eq] + push_cast + ring + +theorem freeRadialArgument_mem_slit {r : ℝ} (hr : 0 < r) : + freeRadialArgument r ∈ Complex.slitPlane := by + apply Complex.mem_slitPlane_iff.2 + right + simp only [freeRadialArgument,neg_mul,Complex.neg_im,Complex.mul_im, + Complex.I_re,Complex.I_im,Complex.ofReal_re,Complex.ofReal_im, + zero_mul,one_mul,zero_add] + nlinarith [sq_pos_of_pos hr] + +theorem freeRadial_raw_equation (b r : ℝ) (hr : 0 < r) : + let F := fun t => regularizedSlowSolution (-Complex.I*(b : ℂ)) 6 (freeRadialArgument t) + deriv (deriv F) r + ((11 : ℂ)/(r : ℂ)+Complex.I*(r : ℂ)/2)*deriv F r+ + (b : ℂ)*F r=0 := by + intro F + have hq : -1 < (-Complex.I*(b : ℂ)).re := by simp + have hA := analyticOnNhd_regularizedSlowSolution_slit (-Complex.I*(b : ℂ)) 6 hq + _ (freeRadialArgument_mem_slit hr) + obtain ⟨h₁,h₂⟩ := analytic_path_derivatives + (regularizedSlowSolution (-Complex.I*(b : ℂ)) 6) + freeRadialArgument freeRadialTangent r hA hasDerivAt_freeRadialArgument + (-Complex.I/2) (hasDerivAt_freeRadialTangent r) + have hx : 0 ≤ (freeRadialArgument r).re := by + simp only [freeRadialArgument,neg_mul,Complex.neg_re,Complex.mul_re, + Complex.I_re,Complex.I_im,Complex.ofReal_re,Complex.ofReal_im, + zero_mul,mul_zero,sub_self,neg_zero,le_refl] + have hx0 : freeRadialArgument r ≠ 0 := by + exact mul_ne_zero (neg_ne_zero.mpr Complex.I_ne_zero) + (Complex.ofReal_ne_zero.mpr (div_ne_zero (pow_ne_zero 2 hr.ne') (by norm_num))) + have hK := regularizedSlowSolution_kummer_equation_closed + (-Complex.I*(b : ℂ)) 6 (freeRadialArgument r) hq hx hx0 + change deriv (deriv (fun t => regularizedSlowSolution (-Complex.I*(b : ℂ)) 6 + (freeRadialArgument t))) r+_+_=0 + rw [h₁,h₂] + let H := regularizedSlowSolution (-Complex.I*(b : ℂ)) 6 (freeRadialArgument r) + let D := deriv (regularizedSlowSolution (-Complex.I*(b : ℂ)) 6) (freeRadialArgument r) + let DD := deriv (deriv (regularizedSlowSolution (-Complex.I*(b : ℂ)) 6)) (freeRadialArgument r) + change (-Complex.I/2)*D+(freeRadialTangent r)^2*DD+ + ((11 : ℂ)/(r : ℂ)+Complex.I*(r : ℂ)/2)*(freeRadialTangent r*D)+(b : ℂ)*H=0 + change freeRadialArgument r*DD+((6 : ℂ)-freeRadialArgument r)*D- + (-Complex.I*(b : ℂ))*H=0 at hK + have hr0 : (r : ℂ) ≠ 0 := by exact_mod_cast hr.ne' + calc + _ = -Complex.I*(freeRadialArgument r*DD+((6 : ℂ)-freeRadialArgument r)*D- + (-Complex.I*(b : ℂ))*H) := by + dsimp only [freeRadialArgument,freeRadialTangent] + push_cast + field_simp [hr0] + ring_nf + simp only [Complex.I_sq] + ring + _ = 0 := by rw [hK,mul_zero] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeRadialProfile.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeRadialProfile.lean new file mode 100644 index 0000000000000000000000000000000000000000..7f3e203f2dd47c88b9ca70b4727f493b3eb1190b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeRadialProfile.lean @@ -0,0 +1,143 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.FreeExterior +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HighAngularPathEquation + +namespace OAI + +/-! The actual flat-core/free-exterior limiting profile and its matching derivative. -/ + +open Set Filter Topology +namespace DefocusingNLS + +noncomputable def freeProfileRadius (Z : ℝ) : ℝ := 2*Real.sqrt Z + +noncomputable def freeRadialExterior (b Z r : ℝ) : ℂ := + regularizedSlowSolution (-Complex.I*(b : ℂ)) 6 (-Complex.I*((r^2/4 : ℝ) : ℂ)) / + regularizedSlowSolution (-Complex.I*(b : ℂ)) 6 (-Complex.I*(Z : ℂ)) + +noncomputable def freeRadialProfile (b Z r : ℝ) : ℂ := + if r ≤ freeProfileRadius Z then 1 else freeRadialExterior b Z r + +theorem freeProfileRadius_pos {Z : ℝ} (hZ : 0 < Z) : 0 < freeProfileRadius Z := by + exact mul_pos (by norm_num) (Real.sqrt_pos.2 hZ) + +theorem freeProfileRadius_sq {Z : ℝ} (hZ : 0 ≤ Z) : + (freeProfileRadius Z)^2/4=Z := by + dsimp [freeProfileRadius] + nlinarith [Real.sq_sqrt hZ] + +theorem freeRadialExterior_at_radius (b Z : ℝ) (hZ : 0 ≤ Z) + (hH : regularizedSlowSolution (-Complex.I*(b : ℂ)) 6 (-Complex.I*(Z : ℂ)) ≠ 0) : + freeRadialExterior b Z (freeProfileRadius Z)=1 := by + simp only [freeRadialExterior,freeProfileRadius_sq hZ,div_self hH] + +theorem hasDerivAt_freeRadialExterior (b Z r : ℝ) (hr : 0 < r) : + HasDerivAt (freeRadialExterior b Z) + ((-Complex.I*((r/2 : ℝ) : ℂ))* + deriv (regularizedSlowSolution (-Complex.I*(b : ℂ)) 6) + (-Complex.I*((r^2/4 : ℝ) : ℂ)) / + regularizedSlowSolution (-Complex.I*(b : ℂ)) 6 (-Complex.I*(Z : ℂ))) r := by + have hq : -1 < (-Complex.I*(b : ℂ)).re := by simp + have hx : -Complex.I*((r^2/4 : ℝ) : ℂ) ∈ Complex.slitPlane := by + apply Complex.mem_slitPlane_iff.2 + right + simp only [neg_mul,Complex.neg_im,Complex.mul_im,Complex.I_re,Complex.I_im, + Complex.ofReal_re,Complex.ofReal_im,zero_mul,one_mul,zero_add] + nlinarith [sq_pos_of_pos hr] + have hg : HasDerivAt (fun t : ℝ => -Complex.I*((t^2/4 : ℝ) : ℂ)) + (-Complex.I*((r/2 : ℝ) : ℂ)) r := by + convert! (((hasDerivAt_id r).pow 2).div_const 4).ofReal_comp.const_mul (-Complex.I) using 1 + simp only [id_eq] + push_cast + ring + have h := (analyticOnNhd_regularizedSlowSolution_slit (-Complex.I*(b : ℂ)) 6 hq _ hx).differentiableAt.hasDerivAt.scomp r hg + change HasDerivAt (fun t : ℝ => regularizedSlowSolution (-Complex.I*(b : ℂ)) 6 + (-Complex.I*((t^2/4 : ℝ) : ℂ)) / + regularizedSlowSolution (-Complex.I*(b : ℂ)) 6 (-Complex.I*(Z : ℂ))) _ r + convert! h.div_const (regularizedSlowSolution (-Complex.I*(b : ℂ)) 6 (-Complex.I*(Z : ℂ))) using 1 + +theorem hasDerivAt_freeRadialExterior_at_radius (b Z : ℝ) (hZ : 0 < Z) + (hD : deriv (regularizedSlowSolution (-Complex.I*(b : ℂ)) 6) (-Complex.I*(Z : ℂ))=0) : + HasDerivAt (freeRadialExterior b Z) 0 (freeProfileRadius Z) := by + simpa only [freeProfileRadius_sq hZ.le,hD,mul_zero,zero_div] using + hasDerivAt_freeRadialExterior b Z _ (freeProfileRadius_pos hZ) + +theorem hasDerivAt_freeRadialProfile_at_radius (b Z : ℝ) (hZ : 0 < Z) + (hH : regularizedSlowSolution (-Complex.I*(b : ℂ)) 6 (-Complex.I*(Z : ℂ)) ≠ 0) + (hD : deriv (regularizedSlowSolution (-Complex.I*(b : ℂ)) 6) (-Complex.I*(Z : ℂ))=0) : + HasDerivAt (freeRadialProfile b Z) 0 (freeProfileRadius Z) := by + have hv := freeRadialExterior_at_radius b Z hZ.le hH + have hleft : HasDerivWithinAt (freeRadialProfile b Z) 0 (Iic (freeProfileRadius Z)) + (freeProfileRadius Z) := by + apply (hasDerivAt_const (freeProfileRadius Z) (1 : ℂ)).hasDerivWithinAt.congr + · intro r hr + exact ite_eq_left hr + · exact ite_eq_left le_rfl + have hright : HasDerivWithinAt (freeRadialProfile b Z) 0 (Ici (freeProfileRadius Z)) + (freeProfileRadius Z) := by + apply (hasDerivAt_freeRadialExterior_at_radius b Z hZ hD).hasDerivWithinAt.congr + · intro r hr + change freeProfileRadius Z ≤ r at hr + rcases hr.eq_or_lt with he | he + · subst r + simpa only [freeRadialProfile,ite_true,le_refl] using hv.symm + · exact ite_eq_right (not_le.mpr he) + · simpa only [freeRadialProfile,ite_true,le_refl] using hv.symm + have h := hleft.union hright + rw [Iic_union_Ici] at h + exact h.hasDerivAt (by simp) + +theorem hasDerivAt_freeRadialProfile_inside (b Z r : ℝ) + (hr : r < freeProfileRadius Z) : HasDerivAt (freeRadialProfile b Z) 0 r := by + apply (hasDerivAt_const r (1 : ℂ)).congr_of_eventuallyEq + filter_upwards [isOpen_Iio.mem_nhds hr] with t ht + exact ite_eq_left ht.le + +theorem hasDerivAt_freeRadialProfile_outside (b Z r : ℝ) (hZ : 0 < Z) + (hr : freeProfileRadius Z < r) : + HasDerivAt (freeRadialProfile b Z) + ((-Complex.I*((r/2 : ℝ) : ℂ))* + deriv (regularizedSlowSolution (-Complex.I*(b : ℂ)) 6) + (-Complex.I*((r^2/4 : ℝ) : ℂ)) / + regularizedSlowSolution (-Complex.I*(b : ℂ)) 6 (-Complex.I*(Z : ℂ))) r := by + apply (hasDerivAt_freeRadialExterior b Z r ((freeProfileRadius_pos hZ).trans hr)).congr_of_eventuallyEq + filter_upwards [isOpen_Ioi.mem_nhds hr] with t ht + exact ite_eq_right (not_le.mpr ht) + +theorem differentiable_freeRadialProfile (b Z : ℝ) (hZ : 0 < Z) + (hH : regularizedSlowSolution (-Complex.I*(b : ℂ)) 6 (-Complex.I*(Z : ℂ)) ≠ 0) + (hD : deriv (regularizedSlowSolution (-Complex.I*(b : ℂ)) 6) (-Complex.I*(Z : ℂ))=0) : + Differentiable ℝ (freeRadialProfile b Z) := by + intro r + rcases lt_trichotomy r (freeProfileRadius Z) with hr | rfl | hr + · exact (hasDerivAt_freeRadialProfile_inside b Z r hr).differentiableAt + · exact (hasDerivAt_freeRadialProfile_at_radius b Z hZ hH hD).differentiableAt + · exact (hasDerivAt_freeRadialProfile_outside b Z r hZ hr).differentiableAt + +theorem freeRadialProfile_nonzero_on_disk + (w : Metric.closedBall (0 : ℂ) (ProfileCertificate.radius : ℝ)) + (r : ℝ) (hr : 0 ≤ r) : + freeRadialProfile ((ProfileCertificate.centerB : ℝ)+w.val.re) + ((ProfileCertificate.centerZ : ℝ)+w.val.im) r ≠ 0 := by + let b : ℝ := (ProfileCertificate.centerB : ℝ)+w.val.re + let Z : ℝ := (ProfileCertificate.centerZ : ℝ)+w.val.im + have hzcoord := (ProfileCertificate.disk_coordinates w).2 + have hZ : 0 < Z := by + have h := (abs_le.mp hzcoord).1 + dsimp [Z] + norm_num [ProfileCertificate.centerZ,ProfileCertificate.radius] at h ⊢ + linarith + change freeRadialProfile b Z r ≠ 0 + unfold freeRadialProfile + split_ifs with hi + · exact one_ne_zero + · apply div_ne_zero + · apply (ProfileCertificate.disk_free_exterior w (r^2/4) ?_).1 + have hR := freeProfileRadius_pos hZ + have hsq := freeProfileRadius_sq hZ.le + have hri := not_le.mp hi + nlinarith + · exact (ProfileCertificate.disk_free_exterior w Z le_rfl).1 + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeRadialRegularity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeRadialRegularity.lean new file mode 100644 index 0000000000000000000000000000000000000000..eb06e135a58938c196cbfeb41c7569779fead8a7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeRadialRegularity.lean @@ -0,0 +1,65 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.FreeRadialProfile +import Mathlib.Analysis.Calculus.ContDiff.Deriv +import Mathlib.Topology.Order.OrderClosed + +namespace OAI + +/-! The limiting profile has a continuously matching first radial derivative. -/ + +open Set +namespace DefocusingNLS + +noncomputable def freeRadialDerivative (b Z r : ℝ) : ℂ := + (-Complex.I*((r/2 : ℝ) : ℂ))* + deriv (regularizedSlowSolution (-Complex.I*(b : ℂ)) 6) + (-Complex.I*((r^2/4 : ℝ) : ℂ)) / + regularizedSlowSolution (-Complex.I*(b : ℂ)) 6 (-Complex.I*(Z : ℂ)) + +theorem continuousOn_freeRadialDerivative (b Z : ℝ) : + ContinuousOn (freeRadialDerivative b Z) (Ioi 0) := by + intro r hr + have hq : -1 < (-Complex.I*(b : ℂ)).re := by simp + have hx : -Complex.I*((r^2/4 : ℝ) : ℂ) ∈ Complex.slitPlane := by + apply Complex.mem_slitPlane_iff.2 + right + simp only [neg_mul,Complex.neg_im,Complex.mul_im,Complex.I_re,Complex.I_im, + Complex.ofReal_re,Complex.ofReal_im,zero_mul,one_mul,zero_add] + have hr' : 0 < r := hr + nlinarith [sq_pos_of_pos hr'] + have hc := (analyticOnNhd_regularizedSlowSolution_slit (-Complex.I*(b : ℂ)) 6 hq).deriv _ hx + have ha : Continuous (fun t : ℝ => -Complex.I*((t^2/4 : ℝ) : ℂ)) := by fun_prop + have ht : Continuous (fun t : ℝ => -Complex.I*((t/2 : ℝ) : ℂ)) := by fun_prop + have hh : ContinuousAt (fun t : ℝ => deriv (regularizedSlowSolution (-Complex.I*(b : ℂ)) 6) + (-Complex.I*((t^2/4 : ℝ) : ℂ))) r := + hc.continuousAt.comp (f := fun t : ℝ => -Complex.I*((t^2/4 : ℝ) : ℂ)) ha.continuousAt + exact ((ht.continuousAt.mul hh).div_const _).continuousWithinAt + +theorem contDiff_freeRadialProfile (b Z : ℝ) (hZ : 0 < Z) + (hH : regularizedSlowSolution (-Complex.I*(b : ℂ)) 6 (-Complex.I*(Z : ℂ)) ≠ 0) + (hD : deriv (regularizedSlowSolution (-Complex.I*(b : ℂ)) 6) (-Complex.I*(Z : ℂ))=0) : + ContDiff ℝ 1 (freeRadialProfile b Z) := by + apply contDiff_one_iff_deriv.2 + refine ⟨differentiable_freeRadialProfile b Z hZ hH hD,?_⟩ + have heq : deriv (freeRadialProfile b Z) = + fun r => if r ≤ freeProfileRadius Z then 0 else freeRadialDerivative b Z r := by + funext r + by_cases hr : r ≤ freeProfileRadius Z + · rw [ite_eq_left hr] + rcases hr.eq_or_lt with rfl | hr + · exact (hasDerivAt_freeRadialProfile_at_radius b Z hZ hH hD).deriv + · exact (hasDerivAt_freeRadialProfile_inside b Z r hr).deriv + · rw [ite_eq_right hr] + exact (hasDerivAt_freeRadialProfile_outside b Z r hZ (not_le.mp hr)).deriv + rw [heq] + apply continuous_if_le continuous_id continuous_const continuousOn_const + · apply (continuousOn_freeRadialDerivative b Z).mono + intro r hr + exact (freeProfileRadius_pos hZ).trans_le hr + · intro r hr + change r = freeProfileRadius Z at hr + subst r + simp only [freeRadialDerivative,freeProfileRadius_sq hZ.le,hD,mul_zero,zero_div] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeRootClassification.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeRootClassification.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd5ae661ca7aa2159bf5952db0921c9940c883a4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeRootClassification.lean @@ -0,0 +1,91 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.FreeSymmetryZeros +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.FreeOutgoingNonvanishing + +namespace OAI + +/-! The counted free zeros are exactly the three symmetry values. -/ + +open Set +namespace DefocusingNLS +open ProfileCertificate + +theorem free_spectral_zero_card_bound (hR : RectangleRouche) (ell : ℕ) (b Z : ℝ) + (hD : (b,Z)∈freeMatchingDisk) + (S : Finset {z : ℂ | -(1/32 : ℝ)≤z.re}) + (hz : ∀ z ∈ S, spectralSlowDeterminant ell b Z z.val=0) : + (S.card : ℕ∞)≤(freeOutgoingCount ell : ℕ∞) := by + classical + let f := fun z : {z : ℂ | -(1/32 : ℝ)≤z.re} => + analyticOrderAt (spectralSlowDeterminant ell b Z) z.val + have hs : Summable f := ⟨_,hasSum_of_isLUB _ (isLUB_sSup (Set.range + (fun s : Finset {z : ℂ | -(1/32 : ℝ)≤z.re} => ∑ z ∈ s, f z)))⟩ + have hZ : Z≠0 := by + have hh := (abs_le.mp (freeMatchingDisk_subset_certificate_box hD).2).1 + intro he + norm_num [he] at hh + calc + (S.card : ℕ∞) = ∑ _z ∈ S, (1 : ℕ∞) := by simp + _ ≤ ∑ z ∈ S, f z := by + apply Finset.sum_le_sum + intro z hzs + apply Order.one_le_iff_ne_zero.mpr + exact (analyticAt_spectralSlowDeterminant ell b Z z hZ z.property).analyticOrderAt_ne_zero.mpr + (hz z hzs) + _ ≤ ∑' z, f z := hs.sum_le_tsum S (fun _ _ => zero_le) + _ = (freeOutgoingCount ell : ℕ∞) := free_outgoing_count hR ell b Z hD + +theorem radialFree_phase_scaling_zeros (hR : RectangleRouche) (w : RadialShootingDisk) + (hw : diskProfile w=0) (lam : ℂ) (hhalf : -(1/32 : ℝ)≤lam.re) : + spectralSlowDeterminant 0 (radialShootingB w) ((radialShootingR w)^2/4) lam=0 ↔ + lam=0 ∨ lam=1 := by + classical + obtain ⟨h0,_ht,h1⟩ := radialFree_spectral_symmetry_zeros w hw + constructor + · intro hz + by_contra h + push Not at h + let a : {z : ℂ | -(1/32 : ℝ)≤z.re} := ⟨0,by norm_num⟩ + let b : {z : ℂ | -(1/32 : ℝ)≤z.re} := ⟨1,by norm_num⟩ + let c : {z : ℂ | -(1/32 : ℝ)≤z.re} := ⟨lam,hhalf⟩ + have hc := free_spectral_zero_card_bound hR 0 _ _ (radialShooting_freeMatchingDisk w) + {a,b,c} (by + intro z hzS + simp only [Finset.mem_insert,Finset.mem_singleton] at hzS + rcases hzS with rfl | rfl | rfl + · exact h0 + · exact h1 + · exact hz) + have hab : a≠b := by intro he; have := congrArg Subtype.val he; norm_num [a,b] at this + have hac : a≠c := by intro he; exact h.1 (congrArg Subtype.val he).symm + have hbc : b≠c := by intro he; exact h.2 (congrArg Subtype.val he).symm + norm_num [Finset.card_insert_of_notMem,hab,hac,hbc,freeOutgoingCount] at hc + · rintro (rfl | rfl) + · exact h0 + · exact h1 + +theorem radialFree_translation_zero (hR : RectangleRouche) (w : RadialShootingDisk) + (hw : diskProfile w=0) (lam : ℂ) (hhalf : -(1/32 : ℝ)≤lam.re) : + spectralSlowDeterminant 1 (radialShootingB w) ((radialShootingR w)^2/4) lam=0 ↔ + lam=1/2 := by + classical + have ht := (radialFree_spectral_symmetry_zeros w hw).2.1 + constructor + · intro hz + by_contra h + let a : {z : ℂ | -(1/32 : ℝ)≤z.re} := ⟨1/2,by norm_num⟩ + let b : {z : ℂ | -(1/32 : ℝ)≤z.re} := ⟨lam,hhalf⟩ + have hc := free_spectral_zero_card_bound hR 1 _ _ (radialShooting_freeMatchingDisk w) + {a,b} (by + intro z hzS + simp only [Finset.mem_insert,Finset.mem_singleton] at hzS + rcases hzS with rfl | rfl + · exact ht + · exact hz) + have hab : a≠b := by intro he; exact h (congrArg Subtype.val he).symm + norm_num [Finset.card_insert_of_notMem,hab,freeOutgoingCount] at hc + · rintro rfl + exact ht + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeSimpleZeros.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeSimpleZeros.lean new file mode 100644 index 0000000000000000000000000000000000000000..22ffa7d59d6769adf47038a1f3c58e3b0fbeec76 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeSimpleZeros.lean @@ -0,0 +1,63 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.FreeRootClassification + +namespace OAI + +/-! The three free symmetry zeros have analytic multiplicity one. -/ + +open Set +namespace DefocusingNLS +open ProfileCertificate + +private theorem free_order_sum_le (hR : RectangleRouche) (ell : ℕ) (b Z : ℝ) + (hD : (b,Z)∈freeMatchingDisk) (S : Finset {z : ℂ | -(1/32 : ℝ)≤z.re}) : + (∑ z ∈ S, analyticOrderAt (spectralSlowDeterminant ell b Z) z.val)≤ + (freeOutgoingCount ell : ℕ∞) := by + let f := fun z : {z : ℂ | -(1/32 : ℝ)≤z.re} => + analyticOrderAt (spectralSlowDeterminant ell b Z) z.val + have hs : Summable f := ⟨_,hasSum_of_isLUB _ (isLUB_sSup (Set.range + (fun s : Finset {z : ℂ | -(1/32 : ℝ)≤z.re} => ∑ z ∈ s, f z)))⟩ + exact (hs.sum_le_tsum S (fun _ _ => zero_le)).trans_eq (free_outgoing_count hR ell b Z hD) + +theorem radialFree_symmetry_zeros_simple (hR : RectangleRouche) (w : RadialShootingDisk) + (hw : diskProfile w=0) : + analyticOrderAt (spectralSlowDeterminant 0 (radialShootingB w) ((radialShootingR w)^2/4)) 0=1 ∧ + analyticOrderAt (spectralSlowDeterminant 1 (radialShootingB w) ((radialShootingR w)^2/4)) (1/2)=1 ∧ + analyticOrderAt (spectralSlowDeterminant 0 (radialShootingB w) ((radialShootingR w)^2/4)) 1=1 := by + classical + let b := radialShootingB w + let Z := (radialShootingR w)^2/4 + have hD : (b,Z)∈freeMatchingDisk := radialShooting_freeMatchingDisk w + have hZ : Z≠0 := by + have hh := (abs_le.mp (freeMatchingDisk_subset_certificate_box hD).2).1 + intro he + norm_num [he] at hh + obtain ⟨h0,ht,h1⟩ := radialFree_spectral_symmetry_zeros w hw + have ho0 : 1≤analyticOrderAt (spectralSlowDeterminant 0 b Z) 0 := + Order.one_le_iff_ne_zero.mpr + ((analyticAt_spectralSlowDeterminant 0 b Z 0 hZ (by norm_num)).analyticOrderAt_ne_zero.mpr h0) + have hot : 1≤analyticOrderAt (spectralSlowDeterminant 1 b Z) (1/2) := + Order.one_le_iff_ne_zero.mpr + ((analyticAt_spectralSlowDeterminant 1 b Z (1/2) hZ (by norm_num)).analyticOrderAt_ne_zero.mpr ht) + have ho1 : 1≤analyticOrderAt (spectralSlowDeterminant 0 b Z) 1 := + Order.one_le_iff_ne_zero.mpr + ((analyticAt_spectralSlowDeterminant 0 b Z 1 hZ (by norm_num)).analyticOrderAt_ne_zero.mpr h1) + let a : {z : ℂ | -(1/32 : ℝ)≤z.re} := ⟨0,by norm_num⟩ + let c : {z : ℂ | -(1/32 : ℝ)≤z.re} := ⟨1,by norm_num⟩ + let t : {z : ℂ | -(1/32 : ℝ)≤z.re} := ⟨1/2,by norm_num⟩ + have hsum : analyticOrderAt (spectralSlowDeterminant 0 b Z) 0+ + analyticOrderAt (spectralSlowDeterminant 0 b Z) 1≤(1 : ℕ∞)+1 := by + simpa [a,c,freeOutgoingCount,show (1 : ℕ∞)+1=2 by norm_num] using + free_order_sum_le hR 0 b Z hD {a,c} + have htup : analyticOrderAt (spectralSlowDeterminant 1 b Z) (1/2)≤1 := by + simpa [t,freeOutgoingCount] using free_order_sum_le hR 1 b Z hD {t} + have h0up : analyticOrderAt (spectralSlowDeterminant 0 b Z) 0≤1 := by + apply (ENat.add_le_add_iff_right (by simp : (1 : ℕ∞)≠⊤)).mp + exact (add_le_add le_rfl ho1).trans hsum + have h1up : analyticOrderAt (spectralSlowDeterminant 0 b Z) 1≤1 := by + apply (ENat.add_le_add_iff_left (by simp : (1 : ℕ∞)≠⊤)).mp + exact (add_le_add ho0 le_rfl).trans hsum + exact ⟨le_antisymm h0up ho0,le_antisymm htup hot,le_antisymm h1up ho1⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeSymmetryNoChain.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeSymmetryNoChain.lean new file mode 100644 index 0000000000000000000000000000000000000000..7598b25ef1633fc0f527c24df0520aaa87d34711 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeSymmetryNoChain.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Profile.RadialFreeSpectralClassification +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.MatchingSimpleZero + +namespace OAI + +/-! The actual free H columns at each symmetry root admit no differentiated +matching chain. This applies the simple-zero calculation without introducing +an additional spectral assumption. -/ + +namespace DefocusingNLS +open ProfileCertificate + +theorem radialFree_symmetry_no_chain (hR : RectangleRouche) (w : RadialShootingDisk) + (hw : diskProfile w=0) (ell : ℕ) (lam : ℂ) + (hs : (ell=0 ∧ (lam=0 ∨ lam=1)) ∨ (ell=1 ∧ lam=1/2)) : + let U := fun z => slowBoundaryColumn + (spectralQ ell 1 (radialShootingB w) z) (ell+6) + (Complex.I*((radialShootingR w)^2/4 : ℝ)) + let V := fun z => slowBoundaryColumn + (spectralQ ell (-1) (radialShootingB w) z) (ell+6) + (-Complex.I*((radialShootingR w)^2/4 : ℝ)) + ∀ a b A B : ℂ, (a≠0 ∨ b≠0) → a • U lam+b • V lam=0 → + A • U lam+B • V lam+a • deriv U lam+b • deriv V lam≠0 := by + let b := radialShootingB w + let Z := (radialShootingR w)^2/4 + let U := fun z => slowBoundaryColumn (spectralQ ell 1 b z) (ell+6) (Complex.I*Z) + let V := fun z => slowBoundaryColumn (spectralQ ell (-1) b z) (ell+6) (-Complex.I*Z) + have hD := radialShooting_freeMatchingDisk w + have hZ : Z≠0 := by + have hh := (abs_le.mp (freeMatchingDisk_subset_certificate_box hD).2).1 + intro he + norm_num [show (radialShootingR w)^2/4=Z from rfl,he] at hh + have hhalf : -(1/32 : ℝ)≤lam.re := by + rcases hs with ⟨_,rfl | rfl⟩ | ⟨_,rfl⟩ <;> norm_num + have hU : AnalyticAt ℂ U lam := by + simpa only [U,Complex.ofReal_one,one_mul] using + analyticAt_spectralSlowColumn ell 1 b Z lam (by norm_num) hZ hhalf + have hV : AnalyticAt ℂ V lam := by + simpa only [V,Complex.ofReal_neg,Complex.ofReal_one,neg_one_mul] using + analyticAt_spectralSlowColumn ell (-1) b Z lam (by norm_num) hZ hhalf + have hu : U lam≠0 := slowBoundaryColumn_ne_zero _ _ _ + (by rw [spectralQ_re]; linarith [Nat.cast_nonneg (α := ℝ) ell]) + (by simp) (by simpa using hZ) + have horder : analyticOrderAt (fun z => matchingColumnDeterminant (U z) (V z)) lam=1 := by + change analyticOrderAt (spectralSlowDeterminant ell b Z) lam=1 + simpa only [ite_eq_left hs] using + radialFree_spectral_order hR w hw ell lam hhalf + exact matchingColumn_simple_zero_no_chain U V lam hU hV hu horder + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeSymmetryZeros.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeSymmetryZeros.lean new file mode 100644 index 0000000000000000000000000000000000000000..64292254f068f3e276636c8b03b6e601bd7cb18a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/FreeSymmetryZeros.lean @@ -0,0 +1,126 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Profile.SlowConjugation +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralEndpointMultiplicity +import OAI.MathematicalPhysics.DefocusingNLS.Profile.RadialFreeSpectralDisk +import OAI.MathematicalPhysics.DefocusingNLS.Profile.ProfileExistence + +namespace OAI + +/-! The free matching condition forces the phase, translation and scaling +zeros at 0, 1/2 and 1. These identities use the actual H columns. -/ + +namespace DefocusingNLS +open ProfileCertificate + +private theorem stationary_column_shifts (q s : ℂ) (hq : q.re=0) (hq0 : q≠0) + (hs : s.re=0) (hs0 : s≠0) (hd : slowBoundaryColumn q 6 s 1=0) : + slowBoundaryColumn (q+1) 7 s 0=0 ∧ + slowBoundaryColumn (q+1) 6 s 1 = -slowBoundaryColumn (q+1) 6 s 0 := by + have hH : regularizedSlowSolution (q+1) 7 (-s)=0 := by + change q*regularizedSlowSolution (q+1) 7 (-s)=0 at hd + exact (mul_eq_zero.mp hd).resolve_left hq0 + refine ⟨hH,?_⟩ + have ha := regularizedSlowSolution_adjacent (q+1) 6 (-s) + (by simp [hq]) (by simp [hs]) (neg_ne_zero.mpr hs0) + rw [hH] at ha + change (q+1)*regularizedSlowSolution (q+1+1) 7 (-s) = + -regularizedSlowSolution (q+1) 6 (-s) + linear_combination -ha + +private theorem stationary_column_pair_zeros (q s : ℂ) (hq : q.re=0) (hq0 : q≠0) + (hs : s.re=0) (hs0 : s≠0) (hd : slowBoundaryColumn q 6 s 1=0) : + matchingColumnDeterminant (slowBoundaryColumn q 6 s) + (slowBoundaryColumn (star q) 6 (star s))=0 ∧ + matchingColumnDeterminant (slowBoundaryColumn (q+1) 7 s) + (slowBoundaryColumn (star q+1) 7 (star s))=0 ∧ + matchingColumnDeterminant (slowBoundaryColumn (q+1) 6 s) + (slowBoundaryColumn (star q+1) 6 (star s))=0 := by + have hsim : s.im≠0 := by + intro hi + exact hs0 (Complex.ext hs hi) + have hslit : -s∈Complex.slitPlane := + Complex.mem_slitPlane_iff.mpr (Or.inr (by simpa using hsim)) + have hstar := congrFun (slowBoundaryColumn_star q 6 s hslit) 1 + change star (slowBoundaryColumn q 6 s 1) = slowBoundaryColumn (star q) 6 (star s) 1 at hstar + rw [hd,star_zero] at hstar + have hqm : (star q).re=0 := by simpa only [Complex.star_def,Complex.conj_re] using hq + have hsm : (star s).re=0 := by simpa only [Complex.star_def,Complex.conj_re] using hs + have hp := stationary_column_shifts q s hq hq0 hs hs0 hd + have hm := stationary_column_shifts (star q) (star s) hqm + (star_ne_zero.mpr hq0) hsm (star_ne_zero.mpr hs0) hstar.symm + refine ⟨?_,?_,?_⟩ + · simp only [matchingColumnDeterminant,hd,hstar.symm,mul_zero,zero_mul,sub_self] + · simp only [matchingColumnDeterminant,hp.1,hm.1,zero_mul,mul_zero,sub_self] + · rw [matchingColumnDeterminant,hp.2,hm.2] + ring + +theorem free_spectral_symmetry_zeros (b Z : ℝ) (hb : b≠0) (hZ : Z≠0) + (hd : deriv (regularizedSlowSolution (-Complex.I*(b : ℂ)) 6) + (-Complex.I*(Z : ℂ))=0) : + spectralSlowDeterminant 0 b Z 0=0 ∧ + spectralSlowDeterminant 1 b Z (1/2)=0 ∧ + spectralSlowDeterminant 0 b Z 1=0 := by + let q := -Complex.I*(b : ℂ) + let s := Complex.I*(Z : ℂ) + have hq : q.re=0 := by simp [q] + have hs : s.re=0 := by simp [s] + have hq0 : q≠0 := mul_ne_zero (neg_ne_zero.mpr Complex.I_ne_zero) (by exact_mod_cast hb) + have hs0 : s≠0 := mul_ne_zero Complex.I_ne_zero (by exact_mod_cast hZ) + have hsim : s.im≠0 := by simpa [s] using hZ + have hcol : slowBoundaryColumn q 6 s 1=0 := by + rw [slowBoundaryColumn_eq_jet q 6 s (by simp [hq]) hs hsim] + simpa only [Matrix.cons_val_one,Matrix.cons_val_zero,neg_mul,neg_zero,q,s] using congrArg Neg.neg hd + have hz := stationary_column_pair_zeros q s hq hq0 hs hs0 hcol + have hqm : star q=Complex.I*(b : ℂ) := by + simp only [q,star_mul,star_neg,Complex.star_def,Complex.conj_I,Complex.conj_ofReal,neg_neg] + ring + have hsm : star s= -Complex.I*(Z : ℂ) := by + simp only [s,star_mul,Complex.star_def,Complex.conj_I,Complex.conj_ofReal] + ring + have hq0p : spectralQ 0 1 b 0=q := by simp [spectralQ,q] + have hq0m : spectralQ 0 (-1) b 0=star q := by rw [hqm]; simp [spectralQ] + have hqtp : spectralQ 1 1 b (1/2)=q+1 := by simp [spectralQ,q]; ring + have hqtm : spectralQ 1 (-1) b (1/2)=star q+1 := by rw [hqm]; simp [spectralQ]; ring + have hqsp : spectralQ 0 1 b 1=q+1 := by simp [spectralQ,q]; ring + have hqsm : spectralQ 0 (-1) b 1=star q+1 := by rw [hqm]; simp [spectralQ]; ring + simpa only [spectralSlowDeterminant,hq0p,hq0m,hqtp,hqtm,hqsp,hqsm, + hsm,s,Nat.reduceAdd,neg_mul] using hz + +theorem radialShooting_stationary_of_matching (w : RadialShootingDisk) + (hw : diskProfile w=0) : + deriv (regularizedSlowSolution (-Complex.I*(radialShootingB w : ℂ)) 6) + (-Complex.I*(radialShootingZ w : ℂ))=0 := by + obtain ⟨hb,hz⟩ := disk_coordinates w + have hZ : 0 highArcPoint Z h t/(highArcTangent h t)^2) + (highArcCorrection Z) (highArcWave q M Z h) + +theorem highAngular_radialPotential_re (u v h M : ℝ) (hh : h=1 ∨ h= -1) (hv : v ≠ 0) : + (((u : ℂ)-Complex.I*(h*v : ℝ))/4+ + (M : ℂ)^2/(4*((u : ℂ)-Complex.I*(h*v : ℝ)))).re = + u/4+M^2*u/(4*(u^2+v^2)) := by + have hd : u^2+v^2 ≠ 0 := ne_of_gt (add_pos_of_nonneg_of_pos (sq_nonneg u) (sq_pos_of_ne_zero hv)) + rcases hh with rfl | rfl <;> + simp only [Complex.add_re,Complex.div_re,Complex.mul_re,Complex.mul_im, + Complex.sub_re,Complex.sub_im,pow_two,Complex.ofReal_re,Complex.ofReal_im, + Complex.I_re,Complex.I_im,Complex.normSq_apply] <;> norm_num <;> field_simp <;> ring + +theorem highArcWave_deriv (q : ℂ) (M : ℕ) (Z h t : ℝ) + (hq : -1 < q.re) (hh : h=1 ∨ h= -1) (hZ : 2704/1000 ≤ Z) + (ht : 0 ≤ 2*t) (ht' : 2*t ≤ highArcAngle) : + deriv (highArcWave q M Z h) t = + highArcTangent h t*deriv (gaugedSlowSolution q M) (highArcPoint Z h t) := by + have hx : 0 ≤ (highArcPoint Z h t).re := by + rw [highArcPoint_re] + exact (highArc_geometry Z (2*t) hZ ht ht').1 + have hd := (hasDerivAt_gaugedSlowSolution q M (highArcPoint Z h t) hq hx + (highArcPoint_ne_zero Z h t hh hZ ht ht')).differentiableAt.hasDerivAt + change deriv (fun s : ℝ => gaugedSlowSolution q M (highArcPoint Z h s)) t = + highArcTangent h t*deriv (gaugedSlowSolution q M) (highArcPoint Z h t) + simpa only [Function.comp_def,smul_eq_mul] using + (hd.scomp t (hasDerivAt_highArcPoint Z h t)).deriv + +theorem hasDerivAt_highArcActualFlux (q : ℂ) (M : ℕ) (Z h t : ℝ) + (hq : -1 < q.re) (hh : h=1 ∨ h= -1) (hZ : 2704/1000 ≤ Z) + (ht : 0 ≤ 2*t) (ht' : 2*t ≤ highArcAngle) : + HasDerivAt (highArcActualFlux q M Z h) + (highArcL Z (2*t)*Complex.normSq + (deriv (highArcWave q M Z h) t+ + ((3/10 : ℂ)-Complex.I*(h : ℂ))*highArcWave q M Z h t)+ + highArcPotential (3-(((M : ℂ)+1)/2-q).re) (M : ℝ) Z (2*t)* + Complex.normSq (highArcWave q M Z h t)) t := by + let γ := highArcPoint Z h + let g := highArcTangent h + let U := highArcWave q M Z h + let A := fun s => γ s/(g s)^2 + let C : ℂ := Complex.I*(h*2 : ℝ) + let E : ℂ := ((M : ℂ)+1)/2-q + let V : ℂ := γ t/4+(M : ℂ)^2/(4*γ t) + have hgeo := highArc_geometry Z (2*t) hZ ht ht' + have hx : 0 ≤ (γ t).re := by rw [highArcPoint_re]; exact hgeo.1 + have hx0 : γ t ≠ 0 := highArcPoint_ne_zero Z h t hh hZ ht ht' + have hs : γ t ∈ Complex.slitPlane := by + apply Complex.mem_slitPlane_iff.mpr + rcases hx.eq_or_lt with he | he + · exact Or.inr (fun hi => hx0 (Complex.ext he.symm hi)) + · exact Or.inl he + have hg0 : g t ≠ 0 := by + intro hz + have hn := highArcTangent_normSq h t hh + change Complex.normSq (g t)=1 at hn + rw [hz,Complex.normSq_zero] at hn + norm_num at hn + have hg : HasDerivAt g (-C*g t) t := by + convert! hasDerivAt_highArcTangent h t hh using 1 + dsimp [C] + ring + have hF := analyticOnNhd_gaugedSlowSolution q M hq (γ t) hs + have hU : HasDerivAt U (deriv U t) t := by + have h := hF.differentiableAt.hasDerivAt.scomp t (hasDerivAt_highArcPoint Z h t) + exact h.differentiableAt.hasDerivAt + have hU' : HasDerivAt (deriv U) (deriv (deriv U) t) t := + (analytic_path_hasDerivAt_deriv (gaugedSlowSolution q M) γ g t hF + (hasDerivAt_highArcPoint Z h) (-C*g t) hg).differentiableAt.hasDerivAt + have hA := hasDerivAt_kineticCoefficient γ g t C + (hasDerivAt_highArcPoint Z h t) hg hg0 + have hODE := gaugedSlowSolution_path_equation q M γ g t C hq hx hx0 hg0 + (hasDerivAt_highArcPoint Z h) hg + have hODE' : -A t*deriv (deriv U) t- + (1/g t+2*C*A t-C*A t)*deriv U t+V*U t=E*U t := by + change -A t*deriv (deriv U) t-(1/g t+C*A t)*deriv U t+V*U t=E*U t at hODE + linear_combination hODE + have hB := hasDerivAt_highArcCorrection Z t + have hd := hasDerivAt_highAngularFlux_completed A (highArcCorrection Z) U t + (highArcL Z (2*t)) (highArcN Z (2*t)) (3/10) + ((3/10)*(Real.cos (2*t)-4*highArcN Z (2*t))) 2 + (Real.sin (2*t)+4*highArcL Z (2*t)) h + (1/g t+2*C*A t) V E (deriv U t) (deriv (deriv U) t) hh + (highArc_kinetic_coefficient Z h t hh) (by dsimp [highArcCorrection]; ring) + hA (by convert! hB using 1; ring) hU hU' (by + convert! hODE' using 1) + have hV : V.re = highArcU (2*t)/4+ + (M : ℝ)^2*highArcU (2*t)/(4*(highArcU (2*t)^2+highArcV Z (2*t)^2)) := by + convert! highAngular_radialPotential_re (highArcU (2*t)) (highArcV Z (2*t)) h M hh hgeo.2.1.ne' using 1 + simp only [V,γ,highArcPoint,Complex.ofReal_mul,Complex.ofReal_natCast] + ring_nf + convert! hd using 1 + rw [hV] + dsimp only [highArcPotential,E,U,highArcWave] + push_cast + ring_nf + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularArc.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularArc.lean new file mode 100644 index 0000000000000000000000000000000000000000..70fd0a86a4accb8885d009b956e43a336f07c5e1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularArc.lean @@ -0,0 +1,98 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HighAngularRay +import Mathlib.Analysis.SpecialFunctions.Trigonometric.Inverse + +namespace OAI + +/-! Geometry and positivity on the initial arc of the high-angular contour. -/ + +namespace DefocusingNLS + +noncomputable def highArcAngle : ℝ := Real.arccos (99/101) +noncomputable def highArcU (θ : ℝ) : ℝ := Real.sin θ/2 +noncomputable def highArcV (Z θ : ℝ) : ℝ := Z+(1-Real.cos θ)/2 +noncomputable def highArcL (Z θ : ℝ) : ℝ := + highArcU θ*(Real.cos θ^2-Real.sin θ^2)+ + highArcV Z θ*(2*Real.sin θ*Real.cos θ) +noncomputable def highArcN (Z θ : ℝ) : ℝ := + highArcU θ*(2*Real.sin θ*Real.cos θ)- + highArcV Z θ*(Real.cos θ^2-Real.sin θ^2) + +private theorem highArc_sin_cos (θ : ℝ) (hθ : 0 ≤ θ) (hθ' : θ ≤ highArcAngle) : + 0 ≤ Real.sin θ ∧ Real.sin θ ≤ 20/101 ∧ + 99/101 ≤ Real.cos θ ∧ Real.cos θ ≤ 1 := by + have hA : highArcAngle ≤ Real.pi/2 := Real.arccos_le_pi_div_two.mpr (by norm_num) + have hsin : Real.sin highArcAngle = 20/101 := by + rw [highArcAngle,Real.sin_arccos] + norm_num + have hcos : Real.cos highArcAngle = 99/101 := + Real.cos_arccos (by norm_num) (by norm_num) + refine ⟨Real.sin_nonneg_of_nonneg_of_le_pi hθ + (hθ'.trans (Real.arccos_le_pi _)), ?_, ?_, Real.cos_le_one θ⟩ + · rw [← hsin] + exact Real.sin_le_sin_of_le_of_le_pi_div_two (by linarith [Real.pi_pos]) hA hθ' + · rw [← hcos] + exact Real.cos_le_cos_of_nonneg_of_le_pi hθ (Real.arccos_le_pi _) hθ' + +theorem highArc_geometry (Z θ : ℝ) (hZ : 2704/1000 ≤ Z) + (hθ : 0 ≤ θ) (hθ' : θ ≤ highArcAngle) : + 0 ≤ highArcU θ ∧ 0 < highArcV Z θ ∧ + 0 ≤ highArcL Z θ ∧ highArcN Z θ ≤ -(2444/1000) ∧ + 107/10 < Real.cos θ-4*highArcN Z θ := by + obtain ⟨hs,hs',hc,hc'⟩ := highArc_sin_cos θ hθ hθ' + have hc0 : 0 ≤ Real.cos θ := by linarith + have hsc := Real.sin_sq_add_cos_sq θ + have hS0 : 0 ≤ 2*Real.sin θ*Real.cos θ := by positivity + have hS1 : 2*Real.sin θ*Real.cos θ ≤ 2/5 := by + have hm := mul_le_mul_of_nonneg_left hc' hs + nlinarith + have hC0 : 92/100 ≤ Real.cos θ^2-Real.sin θ^2 := by + have hsq : Real.sin θ^2 ≤ (20/101 : ℝ)^2 := + (sq_le_sq₀ hs (by norm_num)).mpr hs' + nlinarith + have hu : 0 ≤ highArcU θ := by dsimp [highArcU]; positivity + have hu' : highArcU θ ≤ 1/10 := by dsimp [highArcU]; linarith + have hv : 27/10 < highArcV Z θ := by dsimp [highArcV]; linarith + have hv0 : 0 < highArcV Z θ := by linarith + have hL : 0 ≤ highArcL Z θ := by + unfold highArcL + exact add_nonneg (mul_nonneg hu (by linarith)) (mul_nonneg hv0.le hS0) + have hN : highArcN Z θ ≤ -(2444/1000) := by + have hfirst := mul_le_mul hu' hS1 hS0 (by norm_num) + have hsecond := mul_le_mul (le_of_lt hv) hC0 (by norm_num) hv0.le + unfold highArcN + nlinarith + exact ⟨hu,hv0,hL,hN,by linarith⟩ + +noncomputable def highArcPotential (σ M Z θ : ℝ) : ℝ := + σ-3+highArcU θ/4+ + M^2*highArcU θ/(4*(highArcU θ^2+highArcV Z θ^2))+ + Real.sin θ+(3/10)*(Real.cos θ-4*highArcN Z θ)+(3-9/100)*highArcL Z θ + +theorem highArcPotential_pos (σ M Z θ : ℝ) (hσ : -(1/32 : ℝ) ≤ σ) + (hZ : 2704/1000 ≤ Z) + (hθ : 0 ≤ θ) (hθ' : θ ≤ highArcAngle) : + 0 < highArcPotential σ M Z θ := by + obtain ⟨hu,hv,hL,_,hL'⟩ := highArc_geometry Z θ hZ hθ hθ' + have hs := (highArc_sin_cos θ hθ hθ').1 + have hterm : 0 ≤ M^2*highArcU θ/(4*(highArcU θ^2+highArcV Z θ^2)) := by positivity + unfold highArcPotential + linarith + +theorem highArc_join_L (Z : ℝ) : highArcL Z highArcAngle = highRayL Z 0 := by + norm_num [highArcL,highArcU,highArcV,highArcAngle,Real.sin_arccos, + highRayL,highRayU,highRayV] + rw [Real.cos_arccos (by norm_num) (by norm_num)] + ring + +theorem highArc_join_jump_pos (Z : ℝ) (hZ : 2704/1000 ≤ Z) (hZ' : Z ≤ 2706/1000) : + 0 < -3/2-(3/10)*highArcL Z highArcAngle-highArcN Z highArcAngle := by + have hN := (highArc_geometry Z highArcAngle hZ (Real.arccos_nonneg _) le_rfl).2.2.2.1 + have hL : highArcL Z highArcAngle < 119/100 := by + rw [highArc_join_L] + norm_num [highRayL,highRayU,highRayV] + linarith + linarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularArcFluxSign.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularArcFluxSign.lean new file mode 100644 index 0000000000000000000000000000000000000000..6db3a5e233740b2263e17540087560c761bb46e0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularArcFluxSign.lean @@ -0,0 +1,65 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HighAngularFluxSign + +namespace OAI + +/-! The negative outgoing flux propagates across the corner and the initial arc. -/ + +open Set +namespace DefocusingNLS + +theorem highAngular_actualFlux_join (q : ℂ) (M : ℕ) (Z h : ℝ) + (hq : -1 < q.re) (hh : h=1 ∨ h= -1) (hZ : 2704/1000 ≤ Z) : + highRayActualFlux q M Z h 0-highArcActualFlux q M Z h (highArcAngle/2) = + (highRayCorrection 0-highArcCorrection Z (highArcAngle/2))* + Complex.normSq (highRayWave q M Z h 0) := by + have ha : 0 ≤ highArcAngle := Real.arccos_nonneg _ + have hj := highContour_join Z h + have hU : highArcWave q M Z h (highArcAngle/2)=highRayWave q M Z h 0 := by + dsimp only [highArcWave,highRayWave] + rw [hj.1] + have hD : deriv (highArcWave q M Z h) (highArcAngle/2)=deriv (highRayWave q M Z h) 0 := by + rw [highArcWave_deriv q M Z h _ hq hh hZ (by linarith) (by linarith), + highRayWave_deriv q M Z h 0 hq le_rfl,hj.1,hj.2] + unfold highRayActualFlux highArcActualFlux highAngularFlux + dsimp only + rw [hU,hD,hj.1,hj.2] + ring + +theorem highArcActualFlux_monotoneOn (q : ℂ) (M : ℕ) (Z h : ℝ) + (hq : -1 < q.re) (hh : h=1 ∨ h= -1) + (hσ : -(1/32 : ℝ) ≤ 3-(((M : ℂ)+1)/2-q).re) (hZ : 2704/1000 ≤ Z) : + MonotoneOn (highArcActualFlux q M Z h) (Icc 0 (highArcAngle/2)) := by + have hd (t : ℝ) (ht : t ∈ Icc 0 (highArcAngle/2)) := + hasDerivAt_highArcActualFlux q M Z h t hq hh hZ (by linarith [ht.1]) (by linarith [ht.2]) + apply monotoneOn_of_deriv_nonneg (convex_Icc 0 (highArcAngle/2)) + · intro t ht + exact (hd t ht).continuousAt.continuousWithinAt + · intro t ht + exact (hd t (interior_subset ht)).differentiableAt.differentiableWithinAt + · intro t ht + have hti := interior_subset ht + rw [(hd t hti).deriv] + have hgeo := highArc_geometry Z (2*t) hZ (by linarith [hti.1]) (by linarith [hti.2]) + have hV := highArcPotential_pos _ (M : ℝ) Z (2*t) hσ hZ + (by linarith [hti.1]) (by linarith [hti.2]) + exact add_nonneg (mul_nonneg hgeo.2.2.1 (Complex.normSq_nonneg _)) + (mul_nonneg hV.le (Complex.normSq_nonneg _)) + +theorem highArcActualFlux_initial_neg (q : ℂ) (M : ℕ) (Z h : ℝ) + (hq : -1 < q.re) (hh : h=1 ∨ h= -1) (hM : 9 ≤ M) + (hσ : -(1/32 : ℝ) ≤ 3-(((M : ℂ)+1)/2-q).re) + (hZ : 2704/1000 ≤ Z) (hZ' : Z ≤ 2706/1000) : + highArcActualFlux q M Z h 0 < 0 := by + have ha : 0 ≤ highArcAngle/2 := div_nonneg (Real.arccos_nonneg _) (by norm_num) + have hmono := highArcActualFlux_monotoneOn q M Z h hq hh hσ hZ + (show (0 : ℝ) ∈ Icc 0 (highArcAngle/2) from ⟨le_rfl,ha⟩) + (show highArcAngle/2 ∈ Icc 0 (highArcAngle/2) from ⟨ha,le_rfl⟩) ha + have hjump : 0 ≤ highRayActualFlux q M Z h 0-highArcActualFlux q M Z h (highArcAngle/2) := by + rw [highAngular_actualFlux_join q M Z h hq hh hZ] + exact mul_nonneg (highCorrection_join Z hZ hZ').le (Complex.normSq_nonneg _) + have hneg := highRayActualFlux_initial_neg q M Z h hq hh hM hσ hZ hZ' + linarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularBoundaryFlux.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularBoundaryFlux.lean new file mode 100644 index 0000000000000000000000000000000000000000..fae5f1362e8833c43860b29153b4627d2e5f499c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularBoundaryFlux.lean @@ -0,0 +1,58 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Profile.SlowGaugeGrowth + +namespace OAI + +/-! Cancellation of the two matched jets at the initial contour endpoint. -/ + +namespace DefocusingNLS + +theorem gaugedFlux_product_identity (x G H D A : ℂ) : + (x*star (G*H)*(G*(D+A*H))).re = + Complex.normSq G*((x*star H*D).re+(x*A).re*Complex.normSq H) := by + simp only [Complex.mul_re,Complex.mul_im,Complex.add_re,Complex.add_im, + Complex.star_def,Complex.conj_re,Complex.conj_im,Complex.normSq_apply] + ring + +theorem gaugedFlux_at_imaginary_boundary (x G H D : ℂ) (M : ℕ) + (hx : x.re=0) (hx0 : x ≠ 0) : + (x*star (G*H)*(G*(D+((M : ℂ)/(2*x)-1/2)*H))).re = + Complex.normSq G*((x*star H*D).re+(M : ℝ)/2*Complex.normSq H) := by + rw [gaugedFlux_product_identity] + have he : x*((M : ℂ)/(2*x)-1/2)=(M : ℂ)/2-x/2 := by + field_simp [hx0] + rw [he] + norm_num [Complex.div_re,hx] + +theorem paired_gauged_boundary_flux (Z : ℝ) (M : ℕ) (H D : ℂ) (hZ : 0 < Z) : + let xp : ℂ := -Complex.I*(Z : ℂ) + let xm : ℂ := Complex.I*(Z : ℂ) + let Gp := slowGauge M xp + let Gm := slowGauge M xm + (xp*star (Gp*H)*(Gp*(D+((M : ℂ)/(2*xp)-1/2)*H))).re+ + (xm*star (Gm*H)*(Gm*(D+((M : ℂ)/(2*xm)-1/2)*H))).re = + (M : ℝ)/2*(Complex.normSq (Gp*H)+Complex.normSq (Gm*H)) := by + intro xp xm Gp Gm + have hxp : xp.re=0 := by simp [xp] + have hxm : xm.re=0 := by simp [xm] + have hz : (Z : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr hZ.ne' + have hxp0 : xp ≠ 0 := mul_ne_zero (neg_ne_zero.mpr Complex.I_ne_zero) hz + have hxm0 : xm ≠ 0 := mul_ne_zero Complex.I_ne_zero hz + have hnorm : ‖Gp‖=‖Gm‖ := by + dsimp only [Gp,Gm] + rw [slowGauge_norm,slowGauge_norm,hxp,hxm] + have he : xp = -xm := by dsimp [xp,xm]; ring + rw [he,norm_neg] + have hsq : Complex.normSq Gp=Complex.normSq Gm := by + rw [Complex.normSq_eq_norm_sq,Complex.normSq_eq_norm_sq,hnorm] + rw [gaugedFlux_at_imaginary_boundary xp Gp H D M hxp hxp0, + gaugedFlux_at_imaginary_boundary xm Gm H D M hxm hxm0, + Complex.normSq_mul,Complex.normSq_mul,hsq] + have hcancel : (xp*star H*D).re+(xm*star H*D).re=0 := by + rw [← Complex.add_re] + have he : xp*star H*D+xm*star H*D=0 := by dsimp [xp,xm]; ring + rw [he,Complex.zero_re] + linear_combination Complex.normSq Gm*hcancel + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularCertificate.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularCertificate.lean new file mode 100644 index 0000000000000000000000000000000000000000..8b214d6f4745cdd55d8383b8705bcee3a7f0643d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularCertificate.lean @@ -0,0 +1,71 @@ +import Mathlib.Tactic + +namespace OAI + +/-! +# The high angular degree polynomial certificate + +Exact rational comparisons from Appendix `cert:high-angular` of +*Stable self-similar blowup for a supercritical defocusing Schrödinger equation +on the torus* (September 2026) give positivity of the multiplier polynomial. +-/ + +namespace DefocusingNLS + +/-- The rational lower bound in equation `free:high-polynomial`. -/ +noncomputable def highAngularPolynomial (t : ℝ) : ℝ := + let u₀ := 99 / 1000 + 98 / 100 * t + let L₀ := 113 / 100 + 98 / 100 * t + let d₀ := (1 / 10 + 981 / 1000 * t) ^ 2 + (272 / 100 + 1 / 5 * t) ^ 2 + let q₀ := 1 + 3 / 2 * t + (-3 - 1 / 32 + u₀ / 4) * L₀ * d₀ * q₀ ^ 2 + + (81 / 4) * u₀ * L₀ * q₀ ^ 2 + 5 * L₀ * d₀ - + (-3 / 2 + 11 / 4 * t) ^ 2 * d₀ + +/-- The comparison polynomial in Appendix `cert:high-angular`. -/ +noncomputable def highAngularComparison (t : ℝ) : ℝ := + 2 + t * (33 - 361 / 5 * t + 224 / 5 * t ^ 2) + + t ^ 4 * (179 / 10 - 461 / 100 * t + 27 / 50 * t ^ 2) + +/-- All seven coefficients of the difference, checked as a polynomial identity. -/ +theorem highAngular_difference (t : ℝ) : + highAngularPolynomial t - highAngularComparison t = + 142518401 / 500000000 + 325932989 / 1000000000 * t + + 15777215591 / 200000000000 * t ^ 2 + + 8728703679 / 200000000000 * t ^ 3 + + 34209914771 / 800000000000 * t ^ 4 + + 16113799 / 3125000000 * t ^ 5 + + 60018849 / 40000000000 * t ^ 6 := by + unfold highAngularPolynomial highAngularComparison + ring + +/-- The first quadratic is strictly positive, by completing the square. -/ +theorem highAngular_first_quadratic_pos (t : ℝ) : + 0 < 33 - 361 / 5 * t + 224 / 5 * t ^ 2 := by + nlinarith [sq_nonneg (448 * t - 361)] + +/-- The second quadratic is strictly positive, by completing the square. -/ +theorem highAngular_second_quadratic_pos (t : ℝ) : + 0 < 179 / 10 - 461 / 100 * t + 27 / 50 * t ^ 2 := by + nlinarith [sq_nonneg (108 * t - 461)] + +/-- The comparison polynomial is at least two on the positive half-line. -/ +theorem highAngularComparison_ge_two {t : ℝ} (ht : 0 ≤ t) : + 2 ≤ highAngularComparison t := by + have h₁ := mul_nonneg ht (highAngular_first_quadratic_pos t).le + have h₂ := mul_nonneg (pow_nonneg ht 4) (highAngular_second_quadratic_pos t).le + unfold highAngularComparison + linarith + +/-- The manuscript's exact polynomial lower bound is strictly positive. -/ +theorem highAngularPolynomial_pos {t : ℝ} (ht : 0 ≤ t) : + 0 < highAngularPolynomial t := by + have hdiff : 0 < highAngularPolynomial t - highAngularComparison t := by + rw [highAngular_difference] + positivity + have hcomp := highAngularComparison_ge_two ht + linarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularContour.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularContour.lean new file mode 100644 index 0000000000000000000000000000000000000000..4b580bcc4412ac08c7faf12a44da04482da23292 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularContour.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HighAngularArc +import Mathlib.Analysis.Complex.RealDeriv +import Mathlib.Analysis.Calculus.Deriv.Mul +import Mathlib.Analysis.SpecialFunctions.Trigonometric.Deriv + +namespace OAI + +/-! The two actual pieces of the high-angular contour and their tangent vectors. -/ + +namespace DefocusingNLS + +noncomputable def highArcPoint (Z h t : ℝ) : ℂ := + (highArcU (2*t) : ℂ)-Complex.I*(h : ℂ)*(highArcV Z (2*t) : ℂ) +noncomputable def highArcTangent (h t : ℝ) : ℂ := + (Real.cos (2*t) : ℂ)-Complex.I*(h*Real.sin (2*t) : ℝ) +noncomputable def highRayPoint (Z h t : ℝ) : ℂ := + (highRayU t : ℂ)-Complex.I*(h : ℂ)*(highRayV Z t : ℂ) +noncomputable def highRayTangent (h : ℝ) : ℂ := + (99/101 : ℂ)-Complex.I*(h*(20/101) : ℝ) + +theorem hasDerivAt_highArcPoint (Z h t : ℝ) : + HasDerivAt (highArcPoint Z h) (highArcTangent h t) t := by + have hu : HasDerivAt (fun r : ℝ => highArcU (2*r)) (Real.cos (2*t)) t := by + convert! ((((hasDerivAt_id t).const_mul 2).sin).div_const 2) using 1 + simp only [id_eq,mul_one] + ring + have hv : HasDerivAt (fun r : ℝ => highArcV Z (2*r)) (Real.sin (2*t)) t := by + convert! (((((hasDerivAt_id t).const_mul 2).cos).const_sub 1).div_const 2).const_add Z using 1 + simp only [id_eq,mul_one] + ring + convert! hu.ofReal_comp.sub (hv.ofReal_comp.const_mul (Complex.I*(h : ℂ))) using 1 + simp only [highArcTangent,Complex.ofReal_mul] + ring + +theorem hasDerivAt_highRayPoint (Z h t : ℝ) : + HasDerivAt (highRayPoint Z h) (highRayTangent h) t := by + have hu : HasDerivAt highRayU (99/101) t := by + convert! ((hasDerivAt_id t).const_mul (99/101)).const_add (10/101) using 1 + simp only [mul_one] + have hv : HasDerivAt (highRayV Z) (20/101) t := by + convert! ((hasDerivAt_id t).const_mul (20/101)).const_add (Z+1/101) using 1 + simp only [mul_one] + convert! hu.ofReal_comp.sub (hv.ofReal_comp.const_mul (Complex.I*(h : ℂ))) using 1 + norm_num [highRayTangent,Complex.ofReal_mul] + ring + +theorem highArcTangent_normSq (h t : ℝ) (hh : h=1 ∨ h= -1) : + Complex.normSq (highArcTangent h t) = 1 := by + rcases hh with rfl | rfl <;> + simp only [highArcTangent,Complex.normSq_apply,Complex.sub_re,Complex.sub_im, + Complex.mul_re,Complex.mul_im,Complex.ofReal_re,Complex.ofReal_im, + Complex.I_re,Complex.I_im] <;> nlinarith [Real.sin_sq_add_cos_sq (2*t)] + +theorem highRayTangent_normSq (h : ℝ) (hh : h=1 ∨ h= -1) : + Complex.normSq (highRayTangent h) = 1 := by + rcases hh with rfl | rfl <;> norm_num [highRayTangent,Complex.normSq_apply] + +theorem highContour_join (Z h : ℝ) : + highArcPoint Z h (highArcAngle/2) = highRayPoint Z h 0 ∧ + highArcTangent h (highArcAngle/2) = highRayTangent h := by + have hc : Real.cos highArcAngle = 99/101 := Real.cos_arccos (by norm_num) (by norm_num) + have hs : Real.sin highArcAngle = 20/101 := by + norm_num [highArcAngle,Real.sin_arccos] + have ht : 2*(highArcAngle/2)=highArcAngle := by ring + constructor + · simp only [highArcPoint,highRayPoint,highArcU,highArcV,highRayU,highRayV,ht,hc,hs] + push_cast + ring + · norm_num [highArcTangent,highRayTangent,ht,hc,hs] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularCorrections.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularCorrections.lean new file mode 100644 index 0000000000000000000000000000000000000000..d6b67f3880479ac1126c00ccfb43295720a3cf92 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularCorrections.lean @@ -0,0 +1,46 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HighAngularKineticDerivative + +namespace OAI + +/-! The two correction terms in the actual high-angular boundary flux. -/ + +namespace DefocusingNLS + +noncomputable def highArcCorrection (Z t : ℝ) : ℝ := + (3/10)*highArcL Z (2*t)+highArcN Z (2*t) + +noncomputable def highRayCorrection (t : ℝ) : ℝ := -3/2+5*t/(1+(3/2)*t) + +theorem hasDerivAt_highArcCorrection (Z t : ℝ) : + HasDerivAt (highArcCorrection Z) + ((3/10)*(Real.cos (2*t)-4*highArcN Z (2*t))+ + Real.sin (2*t)+4*highArcL Z (2*t)) t := by + convert! ((hasDerivAt_highArcL Z t).const_mul (3/10)).add + (hasDerivAt_highArcN Z t) using 1 + ring + +theorem hasDerivAt_highRayCorrection (t : ℝ) (ht : 0 ≤ t) : + HasDerivAt highRayCorrection (5/(1+(3/2)*t)^2) t := by + have hd : 1+(3/2)*t ≠ 0 := by positivity + have h := (((hasDerivAt_id t).const_mul 5).div + (((hasDerivAt_id t).const_mul (3/2)).const_add 1) hd).const_add (-3/2) + convert! h using 1 + simp only [id_eq,mul_one] + field_simp [hd] + ring + +theorem highRayCorrection_quotient (t : ℝ) (ht : 0 ≤ t) : + highRayCorrection t = (-3/2+(11/4)*t)/(1+(3/2)*t) := by + unfold highRayCorrection + field_simp [show 1+(3/2)*t ≠ 0 by positivity] + ring + +theorem highCorrection_join (Z : ℝ) (hZ : 2704/1000 ≤ Z) (hZ' : Z ≤ 2706/1000) : + 0 < highRayCorrection 0-highArcCorrection Z (highArcAngle/2) := by + have h := highArc_join_jump_pos Z hZ hZ' + simpa only [highRayCorrection,highArcCorrection,mul_zero,add_zero,zero_div, + show 2*(highArcAngle/2)=highArcAngle by ring,sub_add_eq_sub_sub] using h + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularFlux.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularFlux.lean new file mode 100644 index 0000000000000000000000000000000000000000..a24c1c429524e6a4caa03ef25253e1c6b56870aa --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularFlux.lean @@ -0,0 +1,40 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HighAngularSquare + +namespace OAI + +/-! Algebraic flux identities underlying the high-angular exclusion. -/ + +namespace DefocusingNLS + +/-- The real flux derivative before completing the kinetic square. -/ +theorem highAngular_raw_flux (A A' C V E U U' U'' : ℂ) + (hODE : -A*U''-(A'-C*A)*U'+V*U=E*U) : + (A'*star U*U'+A*star U'*U'+A*star U*U'').re = + A.re*Complex.normSq U'+(C*A*star U*U').re+ + (V.re-E.re)*Complex.normSq U := by + have h := congrArg (fun z : ℂ => (star U*z).re) hODE + simp only [Complex.mul_re,Complex.mul_im,Complex.add_re,Complex.add_im, + Complex.sub_re,Complex.sub_im,Complex.neg_re,Complex.neg_im,Complex.star_def, + Complex.conj_re,Complex.conj_im,Complex.normSq_apply] at h ⊢ + linear_combination -h + +/-- Adding the correction to the boundary flux produces exactly the bulk +potential from the manuscript. -/ +theorem highAngular_corrected_flux (L N α αL' θ' N' h : ℝ) + (A' V E U U' U'' : ℂ) (hh : h=1 ∨ h= -1) + (hODE : -((L : ℂ)+Complex.I*(h*N : ℝ))*U''- + (A'-Complex.I*(h*θ' : ℝ)*((L : ℂ)+Complex.I*(h*N : ℝ)))*U'+V*U=E*U) : + (A'*star U*U'+((L : ℂ)+Complex.I*(h*N : ℝ))*star U'*U'+ + ((L : ℂ)+Complex.I*(h*N : ℝ))*star U*U'').re+ + (αL'+θ'*N'/2)*Complex.normSq U+ + (α*L+θ'*N/2)*(2*(star U*U').re) = + L*Complex.normSq (U'+((α : ℂ)-Complex.I*(h*θ'/2 : ℝ))*U)+ + (V.re-E.re+αL'+θ'*N'/2-L*(α^2+θ'^2/4))*Complex.normSq U := by + rw [highAngular_raw_flux _ _ _ _ _ _ _ _ hODE] + have hA : ((L : ℂ)+Complex.I*(h*N : ℝ)).re = L := by simp + rw [hA,highAngular_completed_square L N α θ' h U U' hh] + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularFluxDerivative.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularFluxDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..3a307adab9f1f7a64af399d58cdba01ba4dcd31c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularFluxDerivative.lean @@ -0,0 +1,64 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HighAngularFlux +import Mathlib.Analysis.Calculus.Deriv.Star +import Mathlib.Analysis.Complex.RealDeriv +import Mathlib.Analysis.Calculus.Deriv.Mul + +namespace OAI + +/-! Differential form of the high-angular multiplier identity. -/ + +namespace DefocusingNLS + +noncomputable def highAngularFlux (A : ℝ → ℂ) (B : ℝ → ℝ) (U : ℝ → ℂ) (t : ℝ) : ℝ := + (A t*star (U t)*deriv U t).re+B t*Complex.normSq (U t) + +theorem hasDerivAt_complex_normSq {U : ℝ → ℂ} {U' : ℂ} {t : ℝ} + (hU : HasDerivAt U U' t) : + HasDerivAt (fun s => Complex.normSq (U s)) (2*(star (U t)*U').re) t := by + have h := Complex.reCLM.hasFDerivAt.comp_hasDerivAt t (hU.star.mul hU) + convert! h using 1 + · ext s + simp [Complex.normSq_apply,Complex.mul_re] + · simp only [Complex.reCLM_apply,Complex.add_re,Complex.mul_re, + Complex.star_def,Complex.conj_re,Complex.conj_im] + ring + +theorem hasDerivAt_highAngularFlux (A : ℝ → ℂ) (B : ℝ → ℝ) (U : ℝ → ℂ) + (t : ℝ) (A' U' U'' : ℂ) (B' : ℝ) + (hA : HasDerivAt A A' t) (hB : HasDerivAt B B' t) + (hU : HasDerivAt U U' t) (hU' : HasDerivAt (deriv U) U'' t) : + HasDerivAt (highAngularFlux A B U) + ((A'*star (U t)*U'+A t*star U'*U'+A t*star (U t)*U'').re+ + B'*Complex.normSq (U t)+B t*(2*(star (U t)*U').re)) t := by + have h := (Complex.reCLM.hasFDerivAt.comp_hasDerivAt t + ((hA.mul hU.star).mul hU')).add (hB.mul (hasDerivAt_complex_normSq hU)) + rw [hU.deriv] at h + convert! h using 1 + simp only [Complex.reCLM_apply,Pi.mul_apply,Complex.add_re,Complex.add_im,Complex.mul_re, + Complex.mul_im] + ring + +/-- A local ODE yields the positive-square flux derivative with no integration +or unproved endpoint assertion. -/ +theorem hasDerivAt_highAngularFlux_completed + (A : ℝ → ℂ) (B : ℝ → ℝ) (U : ℝ → ℂ) (t : ℝ) + (L N α αL' θ' N' h : ℝ) (A' V E U' U'' : ℂ) + (hh : h=1 ∨ h= -1) + (hAval : A t=(L : ℂ)+Complex.I*(h*N : ℝ)) + (hBval : B t=α*L+θ'*N/2) + (hA : HasDerivAt A A' t) + (hB : HasDerivAt B (αL'+θ'*N'/2) t) + (hU : HasDerivAt U U' t) (hU' : HasDerivAt (deriv U) U'' t) + (hODE : -A t*U''-(A'-Complex.I*(h*θ' : ℝ)*A t)*U'+V*U t=E*U t) : + HasDerivAt (highAngularFlux A B U) + (L*Complex.normSq (U'+((α : ℂ)-Complex.I*(h*θ'/2 : ℝ))*U t)+ + (V.re-E.re+αL'+θ'*N'/2-L*(α^2+θ'^2/4))*Complex.normSq (U t)) t := by + have hd := hasDerivAt_highAngularFlux A B U t A' U' U'' (αL'+θ'*N'/2) hA hB hU hU' + rw [hAval,hBval] at hd + rw [hAval] at hODE + rw [highAngular_corrected_flux L N α αL' θ' N' h A' V E (U t) U' U'' hh hODE] at hd + exact hd + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularFluxLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularFluxLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..3c43ecac96887bff84017ce7444084ecbb671331 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularFluxLimit.lean @@ -0,0 +1,79 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HighAngularRayFlux + +namespace OAI + +/-! Vanishing of the actual outgoing flux at infinity. -/ + +open Filter Topology +namespace DefocusingNLS + +theorem highRayPoint_affine (Z h t : ℝ) : + highRayPoint Z h t = highRayPoint Z h 0+(t : ℂ)*highRayTangent h := by + apply Complex.ext <;> + norm_num [highRayPoint,highRayTangent,highRayU,highRayV,Complex.mul_re, + Complex.mul_im] <;> ring + +theorem highRayCorrection_tendsto : + Tendsto highRayCorrection atTop (𝓝 (11/6)) := by + have htop : Tendsto (fun t : ℝ => 1+(3/2)*t) atTop atTop := + tendsto_atTop_add_const_left atTop 1 + (Filter.Tendsto.const_mul_atTop (by norm_num : (0 : ℝ)<3/2) tendsto_id) + have hi := tendsto_inv_atTop_zero.comp htop + have he : Tendsto (fun t : ℝ => (11/6)-(10/3)*(1+(3/2)*t)⁻¹) atTop (𝓝 (11/6)) := by + simpa only [mul_zero,sub_zero,Function.comp_def] using + (tendsto_const_nhds : Tendsto (fun _ : ℝ => (11/6 : ℝ)) atTop (𝓝 (11/6))).sub + (hi.const_mul (10/3)) + apply he.congr' + filter_upwards [eventually_ge_atTop (0 : ℝ)] with t ht + dsimp [highRayCorrection] + field_simp [show 1+(3/2)*t ≠ 0 by positivity] + ring + +theorem highRayActualFlux_tendsto_zero (q : ℂ) (M : ℕ) (Z h : ℝ) + (hq : -1 < q.re) (hh : h=1 ∨ h= -1) + (hZ : 2704/1000 ≤ Z) (hZ' : Z ≤ 2706/1000) : + Tendsto (highRayActualFlux q M Z h) atTop (𝓝 0) := by + let U := highRayWave q M Z h + let g := highRayTangent h + have hU : Tendsto U atTop (𝓝 0) := by + change Tendsto (fun t => gaugedSlowSolution q M (highRayPoint Z h t)) atTop (𝓝 0) + simpa only [pow_zero,one_mul] using highRay_gaugedSlowSolution_decay q M 0 hq Z h hh hZ hZ' + have htU : Tendsto (fun t : ℝ => (t : ℂ)*U t) atTop (𝓝 0) := by + change Tendsto (fun t : ℝ => (t : ℂ)*gaugedSlowSolution q M (highRayPoint Z h t)) atTop (𝓝 0) + simpa only [pow_one] using highRay_gaugedSlowSolution_decay q M 1 hq Z h hh hZ hZ' + have hD : Tendsto (deriv U) atTop (𝓝 0) := by + have hl := (highRay_gaugedSlowSolution_derivative_decay q M 0 hq Z h hh hZ hZ').const_mul g + simp only [pow_zero,one_mul,mul_zero] at hl + apply hl.congr' + filter_upwards [eventually_ge_atTop (0 : ℝ)] with t ht + exact (highRayWave_deriv q M Z h t hq ht).symm + have hg0 : g ≠ 0 := by + have hn := highRayTangent_normSq h hh + change Complex.normSq g=1 at hn + intro hz + rw [hz,Complex.normSq_zero] at hn + norm_num at hn + have hAU : Tendsto (fun t : ℝ => (highRayPoint Z h t/g^2)*star (U t)) atTop (𝓝 0) := by + have hl := ((hU.star).const_mul (highRayPoint Z h 0/g^2)).add + ((htU.star).const_mul (1/g)) + simp only [star_zero,mul_zero,add_zero] at hl + apply hl.congr' + filter_upwards with t + conv_rhs => rw [highRayPoint_affine] + change highRayPoint Z h 0/g^2*star (U t)+1/g*star ((t : ℂ)*U t) = + ((highRayPoint Z h 0+(t : ℂ)*g)/g^2)*star (U t) + simp only [star_mul,Complex.star_def,Complex.conj_ofReal] + field_simp [hg0] + have hp := hAU.mul hD + simp only [mul_zero] at hp + have hraw := Complex.continuous_re.tendsto 0 |>.comp hp + have hsquare := Complex.continuous_normSq.tendsto 0 |>.comp hU + have hcor := highRayCorrection_tendsto.mul hsquare + change Tendsto (fun t => (highRayPoint Z h t/g^2*star (U t)*deriv U t).re+ + highRayCorrection t*Complex.normSq (U t)) atTop (𝓝 0) + simpa only [Function.comp_def,mul_zero,Complex.zero_re,Complex.normSq_zero,add_zero] + using hraw.add hcor + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularFluxSign.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularFluxSign.lean new file mode 100644 index 0000000000000000000000000000000000000000..6757302b8a52c87eab2b992ee552cb46a89d64bd --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularFluxSign.lean @@ -0,0 +1,93 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HighAngularFluxLimit +import Mathlib.Analysis.Calculus.Deriv.MeanValue +import Mathlib.Topology.Order.MonotoneConvergence + +namespace OAI + +/-! The outgoing ray has strictly negative initial flux in high angular degree. -/ + +open Set Filter Topology +namespace DefocusingNLS + +theorem highRayActualFlux_deriv_nonneg (q : ℂ) (M : ℕ) (Z h t : ℝ) + (hq : -1 < q.re) (hh : h=1 ∨ h= -1) (hM : 9 ≤ M) + (hσ : -(1/32 : ℝ) ≤ 3-(((M : ℂ)+1)/2-q).re) + (hZ : 2704/1000 ≤ Z) (hZ' : Z ≤ 2706/1000) (ht : 0 ≤ t) : + 0 ≤ deriv (highRayActualFlux q M Z h) t := by + rw [(hasDerivAt_highRayActualFlux q M Z h t hq hh hZ hZ' ht).deriv] + have hL := (highRay_bounds Z t hZ hZ' ht).2.2.2.2 + have hV := highRayPotential_pos _ (M : ℝ) Z t hσ (by exact_mod_cast hM) hZ hZ' ht + exact add_nonneg (mul_nonneg (by linarith) (Complex.normSq_nonneg _)) + (mul_nonneg hV.le (Complex.normSq_nonneg _)) + +theorem highRayActualFlux_monotoneOn (q : ℂ) (M : ℕ) (Z h : ℝ) + (hq : -1 < q.re) (hh : h=1 ∨ h= -1) (hM : 9 ≤ M) + (hσ : -(1/32 : ℝ) ≤ 3-(((M : ℂ)+1)/2-q).re) + (hZ : 2704/1000 ≤ Z) (hZ' : Z ≤ 2706/1000) : + MonotoneOn (highRayActualFlux q M Z h) (Ici 0) := by + apply monotoneOn_of_deriv_nonneg (convex_Ici 0) + · intro t ht + exact (hasDerivAt_highRayActualFlux q M Z h t hq hh hZ hZ' ht).continuousAt.continuousWithinAt + · intro t ht + exact (hasDerivAt_highRayActualFlux q M Z h t hq hh hZ hZ' + (interior_subset ht)).differentiableAt.differentiableWithinAt + · intro t ht + exact highRayActualFlux_deriv_nonneg q M Z h t hq hh hM hσ hZ hZ' (interior_subset ht) + +theorem highRayActualFlux_nonpos (q : ℂ) (M : ℕ) (Z h t : ℝ) + (hq : -1 < q.re) (hh : h=1 ∨ h= -1) (hM : 9 ≤ M) + (hσ : -(1/32 : ℝ) ≤ 3-(((M : ℂ)+1)/2-q).re) + (hZ : 2704/1000 ≤ Z) (hZ' : Z ≤ 2706/1000) (ht : 0 ≤ t) : + highRayActualFlux q M Z h t ≤ 0 := by + apply ge_of_tendsto (highRayActualFlux_tendsto_zero q M Z h hq hh hZ hZ') + filter_upwards [eventually_ge_atTop t] with s hs + exact highRayActualFlux_monotoneOn q M Z h hq hh hM hσ hZ hZ' ht (ht.trans hs) hs + +theorem highRayActualFlux_initial_neg (q : ℂ) (M : ℕ) (Z h : ℝ) + (hq : -1 < q.re) (hh : h=1 ∨ h= -1) (hM : 9 ≤ M) + (hσ : -(1/32 : ℝ) ≤ 3-(((M : ℂ)+1)/2-q).re) + (hZ : 2704/1000 ≤ Z) (hZ' : Z ≤ 2706/1000) : + highRayActualFlux q M Z h 0 < 0 := by + by_contra hn + have hzero : highRayActualFlux q M Z h 0 = 0 := le_antisymm + (highRayActualFlux_nonpos q M Z h 0 hq hh hM hσ hZ hZ' le_rfl) (le_of_not_gt hn) + have hz (t : ℝ) (ht : 0 ≤ t) : highRayActualFlux q M Z h t = 0 := by + apply le_antisymm (highRayActualFlux_nonpos q M Z h t hq hh hM hσ hZ hZ' ht) + rw [← hzero] + exact highRayActualFlux_monotoneOn q M Z h hq hh hM hσ hZ hZ' (by simp only [mem_Ici, le_refl]) ht ht + obtain ⟨R,hR,hH⟩ := regularizedSlowSolution_nonzero_at_large_norm q (M+1) hq + let t : ℝ := 2*R+2 + have ht : 0 < t := by dsimp [t]; linarith + have hx : 0 ≤ (highRayPoint Z h t).re := by + rw [highRayPoint_re] + dsimp [highRayU] + positivity + have hnR : R ≤ ‖highRayPoint Z h t‖ := by + have hle := (le_abs_self (highRayPoint Z h t).re).trans (Complex.abs_re_le_norm _) + rw [highRayPoint_re] at hle + dsimp [highRayU,t] at hle + linarith + have hG : slowGauge M (highRayPoint Z h t) ≠ 0 := by + unfold slowGauge + apply mul_ne_zero (Complex.exp_ne_zero _) + exact Complex.cpow_ne_zero_iff.mpr (Or.inl (highRayPoint_ne_zero Z h t ht.le)) + have hU : highRayWave q M Z h t ≠ 0 := by + change slowGauge M (highRayPoint Z h t)*regularizedSlowSolution q (M+1) (highRayPoint Z h t) ≠ 0 + exact mul_ne_zero hG (hH _ hx hnR) + have hderiv : 0 < deriv (highRayActualFlux q M Z h) t := by + rw [(hasDerivAt_highRayActualFlux q M Z h t hq hh hZ hZ' ht.le).deriv] + have hL := (highRay_bounds Z t hZ hZ' ht.le).2.2.2.2 + have hV := highRayPotential_pos _ (M : ℝ) Z t hσ (by exact_mod_cast hM) hZ hZ' ht.le + exact add_pos_of_nonneg_of_pos + (mul_nonneg (by linarith) (Complex.normSq_nonneg _)) + (mul_pos hV (Complex.normSq_pos.mpr hU)) + have he : highRayActualFlux q M Z h =ᶠ[𝓝 t] fun _ => 0 := by + filter_upwards [isOpen_Ioi.mem_nhds ht] with s hs + exact hz s hs.le + have hd0 := he.deriv_eq + rw [deriv_const] at hd0 + linarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularGeometry.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..0e1695a7d15d754f285f1d10ac874d4544a1bd7b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularGeometry.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HighAngularContour + +namespace OAI + +/-! The complex kinetic coefficient of the two actual contour pieces. -/ + +namespace DefocusingNLS + +noncomputable def highRayN (Z t : ℝ) : ℝ := + (3960*highRayU t-9401*highRayV Z t)/10201 + +private theorem inv_eq_star_of_normSq (z : ℂ) (hz : Complex.normSq z = 1) : z⁻¹=star z := by + apply Complex.inv_eq_conj + rw [Complex.normSq_eq_norm_sq] at hz + nlinarith [norm_nonneg z] + +theorem highArc_kinetic_coefficient (Z h t : ℝ) (hh : h=1 ∨ h= -1) : + highArcPoint Z h t/(highArcTangent h t)^2 = + (highArcL Z (2*t) : ℂ)+Complex.I*(h*highArcN Z (2*t) : ℝ) := by + rw [div_eq_mul_inv,← inv_pow,inv_eq_star_of_normSq _ (highArcTangent_normSq h t hh)] + rcases hh with rfl | rfl <;> apply Complex.ext <;> + simp only [highArcPoint,highArcTangent,highArcL,highArcN,Complex.add_re, + Complex.add_im,Complex.sub_re,Complex.sub_im,Complex.mul_re,Complex.mul_im, + pow_two,Complex.ofReal_re,Complex.ofReal_im,Complex.ofReal_mul, + Complex.I_re,Complex.I_im,Complex.star_def,Complex.conj_re,Complex.conj_im] <;> ring + +theorem highRay_kinetic_coefficient (Z h t : ℝ) (hh : h=1 ∨ h= -1) : + highRayPoint Z h t/(highRayTangent h)^2 = + (highRayL Z t : ℂ)+Complex.I*(h*highRayN Z t : ℝ) := by + rw [div_eq_mul_inv,← inv_pow,inv_eq_star_of_normSq _ (highRayTangent_normSq h hh)] + rcases hh with rfl | rfl <;> apply Complex.ext <;> + norm_num [highRayPoint,highRayTangent,highRayL,highRayN,Complex.mul_re, + Complex.mul_im,pow_two,Complex.star_def] <;> ring + +theorem hasDerivAt_highArcTangent (h t : ℝ) (hh : h=1 ∨ h= -1) : + HasDerivAt (highArcTangent h) (-Complex.I*(h*2 : ℝ)*highArcTangent h t) t := by + have hc := (((hasDerivAt_id t).const_mul 2).cos).ofReal_comp + have hs := ((((hasDerivAt_id t).const_mul 2).sin).const_mul h).ofReal_comp + convert! hc.sub (hs.const_mul Complex.I) using 1 + rcases hh with rfl | rfl <;> apply Complex.ext <;> + norm_num [highArcTangent,Complex.mul_re,Complex.mul_im] <;> ring + +theorem highRayPoint_re (Z h t : ℝ) : (highRayPoint Z h t).re = highRayU t := by + simp [highRayPoint] + +theorem highArcPoint_re (Z h t : ℝ) : (highArcPoint Z h t).re = highArcU (2*t) := by + simp [highArcPoint] + +theorem highRayPoint_ne_zero (Z h t : ℝ) (ht : 0 ≤ t) : highRayPoint Z h t ≠ 0 := by + intro hz + have hr := congrArg Complex.re hz + rw [highRayPoint_re] at hr + simp only [Complex.zero_re] at hr + dsimp [highRayU] at hr + linarith + +theorem highArcPoint_ne_zero (Z h t : ℝ) (hh : h=1 ∨ h= -1) + (hZ : 2704/1000 ≤ Z) (ht : 0 ≤ 2*t) (ht' : 2*t ≤ highArcAngle) : + highArcPoint Z h t ≠ 0 := by + have hv := (highArc_geometry Z (2*t) hZ ht ht').2.1 + intro hz + have hi := congrArg Complex.im hz + rcases hh with rfl | rfl <;> simp [highArcPoint] at hi <;> linarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularInitialFlux.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularInitialFlux.lean new file mode 100644 index 0000000000000000000000000000000000000000..fae91e10f266a1993c6fe74e1e98b33e01353bb2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularInitialFlux.lean @@ -0,0 +1,54 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HighAngularArcFluxSign +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HighAngularBoundaryFlux +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.FreeMatching + +namespace OAI + +/-! The actual initial flux is a scaled cone form of the ungauged boundary jet. -/ + +namespace DefocusingNLS + +theorem highArcActualFlux_initial (q : ℂ) (M : ℕ) (Z h : ℝ) + (hq : -1 < q.re) (hh : h=1 ∨ h= -1) (hZ : 2704/1000 ≤ Z) : + let x : ℂ := -Complex.I*(h*Z : ℝ) + highArcActualFlux q M Z h 0 = Complex.normSq (slowGauge M x)* + coneForm ((M : ℝ)-2*Z) x (regularizedSlowSolution q (M+1) x) + (deriv (regularizedSlowSolution q (M+1)) x) := by + intro x + have hx : x.re=0 := by simp [x] + have hx0 : x ≠ 0 := by + intro hz + have hi := congrArg Complex.im hz + rcases hh with rfl | rfl <;> norm_num [x] at hi <;> linarith + have hpoint : highArcPoint Z h 0=x := by + simp [highArcPoint,highArcU,highArcV,x] + ring + have htangent : highArcTangent h 0=1 := by simp [highArcTangent] + have hcorrection : highArcCorrection Z 0= -Z := by + simp [highArcCorrection,highArcL,highArcN,highArcU,highArcV] + unfold highArcActualFlux highAngularFlux + dsimp only + rw [highArcWave_deriv q M Z h 0 hq hh hZ (by norm_num) + (by simpa only [mul_zero,highArcAngle] using Real.arccos_nonneg (99/101 : ℝ)),hpoint,htangent,hcorrection] + simp only [one_pow,div_one,one_mul] + dsimp only [highArcWave] + rw [hpoint,(hasDerivAt_gaugedSlowSolution q M x hq hx.ge hx0).deriv] + unfold gaugedSlowSolution + rw [gaugedFlux_at_imaginary_boundary x (slowGauge M x) + (regularizedSlowSolution q (M+1) x) (deriv (regularizedSlowSolution q (M+1)) x) M hx hx0, + Complex.normSq_mul] + dsimp only [coneForm] + ring + +theorem conjugate_boundary_gauge_normSq (M : ℕ) (Z : ℝ) : + Complex.normSq (slowGauge M (-Complex.I*(Z : ℂ))) = + Complex.normSq (slowGauge M (Complex.I*(Z : ℂ))) := by + rw [Complex.normSq_eq_norm_sq,Complex.normSq_eq_norm_sq, + slowGauge_norm,slowGauge_norm] + simp only [Complex.neg_re,Complex.mul_re,Complex.I_re,Complex.I_im, + Complex.ofReal_re,Complex.ofReal_im,mul_zero,zero_mul,sub_zero,neg_zero, + zero_div,Real.exp_zero,one_mul,neg_mul,norm_neg] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularKineticDerivative.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularKineticDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..733ef192d7f7d4134e4a1e73b5344effdece0ab9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularKineticDerivative.lean @@ -0,0 +1,91 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HighAngularGeometry + +namespace OAI + +/-! Derivatives of the kinetic coefficient and of its real and imaginary parts. -/ + +namespace DefocusingNLS + +theorem hasDerivAt_kineticCoefficient (γ g : ℝ → ℂ) (t : ℝ) (C : ℂ) + (hγ : HasDerivAt γ (g t) t) (hg : HasDerivAt g (-C*g t) t) (hg0 : g t ≠ 0) : + HasDerivAt (fun s => γ s/(g s)^2) + (1/g t+2*C*(γ t/(g t)^2)) t := by + convert! hγ.div (hg.pow 2) (pow_ne_zero 2 hg0) using 1 + simp only [Pi.pow_apply] + field_simp [hg0] + ring + +theorem hasDerivAt_highArcKinetic (Z h t : ℝ) (hh : h=1 ∨ h= -1) : + HasDerivAt (fun s => highArcPoint Z h s/(highArcTangent h s)^2) + ((Real.cos (2*t)-4*highArcN Z (2*t) : ℝ)+ + Complex.I*(h*(Real.sin (2*t)+4*highArcL Z (2*t)) : ℝ)) t := by + have hn := highArcTangent_normSq h t hh + have hg0 : highArcTangent h t ≠ 0 := by + intro hz + rw [hz,Complex.normSq_zero] at hn + norm_num at hn + have hd := hasDerivAt_kineticCoefficient (highArcPoint Z h) (highArcTangent h) t + (Complex.I*(h*2 : ℝ)) (hasDerivAt_highArcPoint Z h t) + (by convert! hasDerivAt_highArcTangent h t hh using 1; ring) hg0 + convert! hd using 1 + rw [highArc_kinetic_coefficient Z h t hh,one_div] + have hinv : (highArcTangent h t)⁻¹=star (highArcTangent h t) := by + apply Complex.inv_eq_conj + rw [Complex.normSq_eq_norm_sq] at hn + nlinarith [norm_nonneg (highArcTangent h t)] + rw [hinv] + rcases hh with rfl | rfl <;> apply Complex.ext <;> + simp only [highArcTangent,Complex.add_re,Complex.add_im,Complex.sub_re,Complex.sub_im, + Complex.mul_re,Complex.mul_im,Complex.ofReal_re,Complex.ofReal_im, + Complex.I_re,Complex.I_im,Complex.star_def,Complex.conj_re,Complex.conj_im] <;> norm_num <;> ring + +theorem hasDerivAt_highRayKinetic (Z h t : ℝ) (hh : h=1 ∨ h= -1) : + HasDerivAt (fun s => highRayPoint Z h s/(highRayTangent h)^2) + ((99/101 : ℂ)+Complex.I*(h*(20/101) : ℝ)) t := by + have hn := highRayTangent_normSq h hh + have hg0 : highRayTangent h ≠ 0 := by + intro hz + rw [hz,Complex.normSq_zero] at hn + norm_num at hn + have hd := (hasDerivAt_highRayPoint Z h t).div_const ((highRayTangent h)^2) + convert! hd using 1 + have hinv : (highRayTangent h)⁻¹=star (highRayTangent h) := by + apply Complex.inv_eq_conj + rw [Complex.normSq_eq_norm_sq] at hn + nlinarith [norm_nonneg (highRayTangent h)] + have hdiv : highRayTangent h/(highRayTangent h)^2=(highRayTangent h)⁻¹ := by + field_simp + rw [hdiv,hinv] + simp [highRayTangent] + +theorem hasDerivAt_highArcL (Z t : ℝ) : + HasDerivAt (fun s => highArcL Z (2*s)) + (Real.cos (2*t)-4*highArcN Z (2*t)) t := by + have hd := Complex.reCLM.hasFDerivAt.comp_hasDerivAt t + (hasDerivAt_highArcKinetic Z 1 t (Or.inl rfl)) + convert! hd using 1 + · ext s + change highArcL Z (2*s) = (highArcPoint Z 1 s/(highArcTangent 1 s)^2).re + rw [highArc_kinetic_coefficient Z 1 s (Or.inl rfl)] + simp + · simp only [Complex.reCLM_apply,Complex.add_re,Complex.mul_re,Complex.ofReal_re, + Complex.ofReal_im,Complex.I_re,Complex.I_im] + ring + +theorem hasDerivAt_highArcN (Z t : ℝ) : + HasDerivAt (fun s => highArcN Z (2*s)) + (Real.sin (2*t)+4*highArcL Z (2*t)) t := by + have hd := Complex.imCLM.hasFDerivAt.comp_hasDerivAt t + (hasDerivAt_highArcKinetic Z 1 t (Or.inl rfl)) + convert! hd using 1 + · ext s + change highArcN Z (2*s) = (highArcPoint Z 1 s/(highArcTangent 1 s)^2).im + rw [highArc_kinetic_coefficient Z 1 s (Or.inl rfl)] + simp + · simp only [Complex.imCLM_apply,Complex.add_im,Complex.mul_im,Complex.ofReal_re, + Complex.ofReal_im,Complex.I_re,Complex.I_im] + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularMatching.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularMatching.lean new file mode 100644 index 0000000000000000000000000000000000000000..e8e50bf8e1d1337087dd7a743677a43e1b283511 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularMatching.lean @@ -0,0 +1,62 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HighAngularInitialFlux +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HomotopyCone + +namespace OAI + +/-! Matched nonzero outgoing jets are incompatible with the high-angular flux sign. -/ + +namespace DefocusingNLS + +theorem highAngular_matched_jets_impossible (qp qm : ℂ) (M : ℕ) (Z : ℝ) + (hqp : -1 < qp.re) (hqm : -1 < qm.re) (hM : 9 ≤ M) + (hσp : -(1/32 : ℝ) ≤ 3-(((M : ℂ)+1)/2-qp).re) + (hσm : -(1/32 : ℝ) ≤ 3-(((M : ℂ)+1)/2-qm).re) + (hZ : 2704/1000 ≤ Z) (hZ' : Z ≤ 2706/1000) + (c : ℂ) + (hH : regularizedSlowSolution qm (M+1) (Complex.I*Z) = + c*regularizedSlowSolution qp (M+1) (-Complex.I*Z)) + (hD : deriv (regularizedSlowSolution qm (M+1)) (Complex.I*Z) = + c*deriv (regularizedSlowSolution qp (M+1)) (-Complex.I*Z)) : False := by + have hpneg := highArcActualFlux_initial_neg qp M Z 1 hqp (Or.inl rfl) hM hσp hZ hZ' + have hmneg := highArcActualFlux_initial_neg qm M Z (-1) hqm (Or.inr rfl) hM hσm hZ hZ' + have hp := highArcActualFlux_initial qp M Z 1 hqp (Or.inl rfl) hZ + have hm := highArcActualFlux_initial qm M Z (-1) hqm (Or.inr rfl) hZ + dsimp only at hp hm + simp only [one_mul,Complex.ofReal_neg,mul_neg,neg_mul,neg_neg] at hp hm + have hG := conjugate_boundary_gauge_normSq M Z + simp only [neg_mul] at hG hH hD + rw [hG] at hp + let K : ℝ := (M : ℝ)-2*Z + let H := regularizedSlowSolution qm (M+1) (Complex.I*Z) + let D := deriv (regularizedSlowSolution qm (M+1)) (Complex.I*Z) + have he : Complex.normSq c*highArcActualFlux qp M Z 1 0+highArcActualFlux qm M Z (-1) 0 = + Complex.normSq (slowGauge M (Complex.I*Z))* + (coneForm K (-Complex.I*Z) H D+coneForm K (Complex.I*Z) H D) := by + dsimp only [K,H,D] + simp only [neg_mul] + rw [hp,hm,hH,hD] + simp only [coneForm_scale] + ring + have hsum : coneForm K (-Complex.I*Z) H D+coneForm K (Complex.I*Z) H D = + K*Complex.normSq H := by + simp only [coneForm,Complex.mul_re,Complex.mul_im,Complex.neg_re,Complex.neg_im, + Complex.I_re,Complex.I_im,Complex.ofReal_re,Complex.ofReal_im] + ring + rw [hsum] at he + have hK : 0 ≤ K := by + have hMr : (9 : ℝ) ≤ M := by exact_mod_cast hM + dsimp [K] + linarith + have hnonneg : 0 ≤ Complex.normSq c*highArcActualFlux qp M Z 1 0+ + highArcActualFlux qm M Z (-1) 0 := by + rw [he] + exact mul_nonneg (Complex.normSq_nonneg _) (mul_nonneg hK (Complex.normSq_nonneg _)) + have hneg : Complex.normSq c*highArcActualFlux qp M Z 1 0+ + highArcActualFlux qm M Z (-1) 0 < 0 := + add_neg_of_nonpos_of_neg + (mul_nonpos_of_nonneg_of_nonpos (Complex.normSq_nonneg _) hpneg.le) hmneg + exact (not_lt_of_ge hnonneg) hneg + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularPathEquation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularPathEquation.lean new file mode 100644 index 0000000000000000000000000000000000000000..39a766c127cb46c135b89824d8bd8a737648f7b2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularPathEquation.lean @@ -0,0 +1,89 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HighAngularContour +import OAI.MathematicalPhysics.DefocusingNLS.Profile.SlowGaugedEquation + +namespace OAI + +/-! Chain rules and the actual gauged equation along a complex contour. -/ + +open Filter Topology +namespace DefocusingNLS + +theorem analyticOnNhd_slowGauge (M : ℕ) : + AnalyticOnNhd ℂ (slowGauge M) Complex.slitPlane := by + apply DifferentiableOn.analyticOnNhd _ Complex.isOpen_slitPlane + intro x hx + exact (hasDerivAt_slowGauge M x hx).differentiableAt.differentiableWithinAt + +theorem analyticOnNhd_gaugedSlowSolution (q : ℂ) (M : ℕ) (hq : -1 < q.re) : + AnalyticOnNhd ℂ (gaugedSlowSolution q M) Complex.slitPlane := + (analyticOnNhd_slowGauge M).mul + (analyticOnNhd_regularizedSlowSolution_slit q (M+1) hq) + +/-- The first two derivatives along a twice differentiable contour. -/ +theorem analytic_path_derivatives (F : ℂ → ℂ) (γ g : ℝ → ℂ) (s : ℝ) + (hF : AnalyticAt ℂ F (γ s)) (hγ : ∀ t, HasDerivAt γ (g t) t) + (g' : ℂ) (hg : HasDerivAt g g' s) : + deriv (fun t => F (γ t)) s = g s*deriv F (γ s) ∧ + deriv (deriv (fun t => F (γ t))) s = + g'*deriv F (γ s)+(g s)^2*deriv (deriv F) (γ s) := by + have h₁ : ∀ t, AnalyticAt ℂ F (γ t) → + HasDerivAt (fun r => F (γ r)) (g t*deriv F (γ t)) t := by + intro t ht + simpa only [Function.comp_def,smul_eq_mul] using + ht.differentiableAt.hasDerivAt.scomp t (hγ t) + have heq : deriv (fun t => F (γ t)) =ᶠ[𝓝 s] + (fun t => g t*deriv F (γ t)) := by + filter_upwards [(hγ s).continuousAt.tendsto.eventually hF.eventually_analyticAt] with t ht + exact (h₁ t ht).deriv + have h₂ : HasDerivAt (fun t => deriv F (γ t)) + (g s*deriv (deriv F) (γ s)) s := by + simpa only [Function.comp_def,smul_eq_mul] using + hF.deriv.differentiableAt.hasDerivAt.scomp s (hγ s) + refine ⟨(h₁ s hF).deriv,?_⟩ + have h := ((hg.mul h₂).congr_of_eventuallyEq heq).deriv + rw [h] + ring + +/-- The second chain rule as an actual derivative, for use in the flux derivative. -/ +theorem analytic_path_hasDerivAt_deriv (F : ℂ → ℂ) (γ g : ℝ → ℂ) (s : ℝ) + (hF : AnalyticAt ℂ F (γ s)) (hγ : ∀ t, HasDerivAt γ (g t) t) + (g' : ℂ) (hg : HasDerivAt g g' s) : + HasDerivAt (deriv (fun t => F (γ t))) + (g'*deriv F (γ s)+(g s)^2*deriv (deriv F) (γ s)) s := by + have heq : deriv (fun t => F (γ t)) =ᶠ[𝓝 s] + (fun t => g t*deriv F (γ t)) := by + filter_upwards [(hγ s).continuousAt.tendsto.eventually hF.eventually_analyticAt] with t ht + simpa only [Function.comp_def,smul_eq_mul] using + (ht.differentiableAt.hasDerivAt.scomp t (hγ t)).deriv + have h₂ : HasDerivAt (fun t => deriv F (γ t)) + (g s*deriv (deriv F) (γ s)) s := by + simpa only [Function.comp_def,smul_eq_mul] using + hF.deriv.differentiableAt.hasDerivAt.scomp s (hγ s) + convert! (hg.mul h₂).congr_of_eventuallyEq heq using 1 + ring + +/-- The Kummer gauge equation after changing to an arc-length contour. -/ +theorem gaugedSlowSolution_path_equation (q : ℂ) (M : ℕ) (γ g : ℝ → ℂ) + (s : ℝ) (C : ℂ) (hq : -1 < q.re) + (hx : 0 ≤ (γ s).re) (hx0 : γ s ≠ 0) (hg0 : g s ≠ 0) + (hγ : ∀ t, HasDerivAt γ (g t) t) (hg : HasDerivAt g (-C*g s) s) : + -(γ s/(g s)^2)*deriv (deriv (fun t => gaugedSlowSolution q M (γ t))) s- + (1/g s+C*(γ s/(g s)^2))*deriv (fun t => gaugedSlowSolution q M (γ t)) s+ + (γ s/4+(M : ℂ)^2/(4*γ s))*gaugedSlowSolution q M (γ s) = + (((M : ℂ)+1)/2-q)*gaugedSlowSolution q M (γ s) := by + have hs : γ s ∈ Complex.slitPlane := by + apply Complex.mem_slitPlane_iff.mpr + rcases hx.eq_or_lt with he | he + · exact Or.inr (fun hi => hx0 (Complex.ext he.symm hi)) + · exact Or.inl he + obtain ⟨h₁,h₂⟩ := analytic_path_derivatives (gaugedSlowSolution q M) γ g s + (analyticOnNhd_gaugedSlowSolution q M hq (γ s) hs) hγ (-C*g s) hg + rw [h₁,h₂] + have hODE := gaugedSlowSolution_equation q M (γ s) hq hx hx0 + convert! hODE using 1 + field_simp [hg0] + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularRay.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularRay.lean new file mode 100644 index 0000000000000000000000000000000000000000..deff3667e3ee360d21b07f8f41e6b7ae64352577 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularRay.lean @@ -0,0 +1,88 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HighAngularCertificate + +namespace OAI + +/-! The positive multiplier potential on the straight part of the high-angular contour. -/ + +namespace DefocusingNLS + +noncomputable def highRayU (t : ℝ) : ℝ := 10/101+(99/101)*t +noncomputable def highRayV (Z t : ℝ) : ℝ := Z+1/101+(20/101)*t +noncomputable def highRayL (Z t : ℝ) : ℝ := + ((9401 : ℝ)*highRayU t+3960*highRayV Z t)/10201 + +noncomputable def highRayPotential (σ M Z t : ℝ) : ℝ := + σ-3+highRayU t/4+ + M^2*highRayU t/(4*(highRayU t^2+highRayV Z t^2))+ + 5/(1+(3/2)*t)^2-(-3/2+(11/4)*t)^2/(highRayL Z t*(1+(3/2)*t)^2) + +theorem highRay_bounds (Z t : ℝ) (hZ : 2704/1000 ≤ Z) (hZ' : Z ≤ 2706/1000) + (ht : 0 ≤ t) : + 99/1000+(98/100)*t ≤ highRayU t ∧ + highRayU t ≤ 1/10+(981/1000)*t ∧ + 0 < highRayV Z t ∧ highRayV Z t ≤ 272/100+(1/5)*t ∧ + 113/100+(98/100)*t ≤ highRayL Z t := by + dsimp only [highRayU,highRayV,highRayL] + constructor + · linarith + constructor + · linarith + constructor + · linarith + constructor <;> linarith + +theorem highRayPotential_pos (σ M Z t : ℝ) + (hσ : -(1/32 : ℝ) ≤ σ) (hM : 9 ≤ M) + (hZ : 2704/1000 ≤ Z) (hZ' : Z ≤ 2706/1000) (ht : 0 ≤ t) : + 0 < highRayPotential σ M Z t := by + let u₀ : ℝ := 99/1000+(98/100)*t + let L₀ : ℝ := 113/100+(98/100)*t + let d₀ : ℝ := (1/10+(981/1000)*t)^2+(272/100+(1/5)*t)^2 + let q₀ : ℝ := 1+(3/2)*t + let A : ℝ := -3/2+(11/4)*t + obtain ⟨hu,hu',hv,hv',hL⟩ := highRay_bounds Z t hZ hZ' ht + have huBound : u₀ ≤ highRayU t := hu + have hu₀ : 0 < u₀ := by dsimp [u₀]; positivity + have hL₀ : 0 < L₀ := by dsimp [L₀]; positivity + have hd₀ : 0 < d₀ := by dsimp [d₀]; positivity + have hq₀ : 0 < q₀ := by dsimp [q₀]; positivity + have huPos : 0 < highRayU t := lt_of_lt_of_le hu₀ hu + have hD : 0 < highRayU t^2+highRayV Z t^2 := by positivity + have hDb : highRayU t^2+highRayV Z t^2 ≤ d₀ := by + have huSq := (sq_le_sq₀ huPos.le (by positivity : 0 ≤ 1/10+(981/1000)*t)).mpr hu' + have hvSq := (sq_le_sq₀ hv.le (by positivity : 0 ≤ 272/100+(1/5)*t)).mpr hv' + exact add_le_add huSq hvSq + have hLPos : 0 < highRayL Z t := lt_of_lt_of_le hL₀ hL + have hM2 : 81 ≤ M^2 := by nlinarith + have hAngular : 81*u₀/(4*d₀) ≤ + M^2*highRayU t/(4*(highRayU t^2+highRayV Z t^2)) := by + apply (div_le_div_iff₀ (by positivity) (by positivity)).mpr + have hnum : 81*u₀ ≤ M^2*highRayU t := + mul_le_mul hM2 hu hu₀.le (sq_nonneg M) + have hprod := mul_le_mul (show 4*(highRayU t^2+highRayV Z t^2) ≤ 4*d₀ by linarith) + hnum (by positivity) (by positivity) + nlinarith + have hNegative : A^2/(highRayL Z t*q₀^2) ≤ A^2/(L₀*q₀^2) := by + apply (div_le_div_iff₀ (by positivity) (by positivity)).mpr + exact mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_right hL (sq_nonneg _)) + (sq_nonneg A) + let V₀ : ℝ := -3-1/32+u₀/4+81*u₀/(4*d₀)+5/q₀^2-A^2/(L₀*q₀^2) + have hV : V₀ ≤ highRayPotential σ M Z t := by + change -3-1/32+u₀/4+81*u₀/(4*d₀)+5/q₀^2-A^2/(L₀*q₀^2) ≤ + σ-3+highRayU t/4+M^2*highRayU t/(4*(highRayU t^2+highRayV Z t^2))+ + 5/q₀^2-A^2/(highRayL Z t*q₀^2) + linarith + have hP : V₀*L₀*d₀*q₀^2 = highAngularPolynomial t := by + dsimp only [V₀,highAngularPolynomial,u₀,L₀,d₀,q₀,A] + field_simp [ne_of_gt hd₀,ne_of_gt hL₀,ne_of_gt hq₀] + have hpos := highAngularPolynomial_pos ht + rw [← hP] at hpos + have hV₀ : 0 < V₀ := by + have h₃ := (mul_pos_iff_of_pos_right (sq_pos_of_pos hq₀)).mp hpos + have h₂ := (mul_pos_iff_of_pos_right hd₀).mp h₃ + exact (mul_pos_iff_of_pos_right hL₀).mp h₂ + exact lt_of_lt_of_le hV₀ hV + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularRayDecay.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularRayDecay.lean new file mode 100644 index 0000000000000000000000000000000000000000..51c0084fef7cfbb2098eb302b4054fb50f2ea005 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularRayDecay.lean @@ -0,0 +1,74 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HighAngularGeometry +import OAI.MathematicalPhysics.DefocusingNLS.Profile.SlowGaugeDerivativeGrowth +import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics + +namespace OAI + +/-! Exponential decay on the actual outgoing rays, with a polynomial weight. -/ + +open Filter Topology +namespace DefocusingNLS + +theorem highRay_norm_bounds (Z h t : ℝ) (hh : h=1 ∨ h= -1) + (hZ : 2704/1000 ≤ Z) (hZ' : Z ≤ 2706/1000) (ht : 2 ≤ t) : + 1 ≤ ‖highRayPoint Z h t‖ ∧ ‖highRayPoint Z h t‖ ≤ 5*t ∧ + (98/100)*t ≤ (highRayPoint Z h t).re := by + obtain ⟨hu,hu',hv,hv',_⟩ := highRay_bounds Z t hZ hZ' (by linarith) + have hure : (highRayPoint Z h t).re=highRayU t := highRayPoint_re Z h t + have hlower : (highRayPoint Z h t).re ≤ ‖highRayPoint Z h t‖ := + (le_abs_self _).trans (Complex.abs_re_le_norm _) + refine ⟨by linarith,?_,by linarith⟩ + have hn := Complex.norm_le_abs_re_add_abs_im (highRayPoint Z h t) + have hu0 : 0 ≤ highRayU t := by linarith + rcases hh with rfl | rfl <;> + simp [highRayPoint,abs_of_nonneg hu0,abs_of_pos hv] at hn ⊢ <;> linarith + +theorem highRay_envelope_tendsto_zero (f : ℂ → ℂ) (p C : ℝ) (k : ℕ) + (hp : 0 ≤ p) (hC : 0 ≤ C) + (hbound : ∀ x : ℂ, 0 ≤ x.re → 1 ≤ ‖x‖ → + ‖f x‖ ≤ C*Real.exp (-x.re/2)*‖x‖^p) + (Z h : ℝ) (hh : h=1 ∨ h= -1) + (hZ : 2704/1000 ≤ Z) (hZ' : Z ≤ 2706/1000) : + Tendsto (fun t : ℝ => (t : ℂ)^k*f (highRayPoint Z h t)) atTop (𝓝 0) := by + have hlim := (tendsto_rpow_mul_exp_neg_mul_atTop_nhds_zero + ((k : ℝ)+p) (49/100) (by norm_num)).const_mul (C*5^p) + simp only [mul_zero] at hlim + apply squeeze_zero_norm' _ hlim + filter_upwards [eventually_ge_atTop (2 : ℝ)] with t ht + obtain ⟨hn,hn',hr⟩ := highRay_norm_bounds Z h t hh hZ hZ' ht + have ht0 : 0 ≤ t := by linarith + have hx0 : 0 ≤ (highRayPoint Z h t).re := by linarith + have hexp : Real.exp (-(highRayPoint Z h t).re/2) ≤ Real.exp (-(49/100)*t) := + Real.exp_le_exp.mpr (by linarith) + have hpbound := Real.rpow_le_rpow (norm_nonneg (highRayPoint Z h t)) hn' hp + calc + _ = t^k*‖f (highRayPoint Z h t)‖ := by + rw [norm_mul,norm_pow,Complex.norm_real,Real.norm_of_nonneg ht0] + _ ≤ t^k*(C*Real.exp (-(highRayPoint Z h t).re/2)*‖highRayPoint Z h t‖^p) := + mul_le_mul_of_nonneg_left (hbound _ hx0 hn) (pow_nonneg ht0 k) + _ ≤ t^k*(C*Real.exp (-(49/100)*t)*(5*t)^p) := by + gcongr + _ = C*5^p*(t^((k : ℝ)+p)*Real.exp (-(49/100)*t)) := by + rw [Real.mul_rpow (by norm_num) ht0,Real.rpow_add (by linarith : 0 < t), + Real.rpow_natCast] + ring + +theorem highRay_gaugedSlowSolution_decay (q : ℂ) (M k : ℕ) (hq : -1 < q.re) + (Z h : ℝ) (hh : h=1 ∨ h= -1) + (hZ : 2704/1000 ≤ Z) (hZ' : Z ≤ 2706/1000) : + Tendsto (fun t : ℝ => (t : ℂ)^k*gaugedSlowSolution q M (highRayPoint Z h t)) + atTop (𝓝 0) := by + obtain ⟨C,hC,hbound⟩ := gaugedSlowSolution_polynomial_envelope q M hq + exact highRay_envelope_tendsto_zero _ _ C k (by positivity) hC hbound Z h hh hZ hZ' + +theorem highRay_gaugedSlowSolution_derivative_decay (q : ℂ) (M k : ℕ) + (hq : -1 < q.re) (Z h : ℝ) (hh : h=1 ∨ h= -1) + (hZ : 2704/1000 ≤ Z) (hZ' : Z ≤ 2706/1000) : + Tendsto (fun t : ℝ => (t : ℂ)^k*deriv (gaugedSlowSolution q M) (highRayPoint Z h t)) + atTop (𝓝 0) := by + obtain ⟨C,hC,hbound⟩ := gaugedSlowSolution_derivative_polynomial_envelope q M hq + exact highRay_envelope_tendsto_zero _ _ C k (by positivity) hC hbound Z h hh hZ hZ' + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularRayFlux.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularRayFlux.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f9c2f1afee631dbcba5f842b28334128d89fd72 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularRayFlux.lean @@ -0,0 +1,103 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HighAngularActualFlux +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HighAngularRayDecay + +namespace OAI + +/-! The actual positive flux on the straight outgoing contour. -/ + +namespace DefocusingNLS + +noncomputable def highRayWave (q : ℂ) (M : ℕ) (Z h : ℝ) (t : ℝ) : ℂ := + gaugedSlowSolution q M (highRayPoint Z h t) + +noncomputable def highRayActualFlux (q : ℂ) (M : ℕ) (Z h : ℝ) : ℝ → ℝ := + highAngularFlux (fun t => highRayPoint Z h t/(highRayTangent h)^2) + highRayCorrection (highRayWave q M Z h) + +theorem highRayWave_deriv (q : ℂ) (M : ℕ) (Z h t : ℝ) + (hq : -1 < q.re) (ht : 0 ≤ t) : + deriv (highRayWave q M Z h) t = + highRayTangent h*deriv (gaugedSlowSolution q M) (highRayPoint Z h t) := by + have hx : 0 ≤ (highRayPoint Z h t).re := by + rw [highRayPoint_re] + dsimp [highRayU] + positivity + have hd := (hasDerivAt_gaugedSlowSolution q M (highRayPoint Z h t) hq hx + (highRayPoint_ne_zero Z h t ht)).differentiableAt.hasDerivAt + change deriv (fun s : ℝ => gaugedSlowSolution q M (highRayPoint Z h s)) t = + highRayTangent h*deriv (gaugedSlowSolution q M) (highRayPoint Z h t) + simpa only [Function.comp_def,smul_eq_mul] using + (hd.scomp t (hasDerivAt_highRayPoint Z h t)).deriv + +theorem hasDerivAt_highRayActualFlux (q : ℂ) (M : ℕ) (Z h t : ℝ) + (hq : -1 < q.re) (hh : h=1 ∨ h= -1) + (hZ : 2704/1000 ≤ Z) (hZ' : Z ≤ 2706/1000) (ht : 0 ≤ t) : + HasDerivAt (highRayActualFlux q M Z h) + (highRayL Z t*Complex.normSq + (deriv (highRayWave q M Z h) t+ + (highRayCorrection t/highRayL Z t : ℝ)*highRayWave q M Z h t)+ + highRayPotential (3-(((M : ℂ)+1)/2-q).re) (M : ℝ) Z t* + Complex.normSq (highRayWave q M Z h t)) t := by + let γ := highRayPoint Z h + let g := fun _ : ℝ => highRayTangent h + let U := highRayWave q M Z h + let A := fun s => γ s/(g s)^2 + let E : ℂ := ((M : ℂ)+1)/2-q + let V : ℂ := γ t/4+(M : ℂ)^2/(4*γ t) + obtain ⟨hu,_,hv,_,hL⟩ := highRay_bounds Z t hZ hZ' ht + have hu0 : 0 < highRayU t := by linarith + have hL0 : highRayL Z t ≠ 0 := by linarith + have hx : 0 ≤ (γ t).re := by rw [highRayPoint_re]; exact hu0.le + have hx0 : γ t ≠ 0 := highRayPoint_ne_zero Z h t ht + have hs : γ t ∈ Complex.slitPlane := by + apply Complex.mem_slitPlane_iff.mpr + left + rw [highRayPoint_re] + exact hu0 + have hg0 : g t ≠ 0 := by + intro hz + have hn := highRayTangent_normSq h hh + change Complex.normSq (g t)=1 at hn + rw [hz,Complex.normSq_zero] at hn + norm_num at hn + have hg : HasDerivAt g (-(0 : ℂ)*g t) t := by simpa using hasDerivAt_const t (highRayTangent h) + have hF := analyticOnNhd_gaugedSlowSolution q M hq (γ t) hs + have hU : HasDerivAt U (deriv U t) t := + (hF.differentiableAt.hasDerivAt.scomp t (hasDerivAt_highRayPoint Z h t)).differentiableAt.hasDerivAt + have hU' : HasDerivAt (deriv U) (deriv (deriv U) t) t := + (analytic_path_hasDerivAt_deriv (gaugedSlowSolution q M) γ g t hF + (hasDerivAt_highRayPoint Z h) (-(0 : ℂ)*g t) hg).differentiableAt.hasDerivAt + have hA := hasDerivAt_kineticCoefficient γ g t 0 (hasDerivAt_highRayPoint Z h t) hg hg0 + have hODE := gaugedSlowSolution_path_equation q M γ g t 0 hq hx hx0 hg0 + (hasDerivAt_highRayPoint Z h) hg + change -A t*deriv (deriv U) t-(1/g t+0*A t)*deriv U t+V*U t=E*U t at hODE + have hd := hasDerivAt_highAngularFlux_completed A highRayCorrection U t + (highRayL Z t) (highRayN Z t) (highRayCorrection t/highRayL Z t) + (5/(1+(3/2)*t)^2) 0 0 h (1/g t) V E (deriv U t) (deriv (deriv U) t) hh + (highRay_kinetic_coefficient Z h t hh) + (by field_simp [hL0]; ring) + (by simpa using hA) (by simpa using hasDerivAt_highRayCorrection t ht) + hU hU' (by simpa only [mul_zero,zero_mul,sub_zero,add_zero,Complex.ofReal_zero] using hODE) + have hV : V.re = highRayU t/4+ + (M : ℝ)^2*highRayU t/(4*(highRayU t^2+highRayV Z t^2)) := by + convert! highAngular_radialPotential_re (highRayU t) (highRayV Z t) h M hh hv.ne' using 1 + simp only [V,γ,highRayPoint,Complex.ofReal_mul,Complex.ofReal_natCast] + ring_nf + norm_num only [mul_zero,zero_mul,zero_div,Complex.ofReal_zero,sub_zero,add_zero,pow_two] at hd + have hc : V.re-E.re+5/(1+(3/2)*t)^2- + highRayL Z t*(highRayCorrection t/highRayL Z t)^2 = + highRayPotential (3-E.re) (M : ℝ) Z t := by + rw [hV] + dsimp only [highRayPotential] + rw [highRayCorrection_quotient t ht] + have hden : 1+(3/2)*t ≠ 0 := by positivity + field_simp [hL0,hden] + ring + simp only [pow_two] at hc + rw [hc] at hd + exact hd + + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularSquare.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularSquare.lean new file mode 100644 index 0000000000000000000000000000000000000000..047750fdbe0a00e7bda004e04081ac7a910df5c7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HighAngularSquare.lean @@ -0,0 +1,24 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ForwardHermitianForm + +namespace OAI + +/-! The square completion in the high-angular multiplier identity. -/ + +namespace DefocusingNLS + +theorem highAngular_completed_square (L N α θ' h : ℝ) (U V : ℂ) + (hh : h=1 ∨ h= -1) : + L*Complex.normSq V+ + ((Complex.I*(h*θ' : ℝ))*((L : ℂ)+Complex.I*(h*N : ℝ))*star U*V).re = + L*Complex.normSq (V+((α : ℂ)-Complex.I*(h*θ'/2 : ℝ))*U)- + (α*L+θ'*N/2)*(2*(star U*V).re)- + L*(α^2+θ'^2/4)*Complex.normSq U := by + rcases hh with rfl | rfl <;> + simp only [Complex.normSq_apply,Complex.mul_re,Complex.mul_im,Complex.add_re, + Complex.add_im,Complex.sub_re,Complex.sub_im,Complex.star_def,Complex.conj_re, + Complex.conj_im,Complex.ofReal_re,Complex.ofReal_im,Complex.I_re,Complex.I_im] <;> + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HomotopyCone.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HomotopyCone.lean new file mode 100644 index 0000000000000000000000000000000000000000..7b5d2b7bd92622432632740005cf0e062b0d9eb7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HomotopyCone.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.NormalizedTailHolomorphy +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ForwardMatching + +namespace OAI + +/-! # The terminal cone along the tail homotopy -/ + +namespace DefocusingNLS + +theorem coneForm_scale (M : ℝ) (s a B C : ℂ) : + coneForm M s (a * B) (a * C) = Complex.normSq a * coneForm M s B C := by + have he : s * star (a * B) * (a * C) = + (Complex.normSq a : ℂ) * (s * star B * C) := by + calc + _ = (a * star a) * (s * star B * C) := by rw [star_mul]; ring + _ = _ := by + have ha : a * star a = (Complex.normSq a : ℂ) := by + simpa only [starRingEnd_apply] using Complex.mul_conj a + rw [ha] + simp only [coneForm, Complex.normSq_mul, he, Complex.mul_re, + Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero] + ring + +theorem coneForm_ratio (M : ℝ) (s B C : ℂ) (hC : C ≠ 0) : + coneForm M s (B / C) 1 = Complex.normSq C⁻¹ * coneForm M s B C := by + have h := coneForm_scale M s C⁻¹ B C + simpa only [inv_mul_cancel₀ hC, div_eq_mul_inv, mul_comm C⁻¹ B] using h + +theorem coneForm_real_contraction (M : ℝ) (s R : ℂ) (ρ : ℝ) : + coneForm M s ((ρ : ℂ) * R) 1 = + ρ * coneForm M s R 1 - M / 2 * ρ * (1 - ρ) * Complex.normSq R := by + simp only [coneForm, Complex.normSq_apply, Complex.mul_re, Complex.mul_im, + Complex.star_def, Complex.conj_re, Complex.conj_im, Complex.ofReal_re, + Complex.ofReal_im, Complex.one_re, Complex.one_im] + ring + +theorem coneForm_nonpos_of_contraction (M : ℝ) (s R : ℂ) (ρ : ℝ) + (hM : 0 ≤ M) (hR : coneForm M s R 1 < 0) (hρ : 0 ≤ ρ) (hρ1 : ρ ≤ 1) : + coneForm M s ((ρ : ℂ) * R) 1 ≤ 0 := by + rw [coneForm_real_contraction] + have h₁ : ρ * coneForm M s R 1 ≤ 0 := mul_nonpos_of_nonneg_of_nonpos hρ hR.le + have h₂ : 0 ≤ M / 2 * ρ * (1 - ρ) * Complex.normSq R := + mul_nonneg (mul_nonneg (mul_nonneg (div_nonneg hM (by norm_num)) hρ) + (by linarith)) (Complex.normSq_nonneg R) + linarith + +theorem slowTailRatio_strict_cone (σ : ℝ) (ℓ K : ℕ) (q s : ℂ) + (hσ : -(1 / 32 : ℝ) ≤ σ) (hK : 3 ≤ K) + (hq : q.re = σ + (ℓ : ℝ) / 2) (hsre : s.re = 0) (hsim : s.im ≠ 0) : + coneForm ((ℓ : ℝ) + 5) s (slowTailRatio q (ℓ + 6) K s) 1 < 0 := by + have h := normalizedSlow_strict_cone σ ℓ K q s hσ hK hq hsre hsim + have hC := (normalizedSlow_tail_disk σ ℓ K q s hσ hK hq hsre hsim).1 + have hq' : -1 < q.re := by rw [hq]; linarith [Nat.cast_nonneg (α := ℝ) ℓ] + have hp := shiftedPochhammer_ne_zero q (K - 1) hq' + have hquot : slowTailRatio q (ℓ + 6) K s = + normalizedSlowB q (ℓ + 6) s K / normalizedSlowC q (ℓ + 6) s K := by + unfold slowTailRatio normalizedMatchingB normalizedMatchingC + field_simp [hp] + rw [hquot, coneForm_ratio _ _ _ _ hC] + exact mul_neg_of_pos_of_neg (Complex.normSq_pos.mpr (inv_ne_zero hC)) h + +/-- Every terminal pair in the straight tail homotopy has nonpositive cone. -/ +theorem slowTailRatio_homotopy_cone (σ : ℝ) (ℓ K : ℕ) (q s : ℂ) (ρ : ℝ) + (hσ : -(1 / 32 : ℝ) ≤ σ) (hK : 3 ≤ K) + (hq : q.re = σ + (ℓ : ℝ) / 2) (hsre : s.re = 0) (hsim : s.im ≠ 0) + (hρ : 0 ≤ ρ) (hρ1 : ρ ≤ 1) : + coneForm ((ℓ : ℝ) + 5) s ((ρ : ℂ) * slowTailRatio q (ℓ + 6) K s) 1 ≤ 0 := + coneForm_nonpos_of_contraction _ _ _ _ (by positivity) + (slowTailRatio_strict_cone σ ℓ K q s hσ hK hq hsre hsim) hρ hρ1 + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HorizontalCompactification.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HorizontalCompactification.lean new file mode 100644 index 0000000000000000000000000000000000000000..079bedd1e5783922f2c473c4255d811891fac55b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HorizontalCompactification.lean @@ -0,0 +1,88 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ForwardConeMonotonicity + +namespace OAI + +/-! # The forward recurrence at inverse imaginary frequency zero -/ + +open Matrix + +namespace DefocusingNLS + +noncomputable def horizontalDifference (ell n : ℕ) (h σ b Z τ : ℝ) (B C : ℂ) : ℂ := + -((τ : ℂ) * ((ell : ℂ) + 5) * B + (h : ℂ) * Complex.I * Z * C) / + (Complex.I + (τ : ℂ) * + ((((σ + (ell : ℝ) / 2 + n - ((ell : ℝ) + 5) : ℝ) : ℂ)) - + (h : ℂ) * Complex.I * b)) + +noncomputable def horizontalState (ell : ℕ) (h σ b Z τ : ℝ) (B C : ℂ) : ℕ → ℂ × ℂ + | 0 => (B, C) + | n + 1 => + let bc := horizontalState ell h σ b Z τ B C n + let B' := bc.1 - horizontalDifference ell n h σ b Z τ bc.1 bc.2 + (B', bc.2 - (τ : ℂ) * B') + +theorem horizontalDifference_zero (ell n : ℕ) (h σ b Z : ℝ) (B C : ℂ) : + horizontalDifference ell n h σ b Z 0 B C = -(h : ℂ) * Z * C := by + simp only [horizontalDifference, Complex.ofReal_zero, zero_mul, zero_add, add_zero] + apply (div_eq_iff Complex.I_ne_zero).mpr + calc + -((h : ℂ) * Complex.I * Z * C) = + (-(h : ℂ) * Z * C) * Complex.I := by ring + +theorem horizontalState_zero (ell n : ℕ) (h σ b Z : ℝ) (B C : ℂ) : + horizontalState ell h σ b Z 0 B C n = (B + n * (h : ℂ) * Z * C, C) := by + induction n with + | zero => simp [horizontalState] + | succ n ih => + rw [horizontalState, ih, horizontalDifference_zero] + simp only [Complex.ofReal_zero, zero_mul, sub_zero] + congr 1 + push_cast + ring + +noncomputable def horizontalIncrementSum (ell : ℕ) (h σ b Z τ : ℝ) + (B C : ℂ) (N : ℕ) : ℝ := + ∑ n ∈ Finset.range N, (σ + n - 5 / 2) * Complex.normSq + (horizontalDifference ell n h σ b Z τ + (horizontalState ell h σ b Z τ B C n).1 + (horizontalState ell h σ b Z τ B C n).2) + +theorem horizontalIncrementSum_zero (ell N : ℕ) (h σ b Z : ℝ) (B C : ℂ) : + horizontalIncrementSum ell h σ b Z 0 B C N = + ((N : ℝ) * σ + (N : ℝ) * (N - 1 : ℝ) / 2 - (N : ℝ) * (5 / 2)) * + (h ^ 2 * Z ^ 2 * Complex.normSq C) := by + simp only [horizontalIncrementSum, horizontalState_zero, horizontalDifference_zero] + have hn : Complex.normSq (-(h : ℂ) * Z * C) = h ^ 2 * Z ^ 2 * Complex.normSq C := by + simp [Complex.normSq_mul, Complex.normSq_neg, Complex.normSq_ofReal, pow_two] + simp only [hn] + induction N with + | zero => simp + | succ N ih => + rw [Finset.sum_range_succ, ih] + push_cast + ring + +/-- The horizontal limiting form is uniformly positive in the counting strip. +No asymptotic assumption is used: this is the exact value at inverse frequency zero. -/ +theorem horizontal_limiting_form_pos (ell : ℕ) (σ b Z : ℝ) (B C : ℂ) + (hσ : -(1 / 32 : ℝ) ≤ σ) (hZ : Z ≠ 0) (hBC : B ≠ 0 ∨ C ≠ 0) : + 0 < ((ell : ℝ) + 5) * Complex.normSq B + + horizontalIncrementSum ell 1 σ b Z 0 B C 8 + + horizontalIncrementSum ell (-1) σ b Z 0 B C 8 := by + rw [horizontalIncrementSum_zero, horizontalIncrementSum_zero] + norm_num + have hM : 0 < (ell : ℝ) + 5 := by positivity + have hcoef : 0 < 8 * σ + 8 := by linarith + have hZ2 : 0 < Z ^ 2 := sq_pos_of_ne_zero hZ + rcases hBC with hB | hC + · have hp := mul_pos hM (Complex.normSq_pos.mpr hB) + have hn : 0 ≤ (8 * σ + 8) * (Z ^ 2 * Complex.normSq C) := + mul_nonneg hcoef.le (mul_nonneg hZ2.le (Complex.normSq_nonneg C)) + nlinarith + · have hp := mul_pos hcoef (mul_pos hZ2 (Complex.normSq_pos.mpr hC)) + have hn := mul_nonneg hM.le (Complex.normSq_nonneg B) + nlinarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HorizontalConeIdentity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HorizontalConeIdentity.lean new file mode 100644 index 0000000000000000000000000000000000000000..0e946995bd7f8ebce8d91dc41ab8dd5d7956157c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HorizontalConeIdentity.lean @@ -0,0 +1,56 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HorizontalForwardLink +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HorizontalContinuity +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.RightMatchingExclusion + +namespace OAI + +/-! # Identification of the horizontal form with the two forward cones -/ + +open Matrix Polynomial + +namespace DefocusingNLS + +noncomputable def horizontalCone (ell : ℕ) (h σ b Z v : ℝ) (B C : ℂ) : ℝ := + matrixCone ((ell : ℝ) + 5) ((h : ℂ) * Complex.I * Z) + (normalizedForwardMatrix (ell + 5) ((h : ℂ) * Complex.I * Z) + (horizontalQ ell h σ b v) 8) ![B, (v : ℂ) * C] + +theorem horizontalCone_eq_increment (ell : ℕ) (h σ b Z v : ℝ) (B C : ℂ) + (hv : v ≠ 0) (hd : ∀ n : ℕ, horizontalQ ell h σ b v + n - (ell + 5) ≠ 0) : + horizontalCone ell h σ b Z v B C = + coneForm ((ell : ℝ) + 5) ((h : ℂ) * Complex.I * Z) B ((v : ℂ) * C) + + horizontalIncrementSum ell h σ b Z v⁻¹ B C 8 := by + have he := normalizedForwardJet_cone_sum ell 8 h σ b Z v hv hd B C + simpa only [normalizedForwardJet_eq_mulVec, horizontalCone, matrixCone] using he + +theorem horizontalFormAt_eq_cones (ell : ℕ) (σ b Z v : ℝ) (B C : ℂ) (hv : v ≠ 0) + (hd₁ : ∀ n : ℕ, horizontalQ ell 1 σ b v + n - (ell + 5) ≠ 0) + (hd₂ : ∀ n : ℕ, horizontalQ ell (-1) σ b v + n - (ell + 5) ≠ 0) : + horizontalFormAt ell (v⁻¹, σ, b, Z, B, C) = + horizontalCone ell 1 σ b Z v B C + horizontalCone ell (-1) σ b Z v B C := by + rw [horizontalCone_eq_increment ell 1 σ b Z v B C hv hd₁, + horizontalCone_eq_increment ell (-1) σ b Z v B C hv hd₂] + have hi : coneForm ((ell : ℝ) + 5) ((1 : ℂ) * Complex.I * Z) B ((v : ℂ) * C) + + coneForm ((ell : ℝ) + 5) ((-1 : ℂ) * Complex.I * Z) B ((v : ℂ) * C) = + ((ell : ℝ) + 5) * Complex.normSq B := by + simp [coneForm] + ring + change ((ell : ℝ) + 5) * Complex.normSq B + _ + _ = _ + norm_num only [Complex.ofReal_neg, Complex.ofReal_one] + linear_combination -hi + +theorem ascPochhammer_eval_ne_zero_of_im_ne_zero (q : ℂ) (N : ℕ) (hq : q.im ≠ 0) : + (ascPochhammer ℂ N).eval q ≠ 0 := by + induction N with + | zero => simp + | succ N ih => + rw [ascPochhammer_succ_eval] + apply mul_ne_zero ih + intro h + apply hq + have hi := congrArg Complex.im h + simpa using hi + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HorizontalContinuity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HorizontalContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..257e7b3378907cc9d525623510f9d2f4b3c4858d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HorizontalContinuity.lean @@ -0,0 +1,89 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HorizontalCompactification +import Mathlib.Topology.Compactness.Compact + +namespace OAI + +/-! # Joint continuity of the compactified finite recurrence -/ + +open Filter Topology + +namespace DefocusingNLS + +/-- Real spectral part, shift, coupling, and the two normalized initial coordinates. -/ +abbrev HorizontalParameters := ℝ × ℝ × ℝ × ℂ × ℂ + +noncomputable def horizontalStateAt (ell : ℕ) (h : ℝ) (n : ℕ) + (x : ℝ × HorizontalParameters) : ℂ × ℂ := + horizontalState ell h x.2.1 x.2.2.1 x.2.2.2.1 x.1 x.2.2.2.2.1 x.2.2.2.2.2 n + +noncomputable def horizontalDifferenceAt (ell n : ℕ) (h : ℝ) + (x : ℝ × HorizontalParameters) : ℂ := + horizontalDifference ell n h x.2.1 x.2.2.1 x.2.2.2.1 x.1 + (horizontalStateAt ell h n x).1 (horizontalStateAt ell h n x).2 + +theorem continuousAt_horizontalStateAt (ell : ℕ) (h : ℝ) (n : ℕ) + (p : HorizontalParameters) : ContinuousAt (horizontalStateAt ell h n) (0, p) := by + induction n with + | zero => + change ContinuousAt (fun x : ℝ × HorizontalParameters => + (x.2.2.2.2.1, x.2.2.2.2.2)) (0, p) + fun_prop + | succ n ih => + have hd : ContinuousAt (horizontalDifferenceAt ell n h) (0, p) := by + unfold horizontalDifferenceAt horizontalDifference + apply ContinuousAt.div + · fun_prop + · fun_prop + · simp + change ContinuousAt (fun x : ℝ × HorizontalParameters => + ((horizontalStateAt ell h n x).1 - horizontalDifferenceAt ell n h x, + (horizontalStateAt ell h n x).2 - (x.1 : ℂ) * + ((horizontalStateAt ell h n x).1 - horizontalDifferenceAt ell n h x))) (0, p) + fun_prop + +theorem continuousAt_horizontalDifferenceAt (ell n : ℕ) (h : ℝ) + (p : HorizontalParameters) : ContinuousAt (horizontalDifferenceAt ell n h) (0, p) := by + have hc := continuousAt_horizontalStateAt ell h n p + unfold horizontalDifferenceAt horizontalDifference + apply ContinuousAt.div + · fun_prop + · fun_prop + · simp + +noncomputable def horizontalFormAt (ell : ℕ) (x : ℝ × HorizontalParameters) : ℝ := + ((ell : ℝ) + 5) * Complex.normSq x.2.2.2.2.1 + + horizontalIncrementSum ell 1 x.2.1 x.2.2.1 x.2.2.2.1 x.1 x.2.2.2.2.1 x.2.2.2.2.2 8 + + horizontalIncrementSum ell (-1) x.2.1 x.2.2.1 x.2.2.2.1 x.1 x.2.2.2.2.1 x.2.2.2.2.2 8 + +theorem continuousAt_horizontalFormAt (ell : ℕ) (p : HorizontalParameters) : + ContinuousAt (horizontalFormAt ell) (0, p) := by + have hsum (h : ℝ) : ContinuousAt (fun x : ℝ × HorizontalParameters => + horizontalIncrementSum ell h x.2.1 x.2.2.1 x.2.2.2.1 x.1 x.2.2.2.2.1 x.2.2.2.2.2 8) + (0, p) := by + unfold horizontalIncrementSum + apply tendsto_finsetSum + intro n hn + change ContinuousAt (fun x : ℝ × HorizontalParameters => + (x.2.1 + n - 5 / 2) * Complex.normSq (horizontalDifferenceAt ell n h x)) (0, p) + have hc := continuousAt_horizontalDifferenceAt ell n h p + fun_prop + unfold horizontalFormAt + fun_prop + +/-- Compactness makes the positive limiting form uniform over all normalized +initial data and spectral parameters in a compact set. -/ +theorem eventually_horizontalForm_positive (ell : ℕ) (P : Set HorizontalParameters) + (hP : IsCompact P) (hσ : ∀ p ∈ P, -(1 / 32 : ℝ) ≤ p.1) + (hZ : ∀ p ∈ P, p.2.2.1 ≠ 0) + (hBC : ∀ p ∈ P, p.2.2.2.1 ≠ 0 ∨ p.2.2.2.2 ≠ 0) : + ∀ᶠ τ in 𝓝 (0 : ℝ), ∀ p ∈ P, 0 < horizontalFormAt ell (τ, p) := by + apply hP.eventually_forall_of_forall_eventually + intro p hp + have hz : 0 < horizontalFormAt ell (0, p) := + horizontal_limiting_form_pos ell p.1 p.2.1 p.2.2.1 p.2.2.2.1 p.2.2.2.2 + (hσ p hp) (hZ p hp) (hBC p hp) + exact (continuousAt_horizontalFormAt ell p).eventually (eventually_gt_nhds hz) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HorizontalForwardLink.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HorizontalForwardLink.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d3d7837a1947cef7f8b63d5491693273db5b4d1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HorizontalForwardLink.lean @@ -0,0 +1,109 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HorizontalCompactification + +namespace OAI + +/-! # The compactified recurrence is the actual forward jet -/ + +open Matrix + +namespace DefocusingNLS + +noncomputable def horizontalQ (ell : ℕ) (h σ b v : ℝ) : ℂ := + ((σ + (ell : ℝ) / 2 : ℝ) : ℂ) + Complex.I * ((v - h * b : ℝ) : ℂ) + +theorem horizontalDifference_forward (ell n : ℕ) (h σ b Z v : ℝ) + (hv : v ≠ 0) (B C : ℂ) : + horizontalDifference ell n h σ b Z v⁻¹ B ((v⁻¹ : ℝ) * C) = + -(((ell : ℂ) + 5) * B + ((h : ℂ) * Complex.I * Z) * C) / + (horizontalQ ell h σ b v + n - (ell + 5)) := by + have hvC : (v : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr hv + have hd : Complex.I + ((v⁻¹ : ℝ) : ℂ) * + ((((σ + (ell : ℝ) / 2 + n - ((ell : ℝ) + 5) : ℝ) : ℂ)) - + (h : ℂ) * Complex.I * b) = + ((v⁻¹ : ℝ) : ℂ) * (horizontalQ ell h σ b v + n - (ell + 5)) := by + simp only [horizontalQ] + push_cast + field_simp [hvC] + ring + rw [horizontalDifference, hd] + have hn : -(((v⁻¹ : ℝ) : ℂ) * ((ell : ℂ) + 5) * B + + (h : ℂ) * Complex.I * Z * (((v⁻¹ : ℝ) : ℂ) * C)) = + ((v⁻¹ : ℝ) : ℂ) * -(((ell : ℂ) + 5) * B + (h : ℂ) * Complex.I * Z * C) := by ring + rw [hn, mul_div_mul_left _ _ (Complex.ofReal_ne_zero.mpr (inv_ne_zero hv))] + +theorem horizontalState_forward (ell N : ℕ) (h σ b Z v : ℝ) (hv : v ≠ 0) + (hd : ∀ n : ℕ, horizontalQ ell h σ b v + n - (ell + 5) ≠ 0) (B C : ℂ) : + horizontalState ell h σ b Z v⁻¹ B C N = + (normalizedForwardJet (ell + 5) ((h : ℂ) * Complex.I * Z) + (horizontalQ ell h σ b v) ![B, (v : ℂ) * C] N 0, + ((v⁻¹ : ℝ) : ℂ) * normalizedForwardJet (ell + 5) ((h : ℂ) * Complex.I * Z) + (horizontalQ ell h σ b v) ![B, (v : ℂ) * C] N 1) := by + let q := horizontalQ ell h σ b v + let s := (h : ℂ) * Complex.I * Z + let w : Fin 2 → ℂ := ![B, (v : ℂ) * C] + have hvC : (v : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr hv + induction N with + | zero => + simp [horizontalState, normalizedForwardJet, Complex.ofReal_inv, hvC] + | succ N ih => + rw [horizontalState, ih, horizontalDifference_forward ell N h σ b Z v hv] + have hg : normalizedForwardJet (ell + 5) s q w N 0 - + -(((ell : ℂ) + 5) * normalizedForwardJet (ell + 5) s q w N 0 + + s * normalizedForwardJet (ell + 5) s q w N 1) / (q + N - (ell + 5)) = + normalizedForwardJet (ell + 5) s q w (N + 1) 0 := by + rw [normalizedForwardJet_succ_first] + dsimp only [q, s, w] + field_simp [hd N] + ring + change (_, _) = (_, _) + apply Prod.ext + · exact hg + · rw [normalizedForwardJet_succ_second _ _ _ _ _ (hd N)] + change ((v⁻¹ : ℝ) : ℂ) * normalizedForwardJet (ell + 5) s q w N 1 - + ((v⁻¹ : ℝ) : ℂ) * _ = _ + rw [hg, mul_sub] + +/-- The finite telescoping identity retains the exact cone weights. -/ +theorem normalizedForwardJet_cone_sum (ell N : ℕ) (h σ b Z v : ℝ) + (hv : v ≠ 0) (hd : ∀ n : ℕ, horizontalQ ell h σ b v + n - (ell + 5) ≠ 0) + (B C : ℂ) : + coneForm ((ell : ℝ) + 5) ((h : ℂ) * Complex.I * Z) + (normalizedForwardJet (ell + 5) ((h : ℂ) * Complex.I * Z) + (horizontalQ ell h σ b v) ![B, (v : ℂ) * C] N 0) + (normalizedForwardJet (ell + 5) ((h : ℂ) * Complex.I * Z) + (horizontalQ ell h σ b v) ![B, (v : ℂ) * C] N 1) = + coneForm ((ell : ℝ) + 5) ((h : ℂ) * Complex.I * Z) B ((v : ℂ) * C) + + horizontalIncrementSum ell h σ b Z v⁻¹ B C N := by + induction N with + | zero => simp [normalizedForwardJet, horizontalIncrementSum] + | succ N ih => + let q := horizontalQ ell h σ b v + let s := (h : ℂ) * Complex.I * Z + let w : Fin 2 → ℂ := ![B, (v : ℂ) * C] + have hi := normalizedForwardJet_increment ((ell : ℝ) + 5) s q w N + (by simp [s, Complex.mul_re, Complex.mul_im]) + (by simpa only [Complex.ofReal_add, Complex.ofReal_natCast, Complex.ofReal_ofNat] using hd N) + have he : ((q + N).re - ((ell : ℝ) + 5) / 2) = σ + N - 5 / 2 := by + simp [q, horizontalQ] + ring + rw [he] at hi + have hs := horizontalState_forward ell N h σ b Z v hv hd B C + have hg := horizontalDifference_forward ell N h σ b Z v hv + (normalizedForwardJet (ell + 5) s q w N 0) (normalizedForwardJet (ell + 5) s q w N 1) + have hdiff : horizontalDifference ell N h σ b Z v⁻¹ + (horizontalState ell h σ b Z v⁻¹ B C N).1 + (horizontalState ell h σ b Z v⁻¹ B C N).2 = + normalizedForwardJet (ell + 5) s q w N 0 - + normalizedForwardJet (ell + 5) s q w (N + 1) 0 := by + rw [hs, hg, normalizedForwardJet_succ_first] + dsimp only [q, s, w] + field_simp [hd N] + ring + rw [horizontalIncrementSum, Finset.sum_range_succ, hdiff] + change _ = _ + (horizontalIncrementSum ell h σ b Z v⁻¹ B C N + _) + push_cast at hi + linarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HorizontalHomogeneity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HorizontalHomogeneity.lean new file mode 100644 index 0000000000000000000000000000000000000000..5230b4973fdf7420e80cfbc707298bbd776f320d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HorizontalHomogeneity.lean @@ -0,0 +1,66 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HorizontalUniformPositivity + +namespace OAI + +/-! # Removing the unit-vector normalization from the horizontal estimate -/ + +open Set Metric + +namespace DefocusingNLS + +theorem horizontalDifference_mul (ell n : ℕ) (h σ b Z τ : ℝ) (a B C : ℂ) : + horizontalDifference ell n h σ b Z τ (a * B) (a * C) = + a * horizontalDifference ell n h σ b Z τ B C := by + unfold horizontalDifference + ring + +theorem horizontalState_mul (ell n : ℕ) (h σ b Z τ : ℝ) (a B C : ℂ) : + horizontalState ell h σ b Z τ (a * B) (a * C) n = + (a * (horizontalState ell h σ b Z τ B C n).1, + a * (horizontalState ell h σ b Z τ B C n).2) := by + induction n with + | zero => rfl + | succ n ih => + rw [horizontalState, ih, horizontalDifference_mul] + apply Prod.ext <;> simp only [horizontalState] <;> ring + +theorem horizontalIncrementSum_mul (ell N : ℕ) (h σ b Z τ : ℝ) (a B C : ℂ) : + horizontalIncrementSum ell h σ b Z τ (a * B) (a * C) N = + Complex.normSq a * horizontalIncrementSum ell h σ b Z τ B C N := by + simp only [horizontalIncrementSum, horizontalState_mul, horizontalDifference_mul, + Complex.normSq_mul, Finset.mul_sum] + apply Finset.sum_congr rfl + intro n hn + ring + +theorem horizontalFormAt_mul (ell : ℕ) (τ σ b Z : ℝ) (a B C : ℂ) : + horizontalFormAt ell (τ, σ, b, Z, a * B, a * C) = + Complex.normSq a * horizontalFormAt ell (τ, σ, b, Z, B, C) := by + simp only [horizontalFormAt, horizontalIncrementSum_mul, Complex.normSq_mul] + ring + +/-- Homogeneity extends the compact unit-sphere estimate to every nonzero jet. -/ +theorem horizontalForm_positive_of_unit_sphere (ell : ℕ) (τ σ b Z : ℝ) + (hunit : ∀ B C : ℂ, (B, C) ∈ sphere (0 : ℂ × ℂ) 1 → + 0 < horizontalFormAt ell (τ, σ, b, Z, B, C)) + (B C : ℂ) (hBC : B ≠ 0 ∨ C ≠ 0) : + 0 < horizontalFormAt ell (τ, σ, b, Z, B, C) := by + have hpair : (B, C) ≠ (0 : ℂ × ℂ) := by + intro h + have hB := congrArg Prod.fst h + have hC := congrArg Prod.snd h + exact hBC.elim (fun hn => hn hB) (fun hn => hn hC) + have hn : 0 < ‖(B, C)‖ := norm_pos_iff.mpr hpair + let a : ℝ := ‖(B, C)‖⁻¹ + have ha : 0 < a := inv_pos.mpr hn + have hsphere : ((a : ℂ) * B, (a : ℂ) * C) ∈ sphere (0 : ℂ × ℂ) 1 := by + change a • (B, C) ∈ sphere (0 : ℂ × ℂ) 1 + rw [mem_sphere_zero_iff_norm, norm_smul, Real.norm_eq_abs, abs_of_pos ha] + exact inv_mul_cancel₀ hn.ne' + have hp := hunit ((a : ℂ) * B) ((a : ℂ) * C) hsphere + rw [horizontalFormAt_mul] at hp + exact pos_of_mul_pos_right hp (Complex.normSq_nonneg _) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HorizontalMatchingExclusion.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HorizontalMatchingExclusion.lean new file mode 100644 index 0000000000000000000000000000000000000000..a050758d2582f4d6d71985e2db230f2d3ef6a732 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HorizontalMatchingExclusion.lean @@ -0,0 +1,130 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HorizontalConeIdentity +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HorizontalHomogeneity + +namespace OAI + +/-! # Horizontal boundary exclusion from the uniform compactified form -/ + +open Matrix Polynomial + +namespace DefocusingNLS + +attribute [local irreducible] matchingHomotopyColumn normalizedForwardMatrix horizontalFormAt + horizontalCone normalizedForwardJet horizontalState horizontalDifference + +theorem horizontalQ_im (ell : ℕ) (h σ b v : ℝ) : + (horizontalQ ell h σ b v).im = v - h * b := by simp [horizontalQ] + +theorem horizontalQ_re (ell : ℕ) (h σ b v : ℝ) : + (horizontalQ ell h σ b v).re = σ + (ell : ℝ) / 2 := by simp [horizontalQ] + +theorem horizontalQ_im_ne_zero (ell : ℕ) (h σ b v : ℝ) + (hh : |h| = 1) (hbv : |b| < |v|) : (horizontalQ ell h σ b v).im ≠ 0 := by + rw [horizontalQ_im] + intro hz + have hvb : v = h * b := sub_eq_zero.mp hz + rw [hvb, abs_mul, hh, one_mul] at hbv + exact lt_irrefl _ hbv + +theorem horizontalQ_sub_mass_add_ne_zero (ell : ℕ) (h σ b v : ℝ) + (hh : |h| = 1) (hbv : |b| < |v|) (n : ℕ) : + horizontalQ ell h σ b v + n - (ell + 5) ≠ 0 := by + intro hz + apply horizontalQ_im_ne_zero ell h σ b v hh hbv + have he := congrArg Complex.im hz + simpa using he + +theorem horizontal_homotopyColumn_ne_zero (ell : ℕ) (h σ b Z v ρ : ℝ) + (hh : |h| = 1) (hbv : |b| < |v|) : + matchingHomotopyColumn (ell + 5) 8 ((h : ℂ) * Complex.I * Z) ρ + (horizontalQ ell h σ b v) ≠ 0 := by + apply matchingHomotopyColumn_ne_zero_of_factors (ell + 5) 8 + ((h : ℂ) * Complex.I * Z) (horizontalQ ell h σ b v) ρ + · exact ascPochhammer_eval_ne_zero_of_im_ne_zero _ _ + (horizontalQ_im_ne_zero ell h σ b v hh hbv) + · apply ascPochhammer_eval_ne_zero_of_im_ne_zero + simpa using horizontalQ_im_ne_zero ell h σ b v hh hbv + +theorem horizontal_homotopy_cone_nonpos (ell : ℕ) (h σ b Z v ρ : ℝ) + (hh : |h| = 1) (hσ : -(1 / 32 : ℝ) ≤ σ) (hZ : Z ≠ 0) + (hρ : 0 ≤ ρ) (hρ1 : ρ ≤ 1) : + matrixCone ((ell : ℝ) + 5) ((h : ℂ) * Complex.I * Z) + (normalizedForwardMatrix (ell + 5) ((h : ℂ) * Complex.I * Z) + (horizontalQ ell h σ b v) 8) + (matchingHomotopyColumn (ell + 5) 8 ((h : ℂ) * Complex.I * Z) ρ + (horizontalQ ell h σ b v)) ≤ 0 := by + have hs : ((h : ℂ) * Complex.I * Z).re = 0 := by simp + have hsim : ((h : ℂ) * Complex.I * Z).im ≠ 0 := by + have hh0 : h ≠ 0 := by intro hz; simp [hz] at hh + simpa using mul_ne_zero hh0 hZ + have he := matrixCone_normalizedForwardMatrix ((ell : ℝ) + 5) + ((h : ℂ) * Complex.I * Z) (horizontalQ ell h σ b v) 8 + (matchingHomotopyColumn (ell + 5) 8 ((h : ℂ) * Complex.I * Z) ρ + (horizontalQ ell h σ b v)) + push_cast at he + rw [he] + apply mul_nonpos_of_nonneg_of_nonpos (Complex.normSq_nonneg _) + have hf := forward_matchingHomotopyColumn_cone σ ell 8 + (horizontalQ ell h σ b v) ((h : ℂ) * Complex.I * Z) ρ hσ (by decide) + (horizontalQ_re ell h σ b v) hs hsim hρ hρ1 + simpa only [matrixCone, Nat.cast_add, Nat.cast_ofNat] using hf + +theorem horizontal_forward_forms_pos (ell : ℕ) (σ b Z v : ℝ) + (hbv : |b| < |v|) + (hform : ∀ B C : ℂ, B ≠ 0 ∨ C ≠ 0 → + 0 < horizontalFormAt ell (v⁻¹, σ, b, Z, B, C)) + (w : Fin 2 → ℂ) (hw : w ≠ 0) : + 0 < matrixCone ((ell : ℝ) + 5) ((1 : ℂ) * Complex.I * Z) + (normalizedForwardMatrix (ell + 5) ((1 : ℂ) * Complex.I * Z) + (horizontalQ ell 1 σ b v) 8) w + + matrixCone ((ell : ℝ) + 5) ((-1 : ℂ) * Complex.I * Z) + (normalizedForwardMatrix (ell + 5) ((-1 : ℂ) * Complex.I * Z) + (horizontalQ ell (-1) σ b v) 8) w := by + have hv : v ≠ 0 := by + intro hz + rw [hz, abs_zero] at hbv + linarith [abs_nonneg b] + have hvC : (v : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr hv + have he : ![w 0, (v : ℂ) * (((v⁻¹ : ℝ) : ℂ) * w 1)] = w := by + funext i + fin_cases i <;> simp [Complex.ofReal_inv, hvC] + have hBC : w 0 ≠ 0 ∨ (((v⁻¹ : ℝ) : ℂ) * w 1) ≠ 0 := by + by_contra hn + push Not at hn + have hw1 : w 1 = 0 := (mul_eq_zero.mp hn.2).resolve_left + (Complex.ofReal_ne_zero.mpr (inv_ne_zero hv)) + apply hw + funext i + fin_cases i <;> simp [hn.1, hw1] + have hp := hform (w 0) (((v⁻¹ : ℝ) : ℂ) * w 1) hBC + rw [horizontalFormAt_eq_cones ell σ b Z v _ _ hv + (horizontalQ_sub_mass_add_ne_zero ell 1 σ b v (by norm_num) hbv) + (horizontalQ_sub_mass_add_ne_zero ell (-1) σ b v (by norm_num) hbv)] at hp + simpa only [horizontalCone, he, Complex.ofReal_one, Complex.ofReal_neg] using hp + +/-- The finite positive form excludes horizontal homotopy zeros. Its uniform +positivity is supplied by `exists_horizontal_positive_neighborhood`. -/ +theorem matchingHomotopy_horizontal_ne_zero_of_form (ell : ℕ) (σ b Z v ρ : ℝ) + (hσ : -(1 / 32 : ℝ) ≤ σ) (hZ : Z ≠ 0) (hbv : |b| < |v|) + (hρ : 0 ≤ ρ) (hρ1 : ρ ≤ 1) + (hform : ∀ B C : ℂ, B ≠ 0 ∨ C ≠ 0 → + 0 < horizontalFormAt ell (v⁻¹, σ, b, Z, B, C)) : + matchingColumnDeterminant + (matchingHomotopyColumn (ell + 5) 8 ((1 : ℂ) * Complex.I * Z) ρ + (horizontalQ ell 1 σ b v)) + (matchingHomotopyColumn (ell + 5) 8 ((-1 : ℂ) * Complex.I * Z) ρ + (horizontalQ ell (-1) σ b v)) ≠ 0 := by + exact matchingColumnDeterminant_ne_zero_of_forward_forms ((ell : ℝ) + 5) + ((1 : ℂ) * Complex.I * Z) ((-1 : ℂ) * Complex.I * Z) + (normalizedForwardMatrix (ell + 5) ((1 : ℂ) * Complex.I * Z) (horizontalQ ell 1 σ b v) 8) + (normalizedForwardMatrix (ell + 5) ((-1 : ℂ) * Complex.I * Z) (horizontalQ ell (-1) σ b v) 8) + _ _ + (by simpa using horizontal_homotopyColumn_ne_zero ell 1 σ b Z v ρ (by norm_num) hbv) + (by simpa using horizontal_homotopyColumn_ne_zero ell (-1) σ b Z v ρ (by norm_num) hbv) + (by simpa using horizontal_homotopy_cone_nonpos ell 1 σ b Z v ρ (by norm_num) hσ hZ hρ hρ1) + (by simpa using horizontal_homotopy_cone_nonpos ell (-1) σ b Z v ρ (by norm_num) hσ hZ hρ hρ1) + (horizontal_forward_forms_pos ell σ b Z v hbv hform) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HorizontalUniformPositivity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HorizontalUniformPositivity.lean new file mode 100644 index 0000000000000000000000000000000000000000..fefb878fd09ad7ca362188160ec75dafd584169f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/HorizontalUniformPositivity.lean @@ -0,0 +1,46 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HorizontalContinuity + +namespace OAI + +/-! # A uniform positive neighborhood at inverse frequency zero -/ + +open Filter Topology Set Metric + +namespace DefocusingNLS + +noncomputable def horizontalParameterBox (R b₀ b₁ Z₀ Z₁ : ℝ) : Set HorizontalParameters := + Icc (-(1 / 32 : ℝ)) R ×ˢ Icc b₀ b₁ ×ˢ Icc Z₀ Z₁ ×ˢ sphere (0 : ℂ × ℂ) 1 + +theorem isCompact_horizontalParameterBox (R b₀ b₁ Z₀ Z₁ : ℝ) : + IsCompact (horizontalParameterBox R b₀ b₁ Z₀ Z₁) := + isCompact_Icc.prod (isCompact_Icc.prod (isCompact_Icc.prod (isCompact_sphere _ _))) + +theorem horizontalParameterBox_nonzero {R b₀ b₁ Z₀ Z₁ : ℝ} {p : HorizontalParameters} + (hp : p ∈ horizontalParameterBox R b₀ b₁ Z₀ Z₁) : + p.2.2.2.1 ≠ 0 ∨ p.2.2.2.2 ≠ 0 := by + by_contra h + push Not at h + have hz : p.2.2.2 = (0 : ℂ × ℂ) := Prod.ext h.1 h.2 + have hs := hp.2.2.2 + rw [mem_sphere, hz, dist_self] at hs + norm_num at hs + +/-- One inverse-frequency neighborhood works for the full parameter box and +all unit initial vectors. The estimate is symmetric in positive/negative frequency. -/ +theorem exists_horizontal_positive_neighborhood (ell : ℕ) (R b₀ b₁ Z₀ Z₁ : ℝ) + (hZ : 0 < Z₀) : + ∃ ε : ℝ, 0 < ε ∧ ∀ τ : ℝ, |τ| < ε → + ∀ p ∈ horizontalParameterBox R b₀ b₁ Z₀ Z₁, 0 < horizontalFormAt ell (τ, p) := by + have hev := eventually_horizontalForm_positive ell + (horizontalParameterBox R b₀ b₁ Z₀ Z₁) + (isCompact_horizontalParameterBox R b₀ b₁ Z₀ Z₁) + (fun p hp => hp.1.1) + (fun p hp => ne_of_gt (lt_of_lt_of_le hZ hp.2.2.1.1)) + (fun p hp => horizontalParameterBox_nonzero hp) + obtain ⟨ε, hε, he⟩ := Metric.eventually_nhds_iff.mp hev + refine ⟨ε, hε, fun τ hτ => he ?_⟩ + simpa only [Real.dist_eq, sub_zero] using hτ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/IntegerPolynomialDisk.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/IntegerPolynomialDisk.lean new file mode 100644 index 0000000000000000000000000000000000000000..3f3d0432985e5181b28ff3f44603d709ccbd3d91 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/IntegerPolynomialDisk.lean @@ -0,0 +1,53 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.PolynomialDisk +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.RootDiskArithmetic + +namespace OAI + +/-!+# Interpreting integer disk bounds over the complex numbers + +Integer upper and lower coefficient bounds imply +the norm inequality required by the disk root theorem. +-/ + +namespace DefocusingNLS.SeparatorArithmetic + +theorem norm_toComplex_le_upper (z : GaussianInt) : + ‖(z : ℂ)‖ ≤ (coefficientUpper z : ℝ) := by + simpa only [coefficientUpper, Int.cast_add, Int.cast_abs, + GaussianInt.intCast_re, GaussianInt.intCast_im] using + Complex.norm_le_abs_re_add_abs_im (z : ℂ) + +theorem lower_le_norm_toComplex (z : GaussianInt) : + (coefficientLower z : ℝ) ≤ ‖(z : ℂ)‖ := by + simp only [coefficientLower, Int.cast_max, Int.cast_abs, + GaussianInt.intCast_re, GaussianInt.intCast_im] + exact max_le (Complex.abs_re_le_norm _) (Complex.abs_im_le_norm _) + +theorem root_of_integer_coefficient_bound (a b : GaussianInt) + (c : Fin 14 → GaussianInt) (r : ℕ) (hb : b ≠ 0) + (hbound : coefficientUpper a + + ∑ i, coefficientUpper (c i) * (r : ℤ) ^ ((i : ℕ) + 2) ≤ + coefficientLower b * r) : + ∃ z : ℂ, ‖z‖ ≤ r ∧ + (a : ℂ) + (b : ℂ) * z + ∑ i, (c i : ℂ) * z ^ ((i : ℕ) + 2) = 0 := by + have hr : (0 : ℝ) ≤ r := Nat.cast_nonneg r + apply degree_fifteen_root_in_disk (a : ℂ) (b : ℂ) + (fun i => (c i : ℂ)) r hr (GaussianInt.toComplex_eq_zero.not.mpr hb) + have hreal : (coefficientUpper a : ℝ) + + ∑ i, (coefficientUpper (c i) : ℝ) * (r : ℝ) ^ ((i : ℕ) + 2) ≤ + (coefficientLower b : ℝ) * r := by exact_mod_cast hbound + calc + ‖(a : ℂ)‖ + ∑ i, ‖(c i : ℂ)‖ * (r : ℝ) ^ ((i : ℕ) + 2) ≤ + (coefficientUpper a : ℝ) + + ∑ i, (coefficientUpper (c i) : ℝ) * (r : ℝ) ^ ((i : ℕ) + 2) := by + apply add_le_add (norm_toComplex_le_upper a) + apply Finset.sum_le_sum + intro i _ + exact mul_le_mul_of_nonneg_right (norm_toComplex_le_upper (c i)) + (pow_nonneg hr _) + _ ≤ (coefficientLower b : ℝ) * r := hreal + _ ≤ ‖(b : ℂ)‖ * r := mul_le_mul_of_nonneg_right (lower_le_norm_toComplex b) hr + +end DefocusingNLS.SeparatorArithmetic + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/InteriorDerivativeLipschitz.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/InteriorDerivativeLipschitz.lean new file mode 100644 index 0000000000000000000000000000000000000000..356d981aecfeedc5c3c420ee8f09c1e918c471f7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/InteriorDerivativeLipschitz.lean @@ -0,0 +1,39 @@ +import Mathlib.Analysis.Calculus.MeanValue +import Mathlib.Analysis.Complex.RealDeriv + +namespace OAI + +/-! # Extending the interior derivative estimate to closed time slabs -/ + +open Set + +namespace DefocusingNLS + +theorem norm_sub_le_of_interior_derivative + (F D : ℝ → ℂ) (T C : ℝ) (hT : 0 ≤ T) (hF : Continuous F) + (hd : ∀ s ∈ Ioo 0 T, HasDerivAt F (D s) s) + (hbound : ∀ s ∈ Ioo 0 T, ‖D s‖ ≤ C) + (s t : ℝ) (hs : s ∈ Icc 0 T) (ht : t ∈ Icc 0 T) : + ‖F t - F s‖ ≤ C * |t - s| := by + rcases hT.eq_or_lt with hT | hT + · have hs0 : s = 0 := by linarith [hs.1, hs.2] + have ht0 : t = 0 := by linarith [ht.1, ht.2] + simp [hs0, ht0] + have hclosed : IsClosed {p : ℝ × ℝ | ‖F p.2 - F p.1‖ ≤ C * |p.2 - p.1|} := + isClosed_le ((hF.comp continuous_snd).sub (hF.comp continuous_fst)).norm + (continuous_const.mul ((continuous_snd.sub continuous_fst).abs)) + have hin : Ioo (0 : ℝ) T ×ˢ Ioo (0 : ℝ) T ⊆ + {p : ℝ × ℝ | ‖F p.2 - F p.1‖ ≤ C * |p.2 - p.1|} := by + intro p hp + have he := Convex.norm_image_sub_le_of_norm_hasDerivWithin_le + (fun x hx => (hd x hx).hasDerivWithinAt) hbound (convex_Ioo (0 : ℝ) T) hp.1 hp.2 + simpa only [Set.mem_ofPred_eq, Real.norm_eq_abs] using he + have he := hclosed.closure_subset_iff.mpr hin + have hmem : (s, t) ∈ closure (Ioo (0 : ℝ) T ×ˢ Ioo (0 : ℝ) T) := by + rw [closure_prod_eq, closure_Ioo hT.ne] + exact ⟨hs, ht⟩ + exact he hmem + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/KernelOperatorBound.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/KernelOperatorBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..8c2b34690489e2dbbb5bffb234ec2d2cf92458e1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/KernelOperatorBound.lean @@ -0,0 +1,43 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.StableGraphFrameBounds + +namespace OAI + +/-! # Turning a unit-ball kernel estimate into a stable block estimate -/ + +namespace DefocusingNLS + +variable {E F G : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] + [NormedAddCommGroup G] [NormedSpace ℝ G] + +theorem linear_kernel_bound_of_unit_ball (A : E →L[ℝ] G) (π : E →L[ℝ] F) + (c : ℝ) (hc : 0 ≤ c) + (h : ∀ v, ‖v‖ ≤ 1 → π v = 0 → ‖A v‖ ≤ c) : + ∀ v, π v = 0 → ‖A v‖ ≤ c * ‖v‖ := by + let B := A.comp π.ker.subtypeL + have hB : ‖B‖ ≤ c := ContinuousLinearMap.opNorm_le_of_unit_norm hc (fun v hv => + h v (le_of_eq hv) v.property) + intro v hv + exact (B.le_opNorm ⟨v, hv⟩).trans (mul_le_mul_of_nonneg_right hB (norm_nonneg v)) + +theorem stableProjectedBlock_of_kernel_bound + (ζ₀ ζ₁ : F →L[ℝ] E) (π₀ π₁ : E →L[ℝ] F) (A : E →L[ℝ] E) + (C c : ℝ) (hC : 0 ≤ C) (hc : 0 ≤ c) + (hπζ : ∀ v, π₀ (ζ₀ v) = v) + (hP₀ : ‖stableFrameProjection ζ₀ π₀‖ ≤ C) + (hP₁ : ‖stableFrameProjection ζ₁ π₁‖ ≤ C) + (hstable : ∀ v, ‖v‖ ≤ 1 → π₀ v = 0 → ‖A v‖ ≤ c) : + ‖stableProjectedBlock ζ₀ ζ₁ π₀ π₁ A‖ ≤ C * c * C := by + apply stableProjectedBlock_norm_le ζ₀ ζ₁ π₀ π₁ A (C * c) C + (mul_nonneg hC hc) hC hπζ hP₀ + intro v hv + calc + _ ≤ C * ‖A v‖ := ((stableFrameProjection ζ₁ π₁).le_opNorm _).trans + (mul_le_mul_of_nonneg_right hP₁ (norm_nonneg _)) + _ ≤ C * (c * ‖v‖) := mul_le_mul_of_nonneg_left + (linear_kernel_bound_of_unit_ball A π₀ c hc hstable v hv) hC + _ = _ := (mul_assoc _ _ _).symm + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LaguerreHilbert.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LaguerreHilbert.lean new file mode 100644 index 0000000000000000000000000000000000000000..d01a19992b7bf8df87ee3f306d5f6fe404fa9b61 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LaguerreHilbert.lean @@ -0,0 +1,117 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ShiftedSlowGrowth +import Mathlib.MeasureTheory.Function.L2Space +import Mathlib.Analysis.InnerProductSpace.Orthonormal + +namespace OAI + +/-! # Hilbert-space decay of Laguerre coefficients + +Multiplication by `exp (-t/2)` puts the weighted problem into the ordinary +complex L² space on the positive ray. Bessel's inequality then proves decay +of coefficients without presupposing completeness of the Laguerre family. +-/ + +open Filter Topology MeasureTheory Set Asymptotics +open scoped ComplexConjugate + +namespace DefocusingNLS + +noncomputable def halfWeighted (f : ℝ → ℂ) (t : ℝ) : ℂ := + (Real.exp (-t / 2) : ℂ) * f t + +theorem halfWeighted_norm_sq (f : ℝ → ℂ) (t : ℝ) : + ‖halfWeighted f t‖ ^ 2 = Real.exp (-t) * ‖f t‖ ^ 2 := by + simp only [halfWeighted, norm_mul, Complex.norm_of_nonneg (Real.exp_pos _).le, mul_pow] + have h : Real.exp (-t / 2) ^ 2 = Real.exp (-t) := by + rw [pow_two, ← Real.exp_add] + congr 1 + ring + rw [h] + +theorem halfWeighted_inner (f g : ℝ → ℂ) (t : ℝ) : + conj (halfWeighted f t) * halfWeighted g t = + (Real.exp (-t) : ℂ) * conj (f t) * g t := by + have h : (Real.exp (-t / 2) : ℂ) ^ 2 = (Real.exp (-t) : ℂ) := by + norm_cast + rw [pow_two, ← Real.exp_add] + congr 1 + ring + simp only [halfWeighted, map_mul, Complex.conj_ofReal] + calc + _ = (Real.exp (-t / 2) : ℂ) ^ 2 * conj (f t) * g t := by ring + _ = _ := by rw [h] + +theorem memLp_halfWeighted_of_exp_bound (f : ℝ → ℂ) + (hc : Continuous f) + (hf : f =O[atTop] (fun t : ℝ => Real.exp ((1 / 4) * t))) : + MemLp (halfWeighted f) 2 (volume.restrict (Ioi 0)) := by + have hs : (fun t : ℝ => ‖f t‖ ^ 2) =O[atTop] + (fun t : ℝ => Real.exp ((1 / 2) * t)) := by + convert hf.norm_left.pow 2 using 1 + funext t + rw [pow_two, ← Real.exp_add] + congr 1 + ring + have hcont : Continuous (fun t : ℝ => ‖f t‖ ^ 2) := hc.norm.pow 2 + have hi := integrableOn_exp_neg_smul_of_isBigO_exp (c := 0) + (hcont.continuousOn.locallyIntegrableOn measurableSet_Ici) hs + (by norm_num : (1 / 2 : ℝ) < 1) + have hi' : IntegrableOn (fun t : ℝ => Real.exp (-t) * ‖f t‖ ^ 2) (Ioi 0) := by + simpa only [neg_mul, one_mul, smul_eq_mul] using hi.mono_set Ioi_subset_Ici_self + have hw : Continuous (halfWeighted f) := by + unfold halfWeighted + have he : Continuous (fun t : ℝ => (Real.exp (-t / 2) : ℂ)) := by fun_prop + exact he.mul hc + apply (memLp_two_iff_integrable_sq_norm hw.aestronglyMeasurable.restrict).mpr + change Integrable (fun t => Real.exp (-t) * ‖f t‖ ^ 2) + (volume.restrict (Ioi 0)) at hi' + convert! hi' using 1 + funext t + exact halfWeighted_norm_sq f t + +theorem memLp_halfWeighted_laguerre (n : ℕ) : + MemLp (halfWeighted (laguerreValue n)) 2 (volume.restrict (Ioi 0)) := by + apply memLp_halfWeighted_of_exp_bound + · exact continuous_iff_continuousAt.mpr fun t => (hasDerivAt_laguerreValue n t).continuousAt + · exact polynomial_eval_isBigO_exp (laguerrePolynomial n) (1 / 4) (by norm_num) + +noncomputable def laguerreL2 (n : ℕ) : Lp ℂ 2 (volume.restrict (Ioi (0 : ℝ))) := + (memLp_halfWeighted_laguerre n).toLp (halfWeighted (laguerreValue n)) + +theorem inner_laguerreL2_halfWeighted (n : ℕ) (f : ℝ → ℂ) + (hf : MemLp (halfWeighted f) 2 (volume.restrict (Ioi 0))) : + inner ℂ (laguerreL2 n) (hf.toLp (halfWeighted f)) = laguerreCoefficientIntegral f n := by + rw [L2.inner_def] + apply integral_congr_ae + filter_upwards [(memLp_halfWeighted_laguerre n).coeFn_toLp, hf.coeFn_toLp] with t hn ht + rw [RCLike.inner_apply'] + change laguerreL2 n t = halfWeighted (laguerreValue n) t at hn + rw [hn, ht, halfWeighted_inner] + simp only [laguerreValue, conj_laguerrePolynomial_eval] + change (Real.exp (-t) : ℂ) * (laguerrePolynomial n).eval (t : ℂ) * f t = + (Real.exp (-t) : ℂ) * f t * (laguerrePolynomial n).eval (t : ℂ) + ring + +theorem orthonormal_laguerreL2 : Orthonormal ℂ laguerreL2 := by + apply orthonormal_iff_ite.mpr + intro n m + change inner ℂ (laguerreL2 n) + ((memLp_halfWeighted_laguerre m).toLp (halfWeighted (laguerreValue m))) = _ + rw [inner_laguerreL2_halfWeighted] + change (∫ t in Ioi (0 : ℝ), (Real.exp (-t) : ℂ) * + (laguerrePolynomial m).eval (t : ℂ) * (laguerrePolynomial n).eval (t : ℂ)) = _ + simpa only [conj_laguerrePolynomial_eval, eq_comm] using integral_laguerre_orthonormal m n + +theorem laguerreCoefficientIntegral_tendsto_zero (f : ℝ → ℂ) + (hf : MemLp (halfWeighted f) 2 (volume.restrict (Ioi 0))) : + Tendsto (laguerreCoefficientIntegral f) atTop (𝓝 0) := by + have hs := orthonormal_laguerreL2.inner_products_summable (hf.toLp (halfWeighted f)) + simp only [inner_laguerreL2_halfWeighted] at hs + have hz := hs.tendsto_atTop_zero + apply tendsto_zero_iff_norm_tendsto_zero.mpr + have h := Real.continuous_sqrt.continuousAt.tendsto.comp hz + simpa only [Function.comp_def, Real.sqrt_sq (norm_nonneg _), Real.sqrt_zero] using h + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LaguerreIntegral.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LaguerreIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..805a5eb1ac63a73b0b523c98ad44f39ae76bf5d3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LaguerreIntegral.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.LaguerreOrthogonality +import Mathlib.Analysis.SpecialFunctions.Gamma.Basic + +namespace OAI + +/-! # Integral realization of Laguerre orthogonality -/ + +namespace DefocusingNLS + +open Polynomial MeasureTheory Set +open scoped ComplexConjugate + +theorem integrableOn_exp_neg_natPow (n : ℕ) : + IntegrableOn (fun t : ℝ => (Real.exp (-t) : ℂ) * (t : ℂ) ^ n) (Ioi 0) := by + have hpos : 0 < ((n : ℂ) + 1).re := by simp; positivity + simpa only [add_sub_cancel_right, Complex.cpow_natCast] using + Complex.GammaIntegral_convergent hpos + +theorem integral_exp_neg_natPow (n : ℕ) : + (∫ t in Ioi (0 : ℝ), (Real.exp (-t) : ℂ) * (t : ℂ) ^ n) = n.factorial := by + have hpos : 0 < ((n : ℂ) + 1).re := by simp; positivity + have h := Complex.Gamma_eq_integral hpos + rw [Complex.Gamma_nat_eq_factorial] at h + simpa only [Complex.GammaIntegral, add_sub_cancel_right, Complex.cpow_natCast] using h.symm + +theorem integrableOn_exp_neg_polynomial (p : ℂ[X]) : + IntegrableOn (fun t : ℝ => (Real.exp (-t) : ℂ) * p.eval (t : ℂ)) (Ioi 0) := by + induction p using Polynomial.induction_on' with + | add p q hp hq => + convert! hp.add hq using 1 + funext t + simp only [Polynomial.eval_add, mul_add, Pi.add_apply] + | monomial n a => + change Integrable _ (volume.restrict (Ioi 0)) + convert! (integrableOn_exp_neg_natPow n).const_mul a using 1 + funext t + simp only [Polynomial.eval_monomial] + ring + +theorem integral_exp_neg_polynomial (p : ℂ[X]) : + (∫ t in Ioi (0 : ℝ), (Real.exp (-t) : ℂ) * p.eval (t : ℂ)) = laguerreMoment p := by + induction p using Polynomial.induction_on' with + | add p q hp hq => + simp only [Polynomial.eval_add, mul_add] + rw [integral_add (integrableOn_exp_neg_polynomial p) + (integrableOn_exp_neg_polynomial q), hp, hq, map_add] + | monomial n a => + simp only [Polynomial.eval_monomial, laguerreMoment_monomial] + simp_rw [mul_left_comm (Real.exp (-_) : ℂ) a] + rw [integral_const_mul, integral_exp_neg_natPow] + ring + +@[simp] theorem conj_laguerreCoefficient (n k : ℕ) : + conj (laguerreCoefficient n k) = laguerreCoefficient n k := by + simp [laguerreCoefficient] + +@[simp] theorem conj_laguerrePolynomial_eval (n : ℕ) (t : ℝ) : + conj ((laguerrePolynomial n).eval (t : ℂ)) = + (laguerrePolynomial n).eval (t : ℂ) := by + simp [laguerrePolynomial, Polynomial.eval_finsetSum, map_sum, + Polynomial.eval_monomial] + +theorem integral_laguerre_orthonormal (n m : ℕ) : + (∫ t in Ioi (0 : ℝ), (Real.exp (-t) : ℂ) * + conj ((laguerrePolynomial n).eval (t : ℂ)) * + (laguerrePolynomial m).eval (t : ℂ)) = if n = m then 1 else 0 := by + simp only [conj_laguerrePolynomial_eval] + simp_rw [mul_assoc, ← Polynomial.eval_mul] + rw [integral_exp_neg_polynomial, laguerreMoment_orthonormal] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LaguerreIteratedSlowGrowth.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LaguerreIteratedSlowGrowth.lean new file mode 100644 index 0000000000000000000000000000000000000000..a7b4f752971115ef2b1bdc9af176ea51b3378113 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LaguerreIteratedSlowGrowth.lean @@ -0,0 +1,65 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.LaguerreIteratedSlowJet +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.PolynomialProjection + +namespace OAI + +/-! # Integrability of every iterated Laguerre operator on the slow solution -/ + +open Filter Topology Asymptotics MeasureTheory Set Polynomial + +namespace DefocusingNLS + +theorem laguerreIteratedSlowJet_subexponential (q : ℂ) (m : ℕ) (s : ℂ) + (hq : -1 < q.re) (hs : s.re = 0) (j n : ℕ) (ε : ℝ) (hε : 0 < ε) : + laguerreIteratedSlowJet q m s j n =O[atTop] (fun t : ℝ => Real.exp (ε * t)) := by + induction j generalizing n ε with + | zero => + exact (shiftedSlowDerivative_isBigO_rpow n q m s hq hs).trans + (isLittleO_rpow_exp_pos_mul_atTop _ hε).isBigO + | succ j ih => + exact laguerreJetOperator_subexponential _ ih n ε hε + +theorem continuous_laguerreIteratedSlowJet (q : ℂ) (m : ℕ) (s : ℂ) + (hq : -1 < q.re) (hs : s.im ≠ 0) (j n : ℕ) : + Continuous (laguerreIteratedSlowJet q m s j n) := + continuous_iff_continuousAt.mpr fun t => + (hasDerivAt_laguerreIteratedSlowJet q m s hq hs j n t).continuousAt + +theorem memLp_halfWeighted_laguerreIteratedSlowJet (q : ℂ) (m : ℕ) (s : ℂ) + (hq : -1 < q.re) (hsre : s.re = 0) (hsim : s.im ≠ 0) (j n : ℕ) : + MemLp (halfWeighted (laguerreIteratedSlowJet q m s j n)) 2 (volume.restrict (Ioi 0)) := + memLp_halfWeighted_of_exp_bound _ (continuous_laguerreIteratedSlowJet q m s hq hsim j n) + (laguerreIteratedSlowJet_subexponential q m s hq hsre j n (1 / 4) (by norm_num)) + +theorem integrableOn_weightedPolynomial_of_subexponential (f : ℝ → ℂ) + (hc : Continuous f) + (hf : ∀ ε : ℝ, 0 < ε → f =O[atTop] (fun t : ℝ => Real.exp (ε * t))) (p : ℂ[X]) : + IntegrableOn (weightedPolynomialIntegrand f p) (Ioi 0) := by + have hp := polynomial_eval_isBigO_exp p (1 / 4) (by norm_num) + have hprod : (fun t : ℝ => f t * p.eval (t : ℂ)) =O[atTop] + (fun t : ℝ => Real.exp ((1 / 2) * t)) := by + convert! (hf (1 / 4) (by norm_num)).mul hp using 1 + funext t + rw [← Real.exp_add] + congr 1 + ring + have hcont : ContinuousOn (fun t : ℝ => f t * p.eval (t : ℂ)) (Ici 0) := + (hc.mul (p.continuous.comp Complex.continuous_ofReal)).continuousOn + have hi := integrableOn_exp_neg_smul_of_isBigO_exp + (hcont.locallyIntegrableOn measurableSet_Ici) hprod (by norm_num : (1 / 2 : ℝ) < 1) + have hi' := hi.mono_set Ioi_subset_Ici_self + convert! hi' using 1 + funext t + simp only [weightedPolynomialIntegrand, neg_mul, one_mul, Complex.real_smul] + ring + +theorem integrableOn_weightedPolynomial_laguerreIteratedSlowJet (q : ℂ) (m : ℕ) (s : ℂ) + (hq : -1 < q.re) (hsre : s.re = 0) (hsim : s.im ≠ 0) (j n : ℕ) (p : ℂ[X]) : + IntegrableOn (weightedPolynomialIntegrand (laguerreIteratedSlowJet q m s j n) p) (Ioi 0) := + integrableOn_weightedPolynomial_of_subexponential _ + (continuous_laguerreIteratedSlowJet q m s hq hsim j n) + (laguerreIteratedSlowJet_subexponential q m s hq hsre j n) p + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LaguerreIteratedSlowJet.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LaguerreIteratedSlowJet.lean new file mode 100644 index 0000000000000000000000000000000000000000..fcd3d104b81693b4b48b8873fb2429cd20eaa0d5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LaguerreIteratedSlowJet.lean @@ -0,0 +1,64 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.LaguerreHilbert + +namespace OAI + +/-! # Iterating the Laguerre differential operator on the actual slow jet -/ + +open Filter Topology Asymptotics Polynomial + +namespace DefocusingNLS + +noncomputable def laguerreJetOperator (d : ℕ → ℝ → ℂ) (n : ℕ) (t : ℝ) : ℂ := + -((t : ℂ) * d (n + 2) t + ((n + 1 : ℂ) - t) * d (n + 1) t - (n : ℂ) * d n t) + +theorem hasDerivAt_laguerreJetOperator (d : ℕ → ℝ → ℂ) + (hd : ∀ n t, HasDerivAt (d n) (d (n + 1) t) t) (n : ℕ) (t : ℝ) : + HasDerivAt (laguerreJetOperator d n) (laguerreJetOperator d (n + 1) t) t := by + have ht : HasDerivAt (fun u : ℝ => (u : ℂ)) 1 t := (hasDerivAt_id (t : ℂ)).comp_ofReal + have h := (((ht.mul (hd (n + 2) t)).add + (((hasDerivAt_const t (n + 1 : ℂ)).sub ht).mul (hd (n + 1) t))).sub + ((hd n t).const_mul (n : ℂ))).neg + convert! h using 1 + simp only [laguerreJetOperator, Pi.sub_apply, one_mul, zero_sub, neg_one_mul, Nat.cast_add, Nat.cast_one, + show n + 1 + 2 = n + 2 + 1 by omega, show n + 1 + 1 = n + 2 by omega] + ring + +theorem polynomial_mul_subexponential (f : ℝ → ℂ) + (hf : ∀ ε : ℝ, 0 < ε → f =O[atTop] (fun t : ℝ => Real.exp (ε * t))) + (p : ℂ[X]) (ε : ℝ) (hε : 0 < ε) : + (fun t : ℝ => p.eval (t : ℂ) * f t) =O[atTop] (fun t : ℝ => Real.exp (ε * t)) := by + have hp := polynomial_eval_isBigO_exp p (ε / 2) (by linarith) + have hh := hf (ε / 2) (by linarith) + convert! hp.mul hh using 1 + funext t + rw [← Real.exp_add] + congr 1 + ring + +theorem laguerreJetOperator_subexponential (d : ℕ → ℝ → ℂ) + (hd : ∀ n ε, 0 < ε → d n =O[atTop] (fun t : ℝ => Real.exp (ε * t))) + (n : ℕ) (ε : ℝ) (hε : 0 < ε) : + laguerreJetOperator d n =O[atTop] (fun t : ℝ => Real.exp (ε * t)) := by + have h₁ := polynomial_mul_subexponential (d (n + 2)) (hd (n + 2)) X ε hε + have h₂ := polynomial_mul_subexponential (d (n + 1)) (hd (n + 1)) (C ((n : ℂ) + 1) - X) ε hε + have h₃ := polynomial_mul_subexponential (d n) (hd n) (C (n : ℂ)) ε hε + convert! ((h₁.add h₂).sub h₃).neg_left using 1 + funext t + simp only [laguerreJetOperator, Polynomial.eval_X, Polynomial.eval_sub, Polynomial.eval_C] + +noncomputable def laguerreIteratedSlowJet (q : ℂ) (m : ℕ) (s : ℂ) : ℕ → ℕ → ℝ → ℂ + | 0 => fun n => shiftedSlowDerivative n q m s + | j + 1 => laguerreJetOperator (laguerreIteratedSlowJet q m s j) + +theorem hasDerivAt_laguerreIteratedSlowJet (q : ℂ) (m : ℕ) (s : ℂ) + (hq : -1 < q.re) (hs : s.im ≠ 0) (j n : ℕ) (t : ℝ) : + HasDerivAt (laguerreIteratedSlowJet q m s j n) + (laguerreIteratedSlowJet q m s j (n + 1) t) t := by + induction j generalizing n t with + | zero => exact hasDerivAt_shiftedSlowDerivative n q m s hq hs t + | succ j ih => + exact hasDerivAt_laguerreJetOperator _ ih n t + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LaguerreOrthogonality.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LaguerreOrthogonality.lean new file mode 100644 index 0000000000000000000000000000000000000000..99bed3dea639d690df6b3a01f93e5166ef02e4fd --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LaguerreOrthogonality.lean @@ -0,0 +1,109 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.LaguerrePolynomial + +namespace OAI + +/-! # Algebraic Laguerre orthogonality + +The factorial moment functional realizes integration against `exp (-t)` on +the positive ray. Integration by parts becomes a finite polynomial identity. +-/ + +namespace DefocusingNLS + +open Polynomial + +noncomputable def laguerreMoment : ℂ[X] →ₗ[ℂ] ℂ := + Polynomial.lsum fun n => (n.factorial : ℂ) • LinearMap.id + +@[simp] theorem laguerreMoment_monomial (n : ℕ) (a : ℂ) : + laguerreMoment (monomial n a) = (n.factorial : ℂ) * a := by + simp [laguerreMoment, Polynomial.lsum] + +@[simp] theorem laguerreMoment_C (a : ℂ) : laguerreMoment (C a) = a := by + simpa using laguerreMoment_monomial 0 a + +@[simp] theorem laguerreMoment_C_mul (a : ℂ) (p : ℂ[X]) : + laguerreMoment (C a * p) = a * laguerreMoment p := by + rw [← Polynomial.smul_eq_C_mul, map_smul, smul_eq_mul] + +/-- The boundary term in integration by parts at zero. -/ +theorem laguerreMoment_derivative_sub (p : ℂ[X]) : + laguerreMoment (p.derivative - p) = -p.coeff 0 := by + induction p using Polynomial.induction_on' with + | add p q hp hq => + simp only [map_add, map_sub, Polynomial.coeff_add] at hp hq ⊢ + linear_combination hp + hq + | monomial n a => + cases n with + | zero => simp + | succ n => + simp [Nat.factorial_succ] + ring + +noncomputable def laguerreOperator (p : ℂ[X]) : ℂ[X] := + X * p.derivative.derivative + (1 - X) * p.derivative + +/-- The Laguerre operator is symmetric for the factorial moment functional. -/ +theorem laguerreMoment_green (p q : ℂ[X]) : + laguerreMoment (laguerreOperator p * q) = + -laguerreMoment (X * p.derivative * q.derivative) := by + have h := laguerreMoment_derivative_sub (X * p.derivative * q) + have he : (X * p.derivative * q).derivative - X * p.derivative * q = + laguerreOperator p * q + X * p.derivative * q.derivative := by + simp only [laguerreOperator, Polynomial.derivative_mul, Polynomial.derivative_X] + ring + rw [he, map_add] at h + simp only [Polynomial.mul_coeff_zero, Polynomial.coeff_X_zero, zero_mul, neg_zero] at h + linear_combination h + +theorem laguerreOperator_laguerrePolynomial (n : ℕ) : + laguerreOperator (laguerrePolynomial n) = -C (n : ℂ) * laguerrePolynomial n := by + have h := laguerrePolynomial_differential_equation n + dsimp [laguerreOperator] + linear_combination h + +theorem laguerreMoment_orthogonal (n m : ℕ) (hnm : n ≠ m) : + laguerreMoment (laguerrePolynomial n * laguerrePolynomial m) = 0 := by + have hn := laguerreMoment_green (laguerrePolynomial n) (laguerrePolynomial m) + have hm := laguerreMoment_green (laguerrePolynomial m) (laguerrePolynomial n) + rw [laguerreOperator_laguerrePolynomial] at hn hm + simp only [neg_mul, mul_assoc, map_neg, laguerreMoment_C_mul] at hn hm + rw [mul_comm (laguerrePolynomial m) (laguerrePolynomial n)] at hm + have he : X * (laguerrePolynomial m).derivative * (laguerrePolynomial n).derivative = + X * (laguerrePolynomial n).derivative * (laguerrePolynomial m).derivative := by ring + simp only [mul_assoc] at he + rw [he] at hm + have hz : ((n : ℂ) - m) * + laguerreMoment (laguerrePolynomial n * laguerrePolynomial m) = 0 := by + linear_combination hm - hn + exact (mul_eq_zero.mp hz).resolve_left (sub_ne_zero.mpr (by exact_mod_cast hnm)) + +theorem laguerreMoment_derivative_self (n : ℕ) : + laguerreMoment ((laguerrePolynomial n).derivative * laguerrePolynomial n) = 0 := by + rw [laguerrePolynomial_derivative, neg_mul, map_neg, Finset.sum_mul, map_sum] + apply neg_eq_zero.mpr + apply Finset.sum_eq_zero + intro j hj + exact laguerreMoment_orthogonal j n (Nat.ne_of_lt (Finset.mem_range.mp hj)) + +/-- This normalization gives squared norm one for every degree. -/ +theorem laguerreMoment_self (n : ℕ) : + laguerreMoment (laguerrePolynomial n * laguerrePolynomial n) = 1 := by + have h := laguerreMoment_derivative_sub (laguerrePolynomial n * laguerrePolynomial n) + rw [Polynomial.derivative_mul, map_sub, map_add, + laguerreMoment_derivative_self, mul_comm (laguerrePolynomial n), + laguerreMoment_derivative_self] at h + simp only [Polynomial.mul_coeff_zero, coeff_laguerrePolynomial, + laguerreCoefficient_zero, mul_one] at h + linear_combination -h + +theorem laguerreMoment_orthonormal (n m : ℕ) : + laguerreMoment (laguerrePolynomial n * laguerrePolynomial m) = if n = m then 1 else 0 := by + split_ifs with h + · subst m + exact laguerreMoment_self n + · exact laguerreMoment_orthogonal n m h + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LaguerrePolynomial.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LaguerrePolynomial.lean new file mode 100644 index 0000000000000000000000000000000000000000..1ba571359c9c977d00c038d98ed80d592ad8065f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LaguerrePolynomial.lean @@ -0,0 +1,118 @@ +import Mathlib.Algebra.Polynomial.Derivative +import Mathlib.Data.Nat.Choose.Basic +import Mathlib.Basic.Complex.Basic +import Mathlib.Tactic + +namespace OAI + +/-! # The Laguerre polynomials used in the slow-solution projection + +The normalization is `Lₙ(0) = 1`, with weight `exp (-t)` on the positive ray. +The differential and derivative identities hold as polynomial identities. +-/ + +namespace DefocusingNLS + +open Polynomial + +noncomputable def laguerreCoefficient (n k : ℕ) : ℂ := + (-1) ^ k * (n.choose k : ℂ) / (k.factorial : ℂ) + +noncomputable def laguerrePolynomial (n : ℕ) : ℂ[X] := + ∑ k ∈ Finset.range (n + 1), monomial k (laguerreCoefficient n k) + +theorem laguerreCoefficient_eq_zero (n k : ℕ) (h : n < k) : + laguerreCoefficient n k = 0 := by + simp [laguerreCoefficient, Nat.choose_eq_zero_of_lt h] + +@[simp] theorem coeff_laguerrePolynomial (n k : ℕ) : + (laguerrePolynomial n).coeff k = laguerreCoefficient n k := by + by_cases h : k < n + 1 + · simp [laguerrePolynomial, Polynomial.coeff_monomial, + Finset.mem_range, h] + · have hnk : n < k := by omega + simp [laguerrePolynomial, Polynomial.coeff_monomial, + Finset.mem_range, h, laguerreCoefficient_eq_zero n k hnk] + +@[simp] theorem laguerreCoefficient_zero (n : ℕ) : laguerreCoefficient n 0 = 1 := by + simp [laguerreCoefficient] + +@[simp] theorem laguerrePolynomial_eval_zero (n : ℕ) : + (laguerrePolynomial n).eval 0 = 1 := by + rw [← Polynomial.coeff_zero_eq_eval_zero, coeff_laguerrePolynomial, laguerreCoefficient_zero] + +@[simp] theorem laguerrePolynomial_zero : laguerrePolynomial 0 = 1 := by + ext k + cases k <;> simp [laguerreCoefficient, Polynomial.coeff_one] + +theorem laguerreCoefficient_recurrence (n k : ℕ) : + ((k : ℂ) + 1) ^ 2 * laguerreCoefficient n (k + 1) + + ((n : ℂ) - k) * laguerreCoefficient n k = 0 := by + by_cases hkn : k ≤ n + · have hc : (n.choose (k + 1) : ℂ) * ((k : ℂ) + 1) = + (n.choose k : ℂ) * ((n : ℂ) - k) := by + exact_mod_cast Nat.choose_succ_right_eq n k + have hf : (k.factorial : ℂ) ≠ 0 := by exact_mod_cast Nat.factorial_ne_zero k + have hk : (k : ℂ) + 1 ≠ 0 := by exact_mod_cast Nat.succ_ne_zero k + simp only [laguerreCoefficient, Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, + Nat.cast_one, pow_succ] + field_simp + linear_combination -((-1 : ℂ) ^ k) * hc + · have hnk : n < k := by omega + rw [laguerreCoefficient_eq_zero n k hnk, + laguerreCoefficient_eq_zero n (k + 1) (by omega)] + ring + +/-- `t Lₙ'' + (1-t)Lₙ' + n Lₙ = 0`, as a polynomial identity. -/ +theorem laguerrePolynomial_differential_equation (n : ℕ) : + X * (laguerrePolynomial n).derivative.derivative + + (1 - X) * (laguerrePolynomial n).derivative + + C (n : ℂ) * laguerrePolynomial n = 0 := by + ext k + cases k with + | zero => + simpa [Polynomial.coeff_add, Polynomial.coeff_sub, Polynomial.coeff_derivative, + sub_mul, Polynomial.coeff_C_mul] using laguerreCoefficient_recurrence n 0 + | succ k => + simp only [Polynomial.coeff_add, sub_mul, one_mul, + Polynomial.coeff_sub, Polynomial.coeff_X_mul, Polynomial.coeff_derivative, + Polynomial.coeff_C_mul, coeff_laguerrePolynomial, Polynomial.coeff_zero] + have h := laguerreCoefficient_recurrence n (k + 1) + push_cast at h ⊢ + linear_combination h + +theorem laguerreCoefficient_derivative_step (n k : ℕ) : + ((k : ℂ) + 1) * (laguerreCoefficient (n + 1) (k + 1) - + laguerreCoefficient n (k + 1)) = -laguerreCoefficient n k := by + have hc : ((n + 1).choose (k + 1) : ℂ) = + (n.choose k : ℂ) + (n.choose (k + 1) : ℂ) := by + exact_mod_cast Nat.choose_succ_succ' n k + have hf : (k.factorial : ℂ) ≠ 0 := by exact_mod_cast Nat.factorial_ne_zero k + have hk : (k : ℂ) + 1 ≠ 0 := by exact_mod_cast Nat.succ_ne_zero k + simp only [laguerreCoefficient, Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, + Nat.cast_one, pow_succ] + rw [hc] + field_simp + ring + +theorem laguerrePolynomial_derivative_step (n : ℕ) : + (laguerrePolynomial (n + 1)).derivative = + (laguerrePolynomial n).derivative - laguerrePolynomial n := by + ext k + simp only [Polynomial.coeff_sub, Polynomial.coeff_derivative, coeff_laguerrePolynomial] + have h := laguerreCoefficient_derivative_step n k + linear_combination h + +/-- The derivative has the finite triangular expansion used in projection. -/ +theorem laguerrePolynomial_derivative (n : ℕ) : + (laguerrePolynomial n).derivative = + -∑ j ∈ Finset.range n, laguerrePolynomial j := by + induction n with + | zero => simp + | succ n ih => + rw [laguerrePolynomial_derivative_step, ih, Finset.sum_range_succ] + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LaguerreProjection.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LaguerreProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..8b4cd86f86889c26fb9418c0ff3950a71cefd5cc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LaguerreProjection.lean @@ -0,0 +1,84 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.LaguerreIntegral +import Mathlib.Analysis.Calculus.Deriv.Polynomial +import Mathlib.MeasureTheory.Integral.IntegralEqImproper + +namespace OAI + +/-! # Differentiation in Laguerre coefficients + +Integration by parts gives the triangular derivative rule directly. No +interchange of an infinite Laguerre expansion and differentiation is needed. +-/ + +open Filter Topology MeasureTheory Set + +namespace DefocusingNLS + +noncomputable def laguerreValue (n : ℕ) (t : ℝ) : ℂ := + (laguerrePolynomial n).eval (t : ℂ) + +noncomputable def laguerreIntegrand (f : ℝ → ℂ) (n : ℕ) (t : ℝ) : ℂ := + (Real.exp (-t) : ℂ) * f t * laguerreValue n t + +noncomputable def laguerreCoefficientIntegral (f : ℝ → ℂ) (n : ℕ) : ℂ := + ∫ t in Ioi (0 : ℝ), laguerreIntegrand f n t + +theorem hasDerivAt_laguerreValue (n : ℕ) (t : ℝ) : + HasDerivAt (laguerreValue n) (-∑ j ∈ Finset.range n, laguerreValue j t) t := by + have h := ((laguerrePolynomial n).hasDerivAt (t : ℂ)).comp_ofReal + rw [laguerrePolynomial_derivative] at h + convert! h using 1 + simp only [Polynomial.eval_neg, Polynomial.eval_finsetSum, laguerreValue] + +theorem hasDerivAt_laguerreIntegrand (f f' : ℝ → ℂ) (n : ℕ) (t : ℝ) + (hf : HasDerivAt f (f' t) t) : + HasDerivAt (laguerreIntegrand f n) + (laguerreIntegrand f' n t - laguerreIntegrand f n t - + ∑ j ∈ Finset.range n, laguerreIntegrand f j t) t := by + have he := ((Real.hasDerivAt_exp (-t)).comp t (hasDerivAt_neg t)).ofReal_comp + have h := (he.fun_mul hf).fun_mul (hasDerivAt_laguerreValue n t) + convert! h using 1 + simp only [laguerreIntegrand, neg_mul, Complex.ofReal_mul, Complex.ofReal_neg, + Complex.ofReal_one, mul_neg, Finset.mul_sum, Function.comp_apply] + ring + +/-- A weighted derivative coefficient is a finite partial sum minus the +boundary value. Both endpoint limits follow from the integrability hypotheses. -/ +theorem laguerreCoefficientIntegral_derivative (f f' : ℝ → ℂ) (n : ℕ) + (hf : ∀ t ∈ Ioi (0 : ℝ), HasDerivAt f (f' t) t) + (hc : ContinuousWithinAt f (Ici 0) 0) + (hi : ∀ j, IntegrableOn (laguerreIntegrand f j) (Ioi 0)) + (hi' : IntegrableOn (laguerreIntegrand f' n) (Ioi 0)) : + laguerreCoefficientIntegral f' n = + -f 0 + ∑ j ∈ Finset.range (n + 1), laguerreCoefficientIntegral f j := by + let D : ℝ → ℂ := fun t => laguerreIntegrand f' n t - laguerreIntegrand f n t - + ∑ j ∈ Finset.range n, laguerreIntegrand f j t + have hsum : IntegrableOn (fun t => ∑ j ∈ Finset.range n, laguerreIntegrand f j t) + (Ioi 0) := integrable_finsetSum _ (fun j _ => hi j) + have hD : IntegrableOn D (Ioi 0) := (hi'.sub (hi n)).sub hsum + have hd (t : ℝ) (ht : t ∈ Ioi (0 : ℝ)) : + HasDerivAt (laguerreIntegrand f n) (D t) t := + hasDerivAt_laguerreIntegrand f f' n t (hf t ht) + have hcont : ContinuousWithinAt (laguerreIntegrand f n) (Ici 0) 0 := by + have hp : ContinuousWithinAt (laguerreValue n) (Ici 0) 0 := + (hasDerivAt_laguerreValue n 0).continuousAt.continuousWithinAt + have he : ContinuousAt (fun t : ℝ => (Real.exp (-t) : ℂ)) 0 := by fun_prop + exact (he.continuousWithinAt.mul hc).mul hp + have hlim := tendsto_zero_of_hasDerivAt_of_integrableOn_Ioi hd hD (hi n) + have h := integral_Ioi_of_hasDerivAt_of_tendsto hcont hd hD hlim + have hz : laguerreIntegrand f n 0 = f 0 := by + simp [laguerreIntegrand, laguerreValue] + rw [hz, zero_sub] at h + dsimp only [D] at h + have hisub : IntegrableOn (fun t => laguerreIntegrand f' n t - + laguerreIntegrand f n t) (Ioi 0) := hi'.sub (hi n) + rw [integral_sub hisub hsum, integral_sub hi' (hi n), + integral_finsetSum _ (fun j _ => hi j)] at h + change laguerreCoefficientIntegral f' n - laguerreCoefficientIntegral f n - + ∑ j ∈ Finset.range n, laguerreCoefficientIntegral f j = -f 0 at h + rw [Finset.sum_range_succ] + linear_combination h + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LaguerreRapidDecay.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LaguerreRapidDecay.lean new file mode 100644 index 0000000000000000000000000000000000000000..e8541ca5ffb8ad94f03bbf0782954e0f1db3e689 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LaguerreRapidDecay.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.LaguerreIteratedSlowGrowth +import OAI.MathematicalPhysics.DefocusingNLS.Profile.SlowLaguerreTail + +namespace OAI + +/-! # Rapid decay of the actual slow-solution Laguerre coefficients -/ + +open Filter Topology MeasureTheory Set Polynomial + +namespace DefocusingNLS + +theorem laguerreIteratedSlowJet_coefficient_succ (q : ℂ) (m : ℕ) (s : ℂ) + (hq : -1 < q.re) (hsre : s.re = 0) (hsim : s.im ≠ 0) (j n : ℕ) : + laguerreCoefficientIntegral (laguerreIteratedSlowJet q m s (j + 1) 0) n = + (n : ℂ) * laguerreCoefficientIntegral (laguerreIteratedSlowJet q m s j 0) n := by + let d := laguerreIteratedSlowJet q m s j + let p := laguerrePolynomial n + have hi (k : ℕ) (r : ℂ[X]) : IntegrableOn (weightedPolynomialIntegrand (d k) r) (Ioi 0) := + integrableOn_weightedPolynomial_laguerreIteratedSlowJet q m s hq hsre hsim j k r + have hg := weightedPolynomialIntegral_laguerre_operator (d 0) (d 1) (d 2) p + (fun t _ => hasDerivAt_laguerreIteratedSlowJet q m s hq hsim j 0 t) + (fun t _ => hasDerivAt_laguerreIteratedSlowJet q m s hq hsim j 1 t) + (continuous_laguerreIteratedSlowJet q m s hq hsim j 0).continuousWithinAt + (continuous_laguerreIteratedSlowJet q m s hq hsim j 1).continuousWithinAt + (hi 0) (hi 1) (hi 2) + have hp : laguerreOperator p = -C (n : ℂ) * p := laguerreOperator_laguerrePolynomial n + rw [hp] at hg + have he : weightedPolynomialIntegral (d 0) (-C (n : ℂ) * p) = + -(n : ℂ) * weightedPolynomialIntegral (d 0) p := by + change weightedPolynomialFunctional (d 0) (hi 0) _ = _ + rw [neg_mul, map_neg, ← Polynomial.smul_eq_C_mul, map_smul, smul_eq_mul] + simp only [weightedPolynomialFunctional_apply, neg_mul] + rw [he] at hg + have ho : laguerreCoefficientIntegral (laguerreIteratedSlowJet q m s (j + 1) 0) n = + -(weightedPolynomialIntegral (d 2) (X * p) + + weightedPolynomialIntegral (d 1) ((1 - X) * p)) := by + unfold weightedPolynomialIntegral + rw [← integral_add (hi 2 (X * p)) (hi 1 ((1 - X) * p)), ← integral_neg] + apply setIntegral_congr_fun measurableSet_Ioi + intro t ht + change (Real.exp (-t) : ℂ) * laguerreJetOperator d 0 t * p.eval (t : ℂ) = _ + simp only [laguerreJetOperator, Nat.cast_zero, zero_add, zero_mul, sub_zero, + weightedPolynomialIntegrand, Polynomial.eval_mul, Polynomial.eval_X, + Polynomial.eval_sub, Polynomial.eval_one] + ring + rw [ho, hg] + change -(-(n : ℂ) * weightedPolynomialIntegral (d 0) p) = + (n : ℂ) * weightedPolynomialIntegral (d 0) p + ring + +theorem laguerreIteratedSlowJet_coefficient (q : ℂ) (m : ℕ) (s : ℂ) + (hq : -1 < q.re) (hsre : s.re = 0) (hsim : s.im ≠ 0) (j n : ℕ) : + laguerreCoefficientIntegral (laguerreIteratedSlowJet q m s j 0) n = + (n : ℂ) ^ j * slowLaguerreCoefficient q m s n := by + induction j with + | zero => simp [laguerreIteratedSlowJet, slowLaguerreCoefficient] + | succ j ih => + rw [laguerreIteratedSlowJet_coefficient_succ q m s hq hsre hsim j n, ih, pow_succ] + ring + +/-- Every power of the coefficient index times the actual coefficient tends +to zero. Each integration by parts is justified by the proved jet bounds. -/ +theorem slowLaguerreCoefficient_rapid_decay (q : ℂ) (m : ℕ) (s : ℂ) + (hq : -1 < q.re) (hsre : s.re = 0) (hsim : s.im ≠ 0) (j : ℕ) : + Tendsto (fun n : ℕ => (n : ℂ) ^ j * slowLaguerreCoefficient q m s n) + atTop (𝓝 0) := by + have ht := laguerreCoefficientIntegral_tendsto_zero _ + (memLp_halfWeighted_laguerreIteratedSlowJet q m s hq hsre hsim j 0) + convert! ht using 1 + funext n + exact (laguerreIteratedSlowJet_coefficient q m s hq hsre hsim j n).symm + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LowWeightInterpolation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LowWeightInterpolation.lean new file mode 100644 index 0000000000000000000000000000000000000000..0ffca66556c44ea2514ffc19d6891064d5090ee8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/LowWeightInterpolation.lean @@ -0,0 +1,53 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingLowerWeightBound + +namespace OAI + +/-! # Uniform interpolation of the lower Bessel weight against mass -/ + +namespace DefocusingNLS + +theorem lowBesselWeight_interpolation (a k ε : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hε : 0 < ε) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ x r : ℝ, 0 ≤ x → x ≤ 1 → 0 ≤ r → + (x + r ^ 2) ^ (6 - a) ≤ ε * r ^ (2 * k) + C := by + let D : ℝ := 2 ^ (6 - a) + have hD : 0 < D := Real.rpow_pos_of_pos (by norm_num) _ + let R := max 1 (D / ε) + have hR : 1 ≤ R := le_max_left _ _ + have hRp : 0 < R := by linarith + refine ⟨(1 + R ^ 2) ^ (6 - a), by positivity, ?_⟩ + intro x r hx hx1 hr + by_cases hsmall : r ≤ R + · have hr2 : r ^ 2 ≤ R ^ 2 := pow_le_pow_left₀ hr hsmall 2 + exact (Real.rpow_le_rpow (by positivity) (by linarith) (by linarith)).trans + (le_add_of_nonneg_left (mul_nonneg hε.le (Real.rpow_nonneg hr _))) + · have hlarge : R ≤ r := (lt_of_not_ge hsmall).le + have hr1 : 1 ≤ r := hR.trans hlarge + have hrp : 0 < r := by linarith + have hi : D * r⁻¹ ≤ ε := by + have hd : D / ε ≤ r := (le_max_right _ _).trans hlarge + have he : D ≤ ε * r := by simpa only [mul_comm] using (div_le_iff₀ hε).mp hd + exact (div_le_iff₀ hrp).mpr (by simpa only [div_eq_mul_inv, mul_comm] using he) + have hr2 : 1 ≤ r ^ 2 := by nlinarith + calc + (x + r ^ 2) ^ (6 - a) ≤ (2 * r ^ 2) ^ (6 - a) := + Real.rpow_le_rpow (by positivity) (by linarith) (by linarith) + _ = D * r ^ (2 * (6 - a)) := by + rw [Real.mul_rpow (by norm_num : (0 : ℝ) ≤ 2) (sq_nonneg r), + ← Real.rpow_natCast, ← Real.rpow_mul hr] + norm_num [D] + _ = D * (r ^ (2 * k) * r ^ (2 * (6 - a) - 2 * k)) := by + rw [← Real.rpow_add hrp] + congr 2 + ring + _ ≤ D * (r ^ (2 * k) * r ^ (-1 : ℝ)) := + mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_left + (Real.rpow_le_rpow_of_exponent_le hr1 (by linarith)) (Real.rpow_nonneg hr _)) hD.le + _ = r ^ (2 * k) * (D * r⁻¹) := by rw [Real.rpow_neg_one]; ring + _ ≤ r ^ (2 * k) * ε := mul_le_mul_of_nonneg_left hi (Real.rpow_nonneg hr _) + _ ≤ ε * r ^ (2 * k) + (1 + R ^ 2) ^ (6 - a) := by + nlinarith [Real.rpow_nonneg (show 0 ≤ 1 + R ^ 2 by positivity) (6 - a)] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/MatchingBasisChange.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/MatchingBasisChange.lean new file mode 100644 index 0000000000000000000000000000000000000000..54d3d739be632f2dd96408f73e9c35365ce2424c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/MatchingBasisChange.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralMatchingAnalytic +import Mathlib.Analysis.Analytic.Order + +namespace OAI + +/-! Separate changes of regular and outgoing bases preserve the matching +zeros; invertible holomorphic changes also preserve their multiplicities. -/ + +namespace DefocusingNLS +local notation "E₄" => (ℂ × ℂ) × (ℂ × ℂ) +local notation "J₄" => Fin 2 × Fin 2 + +noncomputable def matchingBasisChange (A B : Matrix (Fin 2) (Fin 2) ℂ) : Matrix J₄ J₄ ℂ := + (Matrix.blockDiagonal ![A,B]).submatrix (Equiv.prodComm _ _) (Equiv.prodComm _ _) + +theorem matchingBasisChange_det (A B : Matrix (Fin 2) (Fin 2) ℂ) : + (matchingBasisChange A B).det=A.det*B.det := by + rw [matchingBasisChange,Matrix.det_submatrix_equiv_self (Equiv.prodComm _ _), + Matrix.det_blockDiagonal,Fin.prod_univ_two] + rfl + +theorem spectralMatchingMatrix_change (R₀ R₁ O₀ O₁ : E₄) + (A B : Matrix (Fin 2) (Fin 2) ℂ) : + spectralMatchingMatrix (A 0 0 • R₀+A 1 0 • R₁) (A 0 1 • R₀+A 1 1 • R₁) + (B 0 0 • O₀+B 1 0 • O₁) (B 0 1 • O₀+B 1 1 • O₁)= + spectralMatchingMatrix R₀ R₁ O₀ O₁*matchingBasisChange A B := by + ext ⟨i,j⟩ ⟨k,l⟩ + fin_cases i <;> fin_cases j <;> fin_cases k <;> fin_cases l <;> + simp [spectralMatchingMatrix,spectralStateCoordinates,spectralMatchingColumns, + matchingBasisChange,Matrix.blockDiagonal,Matrix.submatrix,Matrix.mul_apply, + Fintype.sum_prod_type,Fin.sum_univ_two,smul_eq_mul] <;> ring + +theorem spectralMatchingDeterminant_change (R₀ R₁ O₀ O₁ : E₄) + (A B : Matrix (Fin 2) (Fin 2) ℂ) : + spectralMatchingDeterminant (A 0 0 • R₀+A 1 0 • R₁) (A 0 1 • R₀+A 1 1 • R₁) + (B 0 0 • O₀+B 1 0 • O₁) (B 0 1 • O₀+B 1 1 • O₁)= + (A.det*B.det)*spectralMatchingDeterminant R₀ R₁ O₀ O₁ := by + unfold spectralMatchingDeterminant + rw [spectralMatchingMatrix_change,Matrix.det_mul,matchingBasisChange_det] + ring + +theorem spectralMatchingDeterminant_change_order + (R₀ R₁ O₀ O₁ : ℂ → E₄) (A B : ℂ → Matrix (Fin 2) (Fin 2) ℂ) (z : ℂ) + (hR₀ : AnalyticAt ℂ R₀ z) (hR₁ : AnalyticAt ℂ R₁ z) + (hO₀ : AnalyticAt ℂ O₀ z) (hO₁ : AnalyticAt ℂ O₁ z) + (hA : ∀ i j, AnalyticAt ℂ (fun w => A w i j) z) + (hB : ∀ i j, AnalyticAt ℂ (fun w => B w i j) z) + (hAz : (A z).det≠0) (hBz : (B z).det≠0) : + analyticOrderAt (fun w => spectralMatchingDeterminant + (A w 0 0 • R₀ w+A w 1 0 • R₁ w) (A w 0 1 • R₀ w+A w 1 1 • R₁ w) + (B w 0 0 • O₀ w+B w 1 0 • O₁ w) (B w 0 1 • O₀ w+B w 1 1 • O₁ w)) z= + analyticOrderAt (fun w => spectralMatchingDeterminant (R₀ w) (R₁ w) (O₀ w) (O₁ w)) z := by + have ha : AnalyticAt ℂ (fun w => (A w).det) z := by + simp only [Matrix.det_fin_two] + exact ((hA 0 0).mul (hA 1 1)).sub ((hA 0 1).mul (hA 1 0)) + have hb : AnalyticAt ℂ (fun w => (B w).det) z := by + simp only [Matrix.det_fin_two] + exact ((hB 0 0).mul (hB 1 1)).sub ((hB 0 1).mul (hB 1 0)) + have hD := spectralMatchingDeterminant_analyticAt R₀ R₁ O₀ O₁ z hR₀ hR₁ hO₀ hO₁ + have hab : AnalyticAt ℂ (fun w => (A w).det*(B w).det) z := ha.mul hb + have he : (fun w => spectralMatchingDeterminant + (A w 0 0 • R₀ w+A w 1 0 • R₁ w) (A w 0 1 • R₀ w+A w 1 1 • R₁ w) + (B w 0 0 • O₀ w+B w 1 0 • O₁ w) (B w 0 1 • O₀ w+B w 1 1 • O₁ w))= + (fun w => (A w).det*(B w).det)* + (fun w => spectralMatchingDeterminant (R₀ w) (R₁ w) (O₀ w) (O₁ w)) := by + funext w + exact spectralMatchingDeterminant_change _ _ _ _ _ _ + rw [he,analyticOrderAt_mul hab hD, + hab.analyticOrderAt_eq_zero.mpr (mul_ne_zero hAz hBz),zero_add] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/MatchingBoundary.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/MatchingBoundary.lean new file mode 100644 index 0000000000000000000000000000000000000000..7b416c11684988ab7f50b38cd6d1d08b6d4ff369 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/MatchingBoundary.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ForwardConeTransport + +namespace OAI + +/-! # A finite-dimensional criterion excluding matching zeros + +Positivity of the sum of forward cone forms excludes two dependent nonzero +matching columns with nonpositive individual forms. +-/ + +open Matrix + +namespace DefocusingNLS + +theorem matchingColumnDeterminant_eq_zero_imp_smul (u v : Fin 2 → ℂ) + (hu : u ≠ 0) (hdet : matchingColumnDeterminant u v = 0) : + ∃ a : ℂ, v = a • u := by + change u 0 * v 1 - u 1 * v 0 = 0 at hdet + by_cases h₀ : u 0 = 0 + · have h₁ : u 1 ≠ 0 := by + intro hz + apply hu + ext i + fin_cases i <;> simp [h₀, hz] + have hv₀ : v 0 = 0 := by + rw [h₀, zero_mul, zero_sub, neg_eq_zero] at hdet + exact (mul_eq_zero.mp hdet).resolve_left h₁ + refine ⟨v 1 / u 1, ?_⟩ + ext i + fin_cases i <;> simp [h₀, hv₀, h₁] + · refine ⟨v 0 / u 0, ?_⟩ + ext i + fin_cases i + · simp [h₀] + · change v 1 = (v 0 / u 0) * u 1 + field_simp [h₀] + linear_combination hdet + +noncomputable def matrixCone (M : ℝ) (s : ℂ) (T : Matrix (Fin 2) (Fin 2) ℂ) + (v : Fin 2 → ℂ) : ℝ := coneForm M s ((T *ᵥ v) 0) ((T *ᵥ v) 1) + +theorem matrixCone_smul (M : ℝ) (s a : ℂ) (T : Matrix (Fin 2) (Fin 2) ℂ) + (v : Fin 2 → ℂ) : matrixCone M s T (a • v) = Complex.normSq a * matrixCone M s T v := by + simp only [matrixCone, Matrix.mulVec_smul, Pi.smul_apply, smul_eq_mul] + exact coneForm_scale M s a _ _ + +/-- A positive sum of forward forms is incompatible with two dependent +nonzero columns having nonpositive individual forms. -/ +theorem matchingColumnDeterminant_ne_zero_of_forward_forms (M : ℝ) (s₁ s₂ : ℂ) + (T₁ T₂ : Matrix (Fin 2) (Fin 2) ℂ) (u v : Fin 2 → ℂ) + (hu : u ≠ 0) (hv : v ≠ 0) + (h₁ : matrixCone M s₁ T₁ u ≤ 0) (h₂ : matrixCone M s₂ T₂ v ≤ 0) + (hpos : ∀ w : Fin 2 → ℂ, w ≠ 0 → 0 < matrixCone M s₁ T₁ w + matrixCone M s₂ T₂ w) : + matchingColumnDeterminant u v ≠ 0 := by + intro hdet + obtain ⟨a, ha⟩ := matchingColumnDeterminant_eq_zero_imp_smul u v hu hdet + have ha0 : a ≠ 0 := by intro hz; apply hv; simp [ha, hz] + rw [ha, matrixCone_smul] at h₂ + have h₂' : matrixCone M s₂ T₂ u ≤ 0 := by + by_contra hn + have hp : 0 < Complex.normSq a * matrixCone M s₂ T₂ u := + mul_pos (Complex.normSq_pos.mpr ha0) (lt_of_not_ge hn) + linarith + exact (not_lt_of_ge (add_nonpos h₁ h₂')) (hpos u hu) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/MatchingColumns.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/MatchingColumns.lean new file mode 100644 index 0000000000000000000000000000000000000000..991771c446e481150c46856603b961b9b0fd0f2c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/MatchingColumns.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.FreeMatching +import Mathlib.LinearAlgebra.Matrix.Determinant.Basic +import Mathlib.RingTheory.Polynomial.Pochhammer + +namespace OAI + +/-! +# Division-free backward matching + +The tail recurrences imply the matrix identity in Lemma `free:columns` of +*Stable self-similar blowup for a supercritical defocusing Schrödinger equation +on the torus* (September 2026), including at zeros of the Pochhammer factor. +-/ + +open Matrix + +namespace DefocusingNLS + +/-- One backward step, with `t = q + n` and `d = t - M`. -/ +noncomputable def backwardMatrix (M s t : ℂ) : Matrix (Fin 2) (Fin 2) ℂ := + !![t - M - s, -s; t, t] + +/-- The ordered product `F₀ ⋯ Fₖ₋₁`. -/ +noncomputable def backwardProduct (M s q : ℂ) : ℕ → Matrix (Fin 2) (Fin 2) ℂ + | 0 => 1 + | k + 1 => backwardProduct M s q k * backwardMatrix M s (q + k) + +/-- The backward recurrence requires no division by `t` or `t - M`. -/ +theorem backwardMatrix_step (M s t B C B' C' : ℂ) + (hB : (t - M) * B' = t * B + s * C) + (hC : C' = C - B') : + backwardMatrix M s t *ᵥ ![B', C'] = t • ![B, C] := by + ext i + fin_cases i + · simp [backwardMatrix, Matrix.mulVec, dotProduct, Fin.sum_univ_two, hC] + linear_combination hB + · simp [backwardMatrix, Matrix.mulVec, dotProduct, Fin.sum_univ_two, hC] + ring + +/-- Multiplication of the division-free recurrences gives precisely the +Pochhammer factor, including at its zeros. -/ +theorem backwardProduct_apply (M s q : ℂ) (B C : ℕ → ℂ) + (hB : ∀ n, (q + n - M) * B (n + 1) = (q + n) * B n + s * C n) + (hC : ∀ n, C (n + 1) = C n - B (n + 1)) (k : ℕ) : + backwardProduct M s q k *ᵥ ![B k, C k] = + (ascPochhammer ℂ k).eval q • ![B 0, C 0] := by + induction k with + | zero => simp [backwardProduct] + | succ k ih => + rw [backwardProduct, ← Matrix.mulVec_mulVec, + backwardMatrix_step M s (q + k) _ _ _ _ (hB k) (hC k), + Matrix.mulVec_smul, ih, smul_smul, ascPochhammer_succ_eval] + rw [mul_comm (q + k)] + +/-- In the relevant half-plane the only Pochhammer zero is `q = 0`. -/ +theorem pochhammer_zero_iff (q : ℂ) (k : ℕ) (hk : 0 < k) + (hq : -1 < q.re) : (ascPochhammer ℂ k).eval q = 0 ↔ q = 0 := by + constructor + · intro h + obtain ⟨n, _, hn⟩ := (ascPochhammer_eval_eq_zero_iff k q).mp h + have hre := congrArg Complex.re hn + simp only [Complex.natCast_re, Complex.neg_re] at hre + have hnlt : (n : ℝ) < 1 := by linarith + have hnzero : n = 0 := by + have : n < 1 := by exact_mod_cast hnlt + omega + simpa [hnzero] using hn.symm + · rintro rfl + exact ascPochhammer_ne_zero_eval_zero ℂ hk.ne' + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/MatchingHomotopy.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/MatchingHomotopy.lean new file mode 100644 index 0000000000000000000000000000000000000000..dca34f314143fcf8829373187411d71d43d8bcef --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/MatchingHomotopy.lean @@ -0,0 +1,110 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HomotopyCone + +namespace OAI + +/-! # Holomorphic matching columns along the straight tail homotopy -/ + +open Matrix + +namespace DefocusingNLS + +theorem analyticAt_backwardMatrix_entry (M s q : ℂ) (n : ℕ) (i j : Fin 2) : + AnalyticAt ℂ (fun z => backwardMatrix M s (z + n) i j) q := by + fin_cases i <;> fin_cases j + · change AnalyticAt ℂ (fun z : ℂ => z + n - M - s) q + exact ((analyticAt_id.add analyticAt_const).sub analyticAt_const).sub analyticAt_const + · change AnalyticAt ℂ (fun _ : ℂ => -s) q + exact analyticAt_const + · change AnalyticAt ℂ (fun z : ℂ => z + n) q + exact analyticAt_id.add analyticAt_const + · change AnalyticAt ℂ (fun z : ℂ => z + n) q + exact analyticAt_id.add analyticAt_const + +theorem analyticAt_backwardProduct_entry (M s q : ℂ) (K : ℕ) (i j : Fin 2) : + AnalyticAt ℂ (fun z => backwardProduct M s z K i j) q := by + induction K generalizing i j with + | zero => + change AnalyticAt ℂ (fun _ : ℂ => (1 : Matrix (Fin 2) (Fin 2) ℂ) i j) q + exact analyticAt_const + | succ K ih => + simp only [backwardProduct, Matrix.mul_apply, Fin.sum_univ_two] + exact ((ih i 0).mul (analyticAt_backwardMatrix_entry M s q K 0 j)).add + ((ih i 1).mul (analyticAt_backwardMatrix_entry M s q K 1 j)) + +noncomputable def matchingHomotopyColumn (M K : ℕ) (s : ℂ) (ρ : ℝ) (q : ℂ) : Fin 2 → ℂ := + backwardProduct M s q K *ᵥ ![(ρ : ℂ) * slowTailRatio q (M + 1) K s, 1] + +theorem analyticAt_matchingHomotopyColumn (ℓ K : ℕ) (s q : ℂ) (ρ : ℝ) + (hK : 3 ≤ K) (hq : -(1 / 32 : ℝ) ≤ q.re - (ℓ : ℝ) / 2) + (hsre : s.re = 0) (hsim : s.im ≠ 0) : + AnalyticAt ℂ (matchingHomotopyColumn (ℓ + 5) K s ρ) q := by + have hr := analyticAt_slowTailRatio q ℓ K s hK hq hsre hsim + apply AnalyticAt.pi + intro i + have he : ℓ + 5 + 1 = ℓ + 6 := by omega + convert ((analyticAt_backwardProduct_entry (ℓ + 5) s q K i 0).mul + ((show AnalyticAt ℂ (fun _ : ℂ => (ρ : ℂ)) q from analyticAt_const).mul hr)).add (analyticAt_backwardProduct_entry (ℓ + 5) s q K i 1) using 1 + funext z + simp [matchingHomotopyColumn, he, Matrix.mulVec, dotProduct, Fin.sum_univ_two] + +theorem matchingHomotopyColumn_zero (M K : ℕ) (s q : ℂ) : + matchingHomotopyColumn M K s 0 q = backwardProduct M s q K *ᵥ ![0, 1] := by + simp [matchingHomotopyColumn] + +theorem matchingHomotopyColumn_one (M K : ℕ) (s q : ℂ) + (hK : 0 < K) (hq : -1 < q.re) (hsre : s.re = 0) (hsim : s.im ≠ 0) + (hC : normalizedMatchingC q (M + 1) s K ≠ 0) : + matchingHomotopyColumn M K s 1 q = + (normalizedMatchingC q (M + 1) s K)⁻¹ • slowBoundaryColumn q (M + 1) s := by + simpa only [matchingHomotopyColumn, Complex.ofReal_one, one_mul, slowTailRatio] using + normalizedMatching_ratio_column q M K s hK hq hsre hsim hC + +theorem matchingHomotopyColumn_one_ne_zero (ℓ K : ℕ) (s q : ℂ) + (hK : 3 ≤ K) (hq : -(1 / 32 : ℝ) ≤ q.re - (ℓ : ℝ) / 2) + (hsre : s.re = 0) (hsim : s.im ≠ 0) : + matchingHomotopyColumn (ℓ + 5) K s 1 q ≠ 0 := by + have hq' : -1 < q.re := by linarith [Nat.cast_nonneg (α := ℝ) ℓ] + have hC := (normalizedMatching_tail_disk (q.re - (ℓ : ℝ) / 2) ℓ K q s hq hK + (by ring) hsre hsim).1 + have he : ℓ + 5 + 1 = ℓ + 6 := by omega + rw [matchingHomotopyColumn_one (ℓ + 5) K s q (by omega) hq' hsre hsim (by simpa only [he] using hC)] + exact smul_ne_zero (inv_ne_zero (by simpa only [he] using hC)) + (slowBoundaryColumn_ne_zero q (ℓ + 5 + 1) s hq' hsre hsim) + +/-- The scalar identifying the endpoint with the actual column is holomorphic +and nonzero throughout the counting half-plane, including q=0. -/ +theorem analyticAt_matchingTailScalar (ℓ K : ℕ) (s q : ℂ) + (hK : 3 ≤ K) (hq : -(1 / 32 : ℝ) ≤ q.re - (ℓ : ℝ) / 2) + (hsre : s.re = 0) (hsim : s.im ≠ 0) : + AnalyticAt ℂ (fun z => (normalizedMatchingC z (ℓ + 6) s K)⁻¹) q ∧ + (normalizedMatchingC q (ℓ + 6) s K)⁻¹ ≠ 0 := by + have hq' : -1 < q.re := by linarith [Nat.cast_nonneg (α := ℝ) ℓ] + have hC := (normalizedMatching_tail_disk (q.re - (ℓ : ℝ) / 2) ℓ K q s hq hK + (by ring) hsre hsim).1 + exact ⟨((analyticOnNhd_normalizedMatchingC (ℓ + 6) K s hsre hsim) q hq').inv hC, + inv_ne_zero hC⟩ + +noncomputable def matchingColumnDeterminant (u v : Fin 2 → ℂ) : ℂ := u 0 * v 1 - u 1 * v 0 + +theorem matchingColumnDeterminant_smul (a b : ℂ) (u v : Fin 2 → ℂ) : + matchingColumnDeterminant (a • u) (b • v) = a * b * matchingColumnDeterminant u v := by + simp only [matchingColumnDeterminant, Pi.smul_apply, smul_eq_mul] + ring + +theorem matchingHomotopy_endpoint_determinant (M K : ℕ) (s₁ s₂ q₁ q₂ : ℂ) + (hK : 0 < K) (hq₁ : -1 < q₁.re) (hq₂ : -1 < q₂.re) + (hs₁ : s₁.re = 0) (hs₂ : s₂.re = 0) (hi₁ : s₁.im ≠ 0) (hi₂ : s₂.im ≠ 0) + (hC₁ : normalizedMatchingC q₁ (M + 1) s₁ K ≠ 0) + (hC₂ : normalizedMatchingC q₂ (M + 1) s₂ K ≠ 0) : + matchingColumnDeterminant (matchingHomotopyColumn M K s₁ 1 q₁) + (matchingHomotopyColumn M K s₂ 1 q₂) = 0 ↔ + matchingColumnDeterminant (slowBoundaryColumn q₁ (M + 1) s₁) + (slowBoundaryColumn q₂ (M + 1) s₂) = 0 := by + rw [matchingHomotopyColumn_one M K s₁ q₁ hK hq₁ hs₁ hi₁ hC₁, + matchingHomotopyColumn_one M K s₂ q₂ hK hq₂ hs₂ hi₂ hC₂, + matchingColumnDeterminant_smul] + exact mul_eq_zero.trans (or_iff_right (mul_ne_zero (inv_ne_zero hC₁) (inv_ne_zero hC₂))) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/MatchingMatrixSimpleZero.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/MatchingMatrixSimpleZero.lean new file mode 100644 index 0000000000000000000000000000000000000000..ba7979ef0428dcd906491b20921eaba11d4d2b96 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/MatchingMatrixSimpleZero.lean @@ -0,0 +1,87 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralMatchingMatrix +import Mathlib.Analysis.Analytic.Order + +namespace OAI + +/-! A simple zero of the full matching determinant excludes a first +differentiated matching chain. The adjugate identity handles all four columns +without choosing a possibly singular minor. -/ + +open Matrix +namespace DefocusingNLS + +private theorem matrix_det_analyticAt {n : Type*} [Fintype n] [DecidableEq n] + (M : ℂ → Matrix n n ℂ) (z : ℂ) + (hM : ∀ i j, AnalyticAt ℂ (fun w => M w i j) z) : + AnalyticAt ℂ (fun w => (M w).det) z := by + simp_rw [Matrix.det_apply'] + apply Finset.analyticAt_fun_sum + intro σ _ + apply AnalyticAt.mul analyticAt_const + apply Finset.analyticAt_fun_prod + intro i _ + exact hM (σ i) i + +private theorem matrix_adjugate_analyticAt {n : Type*} [Fintype n] [DecidableEq n] + (M : ℂ → Matrix n n ℂ) (z : ℂ) + (hM : ∀ i j, AnalyticAt ℂ (fun w => M w i j) z) (i j : n) : + AnalyticAt ℂ (fun w => (M w).adjugate i j) z := by + simp_rw [Matrix.adjugate_apply] + apply matrix_det_analyticAt + intro k l + by_cases hk : k = j + · subst k + simp only [Matrix.updateRow_self] + exact analyticAt_const + · simpa only [Matrix.updateRow_ne hk] using hM k l + +private theorem matrix_mulVec_hasDerivAt {n : Type*} [Fintype n] + (M : ℂ → Matrix n n ℂ) (dM : Matrix n n ℂ) (z : ℂ) + (hM : ∀ i j, HasDerivAt (fun w => M w i j) (dM i j) z) (u : n → ℂ) (i : n) : + HasDerivAt (fun w => (M w *ᵥ u) i) ((dM *ᵥ u) i) z := by + simpa only [Matrix.mulVec, dotProduct] using + (HasDerivAt.fun_sum (u := Finset.univ) (fun j _ => (hM i j).mul_const (u j))) + +theorem matchingMatrix_simple_zero_no_chain {n : Type*} [Fintype n] [DecidableEq n] + (M : ℂ → Matrix n n ℂ) (z : ℂ) + (hM : ∀ i j, AnalyticAt ℂ (fun w => M w i j) z) + (hsimple : analyticOrderAt (fun w => (M w).det) z = 1) + (u v : n → ℂ) (hu : u ≠ 0) (hkernel : M z *ᵥ u = 0) : + M z *ᵥ v + (fun i j => deriv (fun w => M w i j) z) *ᵥ u ≠ 0 := by + classical + let dM : Matrix n n ℂ := fun i j => deriv (fun w => M w i j) z + let D : ℂ → ℂ := fun w => (M w).det + have hD : AnalyticAt ℂ D z := matrix_det_analyticAt M z hM + have hz : D z = 0 := apply_eq_zero_of_analyticOrderAt_ne_zero + (by rw [show analyticOrderAt D z = 1 from hsimple]; exact one_ne_zero) + have hdo : analyticOrderAt (deriv D) z = 0 := + analyticOrderAt_deriv_of_pos hD (n := 0) (by simpa using hsimple) + have hd : deriv D z ≠ 0 := hD.deriv.analyticOrderAt_eq_zero.mp hdo + have hMd (i j : n) : HasDerivAt (fun w => M w i j) (dM i j) z := + (hM i j).differentiableAt.hasDerivAt + have hAdj (w : ℂ) (x : n → ℂ) : + (M w).adjugate *ᵥ (M w *ᵥ x) = D w • x := by + rw [Matrix.mulVec_mulVec, Matrix.adjugate_mul, Matrix.smul_mulVec, Matrix.one_mulVec] + intro hchain + have hzero : (M z).adjugate *ᵥ (dM *ᵥ u) = 0 := by + have he := congrArg (fun x => (M z).adjugate *ᵥ x) hchain + rw [Matrix.mulVec_add, hAdj, hz, zero_smul, zero_add, Matrix.mulVec_zero] at he + exact he + have hder (i : n) : HasDerivAt (fun w => ((M w).adjugate *ᵥ (M w *ᵥ u)) i) + (((M z).adjugate *ᵥ (dM *ᵥ u)) i) z := by + have hh := HasDerivAt.fun_sum (u := Finset.univ) (fun j _ => + ((matrix_adjugate_analyticAt M z hM i j).differentiableAt.hasDerivAt).mul + (matrix_mulVec_hasDerivAt M dM z hMd u j)) + simp only [hkernel, Pi.zero_apply, mul_zero, zero_add] at hh + convert! hh using 1 + have he (i : n) : deriv D z * u i = 0 := by + have hl := hder i + simp only [hAdj, Pi.smul_apply, smul_eq_mul, hzero, Pi.zero_apply] at hl + exact (hD.differentiableAt.hasDerivAt.mul_const (u i)).unique hl + apply hu + funext i + exact (mul_eq_zero.mp (he i)).resolve_left hd + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/MatchingPolynomialDegree.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/MatchingPolynomialDegree.lean new file mode 100644 index 0000000000000000000000000000000000000000..8de2a008b9e99f85c133f1e14f289175d290de2f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/MatchingPolynomialDegree.lean @@ -0,0 +1,72 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.SeparatorPolynomials + +namespace OAI + +/-! # Degree bounds for the zero-tail matching polynomial -/ + +open Polynomial + +namespace DefocusingNLS.SeparatorArithmetic + +theorem length_addCoefficients (xs ys : List GaussianInt) : + (addCoefficients xs ys).length = max xs.length ys.length := by + induction xs generalizing ys with + | nil => simp [addCoefficients] + | cons x xs ih => + cases ys with + | nil => simp [addCoefficients] + | cons y ys => simp [addCoefficients, ih, Nat.succ_max_succ] + +theorem length_mulLinear (a : GaussianInt) (xs : List GaussianInt) : + (mulLinear a xs).length = xs.length + 1 := by + simp [mulLinear, length_addCoefficients, scaleCoefficients] + +theorem backwardStep_lengths (ℓ n k : ℕ) (xy : List GaussianInt × List GaussianInt) + (hx : xy.1.length = k) (hy : xy.2.length = k + 1) : + (backwardStep ℓ n xy).1.length = k + 1 ∧ + (backwardStep ℓ n xy).2.length = k + 2 := by + simp only [backwardStep, length_addCoefficients, length_mulLinear, + scaleCoefficients, List.length_map, hx, hy, max_self] + simp [Nat.add_assoc] + +theorem backward_fold_lengths (ℓ : ℕ) (ns : List ℕ) + (xy : List GaussianInt × List GaussianInt) (k : ℕ) + (hx : xy.1.length = k) (hy : xy.2.length = k + 1) : + (ns.foldl (fun xy n => backwardStep ℓ n xy) xy).1.length = k + ns.length ∧ + (ns.foldl (fun xy n => backwardStep ℓ n xy) xy).2.length = k + ns.length + 1 := by + induction ns generalizing xy k with + | nil => simp [hx, hy] + | cons n ns ih => + have h := backwardStep_lengths ℓ n k xy hx hy + simpa only [List.foldl_cons, List.length_cons, Nat.add_assoc, Nat.add_left_comm, + Nat.add_comm] using ih (backwardStep ℓ n xy) (k + 1) h.1 h.2 + +theorem backwardCoefficients_lengths (ℓ : ℕ) : + (backwardCoefficients ℓ).1.length = 8 ∧ + (backwardCoefficients ℓ).2.length = 9 := by + exact backward_fold_lengths ℓ [7, 6, 5, 4, 3, 2, 1, 0] ([], [1]) 0 rfl rfl + +theorem toPolynomial_natDegree_le (xs : List GaussianInt) (n : ℕ) + (h : xs.length ≤ n + 1) : (toPolynomial xs).natDegree ≤ n := by + apply natDegree_le_iff_coeff_eq_zero.mpr + intro j hj + rw [coeff_toPolynomial, List.getElem?_eq_none (by omega)] + rfl + +theorem backward_polynomial_product_degree (ℓ : ℕ) : + (toPolynomial (backwardCoefficients ℓ).1 * + (toPolynomial (backwardCoefficients ℓ).2).map (starRingEnd GaussianInt)).natDegree ≤ 15 := by + have h := backwardCoefficients_lengths ℓ + exact natDegree_mul_le.trans (add_le_add + (toPolynomial_natDegree_le _ 7 (by omega)) + (natDegree_map_le.trans (toPolynomial_natDegree_le _ 8 (by omega)))) + +theorem windingCoefficient_eq_zero (ℓ j : ℕ) (hj : 15 < j) : + windingCoefficient ℓ j = 0 := by + rw [windingCoefficient_eq, + coeff_eq_zero_of_natDegree_lt ((backward_polynomial_product_degree ℓ).trans_lt hj)] + rfl + +end DefocusingNLS.SeparatorArithmetic + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/MatchingSimpleZero.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/MatchingSimpleZero.lean new file mode 100644 index 0000000000000000000000000000000000000000..7cbfe462f62abb0da804e3ad213f36cc659f760c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/MatchingSimpleZero.lean @@ -0,0 +1,74 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.MatchingBoundary +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralEndpointMultiplicity + +namespace OAI + +/-! A simple two-column determinant zero excludes a differentiated matching +chain. This is the finite boundary calculation needed for generalized modes. -/ + +namespace DefocusingNLS + +theorem matchingColumn_no_chain (u v du dv : Fin 2 → ℂ) (hu : u≠0) + (hz : matchingColumnDeterminant u v=0) + (hd : matchingColumnDeterminant du v+matchingColumnDeterminant u dv≠0) + (a b A B : ℂ) (hab : a≠0 ∨ b≠0) + (he : a • u+b • v=0) : A • u+B • v+a • du+b • dv≠0 := by + obtain ⟨c,hv⟩ := matchingColumnDeterminant_eq_zero_imp_smul u v hu hz + have hc : a+b*c=0 := by + apply (smul_eq_zero.mp ?_).resolve_right hu + calc + (a+b*c) • u = a • u+b • v := by rw [hv,smul_smul,add_smul] + _ = 0 := he + have hb : b≠0 := by + intro hb + have ha : a=0 := by simpa only [hb,zero_mul,add_zero] using hc + exact hab.elim (fun h => h ha) (fun h => h hb) + intro hchain + have hd0 := congrArg (matchingColumnDeterminant u) hchain + have hv0 := congrFun hv 0 + have hv1 := congrFun hv 1 + simp only [Pi.smul_apply,smul_eq_mul] at hv0 hv1 + simp only [matchingColumnDeterminant,Pi.add_apply,Pi.smul_apply,smul_eq_mul, + Pi.zero_apply,hv0,hv1,mul_zero,sub_zero] at hd0 + have hprod : b*(matchingColumnDeterminant du v+matchingColumnDeterminant u dv)=0 := by + simp only [matchingColumnDeterminant,hv0,hv1] + linear_combination hd0-(u 0*du 1-u 1*du 0)*hc + exact hd ((mul_eq_zero.mp hprod).resolve_left hb) + +theorem matchingColumnDeterminant_hasDerivAt + (U V : ℂ → Fin 2 → ℂ) (du dv : Fin 2 → ℂ) (z : ℂ) + (hU : HasDerivAt U du z) (hV : HasDerivAt V dv z) : + HasDerivAt (fun w => matchingColumnDeterminant (U w) (V w)) + (matchingColumnDeterminant du (V z)+matchingColumnDeterminant (U z) dv) z := by + have hu0 := (hasDerivAt_pi.mp hU) 0 + have hu1 := (hasDerivAt_pi.mp hU) 1 + have hv0 := (hasDerivAt_pi.mp hV) 0 + have hv1 := (hasDerivAt_pi.mp hV) 1 + have he : matchingColumnDeterminant du (V z)+matchingColumnDeterminant (U z) dv = + (du 0*V z 1+U z 0*dv 1)-(du 1*V z 0+U z 1*dv 0) := by + simp only [matchingColumnDeterminant] + ring + rw [he] + exact (hu0.mul hv1).sub (hu1.mul hv0) + +theorem matchingColumn_simple_zero_no_chain + (U V : ℂ → Fin 2 → ℂ) (z : ℂ) + (hU : AnalyticAt ℂ U z) (hV : AnalyticAt ℂ V z) (hu : U z≠0) + (hsimple : analyticOrderAt (fun w => matchingColumnDeterminant (U w) (V w)) z=1) + (a b A B : ℂ) (hab : a≠0 ∨ b≠0) (he : a • U z+b • V z=0) : + A • U z+B • V z+a • deriv U z+b • deriv V z≠0 := by + let D := fun w => matchingColumnDeterminant (U w) (V w) + have hD : AnalyticAt ℂ D z := analyticAt_matchingColumnDeterminant hU hV + have hz : D z=0 := apply_eq_zero_of_analyticOrderAt_ne_zero + (by rw [show analyticOrderAt D z=1 from hsimple]; exact one_ne_zero) + have hdord : analyticOrderAt (deriv D) z=0 := + analyticOrderAt_deriv_of_pos hD (n := 0) (by simpa using hsimple) + have hd : deriv D z≠0 := hD.deriv.analyticOrderAt_eq_zero.mp hdord + have hder := matchingColumnDeterminant_hasDerivAt U V (deriv U z) (deriv V z) z + hU.differentiableAt.hasDerivAt hV.differentiableAt.hasDerivAt + rw [hder.deriv] at hd + exact matchingColumn_no_chain (U z) (V z) (deriv U z) (deriv V z) hu hz hd a b A B hab he + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/MixedFourierLocalization.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/MixedFourierLocalization.lean new file mode 100644 index 0000000000000000000000000000000000000000..3f459ecd4784055a7dcb7c796ca47dcf91b2b7aa --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/MixedFourierLocalization.lean @@ -0,0 +1,86 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.SobolevWeights +import Mathlib.Analysis.MeanInequalities +import Mathlib.MeasureTheory.Group.Integral +import Mathlib.MeasureTheory.Integral.Bochner.Set +import Mathlib.MeasureTheory.Measure.Haar.InnerProductSpace + +namespace OAI + +/-! # The mixed Fourier estimate used by torus localization + +The localization kernel sends lattice coefficients to a continuous Fourier +variable. A finite Schur estimate gives the required ℓ²-to-L² bound; its +constants are the uniform periodized L¹ bound and the ordinary L¹ norm of +the kernel. No localization bound is assumed. +-/ + +open MeasureTheory + +namespace DefocusingNLS + +/-- Weighted Cauchy--Schwarz for the finite mixed Fourier sum. -/ +theorem mixedFourier_pointwise_bound (S : Finset frequencyLattice) + (v : frequencyLattice → ℂ) + (K : EuclideanSpace ℝ (Fin 12) → ℂ) + (x : EuclideanSpace ℝ (Fin 12)) (C : ℝ) + (hK : ∑ n ∈ S, ‖K (x - n)‖ ≤ C) : + ‖∑ n ∈ S, v n * K (x - n)‖ ^ 2 ≤ + C * ∑ n ∈ S, ‖v n‖ ^ 2 * ‖K (x - n)‖ := by + have hn : ‖∑ n ∈ S, v n * K (x - n)‖ ≤ + ∑ n ∈ S, ‖v n‖ * ‖K (x - n)‖ := by + simpa only [norm_mul] using norm_sum_le S (fun n => v n * K (x - n)) + have hcs := Finset.sum_sq_le_sum_mul_sum_of_sq_le_mul S + (r := fun n => ‖v n‖ * ‖K (x - n)‖) + (f := fun n => ‖v n‖ ^ 2 * ‖K (x - n)‖) + (g := fun n => ‖K (x - n)‖) + (fun n _ => mul_nonneg (sq_nonneg _) (norm_nonneg _)) + (fun n _ => norm_nonneg _) (fun n _ => le_of_eq (by ring)) + have hsum : 0 ≤ ∑ n ∈ S, ‖v n‖ * ‖K (x - n)‖ := + Finset.sum_nonneg (fun n _ => mul_nonneg (norm_nonneg _) (norm_nonneg _)) + have hsum2 : 0 ≤ ∑ n ∈ S, ‖v n‖ ^ 2 * ‖K (x - n)‖ := + Finset.sum_nonneg (fun n _ => mul_nonneg (sq_nonneg _) (norm_nonneg _)) + calc + _ ≤ (∑ n ∈ S, ‖v n‖ * ‖K (x - n)‖) ^ 2 := by + nlinarith [norm_nonneg (∑ n ∈ S, v n * K (x - n))] + _ ≤ (∑ n ∈ S, ‖v n‖ ^ 2 * ‖K (x - n)‖) * ∑ n ∈ S, ‖K (x - n)‖ := hcs + _ ≤ (∑ n ∈ S, ‖v n‖ ^ 2 * ‖K (x - n)‖) * C := + mul_le_mul_of_nonneg_left hK hsum2 + _ = _ := mul_comm _ _ + +/-- The mixed lattice-to-continuum Fourier kernel is bounded on finite sums. +The bound is independent of the finite frequency set. -/ +theorem mixedFourier_integral_bound (S : Finset frequencyLattice) + (v : frequencyLattice → ℂ) + (K : EuclideanSpace ℝ (Fin 12) → ℂ) (hK : Integrable K) + (C : ℝ) (_hC : 0 ≤ C) + (hperiod : ∀ x, ∑ n ∈ S, ‖K (x - n)‖ ≤ C) : + Integrable (fun x => ‖∑ n ∈ S, v n * K (x - n)‖ ^ 2) ∧ + (∫ x, ‖∑ n ∈ S, v n * K (x - n)‖ ^ 2) ≤ + C * (∫ x, ‖K x‖) * ∑ n ∈ S, ‖v n‖ ^ 2 := by + have hfin : Integrable (fun x => ∑ n ∈ S, v n * K (x - n)) := by + apply integrable_finsetSum + intro n _ + exact (hK.comp_sub_right (n : EuclideanSpace ℝ (Fin 12))).const_mul (v n) + have hterm (n : frequencyLattice) : Integrable (fun x => ‖v n‖ ^ 2 * ‖K (x - n)‖) := + ((hK.comp_sub_right (n : EuclideanSpace ℝ (Fin 12))).norm).const_mul _ + have hmajor : Integrable (fun x => C * ∑ n ∈ S, ‖v n‖ ^ 2 * ‖K (x - n)‖) := + (integrable_finsetSum S (fun n _ => hterm n)).const_mul C + have hpoint := mixedFourier_pointwise_bound S v K + have hsq : Integrable (fun x => ‖∑ n ∈ S, v n * K (x - n)‖ ^ 2) := by + apply hmajor.mono' (hfin.norm.aestronglyMeasurable.pow 2) + filter_upwards [] with x + rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] + exact hpoint x C (hperiod x) + refine ⟨hsq, (integral_mono hsq hmajor (fun x => + hpoint x C (hperiod x))).trans_eq ?_⟩ + rw [integral_const_mul, integral_finsetSum S (fun n _ => hterm n)] + simp only [integral_const_mul] + simp_rw [show ∀ n : frequencyLattice, + (∫ x, ‖K (x - n)‖) = ∫ x, ‖K x‖ from + fun n => integral_sub_right_eq_self (fun x => ‖K x‖) n] + rw [← Finset.sum_mul] + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/NearIdentityInverse.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/NearIdentityInverse.lean new file mode 100644 index 0000000000000000000000000000000000000000..6e6772f00b8b80bb74e27d67f30c7e145ad6fc8a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/NearIdentityInverse.lean @@ -0,0 +1,46 @@ +import Mathlib.Analysis.Normed.Ring.Units +import Mathlib.Analysis.Normed.Operator.Banach + +namespace OAI + +/-! # A bounded inverse for a coordinate matrix close to the identity -/ + +namespace DefocusingNLS + +theorem exists_nearIdentity_inverse {F : Type*} + [NormedAddCommGroup F] [NormedSpace ℝ F] [CompleteSpace F] + (A : F →L[ℝ] F) (hA : ‖A - ContinuousLinearMap.id ℝ F‖ < 1 / 2) : + ∃ D : F →L[ℝ] F, D.comp A = ContinuousLinearMap.id ℝ F ∧ + A.comp D = ContinuousLinearMap.id ℝ F ∧ ‖D‖ ≤ 2 := by + have hsmall : ‖(1 : F →L[ℝ] F) - A‖ < 1 := by + rw [norm_sub_rev] + exact hA.trans (by norm_num) + let U := Units.oneSub ((1 : F →L[ℝ] F) - A) hsmall + have hU : (U : F →L[ℝ] F) = A := by + simp only [U, Units.val_oneSub, sub_sub_cancel] + let D : F →L[ℝ] F := ↑U⁻¹ + have hDA : D.comp A = ContinuousLinearMap.id ℝ F := by + change U.inv * A = 1 + rw [← hU] + exact U.inv_val + have hAD : A.comp D = ContinuousLinearMap.id ℝ F := by + change A * U.inv = 1 + rw [← hU] + exact U.val_inv + refine ⟨D, hDA, hAD, ContinuousLinearMap.opNorm_le_bound _ (by norm_num) (fun v => ?_)⟩ + have he : A (D v) = v := congrArg (fun T : F →L[ℝ] F => T v) hAD + have hd : ((1 : F →L[ℝ] F) - A) (D v) = D v - v := by + simp only [sub_apply, one_apply_eq_self, he] + have hb := ((1 : F →L[ℝ] F) - A).le_opNorm (D v) + rw [hd] at hb + have hnorm : ‖(1 : F →L[ℝ] F) - A‖ = ‖A - ContinuousLinearMap.id ℝ F‖ := + norm_sub_rev _ _ + rw [hnorm] at hb + have hmul := mul_le_mul_of_nonneg_right hA.le (norm_nonneg (D v)) + have ht := norm_add_le (D v - v) v + rw [sub_add_cancel] at ht + linarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/NormalizedForwardJet.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/NormalizedForwardJet.lean new file mode 100644 index 0000000000000000000000000000000000000000..1721efeb7ce291f8f171d5e40949371f05c9bcc9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/NormalizedForwardJet.lean @@ -0,0 +1,69 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ForwardConeTransport + +namespace OAI + +/-! # Forward jets and their Pochhammer divisors -/ + +open Matrix Polynomial + +namespace DefocusingNLS + +noncomputable def normalizedForwardJet (M s q : ℂ) (w : Fin 2 → ℂ) : + ℕ → Fin 2 → ℂ + | 0 => w + | n + 1 => (q + n - M)⁻¹ • (forwardMatrix M s (q + n) *ᵥ + normalizedForwardJet M s q w n) + +theorem normalizedForwardJet_eq (M s q : ℂ) (w : Fin 2 → ℂ) (n : ℕ) : + normalizedForwardJet M s q w n = + ((ascPochhammer ℂ n).eval (q - M))⁻¹ • (forwardProduct M s q n *ᵥ w) := by + induction n with + | zero => simp [normalizedForwardJet, forwardProduct] + | succ n ih => + rw [normalizedForwardJet, ih, Matrix.mulVec_smul, smul_smul, + forwardProduct, ← Matrix.mulVec_mulVec, ascPochhammer_succ_eval, _root_.mul_inv_rev] + congr 1 + congr 1 + ring + +theorem normalizedForwardJet_succ_first (M s q : ℂ) (w : Fin 2 → ℂ) (n : ℕ) : + normalizedForwardJet M s q w (n + 1) 0 = + ((q + n) * normalizedForwardJet M s q w n 0 + + s * normalizedForwardJet M s q w n 1) / (q + n - M) := by + simp [normalizedForwardJet, forwardMatrix, dotProduct, Fin.sum_univ_two, + div_eq_mul_inv, mul_comm] + +theorem normalizedForwardJet_succ_second (M s q : ℂ) (w : Fin 2 → ℂ) (n : ℕ) + (hd : q + n - M ≠ 0) : + normalizedForwardJet M s q w (n + 1) 1 = normalizedForwardJet M s q w n 1 - + normalizedForwardJet M s q w (n + 1) 0 := by + rw [normalizedForwardJet_succ_first] + conv_lhs => rw [normalizedForwardJet] + simp [forwardMatrix, dotProduct, Fin.sum_univ_two] + + field_simp [hd] + ring + +theorem normalizedForwardJet_increment (M : ℝ) (s q : ℂ) (w : Fin 2 → ℂ) (n : ℕ) + (hs : s.re = 0) (hd : q + n - (M : ℂ) ≠ 0) : + coneForm M s (normalizedForwardJet M s q w (n + 1) 0) + (normalizedForwardJet M s q w (n + 1) 1) - + coneForm M s (normalizedForwardJet M s q w n 0) + (normalizedForwardJet M s q w n 1) = + ((q + n).re - M / 2) * Complex.normSq + (normalizedForwardJet M s q w n 0 - normalizedForwardJet M s q w (n + 1) 0) := by + let B := normalizedForwardJet M s q w n 0 + let C := normalizedForwardJet M s q w n 1 + let B' := normalizedForwardJet M s q w (n + 1) 0 + have hB : B' = ((q + n) * B + s * C) / (q + n - M) := + normalizedForwardJet_succ_first M s q w n + have hrec : (q + n) * (B - B') = -(M : ℂ) * (B - (B - B')) - s * C := by + rw [hB] + field_simp [hd] + ring + have h := coneForm_increment M s (q + n) B C (B - B') hs hrec + simpa only [sub_sub_cancel, B, C, B', ← normalizedForwardJet_succ_second M s q w n hd] using h + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/NormalizedMatchingColumns.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/NormalizedMatchingColumns.lean new file mode 100644 index 0000000000000000000000000000000000000000..399ec6965094048de0c483dabadfe3f6635e3c82 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/NormalizedMatchingColumns.lean @@ -0,0 +1,110 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Profile.SlowAdjacentParameter + +namespace OAI + +/-! # The normalized backward column, including the removable parameter -/ + +open Matrix Polynomial + +namespace DefocusingNLS + +theorem normalizedSlowC_one (q : ℂ) (m : ℕ) (s : ℂ) + (hq : -1 < q.re) (hsre : s.re = 0) (hsim : s.im ≠ 0) : + normalizedSlowC q m s 1 = regularizedSlowSolution (q + 1) (m + 1) (-s) - + regularizedSlowSolution (q + 1) m (-s) := by + have hq' : 0 < (q + 1).re := by change 0 < q.re + 1; linarith + change slowLaguerreB (q + 1) (m + 1) s (0 + 1) = _ + rw [slowLaguerreB_succ, slowLaguerreB_zero, + slowLaguerreCoefficient_zero (q + 1) m s hq' hsre hsim] + +theorem normalizedSlow_initial_column (q : ℂ) (M : ℕ) (s : ℂ) + (hq : -1 < q.re) (hsre : s.re = 0) (hsim : s.im ≠ 0) : + backwardMatrix M s q *ᵥ ![normalizedSlowB q (M + 1) s 1, + normalizedSlowC q (M + 1) s 1] = + ![regularizedSlowSolution q (M + 1) (-s), + -deriv (regularizedSlowSolution q (M + 1)) (-s)] := by + have hs0 : -s ≠ 0 := neg_ne_zero.mpr (fun h => hsim (by simp [h])) + have hx : 0 ≤ (-s).re := by simp [hsre] + have hc := regularizedSlowSolution_contiguous q (M + 1) (-s) hq hx hs0 + have hd := (hasDerivAt_regularizedSlowSolution_shift_closed q (M + 1) (-s) hq hx hs0).deriv + rw [normalizedSlowB_one q (M + 1) s hq hsre hsim, + normalizedSlowC_one q (M + 1) s hq hsre hsim] + ext i + fin_cases i + · simp [backwardMatrix, Matrix.mulVec, dotProduct, Fin.sum_univ_two] at hc ⊢ + linear_combination -hc + · simp [backwardMatrix, Matrix.mulVec, dotProduct, Fin.sum_univ_two, hd] + ring + +theorem normalizedSlow_backward_relation (q : ℂ) (M : ℕ) (s : ℂ) (n : ℕ) + (hn : 1 ≤ n) (hq : -1 < q.re) (hsre : s.re = 0) (hsim : s.im ≠ 0) : + (q + n - M) * normalizedSlowB q (M + 1) s (n + 1) = + (q + n) * normalizedSlowB q (M + 1) s n + + s * normalizedSlowC q (M + 1) s n := by + have h := normalizedSlow_recurrence q M s n hn hq hsre hsim + have hg : normalizedSlowCoefficient q (M + 1) s n = + normalizedSlowB q (M + 1) s n - normalizedSlowB q (M + 1) s (n + 1) := by + rw [normalizedSlowB_succ] + ring + rw [hg] at h + linear_combination -h + +/-- The factor q has disappeared from the backward product, with no division +in the argument. In particular this formula is valid at q=0. -/ +theorem normalizedSlow_backwardProduct (q : ℂ) (M K : ℕ) (s : ℂ) + (hq : -1 < q.re) (hsre : s.re = 0) (hsim : s.im ≠ 0) : + backwardProduct M s q (K + 1) *ᵥ + ![normalizedSlowB q (M + 1) s (K + 1), normalizedSlowC q (M + 1) s (K + 1)] = + (ascPochhammer ℂ K).eval (q + 1) • + ![regularizedSlowSolution q (M + 1) (-s), + -deriv (regularizedSlowSolution q (M + 1)) (-s)] := by + induction K with + | zero => + simpa only [backwardProduct, Matrix.one_mul, Nat.cast_zero, add_zero, + ascPochhammer_zero, Polynomial.eval_one, one_smul] using + normalizedSlow_initial_column q M s hq hsre hsim + | succ K ih => + rw [backwardProduct, ← Matrix.mulVec_mulVec, + backwardMatrix_step M s (q + (K + 1 : ℕ)) _ _ _ _ + (normalizedSlow_backward_relation q M s (K + 1) (by omega) hq hsre hsim) + (normalizedSlowC_succ q (M + 1) s (K + 1)), + Matrix.mulVec_smul, ih, smul_smul, ascPochhammer_succ_eval] + congr 1 + push_cast + ring + +theorem shiftedPochhammer_ne_zero (q : ℂ) (K : ℕ) (hq : -1 < q.re) : + (ascPochhammer ℂ K).eval (q + 1) ≠ 0 := by + intro hz + obtain ⟨n, _, hn⟩ := (ascPochhammer_eval_eq_zero_iff K (q + 1)).mp hz + have hre := congrArg Complex.re hn + simp only [Complex.natCast_re, Complex.neg_re, Complex.add_re, Complex.one_re] at hre + linarith [Nat.cast_nonneg (α := ℝ) n] + +noncomputable def normalizedMatchingB (q : ℂ) (m : ℕ) (s : ℂ) (K : ℕ) : ℂ := + normalizedSlowB q m s K / (ascPochhammer ℂ (K - 1)).eval (q + 1) + +noncomputable def normalizedMatchingC (q : ℂ) (m : ℕ) (s : ℂ) (K : ℕ) : ℂ := + normalizedSlowC q m s K / (ascPochhammer ℂ (K - 1)).eval (q + 1) + +/-- The fully normalized tail produces precisely the actual boundary jet. -/ +theorem normalizedMatching_backwardProduct (q : ℂ) (M K : ℕ) (s : ℂ) + (hK : 0 < K) (hq : -1 < q.re) (hsre : s.re = 0) (hsim : s.im ≠ 0) : + backwardProduct M s q K *ᵥ + ![normalizedMatchingB q (M + 1) s K, normalizedMatchingC q (M + 1) s K] = + ![regularizedSlowSolution q (M + 1) (-s), + -deriv (regularizedSlowSolution q (M + 1)) (-s)] := by + obtain ⟨j, rfl⟩ := Nat.exists_eq_succ_of_ne_zero hK.ne' + have hp := shiftedPochhammer_ne_zero q j hq + have hv : ![normalizedMatchingB q (M + 1) s (j + 1), + normalizedMatchingC q (M + 1) s (j + 1)] = + ((ascPochhammer ℂ j).eval (q + 1))⁻¹ • + ![normalizedSlowB q (M + 1) s (j + 1), normalizedSlowC q (M + 1) s (j + 1)] := by + ext i + fin_cases i <;> simp [normalizedMatchingB, normalizedMatchingC, div_eq_mul_inv, mul_comm] + rw [hv, Matrix.mulVec_smul, normalizedSlow_backwardProduct q M j s hq hsre hsim, + smul_smul, inv_mul_cancel₀ hp, one_smul] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/NormalizedTailHolomorphy.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/NormalizedTailHolomorphy.lean new file mode 100644 index 0000000000000000000000000000000000000000..59be9b1c8037f62fb886bc25800605f4127e2023 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/NormalizedTailHolomorphy.lean @@ -0,0 +1,87 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Profile.SlowLaguerreHolomorphy +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.AnalyticMatchingColumn + +namespace OAI + +/-! # Holomorphy of the normalized tail and its disk-valued ratio -/ + +open Set Polynomial + +namespace DefocusingNLS + +theorem differentiableAt_slowLaguerreB (q : ℂ) (m n : ℕ) (s : ℂ) + (hq : -1 < q.re) (hsre : s.re = 0) (hsim : s.im ≠ 0) : + DifferentiableAt ℂ (fun z => slowLaguerreB z m s n) q := by + have hs0 : -s ≠ 0 := neg_ne_zero.mpr (fun h => hsim (by simp [h])) + have hb := differentiableAt_regularizedSlowSolution_parameter_closed q m (-s) hq + (by simp [hsre]) hs0 + have hsum : DifferentiableAt ℂ + (fun z => ∑ j ∈ Finset.range n, slowLaguerreCoefficient z m s j) q := + DifferentiableAt.fun_sum fun j _ => differentiableAt_slowLaguerreCoefficient q m j s hq hsre hsim + convert! hb.sub hsum using 1 + funext z + simp [slowLaguerreB, shiftedSlowDerivative] + +theorem differentiableAt_normalizedSlowB (q : ℂ) (m n : ℕ) (s : ℂ) + (hq : -1 < q.re) (hsre : s.re = 0) (hsim : s.im ≠ 0) : + DifferentiableAt ℂ (fun z => normalizedSlowB z m s n) q := by + have hq' : -1 < (q + 1).re := by change -1 < q.re + 1; linarith + have h : DifferentiableAt ℂ (fun z => slowLaguerreCoefficient z (m + 1) s (n - 1)) (q + 1) := + differentiableAt_slowLaguerreCoefficient (q + 1) (m + 1) (n - 1) s hq' hsre hsim + have hs : DifferentiableAt ℂ (fun z : ℂ => z + 1) q := differentiableAt_id.add_const 1 + convert! h.comp q hs using 1 + +theorem differentiableAt_normalizedSlowC (q : ℂ) (m n : ℕ) (s : ℂ) + (hq : -1 < q.re) (hsre : s.re = 0) (hsim : s.im ≠ 0) : + DifferentiableAt ℂ (fun z => normalizedSlowC z m s n) q := by + have hq' : -1 < (q + 1).re := by change -1 < q.re + 1; linarith + exact (differentiableAt_slowLaguerreB (q + 1) (m + 1) n s hq' hsre hsim).comp q + (differentiableAt_id.add_const 1) + +theorem differentiableAt_normalizedMatchingB (q : ℂ) (m K : ℕ) (s : ℂ) + (hq : -1 < q.re) (hsre : s.re = 0) (hsim : s.im ≠ 0) : + DifferentiableAt ℂ (fun z => normalizedMatchingB z m s K) q := by + have hp := ((ascPochhammer ℂ (K - 1)).hasDerivAt (q + 1)).differentiableAt.comp q + (differentiableAt_id.add_const 1) + exact (differentiableAt_normalizedSlowB q m K s hq hsre hsim).div hp + (shiftedPochhammer_ne_zero q (K - 1) hq) + +theorem differentiableAt_normalizedMatchingC (q : ℂ) (m K : ℕ) (s : ℂ) + (hq : -1 < q.re) (hsre : s.re = 0) (hsim : s.im ≠ 0) : + DifferentiableAt ℂ (fun z => normalizedMatchingC z m s K) q := by + have hp := ((ascPochhammer ℂ (K - 1)).hasDerivAt (q + 1)).differentiableAt.comp q + (differentiableAt_id.add_const 1) + exact (differentiableAt_normalizedSlowC q m K s hq hsre hsim).div hp + (shiftedPochhammer_ne_zero q (K - 1) hq) + +theorem analyticOnNhd_normalizedMatchingB (m K : ℕ) (s : ℂ) + (hsre : s.re = 0) (hsim : s.im ≠ 0) : + AnalyticOnNhd ℂ (fun q => normalizedMatchingB q m s K) {q : ℂ | -1 < q.re} := by + apply DifferentiableOn.analyticOnNhd _ (isOpen_lt continuous_const Complex.continuous_re) + intro q hq + exact (differentiableAt_normalizedMatchingB q m K s hq hsre hsim).differentiableWithinAt + +theorem analyticOnNhd_normalizedMatchingC (m K : ℕ) (s : ℂ) + (hsre : s.re = 0) (hsim : s.im ≠ 0) : + AnalyticOnNhd ℂ (fun q => normalizedMatchingC q m s K) {q : ℂ | -1 < q.re} := by + apply DifferentiableOn.analyticOnNhd _ (isOpen_lt continuous_const Complex.continuous_re) + intro q hq + exact (differentiableAt_normalizedMatchingC q m K s hq hsre hsim).differentiableWithinAt + +noncomputable def slowTailRatio (q : ℂ) (m K : ℕ) (s : ℂ) : ℂ := + normalizedMatchingB q m s K / normalizedMatchingC q m s K + +/-- Holomorphy includes the boundary of the counting half-plane and q=0. -/ +theorem analyticAt_slowTailRatio (q : ℂ) (ℓ K : ℕ) (s : ℂ) + (hK : 3 ≤ K) (hq : -(1 / 32 : ℝ) ≤ q.re - (ℓ : ℝ) / 2) + (hsre : s.re = 0) (hsim : s.im ≠ 0) : + AnalyticAt ℂ (fun z => slowTailRatio z (ℓ + 6) K s) q := by + have hq' : -1 < q.re := by linarith [Nat.cast_nonneg (α := ℝ) ℓ] + have hC := (normalizedMatching_tail_disk (q.re - (ℓ : ℝ) / 2) ℓ K q s hq hK + (by ring) hsre hsim).1 + exact ((analyticOnNhd_normalizedMatchingB (ℓ + 6) K s hsre hsim) q hq').div + ((analyticOnNhd_normalizedMatchingC (ℓ + 6) K s hsre hsim) q hq') hC + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/OutgoingHalfPlaneCount.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/OutgoingHalfPlaneCount.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd6a6414d88dff2f1ece78831a84ccd54350fd13 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/OutgoingHalfPlaneCount.lean @@ -0,0 +1,74 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.CentralOutgoingCount + +namespace OAI + +/-! # Numerical outgoing counts in the full counting half-plane -/ + +open Set + +namespace DefocusingNLS + +noncomputable def countingHalfPlaneZeroCount (f : ℂ → ℂ) : ℕ∞ := + ∑' z : {z : ℂ | -(1 / 32 : ℝ) < z.re}, analyticOrderAt f z.1 + +theorem countingHalfPlaneZeroCount_eq_rectangle (f : ℂ → ℂ) (V : ℝ) + (hn : ∀ z : ℂ, -(1 / 32 : ℝ) < z.re → z ∉ countingRectangle V → f z ≠ 0) : + countingHalfPlaneZeroCount f = rectangleZeroCount V f := by + classical + unfold countingHalfPlaneZeroCount rectangleZeroCount + rw [tsum_subtype, tsum_subtype] + apply tsum_congr + intro z + by_cases hz : z ∈ countingRectangle V + · have hr : -(1 / 32 : ℝ) < z.re := hz.1 + simp only [Set.indicator_apply, Set.mem_ofPred_eq, ite_eq_left hz, ite_eq_left hr] + · by_cases hr : -(1 / 32 : ℝ) < z.re + · have ho : analyticOrderAt f z = 0 := analyticOrderAt_eq_zero.mpr (Or.inr (hn z hr hz)) + simp only [Set.indicator_apply, Set.mem_ofPred_eq, ite_eq_right hz, ite_eq_left hr, ho] + · simp only [Set.indicator_apply, Set.mem_ofPred_eq, ite_eq_right hz, ite_eq_right hr] + +theorem spectralSlowDeterminant_ne_zero_of_endpoint (ell : ℕ) (b Z : ℝ) (z : ℂ) + (hZ : Z ≠ 0) (hz : -(1 / 32 : ℝ) ≤ z.re) + (hn : spectralHomotopyDeterminant ell b Z 1 z ≠ 0) : + spectralSlowDeterminant ell b Z z ≠ 0 := by + intro h + exact hn (by rw [spectralHomotopy_endpoint_factor ell b Z z hZ hz, h, mul_zero]) + +theorem exists_countingHalfPlaneZeroCount_eq_rectangle (ell : Fin 4) : + ∃ V : ℝ, 0 < V ∧ ∀ W : ℝ, V < W → ∀ b Z : ℝ, + |100000000 * b - 33477607| ≤ 2 → |100000000 * Z - 270506819| ≤ 2 → + countingHalfPlaneZeroCount (spectralSlowDeterminant ell b Z) = + rectangleZeroCount W (spectralSlowDeterminant ell b Z) := by + obtain ⟨V, hV, hb⟩ := exists_spectral_counting_boundary ell + refine ⟨V, hV, ?_⟩ + intro W hW b Z hb0 hZ0 + have hZ : Z ≠ 0 := by intro h; norm_num [h] at hZ0 + apply countingHalfPlaneZeroCount_eq_rectangle + intro z hz hnrect + apply spectralSlowDeterminant_ne_zero_of_endpoint ell b Z z hZ hz.le + apply hb b Z 1 z hb0 hZ0 (by norm_num) le_rfl + by_cases hright : 8 ≤ z.re + · exact Or.inr (Or.inl hright) + · have hRe : z.re < 8 := lt_of_not_ge hright + have hheight : W ≤ |z.im| := by + by_contra h + have hlt : |z.im| < W := lt_of_not_ge h + exact hnrect ⟨hz, hRe, (abs_lt.mp hlt).1, (abs_lt.mp hlt).2⟩ + exact Or.inr (Or.inr ⟨hz.le, hW.trans_le hheight⟩) + +/-- The central outgoing determinant has zero count 2, 1, 0, 0 in +the half-plane Re(z)>-1/32, conditional only on Ahlfors's Rouché corollary. -/ +theorem central_outgoing_halfPlane_count (hR : RectangleRouche) (ell : Fin 4) : + countingHalfPlaneZeroCount + (spectralSlowDeterminant ell (33477607 / 100000000) (270506819 / 100000000)) = + (SeparatorArithmetic.positiveRootCount ell : ℕ∞) := by + obtain ⟨V₁, hV₁, hc⟩ := exists_countingHalfPlaneZeroCount_eq_rectangle ell + obtain ⟨V₂, hV₂, hn⟩ := exists_central_outgoing_rectangle_count hR ell + let W := max V₁ V₂ + 1 + have hW₁ : V₁ < W := by dsimp [W]; linarith [le_max_left V₁ V₂] + have hW₂ : V₂ < W := by dsimp [W]; linarith [le_max_right V₁ V₂] + exact (hc W hW₁ _ _ (by norm_num) (by norm_num)).trans (hn W hW₂) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/PolynomialAnalyticMultiplicity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/PolynomialAnalyticMultiplicity.lean new file mode 100644 index 0000000000000000000000000000000000000000..6aadbe7eef6637e61379dd088e2c5545c6188837 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/PolynomialAnalyticMultiplicity.lean @@ -0,0 +1,41 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.RectangleRoucheInput +import Mathlib.Analysis.Analytic.Polynomial +import Mathlib.Algebra.Polynomial.Roots + +namespace OAI + +/-! # Polynomial root multiplicities equal analytic vanishing orders -/ + +open Polynomial + +namespace DefocusingNLS + +theorem analyticOrderAt_polynomial_eval (p : Polynomial ℂ) (hp : p ≠ 0) (z : ℂ) : + analyticOrderAt (fun w => p.eval w) z = (p.rootMultiplicity z : ℕ∞) := by + obtain ⟨q, hq, hn⟩ := p.exists_eq_pow_rootMultiplicity_mul_and_not_dvd hp z + have hnq : q.eval z ≠ 0 := by + simpa only [dvd_iff_isRoot, Polynomial.IsRoot] using hn + have he : (fun w => p.eval w) = + (fun w => (w - z) ^ p.rootMultiplicity z) * (fun w => q.eval w) := by + funext w + conv_lhs => rw [hq] + simp only [eval_mul, eval_pow, eval_sub, eval_X, eval_C, Pi.mul_apply] + have hqa : AnalyticAt ℂ (fun w => q.eval w) z := + (AnalyticOnNhd.eval_polynomial (𝕜 := ℂ) q) z (Set.mem_univ z) + have hpow : analyticOrderAt (fun w : ℂ => (w - z) ^ p.rootMultiplicity z) z = + (p.rootMultiplicity z : ℕ∞) := by + convert! (analyticOrderAt_centeredMonomial (𝕜 := ℂ) (z₀ := z) + (n := p.rootMultiplicity z)) using 1 + rw [he, analyticOrderAt_mul (by fun_prop) hqa, + hpow, hqa.analyticOrderAt_eq_zero.mpr hnq, add_zero] + +theorem analyticOrderAt_polynomial_translate (p : Polynomial ℂ) (hp : p ≠ 0) (c z : ℂ) : + analyticOrderAt (fun w => p.eval (w + c)) z = (p.rootMultiplicity (z + c) : ℕ∞) := by + have ht : AnalyticAt ℂ (fun w : ℂ => w + c) z := by fun_prop + have hd : deriv (fun w : ℂ => w + c) z ≠ 0 := by simp + rw [show (fun w => p.eval (w + c)) = (fun w => p.eval w) ∘ (fun w => w + c) from rfl, + analyticOrderAt_comp_of_deriv_ne_zero ht hd, analyticOrderAt_polynomial_eval p hp] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/PolynomialDisk.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/PolynomialDisk.lean new file mode 100644 index 0000000000000000000000000000000000000000..e6a9df087cf001ebb2836bd524c3b585379abdf2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/PolynomialDisk.lean @@ -0,0 +1,63 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.ParameterOpenness +import Mathlib.Analysis.Complex.Polynomial.Basic +import Mathlib.Tactic + +namespace OAI + +/-! +# A finite root certificate on a complex disk + +Brouwer degree gives a root of a degree-fifteen polynomial in a prescribed +disk when the constant and higher-order terms are bounded by the linear term. +-/ + +open Metric + +namespace DefocusingNLS + +/-- A degree-fifteen polynomial has a zero in a disk if its constant and +higher-order terms are uniformly smaller than its linear term there. -/ +theorem degree_fifteen_root_in_disk (a b : ℂ) (c : Fin 14 → ℂ) (r : ℝ) + (hr : 0 ≤ r) (hb : b ≠ 0) + (hbound : ‖a‖ + ∑ i, ‖c i‖ * r ^ ((i : ℕ) + 2) ≤ ‖b‖ * r) : + ∃ z : ℂ, ‖z‖ ≤ r ∧ a + b * z + ∑ i, c i * z ^ ((i : ℕ) + 2) = 0 := by + let tail : ℂ → ℂ := fun z => ∑ i, c i * z ^ ((i : ℕ) + 2) + let f : closedBall (0 : ℂ) r → ℂ := fun z => z.val + (a + tail z) / b + have hf : Continuous f := by + dsimp [f, tail] + fun_prop + have herror (z : closedBall (0 : ℂ) r) : ‖f z - z.val‖ ≤ r := by + have hz : ‖z.val‖ ≤ r := by + have hz := z.property + change dist z.val 0 ≤ r at hz + simpa only [dist_zero_right] using hz + have htail : ‖tail z‖ ≤ ∑ i, ‖c i‖ * r ^ ((i : ℕ) + 2) := by + calc + ‖tail z‖ ≤ ∑ i, ‖c i * z.val ^ ((i : ℕ) + 2)‖ := norm_sum_le _ _ + _ ≤ ∑ i, ‖c i‖ * r ^ ((i : ℕ) + 2) := by + apply Finset.sum_le_sum + intro i _ + rw [norm_mul, norm_pow] + gcongr + calc + ‖f z - z.val‖ = ‖a + tail z‖ / ‖b‖ := by simp [f] + _ ≤ (‖a‖ + ∑ i, ‖c i‖ * r ^ ((i : ℕ) + 2)) / ‖b‖ := + div_le_div_of_nonneg_right ((norm_add_le _ _).trans (add_le_add le_rfl htail)) + (norm_nonneg _) + _ ≤ r := (div_le_iff₀ (norm_pos_iff.mpr hb)).mpr (by nlinarith [hbound]) + obtain ⟨z, hz⟩ := zero_of_small_continuous_error r r hr le_rfl f hf herror + refine ⟨z, ?_, ?_⟩ + · have hz := z.property + change dist z.val 0 ≤ r at hz + simpa only [dist_zero_right] using hz + change z.val + (a + tail z) / b = 0 at hz + change a + b * z.val + tail z = 0 + calc + a + b * z.val + tail z = b * (z.val + (a + tail z) / b) := by + field_simp [hb] + ring + _ = 0 := by rw [hz, mul_zero] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/PolynomialEnclosure.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/PolynomialEnclosure.lean new file mode 100644 index 0000000000000000000000000000000000000000..465c69a1040432f59f78b78c4d5a081825c91329 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/PolynomialEnclosure.lean @@ -0,0 +1,181 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.GaussianEnclosure +import Mathlib.Algebra.Polynomial.Inductions + +namespace OAI + +/-! # Polynomial semantics for integer coefficient enclosures + +Lists are in ascending coefficient order. The recursive semantics keeps all +roundoff radii, including those of coefficients whose centers cancel. +-/ + +open Polynomial + +namespace DefocusingNLS +namespace GaussianEnclosure + +def zero : GaussianEnclosure := ⟨0, 0⟩ + +theorem zero_sound : zero.Encloses 0 := by simp [Encloses, zero] + +theorem zero_encloses_iff (z : ℂ) : zero.Encloses z ↔ z = 0 := by + simp [Encloses, zero] + +/-- An enclosure for every coefficient, with exact zero beyond the list. -/ +def EnclosesPolynomial : List GaussianEnclosure → Polynomial ℂ → Prop + | [], p => p = 0 + | a :: as, p => ∃ z q, a.Encloses z ∧ EnclosesPolynomial as q ∧ p = C z + X * q + +def addPolynomial : List GaussianEnclosure → List GaussianEnclosure → List GaussianEnclosure + | [], bs => bs + | as, [] => as + | a :: as, b :: bs => add a b :: addPolynomial as bs + +def scalePolynomial (a : GaussianEnclosure) (bs : List GaussianEnclosure) : List GaussianEnclosure := + bs.map (mul a) + +def mulPolynomial : List GaussianEnclosure → List GaussianEnclosure → List GaussianEnclosure + | [], _ => [] + | a :: as, bs => addPolynomial (scalePolynomial a bs) (zero :: mulPolynomial as bs) + +def negPolynomial (as : List GaussianEnclosure) : List GaussianEnclosure := as.map neg + +def subPolynomial (as bs : List GaussianEnclosure) : List GaussianEnclosure := + addPolynomial as (negPolynomial bs) + +def conjPolynomial (as : List GaussianEnclosure) : List GaussianEnclosure := as.map conj + +theorem addPolynomial_sound {as bs : List GaussianEnclosure} {p q : Polynomial ℂ} + (hp : EnclosesPolynomial as p) (hq : EnclosesPolynomial bs q) : + EnclosesPolynomial (addPolynomial as bs) (p + q) := by + induction as generalizing bs p q with + | nil => + change p = 0 at hp + subst p + simpa [addPolynomial] using hq + | cons a as ih => + cases bs with + | nil => + change q = 0 at hq + subst q + simpa [addPolynomial] using hp + | cons b bs => + obtain ⟨x, p', hx, hp', rfl⟩ := hp + obtain ⟨y, q', hy, hq', rfl⟩ := hq + refine ⟨x + y, p' + q', add_sound hx hy, ih hp' hq', ?_⟩ + simp only [map_add] + ring + +theorem scalePolynomial_sound {a : GaussianEnclosure} {as : List GaussianEnclosure} + {z : ℂ} {p : Polynomial ℂ} (hz : a.Encloses z) (hp : EnclosesPolynomial as p) : + EnclosesPolynomial (scalePolynomial a as) (C z * p) := by + induction as generalizing p with + | nil => + change p = 0 at hp + subst p + simp [EnclosesPolynomial, scalePolynomial] + | cons b bs ih => + obtain ⟨x, q, hx, hq, rfl⟩ := hp + refine ⟨z * x, C z * q, mul_sound hz hx, ih hq, ?_⟩ + simp only [map_mul] + ring + +theorem shiftPolynomial_sound {as : List GaussianEnclosure} {p : Polynomial ℂ} + (hp : EnclosesPolynomial as p) : EnclosesPolynomial (zero :: as) (X * p) := + ⟨0, p, zero_sound, hp, by simp⟩ + +theorem mulPolynomial_sound {as bs : List GaussianEnclosure} {p q : Polynomial ℂ} + (hp : EnclosesPolynomial as p) (hq : EnclosesPolynomial bs q) : + EnclosesPolynomial (mulPolynomial as bs) (p * q) := by + induction as generalizing p with + | nil => + change p = 0 at hp + subst p + simp [mulPolynomial, EnclosesPolynomial] + | cons a as ih => + obtain ⟨z, p', hz, hp', rfl⟩ := hp + have h := addPolynomial_sound (scalePolynomial_sound hz hq) + (shiftPolynomial_sound (ih hp')) + have he : (C z + X * p') * q = C z * q + X * (p' * q) := by ring + rw [he] + exact h + +theorem negPolynomial_sound {as : List GaussianEnclosure} {p : Polynomial ℂ} + (hp : EnclosesPolynomial as p) : EnclosesPolynomial (negPolynomial as) (-p) := by + induction as generalizing p with + | nil => + change p = 0 at hp + subst p + simp [EnclosesPolynomial, negPolynomial] + | cons a as ih => + obtain ⟨z, q, hz, hq, rfl⟩ := hp + refine ⟨-z, -q, neg_sound hz, ih hq, ?_⟩ + simp only [map_neg] + ring + +theorem subPolynomial_sound {as bs : List GaussianEnclosure} {p q : Polynomial ℂ} + (hp : EnclosesPolynomial as p) (hq : EnclosesPolynomial bs q) : + EnclosesPolynomial (subPolynomial as bs) (p - q) := by + simpa only [subPolynomial, sub_eq_add_neg] using addPolynomial_sound hp (negPolynomial_sound hq) + +theorem conjPolynomial_sound {as : List GaussianEnclosure} {p : Polynomial ℂ} + (hp : EnclosesPolynomial as p) : + EnclosesPolynomial (conjPolynomial as) (p.map (starRingEnd ℂ)) := by + induction as generalizing p with + | nil => + change p = 0 at hp + subst p + simp [EnclosesPolynomial, conjPolynomial] + | cons a as ih => + obtain ⟨z, q, hz, hq, rfl⟩ := hp + exact ⟨star z, q.map (starRingEnd ℂ), conj_sound hz, ih hq, by simp⟩ + +theorem coefficient_sound {as : List GaussianEnclosure} {p : Polynomial ℂ} + (hp : EnclosesPolynomial as p) (n : ℕ) : + (as[n]?.getD zero).Encloses (p.coeff n) := by + induction as generalizing p n with + | nil => + change p = 0 at hp + subst p + simpa using zero_sound + | cons a as ih => + obtain ⟨z, q, hz, hq, rfl⟩ := hp + cases n with + | zero => simpa using hz + | succ n => simpa [coeff_X_mul] using ih hq n + +/-- Coefficientwise semantics permits truncation only when the actual discarded +coefficients vanish, regardless of the size of their computed radii. -/ +theorem enclosesPolynomial_of_coefficients (as : List GaussianEnclosure) (p : Polynomial ℂ) + (h : ∀ n, (as[n]?.getD zero).Encloses (p.coeff n)) : EnclosesPolynomial as p := by + induction as generalizing p with + | nil => + apply Polynomial.ext + intro n + exact (zero_encloses_iff _).mp (h n) + | cons a as ih => + refine ⟨p.coeff 0, p.divX, ?_, ?_, ?_⟩ + · simpa using h 0 + · apply ih + intro n + simpa only [coeff_divX, List.getElem?_cons_succ] using h (n + 1) + · exact (add_comm _ _).trans (X_mul_divX_add p) |>.symm + +theorem enclosesPolynomial_iff_coefficients (as : List GaussianEnclosure) (p : Polynomial ℂ) : + EnclosesPolynomial as p ↔ ∀ n, (as[n]?.getD zero).Encloses (p.coeff n) := + ⟨fun hp n => coefficient_sound hp n, enclosesPolynomial_of_coefficients as p⟩ + +theorem truncatePolynomial_sound {as : List GaussianEnclosure} {p : Polynomial ℂ} + (hp : EnclosesPolynomial as p) (N : ℕ) (hN : ∀ n, N ≤ n → p.coeff n = 0) : + EnclosesPolynomial (as.take N) p := by + apply enclosesPolynomial_of_coefficients + intro n + by_cases hn : n < N + · simpa [List.getElem?_take, hn] using coefficient_sound hp n + · have hn' : N ≤ n := Nat.le_of_not_lt hn + simpa [List.getElem?_take, hn, hN n hn'] using zero_sound + +end GaussianEnclosure +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/PolynomialProjection.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/PolynomialProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..2c263f2c5428ec24c7ebbf99dfc1ab9bec2ba917 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/PolynomialProjection.lean @@ -0,0 +1,107 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.LaguerreProjection + +namespace OAI + +/-! # Polynomial test functions for the weighted differential equation -/ + +open Filter Topology MeasureTheory Set Polynomial + +namespace DefocusingNLS + +noncomputable def weightedPolynomialIntegrand (f : ℝ → ℂ) (p : ℂ[X]) (t : ℝ) : ℂ := + (Real.exp (-t) : ℂ) * f t * p.eval (t : ℂ) + +noncomputable def weightedPolynomialIntegral (f : ℝ → ℂ) (p : ℂ[X]) : ℂ := + ∫ t in Ioi (0 : ℝ), weightedPolynomialIntegrand f p t + +noncomputable def weightedPolynomialFunctional (f : ℝ → ℂ) + (hf : ∀ p, IntegrableOn (weightedPolynomialIntegrand f p) (Ioi 0)) : ℂ[X] →ₗ[ℂ] ℂ where + toFun := weightedPolynomialIntegral f + map_add' p q := by + unfold weightedPolynomialIntegral weightedPolynomialIntegrand + simp only [Polynomial.eval_add, mul_add] + exact integral_add (hf p) (hf q) + map_smul' c p := by + unfold weightedPolynomialIntegral weightedPolynomialIntegrand + simp only [Polynomial.eval_smul, smul_eq_mul, RingHom.id_apply] + rw [← integral_const_mul] + congr 1 + funext t + ring + +@[simp] theorem weightedPolynomialFunctional_apply (f : ℝ → ℂ) + (hf : ∀ p, IntegrableOn (weightedPolynomialIntegrand f p) (Ioi 0)) (p : ℂ[X]) : + weightedPolynomialFunctional f hf p = weightedPolynomialIntegral f p := rfl + +theorem hasDerivAt_weightedPolynomialIntegrand (f f' : ℝ → ℂ) (p : ℂ[X]) (t : ℝ) + (hf : HasDerivAt f (f' t) t) : + HasDerivAt (weightedPolynomialIntegrand f p) + (weightedPolynomialIntegrand f' p t + + weightedPolynomialIntegrand f (p.derivative - p) t) t := by + have he := ((Real.hasDerivAt_exp (-t)).comp t (hasDerivAt_neg t)).ofReal_comp + have hp := (p.hasDerivAt (t : ℂ)).comp_ofReal + have h := (he.fun_mul hf).fun_mul hp + convert! h using 1 + simp only [weightedPolynomialIntegrand, Polynomial.eval_sub, + Complex.ofReal_mul, Complex.ofReal_neg, Complex.ofReal_one, Function.comp_apply] + ring + +theorem weightedPolynomialIntegral_derivative (f f' : ℝ → ℂ) (p : ℂ[X]) + (hd : ∀ t ∈ Ioi (0 : ℝ), HasDerivAt f (f' t) t) + (hc : ContinuousWithinAt f (Ici 0) 0) + (hi : ∀ p, IntegrableOn (weightedPolynomialIntegrand f p) (Ioi 0)) + (hi' : IntegrableOn (weightedPolynomialIntegrand f' p) (Ioi 0)) : + weightedPolynomialIntegral f' p + weightedPolynomialIntegral f (p.derivative - p) = + -f 0 * p.eval 0 := by + let D := fun t => weightedPolynomialIntegrand f' p t + + weightedPolynomialIntegrand f (p.derivative - p) t + have hD : IntegrableOn D (Ioi 0) := hi'.add (hi _) + have hderiv (t : ℝ) (ht : t ∈ Ioi (0 : ℝ)) : + HasDerivAt (weightedPolynomialIntegrand f p) (D t) t := + hasDerivAt_weightedPolynomialIntegrand f f' p t (hd t ht) + have hcont : ContinuousWithinAt (weightedPolynomialIntegrand f p) (Ici 0) 0 := by + have hp : ContinuousWithinAt (fun t : ℝ => p.eval (t : ℂ)) (Ici 0) 0 := + ((p.hasDerivAt (0 : ℂ)).comp_ofReal).continuousAt.continuousWithinAt + have he : ContinuousAt (fun t : ℝ => (Real.exp (-t) : ℂ)) 0 := by fun_prop + exact (he.continuousWithinAt.mul hc).mul hp + have hlim := tendsto_zero_of_hasDerivAt_of_integrableOn_Ioi hderiv hD (hi p) + have h := integral_Ioi_of_hasDerivAt_of_tendsto hcont hderiv hD hlim + dsimp only [D] at h + rw [integral_add hi' (hi _)] at h + simpa [weightedPolynomialIntegral, weightedPolynomialIntegrand] using h + +/-- Symmetry of the Laguerre differential operator against a smooth function. -/ +theorem weightedPolynomialIntegral_laguerre_operator (f f' f'' : ℝ → ℂ) (p : ℂ[X]) + (hd : ∀ t ∈ Ioi (0 : ℝ), HasDerivAt f (f' t) t) + (hd' : ∀ t ∈ Ioi (0 : ℝ), HasDerivAt f' (f'' t) t) + (hc : ContinuousWithinAt f (Ici 0) 0) + (hc' : ContinuousWithinAt f' (Ici 0) 0) + (hi : ∀ p, IntegrableOn (weightedPolynomialIntegrand f p) (Ioi 0)) + (hi' : ∀ p, IntegrableOn (weightedPolynomialIntegrand f' p) (Ioi 0)) + (hi'' : ∀ p, IntegrableOn (weightedPolynomialIntegrand f'' p) (Ioi 0)) : + weightedPolynomialIntegral f'' (X * p) + + weightedPolynomialIntegral f' ((1 - X) * p) = + weightedPolynomialIntegral f (laguerreOperator p) := by + let F := weightedPolynomialFunctional f hi + let F' := weightedPolynomialFunctional f' hi' + let F'' := weightedPolynomialFunctional f'' hi'' + have h1 := weightedPolynomialIntegral_derivative f' f'' (X * p) hd' hc' hi' (hi'' _) + have h2 := weightedPolynomialIntegral_derivative f f' (X * p.derivative) hd hc hi (hi' _) + have he1 : (X * p).derivative - X * p - (1 - X) * p = X * p.derivative := by + simp only [Polynomial.derivative_mul, Polynomial.derivative_X] + ring + have he2 : (X * p.derivative).derivative - X * p.derivative = laguerreOperator p := by + simp only [Polynomial.derivative_mul, Polynomial.derivative_X, laguerreOperator] + ring + change F'' (X * p) + F' ((X * p).derivative - X * p) = _ at h1 + change F' (X * p.derivative) + F ((X * p.derivative).derivative - X * p.derivative) = _ at h2 + simp only [Polynomial.eval_mul, Polynomial.eval_X, zero_mul, mul_zero] at h1 h2 + rw [he2] at h2 + have h3 : F' ((X * p).derivative - X * p) - F' ((1 - X) * p) = + F' (X * p.derivative) := by rw [← map_sub, he1] + change F'' (X * p) + F' ((1 - X) * p) = F (laguerreOperator p) + linear_combination h1 - h2 - h3 + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/PolynomialRectangleCount.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/PolynomialRectangleCount.lean new file mode 100644 index 0000000000000000000000000000000000000000..055925aed510e4f0877b9733ab2a8e34831b93e2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/PolynomialRectangleCount.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.PolynomialAnalyticMultiplicity + +namespace OAI + +/-! # Finite rectangle counts for the certified simple polynomial roots -/ + +open Polynomial Set +open scoped Classical + +namespace DefocusingNLS + +theorem rectangleZeroCount_of_simple_orders (V : ℝ) (f : ℂ → ℂ) (S : Finset ℂ) + (ho : ∀ z, analyticOrderAt f z = if z ∈ S then 1 else 0) : + rectangleZeroCount V f = ((S.filter (fun z => z ∈ countingRectangle V)).card : ℕ∞) := by + classical + unfold rectangleZeroCount + rw [tsum_subtype] + rw [tsum_eq_sum (s := S)] + · simp only [Set.indicator_apply] + rw [← Finset.sum_filter] + calc + _ = ∑ _z ∈ S.filter (fun z => z ∈ countingRectangle V), (1 : ℕ∞) := by + apply Finset.sum_congr rfl + intro z hz + rw [ho, ite_eq_left (Finset.mem_filter.mp hz).1] + _ = _ := by simp + · intro z hz + rw [Set.indicator_apply] + split_ifs <;> simp [ho, hz] + +theorem rectangleZeroCount_polynomial_translate (p : Polynomial ℂ) (hp : p ≠ 0) + (hsimple : p.roots.Nodup) (c : ℂ) (V : ℝ) : + rectangleZeroCount V (fun z => p.eval (z + c)) = + ((p.roots.toFinset.filter (fun w => w - c ∈ countingRectangle V)).card : ℕ∞) := by + classical + let S := p.roots.toFinset.image (fun w => w - c) + have hS (z : ℂ) : z ∈ S ↔ z + c ∈ p.roots := by + constructor + · intro hz + obtain ⟨w, hw, rfl⟩ := Finset.mem_image.mp hz + simpa using hw + · intro hz + exact Finset.mem_image.mpr ⟨z + c, by simpa using hz, by simp⟩ + have ho (z : ℂ) : analyticOrderAt (fun w => p.eval (w + c)) z = + if z ∈ S then 1 else 0 := by + rw [analyticOrderAt_polynomial_translate p hp c z, ← Polynomial.count_roots] + by_cases hz : z ∈ S + · rw [ite_eq_left hz, Multiset.count_eq_one_of_mem hsimple ((hS z).mp hz)] + rfl + · rw [ite_eq_right hz, Multiset.count_eq_zero.mpr (fun h => hz ((hS z).mpr h))] + rfl + rw [rectangleZeroCount_of_simple_orders V _ S ho] + dsimp [S] + rw [Finset.filter_image, Finset.card_image_of_injective] + intro z w hz + exact sub_left_inj.mp hz + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/PolynomialRootEnumeration.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/PolynomialRootEnumeration.lean new file mode 100644 index 0000000000000000000000000000000000000000..4617ce1d7a54e97af08c5d171f47b4d65b58e077 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/PolynomialRootEnumeration.lean @@ -0,0 +1,99 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.PolynomialDisk +import Mathlib.Algebra.Polynomial.Roots + +namespace OAI + +/-! # From disjoint disks to an exhaustive polynomial root list + +Fifteen disjoint root-containing disks exhaust the roots of a nonzero +polynomial of degree at most fifteen, including multiplicities. +-/ + +open Polynomial + +namespace DefocusingNLS + +theorem roots_of_fifteen_disks (p : Polynomial ℂ) (hp : p ≠ 0) + (hdegree : p.natDegree ≤ 15) (c : Fin 15 → ℂ) (r : ℝ) + (hsep : ∀ i j, i ≠ j → 2 * r < ‖c i - c j‖) + (hroot : ∀ i, ∃ z : ℂ, ‖z - c i‖ ≤ r ∧ p.IsRoot z) : + ∃ z : Fin 15 → ℂ, Function.Injective z ∧ + (∀ i, ‖z i - c i‖ ≤ r ∧ p.IsRoot (z i)) ∧ + p.roots = (Finset.univ.image z).val := by + classical + choose z hz using hroot + have hinj : Function.Injective z := by + intro i j hij + by_contra hne + have hle : ‖c i - c j‖ ≤ 2 * r := by + calc + ‖c i - c j‖ = ‖(c i - z i) + (z j - c j)‖ := by + rw [hij] + congr 1 + abel + _ ≤ ‖c i - z i‖ + ‖z j - c j‖ := norm_add_le _ _ + _ ≤ r + r := by + rw [norm_sub_rev (c i)] + exact add_le_add (hz i).1 (hz j).1 + _ = 2 * r := by ring + exact (not_le_of_gt (hsep i j hne)) hle + refine ⟨z, hinj, hz, ?_⟩ + apply roots_eq_of_natDegree_le_card_of_ne_zero + · intro x hx + obtain ⟨i, _, rfl⟩ := Finset.mem_image.mp hx + exact (hz i).2 + · simpa only [Finset.card_image_of_injective _ hinj, Finset.card_univ, + Fintype.card_fin] using hdegree + · exact hp + +theorem positive_real_iff_of_disk {z c : ℂ} {r : ℝ} + (hc : r < |c.re|) (hz : ‖z - c‖ ≤ r) : + 0 < z.re ↔ 0 < c.re := by + have h := (Complex.abs_re_le_norm (z - c)).trans hz + rw [Complex.sub_re, abs_le] at h + by_cases hpos : 0 < c.re + · rw [abs_of_pos hpos] at hc + constructor <;> intro + · exact hpos + · linarith [h.1] + · rw [abs_of_nonpos (le_of_not_gt hpos)] at hc + constructor + · intro hzpos + linarith [h.2] + · exact False.elim ∘ hpos + +theorem real_ne_zero_of_disk {z c : ℂ} {r : ℝ} + (hc : r < |c.re|) (hz : ‖z - c‖ ≤ r) : z.re ≠ 0 := by + intro hzero + have h := (Complex.abs_re_le_norm (z - c)).trans hz + simp only [Complex.sub_re, hzero, zero_sub, abs_neg] at h + exact (not_le_of_gt hc) h + +theorem no_axis_root_of_disks (p : Polynomial ℂ) (hp : p ≠ 0) + (c z : Fin 15 → ℂ) (r : ℝ) + (hroots : p.roots = (Finset.univ.image z).val) + (haxis : ∀ i, r < |(c i).re|) + (hdist : ∀ i, ‖z i - c i‖ ≤ r) {x : ℂ} (hx : p.IsRoot x) : x.re ≠ 0 := by + classical + have hmem : x ∈ p.roots := (p.mem_roots hp).mpr hx + rw [hroots] at hmem + have hmem' : x ∈ Finset.univ.image z := hmem + obtain ⟨i, _, hi⟩ := Finset.mem_image.mp hmem' + rw [← hi] + exact real_ne_zero_of_disk (haxis i) (hdist i) + +theorem positive_real_root_count_of_disks (p : Polynomial ℂ) + (c z : Fin 15 → ℂ) (r : ℝ) (hinj : Function.Injective z) + (hroots : p.roots = (Finset.univ.image z).val) + (haxis : ∀ i, r < |(c i).re|) + (hdist : ∀ i, ‖z i - c i‖ ≤ r) : + (p.roots.toFinset.filter (fun x => 0 < x.re)).card = + (Finset.univ.filter (fun i => 0 < (c i).re)).card := by + classical + rw [hroots, Finset.val_toFinset, Finset.filter_image] + simp_rw [positive_real_iff_of_disk (haxis _) (hdist _)] + exact Finset.card_image_of_injective _ hinj + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RationalComplexMatrix.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RationalComplexMatrix.lean new file mode 100644 index 0000000000000000000000000000000000000000..b8a0ffd0ff742f845865c7bd899faf4e1fe8e5f8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RationalComplexMatrix.lean @@ -0,0 +1,97 @@ +import Mathlib.Algebra.QuadraticAlgebra.Basic +import Mathlib.Analysis.Complex.Basic +import Mathlib.LinearAlgebra.Matrix.Determinant.Basic +import Mathlib.Tactic + +namespace OAI + +/-! Exact complex rational arithmetic for the finite profile certificate. -/ + +namespace DefocusingNLS.ProfileCertificate + +abbrev RationalComplex := QuadraticAlgebra ℚ (-1) 0 + +namespace RationalComplex + +def normSq (z : RationalComplex) : ℚ := z.re ^ 2 + z.im ^ 2 + +def absOne (z : RationalComplex) : ℚ := |z.re| + |z.im| + +def quotient (z w : RationalComplex) : RationalComplex := + ⟨(z.re * w.re + z.im * w.im) / normSq w, + (z.im * w.re - z.re * w.im) / normSq w⟩ + +noncomputable def toComplex : RationalComplex →+* ℂ where + toFun z := ⟨z.re, z.im⟩ + map_zero' := by apply Complex.ext <;> simp + map_one' := by apply Complex.ext <;> simp [QuadraticAlgebra.re_one, QuadraticAlgebra.im_one] + map_add' z w := by apply Complex.ext <;> simp + map_mul' z w := by apply Complex.ext <;> simp [QuadraticAlgebra.re_mul, QuadraticAlgebra.im_mul]; ring + +@[simp] theorem toComplex_re (z : RationalComplex) : (toComplex z).re = z.re := rfl +@[simp] theorem toComplex_im (z : RationalComplex) : (toComplex z).im = z.im := rfl + +@[simp] theorem normSq_toComplex (z : RationalComplex) : + Complex.normSq (toComplex z) = (normSq z : ℝ) := by + simp [Complex.normSq_apply, normSq, pow_two] + +theorem norm_toComplex_le_absOne (z : RationalComplex) : + ‖toComplex z‖ ≤ (absOne z : ℝ) := by + have h := Complex.norm_le_abs_re_add_abs_im (toComplex z) + simpa [absOne] using h + +@[simp] theorem toComplex_quotient (z w : RationalComplex) : + toComplex (quotient z w) = toComplex z / toComplex w := by + apply Complex.ext <;> simp [quotient, Complex.div_re, Complex.div_im, normSq, Complex.normSq_apply, pow_two, add_div, sub_div] + +end RationalComplex + +/-- A computational four-entry matrix, avoiding dependent finite-index evaluation. -/ +@[ext] structure Matrix2 (R : Type*) where + a : R + b : R + c : R + d : R + deriving DecidableEq + +namespace Matrix2 + +variable {R S : Type*} + +def zero [Zero R] : Matrix2 R := ⟨0, 0, 0, 0⟩ +def one [Zero R] [One R] : Matrix2 R := ⟨1, 0, 0, 1⟩ +def add [Add R] (x y : Matrix2 R) : Matrix2 R := + ⟨x.a + y.a, x.b + y.b, x.c + y.c, x.d + y.d⟩ +def mul [Add R] [Mul R] (x y : Matrix2 R) : Matrix2 R := + ⟨x.a*y.a+x.b*y.c, x.a*y.b+x.b*y.d, + x.c*y.a+x.d*y.c, x.c*y.b+x.d*y.d⟩ +def scale [Mul R] (r : R) (x : Matrix2 R) : Matrix2 R := + ⟨r*x.a, r*x.b, r*x.c, r*x.d⟩ +def map (f : R → S) (x : Matrix2 R) : Matrix2 S := + ⟨f x.a, f x.b, f x.c, f x.d⟩ +def toMatrix (x : Matrix2 R) : Matrix (Fin 2) (Fin 2) R := + !![x.a, x.b; x.c, x.d] + +@[simp] theorem toMatrix_zero [Zero R] : toMatrix (zero : Matrix2 R) = 0 := by + ext i j; fin_cases i <;> fin_cases j <;> rfl +@[simp] theorem toMatrix_one [Zero R] [One R] : toMatrix (one : Matrix2 R) = 1 := by + ext i j; fin_cases i <;> fin_cases j <;> rfl +@[simp] theorem toMatrix_add [Add R] (x y : Matrix2 R) : + toMatrix (add x y) = toMatrix x + toMatrix y := by + ext i j; fin_cases i <;> fin_cases j <;> rfl +@[simp] theorem toMatrix_mul [Semiring R] (x y : Matrix2 R) : + toMatrix (mul x y) = toMatrix x * toMatrix y := by + ext i j; fin_cases i <;> fin_cases j <;> + simp [toMatrix, mul, Matrix.mul_apply, Fin.sum_univ_two] +@[simp] theorem toMatrix_scale [Mul R] (r : R) (x : Matrix2 R) : + toMatrix (scale r x) = r • toMatrix x := by + ext i j; fin_cases i <;> fin_cases j <;> rfl +@[simp] theorem toMatrix_map (f : R → S) (x : Matrix2 R) : + toMatrix (map f x) = (toMatrix x).map f := by + ext i j; fin_cases i <;> fin_cases j <;> rfl + +end Matrix2 + +end DefocusingNLS.ProfileCertificate + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleAnalyticFactorization.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleAnalyticFactorization.lean new file mode 100644 index 0000000000000000000000000000000000000000..b0d8ba3e73272e54b80d1d507ecb8d5ad9517064 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleAnalyticFactorization.lean @@ -0,0 +1,65 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.RectangleRoucheInput +import Mathlib.Analysis.Complex.Convex +import Mathlib.Analysis.Meromorphic.FactorizedRational + +namespace OAI + +/-! # Finite analytic divisors in the one counting rectangle -/ + +open Set Filter Function +namespace DefocusingNLS + +theorem convex_closedCountingRectangle (V : ℝ) : Convex ℝ (closedCountingRectangle V) := by + change Convex ℝ ({z : ℂ | -(1 / 32 : ℝ) ≤ z.re} ∩ + ({z : ℂ | z.re ≤ 8} ∩ ({z : ℂ | -V ≤ z.im} ∩ {z : ℂ | z.im ≤ V}))) + exact (convex_halfSpace_re_ge _).inter ((convex_halfSpace_re_le _).inter + ((convex_halfSpace_im_ge _).inter (convex_halfSpace_im_le _))) + +theorem isConnected_closedCountingRectangle (V : ℝ) (hV : 0 < V) : + IsConnected (closedCountingRectangle V) := by + apply (convex_closedCountingRectangle V).isConnected + refine ⟨0, ?_⟩ + simp only [closedCountingRectangle, mem_ofPred_eq, Complex.zero_re, Complex.zero_im] + constructor + · norm_num + exact ⟨by norm_num, by linarith, hV.le⟩ + +theorem eight_mem_countingRectangleBoundary (V : ℝ) (hV : 0 < V) : + (8 : ℂ) ∈ countingRectangleBoundary V := by + rw [mem_countingRectangleBoundary_iff] + constructor + · change -(1 / 32 : ℝ) ≤ 8 ∧ (8 : ℝ) ≤ 8 ∧ -V ≤ 0 ∧ (0 : ℝ) ≤ V + exact ⟨by norm_num, le_rfl, by linarith, hV.le⟩ + · exact Or.inr (Or.inl rfl) + +theorem rectangle_analyticOrder_ne_top (V : ℝ) (hV : 0 < V) (f : ℂ → ℂ) + (hf : AnalyticOnNhd ℂ f (closedCountingRectangle V)) + (hn : ∀ z ∈ countingRectangleBoundary V, f z ≠ 0) : + ∀ z ∈ closedCountingRectangle V, analyticOrderAt f z ≠ ⊤ := by + have hz := eight_mem_countingRectangleBoundary V hV + have ho : analyticOrderAt f (8 : ℂ) = 0 := (hf _ hz.1).analyticOrderAt_eq_zero.mpr (hn _ hz) + have hall := (hf.exists_analyticOrderAt_ne_top_iff_forall + (isConnected_closedCountingRectangle V hV)).mp + ⟨⟨8, hz.1⟩, by rw [ho]; exact ENat.zero_ne_top⟩ + exact fun z hz => hall ⟨z, hz⟩ + +theorem rectangle_extract_zeros (V : ℝ) (hV : 0 < V) (f : ℂ → ℂ) + (hf : AnalyticOnNhd ℂ f (closedCountingRectangle V)) + (hn : ∀ z ∈ countingRectangleBoundary V, f z ≠ 0) : + ∃ g : ℂ → ℂ, AnalyticOnNhd ℂ g (closedCountingRectangle V) ∧ + (∀ z ∈ closedCountingRectangle V, g z ≠ 0) ∧ + f =ᶠ[codiscreteWithin (closedCountingRectangle V)] + (∏ᶠ z, (· - z) ^ MeromorphicOn.divisor f (closedCountingRectangle V) z) • g := by + have ho := rectangle_analyticOrder_ne_top V hV f hf hn + have hm : ∀ z : closedCountingRectangle V, meromorphicOrderAt f z ≠ ⊤ := by + intro z + rw [(hf z z.2).meromorphicOrderAt_eq] + simpa using ho z z.2 + obtain ⟨g, hg, hgn, he⟩ := hf.meromorphicOn.extract_zeros_poles hm + ((MeromorphicOn.divisor f (closedCountingRectangle V)).finiteSupport + (isCompact_closedCountingRectangle V)) + exact ⟨g, hg, fun z hz => hgn ⟨z, hz⟩, he⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleBoundaryIntegral.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleBoundaryIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..32525cc197f8150a5bc6ef8ba27ad74f0776bd78 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleBoundaryIntegral.lean @@ -0,0 +1,39 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.RectangleAnalyticFactorization +import Mathlib.Analysis.Complex.CauchyIntegral + +namespace OAI + +/-! # Cauchy's theorem on the exact spectral counting rectangle -/ + +open Set MeasureTheory +namespace DefocusingNLS + +noncomputable def countingBoundaryIntegral (V : ℝ) (f : ℂ → ℂ) : ℂ := + (∫ x : ℝ in (-(1 / 32 : ℝ))..8, f ((x : ℂ) - (V : ℂ) * Complex.I)) - + (∫ x : ℝ in (-(1 / 32 : ℝ))..8, f ((x : ℂ) + (V : ℂ) * Complex.I)) + + Complex.I * (∫ y : ℝ in (-V)..V, f (8 + (y : ℂ) * Complex.I)) - + Complex.I * (∫ y : ℝ in (-V)..V, f (-(1 / 32 : ℂ) + (y : ℂ) * Complex.I)) + +theorem countingBoundaryIntegral_eq_zero (V : ℝ) (hV : 0 < V) (f : ℂ → ℂ) + (hf : AnalyticOnNhd ℂ f (closedCountingRectangle V)) : + countingBoundaryIntegral V f = 0 := by + let z : ℂ := -(1 / 32 : ℂ) - (V : ℂ) * Complex.I + let w : ℂ := 8 + (V : ℂ) * Complex.I + have hzre : z.re = -(1 / 32 : ℝ) := by simp [z] + have hzim : z.im = -V := by simp [z] + have hwre : w.re = 8 := by simp [w] + have hwim : w.im = V := by simp [w] + have hrect : (uIcc z.re w.re ×ℂ uIcc z.im w.im) = closedCountingRectangle V := by + rw [hzre, hzim, hwre, hwim, uIcc_of_le (by norm_num : -(1 / 32 : ℝ) ≤ 8), + uIcc_of_le (by linarith : -V ≤ V)] + ext u + simp only [Complex.mem_reProdIm, mem_Icc, closedCountingRectangle, mem_ofPred_eq] + tauto + have h := Complex.integral_boundary_rect_eq_zero_of_differentiableOn f z w + (hrect.symm ▸ hf.differentiableOn) + simpa [hzre, hzim, hwre, hwim, sub_eq_add_neg, smul_eq_mul, + countingBoundaryIntegral] using h + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleBoundaryLinear.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleBoundaryLinear.lean new file mode 100644 index 0000000000000000000000000000000000000000..e1d7108aff75d1d8e9bffb1aefe7bce0abf8e40a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleBoundaryLinear.lean @@ -0,0 +1,87 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.RectangleBoundaryPrimitive + +namespace OAI + +/-! # Linearity and locality of the rectangular contour integral -/ + +open Set MeasureTheory +namespace DefocusingNLS + +theorem countingBoundary_edge_integrable (V : ℝ) (hV : 0 < V) (f : ℂ → ℂ) + (hf : ContinuousOn f (countingRectangleBoundary V)) : + IntervalIntegrable (fun x : ℝ => f ((x : ℂ) - (V : ℂ) * Complex.I)) volume (-(1/32)) 8 ∧ + IntervalIntegrable (fun x : ℝ => f ((x : ℂ) + (V : ℂ) * Complex.I)) volume (-(1/32)) 8 ∧ + IntervalIntegrable (fun y : ℝ => f (8 + (y : ℂ) * Complex.I)) volume (-V) V ∧ + IntervalIntegrable (fun y : ℝ => f (-(1/32 : ℂ) + (y : ℂ) * Complex.I)) volume (-V) V := by + have hh (y : ℝ) (hy : y = -V ∨ y = V) : + IntervalIntegrable (fun x : ℝ => f ((x : ℂ) + (y : ℂ) * Complex.I)) volume (-(1/32)) 8 := by + apply ContinuousOn.intervalIntegrable + exact hf.comp (by fun_prop) (fun x hx => horizontal_mem_countingBoundary V y x hV hy hx) + have hv (x : ℝ) (hx : x = -(1/32 : ℝ) ∨ x = 8) : + IntervalIntegrable (fun y : ℝ => f ((x : ℂ) + (y : ℂ) * Complex.I)) volume (-V) V := by + apply ContinuousOn.intervalIntegrable + exact hf.comp (by fun_prop) (fun y hy => vertical_mem_countingBoundary V x y hV hx hy) + refine ⟨?_, hh V (Or.inr rfl), ?_, ?_⟩ + · simpa [sub_eq_add_neg] using hh (-V) (Or.inl rfl) + · simpa using hv 8 (Or.inr rfl) + · simpa using hv (-(1/32)) (Or.inl rfl) + +theorem countingBoundaryIntegral_congr (V : ℝ) (hV : 0 < V) {f g : ℂ → ℂ} + (he : EqOn f g (countingRectangleBoundary V)) : + countingBoundaryIntegral V f = countingBoundaryIntegral V g := by + have hh (y : ℝ) (hy : y = -V ∨ y = V) : + (∫ x : ℝ in (-(1/32))..8, f ((x : ℂ) + (y : ℂ) * Complex.I)) = + ∫ x : ℝ in (-(1/32))..8, g ((x : ℂ) + (y : ℂ) * Complex.I) := by + apply intervalIntegral.integral_congr + intro x hx + exact he (horizontal_mem_countingBoundary V y x hV hy hx) + have hv (x : ℝ) (hx : x = -(1/32 : ℝ) ∨ x = 8) : + (∫ y : ℝ in (-V)..V, f ((x : ℂ) + (y : ℂ) * Complex.I)) = + ∫ y : ℝ in (-V)..V, g ((x : ℂ) + (y : ℂ) * Complex.I) := by + apply intervalIntegral.integral_congr + intro y hy + exact he (vertical_mem_countingBoundary V x y hV hx hy) + have hb := hh (-V) (Or.inl rfl) + have hr := hv 8 (Or.inr rfl) + have hl := hv (-(1/32)) (Or.inl rfl) + simp only [Complex.ofReal_neg, neg_mul, ← sub_eq_add_neg] at hb + norm_num only [Complex.ofReal_ofNat, Complex.ofReal_neg, Complex.ofReal_div, + Complex.ofReal_one] at hr hl + unfold countingBoundaryIntegral + rw [hb, hh V (Or.inr rfl), hr, hl] + +theorem countingBoundaryIntegral_sub (V : ℝ) (hV : 0 < V) (f g : ℂ → ℂ) + (hf : ContinuousOn f (countingRectangleBoundary V)) + (hg : ContinuousOn g (countingRectangleBoundary V)) : + countingBoundaryIntegral V (fun z => f z - g z) = + countingBoundaryIntegral V f - countingBoundaryIntegral V g := by + obtain ⟨hf₁, hf₂, hf₃, hf₄⟩ := countingBoundary_edge_integrable V hV f hf + obtain ⟨hg₁, hg₂, hg₃, hg₄⟩ := countingBoundary_edge_integrable V hV g hg + simp only [countingBoundaryIntegral, intervalIntegral.integral_sub hf₁ hg₁, + intervalIntegral.integral_sub hf₂ hg₂, intervalIntegral.integral_sub hf₃ hg₃, + intervalIntegral.integral_sub hf₄ hg₄] + ring + +theorem countingBoundaryIntegral_add (V : ℝ) (hV : 0 < V) (f g : ℂ → ℂ) + (hf : ContinuousOn f (countingRectangleBoundary V)) + (hg : ContinuousOn g (countingRectangleBoundary V)) : + countingBoundaryIntegral V (fun z => f z + g z) = + countingBoundaryIntegral V f + countingBoundaryIntegral V g := by + obtain ⟨hf₁, hf₂, hf₃, hf₄⟩ := countingBoundary_edge_integrable V hV f hf + obtain ⟨hg₁, hg₂, hg₃, hg₄⟩ := countingBoundary_edge_integrable V hV g hg + simp only [countingBoundaryIntegral, intervalIntegral.integral_add hf₁ hg₁, + intervalIntegral.integral_add hf₂ hg₂, intervalIntegral.integral_add hf₃ hg₃, + intervalIntegral.integral_add hf₄ hg₄] + ring + +theorem countingBoundaryIntegral_const_mul (V : ℝ) (c : ℂ) (f : ℂ → ℂ) : + countingBoundaryIntegral V (fun z => c * f z) = c * countingBoundaryIntegral V f := by + simp only [countingBoundaryIntegral, intervalIntegral.integral_const_mul] + ring + +@[simp] theorem countingBoundaryIntegral_zero (V : ℝ) : + countingBoundaryIntegral V (fun _ => 0) = 0 := by simp [countingBoundaryIntegral] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleBoundaryPrimitive.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleBoundaryPrimitive.lean new file mode 100644 index 0000000000000000000000000000000000000000..5323635766c7ee3abd01866d1fe9fb69209f5f9a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleBoundaryPrimitive.lean @@ -0,0 +1,84 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.RectangleBoundaryIntegral +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.SegmentInversePrimitive + +namespace OAI + +/-! # Integrating derivatives on the spectral rectangle -/ + +open Set MeasureTheory +namespace DefocusingNLS + +theorem integral_segment_deriv (f : ℂ → ℂ) (u v : ℂ) (l r : ℝ) + (hf : ∀ t ∈ uIcc l r, AnalyticAt ℂ f (u + (t : ℂ) * v)) : + (∫ t : ℝ in l..r, v * deriv f (u + (t : ℂ) * v)) = + f (u + (r : ℂ) * v) - f (u + (l : ℂ) * v) := by + have hd (t : ℝ) (ht : t ∈ uIcc l r) : + HasDerivAt (fun s : ℝ => f (u + (s : ℂ) * v)) + (v * deriv f (u + (t : ℂ) * v)) t := by + simpa only [Function.comp_def, smul_eq_mul, id_eq, Complex.ofReal_one, one_mul] using! + (hf t ht).differentiableAt.hasDerivAt.scomp t + (((hasDerivAt_id t).ofReal_comp.mul_const v).const_add u) + have hi : IntervalIntegrable (fun t : ℝ => v * deriv f (u + (t : ℂ) * v)) + volume l r := by + apply ContinuousOn.intervalIntegrable + apply continuousOn_const.mul + intro t ht + have hp : ContinuousAt (fun s : ℝ => u + (s : ℂ) * v) t := by fun_prop + exact ContinuousAt.continuousWithinAt + (ContinuousAt.comp (f := fun s : ℝ => u + (s : ℂ) * v) + (g := deriv f) (hf t ht).deriv.continuousAt hp) + exact intervalIntegral.integral_eq_sub_of_hasDerivAt hd hi + +theorem horizontal_mem_countingBoundary (V y x : ℝ) (hV : 0 < V) + (hy : y = -V ∨ y = V) (hx : x ∈ uIcc (-(1/32 : ℝ)) 8) : + (x : ℂ) + (y : ℂ) * Complex.I ∈ countingRectangleBoundary V := by + rw [uIcc_of_le (by norm_num : -(1/32 : ℝ) ≤ 8)] at hx + rw [mem_countingRectangleBoundary_iff] + simp only [closedCountingRectangle, mem_ofPred_eq, + Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, + mul_zero, Complex.ofReal_im, Complex.I_im, sub_zero, add_zero, + Complex.add_im, Complex.mul_im, mul_one, zero_add] + rcases hy with rfl | rfl <;> + exact ⟨⟨hx.1, hx.2, by linarith, by linarith⟩, by tauto⟩ + +theorem vertical_mem_countingBoundary (V x y : ℝ) (hV : 0 < V) + (hx : x = -(1/32 : ℝ) ∨ x = 8) (hy : y ∈ uIcc (-V) V) : + (x : ℂ) + (y : ℂ) * Complex.I ∈ countingRectangleBoundary V := by + rw [uIcc_of_le (by linarith : -V ≤ V)] at hy + rw [mem_countingRectangleBoundary_iff] + simp only [closedCountingRectangle, mem_ofPred_eq, + Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, + mul_zero, Complex.ofReal_im, Complex.I_im, sub_zero, add_zero, + Complex.add_im, Complex.mul_im, mul_one, zero_add] + rcases hx with rfl | rfl <;> + exact ⟨⟨by norm_num, by norm_num, hy.1, hy.2⟩, by tauto⟩ + +theorem countingBoundaryIntegral_deriv (V : ℝ) (hV : 0 < V) (f : ℂ → ℂ) + (hf : AnalyticOnNhd ℂ f (countingRectangleBoundary V)) : + countingBoundaryIntegral V (deriv f) = 0 := by + have hb := integral_segment_deriv f (-(V : ℂ) * Complex.I) 1 (-(1/32 : ℝ)) 8 + (fun t ht => by simpa [mul_one, add_comm, neg_mul, sub_eq_add_neg] using + (hf _ (horizontal_mem_countingBoundary V (-V) t hV (Or.inl rfl) ht))) + have ht := integral_segment_deriv f ((V : ℂ) * Complex.I) 1 (-(1/32 : ℝ)) 8 + (fun t ht => by simpa [mul_one, add_comm] using + (hf _ (horizontal_mem_countingBoundary V V t hV (Or.inr rfl) ht))) + have hr := integral_segment_deriv f 8 Complex.I (-V) V + (fun t ht => hf _ (vertical_mem_countingBoundary V 8 t hV (Or.inr rfl) ht)) + have hl := integral_segment_deriv f (-(1/32 : ℂ)) Complex.I (-V) V + (fun t ht => by simpa using + (hf _ (vertical_mem_countingBoundary V (-(1/32 : ℝ)) t hV (Or.inl rfl) ht))) + simp only [mul_one, one_mul] at hb ht + simp only [add_comm ((V : ℂ) * Complex.I)] at ht + rw [intervalIntegral.integral_const_mul] at hr hl + simp only [countingBoundaryIntegral] + have hb' : (∫ x : ℝ in (-(1/32 : ℝ))..8, deriv f ((x : ℂ) - (V : ℂ) * Complex.I)) = + f (8 - (V : ℂ) * Complex.I) - f (-(1/32 : ℂ) - (V : ℂ) * Complex.I) := by + simpa [add_comm, neg_mul, sub_eq_add_neg] using hb + rw [hb', ht, hr, hl] + simp only [Complex.ofReal_neg, Complex.ofReal_ofNat, Complex.ofReal_div, + Complex.ofReal_one, neg_mul, sub_eq_add_neg] + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleContourDegree.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleContourDegree.lean new file mode 100644 index 0000000000000000000000000000000000000000..1dcab8af12d0242581502e2e0a61668927b25cc8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleContourDegree.lean @@ -0,0 +1,76 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.RectangleFiniteFactor + +namespace OAI + +/-! # The rectangular contour integral counts the finite analytic divisor -/ + +open Set Function MeromorphicOn +namespace DefocusingNLS + +theorem countingBoundaryIntegral_sum {ι : Type*} (V : ℝ) (hV : 0 < V) + (s : Finset ι) (F : ι → ℂ → ℂ) + (hF : ∀ i ∈ s, ContinuousOn (F i) (countingRectangleBoundary V)) : + countingBoundaryIntegral V (fun z => ∑ i ∈ s, F i z) = + ∑ i ∈ s, countingBoundaryIntegral V (F i) := by + classical + induction s using Finset.induction_on with + | empty => simp + | @insert a s ha ih => + simp only [Finset.mem_insert, forall_eq_or_imp] at hF + simp only [Finset.sum_insert ha] + rw [countingBoundaryIntegral_add V hV _ _ hF.1 (continuousOn_finsetSum s hF.2), ih hF.2] + +theorem countingBoundaryIntegral_eq_degree (V : ℝ) (hV : 0 < V) (f : ℂ → ℂ) + (hf : AnalyticOnNhd ℂ f (closedCountingRectangle V)) + (hn : ∀ z ∈ countingRectangleBoundary V, f z ≠ 0) : + countingBoundaryIntegral V (logDeriv f) = + (countingZeroDegree V f : ℂ) * countingBoundaryIntegral V (fun z => z⁻¹) := by + classical + obtain ⟨g, hg, hgn, he⟩ := rectangle_finite_factorization V hV f hf hn + have hp : AnalyticOnNhd ℂ (countingDivisorFactor V f) (closedCountingRectangle V) := + (countingDivisorFactor_analytic V f).mono (subset_univ _) + have hm := hp.mul hg + have hd := rectangle_eqOn_deriv V hV f _ hf hm he + have hlog : EqOn (logDeriv f) + (fun z => logDeriv (countingDivisorFactor V f) z + logDeriv g z) + (countingRectangleBoundary V) := by + intro z hz + calc + logDeriv f z = logDeriv (fun w => countingDivisorFactor V f w * g w) z := by + simp only [logDeriv_apply, hd hz.1, he hz.1] + _ = _ := logDeriv_fun_mul z (countingDivisorFactor_ne_zero V f hf hn z hz) + (hgn z hz.1) (hp z hz.1).differentiableAt (hg z hz.1).differentiableAt + have hpc : ContinuousOn (logDeriv (countingDivisorFactor V f)) (countingRectangleBoundary V) := + ((hp.mono fun _ hz => hz.1).deriv.div (hp.mono fun _ hz => hz.1) + (countingDivisorFactor_ne_zero V f hf hn)).continuousOn + have hgc : ContinuousOn (logDeriv g) (countingRectangleBoundary V) := + ((hg.deriv.div hg hgn).mono fun _ hz => hz.1).continuousOn + have hgzero : countingBoundaryIntegral V (logDeriv g) = 0 := by + change countingBoundaryIntegral V (fun z => deriv g z / g z) = 0 + exact countingBoundaryIntegral_eq_zero V hV _ (hg.deriv.div hg hgn) + rw [countingBoundaryIntegral_congr V hV hlog, + countingBoundaryIntegral_add V hV _ _ hpc hgc, + hgzero, add_zero] + rw [countingBoundaryIntegral_congr V hV (fun z hz => countingDivisorFactor_logDeriv V f hf hn z hz)] + have hcont (a : ℂ) (ha : a ∈ countingDivisorPoints V f) : + ContinuousOn (fun z : ℂ => ((divisor f (closedCountingRectangle V) a).toNat : ℂ) * (z - a)⁻¹) + (countingRectangleBoundary V) := by + apply continuousOn_const.mul + apply ContinuousOn.inv₀ (by fun_prop) + intro z hz + exact sub_ne_zero.mpr (countingBoundary_ne_interior hz (countingDivisorPoints_subset V f hf hn a ha)) + rw [countingBoundaryIntegral_sum V hV _ _ hcont] + calc + _ = ∑ a ∈ countingDivisorPoints V f, ((divisor f (closedCountingRectangle V) a).toNat : ℂ) * + countingBoundaryIntegral V (fun z => z⁻¹) := by + apply Finset.sum_congr rfl + intro a ha + rw [countingBoundaryIntegral_const_mul] + congr 1 + simpa only [sub_zero] using countingBoundaryIntegral_inv_sub_eq V hV a 0 + (countingDivisorPoints_subset V f hf hn a ha) (zero_mem_countingRectangle V hV) + _ = _ := by rw [← Finset.sum_mul, countingZeroDegree, Nat.cast_sum] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleDivisorGeometry.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleDivisorGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..2840a05e48bce5c052e77035634ef38e5d022f05 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleDivisorGeometry.lean @@ -0,0 +1,80 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.RectangleKernelNonzero + +namespace OAI + +/-! # The finite divisor has support strictly inside the counting rectangle -/ + +open Set Filter Function MeromorphicOn +open scoped Topology +namespace DefocusingNLS + +theorem countingRectangle_subset_closed (V : ℝ) : + countingRectangle V ⊆ closedCountingRectangle V := by + rintro z ⟨h₁,h₂,h₃,h₄⟩ + exact ⟨h₁.le,h₂.le,h₃.le,h₄.le⟩ + +theorem closure_countingRectangle (V : ℝ) (hV : 0 < V) : + closure (countingRectangle V) = closedCountingRectangle V := by + have ho : countingRectangle V = Ioo (-(1/32 : ℝ)) 8 ×ℂ Ioo (-V) V := by + ext z + simp only [countingRectangle, mem_ofPred_eq, Complex.mem_reProdIm, mem_Ioo] + tauto + rw [ho, Complex.closure_reProdIm, closure_Ioo (by norm_num : -(1/32 : ℝ) ≠ 8), + closure_Ioo (by linarith : -V ≠ V)] + ext z + simp only [closedCountingRectangle, mem_ofPred_eq, Complex.mem_reProdIm, mem_Icc] + tauto + +theorem counting_divisor_eq_orderNat (V : ℝ) (hV : 0 < V) (f : ℂ → ℂ) + (hf : AnalyticOnNhd ℂ f (closedCountingRectangle V)) + (hn : ∀ z ∈ countingRectangleBoundary V, f z ≠ 0) + (z : ℂ) (hz : z ∈ closedCountingRectangle V) : + MeromorphicOn.divisor f (closedCountingRectangle V) z = (analyticOrderNatAt f z : ℤ) := by + rw [hf.divisor_apply hz, + ← Nat.cast_analyticOrderNatAt (rectangle_analyticOrder_ne_top V hV f hf hn z hz)] + simp + +theorem counting_divisor_support_interior (V : ℝ) (f : ℂ → ℂ) + (hf : AnalyticOnNhd ℂ f (closedCountingRectangle V)) + (hn : ∀ z ∈ countingRectangleBoundary V, f z ≠ 0) : + (MeromorphicOn.divisor f (closedCountingRectangle V)).support ⊆ countingRectangle V := by + intro z hz + have hc := (MeromorphicOn.divisor f (closedCountingRectangle V)).supportWithinDomain hz + by_contra hi + have ho := (hf z hc).analyticOrderAt_eq_zero.mpr (hn z ⟨hc, hi⟩) + have he : MeromorphicOn.divisor f (closedCountingRectangle V) z = 0 := by + rw [hf.divisor_apply hc, ho] + simp + exact hz he + +theorem analytic_eqOn_of_rectangle_codiscrete (V : ℝ) (hV : 0 < V) (f g : ℂ → ℂ) + (hf : AnalyticOnNhd ℂ f (closedCountingRectangle V)) + (hg : AnalyticOnNhd ℂ g (closedCountingRectangle V)) + (he : f =ᶠ[codiscreteWithin (closedCountingRectangle V)] g) : + EqOn f g (closedCountingRectangle V) := by + have h₀ := zero_mem_countingRectangle V hV + have hc₀ := countingRectangle_subset_closed V h₀ + have he₀ := (eventuallyEq_codiscreteWithin_iff_forall_eventually_nhdsNE.mp he) 0 hc₀ + have hm₀ : ∀ᶠ z in 𝓝 (0 : ℂ), z ∈ countingRectangle V := + (isOpen_countingRectangle V).mem_nhds h₀ + have hm : ∀ᶠ z in 𝓝[≠] (0 : ℂ), z ∈ closedCountingRectangle V := + (hm₀.filter_mono nhdsWithin_le_nhds).mono + (fun _ hz => countingRectangle_subset_closed V hz) + have heq : ∀ᶠ z in 𝓝[≠] (0 : ℂ), f z = g z := by + filter_upwards [he₀, hm] with z he hz using he hz + exact hf.eqOn_of_preconnected_of_frequently_eq hg + (isConnected_closedCountingRectangle V hV).isPreconnected hc₀ heq.frequently + +theorem rectangle_eqOn_deriv (V : ℝ) (hV : 0 < V) (f g : ℂ → ℂ) + (hf : AnalyticOnNhd ℂ f (closedCountingRectangle V)) + (hg : AnalyticOnNhd ℂ g (closedCountingRectangle V)) + (he : EqOn f g (closedCountingRectangle V)) : + EqOn (deriv f) (deriv g) (closedCountingRectangle V) := by + have ho := (he.mono (countingRectangle_subset_closed V)).deriv (isOpen_countingRectangle V) + apply ho.of_subset_closure hf.deriv.continuousOn hg.deriv.continuousOn + (countingRectangle_subset_closed V) + rw [closure_countingRectangle V hV] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleFiniteFactor.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleFiniteFactor.lean new file mode 100644 index 0000000000000000000000000000000000000000..0eb48399933d9611f8135c386ea43fe28f66730b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleFiniteFactor.lean @@ -0,0 +1,82 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.RectangleZeroDegree +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.RectangleLogPrimitive + +namespace OAI + +/-! # Polynomial factorization and its boundary logarithmic derivative -/ + +open Set Function MeromorphicOn +namespace DefocusingNLS + +noncomputable def countingDivisorFactor (V : ℝ) (f : ℂ → ℂ) (z : ℂ) : ℂ := + ∏ a ∈ countingDivisorPoints V f, (z - a) ^ (divisor f (closedCountingRectangle V) a).toNat + +theorem countingDivisorFactor_analytic (V : ℝ) (f : ℂ → ℂ) : + AnalyticOnNhd ℂ (countingDivisorFactor V f) univ := by + intro z _ + unfold countingDivisorFactor + fun_prop + +theorem countingDivisorFactor_eq_finprod (V : ℝ) (f : ℂ → ℂ) + (hf : AnalyticOnNhd ℂ f (closedCountingRectangle V)) : + countingDivisorFactor V f = ∏ᶠ a, (· - a) ^ divisor f (closedCountingRectangle V) a := by + classical + have hs : (fun a : ℂ => (· - a) ^ divisor f (closedCountingRectangle V) a).mulSupport ⊆ + (countingDivisorPoints V f : Set ℂ) := by + rw [FactorizedRational.mulSupport] + intro a ha + exact (mem_countingDivisorPoints V f a).mpr ha + rw [finprod_eq_prod_of_mulSupport_subset _ hs] + funext z + simp only [countingDivisorFactor, Finset.prod_apply, Pi.pow_apply] + apply Finset.prod_congr rfl + intro a ha + symm + simpa only [zpow_natCast] using congrArg (fun n : ℤ => (z - a) ^ n) + (Int.toNat_of_nonneg (hf.divisor_nonneg a)).symm + +theorem rectangle_finite_factorization (V : ℝ) (hV : 0 < V) (f : ℂ → ℂ) + (hf : AnalyticOnNhd ℂ f (closedCountingRectangle V)) + (hn : ∀ z ∈ countingRectangleBoundary V, f z ≠ 0) : + ∃ g : ℂ → ℂ, AnalyticOnNhd ℂ g (closedCountingRectangle V) ∧ + (∀ z ∈ closedCountingRectangle V, g z ≠ 0) ∧ + EqOn f (fun z => countingDivisorFactor V f z * g z) (closedCountingRectangle V) := by + obtain ⟨g, hg, hgn, he⟩ := rectangle_extract_zeros V hV f hf hn + have hp := countingDivisorFactor_analytic V f + refine ⟨g, hg, hgn, analytic_eqOn_of_rectangle_codiscrete V hV f _ hf + ((hp.mono (subset_univ _)).mul hg) ?_⟩ + simpa only [← countingDivisorFactor_eq_finprod V f hf, Pi.smul_apply, smul_eq_mul] using! he + +theorem countingDivisorFactor_ne_zero (V : ℝ) (f : ℂ → ℂ) + (hf : AnalyticOnNhd ℂ f (closedCountingRectangle V)) + (hn : ∀ z ∈ countingRectangleBoundary V, f z ≠ 0) + (z : ℂ) (hz : z ∈ countingRectangleBoundary V) : countingDivisorFactor V f z ≠ 0 := by + classical + apply Finset.prod_ne_zero_iff.mpr + intro a ha + exact pow_ne_zero _ (sub_ne_zero.mpr (countingBoundary_ne_interior hz + (countingDivisorPoints_subset V f hf hn a ha))) + +theorem countingDivisorFactor_logDeriv (V : ℝ) (f : ℂ → ℂ) + (hf : AnalyticOnNhd ℂ f (closedCountingRectangle V)) + (hn : ∀ z ∈ countingRectangleBoundary V, f z ≠ 0) + (z : ℂ) (hz : z ∈ countingRectangleBoundary V) : + logDeriv (countingDivisorFactor V f) z = + ∑ a ∈ countingDivisorPoints V f, + ((divisor f (closedCountingRectangle V) a).toNat : ℂ) * (z - a)⁻¹ := by + classical + unfold countingDivisorFactor + rw [logDeriv_fun_prod] + · apply Finset.sum_congr rfl + intro a ha + rw [logDeriv_fun_pow (by fun_prop)] + simp [logDeriv_apply] + · intro a ha + exact pow_ne_zero _ (sub_ne_zero.mpr (countingBoundary_ne_interior hz + (countingDivisorPoints_subset V f hf hn a ha))) + · intro a ha + fun_prop + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleHomotopyCount.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleHomotopyCount.lean new file mode 100644 index 0000000000000000000000000000000000000000..67ec48d088c8c15704d5210bef3ab4956e056fab --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleHomotopyCount.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.RectangleRoucheInput +import Mathlib.Topology.LocallyConstant.Basic + +namespace OAI + +/-! # Root-count transport along the tail homotopy + +Only the explicit published Rouché input is conditional. Compactness gives +local Rouché comparison and connectedness gives equality of endpoint counts. +-/ + +open Set Filter Topology + +namespace DefocusingNLS + +theorem rectangleZeroCount_homotopy (hR : RectangleRouche) (V : ℝ) (hV : 0 < V) + (F : ℝ → ℂ → ℂ) + (ha : ∀ a ∈ Icc (0 : ℝ) 1, AnalyticOnNhd ℂ (F a) (closedCountingRectangle V)) + (hc : ∀ a ∈ Icc (0 : ℝ) 1, ∀ z ∈ countingRectangleBoundary V, + ContinuousAt (fun x : ℝ × ℂ => F x.1 x.2) (a, z)) + (hn : ∀ a ∈ Icc (0 : ℝ) 1, ∀ z ∈ countingRectangleBoundary V, F a z ≠ 0) : + rectangleZeroCount V (F 0) = rectangleZeroCount V (F 1) := by + let G : Icc (0 : ℝ) 1 → ℕ∞ := fun a => rectangleZeroCount V (F a.1) + have hG : IsLocallyConstant G := by + apply (IsLocallyConstant.iff_eventually_eq G).mpr + intro a + have he : ∀ᶠ b : Icc (0 : ℝ) 1 in 𝓝 a, + ∀ z ∈ countingRectangleBoundary V, ‖F b.1 z - F a.1 z‖ < ‖F a.1 z‖ := by + apply (isCompact_countingRectangleBoundary V).eventually_forall_of_forall_eventually + intro z hz + have hj : ContinuousAt + (fun x : Icc (0 : ℝ) 1 × ℂ => F x.1.1 x.2) (a, z) := + ContinuousAt.comp + (f := fun x : Icc (0 : ℝ) 1 × ℂ => (x.1.1, x.2)) + (g := fun x : ℝ × ℂ => F x.1 x.2) (hc a.1 a.2 z hz) + ((continuous_subtype_val.comp continuous_fst).continuousAt.prodMk continuousAt_snd) + have hf : ContinuousAt (F a.1) z := (ha a.1 a.2 z hz.1).continuousAt + have hd : ContinuousAt + (fun x : Icc (0 : ℝ) 1 × ℂ => ‖F x.1.1 x.2 - F a.1 x.2‖) (a, z) := + (hj.sub (hf.comp continuousAt_snd)).norm + have hr : ContinuousAt + (fun x : Icc (0 : ℝ) 1 × ℂ => ‖F a.1 x.2‖) (a, z) := + (hf.comp continuousAt_snd).norm + have hneg : ‖F a.1 z - F a.1 z‖ - ‖F a.1 z‖ < 0 := by + simpa using neg_lt_zero.mpr (norm_pos_iff.mpr (hn a.1 a.2 z hz)) + have hev := (hd.sub hr).eventually (eventually_lt_nhds hneg) + exact hev.mono fun x hx => sub_lt_zero.mp hx + filter_upwards [he] with b hb + exact (hR V hV (F a.1) (F b.1) (ha a.1 a.2) (ha b.1 b.2) hb).symm + exact hG.apply_eq_of_preconnectedSpace ⟨0, by constructor <;> norm_num⟩ + ⟨1, by constructor <;> norm_num⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleKernelNonzero.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleKernelNonzero.lean new file mode 100644 index 0000000000000000000000000000000000000000..175ba8ef008e9bb41423f93eccb7bbd6d77af9e2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleKernelNonzero.lean @@ -0,0 +1,95 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.RectangleBoundaryLinear +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.RectangleRatioSlit + +namespace OAI + +/-! # Nonvanishing of the Cauchy-kernel integral in the counting rectangle -/ + +open Set MeasureTheory +namespace DefocusingNLS + +theorem zero_mem_countingRectangle (V : ℝ) (hV : 0 < V) : + (0 : ℂ) ∈ countingRectangle V := by + change -(1/32 : ℝ) < 0 ∧ (0 : ℝ) < 8 ∧ -V < 0 ∧ (0 : ℝ) < V + exact ⟨by norm_num, by norm_num, by linarith, hV⟩ + +theorem countingBoundaryIntegral_inv_im_pos (V : ℝ) (hV : 0 < V) : + 0 < (countingBoundaryIntegral V (fun z => z⁻¹)).im := by + have hn (z : ℂ) (hz : z ∈ countingRectangleBoundary V) : z ≠ 0 := + countingBoundary_ne_interior hz (zero_mem_countingRectangle V hV) + have hc : ContinuousOn (fun z : ℂ => z⁻¹) (countingRectangleBoundary V) := + continuousOn_id.inv₀ hn + obtain ⟨hb, ht, hr, hl⟩ := countingBoundary_edge_integrable V hV _ hc + have hbpos (x : ℝ) : 0 < (((x : ℂ) - (V : ℂ) * Complex.I)⁻¹).im := by + rw [Complex.inv_im] + have he : ((x : ℂ) - (V : ℂ) * Complex.I).im = -V := by simp + rw [he, neg_neg] + apply div_pos hV + apply Complex.normSq_pos.mpr + intro heq + have := congrArg Complex.im heq + simp only [he, Complex.zero_im] at this + linarith + have hbc : ContinuousOn (fun x : ℝ => (((x : ℂ) - (V : ℂ) * Complex.I)⁻¹).im) + (uIcc (-(1/32 : ℝ)) 8) := by + apply Complex.continuous_im.comp_continuousOn + apply ContinuousOn.inv₀ (by fun_prop) + intro x hx heq + have he := congrArg Complex.im heq + simp at he + linarith + have hbi : 0 < (∫ x : ℝ in (-(1/32 : ℝ))..8, + (((x : ℂ) - (V : ℂ) * Complex.I)⁻¹).im) := + intervalIntegral.intervalIntegral_pos_of_pos hbc.intervalIntegrable hbpos (by norm_num) + have hti : (∫ x : ℝ in (-(1/32 : ℝ))..8, + (((x : ℂ) + (V : ℂ) * Complex.I)⁻¹).im) ≤ 0 := by + rw [← neg_nonneg, ← intervalIntegral.integral_neg] + apply intervalIntegral.integral_nonneg (by norm_num) + intro x hx + simp only [Complex.inv_im] + have he : ((x : ℂ) + (V : ℂ) * Complex.I).im = V := by simp + rw [he, neg_div, neg_neg] + exact div_nonneg hV.le (Complex.normSq_nonneg _) + have hri : 0 ≤ (∫ y : ℝ in (-V)..V, ((8 + (y : ℂ) * Complex.I)⁻¹).re) := by + apply intervalIntegral.integral_nonneg (by linarith) + intro y hy + simp only [Complex.inv_re] + have he : (8 + (y : ℂ) * Complex.I).re = 8 := by simp + rw [he] + exact div_nonneg (by norm_num) (Complex.normSq_nonneg _) + have hli : (∫ y : ℝ in (-V)..V, ((-(1/32 : ℂ) + (y : ℂ) * Complex.I)⁻¹).re) ≤ 0 := by + rw [← neg_nonneg, ← intervalIntegral.integral_neg] + apply intervalIntegral.integral_nonneg (by linarith) + intro y hy + simp only [Complex.inv_re] + have he : (-(1/32 : ℂ) + (y : ℂ) * Complex.I).re = -(1/32 : ℝ) := by norm_num + rw [he, neg_div, neg_neg] + exact div_nonneg (by norm_num) (Complex.normSq_nonneg _) + have hbEq : (∫ x : ℝ in (-(1/32))..8, ((x : ℂ) - (V : ℂ) * Complex.I)⁻¹).im = + ∫ x : ℝ in (-(1/32))..8, (((x : ℂ) - (V : ℂ) * Complex.I)⁻¹).im := by + simpa using! (intervalIntegral.intervalIntegral_im hb).symm + have htEq : (∫ x : ℝ in (-(1/32))..8, ((x : ℂ) + (V : ℂ) * Complex.I)⁻¹).im = + ∫ x : ℝ in (-(1/32))..8, (((x : ℂ) + (V : ℂ) * Complex.I)⁻¹).im := by + simpa using! (intervalIntegral.intervalIntegral_im ht).symm + have hrEq : (∫ y : ℝ in (-V)..V, (8 + (y : ℂ) * Complex.I)⁻¹).re = + ∫ y : ℝ in (-V)..V, ((8 + (y : ℂ) * Complex.I)⁻¹).re := by + simpa using! (intervalIntegral.intervalIntegral_re hr).symm + have hlEq : (∫ y : ℝ in (-V)..V, (-(1/32 : ℂ) + (y : ℂ) * Complex.I)⁻¹).re = + ∫ y : ℝ in (-V)..V, ((-(1/32 : ℂ) + (y : ℂ) * Complex.I)⁻¹).re := by + simpa using! (intervalIntegral.intervalIntegral_re hl).symm + rw [← hbEq] at hbi + rw [← htEq] at hti + rw [← hrEq] at hri + rw [← hlEq] at hli + simp only [countingBoundaryIntegral, Complex.sub_im, Complex.add_im, Complex.I_mul_im] + linarith + +theorem countingBoundaryIntegral_inv_ne_zero (V : ℝ) (hV : 0 < V) : + countingBoundaryIntegral V (fun z => z⁻¹) ≠ 0 := by + intro he + have hp := countingBoundaryIntegral_inv_im_pos V hV + simp [he] at hp + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleLogPrimitive.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleLogPrimitive.lean new file mode 100644 index 0000000000000000000000000000000000000000..944b9492291d40c9f70e0e4bfdd62a314e090b81 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleLogPrimitive.lean @@ -0,0 +1,76 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.RectangleBoundaryLinear +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.RectangleRatioSlit +import Mathlib.Analysis.Calculus.LogDeriv + +namespace OAI + +/-! # Boundary logarithms compare logarithmic-derivative integrals -/ + +open Set +namespace DefocusingNLS + +theorem countingBoundaryIntegral_logDeriv_eq_of_ratio (V : ℝ) (hV : 0 < V) + (f g : ℂ → ℂ) + (hf : AnalyticOnNhd ℂ f (countingRectangleBoundary V)) + (hg : AnalyticOnNhd ℂ g (countingRectangleBoundary V)) + (hnf : ∀ z ∈ countingRectangleBoundary V, f z ≠ 0) + (hng : ∀ z ∈ countingRectangleBoundary V, g z ≠ 0) + (hs : ∀ z ∈ countingRectangleBoundary V, f z / g z ∈ Complex.slitPlane) : + countingBoundaryIntegral V (logDeriv f) = countingBoundaryIntegral V (logDeriv g) := by + have hr : AnalyticOnNhd ℂ (fun z => f z / g z) (countingRectangleBoundary V) := + fun z hz => (hf z hz).div (hg z hz) (hng z hz) + have hl := hr.clog hs + have he : EqOn (deriv (fun z => Complex.log (f z / g z))) + (fun z => logDeriv f z - logDeriv g z) (countingRectangleBoundary V) := by + intro z hz + change deriv (Complex.log ∘ (fun z => f z / g z)) z = _ + rw [Complex.deriv_log_comp_eq_logDeriv (hr z hz).differentiableAt (hs z hz)] + exact logDeriv_fun_div z (hnf z hz) (hng z hz) + (hf z hz).differentiableAt (hg z hz).differentiableAt + have hlf : ContinuousOn (logDeriv f) (countingRectangleBoundary V) := + (hf.deriv.div hf hnf).continuousOn + have hlg : ContinuousOn (logDeriv g) (countingRectangleBoundary V) := + (hg.deriv.div hg hng).continuousOn + have hi := countingBoundaryIntegral_deriv V hV _ hl + rw [countingBoundaryIntegral_congr V hV he, + countingBoundaryIntegral_sub V hV _ _ hlf hlg] at hi + exact sub_eq_zero.mp hi + +theorem countingBoundaryIntegral_rouche (V : ℝ) (hV : 0 < V) (f g : ℂ → ℂ) + (hf : AnalyticOnNhd ℂ f (closedCountingRectangle V)) + (hg : AnalyticOnNhd ℂ g (closedCountingRectangle V)) + (hn : ∀ z ∈ countingRectangleBoundary V, ‖g z - f z‖ < ‖f z‖) : + countingBoundaryIntegral V (logDeriv f) = countingBoundaryIntegral V (logDeriv g) := by + have hnf (z : ℂ) (hz : z ∈ countingRectangleBoundary V) : f z ≠ 0 := + norm_pos_iff.mp ((norm_nonneg _).trans_lt (hn z hz)) + have hng (z : ℂ) (hz : z ∈ countingRectangleBoundary V) : g z ≠ 0 := by + intro he + have hi := hn z hz + simp [he] at hi + symm + apply countingBoundaryIntegral_logDeriv_eq_of_ratio V hV g f + (fun z hz => hg z hz.1) (fun z hz => hf z hz.1) hng hnf + intro z hz + have he : g z / f z = 1 + (g z - f z) / f z := by field_simp [hnf z hz]; ring + rw [he] + apply Complex.mem_slitPlane_of_norm_lt_one + rw [norm_div] + exact (div_lt_one (norm_pos_iff.mpr (hnf z hz))).mpr (hn z hz) + +theorem countingBoundaryIntegral_inv_sub_eq (V : ℝ) (hV : 0 < V) (a b : ℂ) + (ha : a ∈ countingRectangle V) (hb : b ∈ countingRectangle V) : + countingBoundaryIntegral V (fun z => (z - a)⁻¹) = + countingBoundaryIntegral V (fun z => (z - b)⁻¹) := by + have hi := countingBoundaryIntegral_logDeriv_eq_of_ratio V hV + (fun z => z - a) (fun z => z - b) (by fun_prop) (by fun_prop) + (fun z hz => sub_ne_zero.mpr (countingBoundary_ne_interior hz ha)) + (fun z hz => sub_ne_zero.mpr (countingBoundary_ne_interior hz hb)) + (fun z hz => countingBoundary_ratio_mem_slitPlane hz ha hb) + have he (c : ℂ) : logDeriv (fun z : ℂ => z - c) = fun z => (z - c)⁻¹ := by + funext z + simp [logDeriv_apply] + simpa only [he a, he b] using hi + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleRatioSlit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleRatioSlit.lean new file mode 100644 index 0000000000000000000000000000000000000000..39cca96fd9045ff41482d12eb59d3ad4693991ae --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleRatioSlit.lean @@ -0,0 +1,48 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.RectangleAnalyticFactorization +import Mathlib.Analysis.SpecialFunctions.Complex.Analytic + +namespace OAI + +/-! # Ratios associated to two interior points avoid the logarithm's cut -/ + +open Set +namespace DefocusingNLS + +theorem countingBoundary_ne_interior {V : ℝ} {z a : ℂ} + (hz : z ∈ countingRectangleBoundary V) (ha : a ∈ countingRectangle V) : z ≠ a := by + rintro rfl + exact hz.2 ha + +theorem countingBoundary_ratio_mem_slitPlane {V : ℝ} {z a b : ℂ} + (hz : z ∈ countingRectangleBoundary V) (ha : a ∈ countingRectangle V) + (hb : b ∈ countingRectangle V) : (z - a) / (z - b) ∈ Complex.slitPlane := by + have hzb : z - b ≠ 0 := sub_ne_zero.mpr (countingBoundary_ne_interior hz hb) + by_contra hc + have hc' : ((z - a) / (z - b)).re ≤ 0 ∧ ((z - a) / (z - b)).im = 0 := by + simpa only [Complex.slitPlane, mem_ofPred_eq, not_or, not_lt, not_not] using hc + let q : ℝ := ((z - a) / (z - b)).re + have hq : q ≤ 0 := hc'.1 + have he : (q : ℂ) * (z - b) = z - a := by + have heq : (q : ℂ) = (z - a) / (z - b) := by + apply Complex.ext <;> simp [q, hc'.2] + rw [heq, div_mul_cancel₀ _ hzb] + have hre := congrArg Complex.re he + have him := congrArg Complex.im he + simp only [Complex.mul_re, Complex.mul_im, Complex.sub_re, Complex.sub_im, + Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero] at hre him + rcases (mem_countingRectangleBoundary_iff V z).mp hz with ⟨hz, hside⟩ + change -(1/32 : ℝ) < a.re ∧ a.re < 8 ∧ -V < a.im ∧ a.im < V at ha + change -(1/32 : ℝ) < b.re ∧ b.re < 8 ∧ -V < b.im ∧ b.im < V at hb + rcases hside with hs | hs | hs | hs + · rw [hs] at hre + nlinarith [mul_nonpos_of_nonpos_of_nonneg hq (sub_nonneg.mpr hb.1.le)] + · rw [hs] at hre + nlinarith [mul_nonpos_of_nonpos_of_nonneg hq (sub_nonneg.mpr hb.2.1.le)] + · rw [hs] at him + nlinarith [mul_nonpos_of_nonpos_of_nonneg hq (sub_nonneg.mpr hb.2.2.1.le)] + · rw [hs] at him + nlinarith [mul_nonpos_of_nonpos_of_nonneg hq (sub_nonneg.mpr hb.2.2.2.le)] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleRouche.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleRouche.lean new file mode 100644 index 0000000000000000000000000000000000000000..30893f698804f76db8ebc29eb21a83dce873a722 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleRouche.lean @@ -0,0 +1,32 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.RectangleContourDegree + +namespace OAI + +/-! # Rouché's theorem for the spectral counting rectangle + +The specialization of Ahlfors, *Complex Analysis*, third edition, +Chapter 4, §5.2, p. 153, Corollary following Theorem 18 follows from the finite +analytic divisor, Cauchy's theorem, and the boundary logarithm of the quotient. +-/ + +namespace DefocusingNLS + +theorem rectangle_rouche : RectangleRouche := by + intro V hV f g hf hg hn + have hnf (z : ℂ) (hz : z ∈ countingRectangleBoundary V) : f z ≠ 0 := + norm_pos_iff.mp ((norm_nonneg _).trans_lt (hn z hz)) + have hng (z : ℂ) (hz : z ∈ countingRectangleBoundary V) : g z ≠ 0 := by + intro he + have hi := hn z hz + simp [he] at hi + have he := countingBoundaryIntegral_rouche V hV f g hf hg hn + rw [countingBoundaryIntegral_eq_degree V hV f hf hnf, + countingBoundaryIntegral_eq_degree V hV g hg hng] at he + have hd : countingZeroDegree V f = countingZeroDegree V g := by + exact_mod_cast mul_right_cancel₀ (countingBoundaryIntegral_inv_ne_zero V hV) he + rw [rectangleZeroCount_eq_degree V hV f hf hnf, + rectangleZeroCount_eq_degree V hV g hg hng, hd] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleRoucheInput.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleRoucheInput.lean new file mode 100644 index 0000000000000000000000000000000000000000..a3bbb0e90625b8b4c845e0541269c163ed6e7bd1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleRoucheInput.lean @@ -0,0 +1,78 @@ +import Mathlib.Analysis.Analytic.Order +import Mathlib.Analysis.Complex.ReImTopology +import Mathlib.Topology.Instances.ENat +import Mathlib.Topology.Algebra.InfiniteSum.Basic + +namespace OAI + +/-! # Rouché's theorem on the spectral counting rectangle + +The rectangle specialization of Rouché's theorem is formulated as a proposition. +See L. V. Ahlfors, *Complex Analysis*, third edition, McGraw-Hill, 1979, +Chapter 4, §5.2, p. 153, Corollary following Theorem 18. +The zero count uses analytic vanishing orders, including multiplicity. +-/ + +open Set + +namespace DefocusingNLS + +def countingRectangle (V : ℝ) : Set ℂ := + {z | -(1 / 32 : ℝ) < z.re ∧ z.re < 8 ∧ -V < z.im ∧ z.im < V} + +def closedCountingRectangle (V : ℝ) : Set ℂ := + {z | -(1 / 32 : ℝ) ≤ z.re ∧ z.re ≤ 8 ∧ -V ≤ z.im ∧ z.im ≤ V} + +def countingRectangleBoundary (V : ℝ) : Set ℂ := + closedCountingRectangle V \ countingRectangle V + +noncomputable def rectangleZeroCount (V : ℝ) (f : ℂ → ℂ) : ℕ∞ := + ∑' z : countingRectangle V, analyticOrderAt f z.1 + +/-- Ahlfors's Rouché corollary, specialized to the one family of rectangles used +for the spectral count. No spectral conclusion is included in this input. -/ +def RectangleRouche : Prop := + ∀ (V : ℝ), 0 < V → ∀ (f g : ℂ → ℂ), + AnalyticOnNhd ℂ f (closedCountingRectangle V) → + AnalyticOnNhd ℂ g (closedCountingRectangle V) → + (∀ z ∈ countingRectangleBoundary V, ‖g z - f z‖ < ‖f z‖) → + rectangleZeroCount V f = rectangleZeroCount V g + +theorem isOpen_countingRectangle (V : ℝ) : IsOpen (countingRectangle V) := by + convert isOpen_Ioo.reProdIm (isOpen_Ioo (a := -V) (b := V)) using 1 + ext z + simp only [countingRectangle, Complex.mem_reProdIm, mem_ofPred_eq, mem_Ioo] + tauto + +theorem isCompact_closedCountingRectangle (V : ℝ) : IsCompact (closedCountingRectangle V) := by + convert (isCompact_Icc (a := -(1 / 32 : ℝ)) (b := 8)).reProdIm + (isCompact_Icc (a := -V) (b := V)) using 1 + ext z + simp only [closedCountingRectangle, Complex.mem_reProdIm, mem_ofPred_eq, mem_Icc] + tauto + +theorem isCompact_countingRectangleBoundary (V : ℝ) : + IsCompact (countingRectangleBoundary V) := + (isCompact_closedCountingRectangle V).diff (isOpen_countingRectangle V) + +theorem mem_countingRectangleBoundary_iff (V : ℝ) (z : ℂ) : + z ∈ countingRectangleBoundary V ↔ + z ∈ closedCountingRectangle V ∧ + (z.re = -(1 / 32 : ℝ) ∨ z.re = 8 ∨ z.im = -V ∨ z.im = V) := by + simp only [countingRectangleBoundary, closedCountingRectangle, countingRectangle, + mem_sdiff, mem_ofPred_eq] + constructor + · rintro ⟨hz, hn⟩ + refine ⟨hz, ?_⟩ + by_contra h + push Not at h + exact hn ⟨lt_of_le_of_ne hz.1 h.1.symm, lt_of_le_of_ne hz.2.1 h.2.1, + lt_of_le_of_ne hz.2.2.1 h.2.2.1.symm, lt_of_le_of_ne hz.2.2.2 h.2.2.2⟩ + · rintro ⟨hz, he⟩ + refine ⟨hz, ?_⟩ + rintro ⟨ha, hb, hc, hd⟩ + rcases he with he | he | he | he <;> linarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleZeroDegree.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleZeroDegree.lean new file mode 100644 index 0000000000000000000000000000000000000000..79b587446c12e2bee390a77ce8554b7608aea68c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RectangleZeroDegree.lean @@ -0,0 +1,59 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.RectangleDivisorGeometry + +namespace OAI + +/-! # The analytic zero count is a finite natural degree -/ + +open Set Function MeromorphicOn +namespace DefocusingNLS + +noncomputable def countingDivisorPoints (V : ℝ) (f : ℂ → ℂ) : Finset ℂ := + ((divisor f (closedCountingRectangle V)).finiteSupport + (isCompact_closedCountingRectangle V)).toFinset + +@[simp] theorem mem_countingDivisorPoints (V : ℝ) (f : ℂ → ℂ) (z : ℂ) : + z ∈ countingDivisorPoints V f ↔ divisor f (closedCountingRectangle V) z ≠ 0 := by + classical + simp [countingDivisorPoints, Function.mem_support] + +noncomputable def countingZeroDegree (V : ℝ) (f : ℂ → ℂ) : ℕ := + ∑ z ∈ countingDivisorPoints V f, (divisor f (closedCountingRectangle V) z).toNat + +theorem countingDivisorPoints_subset (V : ℝ) (f : ℂ → ℂ) + (hf : AnalyticOnNhd ℂ f (closedCountingRectangle V)) + (hn : ∀ z ∈ countingRectangleBoundary V, f z ≠ 0) : + ∀ z ∈ countingDivisorPoints V f, z ∈ countingRectangle V := by + intro z hz + exact counting_divisor_support_interior V f hf hn ((mem_countingDivisorPoints V f z).mp hz) + +theorem rectangleZeroCount_eq_degree (V : ℝ) (hV : 0 < V) (f : ℂ → ℂ) + (hf : AnalyticOnNhd ℂ f (closedCountingRectangle V)) + (hn : ∀ z ∈ countingRectangleBoundary V, f z ≠ 0) : + rectangleZeroCount V f = (countingZeroDegree V f : ℕ∞) := by + classical + have ho := rectangle_analyticOrder_ne_top V hV f hf hn + unfold rectangleZeroCount + rw [tsum_subtype] + rw [tsum_eq_sum (s := countingDivisorPoints V f)] + · unfold countingZeroDegree + rw [Nat.cast_sum] + apply Finset.sum_congr rfl + intro z hz + have hm := countingDivisorPoints_subset V f hf hn z hz + rw [indicator_of_mem hm] + have hd := counting_divisor_eq_orderNat V hV f hf hn z (countingRectangle_subset_closed V hm) + rw [hd, Int.toNat_natCast, Nat.cast_analyticOrderNatAt (ho z (countingRectangle_subset_closed V hm))] + · intro z hz + by_cases hm : z ∈ countingRectangle V + · rw [indicator_of_mem hm] + have hd : divisor f (closedCountingRectangle V) z = 0 := by + simpa only [mem_countingDivisorPoints, not_not] using hz + have he := counting_divisor_eq_orderNat V hV f hf hn z (countingRectangle_subset_closed V hm) + have hn0 : analyticOrderNatAt f z = 0 := by exact_mod_cast (he.symm.trans hd) + rw [← Nat.cast_analyticOrderNatAt (ho z (countingRectangle_subset_closed V hm)), hn0] + rfl + · simp [hm] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RegularizedSlowSolution.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RegularizedSlowSolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..6e452b99baa5cf64b0fcd76a134f18e8328de466 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RegularizedSlowSolution.lean @@ -0,0 +1,61 @@ +import Mathlib.Analysis.SpecialFunctions.Gamma.Basic +import Mathlib.Analysis.SpecialFunctions.Pow.Deriv +import Mathlib.MeasureTheory.Integral.Bochner.Set + +namespace OAI + +/-! # The regularized integral defining the outgoing slow solution + +The integral in Lemma `free:slow`, specialized to integer `m`, subtracts a +constant from the bracket to remove one order of the endpoint singularity. +-/ + +open MeasureTheory Filter Topology + +namespace DefocusingNLS + +noncomputable section + +def regularizingBracket (r x u : ℂ) : ℂ := (1 + u / x) ^ r - 1 + +theorem hasDerivAt_regularizingBracket (r x : ℂ) : + HasDerivAt (regularizingBracket r x) (r / x) 0 := by + change HasDerivAt (fun u : ℂ => (1 + u / x) ^ r - 1) (r / x) 0 + have h : HasDerivAt (fun u : ℂ => 1 + u / x) (1 / x) 0 := + ((hasDerivAt_id 0).div_const x).const_add 1 + simpa only [zero_div, zero_mul, add_zero, Complex.one_cpow, one_mul, mul_one, + div_eq_mul_inv] using + (h.cpow_const (c := r) + (by simp : (1 + (0 : ℂ) / x) ∈ Complex.slitPlane)).sub_const 1 + +/-- The precise endpoint cancellation needed before proving integrability. -/ +theorem regularizingBracket_isBigO (r x : ℂ) : + regularizingBracket r x =O[𝓝 0] (fun u : ℂ => u) := by + change (fun u : ℂ => (1 + u / x) ^ r - 1) =O[𝓝 0] (fun u : ℂ => u) + simpa only [regularizingBracket, zero_div, add_zero, Complex.one_cpow, + sub_self, sub_zero] using (hasDerivAt_regularizingBracket r x).isBigO_sub + +/-- The manuscript's regularized Laplace representation. -/ +def regularizedSlowKernel (q : ℂ) (m : ℕ) (x : ℂ) (u : ℝ) : ℂ := + Complex.exp (-(u : ℂ)) * (u : ℂ) ^ (q - 1) * + regularizingBracket ((m : ℂ) - 1 - q) x u + +def regularizedSlowSolution (q : ℂ) (m : ℕ) (x : ℂ) : ℂ := + x ^ (-q) * (1 + (Complex.Gamma q)⁻¹ * + ∫ u : ℝ in Set.Ioi 0, regularizedSlowKernel q m x u) + +theorem regularizedSlowSolution_zero (m : ℕ) (x : ℂ) : + regularizedSlowSolution 0 m x = 1 := by + simp [regularizedSlowSolution, Complex.Gamma_zero] + +theorem hasDerivAt_regularizedSlowSolution_zero (m : ℕ) (x : ℂ) : + HasDerivAt (regularizedSlowSolution 0 m) 0 x := by + have h : regularizedSlowSolution 0 m = (fun _ : ℂ => 1) := + funext (regularizedSlowSolution_zero m) + rw [h] + exact hasDerivAt_const x (1 : ℂ) + +end +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RightMatchingExclusion.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RightMatchingExclusion.lean new file mode 100644 index 0000000000000000000000000000000000000000..2e30a3d316506634b3b63b963060451563003879 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RightMatchingExclusion.lean @@ -0,0 +1,100 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ForwardConeMonotonicity +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.MatchingBoundary + +namespace OAI + +/-! # Uniform exclusion to the right of the counting rectangle -/ + +open Matrix Polynomial + +namespace DefocusingNLS + +noncomputable def normalizedForwardMatrix (M s q : ℂ) (N : ℕ) : + Matrix (Fin 2) (Fin 2) ℂ := + ((ascPochhammer ℂ N).eval (q - M))⁻¹ • forwardProduct M s q N + +theorem normalizedForwardJet_eq_mulVec (M s q : ℂ) (w : Fin 2 → ℂ) (N : ℕ) : + normalizedForwardJet M s q w N = normalizedForwardMatrix M s q N *ᵥ w := by + rw [normalizedForwardJet_eq, normalizedForwardMatrix, Matrix.smul_mulVec] + +theorem matrixCone_normalizedForwardMatrix (M : ℝ) (s q : ℂ) (N : ℕ) + (w : Fin 2 → ℂ) : + matrixCone M s (normalizedForwardMatrix M s q N) w = + Complex.normSq (((ascPochhammer ℂ N).eval (q - M))⁻¹) * + matrixCone M s (forwardProduct M s q N) w := by + simp only [matrixCone, normalizedForwardMatrix, Matrix.smul_mulVec, + Pi.smul_apply, smul_eq_mul] + exact coneForm_scale M s _ _ _ + +theorem ascPochhammer_eval_ne_zero_of_re_pos (q : ℂ) (N : ℕ) (hq : 0 < q.re) : + (ascPochhammer ℂ N).eval q ≠ 0 := by + induction N with + | zero => simp + | succ N ih => + rw [ascPochhammer_succ_eval] + apply mul_ne_zero ih + intro h + have hr := congrArg Complex.re h + simp only [Complex.add_re, Complex.natCast_re, Complex.zero_re] at hr + linarith [Nat.cast_nonneg (α := ℝ) N] + +/-- The right boundary may be taken uniformly beyond `Re q = ell + 5`. +This proves absence of homotopy zeros throughout that entire half-plane. -/ +theorem matchingHomotopy_right_ne_zero (ell K : ℕ) (s q₁ q₂ : ℂ) (ρ : ℝ) + (hK : 3 ≤ K) (hs : s.re = 0) (hs0 : s.im ≠ 0) + (hq₁ : (ell : ℝ) + 5 < q₁.re) (hq₂ : (ell : ℝ) + 5 < q₂.re) + (hρ : 0 ≤ ρ) (hρ1 : ρ ≤ 1) : + matchingColumnDeterminant + (matchingHomotopyColumn (ell + 5) K s ρ q₁) + (matchingHomotopyColumn (ell + 5) K (-s) ρ q₂) ≠ 0 := by + have hM : 0 < (ell : ℝ) + 5 := by positivity + have hsne : s ≠ 0 := by intro h; apply hs0; simp [h] + have hd (q : ℂ) (hq : (ell : ℝ) + 5 < q.re) (n : ℕ) : + q + n - (((ell : ℝ) + 5) : ℂ) ≠ 0 := by + intro h + have hr := congrArg Complex.re h + simp only [Complex.sub_re, Complex.add_re, Complex.natCast_re, Complex.ofReal_re, + Complex.zero_re] at hr + norm_num at hr + linarith [Nat.cast_nonneg (α := ℝ) n] + have hp (q : ℂ) (hq : (ell : ℝ) + 5 < q.re) : + (ascPochhammer ℂ K).eval q ≠ 0 ∧ + (ascPochhammer ℂ K).eval (q - (ell + 5)) ≠ 0 := by + constructor + · exact ascPochhammer_eval_ne_zero_of_re_pos q K (lt_trans hM hq) + · apply ascPochhammer_eval_ne_zero_of_re_pos + simpa using (sub_pos.mpr hq) + have hcone (q : ℂ) (hq : (ell : ℝ) + 5 < q.re) (s' : ℂ) + (hs' : s'.re = 0) (hi' : s'.im ≠ 0) : + matrixCone ((ell : ℝ) + 5) s' (normalizedForwardMatrix (ell + 5) s' q K) + (matchingHomotopyColumn (ell + 5) K s' ρ q) ≤ 0 := by + have he := matrixCone_normalizedForwardMatrix ((ell : ℝ) + 5) s' q K + (matchingHomotopyColumn (ell + 5) K s' ρ q) + push_cast at he + rw [he] + apply mul_nonpos_of_nonneg_of_nonpos (Complex.normSq_nonneg _) + have hc := forward_matchingHomotopyColumn_cone (q.re - (ell : ℝ) / 2) + ell K q s' ρ (by linarith [Nat.cast_nonneg (α := ℝ) ell]) hK (by ring) + hs' hi' hρ hρ1 + simpa only [matrixCone, Nat.cast_add, Nat.cast_ofNat, Complex.ofReal_add, + Complex.ofReal_natCast, Complex.ofReal_ofNat] using hc + apply matchingColumnDeterminant_ne_zero_of_forward_forms ((ell : ℝ) + 5) s (-s) + (normalizedForwardMatrix (ell + 5) s q₁ K) (normalizedForwardMatrix (ell + 5) (-s) q₂ K) + · exact matchingHomotopyColumn_ne_zero_of_factors _ _ _ _ _ (hp q₁ hq₁).1 + (by simpa only [Nat.cast_add, Nat.cast_ofNat] using (hp q₁ hq₁).2) + · exact matchingHomotopyColumn_ne_zero_of_factors _ _ _ _ _ (hp q₂ hq₂).1 + (by simpa only [Nat.cast_add, Nat.cast_ofNat] using (hp q₂ hq₂).2) + · exact hcone q₁ hq₁ s hs hs0 + · exact hcone q₂ hq₂ (-s) (by simpa using hs) (by simpa using hs0) + · intro w hw + have hc := normalizedForwardJet_sum_cone_pos ((ell : ℝ) + 5) s q₁ q₂ w K hM hs hsne + (by linarith) (by linarith) + (by simpa only [Complex.ofReal_add, Complex.ofReal_natCast, Complex.ofReal_ofNat] using hd q₁ hq₁) + (by simpa only [Complex.ofReal_add, Complex.ofReal_natCast, Complex.ofReal_ofNat] using hd q₂ hq₂) + (by omega) hw + simpa only [normalizedForwardJet_eq_mulVec, matrixCone, Nat.cast_add, Nat.cast_ofNat, + Complex.ofReal_add, Complex.ofReal_natCast, Complex.ofReal_ofNat] using hc + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RootDiskApplication.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RootDiskApplication.lean new file mode 100644 index 0000000000000000000000000000000000000000..995dc1d2b4c1f6d6377b4f9849a8f44c4836c46e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RootDiskApplication.lean @@ -0,0 +1,164 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.IntegerPolynomialDisk +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.CenteredPolynomial +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.PolynomialRootEnumeration + +namespace OAI + +/-! # Applying the rational certificates to the separator polynomials -/ + +open Polynomial + +namespace DefocusingNLS.SeparatorArithmetic + +noncomputable section + +theorem scaledSeparatorPolynomial_degree (ℓ : ℕ) : + (scaledSeparatorPolynomial ℓ).natDegree ≤ 15 := by + apply natDegree_sum_le_of_forall_le + intro n hn + exact (natDegree_monomial_le _).trans (by have := Finset.mem_range.mp hn; omega) + +theorem eval_degree_fifteen (p : Polynomial ℂ) (hdegree : p.natDegree ≤ 15) (z : ℂ) : + p.eval z = p.coeff 0 + p.coeff 1 * z + + ∑ i : Fin 14, p.coeff ((i : ℕ) + 2) * z ^ ((i : ℕ) + 2) := by + rw [p.eval_eq_sum_range' (lt_of_le_of_lt hdegree (by decide : 15 < 16))] + rw [show 16 = 2 + 14 by decide, Finset.sum_range_add] + have hfirst : ∑ n ∈ Finset.range 2, p.coeff n * z ^ n = + p.coeff 0 + p.coeff 1 * z := by simp [Finset.sum_range_succ] + rw [hfirst] + simp only [Fin.sum_univ_eq_sum_range + (fun i : ℕ => p.coeff (i + 2) * z ^ (i + 2)), Nat.add_comm 2] + +theorem diskErrorBound_eq_sum (ℓ : ℕ) (c : GaussianInt) : + diskErrorBound ℓ c = coefficientUpper (centeredCoefficient ℓ c 0) + + ∑ i : Fin 14, coefficientUpper (centeredCoefficient ℓ c ((i : ℕ) + 2)) * + (100 : ℤ) ^ ((i : ℕ) + 2) := by + unfold diskErrorBound + rw [← List.sum_toFinset _ List.nodup_range] + simp only [List.toFinset_range, diskRadius, + Fin.sum_univ_eq_sum_range (fun i : ℕ => + coefficientUpper (centeredCoefficient ℓ c (i + 2)) * (100 : ℤ) ^ (i + 2))] + +theorem complex_taylor_coeff (ℓ : ℕ) (c : GaussianInt) (i : ℕ) (hi : i ≤ 16) : + (taylor (c : ℂ) ((scaledSeparatorPolynomial ℓ).map GaussianInt.toComplex)).coeff i = + (centeredCoefficient ℓ c i : ℂ) := by + rw [← map_taylor, coeff_map, ← centeredCoefficient_eq ℓ c i hi] + +/-- Every certified disk contains an actual zero of the translated, scaled +separator polynomial. -/ +theorem root_in_certified_disk (ℓ : Fin 4) (j : Fin 15) : + ∃ z : ℂ, ‖z - (diskCenters ℓ j : ℂ)‖ ≤ 100 ∧ + ((scaledSeparatorPolynomial ℓ).map GaussianInt.toComplex).IsRoot z := by + let c := diskCenters ℓ j + obtain ⟨w, hw, hzero⟩ := root_of_integer_coefficient_bound + (centeredCoefficient ℓ c 0) (centeredCoefficient ℓ c 1) + (fun i => centeredCoefficient ℓ c ((i : ℕ) + 2)) 100 + (disk_linear_nonzero ℓ j) (by + have h := disk_bound ℓ j + change diskErrorBound ℓ c ≤ coefficientLower (centeredCoefficient ℓ c 1) * 100 at h + rwa [diskErrorBound_eq_sum] at h) + refine ⟨w + (c : ℂ), ?_, ?_⟩ + · change ‖w + (c : ℂ) - (c : ℂ)‖ ≤ 100 + simpa only [add_sub_cancel_right, Nat.cast_ofNat] using hw + let p := (scaledSeparatorPolynomial ℓ).map GaussianInt.toComplex + have hdegree : (taylor (c : ℂ) p).natDegree ≤ 15 := by + rw [natDegree_taylor] + exact (natDegree_map_le).trans (scaledSeparatorPolynomial_degree ℓ) + have hcoeff (i : ℕ) (hi : i ≤ 16) : + (taylor (c : ℂ) p).coeff i = (centeredCoefficient ℓ c i : ℂ) := by + exact complex_taylor_coeff ℓ c i hi + have heval := eval_degree_fifteen (taylor (c : ℂ) p) hdegree w + rw [hcoeff 0 (by decide), hcoeff 1 (by decide)] at heval + have hcoeff' (i : Fin 14) : + (taylor (c : ℂ) p).coeff ((i : ℕ) + 2) = + (centeredCoefficient ℓ c ((i : ℕ) + 2) : ℂ) := hcoeff _ (by omega) + simp_rw [hcoeff'] at heval + rw [hzero] at heval + change p.eval (w + (c : ℂ)) = 0 + rwa [taylor_eval] at heval + +theorem scaledSeparatorPolynomial_complex_ne_zero (ℓ : Fin 4) : + (scaledSeparatorPolynomial ℓ).map GaussianInt.toComplex ≠ 0 := by + intro hzero + have h := complex_taylor_coeff ℓ (diskCenters ℓ 0) 1 (by decide) + rw [hzero, map_zero, coeff_zero] at h + exact (disk_linear_nonzero ℓ 0) (GaussianInt.toComplex_eq_zero.mp h.symm) + +theorem complex_disk_centers_separated (ℓ : Fin 4) (i j : Fin 15) (hij : i ≠ j) : + 2 * (100 : ℝ) < ‖(diskCenters ℓ i : ℂ) - (diskCenters ℓ j : ℂ)‖ := by + obtain hre | him := disk_centers_separated ℓ i j hij + · have h : 2 * (100 : ℝ) < + |(diskCenters ℓ i : ℂ).re - (diskCenters ℓ j : ℂ).re| := by + simp only [← GaussianInt.intCast_re] + exact_mod_cast hre + exact h.trans_le (by simpa only [Complex.sub_re] using + Complex.abs_re_le_norm ((diskCenters ℓ i : ℂ) - (diskCenters ℓ j : ℂ))) + · have h : 2 * (100 : ℝ) < + |(diskCenters ℓ i : ℂ).im - (diskCenters ℓ j : ℂ).im| := by + simp only [← GaussianInt.intCast_im] + exact_mod_cast him + exact h.trans_le (by simpa only [Complex.sub_im] using + Complex.abs_im_le_norm ((diskCenters ℓ i : ℂ) - (diskCenters ℓ j : ℂ))) + +theorem zero_tail_no_axis_zero (ℓ : Fin 4) {x : ℂ} + (hx : ((scaledSeparatorPolynomial ℓ).map GaussianInt.toComplex).IsRoot x) : + x.re ≠ 0 := by + classical + obtain ⟨z, _, hz, hroots⟩ := roots_of_fifteen_disks + ((scaledSeparatorPolynomial ℓ).map GaussianInt.toComplex) + (scaledSeparatorPolynomial_complex_ne_zero ℓ) + (natDegree_map_le.trans (scaledSeparatorPolynomial_degree ℓ)) + (fun j => (diskCenters ℓ j : ℂ)) 100 + (complex_disk_centers_separated ℓ) (root_in_certified_disk ℓ) + apply no_axis_root_of_disks _ (scaledSeparatorPolynomial_complex_ne_zero ℓ) + (fun i => (diskCenters ℓ i : ℂ)) z 100 hroots _ (fun i => (hz i).1) hx + intro i + rw [← GaussianInt.intCast_re] + exact_mod_cast disk_centers_avoid_axis ℓ i + +/-- The zero-tail polynomial has exactly two, one, zero, zero roots in the +open right half-plane, for angular modes zero through three respectively. -/ +theorem zero_tail_positive_root_count (ℓ : Fin 4) : + (((scaledSeparatorPolynomial ℓ).map GaussianInt.toComplex).roots.toFinset.filter + (fun z => 0 < z.re)).card = positiveRootCount ℓ := by + classical + obtain ⟨z, hinj, hz, hroots⟩ := roots_of_fifteen_disks + ((scaledSeparatorPolynomial ℓ).map GaussianInt.toComplex) + (scaledSeparatorPolynomial_complex_ne_zero ℓ) + (natDegree_map_le.trans (scaledSeparatorPolynomial_degree ℓ)) + (fun j => (diskCenters ℓ j : ℂ)) 100 + (complex_disk_centers_separated ℓ) (root_in_certified_disk ℓ) + have haxis (j : Fin 15) : (100 : ℝ) < |(diskCenters ℓ j : ℂ).re| := by + rw [← GaussianInt.intCast_re] + exact_mod_cast disk_centers_avoid_axis ℓ j + rw [positive_real_root_count_of_disks _ _ z 100 hinj hroots haxis (fun i => (hz i).1)] + convert positive_disk_count ℓ using 1 + congr 1 + ext j + simp only [Finset.mem_filter, Finset.mem_univ, true_and, ← GaussianInt.intCast_re] + exact Int.cast_pos + +theorem zero_tail_closed_half_plane_count (ℓ : Fin 4) : + (((scaledSeparatorPolynomial ℓ).map GaussianInt.toComplex).roots.toFinset.filter + (fun z => 0 ≤ z.re)).card = positiveRootCount ℓ := by + classical + have heq : + (((scaledSeparatorPolynomial ℓ).map GaussianInt.toComplex).roots.toFinset.filter + (fun z => 0 ≤ z.re)) = + (((scaledSeparatorPolynomial ℓ).map GaussianInt.toComplex).roots.toFinset.filter + (fun z => 0 < z.re)) := by + ext x + simp only [Finset.mem_filter] + constructor + · rintro ⟨hx, hle⟩ + have hroot : ((scaledSeparatorPolynomial ℓ).map GaussianInt.toComplex).IsRoot x := + (mem_roots (scaledSeparatorPolynomial_complex_ne_zero ℓ)).mp + (Multiset.mem_toFinset.mp hx) + exact ⟨hx, lt_of_le_of_ne hle (zero_tail_no_axis_zero ℓ hroot).symm⟩ + · exact fun h => ⟨h.1, h.2.le⟩ + rw [heq, zero_tail_positive_root_count] + +end +end DefocusingNLS.SeparatorArithmetic + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RootDiskArithmetic.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RootDiskArithmetic.lean new file mode 100644 index 0000000000000000000000000000000000000000..f5a458c10ed197ceef8dda73037212f574c716cb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/RootDiskArithmetic.lean @@ -0,0 +1,95 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.SeparatorArithmetic + +namespace OAI + +/-! +# Rational disk data for the degree-fifteen separator polynomials + +Centers are Gaussian integers divided by one million; disk radius is +`100 / 1000000`. The coefficient bounds are exact integer inequalities. +-/ + +namespace DefocusingNLS.SeparatorArithmetic + +def diskScale : ℤ := 1000000 +def diskRadius : ℤ := 100 + +def diskCenters (ℓ : Fin 4) : Fin 15 → GaussianInt := + ![![⟨-8123630, -31766832⟩, ⟨-8123630, 31766832⟩, ⟨-2852297, -508076⟩, + ⟨-2852297, 508076⟩, ⟨-2433515, -6697195⟩, ⟨-2433515, 6697195⟩, + ⟨-1820287, -2411053⟩, ⟨-1820287, 2411053⟩, ⟨-1757121, -1089576⟩, + ⟨-1757121, 1089576⟩, ⟨-612406, -638366⟩, ⟨-612406, 638366⟩, + ⟨-395408, 0⟩, ⟨31393, 0⟩, ⟨1031280, 0⟩], + ![⟨-9281712, -32071684⟩, ⟨-9281712, 32071684⟩, ⟨-2664076, -7044582⟩, + ⟨-2664076, 7044582⟩, ⟨-2482266, 0⟩, ⟨-2468408, 0⟩, + ⟨-1944315, -2670218⟩, ⟨-1944315, 2670218⟩, ⟨-1773434, -956885⟩, + ⟨-1773434, 956885⟩, ⟨-1102082, -305188⟩, ⟨-1102082, 305188⟩, + ⟨-464821, 0⟩, ⟨-115059, 0⟩, ⟨530543, 0⟩], + ![⟨-10389538, -32400115⟩, ⟨-10389538, 32400115⟩, ⟨-2898298, -7383939⟩, + ⟨-2898298, 7383939⟩, ⟨-2180223, -559919⟩, ⟨-2180223, 559919⟩, + ⟨-2114597, -2913593⟩, ⟨-2114597, 2913593⟩, ⟨-1873174, 0⟩, + ⟨-1636518, -1162120⟩, ⟨-1636518, 1162120⟩, ⟨-1015304, -461931⟩, + ⟨-1015304, 461931⟩, ⟨-94561, -919837⟩, ⟨-94561, 919837⟩], + ![⟨-11448031, -32743955⟩, ⟨-11448031, 32743955⟩, ⟨-3144105, -7703209⟩, + ⟨-3144105, 7703209⟩, ⟨-2548633, 0⟩, ⟨-2332359, -3241382⟩, + ⟨-2332359, 3241382⟩, ⟨-2107135, -1004078⟩, ⟨-2107135, 1004078⟩, + ⟨-1171235, -202886⟩, ⟨-1171235, 202886⟩, ⟨-979187, -1251033⟩, + ⟨-979187, 1251033⟩, ⟨-809256, -2065587⟩, ⟨-809256, 2065587⟩]] ℓ + +/-- Coefficients of `D^15 P((c + X)/D)`; all denominators are cleared. -/ +def centeredCoefficient (ℓ : ℕ) (c : GaussianInt) (i : ℕ) : GaussianInt := + ((List.range (16 - i)).map fun j => + ((windingCoefficient ℓ (j + i) * (Nat.choose (j + i) i : ℤ) * + diskScale ^ (15 - (j + i)) : ℤ) : GaussianInt) * c ^ j).sum + +def coefficientUpper (z : GaussianInt) : ℤ := |z.re| + |z.im| +def coefficientLower (z : GaussianInt) : ℤ := max |z.re| |z.im| + +def diskErrorBound (ℓ : ℕ) (c : GaussianInt) : ℤ := + coefficientUpper (centeredCoefficient ℓ c 0) + + ((List.range 14).map fun j => + coefficientUpper (centeredCoefficient ℓ c (j + 2)) * diskRadius ^ (j + 2)).sum + +def diskBound (ℓ : Fin 4) (j : Fin 15) : Prop := + diskErrorBound ℓ (diskCenters ℓ j) ≤ + coefficientLower (centeredCoefficient ℓ (diskCenters ℓ j) 1) * diskRadius + +instance (ℓ : Fin 4) (j : Fin 15) : Decidable (diskBound ℓ j) := by + unfold diskBound + infer_instance + +theorem disk_bounds_zero : ∀ j, diskBound 0 j := by decide +kernel +theorem disk_bounds_one : ∀ j, diskBound 1 j := by decide +kernel +theorem disk_bounds_two : ∀ j, diskBound 2 j := by decide +kernel +theorem disk_bounds_three : ∀ j, diskBound 3 j := by decide +kernel + +theorem disk_bound (ℓ : Fin 4) (j : Fin 15) : diskBound ℓ j := by + fin_cases ℓ + · exact disk_bounds_zero j + · exact disk_bounds_one j + · exact disk_bounds_two j + · exact disk_bounds_three j + +theorem disk_linear_nonzero (ℓ : Fin 4) : ∀ j : Fin 15, + centeredCoefficient ℓ (diskCenters ℓ j) 1 ≠ 0 := by + fin_cases ℓ <;> decide +kernel + +theorem disk_centers_separated (ℓ : Fin 4) : ∀ i j : Fin 15, i ≠ j → + 2 * diskRadius < |(diskCenters ℓ i).re - (diskCenters ℓ j).re| ∨ + 2 * diskRadius < |(diskCenters ℓ i).im - (diskCenters ℓ j).im| := by + fin_cases ℓ <;> decide +kernel + +theorem disk_centers_avoid_axis (ℓ : Fin 4) : ∀ j : Fin 15, + diskRadius < |(diskCenters ℓ j).re| := by + fin_cases ℓ <;> decide +kernel + +def positiveRootCount : Fin 4 → ℕ := ![2, 1, 0, 0] + +theorem positive_disk_count (ℓ : Fin 4) : + (Finset.univ.filter fun j : Fin 15 => 0 < (diskCenters ℓ j).re).card = + positiveRootCount ℓ := by + fin_cases ℓ <;> decide +kernel + +end DefocusingNLS.SeparatorArithmetic + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ScaledLatticeKernel.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ScaledLatticeKernel.lean new file mode 100644 index 0000000000000000000000000000000000000000..d184c6b4d0120b9f1793d230d498c96a085e2af3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ScaledLatticeKernel.lean @@ -0,0 +1,158 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingWeightProduct + +namespace OAI + +/-! # A lattice sampling bound uniform as the mesh tends to zero + +The exact Cauchy-kernel integral and the integral test give a one-dimensional +bound. A twelve-coordinate product then controls the radial kernel. +-/ + +open Set MeasureTheory + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +noncomputable def scaledCauchyKernel (L x : ℝ) : ℝ := (1 + (x / L) ^ 2)⁻¹ + +theorem scaledCauchyKernel_nonneg (L x : ℝ) : 0 ≤ scaledCauchyKernel L x := by + unfold scaledCauchyKernel + positivity + +theorem scaledCauchyKernel_even (L x : ℝ) : scaledCauchyKernel L (-x) = scaledCauchyKernel L x := by + simp only [scaledCauchyKernel, neg_div, even_two.neg_pow] + +theorem scaledCauchyKernel_antitone (L : ℝ) (hL : 0 < L) : + AntitoneOn (scaledCauchyKernel L) (Ici 0) := by + intro x hx y hy hxy + unfold scaledCauchyKernel + apply (inv_le_inv₀ (by positivity) (by positivity)).mpr + change 0 ≤ x at hx + change 0 ≤ y at hy + gcongr + +theorem scaledCauchyKernel_integrable (L : ℝ) (hL : 0 < L) : + Integrable (scaledCauchyKernel L) := by + change Integrable (fun x => (1 + (x / L) ^ 2)⁻¹) + simpa only [div_eq_inv_mul] using + integrable_inv_one_add_mul_sq (inv_ne_zero hL.ne') + +theorem integral_scaledCauchyKernel (L : ℝ) (hL : 0 < L) : + (∫ x, scaledCauchyKernel L x) = Real.pi * L := by + simp only [scaledCauchyKernel, div_eq_inv_mul] + rw [integral_univ_inv_one_add_mul_sq, abs_inv, abs_of_pos hL, div_inv_eq_mul] + +theorem scaledCauchyKernel_integer_sum (L : ℝ) (hL : 1 ≤ L) : + Summable (fun n : ℤ => scaledCauchyKernel L n) ∧ + (∑' n : ℤ, scaledCauchyKernel L n) ≤ (1 + 2 * Real.pi) * L := by + have hLp : 0 < L := by linarith + have ha := scaledCauchyKernel_antitone L hLp + have hi := (scaledCauchyKernel_integrable L hLp).integrableOn (s := Ioi 0) + have hp : ∀ x ∈ Ioi (0 : ℝ), 0 ≤ scaledCauchyKernel L x := + fun x _ => scaledCauchyKernel_nonneg L x + have hb : (∫ x in Ioi 0, scaledCauchyKernel L x) ≤ Real.pi * L := by + rw [← integral_scaledCauchyKernel L hLp] + exact setIntegral_le_integral (scaledCauchyKernel_integrable L hLp) + (Filter.Eventually.of_forall (scaledCauchyKernel_nonneg L)) + have hs := ha.summable_of_integrableOn_Ioi_zero hi hp + have hs1 : Summable (fun n : ℕ => scaledCauchyKernel L (n + 1)) := by + simpa only [Nat.cast_add, Nat.cast_one] using (summable_nat_add_iff 1).mpr hs + have hnat : Summable (fun n : ℕ => scaledCauchyKernel L ((n : ℤ) : ℝ)) := by + simpa only [Int.cast_natCast] using hs + have hneg : Summable (fun n : ℕ => scaledCauchyKernel L (((-((n : ℤ) + 1)) : ℤ) : ℝ)) := by + simpa only [Int.cast_neg, Int.cast_add, Int.cast_natCast, Int.cast_one, + scaledCauchyKernel_even] using hs1 + refine ⟨Summable.of_nat_of_neg_add_one hnat hneg, ?_⟩ + rw [tsum_of_nat_of_neg_add_one + (f := fun n : ℤ => scaledCauchyKernel L n) hnat hneg] + simp only [Int.cast_neg, Int.cast_add, Int.cast_natCast, Int.cast_one, scaledCauchyKernel_even] + have h0 := (ha.tsum_le_integral hi hp).trans (add_le_add le_rfl hb) + have h1 := (ha.tsum_add_one_le_integral hi hp).trans hb + simp only [scaledCauchyKernel, zero_div, zero_pow (by decide : 2 ≠ 0), add_zero, inv_one] at h0 + change (∑' n : ℕ, scaledCauchyKernel L n) ≤ 1 + Real.pi * L at h0 + simp only [Nat.cast_add, Nat.cast_one] at h1 + nlinarith [Real.pi_pos] + +private theorem scaled_frequencyCoordinates_injective : Function.Injective frequencyCoordinates := by + intro n m h + apply Subtype.ext + ext j + have hc := congrFun h j + exact_mod_cast (frequencyCoordinates_coe n j).symm.trans + ((congrArg (fun z : ℤ => (z : ℝ)) hc).trans (frequencyCoordinates_coe m j)) + +theorem sum_scaledCauchyKernel_product (L : ℝ) (hL : 1 ≤ L) (S : Finset frequencyLattice) : + (∑ n ∈ S, ∏ j : Fin 12, scaledCauchyKernel L (frequencyCoordinates n j)) ≤ + ((1 + 2 * Real.pi) * L) ^ 12 := by + classical + let K : ℤ → ℝ := fun z => scaledCauchyKernel L z + let U : Finset ℤ := S.biUnion (fun n => Finset.univ.image (frequencyCoordinates n)) + let T : Finset (Fin 12 → ℤ) := S.image frequencyCoordinates + have hTU : T ⊆ Fintype.piFinset (fun _ : Fin 12 => U) := by + intro p hp + obtain ⟨n, hn, rfl⟩ := Finset.mem_image.mp hp + simp only [Fintype.mem_piFinset] + intro j + exact Finset.mem_biUnion.mpr ⟨n, hn, Finset.mem_image.mpr ⟨j, Finset.mem_univ _, rfl⟩⟩ + obtain ⟨hKs, hKb⟩ := scaledCauchyKernel_integer_sum L hL + have hU : (∑ z ∈ U, K z) ≤ (1 + 2 * Real.pi) * L := + (hKs.sum_le_tsum U (fun z _ => scaledCauchyKernel_nonneg L z)).trans hKb + have hUnonneg : 0 ≤ ∑ z ∈ U, K z := + Finset.sum_nonneg (fun z _ => scaledCauchyKernel_nonneg L z) + calc + _ = ∑ p ∈ T, ∏ j : Fin 12, K (p j) := by + rw [Finset.sum_image] + exact fun _ _ _ _ h => scaled_frequencyCoordinates_injective h + _ ≤ ∑ p ∈ Fintype.piFinset (fun _ : Fin 12 => U), ∏ j : Fin 12, K (p j) := + Finset.sum_le_sum_of_subset_of_nonneg hTU (fun _ _ _ => by + apply Finset.prod_nonneg + intro j _ + exact scaledCauchyKernel_nonneg L _) + _ = (∑ z ∈ U, K z) ^ 12 := by rw [Finset.sum_prod_piFinset]; simp + _ ≤ _ := by gcongr + +theorem scaledRadialKernel_le_product (L : ℝ) (hL : 1 ≤ L) (n : frequencyLattice) : + ((1 + ‖(L⁻¹ : ℝ) • (n : E)‖ ^ 2) ^ (12 : ℕ))⁻¹ ≤ + ∏ j : Fin 12, scaledCauchyKernel L (frequencyCoordinates n j) := by + have hLp : 0 < L := by linarith + have hn : ‖(L⁻¹ : ℝ) • (n : E)‖ = ‖n‖ / L := by + rw [norm_smul, Real.norm_eq_abs, abs_inv, abs_of_pos hLp, div_eq_inv_mul, + Submodule.norm_coe] + have heach (j : Fin 12) : 1 + ((frequencyCoordinates n j : ℝ) / L) ^ 2 ≤ + 1 + ‖(L⁻¹ : ℝ) • (n : E)‖ ^ 2 := by + rw [hn, div_pow, div_pow] + exact add_le_add le_rfl (div_le_div_of_nonneg_right (frequencyCoordinates_sq_le n j) + (sq_nonneg L)) + have hprod : (∏ j : Fin 12, (1 + ((frequencyCoordinates n j : ℝ) / L) ^ 2)) ≤ + (1 + ‖(L⁻¹ : ℝ) • (n : E)‖ ^ 2) ^ (12 : ℕ) := by + calc + _ ≤ ∏ _ : Fin 12, (1 + ‖(L⁻¹ : ℝ) • (n : E)‖ ^ 2) := by + apply Finset.prod_le_prod₀ + · intro j _ + positivity + · intro j _ + exact heach j + _ = _ := by simp + have hpos : 0 < ∏ j : Fin 12, (1 + ((frequencyCoordinates n j : ℝ) / L) ^ 2) := + Finset.prod_pos (fun j _ => by positivity) + simpa only [scaledCauchyKernel, Finset.prod_inv_distrib] using + (inv_le_inv₀ (by positivity) hpos).mpr hprod + +theorem scaledRadialKernel_sum (L : ℝ) (hL : 1 ≤ L) : + Summable (fun n : frequencyLattice => ((1 + ‖(L⁻¹ : ℝ) • (n : E)‖ ^ 2) ^ (12 : ℕ))⁻¹) ∧ + (∑' n : frequencyLattice, ((1 + ‖(L⁻¹ : ℝ) • (n : E)‖ ^ 2) ^ (12 : ℕ))⁻¹) ≤ + ((1 + 2 * Real.pi) * L) ^ 12 := by + have hnon (n : frequencyLattice) : + 0 ≤ ((1 + ‖(L⁻¹ : ℝ) • (n : E)‖ ^ 2) ^ (12 : ℕ))⁻¹ := by positivity + have hb (S : Finset frequencyLattice) : + (∑ n ∈ S, ((1 + ‖(L⁻¹ : ℝ) • (n : E)‖ ^ 2) ^ (12 : ℕ))⁻¹) ≤ + ((1 + 2 * Real.pi) * L) ^ 12 := + (Finset.sum_le_sum (fun n _ => scaledRadialKernel_le_product L hL n)).trans + (sum_scaledCauchyKernel_product L hL S) + have hs := summable_of_sum_le hnon hb + exact ⟨hs, hs.tsum_le_of_sum_le hb⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/SegmentInversePrimitive.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/SegmentInversePrimitive.lean new file mode 100644 index 0000000000000000000000000000000000000000..87b75a990d9ca6fa7aca03f0e0dde87a3a6b2fc7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/SegmentInversePrimitive.lean @@ -0,0 +1,30 @@ +import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus +import Mathlib.Analysis.Calculus.Deriv.Inv +import Mathlib.Analysis.Complex.RealDeriv + +namespace OAI + +/-! # The squared Cauchy kernel has zero integral around a polygon -/ + +open Set MeasureTheory +namespace DefocusingNLS + +theorem integral_segment_inv_sq (u v a : ℂ) (l r : ℝ) + (hn : ∀ t ∈ uIcc l r, u + (t : ℂ) * v - a ≠ 0) : + (∫ t : ℝ in l..r, v / (u + (t : ℂ) * v - a) ^ 2) = + (u + (l : ℂ) * v - a)⁻¹ - (u + (r : ℂ) * v - a)⁻¹ := by + have hd (t : ℝ) (ht : t ∈ uIcc l r) : + HasDerivAt (fun s : ℝ => -(u + (s : ℂ) * v - a)⁻¹) + (v / (u + (t : ℂ) * v - a) ^ 2) t := by + have h := (((((hasDerivAt_id t).ofReal_comp.mul_const v).const_add u).sub_const a).inv + (hn t ht)).neg + simpa only [neg_div, neg_neg, id_eq, Complex.ofReal_one, one_mul] using! h + have hi : IntervalIntegrable (fun t : ℝ => v / (u + (t : ℂ) * v - a) ^ 2) volume l r := by + apply ContinuousOn.intervalIntegrable + exact continuousOn_const.div (by fun_prop) (fun t ht => pow_ne_zero 2 (hn t ht)) + have h := intervalIntegral.integral_eq_sub_of_hasDerivAt hd hi + simpa only [neg_sub_neg] using h + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/SeparatorArithmetic.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/SeparatorArithmetic.lean new file mode 100644 index 0000000000000000000000000000000000000000..d0b2dcbc19247439989f8bf8a112b90813d93db6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/SeparatorArithmetic.lean @@ -0,0 +1,131 @@ +import Mathlib.NumberTheory.Zsqrtd.GaussianInt +import Mathlib.Tactic + +namespace OAI + +/-! +# Integer arithmetic for the low-angular separators + +The polynomial recurrence and integer sign inequalities in Appendix +`cert:winding` use Gaussian integer coefficients in ascending order. +-/ + +namespace DefocusingNLS +namespace SeparatorArithmetic + +def scale : ℤ := 100000000 +def centerB : ℤ := 33477607 +def centerZ : ℤ := 270506819 + +def addCoefficients : List GaussianInt → List GaussianInt → List GaussianInt + | [], ys => ys + | xs, [] => xs + | x :: xs, y :: ys => (x + y) :: addCoefficients xs ys + +def scaleCoefficients (a : GaussianInt) (xs : List GaussianInt) : List GaussianInt := + xs.map (a * ·) + +/-- Multiplication by the linear polynomial `a + scale * X`. -/ +def mulLinear (a : GaussianInt) (xs : List GaussianInt) : List GaussianInt := + addCoefficients (scaleCoefficients a xs) + (0 :: scaleCoefficients (scale : GaussianInt) xs) + +/-- The exact backward recurrence, from `n = 7` down to `n = 0`. -/ +def backwardStep (ℓ n : ℕ) (xy : List GaussianInt × List GaussianInt) : + List GaussianInt × List GaussianInt := + let t : GaussianInt := ⟨scale * n + 50000000 * ℓ - 3125000, -centerB⟩ + let d : GaussianInt := t - ⟨scale * (ℓ + 5), centerZ⟩ + (addCoefficients (mulLinear d xy.1) (scaleCoefficients ⟨0, -centerZ⟩ xy.2), + mulLinear t (addCoefficients xy.1 xy.2)) + +def backwardCoefficients (ℓ : ℕ) : List GaussianInt × List GaussianInt := + [7, 6, 5, 4, 3, 2, 1, 0].foldl (fun xy n => backwardStep ℓ n xy) ([], [1]) + +/-- The coefficient `Im ∑ xₖ conj(yⱼ₋ₖ)` of the degree-fifteen polynomial. -/ +def windingCoefficient (ℓ j : ℕ) : ℤ := + let xy := backwardCoefficients ℓ + ((List.range (j + 1)).map fun k => + (xy.1[k]?.getD 0 * star (xy.2[j - k]?.getD 0)).im).sum + +/-- Terms in the denominator-cleared evaluation of an axis polynomial at +`w = ε (q/100)²`. The coordinate is `0` for real and `1` for imaginary. -/ +def evaluationTerms (ℓ c : ℕ) (ε q : ℤ) : List ℤ := + (List.range 8).map fun j => + windingCoefficient ℓ (2 * j + c) * 100 ^ (14 - 2 * j) * (-ε * q ^ 2) ^ j + +def separatorMargin (ℓ c : ℕ) (ε q e : ℤ) : ℤ := + let terms := evaluationTerms ℓ c ε q + (10000 * e * terms.sum) / (terms.map (fun z => |z|)).sum + +/-- A positive relative integer margin proves the requested strict sign. -/ +theorem sign_of_positive_margin (ℓ c : ℕ) (ε q e : ℤ) + (h : 0 < separatorMargin ℓ c ε q e) : + 0 < e * (evaluationTerms ℓ c ε q).sum := by + let terms := evaluationTerms ℓ c ε q + have hd : 0 ≤ (terms.map (fun z => |z|)).sum := + List.sum_nonneg (fun z hz => by + obtain ⟨y, _, rfl⟩ := List.mem_map.mp hz + exact abs_nonneg y) + by_cases hz : (terms.map (fun z => |z|)).sum = 0 + · simp [separatorMargin, terms, hz] at h + · have hdpos : 0 < (terms.map (fun z => |z|)).sum := lt_of_le_of_ne hd (Ne.symm hz) + by_contra hn + have hnum : 10000 * e * terms.sum ≤ 0 := by + dsimp [terms] + nlinarith + have hdiv := Int.ediv_nonpos_of_nonpos_of_neg hnum hdpos + exact (not_lt_of_ge hdiv) h + +def positiveArguments : ℕ → List ℤ + | 0 => [0, 45, 90, 145, 220, 315, 450, 635, 920, 1780, 3100, 7500] + | 1 => [0, 30, 68, 116, 173, 250, 350, 485, 680, 1005, 1880, 3210, 7500] + | 2 => [0, 51, 78, 94, 121, 165, 218, 278, 369, 490, 720, 1080, 1930, 3340, 7500] + | _ => [0, 57, 95, 122, 157, 205, 265, 333, 431, 559, 784, 1148, 2020, 3521, 7500] + +def signCycle (j : ℕ) : ℤ × ℤ := + match j % 4 with + | 0 => (1, 1) + | 1 => (-1, 1) + | 2 => (-1, -1) + | _ => (1, -1) + +def signOffset : ℕ → ℕ + | 0 => 1 + | 1 => 0 + | _ => 2 + +/-- All margins in one row of the appendix, including the negative-argument +tests when they are required. -/ +def rowMargins (ℓ : ℕ) : List ℤ := + let positive := (positiveArguments ℓ).zipIdx.flatMap fun (q, j) => + let signs := signCycle (j + signOffset ℓ) + [separatorMargin ℓ 0 1 q signs.1, separatorMargin ℓ 1 1 q signs.2] + let negative := if ℓ < 2 then + [separatorMargin ℓ 0 (-1) 50 1, separatorMargin ℓ 1 (-1) 50 1, + separatorMargin ℓ 0 (-1) 200 (-1), separatorMargin ℓ 1 (-1) 200 (-1)] else [] + positive ++ negative + +/-- The four exact minimum margins reported in `cert:separator-margins`. -/ +theorem row_zero_margin : (rowMargins 0).min? = some 583 := by decide +kernel + +theorem row_one_margin : (rowMargins 1).min? = some 432 := by decide +kernel + +theorem row_two_margin : (rowMargins 2).min? = some 80 := by decide +kernel + +theorem row_three_margin : (rowMargins 3).min? = some 68 := by decide +kernel + +theorem row_margin_pos (ℓ : Fin 4) (m : ℤ) (hm : m ∈ rowMargins ℓ) : 0 < m := by + fin_cases ℓ + · have h := (List.min?_eq_some_iff.mp row_zero_margin).2 m hm + omega + · have h := (List.min?_eq_some_iff.mp row_one_margin).2 m hm + omega + · have h := (List.min?_eq_some_iff.mp row_two_margin).2 m hm + omega + · have h := (List.min?_eq_some_iff.mp row_three_margin).2 m hm + omega + +end SeparatorArithmetic +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/SeparatorPolynomials.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/SeparatorPolynomials.lean new file mode 100644 index 0000000000000000000000000000000000000000..59673a9da80b50d1c401cca5a8675a1f48260fa1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/SeparatorPolynomials.lean @@ -0,0 +1,110 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.SeparatorArithmetic +import Mathlib.Algebra.Polynomial.Eval.Defs +import Mathlib.Algebra.Polynomial.Coeff + +namespace OAI + +/-! +# Polynomial meaning of the integer separator calculation + +Interpreting the coefficient lists as polynomials identifies their recurrence +with the backward matrix product and its coefficientwise imaginary part. +-/ + +open Polynomial + +namespace DefocusingNLS.SeparatorArithmetic + +/-- Ascending coefficient lists interpreted as polynomials. -/ +noncomputable def toPolynomial : List GaussianInt → Polynomial GaussianInt + | [] => 0 + | a :: as => C a + X * toPolynomial as + +theorem toPolynomial_add (xs ys : List GaussianInt) : + toPolynomial (addCoefficients xs ys) = toPolynomial xs + toPolynomial ys := by + induction xs generalizing ys with + | nil => simp [addCoefficients, toPolynomial] + | cons x xs ih => + cases ys with + | nil => simp [addCoefficients, toPolynomial] + | cons y ys => + simp only [addCoefficients, toPolynomial, ih, map_add] + ring + +theorem toPolynomial_scale (a : GaussianInt) (xs : List GaussianInt) : + toPolynomial (scaleCoefficients a xs) = C a * toPolynomial xs := by + induction xs with + | nil => simp [scaleCoefficients, toPolynomial] + | cons x xs ih => + simp only [scaleCoefficients, List.map_cons, toPolynomial] at * + rw [ih, map_mul] + ring + +theorem toPolynomial_mulLinear (a : GaussianInt) (xs : List GaussianInt) : + toPolynomial (mulLinear a xs) = + (C a + C (scale : GaussianInt) * X) * toPolynomial xs := by + rw [mulLinear, toPolynomial_add, toPolynomial] + simp only [map_zero, zero_add, toPolynomial_scale] + ring + +theorem coeff_toPolynomial (xs : List GaussianInt) (j : ℕ) : + (toPolynomial xs).coeff j = xs[j]?.getD 0 := by + induction xs generalizing j with + | nil => simp [toPolynomial] + | cons x xs ih => + cases j with + | zero => simp [toPolynomial] + | succ j => simp [toPolynomial, ih, coeff_X_mul] + +/-- The list update for the first matching coordinate is the polynomial +matrix update specified in the appendix. -/ +theorem toPolynomial_backwardStep_fst (ℓ n : ℕ) + (xy : List GaussianInt × List GaussianInt) : + toPolynomial (backwardStep ℓ n xy).1 = + (C (⟨scale * n + 50000000 * ℓ - 3125000, -centerB⟩ : GaussianInt) + + C (scale : GaussianInt) * X - C (⟨scale * (ℓ + 5), centerZ⟩ : GaussianInt)) * + toPolynomial xy.1 - C (⟨0, centerZ⟩ : GaussianInt) * toPolynomial xy.2 := by + simp only [backwardStep, toPolynomial_add, toPolynomial_mulLinear, + toPolynomial_scale, map_sub] + have h : (⟨0, -centerZ⟩ : GaussianInt) = -⟨0, centerZ⟩ := by ext <;> simp + rw [h, map_neg] + ring + +theorem toPolynomial_backwardStep_snd (ℓ n : ℕ) + (xy : List GaussianInt × List GaussianInt) : + toPolynomial (backwardStep ℓ n xy).2 = + (C (⟨scale * n + 50000000 * ℓ - 3125000, -centerB⟩ : GaussianInt) + + C (scale : GaussianInt) * X) * (toPolynomial xy.1 + toPolynomial xy.2) := by + simp only [backwardStep, toPolynomial_mulLinear, toPolynomial_add] + +/-- Imaginary part as an additive homomorphism, for coefficient sums. -/ +def imaginaryPart : GaussianInt →+ ℤ where + toFun := Zsqrtd.im + map_zero' := rfl + map_add' _ _ := rfl + +theorem imaginaryPart_apply (z : GaussianInt) : imaginaryPart z = z.im := rfl + +theorem coefficients_product_im (xs ys : List GaussianInt) (j : ℕ) : + ((List.range (j + 1)).map fun k => + (xs[k]?.getD 0 * star (ys[j - k]?.getD 0)).im).sum = + ((toPolynomial xs * (toPolynomial ys).map (starRingEnd GaussianInt)).coeff j).im := by + rw [← List.sum_toFinset _ List.nodup_range] + simp only [List.toFinset_range, coeff_mul, + Finset.Nat.sum_antidiagonal_eq_sum_range_succ_mk, + coeff_toPolynomial, coeff_map, starRingEnd_apply] + simpa only [Nat.succ_eq_add_one, imaginaryPart_apply] using + (map_sum imaginaryPart (fun k => xs[k]?.getD 0 * star (ys[j - k]?.getD 0)) + (Finset.range (j + 1))).symm + +/-- The exact integer `pⱼ` is the imaginary part of the product coefficient +`[X^j] x(X) conj(y)(X)`; no numeric translation is assumed. -/ +theorem windingCoefficient_eq (ℓ j : ℕ) : + windingCoefficient ℓ j = + ((toPolynomial (backwardCoefficients ℓ).1 * + (toPolynomial (backwardCoefficients ℓ).2).map (starRingEnd GaussianInt)).coeff j).im := by + exact coefficients_product_im _ _ _ + +end DefocusingNLS.SeparatorArithmetic + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/SeparatorScaling.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/SeparatorScaling.lean new file mode 100644 index 0000000000000000000000000000000000000000..e12375a30aa569e7c62e2f4c5a2bee939286ae81 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/SeparatorScaling.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.RootDiskApplication + +namespace OAI + +/-! # Scaling between the integer certificate and the zero-tail polynomial -/ + +open Polynomial + +namespace DefocusingNLS.SeparatorArithmetic + +noncomputable section + +theorem scaled_monomial (a D : ℂ) (hD : D ≠ 0) (n : ℕ) (hn : n ≤ 15) : + monomial n (a * D ^ (15 - n)) = + C (D ^ 15) * (monomial n a).comp (C D⁻¹ * X) := by + rw [← C_mul_X_pow_eq_monomial, monomial_comp, mul_pow, ← C_pow, + pow_sub₀ D hD hn, ← inv_pow] + simp only [map_mul] + ring + +theorem scaledSeparatorPolynomial_identity (ℓ : ℕ) : + (scaledSeparatorPolynomial ℓ).map GaussianInt.toComplex = + C ((diskScale : ℂ) ^ 15) * + ((windingPolynomial ℓ).map (Int.castRingHom ℂ)).comp + (C (diskScale : ℂ)⁻¹ * X) := by + classical + simp only [scaledSeparatorPolynomial, windingPolynomial, Polynomial.map_sum, map_monomial, + Int.cast_mul, Int.cast_pow, sum_comp, Finset.mul_sum] + apply Finset.sum_congr rfl + intro n hn + simpa using scaled_monomial (windingCoefficient ℓ n : ℂ) (diskScale : ℂ) + (by norm_num [diskScale]) n (by + have := Finset.mem_range.mp hn + omega) + +theorem scaledSeparatorPolynomial_roots (ℓ : ℕ) : + ((scaledSeparatorPolynomial ℓ).map GaussianInt.toComplex).roots = + (((windingPolynomial ℓ).map (Int.castRingHom ℂ)).roots.map + (fun z => (diskScale : ℂ) * z)) := by + rw [scaledSeparatorPolynomial_identity, roots_C_mul _ (by norm_num [diskScale])] + have h := roots_comp_C_mul_X_add_C + ((windingPolynomial ℓ).map (Int.castRingHom ℂ)) (diskScale : ℂ)⁻¹ 0 + (isUnit_iff_ne_zero.mpr (by norm_num [diskScale])) + simpa only [map_zero, add_zero, sub_zero, Ring.inverse_eq_inv, inv_inv] using h + +theorem closed_half_plane_count_image_pos (S : Finset ℂ) (d : ℝ) (hd : 0 < d) : + ((S.image (fun z => (d : ℂ) * z)).filter (fun z => 0 ≤ z.re)).card = + (S.filter (fun z => 0 ≤ z.re)).card := by + classical + rw [Finset.filter_image] + have hinj : Function.Injective (fun z : ℂ => (d : ℂ) * z) := by + intro z w h + exact mul_left_cancel₀ (Complex.ofReal_ne_zero.mpr hd.ne') h + rw [Finset.card_image_of_injective _ hinj] + congr 1 + ext z + simp only [Finset.mem_filter, Complex.mul_re, Complex.ofReal_re, + Complex.ofReal_im, zero_mul, sub_zero, mul_nonneg_iff_of_pos_left hd] + +/-- Exact half-plane count for the unscaled polynomial appearing in the +manuscript's zero-tail winding argument. -/ +theorem windingPolynomial_closed_half_plane_count (ℓ : Fin 4) : + ((((windingPolynomial ℓ).map (Int.castRingHom ℂ)).roots.toFinset).filter + (fun z => 0 ≤ z.re)).card = positiveRootCount ℓ := by + have h := zero_tail_closed_half_plane_count ℓ + rw [scaledSeparatorPolynomial_roots, Multiset.toFinset_map] at h + rw [show (diskScale : ℂ) = ((diskScale : ℝ) : ℂ) by norm_cast] at h + rw [closed_half_plane_count_image_pos _ (diskScale : ℝ) + (by norm_num [diskScale])] at h + exact h + +end +end DefocusingNLS.SeparatorArithmetic + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ShiftedSlowGrowth.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ShiftedSlowGrowth.lean new file mode 100644 index 0000000000000000000000000000000000000000..402a1ef72c906ca0effa9daf4992fddf396c01f7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ShiftedSlowGrowth.lean @@ -0,0 +1,111 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ShiftedSlowSolution +import OAI.MathematicalPhysics.DefocusingNLS.Profile.SlowGrowth +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.LaguerreProjection +import Mathlib.Analysis.Complex.Asymptotics + +namespace OAI + +/-! # Weighted integrability of the shifted slow solution + +Every spatial derivative has polynomial growth along the translated positive +ray. Exponential weighting therefore makes its product with any polynomial +integrable, as required in the Laguerre projection. +-/ + +open Filter Topology Asymptotics MeasureTheory Set Polynomial + +namespace DefocusingNLS + +noncomputable def shiftedSlowDerivative (n : ℕ) (q : ℂ) (m : ℕ) (s : ℂ) (t : ℝ) : ℂ := + iteratedDeriv n (regularizedSlowSolution q m) ((t : ℂ) - s) + +@[simp] theorem shiftedSlowDerivative_zero (q : ℂ) (m : ℕ) (s : ℂ) : + shiftedSlowDerivative 0 q m s = shiftedSlowSolution q m s := rfl + +theorem hasDerivAt_shiftedSlowDerivative (n : ℕ) (q : ℂ) (m : ℕ) (s : ℂ) + (hq : -1 < q.re) (hs : s.im ≠ 0) (t : ℝ) : + HasDerivAt (shiftedSlowDerivative n q m s) + (shiftedSlowDerivative (n + 1) q m s t) t := by + have ha := (analyticOnNhd_regularizedSlowSolution_slit q m hq).iterated_deriv n + rw [← iteratedDeriv_eq_iterate] at ha + have hh := (ha _ (shifted_argument_mem_slitPlane s hs t)).differentiableAt.hasDerivAt + rw [← iteratedDeriv_succ] at hh + have h := (hh.comp (t : ℂ) ((hasDerivAt_id (t : ℂ)).sub_const s)).comp_ofReal + convert! h using 1 + simp only [shiftedSlowDerivative, mul_one] + +theorem continuous_shiftedSlowDerivative (n : ℕ) (q : ℂ) (m : ℕ) (s : ℂ) + (hq : -1 < q.re) (hs : s.im ≠ 0) : Continuous (shiftedSlowDerivative n q m s) := + continuous_iff_continuousAt.mpr fun t => + (hasDerivAt_shiftedSlowDerivative n q m s hq hs t).continuousAt + +theorem shiftedSlowDerivative_isBigO_rpow (n : ℕ) (q : ℂ) (m : ℕ) (s : ℂ) + (hq : -1 < q.re) (hs : s.re = 0) : + shiftedSlowDerivative n q m s =O[atTop] + (fun t : ℝ => t ^ (max (-(q + n).re) 0)) := by + let a := max (-(q + n).re) 0 + obtain ⟨C, hC, hb⟩ := iteratedDeriv_regularizedSlowSolution_polynomial_bound n q m hq + refine isBigO_iff.mpr ⟨C * (1 + ‖s‖) ^ a, ?_⟩ + filter_upwards [eventually_ge_atTop (1 : ℝ)] with t ht + have ht0 : 0 ≤ t := zero_le_one.trans ht + have hxre : ((t : ℂ) - s).re = t := by simp [hs] + have hxnorm : 1 ≤ ‖(t : ℂ) - s‖ := + ht.trans (by simpa [hxre] using Complex.re_le_norm ((t : ℂ) - s)) + have hxn : ‖(t : ℂ) - s‖ ≤ (1 + ‖s‖) * t := by + calc + _ ≤ ‖(t : ℂ)‖ + ‖s‖ := norm_sub_le _ _ + _ = t + ‖s‖ := by rw [Complex.norm_of_nonneg ht0] + _ ≤ (1 + ‖s‖) * t := by nlinarith [norm_nonneg s] + rw [Real.norm_eq_abs, abs_of_nonneg (Real.rpow_nonneg ht0 _)] + calc + _ ≤ C * ‖(t : ℂ) - s‖ ^ a := hb _ (by simpa [hxre] using ht0) hxnorm + _ ≤ C * ((1 + ‖s‖) * t) ^ a := + mul_le_mul_of_nonneg_left (Real.rpow_le_rpow (norm_nonneg _) hxn (le_max_right _ _)) hC + _ = _ := by rw [Real.mul_rpow (by positivity) ht0]; ring + +theorem polynomial_eval_isBigO_exp (p : ℂ[X]) (a : ℝ) (ha : 0 < a) : + (fun t : ℝ => p.eval (t : ℂ)) =O[atTop] (fun t : ℝ => Real.exp (a * t)) := by + induction p using Polynomial.induction_on' with + | add p q hp hq => simpa only [Polynomial.eval_add] using hp.add hq + | monomial n c => + have h : (fun t : ℝ => (t : ℂ) ^ n) =O[atTop] + (fun t : ℝ => Real.exp (a * t)) := by + simpa only [← Complex.ofReal_pow, Complex.isBigO_ofReal_left, + Real.rpow_natCast] using (isLittleO_rpow_exp_pos_mul_atTop (n : ℝ) ha).isBigO + simpa only [Polynomial.eval_monomial] using h.const_mul_left c + +theorem integrableOn_exp_neg_mul_polynomial_of_growth (f : ℝ → ℂ) (p : ℂ[X]) (r : ℝ) + (hc : ContinuousOn f (Ici 0)) (hf : f =O[atTop] (fun t : ℝ => t ^ r)) : + IntegrableOn (fun t : ℝ => (Real.exp (-t) : ℂ) * f t * p.eval (t : ℂ)) (Ioi 0) := by + have hfe : f =O[atTop] (fun t : ℝ => Real.exp ((1 / 4) * t)) := + hf.trans (isLittleO_rpow_exp_pos_mul_atTop r (by norm_num : 0 < (1 / 4 : ℝ))).isBigO + have hp := polynomial_eval_isBigO_exp p (1 / 4) (by norm_num) + have hprod : (fun t : ℝ => f t * p.eval (t : ℂ)) =O[atTop] + (fun t : ℝ => Real.exp ((1 / 2) * t)) := by + convert hfe.mul hp using 1 + funext t + rw [← Real.exp_add] + congr 1 + ring + have hcp : ContinuousOn (fun t : ℝ => f t * p.eval (t : ℂ)) (Ici 0) := by + apply hc.mul + exact (p.continuous.comp Complex.continuous_ofReal).continuousOn + have hi := integrableOn_exp_neg_smul_of_isBigO_exp + (hcp.locallyIntegrableOn measurableSet_Ici) hprod (by norm_num : (1 / 2 : ℝ) < 1) + have hi' := hi.mono_set Ioi_subset_Ici_self + convert! hi' using 1 + funext t + simp only [neg_mul, one_mul, Complex.real_smul] + ring + +theorem integrableOn_laguerreIntegrand_shiftedSlowDerivative + (n j : ℕ) (q : ℂ) (m : ℕ) (s : ℂ) + (hq : -1 < q.re) (hsre : s.re = 0) (hsim : s.im ≠ 0) : + IntegrableOn (laguerreIntegrand (shiftedSlowDerivative n q m s) j) (Ioi 0) := + integrableOn_exp_neg_mul_polynomial_of_growth _ _ _ + (continuous_shiftedSlowDerivative n q m s hq hsim).continuousOn + (shiftedSlowDerivative_isBigO_rpow n q m s hq hsre) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ShiftedSlowSolution.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ShiftedSlowSolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..4cbaef16e3a1d6be5d5eab2313612d4612807509 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ShiftedSlowSolution.lean @@ -0,0 +1,62 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Profile.SlowHigherDerivatives + +namespace OAI + +/-! # The translated slow solution used in the Laguerre calculation -/ + +namespace DefocusingNLS + +noncomputable def shiftedSlowSolution (q : ℂ) (m : ℕ) (s : ℂ) (t : ℝ) : ℂ := + regularizedSlowSolution q m ((t : ℂ) - s) + +theorem shifted_argument_mem_slitPlane (s : ℂ) (hs : s.im ≠ 0) (t : ℝ) : + (t : ℂ) - s ∈ Complex.slitPlane := by + apply Complex.mem_slitPlane_iff.mpr + right + simpa only [Complex.sub_im, Complex.ofReal_im, zero_sub, ne_eq, neg_eq_zero] using hs + +theorem hasDerivAt_shiftedSlowSolution (q : ℂ) (m : ℕ) (s : ℂ) + (hq : -1 < q.re) (hs : s.im ≠ 0) (t : ℝ) : + HasDerivAt (shiftedSlowSolution q m s) + (deriv (regularizedSlowSolution q m) ((t : ℂ) - s)) t := by + have hh := (analyticOnNhd_regularizedSlowSolution_slit q m hq + _ (shifted_argument_mem_slitPlane s hs t)).differentiableAt.hasDerivAt + have h := (hh.comp (t : ℂ) ((hasDerivAt_id (t : ℂ)).sub_const s)).comp_ofReal + convert! h using 1 + all_goals simp only [mul_one] + +theorem hasDerivAt_deriv_shiftedSlowSolution (q : ℂ) (m : ℕ) (s : ℂ) + (hq : -1 < q.re) (hs : s.im ≠ 0) (t : ℝ) : + HasDerivAt (deriv (shiftedSlowSolution q m s)) + (deriv (deriv (regularizedSlowSolution q m)) ((t : ℂ) - s)) t := by + have he : deriv (shiftedSlowSolution q m s) = + (fun u : ℝ => deriv (regularizedSlowSolution q m) ((u : ℂ) - s)) := + funext fun u => (hasDerivAt_shiftedSlowSolution q m s hq hs u).deriv + rw [he] + have hh := ((analyticOnNhd_regularizedSlowSolution_slit q m hq).deriv + _ (shifted_argument_mem_slitPlane s hs t)).differentiableAt.hasDerivAt + have h := (hh.comp (t : ℂ) ((hasDerivAt_id (t : ℂ)).sub_const s)).comp_ofReal + convert! h using 1 + all_goals simp only [mul_one] + +/-- This is the equation projected onto Laguerre polynomials in the paper. -/ +theorem shiftedSlowSolution_laguerre_equation (q : ℂ) (M : ℕ) (s : ℂ) (t : ℝ) + (hq : -1 < q.re) (hsre : s.re = 0) (hsim : s.im ≠ 0) (ht : 0 ≤ t) : + (t : ℂ) * deriv (deriv (shiftedSlowSolution q (M + 1) s)) t + + (1 - (t : ℂ)) * deriv (shiftedSlowSolution q (M + 1) s) t + + (M : ℂ) * deriv (shiftedSlowSolution q (M + 1) s) t - + s * (deriv (deriv (shiftedSlowSolution q (M + 1) s)) t - + deriv (shiftedSlowSolution q (M + 1) s) t) - + q * shiftedSlowSolution q (M + 1) s t = 0 := by + have hx : 0 ≤ ((t : ℂ) - s).re := by simpa [hsre] using ht + have hx0 := Complex.slitPlane_ne_zero (shifted_argument_mem_slitPlane s hsim t) + rw [(hasDerivAt_deriv_shiftedSlowSolution q (M + 1) s hq hsim t).deriv, + (hasDerivAt_shiftedSlowSolution q (M + 1) s hq hsim t).deriv] + have h := regularizedSlowSolution_kummer_equation_closed q (M + 1) ((t : ℂ) - s) hq hx hx0 + simp only [Nat.cast_add, Nat.cast_one] at h + unfold shiftedSlowSolution + linear_combination h + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/SimilarityLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/SimilarityLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f754dc73e2671a304a237692200c321bd69f756 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/SimilarityLimit.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.BlowupRate +import Mathlib.Analysis.Complex.Exponential +import Mathlib.Analysis.SpecialFunctions.Log.Basic +import Mathlib.Topology.Algebra.Order.Field + +namespace OAI + +/-! +# From a convergent similarity orbit to pointwise blowup + +Convergence of the similarity-time error, followed by the physical time change +and phase cancellation, gives the rescaled pointwise blowup limit. +-/ + +open Filter Topology + +namespace DefocusingNLS + +noncomputable def similarityTime (T t : ℝ) : ℝ := Real.log (T / (T - t)) + +theorem similarityTime_tendsto (T : ℝ) (hT : 0 < T) : + Tendsto (similarityTime T) (𝓝[<] T) atTop := by + change Tendsto (fun t : ℝ => Real.log (T / (T - t))) (𝓝[<] T) atTop + have hb : Tendsto (fun t : ℝ => T - t) (𝓝[<] T) (𝓝[>] 0) := by + apply tendsto_nhdsWithin_iff.mpr + constructor + · have hc : Tendsto (fun _ : ℝ => T) (𝓝[<] T) (𝓝 T) := tendsto_const_nhds + simpa using hc.sub (tendsto_id.mono_left nhdsWithin_le_nhds) + · filter_upwards [self_mem_nhdsWithin] with t ht + exact sub_pos.mpr (Set.mem_Iio.mp ht) + have hi := hb.inv_tendsto_nhdsGT_zero + have hr := Tendsto.const_mul_atTop hT hi + simpa only [div_eq_mul_inv, Function.comp_def, Pi.inv_apply] using + Real.tendsto_log_atTop.comp hr + +/-- The value at the blowup center after restoring amplitude and phase. -/ +noncomputable def similarityCenterValue (T a θ b : ℝ) (Q : ℂ) + (v : ℝ → ℂ) (t : ℝ) : ℂ := + Complex.exp (((θ + b * Real.log ((T - t) / T) : ℝ) : ℂ) * Complex.I) * + ((T - t) ^ (-a) • (Q + v (similarityTime T t))) + +theorem rescaled_similarityCenterValue_norm (T a θ b t : ℝ) (Q : ℂ) + (v : ℝ → ℂ) (ht : t < T) : + (T - t) ^ a * ‖similarityCenterValue T a θ b Q v t‖ = + ‖Q + v (similarityTime T t)‖ := by + simp only [similarityCenterValue, norm_mul, norm_smul, Complex.norm_exp, + Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, Complex.I_re, Complex.I_im, + mul_zero, zero_mul, sub_self, Real.exp_zero, one_mul] + rw [Real.norm_eq_abs, abs_of_nonneg (Real.rpow_nonneg (sub_pos.mpr ht).le _), + ← mul_assoc, ← Real.rpow_add (sub_pos.mpr ht)] + simp + +/-- Convergence in similarity time yields the exact positive rescaled limit +appearing in the main theorem, provided the center profile is nonzero. -/ +theorem similarityCenterValue_rescaled_limit (T a θ b : ℝ) (Q : ℂ) + (v : ℝ → ℂ) (hT : 0 < T) (hv : Tendsto v atTop (𝓝 0)) : + Tendsto (fun t => (T - t) ^ a * ‖similarityCenterValue T a θ b Q v t‖) + (𝓝[<] T) (𝓝 ‖Q‖) := by + have hlim : Tendsto (fun t => ‖Q + v (similarityTime T t)‖) + (𝓝[<] T) (𝓝 ‖Q‖) := by + simpa using (tendsto_const_nhds.add (hv.comp (similarityTime_tendsto T hT))).norm + apply hlim.congr' + filter_upwards [self_mem_nhdsWithin] with t ht + exact (rescaled_similarityCenterValue_norm T a θ b t Q v ht).symm + +theorem similarityCenterValue_no_left_limit (T a θ b : ℝ) (Q : ℂ) + (v : ℝ → ℂ) (hT : 0 < T) (ha : 0 < a) (hQ : Q ≠ 0) + (hv : Tendsto v atTop (𝓝 0)) : + ¬ ∃ z, Tendsto (similarityCenterValue T a θ b Q v) (𝓝[<] T) (𝓝 z) := by + exact no_left_limit_of_positive_rescaled_norm _ T a ‖Q‖ ha (norm_pos_iff.mpr hQ) + (similarityCenterValue_rescaled_limit T a θ b Q v hT hv) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/TailCone.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/TailCone.lean new file mode 100644 index 0000000000000000000000000000000000000000..167fb0639e43b4999e5599988d8ce81add0688eb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/TailCone.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.FreeMatching +import Mathlib.Topology.Algebra.InfiniteSum.ENNReal + +namespace OAI + +/-! +# Strict cone for a decaying recurrent tail + +Decay of the two tail sums, the Laguerre recurrence, and nontriviality beyond +the cutoff give the strict cone inequality in Lemma `free:cone`. +-/ + +open Filter Topology + +namespace DefocusingNLS + +/-- Summing the nonnegative cone increments recovers the negative initial +cone. In particular the infinite sum needs no additional summability input. -/ +theorem hasSum_cone_increments (p a : ℕ → ℝ) (K : ℕ) + (hlimit : Tendsto p atTop (𝓝 0)) + (hinc : ∀ n, p (n + 1) - p n = a n) + (hnonneg : ∀ n, K ≤ n → 0 ≤ a n) : + HasSum (fun n => a (n + K)) (-p K) := by + apply (hasSum_iff_tendsto_nat_of_nonneg + (fun n => hnonneg (n + K) (Nat.le_add_left K n)) _).mpr + have heq (N : ℕ) : ∑ n ∈ Finset.range N, a (n + K) = p (N + K) - p K := by + simp_rw [← hinc] + simpa only [Nat.add_assoc, Nat.add_left_comm, Nat.add_comm, Nat.zero_add, Nat.add_zero] using + Finset.sum_range_sub (fun n => p (n + K)) N + simp_rw [heq] + simpa using (hlimit.comp (tendsto_add_atTop_nat K)).sub_const (p K) + +/-- Decay of both tail sums makes the cone form tend to zero. -/ +theorem coneForm_tendsto_zero (M : ℝ) (s : ℂ) (B C : ℕ → ℂ) + (hB : Tendsto B atTop (𝓝 0)) (hC : Tendsto C atTop (𝓝 0)) : + Tendsto (fun n => coneForm M s (B n) (C n)) atTop (𝓝 0) := by + have hc : Continuous (fun z : ℂ × ℂ => coneForm M s z.1 z.2) := by + unfold coneForm + fun_prop + simpa [coneForm, Function.comp_def] using + (hc.tendsto (0, 0)).comp (hB.prodMk_nhds hC) + +/-- A nontrivial decaying tail satisfying the Laguerre recurrence lies in the +strict cone once the cutoff is at least three. -/ +theorem recurrent_tail_cone_negative (σ : ℝ) (ℓ K : ℕ) + (s : ℂ) (t B C g : ℕ → ℂ) + (hσ : -(1 / 32 : ℝ) ≤ σ) (hK : 3 ≤ K) (hs : s.re = 0) + (ht : ∀ n, (t n).re = σ + (ℓ : ℝ) / 2 + n) + (hrec : ∀ n, t n * g n = -((ℓ : ℝ) + 5 : ℂ) * (B n - g n) - s * C n) + (hBrec : ∀ n, B (n + 1) = B n - g n) + (hCrec : ∀ n, C (n + 1) = C n - B (n + 1)) + (hB : Tendsto B atTop (𝓝 0)) (hC : Tendsto C atTop (𝓝 0)) + (hnonzero : ∃ n, K ≤ n ∧ g n ≠ 0) : + coneForm ((ℓ : ℝ) + 5) s (B K) (C K) < 0 := by + let p := fun n => coneForm ((ℓ : ℝ) + 5) s (B n) (C n) + have hinc (n : ℕ) : p (n + 1) - p n = + (σ + n - 5 / 2) * Complex.normSq (g n) := by + dsimp [p] + rw [hCrec, hBrec] + exact mode_coneForm_increment σ ℓ n s (t n) (B n) (C n) (g n) + hs (ht n) (hrec n) + apply negative_of_increasing_tail K (coneForm_tendsto_zero _ _ _ _ hB hC) + · intro n hn + have h := mode_increment_nonneg σ n (g n) hσ (hK.trans hn) + linarith [hinc n] + · obtain ⟨n, hn, hg⟩ := hnonzero + refine ⟨n, hn, ?_⟩ + have hn' : (3 : ℝ) ≤ n := by exact_mod_cast hK.trans hn + have hpos : 0 < (σ + n - 5 / 2) * Complex.normSq (g n) := + mul_pos (by linarith) (Complex.normSq_pos.mpr hg) + linarith [hinc n] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/UniformCutoffLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/UniformCutoffLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..19c7339486b0e98da7b2e3323d4e62ffa114a418 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/UniformCutoffLimit.lean @@ -0,0 +1,44 @@ +import Mathlib.Analysis.Normed.Group.Basic +import Mathlib.Topology.MetricSpace.Pseudo.Lemmas + +namespace OAI + +/-! # Strong convergence from vanishing fixed cutoffs and a uniform reciprocal remainder -/ + +open Filter Topology + +namespace DefocusingNLS + +theorem tendsto_zero_of_uniform_cutoff {E : Type*} [SeminormedAddCommGroup E] + (f : ℕ → E) (g : (R : ℝ) → 1 ≤ R → ℕ → E) (C : ℝ) (hC : 0 ≤ C) + (hg : ∀ (R : ℝ) (hR : 1 ≤ R), Tendsto (g R hR) atTop (𝓝 0)) + (hrem : ∀ (R : ℝ) (hR : 1 ≤ R), ∀ n, ‖f n - g R hR n‖ ≤ C / R) : + Tendsto f atTop (𝓝 0) := by + rw [Metric.tendsto_atTop] + intro ε hε + let R : ℝ := 1 + 2 * C / ε + have hR : 1 ≤ R := by + dsimp [R] + linarith [div_nonneg (mul_nonneg (by norm_num : (0 : ℝ) ≤ 2) hC) hε.le] + have hRp : 0 < R := by linarith + have hmul : ε * R = ε + 2 * C := by + dsimp [R] + field_simp + have hsmall : C / R < ε / 2 := by + rw [div_lt_iff₀ hRp] + nlinarith + obtain ⟨n₀, hn₀⟩ := Metric.tendsto_atTop.mp (hg R hR) (ε / 2) (by positivity) + refine ⟨n₀, ?_⟩ + intro n hn + have hl := hn₀ n hn + rw [dist_zero_right] at hl ⊢ + have hb := norm_add_le (f n - g R hR n) (g R hR n) + rw [sub_add_cancel] at hb + calc + ‖f n‖ ≤ ‖f n - g R hR n‖ + ‖g R hR n‖ := hb + _ ≤ C / R + ‖g R hR n‖ := add_le_add (hrem R hR n) le_rfl + _ < ε := by linarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/UniformHorizontalExclusion.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/UniformHorizontalExclusion.lean new file mode 100644 index 0000000000000000000000000000000000000000..7dcbb5633a8109a56a24292bda6c6d703792d536 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/UniformHorizontalExclusion.lean @@ -0,0 +1,53 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.HorizontalMatchingExclusion + +namespace OAI + +/-! # A common upper and lower horizontal counting boundary -/ + +namespace DefocusingNLS + +/-- Every sufficiently high horizontal line is free of homotopy zeros, +uniformly over the compact spectral strip and parameter box. -/ +theorem exists_uniform_horizontal_exclusion (ell : ℕ) (R b₀ b₁ Z₀ Z₁ : ℝ) + (hZ₀ : 0 < Z₀) : + ∃ V : ℝ, 0 < V ∧ ∀ σ b Z v ρ : ℝ, + σ ∈ Set.Icc (-(1 / 32 : ℝ)) R → b ∈ Set.Icc b₀ b₁ → Z ∈ Set.Icc Z₀ Z₁ → + V < |v| → 0 ≤ ρ → ρ ≤ 1 → + matchingColumnDeterminant + (matchingHomotopyColumn (ell + 5) 8 ((1 : ℂ) * Complex.I * Z) ρ + (horizontalQ ell 1 σ b v)) + (matchingHomotopyColumn (ell + 5) 8 ((-1 : ℂ) * Complex.I * Z) ρ + (horizontalQ ell (-1) σ b v)) ≠ 0 := by + obtain ⟨ε, hε, he⟩ := exists_horizontal_positive_neighborhood ell R b₀ b₁ Z₀ Z₁ hZ₀ + let V : ℝ := ε⁻¹ + |b₀| + |b₁| + 1 + have hV : 0 < V := by dsimp [V]; positivity + refine ⟨V, hV, ?_⟩ + intro σ b Z v ρ hσ hb hZ hv hρ hρ1 + have habs : |b| ≤ |b₀| + |b₁| := by + apply abs_le.mpr + constructor + · linarith [neg_abs_le b₀, abs_nonneg b₁, hb.1] + · linarith [le_abs_self b₁, abs_nonneg b₀, hb.2] + have hbv : |b| < |v| := by + dsimp [V] at hv + linarith [inv_pos.mpr hε] + have hvpos : 0 < |v| := lt_of_le_of_lt (abs_nonneg b) hbv + have hinv : |v⁻¹| < ε := by + rw [abs_inv, inv_eq_one_div] + apply (div_lt_iff₀ hvpos).mpr + have hbound : 1 / ε < |v| := by + dsimp [V] at hv + rw [one_div] + linarith [abs_nonneg b₀, abs_nonneg b₁] + have hmul := (div_lt_iff₀ hε).mp hbound + nlinarith + apply matchingHomotopy_horizontal_ne_zero_of_form ell σ b Z v ρ hσ.1 + (ne_of_gt (lt_of_lt_of_le hZ₀ hZ.1)) hbv hρ hρ1 + intro B C hBC + apply horizontalForm_positive_of_unit_sphere ell (v⁻¹) σ b Z _ B C hBC + intro B' C' hunit + exact he (v⁻¹) hinv (σ, b, Z, B', C') ⟨hσ, hb, hZ, hunit⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/UniformOutgoingCount.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/UniformOutgoingCount.lean new file mode 100644 index 0000000000000000000000000000000000000000..70bb3b01eac26a65b2fbfe6fb2eebc9618aa177e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/UniformOutgoingCount.lean @@ -0,0 +1,84 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.ParameterBoxHomotopy +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.OutgoingHalfPlaneCount + +namespace OAI + +/-! # Certified outgoing determinant counts throughout the parameter box -/ + +open Set + +namespace DefocusingNLS + +attribute [local irreducible] spectralHomotopyDeterminant spectralSlowDeterminant + +/-- Tail homotopy transport works in every sufficiently tall counting rectangle, +uniformly over the certified real parameter box. -/ +theorem exists_spectral_rectangle_homotopy_count_above (hR : RectangleRouche) + (ell : Fin 4) : + ∃ V : ℝ, 0 < V ∧ ∀ W : ℝ, V < W → ∀ b Z : ℝ, + |100000000 * b - 33477607| ≤ 2 → |100000000 * Z - 270506819| ≤ 2 → + rectangleZeroCount W (spectralHomotopyDeterminant ell b Z 0) = + rectangleZeroCount W (spectralHomotopyDeterminant ell b Z 1) := by + obtain ⟨V, hV, he⟩ := exists_spectral_counting_boundary ell + refine ⟨V, hV, ?_⟩ + intro W hW b Z hb hZ + have hZ0 : Z ≠ 0 := by intro h; norm_num [h] at hZ + apply rectangleZeroCount_homotopy hR W (hV.trans hW) + · intro a ha z hz + exact analyticAt_spectralHomotopyDeterminant ell b Z a z hZ0 hz.1 + · intro a ha z hz + exact continuousAt_joint_spectralHomotopyDeterminant ell b Z a z hZ0 hz.1.1 + · intro a ha z hz + apply he b Z a z hb hZ ha.1 ha.2 + rcases (mem_countingRectangleBoundary_iff W z).mp hz with ⟨hrect, hedge⟩ + rcases hedge with hleft | hright | hbottom | htop + · exact Or.inl hleft + · exact Or.inr (Or.inl hright.ge) + · exact Or.inr (Or.inr ⟨hrect.1, by + rw [hbottom, abs_neg, abs_of_pos (hV.trans hW)] + exact hW⟩) + · exact Or.inr (Or.inr ⟨hrect.1, by + rw [htop, abs_of_pos (hV.trans hW)] + exact hW⟩) + +/-- The full outgoing determinant count is 2, 1, 0, 0 for every parameter pair +in the manuscript's certified box. The only hypothesis is the precisely cited +rectangle specialization of the published Rouché theorem. -/ +theorem outgoing_halfPlane_count (hR : RectangleRouche) (ell : Fin 4) + (b Z : ℝ) (hb : |100000000 * b - 33477607| ≤ 2) + (hZ : |100000000 * Z - 270506819| ≤ 2) : + countingHalfPlaneZeroCount (spectralSlowDeterminant ell b Z) = + (SeparatorArithmetic.positiveRootCount ell : ℕ∞) := by + obtain ⟨V₁, hV₁, hfull⟩ := exists_countingHalfPlaneZeroCount_eq_rectangle ell + obtain ⟨V₂, hV₂, hzero⟩ := SeparatorArithmetic.exists_central_zeroTail_rectangle_count ell + obtain ⟨V₃, hV₃, hpar⟩ := exists_zeroTail_parameter_count hR ell + obtain ⟨V₄, hV₄, htail⟩ := exists_spectral_rectangle_homotopy_count_above hR ell + let W := max (max V₁ V₂) (max V₃ V₄) + 1 + have hW₁ : V₁ < W := by + dsimp [W] + linarith [le_max_left V₁ V₂, le_max_left (max V₁ V₂) (max V₃ V₄)] + have hW₂ : V₂ < W := by + dsimp [W] + linarith [le_max_right V₁ V₂, le_max_left (max V₁ V₂) (max V₃ V₄)] + have hW₃ : V₃ < W := by + dsimp [W] + linarith [le_max_left V₃ V₄, le_max_right (max V₁ V₂) (max V₃ V₄)] + have hW₄ : V₄ < W := by + dsimp [W] + linarith [le_max_right V₃ V₄, le_max_right (max V₁ V₂) (max V₃ V₄)] + have hZ0 : Z ≠ 0 := by intro h; norm_num [h] at hZ + have hc : rectangleZeroCount W (spectralHomotopyDeterminant ell b Z 0) = + (SeparatorArithmetic.positiveRootCount ell : ℕ∞) := + (hpar W hW₃ b Z hb hZ).symm.trans (hzero W hW₂) + calc + countingHalfPlaneZeroCount (spectralSlowDeterminant ell b Z) = + rectangleZeroCount W (spectralSlowDeterminant ell b Z) := hfull W hW₁ b Z hb hZ + _ = rectangleZeroCount W (spectralHomotopyDeterminant ell b Z 1) := + (rectangleZeroCount_spectralHomotopy_endpoint ell b Z W hZ0).symm + _ = rectangleZeroCount W (spectralHomotopyDeterminant ell b Z 0) := + (htail W hW₄ b Z hb hZ).symm + _ = (SeparatorArithmetic.positiveRootCount ell : ℕ∞) := hc + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ZeroTailAnalyticCount.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ZeroTailAnalyticCount.lean new file mode 100644 index 0000000000000000000000000000000000000000..dd097fd9c243040a0f83ca41968c2c0d0aafb7b5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ZeroTailAnalyticCount.lean @@ -0,0 +1,63 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ZeroTailPolynomialRoots +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.PolynomialRectangleCount + +namespace OAI + +/-! # Analytic zero counts for the central zero-tail determinant -/ + +open Polynomial +open scoped Classical + +namespace DefocusingNLS + +theorem analyticOrderAt_const_mul (c : ℂ) (hc : c ≠ 0) (f : ℂ → ℂ) (z : ℂ) + (hf : AnalyticAt ℂ f z) : + analyticOrderAt (fun w => c * f w) z = analyticOrderAt f z := by + have h := analyticOrderAt_mul (f := fun _ : ℂ => c) (g := f) analyticAt_const hf + have hcz : analyticOrderAt (fun _ : ℂ => c) z = 0 := + (analyticAt_const : AnalyticAt ℂ (fun _ : ℂ => c) z).analyticOrderAt_eq_zero.mpr hc + rw [hcz, zero_add] at h + convert! h using 1 + +namespace SeparatorArithmetic + +attribute [local irreducible] spectralHomotopyDeterminant windingPolynomial + +theorem central_zeroTail_order (ell : ℕ) (z : ℂ) (hz : -(1 / 32 : ℝ) ≤ z.re) : + analyticOrderAt + (spectralHomotopyDeterminant ell (33477607 / 100000000) (270506819 / 100000000) 0) z = + analyticOrderAt (fun w => ((windingPolynomial ell).map (Int.castRingHom ℂ)).eval + (w + 1 / 32)) z := by + let p := (windingPolynomial ell).map (Int.castRingHom ℂ) + let f := spectralHomotopyDeterminant ell (33477607 / 100000000) (270506819 / 100000000) 0 + have he : (fun w : ℂ => (2 * Complex.I) * p.eval (w + 1 / 32)) = + (fun w => (100000000 : ℂ) ^ 16 * f w) := by + funext w + simpa only [add_sub_cancel_right] using + windingPolynomial_eval_zeroTailDeterminant ell (w + 1 / 32) + have hp : AnalyticAt ℂ (fun w => p.eval (w + 1 / 32)) z := + ((AnalyticOnNhd.eval_polynomial (𝕜 := ℂ) p) _ (Set.mem_univ _)).comp + (analyticAt_id.add analyticAt_const) + have hf : AnalyticAt ℂ f z := + analyticAt_spectralHomotopyDeterminant ell _ _ 0 z (by norm_num) hz + have h := congrArg (fun g : ℂ → ℂ => analyticOrderAt g z) he + rw [analyticOrderAt_const_mul _ (by norm_num) _ z hp, + analyticOrderAt_const_mul _ (by norm_num) _ z hf] at h + exact h.symm + +theorem central_zeroTail_rectangle_count (ell : Fin 4) (V : ℝ) : + rectangleZeroCount V + (spectralHomotopyDeterminant ell (33477607 / 100000000) (270506819 / 100000000) 0) = + ((((windingPolynomial ell).map (Int.castRingHom ℂ)).roots.toFinset.filter + (fun w => w - 1 / 32 ∈ countingRectangle V)).card : ℕ∞) := by + rw [← rectangleZeroCount_polynomial_translate _ (windingPolynomial_complex_ne_zero ell) + (windingPolynomial_roots_nodup ell) (1 / 32) V] + unfold rectangleZeroCount + apply tsum_congr + intro z + exact central_zeroTail_order ell z z.2.1.le + +end SeparatorArithmetic +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ZeroTailConjugation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ZeroTailConjugation.lean new file mode 100644 index 0000000000000000000000000000000000000000..65a27394441377ff7fd0fefa1b58a5116e61ffcb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ZeroTailConjugation.lean @@ -0,0 +1,84 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ZeroTailRecurrenceLink +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.CenteredPolynomial + +namespace OAI + +/-! # Conjugation of the two zero-tail matching channels -/ + +open Polynomial Matrix + +namespace DefocusingNLS.SeparatorArithmetic + +attribute [local irreducible] backwardProduct backwardCoefficients toPolynomial windingPolynomial matchingHomotopyColumn + +theorem backwardProduct_conjugate (M : ℝ) (s q : ℂ) (N : ℕ) (i j : Fin 2) : + star (backwardProduct (M : ℂ) s q N i j) = + backwardProduct (M : ℂ) (star s) (star q) N i j := by + induction N generalizing i j with + | zero => fin_cases i <;> fin_cases j <;> simp [backwardProduct] + | succ N ih => + simp only [backwardProduct, Matrix.mul_apply, Fin.sum_univ_two, star_add, star_mul, ih] + have hs (a b : Fin 2) : star (backwardMatrix (M : ℂ) s (q + N) a b) = + backwardMatrix (M : ℂ) (star s) (star q + N) a b := by + fin_cases a <;> fin_cases b <;> simp [backwardMatrix] + rw [hs, hs] + ring + +theorem zeroTailQ_conjugate (ell : ℕ) (z : ℂ) : + star (zeroTailQ ell (star z)) = + spectralQ ell (-1) (33477607 / 100000000) (z - 1 / 32) := by + apply Complex.ext <;> + simp [zeroTailQ, spectralQ, Complex.mul_re, Complex.mul_im] + +theorem zeroTailS_conjugate : star zeroTailS = -zeroTailS := by + simp [zeroTailS] + +theorem evaluate_conjugate_polynomial (p : Polynomial ℂ) (z : ℂ) : + (p.map (starRingEnd ℂ)).eval z = star (p.eval (star z)) := by + simpa only [starRingEnd_apply, star_star] using + (Polynomial.eval_map_apply (p := p) (starRingEnd ℂ) (star z)) + +theorem evaluatePair_conjugate (ell : ℕ) (z : ℂ) (i : Fin 2) : + star (evaluatePair (backwardCoefficients ell) (star z) i) = + (100000000 : ℂ) ^ 8 * + matchingHomotopyColumn (ell + 5) 8 (-zeroTailS) 0 + (spectralQ ell (-1) (33477607 / 100000000) (z - 1 / 32)) i := by + rw [evaluatePair_backwardCoefficients, Pi.smul_apply, smul_eq_mul, star_mul] + simp only [star_pow, star_ofNat] + rw [matchingHomotopyColumn_zero, matchingHomotopyColumn_zero] + simp only [Matrix.mulVec, dotProduct, Fin.sum_univ_two, + Matrix.cons_val_zero, Matrix.cons_val_one, mul_zero, mul_one, zero_add] + have h := backwardProduct_conjugate (ell + 5 : ℕ) zeroTailS (zeroTailQ ell (star z)) 8 i 1 + simp only [Nat.cast_add, Nat.cast_ofNat, Complex.ofReal_add, + Complex.ofReal_natCast, Complex.ofReal_ofNat] at h ⊢ + rw [h, zeroTailQ_conjugate, zeroTailS_conjugate] + ring + +/-- The imaginary-part coefficients encode the full determinant polynomial, +not merely its values on the real axis. -/ +theorem windingPolynomial_complex_identity (ell : ℕ) : + C (2 * Complex.I) * (windingPolynomial ell).map (Int.castRingHom ℂ) = + (toPolynomial (backwardCoefficients ell).1 * + (toPolynomial (backwardCoefficients ell).2).map (starRingEnd GaussianInt)).map + GaussianInt.toComplex - + ((toPolynomial (backwardCoefficients ell).1 * + (toPolynomial (backwardCoefficients ell).2).map (starRingEnd GaussianInt)).map + GaussianInt.toComplex).map (starRingEnd ℂ) := by + ext n + simp only [coeff_C_mul, coeff_map, coeff_sub, coeff_windingPolynomial, windingCoefficient_eq, + starRingEnd_apply] + generalize (toPolynomial (backwardCoefficients ell).1 * + (toPolynomial (backwardCoefficients ell).2).map (starRingEnd GaussianInt)).coeff n = a + change (2 * Complex.I) * (a.im : ℂ) = (a : ℂ) - star (a : ℂ) + rw [GaussianInt.toComplex_def₂] + apply Complex.ext + · simp only [Complex.mul_re, Complex.I_re, Complex.I_im, Complex.sub_re, + Complex.star_def, Complex.conj_re, Complex.intCast_re, Complex.intCast_im] + norm_num + · simp only [Complex.mul_im, Complex.I_re, Complex.I_im, Complex.sub_im, + Complex.star_def, Complex.conj_im, Complex.intCast_re, Complex.intCast_im] + (norm_num; ring) + +end DefocusingNLS.SeparatorArithmetic + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ZeroTailDeterminantPolynomial.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ZeroTailDeterminantPolynomial.lean new file mode 100644 index 0000000000000000000000000000000000000000..f17b39f839b5bae158ca4ac44c6bca19441620c1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ZeroTailDeterminantPolynomial.lean @@ -0,0 +1,61 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ZeroTailConjugation + +namespace OAI + +/-! # Exact polynomial identity for the zero-tail determinant -/ + +open Polynomial Matrix + +namespace DefocusingNLS.SeparatorArithmetic + +attribute [local irreducible] backwardCoefficients toPolynomial matchingHomotopyColumn + +theorem map_gaussian_conjugate (p : Polynomial GaussianInt) : + (p.map (starRingEnd GaussianInt)).map GaussianInt.toComplex = + (p.map GaussianInt.toComplex).map (starRingEnd ℂ) := by + ext n + simp only [coeff_map, starRingEnd_apply] + exact GaussianInt.toComplex_star (p.coeff n) + +/-- The central certificate polynomial is exactly the entire zero-tail matching +determinant, with its documented spectral translation and integer scaling. -/ +theorem windingPolynomial_eval_zeroTailDeterminant (ell : ℕ) (z : ℂ) : + (2 * Complex.I) * ((windingPolynomial ell).map (Int.castRingHom ℂ)).eval z = + (100000000 : ℂ) ^ 16 * spectralHomotopyDeterminant ell + (33477607 / 100000000) (270506819 / 100000000) 0 (z - 1 / 32) := by + let X := (toPolynomial (backwardCoefficients ell).1).map GaussianInt.toComplex + let Y := (toPolynomial (backwardCoefficients ell).2).map GaussianInt.toComplex + have hm : (toPolynomial (backwardCoefficients ell).1 * + (toPolynomial (backwardCoefficients ell).2).map (starRingEnd GaussianInt)).map + GaussianInt.toComplex = X * Y.map (starRingEnd ℂ) := by + rw [Polynomial.map_mul, map_gaussian_conjugate] + have h := congrArg (fun p : Polynomial ℂ => p.eval z) + (windingPolynomial_complex_identity ell) + rw [hm] at h + simp only [eval_mul, eval_C, eval_sub, evaluate_conjugate_polynomial, + star_mul, star_star] at h + have hp0 : X.eval z = (100000000 : ℂ) ^ 8 * + matchingHomotopyColumn (ell + 5) 8 zeroTailS 0 (zeroTailQ ell z) 0 := by + simpa only [X, evaluatePair, Matrix.cons_val_zero, Pi.smul_apply, smul_eq_mul] using + congrFun (evaluatePair_backwardCoefficients ell z) 0 + have hp1 : Y.eval z = (100000000 : ℂ) ^ 8 * + matchingHomotopyColumn (ell + 5) 8 zeroTailS 0 (zeroTailQ ell z) 1 := by + simpa only [Y, evaluatePair, Matrix.cons_val_one, Matrix.cons_val_zero, Pi.smul_apply, smul_eq_mul] using + congrFun (evaluatePair_backwardCoefficients ell z) 1 + have hm0 : star (X.eval (star z)) = (100000000 : ℂ) ^ 8 * + matchingHomotopyColumn (ell + 5) 8 (-zeroTailS) 0 + (spectralQ ell (-1) (33477607 / 100000000) (z - 1 / 32)) 0 := by + simpa only [X, evaluatePair, Matrix.cons_val_zero] using evaluatePair_conjugate ell z 0 + have hm1 : star (Y.eval (star z)) = (100000000 : ℂ) ^ 8 * + matchingHomotopyColumn (ell + 5) 8 (-zeroTailS) 0 + (spectralQ ell (-1) (33477607 / 100000000) (z - 1 / 32)) 1 := by + simpa only [Y, evaluatePair, Matrix.cons_val_one, Matrix.cons_val_zero] using evaluatePair_conjugate ell z 1 + rw [hp0, hp1, hm0, hm1] at h + rw [h] + simp only [spectralHomotopyDeterminant, matchingColumnDeterminant, zeroTailQ, zeroTailS, + Complex.ofReal_div, Complex.ofReal_ofNat, neg_mul] + ring + +end DefocusingNLS.SeparatorArithmetic + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ZeroTailParameterContinuity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ZeroTailParameterContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..def0baca1f0b0735717760a3388350078eb702ec --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ZeroTailParameterContinuity.lean @@ -0,0 +1,76 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralHomotopyContinuity + +namespace OAI + +/-! # Joint parameter continuity of the finite zero-tail determinant + +At tail parameter zero the matching column is the second column of the finite +backward matrix product. Its continuity therefore holds for all parameters, +without any integral-kernel continuity or nonvanishing hypothesis. +-/ + +open Matrix + +namespace DefocusingNLS + +attribute [local irreducible] backwardProduct matchingHomotopyColumn + +theorem continuous_backwardMatrix_entry (M : ℂ) (n : ℕ) (i j : Fin 2) : + Continuous (fun x : ℂ × ℂ => backwardMatrix M x.1 (x.2 + n) i j) := by + fin_cases i <;> fin_cases j + · change Continuous (fun x : ℂ × ℂ => x.2 + n - M - x.1) + fun_prop + · change Continuous (fun x : ℂ × ℂ => -x.1) + fun_prop + · change Continuous (fun x : ℂ × ℂ => x.2 + n) + fun_prop + · change Continuous (fun x : ℂ × ℂ => x.2 + n) + fun_prop + +theorem continuous_backwardProduct_entry (M : ℂ) (K : ℕ) (i j : Fin 2) : + Continuous (fun x : ℂ × ℂ => backwardProduct M x.1 x.2 K i j) := by + induction K generalizing i j with + | zero => + simp only [backwardProduct] + exact continuous_const + | succ K ih => + simp only [backwardProduct, Matrix.mul_apply, Fin.sum_univ_two] + exact ((ih i 0).mul (continuous_backwardMatrix_entry M K 0 j)).add + ((ih i 1).mul (continuous_backwardMatrix_entry M K 1 j)) + +theorem matchingHomotopyColumn_zero_entry (M K : ℕ) (s q : ℂ) (i : Fin 2) : + matchingHomotopyColumn M K s 0 q i = backwardProduct M s q K i 1 := by + rw [matchingHomotopyColumn_zero] + simp [Matrix.mulVec, dotProduct, Fin.sum_univ_two] + +/-- Coordinates are the real shift, real coupling, and complex spectral value. -/ +abbrev ZeroTailParameters := ℝ × ℝ × ℂ + +theorem continuous_zeroTail_spectralColumn (ell : ℕ) (h : ℝ) (i : Fin 2) : + Continuous (fun x : ZeroTailParameters => + matchingHomotopyColumn (ell + 5) 8 ((h : ℂ) * Complex.I * x.2.1) 0 + (spectralQ ell h x.1 x.2.2) i) := by + have hc : Continuous (fun x : ZeroTailParameters => + ((h : ℂ) * Complex.I * x.2.1, spectralQ ell h x.1 x.2.2)) := by + unfold spectralQ + fun_prop + have hp := (continuous_backwardProduct_entry (ell + 5) 8 i 1).comp hc + simpa only [matchingHomotopyColumn_zero_entry, Function.comp_def, Nat.cast_add, Nat.cast_ofNat] using hp + +theorem continuous_zeroTail_spectralDeterminant (ell : ℕ) : + Continuous (fun x : ZeroTailParameters => + spectralHomotopyDeterminant ell x.1 x.2.1 0 x.2.2) := by + have hp0 := continuous_zeroTail_spectralColumn ell 1 0 + have hp1 := continuous_zeroTail_spectralColumn ell 1 1 + have hm0 := continuous_zeroTail_spectralColumn ell (-1) 0 + have hm1 := continuous_zeroTail_spectralColumn ell (-1) 1 + have hc := (hp0.mul hm1).sub (hp1.mul hm0) + unfold spectralHomotopyDeterminant + convert! hc using 1 + funext x + simp only [matchingColumnDeterminant, Pi.mul_apply, Pi.sub_apply, + Complex.ofReal_one, Complex.ofReal_neg, one_mul, neg_one_mul] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ZeroTailPolynomialRoots.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ZeroTailPolynomialRoots.lean new file mode 100644 index 0000000000000000000000000000000000000000..9d4819ad4b45fb4c970f9ba50ae0d477601e1725 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ZeroTailPolynomialRoots.lean @@ -0,0 +1,51 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ZeroTailDeterminantPolynomial +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.SeparatorScaling + +namespace OAI + +/-! # Simplicity and axis exclusion for the unscaled certificate polynomial -/ + +open Polynomial + +namespace DefocusingNLS.SeparatorArithmetic + +attribute [local irreducible] scaledSeparatorPolynomial windingPolynomial + +theorem windingPolynomial_complex_ne_zero (ell : Fin 4) : + (windingPolynomial ell).map (Int.castRingHom ℂ) ≠ 0 := by + intro h + apply scaledSeparatorPolynomial_complex_ne_zero ell + rw [scaledSeparatorPolynomial_identity, h, zero_comp, mul_zero] + +theorem scaledSeparatorPolynomial_roots_nodup (ell : Fin 4) : + ((scaledSeparatorPolynomial ell).map GaussianInt.toComplex).roots.Nodup := by + obtain ⟨z, _, _, hz⟩ := roots_of_fifteen_disks + ((scaledSeparatorPolynomial ell).map GaussianInt.toComplex) + (scaledSeparatorPolynomial_complex_ne_zero ell) + (natDegree_map_le.trans (scaledSeparatorPolynomial_degree ell)) + (fun j => (diskCenters ell j : ℂ)) 100 + (complex_disk_centers_separated ell) (root_in_certified_disk ell) + rw [hz] + exact Finset.nodup _ + +theorem windingPolynomial_roots_nodup (ell : Fin 4) : + ((windingPolynomial ell).map (Int.castRingHom ℂ)).roots.Nodup := by + have h := scaledSeparatorPolynomial_roots_nodup ell + rw [scaledSeparatorPolynomial_roots] at h + exact Multiset.Nodup.of_map _ h + +theorem windingPolynomial_no_axis_root (ell : Fin 4) {z : ℂ} + (hz : ((windingPolynomial ell).map (Int.castRingHom ℂ)).IsRoot z) : z.re ≠ 0 := by + have hscaled : ((scaledSeparatorPolynomial ell).map GaussianInt.toComplex).IsRoot + ((diskScale : ℂ) * z) := by + rw [Polynomial.IsRoot, scaledSeparatorPolynomial_identity] + simp only [eval_mul, eval_C, eval_comp, eval_X] + rw [inv_mul_cancel_left₀ (by norm_num [diskScale]), hz.eq_zero, mul_zero] + have hn := zero_tail_no_axis_zero ell hscaled + intro h + apply hn + simp [Complex.mul_re, h] + +end DefocusingNLS.SeparatorArithmetic + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ZeroTailRecurrenceLink.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ZeroTailRecurrenceLink.lean new file mode 100644 index 0000000000000000000000000000000000000000..a807c11541a450eefb362f1167a01a2adf81b780 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Certificates/ZeroTailRecurrenceLink.lean @@ -0,0 +1,123 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralEndpointMultiplicity +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.MatchingPolynomialDegree + +namespace OAI + +/-! # The integer zero-tail recurrence is the actual backward matching column -/ + +open Polynomial Matrix + +namespace DefocusingNLS.SeparatorArithmetic + +attribute [local irreducible] backwardProduct backwardCoefficients matchingHomotopyColumn + +noncomputable def zeroTailQ (ell : ℕ) (z : ℂ) : ℂ := + spectralQ ell 1 (33477607 / 100000000) (z - 1 / 32) + +noncomputable def zeroTailS : ℂ := Complex.I * (270506819 / 100000000) + +noncomputable def evaluatePair (xy : List GaussianInt × List GaussianInt) (z : ℂ) : + Fin 2 → ℂ := + ![((toPolynomial xy.1).map GaussianInt.toComplex).eval z, + ((toPolynomial xy.2).map GaussianInt.toComplex).eval z] + +theorem affine_coefficient_eval (ell n : ℕ) (z : ℂ) : + GaussianInt.toComplex ⟨scale * n + 50000000 * ell - 3125000, -centerB⟩ + + GaussianInt.toComplex (scale : GaussianInt) * z = + (100000000 : ℂ) * (zeroTailQ ell z + n) := by + have hD : GaussianInt.toComplex (scale : GaussianInt) = (100000000 : ℂ) := by + rw [GaussianInt.toComplex_def] + norm_num [scale] + rw [hD] + change ((⟨scale * n + 50000000 * ell - 3125000, -centerB⟩ : GaussianInt) : ℂ) + + (100000000 : ℂ) * z = _ + rw [GaussianInt.toComplex_def'] + simp only [scale, centerB, Int.cast_add, Int.cast_sub, Int.cast_mul, + Int.cast_natCast, Int.cast_ofNat, Int.cast_neg, zeroTailQ, spectralQ, + Complex.ofReal_one, one_mul] + push_cast + ring + +theorem mass_coefficient_eval (ell : ℕ) : + GaussianInt.toComplex ⟨scale * (ell + 5), centerZ⟩ = + (100000000 : ℂ) * ((ell + 5 : ℕ) + zeroTailS) := by + rw [GaussianInt.toComplex_def'] + simp only [scale, centerZ, zeroTailS] + push_cast + ring + +theorem coupling_coefficient_eval : + GaussianInt.toComplex ⟨0, centerZ⟩ = (100000000 : ℂ) * zeroTailS := by + rw [GaussianInt.toComplex_def'] + norm_num [centerZ, zeroTailS] + ring + +theorem evaluatePair_backwardStep (ell n : ℕ) + (xy : List GaussianInt × List GaussianInt) (z : ℂ) : + evaluatePair (backwardStep ell n xy) z = (100000000 : ℂ) • + (backwardMatrix (ell + 5) zeroTailS (zeroTailQ ell z + n) *ᵥ evaluatePair xy z) := by + have ht := affine_coefficient_eval ell n z + have hm := mass_coefficient_eval ell + have hs := coupling_coefficient_eval + funext i + by_cases hi : i = 0 + · subst i + simp only [evaluatePair, Matrix.cons_val_zero, toPolynomial_backwardStep_fst, + Polynomial.map_sub, Polynomial.map_mul, Polynomial.map_add, map_C, map_X, + eval_sub, eval_mul, eval_add, eval_C, eval_X, Pi.smul_apply, smul_eq_mul] + rw [ht, hm, hs] + simp [backwardMatrix, Matrix.mulVec, dotProduct, Fin.sum_univ_two] + ring + · have hi1 : i = 1 := by omega + subst i + simp only [evaluatePair, Matrix.cons_val_one, toPolynomial_backwardStep_snd, + Polynomial.map_mul, Polynomial.map_add, map_C, map_X, + eval_mul, eval_add, eval_C, eval_X, Pi.smul_apply, smul_eq_mul] + rw [ht] + simp [backwardMatrix, Matrix.mulVec, dotProduct, Fin.sum_univ_two] + ring + +theorem backward_fold_smul (M s q a : ℂ) (ns : List ℕ) (v : Fin 2 → ℂ) : + ns.foldl (fun w (n : ℕ) => backwardMatrix M s (q + n) *ᵥ w) (a • v) = + a • ns.foldl (fun w (n : ℕ) => backwardMatrix M s (q + n) *ᵥ w) v := by + induction ns generalizing v with + | nil => rfl + | cons n ns ih => + simp only [List.foldl_cons, Matrix.mulVec_smul, ih] + +theorem evaluatePair_backwardFold (ell : ℕ) (ns : List ℕ) + (xy : List GaussianInt × List GaussianInt) (z : ℂ) : + evaluatePair (ns.foldl (fun v n => backwardStep ell n v) xy) z = + (100000000 : ℂ) ^ ns.length • + ns.foldl (fun v (n : ℕ) => backwardMatrix (ell + 5) zeroTailS (zeroTailQ ell z + n) *ᵥ v) + (evaluatePair xy z) := by + induction ns generalizing xy with + | nil => simp + | cons n ns ih => + simp only [List.foldl_cons, List.length_cons, ih, evaluatePair_backwardStep, + backward_fold_smul, smul_smul, pow_succ] + +theorem reverse_range_backwardProduct (M s q : ℂ) (N : ℕ) (v : Fin 2 → ℂ) : + (List.range N).reverse.foldl (fun w (n : ℕ) => backwardMatrix M s (q + n) *ᵥ w) v = + backwardProduct M s q N *ᵥ v := by + induction N generalizing v with + | zero => simp [backwardProduct] + | succ N ih => + simp only [List.range_succ, List.reverse_append, List.reverse_singleton, + List.singleton_append, List.foldl_cons, ih, Matrix.mulVec_mulVec, backwardProduct] + +theorem evaluatePair_backwardCoefficients (ell : ℕ) (z : ℂ) : + evaluatePair (backwardCoefficients ell) z = (100000000 : ℂ) ^ 8 • + matchingHomotopyColumn (ell + 5) 8 zeroTailS 0 (zeroTailQ ell z) := by + rw [matchingHomotopyColumn_zero] + have h := evaluatePair_backwardFold ell (List.range 8).reverse ([], [1]) z + rw [reverse_range_backwardProduct] at h + have hn : (List.range 8).reverse = [7, 6, 5, 4, 3, 2, 1, 0] := by decide + have hi : evaluatePair ([], [1]) z = ![0, 1] := by + simp [evaluatePair, toPolynomial] + rw [List.length_reverse, List.length_range, hn, hi] at h + simpa only [backwardCoefficients, Nat.cast_add, Nat.cast_ofNat] using h + +end DefocusingNLS.SeparatorArithmetic + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ContinuousYoung.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ContinuousYoung.lean new file mode 100644 index 0000000000000000000000000000000000000000..c7bcac9ee68160eac674aee88eed1f680534e97f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ContinuousYoung.lean @@ -0,0 +1,110 @@ +import Mathlib.Analysis.Convolution +import Mathlib.MeasureTheory.Function.L2Space +import Mathlib.MeasureTheory.Integral.Bochner.Basic +import Mathlib.MeasureTheory.Measure.Haar.InnerProductSpace +import Mathlib.MeasureTheory.Measure.Haar.Unique + +namespace OAI + +/-! # The continuous-frequency Young estimate used by the homogeneous algebra + +Only the nonnegative L¹–L² estimate needed for Fourier magnitudes is proved. +Weighted Cauchy–Schwarz gives the pointwise bound; the existing convolution +Fubini theorem integrates its majorant. +-/ + +open MeasureTheory +open scoped ENNReal Convolution + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +/-- Weighted Cauchy–Schwarz without introducing a probability normalization. -/ +theorem continuousWeightedCauchySchwarz (f g : E → ℝ) + (hf : Integrable f) (hg : AEStronglyMeasurable g volume) + (hfp : ∀ x, 0 ≤ f x) (hgp : ∀ x, 0 ≤ g x) + (hfg : Integrable (fun x => f x * g x ^ 2)) : + (∫ x, f x * g x) ^ 2 ≤ (∫ x, f x) * ∫ x, f x * g x ^ 2 := by + let A : E → ℝ := fun x => Real.sqrt (f x) + let B : E → ℝ := fun x => Real.sqrt (f x) * g x + have hAm : AEStronglyMeasurable A volume := + Real.continuous_sqrt.comp_aestronglyMeasurable hf.aestronglyMeasurable + have hBm : AEStronglyMeasurable B volume := hAm.mul hg + have hAs (x : E) : A x ^ 2 = f x := Real.sq_sqrt (hfp x) + have hBs (x : E) : B x ^ 2 = f x * g x ^ 2 := by + simp only [B, mul_pow, Real.sq_sqrt (hfp x)] + have hA : MemLp A 2 volume := (memLp_two_iff_integrable_sq hAm).mpr (by + simpa only [hAs] using hf) + have hB : MemLp B 2 volume := (memLp_two_iff_integrable_sq hBm).mpr (by + simpa only [hBs] using hfg) + have hAB (x : E) : A x * B x = f x * g x := by + change Real.sqrt (f x) * (Real.sqrt (f x) * g x) = _ + rw [← mul_assoc, Real.mul_self_sqrt (hfp x)] + have hholder : (2 : ℝ).HolderConjugate 2 := by rw [Real.holderConjugate_iff]; norm_num + have hh := integral_mul_le_Lp_mul_Lq_of_nonneg hholder + (ae_of_all _ (fun x => Real.sqrt_nonneg (f x))) + (ae_of_all _ (fun x => mul_nonneg (Real.sqrt_nonneg _) (hgp x))) + (by simpa using hA) (by simpa using hB) + change (∫ x, A x * B x) ≤ (∫ x, A x ^ (2 : ℝ)) ^ (1 / 2 : ℝ) * + (∫ x, B x ^ (2 : ℝ)) ^ (1 / 2 : ℝ) at hh + simp only [Real.rpow_two, hAB, hAs, hBs, ← Real.sqrt_eq_rpow] at hh + have hleft : 0 ≤ ∫ x, f x * g x := integral_nonneg (fun x => mul_nonneg (hfp x) (hgp x)) + have h1 : 0 ≤ ∫ x, f x := integral_nonneg hfp + have h2 : 0 ≤ ∫ x, f x * g x ^ 2 := integral_nonneg (fun x => mul_nonneg (hfp x) (sq_nonneg _)) + have hs := (sq_le_sq₀ hleft (mul_nonneg (Real.sqrt_nonneg _) (Real.sqrt_nonneg _))).mpr hh + simpa only [mul_pow, Real.sq_sqrt h1, Real.sq_sqrt h2] using hs + +noncomputable def positiveFrequencyConvolution (f g : E → ℝ) (ξ : E) : ℝ := + ∫ η, f η * g (ξ - η) + +theorem positiveFrequencyConvolution_comm (f g : E → ℝ) (ξ : E) : + positiveFrequencyConvolution f g ξ = positiveFrequencyConvolution g f ξ := by + unfold positiveFrequencyConvolution + rw [← integral_sub_left_eq_self (fun η => f η * g (ξ - η)) volume ξ] + simp only [sub_sub_self, mul_comm] + +/-- The exact L¹–L² Young bound, in its squared form. -/ +theorem continuousYoung_nonnegative (f g : E → ℝ) + (hf : Integrable f) (hg : Continuous g) + (hfp : ∀ x, 0 ≤ f x) (hgp : ∀ x, 0 ≤ g x) + (hg2 : Integrable (fun x => g x ^ 2)) + (K : ℝ) (_hK : 0 ≤ K) (hgb : ∀ x, g x ≤ K) : + Integrable (fun ξ => positiveFrequencyConvolution f g ξ ^ 2) ∧ + (∫ ξ, positiveFrequencyConvolution f g ξ ^ 2) ≤ + (∫ ξ, f ξ) ^ 2 * ∫ ξ, g ξ ^ 2 := by + let L := ContinuousLinearMap.mul ℝ ℝ + have hconv : Integrable (fun ξ => ∫ η, f η * g (ξ - η) ^ 2) := by + exact hf.integrable_convolution L hg2 + have hmajor : Integrable (fun ξ => (∫ x, f x) * ∫ η, f η * g (ξ - η) ^ 2) := + hconv.const_mul _ + have hpoint (ξ : E) : positiveFrequencyConvolution f g ξ ^ 2 ≤ + (∫ x, f x) * ∫ η, f η * g (ξ - η) ^ 2 := by + have hfg : Integrable (fun η => f η * g (ξ - η) ^ 2) := by + apply (hf.mul_const (K ^ 2)).mono' + (hf.aestronglyMeasurable.mul ((hg.comp (continuous_const.sub continuous_id)).pow 2).aestronglyMeasurable) + filter_upwards [] with η + change ‖f η * g (ξ - η) ^ 2‖ ≤ f η * K ^ 2 + rw [Real.norm_eq_abs, abs_of_nonneg (mul_nonneg (hfp η) (sq_nonneg _))] + exact mul_le_mul_of_nonneg_left + (pow_le_pow_left₀ (hgp _) (hgb _) 2) (hfp η) + exact continuousWeightedCauchySchwarz f (fun η => g (ξ - η)) hf + (hg.comp (continuous_const.sub continuous_id)).aestronglyMeasurable hfp + (fun η => hgp (ξ - η)) hfg + have hmeas : AEStronglyMeasurable (positiveFrequencyConvolution f g) volume := + hf.aestronglyMeasurable.convolution L hg.aestronglyMeasurable + have hint : Integrable (fun ξ => positiveFrequencyConvolution f g ξ ^ 2) := by + apply hmajor.mono' (hmeas.pow 2) + filter_upwards [] with ξ + rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] + exact hpoint ξ + refine ⟨hint, (integral_mono hint hmajor hpoint).trans_eq ?_⟩ + rw [integral_const_mul] + have he := integral_convolution L hf hg2 + change (∫ ξ, ∫ η, f η * g (ξ - η) ^ 2) = (∫ ξ, f ξ) * ∫ ξ, g ξ ^ 2 at he + rw [he] + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingApproximateExistence.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingApproximateExistence.lean new file mode 100644 index 0000000000000000000000000000000000000000..4c1cca9d8865a01fc1a686f13f366b4af4e1d3b2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingApproximateExistence.lean @@ -0,0 +1,117 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingResidualStability + +namespace OAI + +/-! # Exact trajectories in a neighborhood of an approximate mild solution + +The contraction is restricted to a closed ball of paths, so only the actual +local Lipschitz estimate for the polynomial reaction is used. +-/ + +open Set Metric + +namespace DefocusingNLS + +attribute [local irreducible] expandingFreeStep + +theorem expandingMildSolution_initial (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) (u₀ : FourierL2) + (u : C(Icc (0 : ℝ) T, FourierL2)) + (hu : u = expandingPicard a b k L T ha hk hL hT F u₀ u) : + u ⟨0, le_rfl, hT⟩ = u₀ := by + have h := congrArg (fun v : C(Icc (0 : ℝ) T, FourierL2) => v ⟨0, le_rfl, hT⟩) hu + simpa [expandingPicard, expandingDuhamel] using h + +theorem expandingMild_neighborhood_unique (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) (u₀ : FourierL2) + (u v : C(Icc (0 : ℝ) T, FourierL2)) (K : ℝ) (hK : 0 ≤ K) (hTK : T * K < 1) + (hF : ∀ t, ‖F (t, u t) - F (t, v t)‖ ≤ K * ‖u t - v t‖) + (hu : u = expandingPicard a b k L T ha hk hL hT F u₀ u) + (hv : v = expandingPicard a b k L T ha hk hL hT F u₀ v) : u = v := by + have h := expandingPicard_pair_dist_le a b k L T ha hk hL hT F u₀ K hK u v hF + rw [← hu, ← hv] at h + apply dist_eq_zero.mp + nlinarith [dist_nonneg (x := u) (y := v)] + +theorem exists_expandingMild_near_approximation (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) (u₀ : FourierL2) + (v : C(Icc (0 : ℝ) T, FourierL2)) (ρ K ε : ℝ) + (hρ : 0 ≤ ρ) (hK : 0 ≤ K) (hTK : T * K < 1) + (hF : ∀ u ∈ closedBall v ρ, ∀ w ∈ closedBall v ρ, ∀ t, + ‖F (t, u t) - F (t, w t)‖ ≤ K * ‖u t - w t‖) + (hdef : dist v (expandingPicard a b k L T ha hk hL hT F u₀ v) ≤ ε) + (hsmall : ε ≤ (1 - T * K) * ρ) : + ∃ u : C(Icc (0 : ℝ) T, FourierL2), + u = expandingPicard a b k L T ha hk hL hT F u₀ u ∧ + dist u v ≤ ρ ∧ dist u v ≤ ε / (1 - T * K) := by + let P := expandingPicard a b k L T ha hk hL hT F u₀ + have hv : v ∈ closedBall v ρ := by simpa using hρ + have hmap : MapsTo P (closedBall v ρ) (closedBall v ρ) := by + intro u hu + have hp := expandingPicard_pair_dist_le a b k L T ha hk hL hT F u₀ K hK u v + (hF u hu v hv) + have hd : dist u v ≤ ρ := hu + change dist (P u) v ≤ ρ + calc + dist (P u) v ≤ dist (P u) (P v) + dist (P v) v := dist_triangle _ _ _ + _ ≤ T * K * dist u v + ε := add_le_add hp (by simpa only [dist_comm] using hdef) + _ ≤ ρ := by nlinarith [mul_le_mul_of_nonneg_left hd (mul_nonneg hT hK)] + have hcontract : ContractingWith ⟨T * K, mul_nonneg hT hK⟩ + (hmap.restrict P (closedBall v ρ) (closedBall v ρ)) := by + refine ⟨hTK, LipschitzWith.of_dist_le_mul ?_⟩ + intro u w + exact expandingPicard_pair_dist_le a b k L T ha hk hL hT F u₀ K hK u.1 w.1 + (hF u.1 u.2 w.1 w.2) + obtain ⟨u, hu, hfix, _⟩ := hcontract.exists_fixedPoint' + isClosed_closedBall.isComplete hmap hv (edist_ne_top _ _) + have heq : u = P u := hfix.symm + refine ⟨u, heq, hu, ?_⟩ + have hb := expandingMild_residual_stability a b k L T ha hk hL hT F u₀ u₀ + K hK hTK u v (hF u hu v hv) heq ε hdef + simpa only [dist_self, zero_add] using hb + +/-- The local existence radius and Lipschitz constant are independent of the +starting torus scale. The reaction is the actual odd-power nonlinearity. -/ +theorem exists_expandingNonlinear_near_approximation (a b k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) + (R ρ : ℝ) (hR : 0 ≤ R) (hρ : 0 ≤ ρ) : + ∃ K : ℝ, 0 ≤ K ∧ ∀ (L T : ℝ) (hL : 1 ≤ L) (hT : 0 ≤ T), T * K < 1 → + ∀ (v : C(Icc (0 : ℝ) T, FourierL2)), (∀ t, ‖v t‖ ≤ R) → + ∀ (u₀ : FourierL2) (ε : ℝ), + dist v (expandingPicard a b k L T ha hk hL hT + (expandingNonlinearReaction a k L T ha ha1 hk hL m) u₀ v) ≤ ε → + ε ≤ (1 - T * K) * ρ → + ∃ u : C(Icc (0 : ℝ) T, FourierL2), + u = expandingPicard a b k L T ha hk hL hT + (expandingNonlinearReaction a k L T ha ha1 hk hL m) u₀ u ∧ + dist u v ≤ ρ ∧ dist u v ≤ ε / (1 - T * K) := by + obtain ⟨K, hK, hb⟩ := exists_expandingOddPower_lipschitz_on_ball a k ha ha1 hk m + (R + ρ) (add_nonneg hR hρ) + refine ⟨K, hK, ?_⟩ + intro L T hL hT hTK v hv u₀ ε hdef hsmall + apply exists_expandingMild_near_approximation a b k L T ha hk hL hT _ u₀ v + ρ K ε hρ hK hTK _ hdef hsmall + intro u hu w hw t + have hnorm (z : C(Icc (0 : ℝ) T, FourierL2)) (hz : z ∈ closedBall v ρ) : + ‖z t‖ ≤ R + ρ := by + have hd := ContinuousMap.dist_apply_le_dist (f := z) (g := v) t + have hz' : dist z v ≤ ρ := hz + calc + ‖z t‖ ≤ ‖v t‖ + ‖z t - v t‖ := by + have he : v t + (z t - v t) = z t := by abel + simpa only [he] using norm_add_le (v t) (z t - v t) + _ ≤ R + ρ := add_le_add (hv t) (by simpa only [dist_eq_norm] using hd.trans hz') + change ‖(-Complex.I) • expandingOddPower a k (expandingRadiusCurve L T hL t).1 + ha ha1 hk (expandingRadiusCurve L T hL t).2 m (u t) - + (-Complex.I) • expandingOddPower a k (expandingRadiusCurve L T hL t).1 + ha ha1 hk (expandingRadiusCurve L T hL t).2 m (w t)‖ ≤ _ + rw [← smul_sub, norm_smul] + simp only [norm_neg, Complex.norm_I, one_mul] + exact hb _ (expandingRadiusCurve L T hL t).2 _ _ (hnorm u hu) (hnorm w hw) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingApproximationCircular.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingApproximationCircular.lean new file mode 100644 index 0000000000000000000000000000000000000000..67ad08095530fa008ef638ba4e405ac58066ce9b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingApproximationCircular.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingApproximationPower + +namespace OAI + +/-! # Compact approximation of the actual two scalar linearization coefficients -/ + +open Filter Topology + +namespace DefocusingNLS + +variable (a k M : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (hLinf : Tendsto L atTop atTop) + (q : ℕ → FourierL2) (hq : ExpandingCompactApproximation a k ha1 hk L hL q) + (hqb : ∀ n, ‖q n‖ ≤ M) + +include hLinf hq hqb + +theorem ExpandingCompactApproximation.circular (m : ℕ) : + ExpandingCompactApproximation a k ha1 hk L hL + (fun n => expandingCircularCoefficient a k (L n) ha ha1 hk (hL n) (m + 1) (q n)) := by + have hqp := ExpandingCompactApproximation.positivePower a k M ha ha1 hk L hL hLinf q hq hqb m + have hqc := ExpandingCompactApproximation.conjugate a k ha ha1 hk L hL q hq + have hqcb (n : ℕ) : ‖fourierConjugate (q n)‖ ≤ M := by simpa only [fourierConjugate_norm] using hqb n + have hqcp := ExpandingCompactApproximation.positivePower a k M ha ha1 hk L hL hLinf + (fun n => fourierConjugate (q n)) hqc hqcb m + let B := expandingAlgebraBound a k ^ m * M ^ (m + 1) + have hb (n : ℕ) (u : FourierL2) (hu : ‖u‖ ≤ M) : + ‖expandingPower a k (L n) ha ha1 hk (hL n) u (m + 1)‖ ≤ B := + (expandingPower_positive_norm_le a k (L n) ha ha1 hk (hL n) u m).trans + (mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (norm_nonneg _) hu _) + (pow_nonneg (expandingAlgebraBound_nonneg a k) _)) + have hp := ExpandingCompactApproximation.mul a k B ha ha1 hk L hL hLinf _ _ hqp hqcp + (fun n => hb n (q n) (hqb n)) (fun n => hb n (fourierConjugate (q n)) (hqcb n)) + exact ExpandingCompactApproximation.smul a k ha1 hk L hL _ hp (((m + 1 + 1 : ℕ) : ℂ)) + +theorem ExpandingCompactApproximation.anticircular_one : + ExpandingCompactApproximation a k ha1 hk L hL + (fun n => expandingAnticircularCoefficient a k (L n) ha ha1 hk (hL n) 1 (q n)) := by + simpa only [expandingAnticircularCoefficient_one] using + ExpandingCompactApproximation.positivePower a k M ha ha1 hk L hL hLinf q hq hqb 1 + +theorem ExpandingCompactApproximation.anticircular_succ (m : ℕ) : + ExpandingCompactApproximation a k ha1 hk L hL + (fun n => expandingAnticircularCoefficient a k (L n) ha ha1 hk (hL n) (m + 2) (q n)) := by + have hqp := ExpandingCompactApproximation.positivePower a k M ha ha1 hk L hL hLinf q hq hqb (m + 2) + have hqc := ExpandingCompactApproximation.conjugate a k ha ha1 hk L hL q hq + have hqcb (n : ℕ) : ‖fourierConjugate (q n)‖ ≤ M := by simpa only [fourierConjugate_norm] using hqb n + have hqcp := ExpandingCompactApproximation.positivePower a k M ha ha1 hk L hL hLinf + (fun n => fourierConjugate (q n)) hqc hqcb m + let B₁ := expandingAlgebraBound a k ^ (m + 2) * M ^ (m + 2 + 1) + let B₂ := expandingAlgebraBound a k ^ m * M ^ (m + 1) + have hb₁ (n : ℕ) : ‖expandingPower a k (L n) ha ha1 hk (hL n) (q n) (m + 2 + 1)‖ ≤ B₁ := + (expandingPower_positive_norm_le a k (L n) ha ha1 hk (hL n) (q n) (m + 2)).trans + (mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (norm_nonneg _) (hqb n) _) + (pow_nonneg (expandingAlgebraBound_nonneg a k) _)) + have hb₂ (n : ℕ) : ‖expandingPower a k (L n) ha ha1 hk (hL n) (fourierConjugate (q n)) (m + 1)‖ ≤ B₂ := + (expandingPower_positive_norm_le a k (L n) ha ha1 hk (hL n) (fourierConjugate (q n)) m).trans + (mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (norm_nonneg _) (hqcb n) _) + (pow_nonneg (expandingAlgebraBound_nonneg a k) _)) + have hp := ExpandingCompactApproximation.mul a k (max B₁ B₂) ha ha1 hk L hL hLinf _ _ hqp hqcp + (fun n => (hb₁ n).trans (le_max_left _ _)) (fun n => (hb₂ n).trans (le_max_right _ _)) + have hs := ExpandingCompactApproximation.smul a k ha1 hk L hL _ hp ((m + 2 : ℕ) : ℂ) + have he : m + 2 - 1 = m + 1 := by omega + simpa only [expandingAnticircularCoefficient, he] using hs + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingApproximationCoefficients.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingApproximationCoefficients.lean new file mode 100644 index 0000000000000000000000000000000000000000..40d09429e30259a4149f306f0ca786c14a147f4e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingApproximationCoefficients.lean @@ -0,0 +1,31 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingApproximationCircular + +namespace OAI + +/-! # Both actual odd-power coefficients have compact approximations -/ + +open Filter Topology + +namespace DefocusingNLS + +theorem expandingOdd_coefficients_compact (a k Q : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (hLinf : Tendsto L atTop atTop) + (q : ℕ → FourierL2) (hq : ExpandingCompactApproximation a k ha1 hk L hL q) + (hqb : ∀ n, ‖q n‖ ≤ Q) (m : ℕ) (hm : 0 < m) : + ExpandingCompactApproximation a k ha1 hk L hL + (fun n => expandingCircularCoefficient a k (L n) ha ha1 hk (hL n) m (q n)) ∧ + ExpandingCompactApproximation a k ha1 hk L hL + (fun n => expandingAnticircularCoefficient a k (L n) ha ha1 hk (hL n) m (q n)) := by + cases m with + | zero => omega + | succ m => + constructor + · exact ExpandingCompactApproximation.circular a k Q ha ha1 hk L hL hLinf q hq hqb m + · cases m with + | zero => exact ExpandingCompactApproximation.anticircular_one a k Q ha ha1 hk L hL hLinf q hq hqb + | succ m => exact ExpandingCompactApproximation.anticircular_succ a k Q ha ha1 hk L hL hLinf q hq hqb m + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingApproximationLinear.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingApproximationLinear.lean new file mode 100644 index 0000000000000000000000000000000000000000..f49466a0d930cba287a8128afcd0ade4d2ae0d8b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingApproximationLinear.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingCoefficientCompactness +import OAI.MathematicalPhysics.DefocusingNLS.Linear.SchwartzProductSampling + +namespace OAI + +/-! # Scalar multiplication and conjugation preserve compact coefficient approximation -/ + +open Filter Topology +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +variable (a k : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (q : ℕ → FourierL2) + +theorem ExpandingCompactApproximation.smul + (hq : ExpandingCompactApproximation a k ha1 hk L hL q) (c : ℂ) : + ExpandingCompactApproximation a k ha1 hk L hL (fun n => c • q n) := by + intro ε hε + let δ := ε / (‖c‖ + 1) + have hδ : 0 < δ := div_pos hε (by positivity) + obtain ⟨R, K, hK, herr⟩ := hq δ hδ + refine ⟨R, c • K, ?_, ?_⟩ + · intro y hy + simp only [smul_apply, hK y hy, smul_zero] + · have hbound : ‖c‖ * δ < ε := by + have hi : δ * (‖c‖ + 1) = ε := div_mul_cancel₀ _ (by positivity) + nlinarith + filter_upwards [herr] with n hn + have he : schwartzTorusSample a k (L n) ha1 hk (hL n) (radianFourierKernel (c • K)) = + c • schwartzTorusSample a k (L n) ha1 hk (hL n) (radianFourierKernel K) := + (physicalSchwartzTorusSamplingLinear a k (L n) ha1 hk (hL n)).map_smul c K + rw [he, ← smul_sub, norm_smul] + exact (mul_le_mul_of_nonneg_left hn.le (norm_nonneg c)).trans_lt hbound + +include ha in +theorem ExpandingCompactApproximation.conjugate + (hq : ExpandingCompactApproximation a k ha1 hk L hL q) : + ExpandingCompactApproximation a k ha1 hk L hL (fun n => fourierConjugate (q n)) := by + intro ε hε + obtain ⟨R, K, hK, herr⟩ := hq ε hε + refine ⟨R, schwartzPointConjugate K, ?_, ?_⟩ + · intro y hy + simp only [schwartzPointConjugate_apply, hK y hy, map_zero] + · filter_upwards [herr] with n hn + rw [← schwartzTorusSample_conjugate a k (L n) ha ha1 hk (hL n)] + change ‖sobolevConjugation (q n) - sobolevConjugation _‖ < ε + rw [← map_sub, sobolevConjugation_apply, fourierConjugate_norm] + exact hn + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingApproximationPower.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingApproximationPower.lean new file mode 100644 index 0000000000000000000000000000000000000000..d512ff766df1873d82cfd8313141b8a3965c8106 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingApproximationPower.lean @@ -0,0 +1,32 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingApproximationProduct +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPositivePower + +namespace OAI + +/-! # Positive powers preserve compact coefficient approximation -/ + +open Filter Topology + +namespace DefocusingNLS + +theorem ExpandingCompactApproximation.positivePower (a k M : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (hLinf : Tendsto L atTop atTop) + (q : ℕ → FourierL2) (hq : ExpandingCompactApproximation a k ha1 hk L hL q) + (hqb : ∀ n, ‖q n‖ ≤ M) (p : ℕ) : + ExpandingCompactApproximation a k ha1 hk L hL + (fun n => expandingPower a k (L n) ha ha1 hk (hL n) (q n) (p + 1)) := by + induction p with + | zero => simpa only [zero_add, expandingPower_one] using hq + | succ p ih => + let B := expandingAlgebraBound a k ^ p * M ^ (p + 1) + have hpb (n : ℕ) : ‖expandingPower a k (L n) ha ha1 hk (hL n) (q n) (p + 1)‖ ≤ B := + (expandingPower_positive_norm_le a k (L n) ha ha1 hk (hL n) (q n) p).trans + (mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (norm_nonneg _) (hqb n) (p + 1)) + (pow_nonneg (expandingAlgebraBound_nonneg a k) p)) + exact ExpandingCompactApproximation.mul a k (max M B) ha ha1 hk L hL hLinf q _ hq ih + (fun n => (hqb n).trans (le_max_left _ _)) (fun n => (hpb n).trans (le_max_right _ _)) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingApproximationProduct.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingApproximationProduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..2f21c38784dcd46da2d0f7ea4f7e004bc08f292b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingApproximationProduct.lean @@ -0,0 +1,69 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingApproximationLinear +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProductDifference + +namespace OAI + +/-! # Compact coefficient approximation is preserved by the actual torus product -/ + +open Filter Topology +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem ExpandingCompactApproximation.mul (a k M : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (hLinf : Tendsto L atTop atTop) + (q r : ℕ → FourierL2) (hq : ExpandingCompactApproximation a k ha1 hk L hL q) + (hr : ExpandingCompactApproximation a k ha1 hk L hL r) + (hqb : ∀ n, ‖q n‖ ≤ M) (hrb : ∀ n, ‖r n‖ ≤ M) : + ExpandingCompactApproximation a k ha1 hk L hL + (fun n => expandingProduct a k (L n) ha ha1 hk (hL n) (q n) (r n)) := by + have hM : 0 ≤ M := (norm_nonneg (q 0)).trans (hqb 0) + let A := expandingAlgebraBound a k + have hA : 0 ≤ A := expandingAlgebraBound_nonneg a k + let C := A * (2 * M + 1) + have hC : 0 ≤ C := by dsimp [C]; positivity + intro ε hε + let δ := min 1 (ε / (C + 1)) + have hδ : 0 < δ := lt_min (by norm_num) (div_pos hε (by positivity)) + have hδ1 : δ ≤ 1 := min_le_left _ _ + have hδε : δ * (C + 1) ≤ ε := (le_div_iff₀ (by positivity : 0 < C + 1)).mp (min_le_right _ _) + obtain ⟨R, K, hK, heq⟩ := hq δ hδ + obtain ⟨S, J, hJ, her⟩ := hr δ hδ + let T := max R S + have hKT : ∀ y : E, T < ‖y‖ → K y = 0 := fun y hy => hK y ((le_max_left R S).trans_lt hy) + have hJT : ∀ y : E, T < ‖y‖ → J y = 0 := fun y hy => hJ y ((le_max_right R S).trans_lt hy) + refine ⟨T, SchwartzMap.smulLeftCLM ℂ K J, ?_, ?_⟩ + · intro y hy + rw [SchwartzMap.smulLeftCLM_apply_apply K.hasTemperateGrowth, hKT y hy, zero_smul] + · filter_upwards [heq, her, hLinf.eventually (eventually_ge_atTop T)] with n hnq hnr hnL + have hsep : 2 * T < 2 * Real.pi * L n := calc + 2 * T ≤ 2 * L n := mul_le_mul_of_nonneg_left hnL (by norm_num) + _ < 2 * Real.pi * L n := mul_lt_mul_of_pos_right + (by linarith [Real.pi_gt_three] : (2 : ℝ) < 2 * Real.pi) (by linarith [hL n]) + rw [← schwartzTorusSample_product a k (L n) T ha ha1 hk (hL n) hsep K J hKT hJT] + have hKB : ‖schwartzTorusSample a k (L n) ha1 hk (hL n) (radianFourierKernel K)‖ ≤ M + 1 := by + calc + _ ≤ ‖schwartzTorusSample a k (L n) ha1 hk (hL n) (radianFourierKernel K) - q n‖ + ‖q n‖ := + norm_le_norm_sub_add _ _ + _ ≤ δ + M := add_le_add (by rw [norm_sub_rev]; exact hnq.le) (hqb n) + _ ≤ M + 1 := by linarith + have hb := expandingProduct_difference_norm a k (L n) ha ha1 hk (hL n) (q n) (r n) + (schwartzTorusSample a k (L n) ha1 hk (hL n) (radianFourierKernel K)) + (schwartzTorusSample a k (L n) ha1 hk (hL n) (radianFourierKernel J)) + calc + _ ≤ A * (‖q n - schwartzTorusSample a k (L n) ha1 hk (hL n) (radianFourierKernel K)‖ * ‖r n‖ + + ‖schwartzTorusSample a k (L n) ha1 hk (hL n) (radianFourierKernel K)‖ * + ‖r n - schwartzTorusSample a k (L n) ha1 hk (hL n) (radianFourierKernel J)‖) := hb + _ ≤ A * (δ * M + (M + 1) * δ) := + mul_le_mul_of_nonneg_left (add_le_add + (mul_le_mul hnq.le (hrb n) (norm_nonneg _) hδ.le) + (mul_le_mul hKB hnr.le (norm_nonneg _) (by linarith))) hA + _ = C * δ := by dsimp [C]; ring + _ < ε := by nlinarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingBallScalar.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingBallScalar.lean new file mode 100644 index 0000000000000000000000000000000000000000..b07d1377a3fe3a8652ed11f9956d9315f735a577 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingBallScalar.lean @@ -0,0 +1,34 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFilteredLimit +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingEvaluation + +namespace OAI + +/-! # Scalar multiplication and pointwise bounds for physical ball observations -/ + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem expandingPhysicalBall_smul (a k L R : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (c : ℝ) (f : FourierL2) : + expandingPhysicalBall a k L R ha ha1 hk hL (c • f) = + c • expandingPhysicalBall a k L R ha ha1 hk hL f := by + ext y + simp only [expandingPhysicalBall_apply, ContinuousMap.smul_apply] + rw [expandingTorusFunction_eq_evaluation a k L ha ha1 hk hL, + expandingTorusFunction_eq_evaluation a k L ha ha1 hk hL] + exact ((expandingPointEvaluation a k L ha ha1 hk hL _).restrictScalars ℝ).map_smul c f + +theorem expandingPhysicalBall_point_le (a k L R : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (f : FourierL2) (y : E) (hy : ‖y‖ ≤ R) : + ‖expandingTorusFunction a k L f (euclideanToTorus (L⁻¹ • y))‖ ≤ + ‖expandingPhysicalBall a k L R ha ha1 hk hL f‖ := by + let x : Metric.closedBall (0 : E) R := ⟨y, by simpa using hy⟩ + simpa only [expandingPhysicalBall_apply] using + ContinuousMap.norm_coe_le_norm (expandingPhysicalBall a k L R ha ha1 hk hL f) x + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingBielecki.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingBielecki.lean new file mode 100644 index 0000000000000000000000000000000000000000..625c1ddf6f2d9a945a89b97b2153b9a77ed04c44 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingBielecki.lean @@ -0,0 +1,143 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingWeightedDuhamel +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingMildContraction + +namespace OAI + +/-! # The moving-scale mild equation on arbitrary finite slabs + +An exponential time weight makes the Picard map contract with constant +`K / (K + 1)` on every finite interval. Thus the permitted slab length is +independent of the initial radius and requires no a priori small-time bound. +-/ + +open Set MeasureTheory + +namespace DefocusingNLS + +attribute [local irreducible] expandingFreeStep + +noncomputable def expandingTimeWeight (T η : ℝ) + (u : C(Icc (0 : ℝ) T, FourierL2)) : C(Icc (0 : ℝ) T, FourierL2) where + toFun t := Real.exp (η * t) • u t + continuous_toFun := + (Real.continuous_exp.comp (continuous_const.mul continuous_subtype_val)).smul u.continuous + +@[simp] theorem expandingTimeWeight_cancel (T η : ℝ) + (u : C(Icc (0 : ℝ) T, FourierL2)) : + expandingTimeWeight T η (expandingTimeWeight T (-η) u) = u := by + apply ContinuousMap.ext + intro t + change Real.exp (η * t) • (Real.exp (-η * t) • u t) = u t + rw [smul_smul, ← Real.exp_add, show η * (t : ℝ) + -η * t = 0 by ring, Real.exp_zero, one_smul] + +noncomputable def expandingBieleckiHistory (T η : ℝ) (hT : 0 ≤ T) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) + (u : C(Icc (0 : ℝ) T, FourierL2)) : ℝ → FourierL2 := + expandingReactionHistory T hT F (expandingTimeWeight T η u) + +theorem continuous_expandingBieleckiHistory (T η : ℝ) (hT : 0 ≤ T) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) + (u : C(Icc (0 : ℝ) T, FourierL2)) : + Continuous (expandingBieleckiHistory T η hT F u) := + continuous_expandingReactionHistory T hT F _ + +noncomputable def expandingBieleckiPicard (a b k L T η : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) (u₀ : FourierL2) + (u : C(Icc (0 : ℝ) T, FourierL2)) : C(Icc (0 : ℝ) T, FourierL2) := + expandingTimeWeight T (-η) + (expandingPicard a b k L T ha hk hL hT F u₀ (expandingTimeWeight T η u)) + +/-- The weighted Picard bound is independent of both radius and slab length. -/ +theorem expandingBieleckiPicard_dist_le (a b k L T η : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) (hη : 0 < η) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) (u₀ : FourierL2) + (K : ℝ) (hK : 0 ≤ K) + (hF : ∀ t x y, ‖F (t, x) - F (t, y)‖ ≤ K * ‖x - y‖) + (u v : C(Icc (0 : ℝ) T, FourierL2)) : + dist (expandingBieleckiPicard a b k L T η ha hk hL hT F u₀ u) + (expandingBieleckiPicard a b k L T η ha hk hL hT F u₀ v) ≤ K / η * dist u v := by + apply (ContinuousMap.dist_le (mul_nonneg (div_nonneg hK hη.le) dist_nonneg)).2 + intro t + let ru := expandingBieleckiHistory T η hT F u + let rv := expandingBieleckiHistory T η hT F v + have hru : Continuous ru := continuous_expandingBieleckiHistory T η hT F u + have hrv : Continuous rv := continuous_expandingBieleckiHistory T η hT F v + have hbound : ∀ τ ∈ Icc (0 : ℝ) t, ‖ru τ - rv τ‖ ≤ (K * dist u v) * Real.exp (η * τ) := by + intro τ hτ + let τ' : Icc (0 : ℝ) T := ⟨τ, hτ.1, hτ.2.trans t.2.2⟩ + have hτT : τ ∈ Icc 0 T := τ'.2 + change ‖F (projIcc 0 T hT τ, _) - F (projIcc 0 T hT τ, _)‖ ≤ _ + have hnorm : ‖expandingTimeWeight T η u (projIcc 0 T hT τ) - + expandingTimeWeight T η v (projIcc 0 T hT τ)‖ ≤ + Real.exp (η * τ) * dist u v := by + rw [projIcc_of_mem _ hτT] + change ‖Real.exp (η * τ) • u τ' - Real.exp (η * τ) • v τ'‖ ≤ _ + rw [← smul_sub, norm_smul, Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)] + exact mul_le_mul_of_nonneg_left + (by simpa only [dist_eq_norm] using (ContinuousMap.dist_apply_le_dist (f := u) (g := v) τ')) + (Real.exp_pos _).le + calc + _ ≤ K * ‖expandingTimeWeight T η u (projIcc 0 T hT τ) - + expandingTimeWeight T η v (projIcc 0 T hT τ)‖ := hF _ _ _ + _ ≤ K * (Real.exp (η * τ) * dist u v) := mul_le_mul_of_nonneg_left hnorm hK + _ = _ := by ring + have hb := expandingDuhamel_weighted_norm_le a b k L η t (K * dist u v) + ha hk hL hη t.2.1 (mul_nonneg hK dist_nonneg) (fun τ => ru τ - rv τ) hbound + change dist + (Real.exp (-η * t) • (expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t ru)) + (Real.exp (-η * t) • (expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t rv)) ≤ _ + rw [dist_eq_norm, ← smul_sub, add_sub_add_left_eq_sub, norm_smul, Real.norm_eq_abs, + abs_of_pos (Real.exp_pos _), + ← expandingDuhamel_sub a b k L ha hk hL t ru rv hru.continuousOn hrv.continuousOn] + calc + _ ≤ (K * dist u v) / η := hb + _ = _ := by ring + +/-- Globally Lipschitz continuous reactions have a unique moving-scale mild solution +on every finite slab. In particular, the actual bounded linearized potential does. -/ +theorem existsUnique_expandingMildSolution_finiteSlab (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) (u₀ : FourierL2) + (K : ℝ) (hK : 0 ≤ K) + (hF : ∀ t x y, ‖F (t, x) - F (t, y)‖ ≤ K * ‖x - y‖) : + ∃! u : C(Icc (0 : ℝ) T, FourierL2), ∀ t : Icc (0 : ℝ) T, + u t = expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t (expandingReactionHistory T hT F u) := by + let η := K + 1 + have hη : 0 < η := by dsimp [η]; linarith + have hKl : 0 ≤ K / η := div_nonneg hK hη.le + have hKl' : K / η < 1 := (div_lt_one hη).2 (by dsimp [η]; linarith) + let P := expandingBieleckiPicard a b k L T η ha hk hL hT F u₀ + have hP : ContractingWith ⟨K / η, hKl⟩ P := + ⟨hKl', LipschitzWith.of_dist_le_mul + (expandingBieleckiPicard_dist_le a b k L T η ha hk hL hT hη F u₀ K hK hF)⟩ + let v := hP.fixedPoint P + have hv : P v = v := hP.fixedPoint_isFixedPt + let u := expandingTimeWeight T η v + refine ⟨u, ?_, ?_⟩ + · intro t + have he := congrArg (fun f : C(Icc (0 : ℝ) T, FourierL2) => expandingTimeWeight T η f t) hv + change u t = expandingPicard a b k L T ha hk hL hT F u₀ u t + simpa only [P, expandingBieleckiPicard, expandingTimeWeight_cancel, u] using he.symm + · intro w hw + let z := expandingTimeWeight T (-η) w + have hz : Function.IsFixedPt P z := by + apply ContinuousMap.ext + intro t + change Real.exp (-η * t) • + (expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t + (expandingReactionHistory T hT F (expandingTimeWeight T η z))) = z t + rw [show expandingTimeWeight T η z = w from expandingTimeWeight_cancel T η w] + rw [← hw t] + rfl + have he : z = v := hP.fixedPoint_unique hz + have h := congrArg (expandingTimeWeight T η) he + simpa only [z, expandingTimeWeight_cancel, u] using h + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingBlowupClock.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingBlowupClock.lean new file mode 100644 index 0000000000000000000000000000000000000000..a29fcce4ba599a06925b72bebd2ad9aa54849394 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingBlowupClock.lean @@ -0,0 +1,97 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingBlowupObservation + +namespace OAI + +/-! # The exact rescaled pointwise limit in physical time -/ + +open Filter Topology + +namespace DefocusingNLS + +theorem expanding_clock_denominator_pos_of_lt (L t : ℝ) (hL : 0 < L) + (ht : t < L ^ (-2 : ℝ)) : 0 < 1 - L ^ 2 * t := by + have hT : 0 < L ^ (-2 : ℝ) := Real.rpow_pos_of_pos hL _ + have hc : L ^ (-2 : ℝ) * L ^ 2 = 1 := by + rw [← Real.rpow_two, ← Real.rpow_add hL] + norm_num + have he : L ^ (-2 : ℝ) - t = L ^ (-2 : ℝ) * (1 - L ^ 2 * t) := by + calc + _ = L ^ (-2 : ℝ) - (L ^ (-2 : ℝ) * L ^ 2) * t := by rw [hc, one_mul] + _ = _ := by ring + have hp : 0 < L ^ (-2 : ℝ) - t := sub_pos.mpr ht + rw [he] at hp + exact (mul_pos_iff_of_pos_left hT).mp hp + +theorem expandingInverseClock_nonneg (L t : ℝ) (hL : 0 < L) + (ht : t ∈ Set.Ico 0 (L ^ (-2 : ℝ))) : 0 ≤ expandingInverseClock L t := by + unfold expandingInverseClock + apply neg_nonneg.mpr + exact Real.log_nonpos (expanding_clock_denominator_pos_of_lt L t hL ht.2).le + (by nlinarith [mul_nonneg (sq_nonneg L) ht.1]) + +theorem expandingInverseClock_eq_similarityTime (L t : ℝ) (hL : 0 < L) + (ht : t < L ^ (-2 : ℝ)) : + expandingInverseClock L t = similarityTime (L ^ (-2 : ℝ)) t := by + have hT : 0 < L ^ (-2 : ℝ) := Real.rpow_pos_of_pos hL _ + have hc : L ^ (-2 : ℝ) * L ^ 2 = 1 := by + rw [← Real.rpow_two, ← Real.rpow_add hL] + norm_num + have he : L ^ (-2 : ℝ) - t = L ^ (-2 : ℝ) * (1 - L ^ 2 * t) := by + calc + _ = L ^ (-2 : ℝ) - (L ^ (-2 : ℝ) * L ^ 2) * t := by rw [hc, one_mul] + _ = _ := by ring + have hb : 0 < 1 - L ^ 2 * t := + (mul_pos_iff_of_pos_left hT).mp (he ▸ sub_pos.mpr ht) + have hratio : L ^ (-2 : ℝ) / (L ^ (-2 : ℝ) - t) = (1 - L ^ 2 * t)⁻¹ := by + rw [he] + field_simp [hT.ne', hb.ne'] + rw [expandingInverseClock, similarityTime, hratio, Real.log_inv] + +theorem expandingInverseClock_tendsto (L : ℝ) (hL : 0 < L) : + Tendsto (expandingInverseClock L) (𝓝[<] (L ^ (-2 : ℝ))) atTop := by + apply (similarityTime_tendsto (L ^ (-2 : ℝ)) (Real.rpow_pos_of_pos hL _)).congr' + filter_upwards [self_mem_nhdsWithin] with t ht + exact (expandingInverseClock_eq_similarityTime L t hL ht).symm + +theorem expanding_rescaled_amplitude (a b L s : ℝ) (hL : 0 < L) : + (L ^ (-2 : ℝ) - expandingFreeTime L s) ^ a * + ‖expandingPhysicalAmplitude a b L s‖ = 1 := by + have he : L ^ (-2 : ℝ) - expandingFreeTime L s = L ^ (-2 : ℝ) * Real.exp (-s) := by + unfold expandingFreeTime + ring + have hp : (L ^ (-2 : ℝ)) ^ a * L ^ (2 * a) = 1 := by + rw [← Real.rpow_mul hL.le, ← Real.rpow_add hL] + rw [show (-2 : ℝ) * a + 2 * a = 0 by ring, Real.rpow_zero] + rw [he, expandingPhysicalAmplitude_norm a b L s hL, + Real.mul_rpow (Real.rpow_nonneg hL.le _) (Real.exp_pos _).le, ← Real.exp_mul] + calc + _ = ((L ^ (-2 : ℝ)) ^ a * L ^ (2 * a)) * + (Real.exp (-s * a) * Real.exp (a * s)) := by ring + _ = 1 := by + rw [hp, ← Real.exp_add, show -s * a + a * s = 0 by ring, Real.exp_zero, one_mul] + +theorem expanding_rescaled_observation (a b L t : ℝ) (hL : 0 < L) + (ht : t < L ^ (-2 : ℝ)) (z : ℂ) : + (L ^ (-2 : ℝ) - t) ^ a * + ‖expandingPhysicalAmplitude a b L (expandingInverseClock L t) * z‖ = ‖z‖ := by + have hd := expanding_clock_denominator_pos_of_lt L t hL ht + have h := expanding_rescaled_amplitude a b L (expandingInverseClock L t) hL + rw [expandingFreeTime_inverseClock L t hL hd] at h + rw [norm_mul, ← mul_assoc, h, one_mul] + +/-- The rescaled modulus limit required in the main theorem follows from +the similarity observation limit. -/ +theorem expanding_rescaled_observation_limit (a b L : ℝ) (hL : 0 < L) + (g : ℝ → ℂ) (c : ℂ) (hg : Tendsto g atTop (𝓝 c)) : + Tendsto (fun t => (L ^ (-2 : ℝ) - t) ^ a * + ‖expandingPhysicalAmplitude a b L (expandingInverseClock L t) * + g (expandingInverseClock L t)‖) + (𝓝[<] (L ^ (-2 : ℝ))) (𝓝 ‖c‖) := by + have h := (hg.comp (expandingInverseClock_tendsto L hL)).norm + apply h.congr' + filter_upwards [self_mem_nhdsWithin] with t ht + exact (expanding_rescaled_observation a b L t hL ht _).symm + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingBlowupObservation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingBlowupObservation.lean new file mode 100644 index 0000000000000000000000000000000000000000..dc6e83f08c468032c3eb30f9ceb8b20236b59141 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingBlowupObservation.lean @@ -0,0 +1,93 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPhysicalTrajectory +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.CutoffApproximateMode +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.SimilarityLimit + +namespace OAI + +/-! # Point observations of the actual similarity perturbation + +The center of the sampled cutoff profile equals `Q 0` exactly. The uniform +expanding-space evaluation bound therefore transfers norm decay to the +pointwise convergence required by the manuscript's final blowup statement. +-/ + +open Filter Topology +open scoped SchwartzMap ContDiff + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem expandingInverseTransfer_function (a k R : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hR : 1 ≤ R) (f : FourierL2) : + expandingTorusFunction a k 1 (expandingInverseTransfer a k R ha hk hR f) = + expandingTorusFunction a k R f := by + have he : expandingScaleTransfer a k 1 R ha hk le_rfl hR + (expandingInverseTransfer a k R ha hk hR f) = f := + congrArg (fun A : FourierL2 →L[ℂ] FourierL2 => A f) + (expandingWeightUnit a k R ha hk hR).val_inv + have h := expandingScaleTransfer_function a k 1 R ha ha1 hk le_rfl hR + (expandingInverseTransfer a k R ha hk hR f) + rw [he] at h + exact h.symm + +theorem expandingSobolev_observation (a k R : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hR : 1 ≤ R) + (f : FourierL2) (x : SchrodingerTorus) : + sobolevTorusFunction k + (expandingToSobolev a k ha1 hk (expandingInverseTransfer a k R ha hk hR f)) x = + expandingTorusFunction a k R f x := by + rw [sobolevTorusFunction_expandingToSobolev a k ha ha1 hk, + expandingInverseTransfer_function a k R ha ha1 hk hR] + +theorem sampledCutoffProfile_center (a k R : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hR : 1 ≤ R) + (χ : 𝓢(E, ℝ)) (hχ : HasCompactSupport (χ : E → ℝ)) + (hχone : ∀ x : E, ‖x‖ < 1 / 2 → χ x = 1) + (hχzero : ∀ x : E, 2 < ‖x‖ → χ x = 0) + (Q : E → ℂ) (hQ : ContDiff ℝ ∞ Q) : + expandingTorusFunction a k R (schwartzTorusSample a k R ha1 hk hR + (radianFourierKernel (cutoffProfileSchwartz R (by linarith) + (χ.postcompCLM Complex.ofRealCLM) (hasCompactSupport_complexCutoff χ hχ) Q hQ))) 0 = Q 0 := by + have h := schwartzTorusSample_eq_on_ball a k R ha ha1 hk hR + (cutoffProfileSchwartz R (by linarith) (χ.postcompCLM Complex.ofRealCLM) + (hasCompactSupport_complexCutoff χ hχ) Q hQ) + (cutoffProfileSchwartz_zero_outside R (by linarith) χ hχ hχzero Q hQ) + (0 : E) (by simpa using (zero_le_one.trans hR)) + have hχ0 : χ 0 = 1 := hχone 0 (by norm_num) + have hz : euclideanToTorus (0 : E) = 0 := by + ext j + simp [euclideanToTorus] + simpa [hz, cutoffProfileSchwartz_apply, hχ0] using h + +theorem expanding_observation_difference_le (a k R : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hR : 1 ≤ R) + (f g : FourierL2) (x : SchrodingerTorus) : + ‖expandingTorusFunction a k R f x - expandingTorusFunction a k R g x‖ ≤ + expandingEmbeddingBound a k * ‖f - g‖ := by + rw [expandingTorusFunction_eq_evaluation a k R ha ha1 hk hR, + expandingTorusFunction_eq_evaluation a k R ha ha1 hk hR, ← map_sub] + exact (expandingPointEvaluation a k R ha ha1 hk hR x).le_opNorm (f - g) |>.trans + (mul_le_mul_of_nonneg_right (expandingPointEvaluation_norm_le a k R ha ha1 hk hR x) + (norm_nonneg _)) + +/-- Decay of the similarity perturbation determines the limiting point observation. -/ +theorem expanding_observation_tendsto_of_norm_decay (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (u q : ℝ → FourierL2) (x : SchrodingerTorus) (c : ℂ) + (hq : ∀ s, 0 ≤ s → expandingTorusFunction a k (expandingRadius L s) (q s) x = c) + (hdecay : Tendsto (fun s => ‖u s - q s‖) atTop (𝓝 0)) : + Tendsto (fun s => expandingTorusFunction a k (expandingRadius L s) (u s) x) + atTop (𝓝 c) := by + apply tendsto_iff_norm_sub_tendsto_zero.mpr + have hlim : Tendsto (fun s => expandingEmbeddingBound a k * ‖u s - q s‖) atTop (𝓝 0) := by + simpa using hdecay.const_mul (expandingEmbeddingBound a k) + apply squeeze_zero' (Eventually.of_forall (fun _ => norm_nonneg _)) _ hlim + filter_upwards [eventually_ge_atTop (0 : ℝ)] with s hs + rw [← hq s hs] + exact expanding_observation_difference_le a k (expandingRadius L s) ha ha1 hk + (hL.trans (expandingRadius_ge L s hL hs)) (u s) (q s) x + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingBlowupTransfer.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingBlowupTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..22e7797ead30eecf8e50c299d226a4b0ec340267 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingBlowupTransfer.lean @@ -0,0 +1,101 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingBlowupClock + +namespace OAI + +/-! # From a decaying similarity perturbation to a finite maximal endpoint + +A decaying similarity perturbation gives an unbounded physical point +observation as the physical time approaches its finite endpoint. +-/ + +open Filter Topology Set + +namespace DefocusingNLS + +theorem expandingSchrodingerTrajectory_observation (a b k L S : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hS : 0 ≤ S) + (u : C(Icc (0 : ℝ) S, FourierL2)) (t : ℝ) + (ht : t ∈ Icc 0 (expandingFreeTime L S)) (x : SchrodingerTorus) : + sobolevTorusFunction k (expandingSchrodingerTrajectory a b k L S ha ha1 hk hL hS u t) x = + expandingPhysicalAmplitude a b L (expandingInverseClock L t) * + expandingTorusFunction a k (expandingRadius L (expandingInverseClock L t)) + (u ⟨expandingInverseClock L t, + expandingInverseClock_mem_Icc L S t (by linarith) ht⟩) x := by + let s := expandingInverseClock L t + have hs : s ∈ Icc 0 S := expandingInverseClock_mem_Icc L S t (by linarith) ht + have hR : 1 ≤ expandingRadius L s := hL.trans (expandingRadius_ge L s hL hs.1) + change sobolevTorusFunction k + (expandingPhysicalAmplitude a b L s • expandingToSobolev a k ha1 hk + (expandingPhysicalPath a k L S ha hk hL u (projIcc 0 S hS s))) x = _ + rw [projIcc_of_mem _ hs] + calc + _ = expandingPhysicalAmplitude a b L s * sobolevTorusFunction k + (expandingToSobolev a k ha1 hk + (expandingPhysicalPath a k L S ha hk hL u ⟨s, hs⟩)) x := by + simp only [sobolevTorusFunction_apply k (by linarith), map_smul, smul_eq_mul] + _ = _ := by + congr 1 + change sobolevTorusFunction k (expandingToSobolev a k ha1 hk + (expandingInverseTransfer a k (expandingRadius L s) ha hk hR (u ⟨s, hs⟩))) x = _ + exact expandingSobolev_observation a k (expandingRadius L s) ha ha1 hk hR _ x + +theorem expanding_profile_rescaled_limit (a b k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (u q : ℝ → FourierL2) (x : SchrodingerTorus) (c : ℂ) + (hq : ∀ s, 0 ≤ s → expandingTorusFunction a k (expandingRadius L s) (q s) x = c) + (hdecay : Tendsto (fun s => ‖u s - q s‖) atTop (𝓝 0)) : + Tendsto (fun t => (L ^ (-2 : ℝ) - t) ^ a * + ‖expandingPhysicalAmplitude a b L (expandingInverseClock L t) * + expandingTorusFunction a k (expandingRadius L (expandingInverseClock L t)) + (u (expandingInverseClock L t)) x‖) + (𝓝[<] (L ^ (-2 : ℝ))) (𝓝 ‖c‖) := by + let g : ℝ → ℂ := fun s => + expandingTorusFunction a k (expandingRadius L s) (u s) x + have hg : Tendsto g atTop (𝓝 c) := + expanding_observation_tendsto_of_norm_decay a k L ha ha1 hk hL u q x c hq hdecay + exact expanding_rescaled_observation_limit a b L (by linarith) g c hg + +/-- The forward maximal-flow formulation only needs existence on `[0,T)`. +Continuity of the observation excludes the endpoint itself. -/ +theorem maximalSobolev_lifespan_of_forward_rescaled_observation + {F : Type*} [NormedAddCommGroup F] + (k : ℝ) (hk : 6 < k) (m : ℕ) (f₀ : FourierL2) + (T β c : ℝ) (hT : 0 < T) (hβ : 0 < β) (hc : 0 < c) + (hsub : Ico 0 T ⊆ maximalSobolevInteractionDomain k hk m f₀) + (observe : FourierL2 → F) (hobs : Continuous observe) + (hblowup : Tendsto (fun t => (T - t) ^ β * + ‖observe (maximalSobolevSchrodingerFlow k hk m f₀ t)‖) (𝓝[<] T) (𝓝 c)) : + BddAbove (maximalSobolevInteractionDomain k hk m f₀) ∧ + sSup (maximalSobolevInteractionDomain k hk m f₀) = T := by + have hnot : T ∉ maximalSobolevInteractionDomain k hk m f₀ := by + intro hmem + have hcont := (continuousOn_maximalSobolevSchrodingerFlow k hk m f₀ T hmem).continuousAt + ((isOpen_maximalSobolevInteractionDomain k hk m f₀).mem_nhds hmem) + have hlim := hobs.continuousAt.tendsto.comp + (hcont.tendsto.mono_left (nhdsWithin_le_nhds : 𝓝[<] T ≤ 𝓝 T)) + exact no_left_limit_of_positive_rescaled_norm + (fun t => observe (maximalSobolevSchrodingerFlow k hk m f₀ t)) T β c hβ hc hblowup ⟨_, hlim⟩ + have hbound : ∀ t ∈ maximalSobolevInteractionDomain k hk m f₀, t ≤ T := by + intro t ht + by_contra hn + apply hnot + exact (isPreconnected_maximalSobolevInteractionDomain k hk m f₀).Icc_subset + (zero_mem_maximalSobolevInteractionDomain k hk m f₀) ht ⟨hT.le, (lt_of_not_ge hn).le⟩ + refine ⟨⟨T, hbound⟩, ?_⟩ + apply csSup_eq_of_forall_le_of_forall_lt_exists_gt + ⟨0, zero_mem_maximalSobolevInteractionDomain k hk m f₀⟩ hbound + intro r hr + let s := (max 0 r + T) / 2 + have hs : s ∈ Ico 0 T := by + have hm := le_max_left (0 : ℝ) r + have hM := max_lt hT hr + dsimp [s] + constructor <;> linarith + refine ⟨s, hsub hs, ?_⟩ + have hm := le_max_right (0 : ℝ) r + dsimp [s] + linarith [max_lt hT hr] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCircularMoment.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCircularMoment.lean new file mode 100644 index 0000000000000000000000000000000000000000..ed2e24c609f134183b62fd58f30c65524c4a4764 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCircularMoment.lean @@ -0,0 +1,82 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPolynomialMoment + +namespace OAI + +/-! # Quantitative moments of both circular coefficients -/ + +namespace DefocusingNLS + +attribute [local irreducible] expandingPower expandingProduct expandingFourierCoefficient + expandingCircularCoefficient expandingAnticircularCoefficient fourierConjugate + +variable (a k L : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (N m : ℕ) + + theorem expandingCircular_moment (q : FourierL2) + (hq : Summable (latticeMomentMass L N (expandingFourierCoefficient a k L q))) : + let M := ∑' n, latticeMomentMass L N (expandingFourierCoefficient a k L q) n + Summable (latticeMomentMass L N (expandingFourierCoefficient a k L + (expandingCircularCoefficient a k L ha ha1 hk hL m q))) ∧ + (∑' n, latticeMomentMass L N (expandingFourierCoefficient a k L + (expandingCircularCoefficient a k L ha ha1 hk hL m q)) n) ≤ + (m + 1 : ℕ) * (M ^ m * M ^ m) := by + intro M + have hconj := expandingConjugate_moment a k L N q hq + have hp := expandingPower_moment a k L ha ha1 hk hL N q hq m + have hp' := expandingPower_moment a k L ha ha1 hk hL N (fourierConjugate q) hconj.1 m + rw [hconj.2] at hp' + have hprod := expandingProduct_moment a k L ha ha1 hk hL N + (expandingPower a k L ha ha1 hk hL q m) + (expandingPower a k L ha ha1 hk hL (fourierConjugate q) m) hp.1 hp'.1 + have hc := expandingScalar_moment a k L N ((m + 1 : ℕ) : ℂ) + (expandingProduct a k L ha ha1 hk hL + (expandingPower a k L ha ha1 hk hL q m) + (expandingPower a k L ha ha1 hk hL (fourierConjugate q) m)) hprod.1 + rw [expandingCircularCoefficient] + refine ⟨hc.1, ?_⟩ + rw [hc.2] + have hM : 0 ≤ M := tsum_nonneg (fun n => mul_nonneg + (le_trans zero_le_one (latticeMomentWeight_one_le L hL N n)) (norm_nonneg _)) + calc + _ ≤ ‖((m + 1 : ℕ) : ℂ)‖ * (M ^ m * M ^ m) := by + apply mul_le_mul_of_nonneg_left (hprod.2.trans ?_) (norm_nonneg _) + exact mul_le_mul hp.2 hp'.2 + (tsum_nonneg (fun n => mul_nonneg (le_trans zero_le_one (latticeMomentWeight_one_le L hL N n)) (norm_nonneg _))) + (pow_nonneg hM m) + _ = _ := by rw [Complex.norm_natCast] + + theorem expandingAnticircular_moment (q : FourierL2) + (hq : Summable (latticeMomentMass L N (expandingFourierCoefficient a k L q))) : + let M := ∑' n, latticeMomentMass L N (expandingFourierCoefficient a k L q) n + Summable (latticeMomentMass L N (expandingFourierCoefficient a k L + (expandingAnticircularCoefficient a k L ha ha1 hk hL m q))) ∧ + (∑' n, latticeMomentMass L N (expandingFourierCoefficient a k L + (expandingAnticircularCoefficient a k L ha ha1 hk hL m q)) n) ≤ + (m : ℝ) * (M ^ (m + 1) * M ^ (m - 1)) := by + intro M + have hconj := expandingConjugate_moment a k L N q hq + have hp := expandingPower_moment a k L ha ha1 hk hL N q hq (m + 1) + have hp' := expandingPower_moment a k L ha ha1 hk hL N (fourierConjugate q) hconj.1 (m - 1) + rw [hconj.2] at hp' + have hprod := expandingProduct_moment a k L ha ha1 hk hL N + (expandingPower a k L ha ha1 hk hL q (m + 1)) + (expandingPower a k L ha ha1 hk hL (fourierConjugate q) (m - 1)) hp.1 hp'.1 + have hc := expandingScalar_moment a k L N (m : ℂ) + (expandingProduct a k L ha ha1 hk hL + (expandingPower a k L ha ha1 hk hL q (m + 1)) + (expandingPower a k L ha ha1 hk hL (fourierConjugate q) (m - 1))) hprod.1 + rw [expandingAnticircularCoefficient] + refine ⟨hc.1, ?_⟩ + rw [hc.2] + have hM : 0 ≤ M := tsum_nonneg (fun n => mul_nonneg + (le_trans zero_le_one (latticeMomentWeight_one_le L hL N n)) (norm_nonneg _)) + calc + _ ≤ ‖(m : ℂ)‖ * (M ^ (m + 1) * M ^ (m - 1)) := by + apply mul_le_mul_of_nonneg_left (hprod.2.trans ?_) (norm_nonneg _) + exact mul_le_mul hp.2 hp'.2 + (tsum_nonneg (fun n => mul_nonneg (le_trans zero_le_one (latticeMomentWeight_one_le L hL N n)) (norm_nonneg _))) + (pow_nonneg hM (m + 1)) + _ = _ := by rw [Complex.norm_natCast] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCoefficientCompactness.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCoefficientCompactness.lean new file mode 100644 index 0000000000000000000000000000000000000000..e253a97762fa72d4acf22690c1e7e52db430a8b1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCoefficientCompactness.lean @@ -0,0 +1,93 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingCompactCommutator +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingCompactLowProduct +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingCommutatorCoefficient +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.ApproximateNullLimit + +namespace OAI + +/-! # Compact action for coefficients approximated by fixed compact profiles -/ + +open Filter Topology +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +/-- Uniform eventual approximation in the actual expanding norm by sampled compact functions. -/ +def ExpandingCompactApproximation (a k : ℝ) (ha1 : a < 1) (hk : 8 < k) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (q : ℕ → FourierL2) : Prop := + ∀ δ : ℝ, 0 < δ → ∃ (R : ℝ) (K : 𝓢(E, ℂ)), + (∀ y : E, R < ‖y‖ → K y = 0) ∧ ∀ᶠ n in atTop, + ‖q n - schwartzTorusSample a k (L n) ha1 hk (hL n) (radianFourierKernel K)‖ < δ + +theorem tendsto_expandingApproximate_commutator (a M : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < ((N + 1 : ℕ) : ℝ)) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (hLinf : Tendsto L atTop atTop) + (q : ℕ → FourierL2) (hq : ExpandingCompactApproximation a (N + 1 : ℕ) ha1 hN L hL q) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) + (hlocal : ∀ R ε : ℝ, 0 < ε → ∀ᶠ n in atTop, ∀ y : E, ‖y‖ ≤ R → + ‖expandingTorusFunction a (N + 1 : ℕ) (L n) (f n) + (euclideanToTorus ((L n)⁻¹ • y))‖ < ε) + (j : Fin (N + 1) → Fin 12) : + Tendsto (fun n => expandingProductCommutator a (L n) (N + 1) ha ha1 hN (hL n) j (q n) (f n)) + atTop (𝓝 0) := by + let C : ℝ := (2 * Real.sqrt (4 ^ ((N + 1 : ℕ) : ℝ)) + 1) * expandingEmbeddingBound a (N + 1 : ℕ) + have hC : 0 ≤ C := by dsimp [C]; unfold expandingEmbeddingBound; positivity + have hM : 0 ≤ M := (norm_nonneg (f 0)).trans (hf 0) + apply tendsto_zero_of_null_approximations + intro ε hε + let δ := ε / (C * M + 1) + have hδ : 0 < δ := div_pos hε (by positivity) + obtain ⟨R, K, hK, herr⟩ := hq δ hδ + refine ⟨fun n => expandingProductCommutator a (L n) (N + 1) ha ha1 hN (hL n) j + (schwartzTorusSample a (N + 1 : ℕ) (L n) ha1 hN (hL n) (radianFourierKernel K)) (f n), + tendsto_expandingSample_commutator a M R N ha ha1 hN L hL hLinf f hf hlocal K hK j, ?_⟩ + have hδbound : C * δ * M ≤ ε := by + have he : δ * (C * M + 1) = ε := div_mul_cancel₀ _ (by positivity) + nlinarith [hδ.le] + filter_upwards [herr] with n hn + exact (expandingProductCommutator_coefficient_difference a (L n) (N + 1) ha ha1 hN (hL n) + j (q n) _ (f n)).trans ((mul_le_mul + (mul_le_mul_of_nonneg_left hn.le hC) (hf n) (norm_nonneg _) + (mul_nonneg hC hδ.le)).trans hδbound) + +theorem tendsto_expandingApproximate_lowEnergy_product (a M : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (hLinf : Tendsto L atTop atTop) + (q : ℕ → FourierL2) (hq : ExpandingCompactApproximation a N ha1 hN L hL q) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) + (hlocal : ∀ R ε : ℝ, 0 < ε → ∀ᶠ n in atTop, ∀ y : E, ‖y‖ ≤ R → + ‖expandingTorusFunction a N (L n) (f n) (euclideanToTorus ((L n)⁻¹ • y))‖ < ε) : + Tendsto (fun n => expandingLowEnergy a N (L n) (hL n) + (expandingProduct a N (L n) ha ha1 hN (hL n) (q n) (f n))) atTop (𝓝 0) := by + let C : ℝ := 2 * Real.sqrt (4 ^ (N : ℝ)) * expandingEmbeddingBound a N + have hC : 0 ≤ C := by dsimp [C]; unfold expandingEmbeddingBound; positivity + have hM : 0 ≤ M := (norm_nonneg (f 0)).trans (hf 0) + apply tendsto_zero_of_null_approximations + intro ε hε + let δ := ε / (C * M + 1) + have hδ : 0 < δ := div_pos hε (by positivity) + obtain ⟨R, K, hK, herr⟩ := hq δ hδ + let r := fun n => schwartzTorusSample a N (L n) ha1 hN (hL n) (radianFourierKernel K) + refine ⟨fun n => expandingLowEnergy a N (L n) (hL n) + (expandingProduct a N (L n) ha ha1 hN (hL n) (r n) (f n)), + tendsto_expandingSample_lowEnergy_product a M R N ha ha1 hN L hL hLinf f hf hlocal K hK, ?_⟩ + have hδbound : C * δ * M ≤ ε := by + have he : δ * (C * M + 1) = ε := div_mul_cancel₀ _ (by positivity) + nlinarith [hδ.le] + filter_upwards [herr] with n hn + have he : expandingProduct a N (L n) ha ha1 hN (hL n) (q n) (f n) - + expandingProduct a N (L n) ha ha1 hN (hL n) (r n) (f n) = + expandingProduct a N (L n) ha ha1 hN (hL n) (q n - r n) (f n) := by + exact (congrArg (fun B : FourierL2 →L[ℂ] FourierL2 => B (f n)) + ((expandingBilinearProduct a N (L n) ha ha1 hN (hL n)).map_sub (q n) (r n))).symm + rw [← map_sub, he] + exact (expandingLowEnergy_norm_le a N (L n) (hL n) _).trans + ((expandingProduct_norm_le a N (L n) ha ha1 hN (hL n) _ _).trans + ((mul_le_mul (mul_le_mul_of_nonneg_left hn.le hC) (hf n) (norm_nonneg _) + (mul_nonneg hC hδ.le)).trans hδbound)) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCommutatorCoefficient.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCommutatorCoefficient.lean new file mode 100644 index 0000000000000000000000000000000000000000..9c11761fbcaad52aa22ac4c4bc421417541a1425 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCommutatorCoefficient.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProductCommutatorLinear + +namespace OAI + +/-! # Uniform continuity in the product commutator coefficient -/ + +open scoped ENNReal + +namespace DefocusingNLS + +theorem expandingOrderedFourierEnergy_norm_le (a L : ℝ) (N : ℕ) (hL : 1 ≤ L) + (j : Fin N → Fin 12) (f : FourierL2) : + ‖expandingOrderedFourierEnergy a L N hL j f‖ ≤ ‖f‖ := by + apply lp.norm_mono (by norm_num : (2 : ℝ≥0∞) ≠ 0) + intro n + rw [expandingOrderedFourierEnergy_apply, norm_mul] + exact mul_le_of_le_one_left (norm_nonneg _) (expandingOrderedMultiplier_norm_le a L N hL j n) + +theorem expandingProductCommutator_norm_le (a L : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hL : 1 ≤ L) + (j : Fin N → Fin 12) (q f : FourierL2) : + ‖expandingProductCommutator a L N ha ha1 hN hL j q f‖ ≤ + ((2 * Real.sqrt (4 ^ (N : ℝ)) + 1) * expandingEmbeddingBound a N) * ‖q‖ * ‖f‖ := by + have hc := fourierConvolution_norm_le (expandingFourierCoefficient a N L q) + (summable_norm_expandingFourierCoefficient a N L ha ha1 hN hL q) + (expandingOrderedFourierEnergy a L N hL j f) + have hc' : ‖fourierConvolution (expandingFourierCoefficient a N L q) + (expandingOrderedFourierEnergy a L N hL j f)‖ ≤ + (expandingEmbeddingBound a N * ‖q‖) * ‖f‖ := + hc.trans (mul_le_mul (tsum_norm_expandingFourierCoefficient_le a N L ha ha1 hN hL q) + (expandingOrderedFourierEnergy_norm_le a L N hL j f) (norm_nonneg _) + (by unfold expandingEmbeddingBound; positivity)) + have hp := (expandingOrderedFourierEnergy_norm_le a L N hL j + (expandingProduct a N L ha ha1 hN hL q f)).trans + (expandingProduct_norm_le a N L ha ha1 hN hL q f) + exact (norm_sub_le _ _).trans ((add_le_add hp hc').trans_eq (by ring)) + +theorem fourierConvolution_sub_left (v w : frequencyLattice → ℂ) + (hv : Summable (fun n => ‖v n‖)) (hw : Summable (fun n => ‖w n‖)) (f : FourierL2) : + fourierConvolution (v - w) f = fourierConvolution v f - fourierConvolution w f := by + unfold fourierConvolution + simp only [Pi.sub_apply, sub_smul] + exact (summable_fourierConvolution_terms v hv f).tsum_sub + (summable_fourierConvolution_terms w hw f) + +theorem expandingProductCommutator_sub_left (a L : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hL : 1 ≤ L) + (j : Fin N → Fin 12) (q r f : FourierL2) : + expandingProductCommutator a L N ha ha1 hN hL j (q - r) f = + expandingProductCommutator a L N ha ha1 hN hL j q f - + expandingProductCommutator a L N ha ha1 hN hL j r f := by + have hp : expandingProduct a N L ha ha1 hN hL (q - r) f = + expandingProduct a N L ha ha1 hN hL q f - expandingProduct a N L ha ha1 hN hL r f := by + exact congrArg (fun B : FourierL2 →L[ℂ] FourierL2 => B f) + ((expandingBilinearProduct a N L ha ha1 hN hL).map_sub q r) + have hv : expandingFourierCoefficient a N L (q - r) = + expandingFourierCoefficient a N L q - expandingFourierCoefficient a N L r := by + funext n + simp only [expandingFourierCoefficient, lp.coeFn_sub, Pi.sub_apply, mul_sub] + unfold expandingProductCommutator + rw [hp, map_sub, hv, fourierConvolution_sub_left _ _ + (summable_norm_expandingFourierCoefficient a N L ha ha1 hN hL q) + (summable_norm_expandingFourierCoefficient a N L ha ha1 hN hL r)] + abel + +theorem expandingProductCommutator_coefficient_difference (a L : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hL : 1 ≤ L) + (j : Fin N → Fin 12) (q r f : FourierL2) : + ‖expandingProductCommutator a L N ha ha1 hN hL j q f - + expandingProductCommutator a L N ha ha1 hN hL j r f‖ ≤ + ((2 * Real.sqrt (4 ^ (N : ℝ)) + 1) * expandingEmbeddingBound a N) * ‖q - r‖ * ‖f‖ := by + rw [← expandingProductCommutator_sub_left] + exact expandingProductCommutator_norm_le a L N ha ha1 hN hL j (q - r) f + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactCommutator.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactCommutator.lean new file mode 100644 index 0000000000000000000000000000000000000000..23e8c1c78b8b19002c7b04b16ae54bc1fcb6b2a7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactCommutator.lean @@ -0,0 +1,47 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingCompactLowCommutator +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProductSmoothRemainder +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.UniformCutoffLimit + +namespace OAI + +/-! # Strong compactness of sampled compact-coefficient commutators -/ + +open Filter Topology +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem tendsto_expandingSample_commutator (a M R : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < ((N + 1 : ℕ) : ℝ)) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (hLinf : Tendsto L atTop atTop) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) + (hlocal : ∀ R ε : ℝ, 0 < ε → ∀ᶠ n in atTop, ∀ y : E, ‖y‖ ≤ R → + ‖expandingTorusFunction a (N + 1 : ℕ) (L n) (f n) + (euclideanToTorus ((L n)⁻¹ • y))‖ < ε) + (K : 𝓢(E, ℂ)) (hK : ∀ y : E, R < ‖y‖ → K y = 0) + (j : Fin (N + 1) → Fin 12) : + Tendsto (fun n => expandingProductCommutator a (L n) (N + 1) ha ha1 hN (hL n) j + (schwartzTorusSample a (N + 1 : ℕ) (L n) ha1 hN (hL n) (radianFourierKernel K)) (f n)) + atTop (𝓝 0) := by + obtain ⟨C, hC, hc⟩ := exists_expandingProductCommutator_smooth_remainder a N ha ha1 hN + (radianFourierKernel K) + have hM : 0 ≤ M := (norm_nonneg (f 0)).trans (hf 0) + let q := fun n => schwartzTorusSample a (N + 1 : ℕ) (L n) ha1 hN (hL n) (radianFourierKernel K) + apply tendsto_zero_of_uniform_cutoff + (fun n => expandingProductCommutator a (L n) (N + 1) ha ha1 hN (hL n) j (q n) (f n)) + (fun S hS n => expandingProductCommutator a (L n) (N + 1) ha ha1 hN (hL n) j (q n) + (expandingSmoothLow (L n) S (by linarith) (f n))) (C * M) (mul_nonneg hC hM) + · intro S hS + exact tendsto_expandingSample_low_commutator a M R S (N + 1) ha ha1 hN (by linarith) + L hL hLinf f hf hlocal K hK j + · intro S hS n + calc + _ ≤ (C / S) * ‖f n‖ := hc (L n) S (hL n) hS (f n) j + _ ≤ (C / S) * M := mul_le_mul_of_nonneg_left (hf n) (div_nonneg hC (by linarith)) + _ = (C * M) / S := by ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactDerivativeLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactDerivativeLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..d319839a2c248858a80d7241853747c9bd304990 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactDerivativeLimit.lean @@ -0,0 +1,58 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingSampleDerivativeFormula +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingCompactFilterLimit + +namespace OAI + +/-! # Low-frequency derivative compactness for the actual sampled product -/ + +open Filter Topology +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem tendsto_expandingSample_low_derivative (a M R S : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hS : 0 < S) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (hLinf : Tendsto L atTop atTop) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) + (hlocal : ∀ R ε : ℝ, 0 < ε → ∀ᶠ n in atTop, ∀ y : E, ‖y‖ ≤ R → + ‖expandingTorusFunction a N (L n) (f n) (euclideanToTorus ((L n)⁻¹ • y))‖ < ε) + (K : 𝓢(E, ℂ)) (hK : ∀ y : E, R < ‖y‖ → K y = 0) (j : Fin N → Fin 12) : + Tendsto (fun n => expandingOrderedFourierEnergy a (L n) N (hL n) j + (expandingProduct a N (L n) ha ha1 hN (hL n) + (schwartzTorusSample a N (L n) ha1 hN (hL n) (radianFourierKernel K)) + (expandingSmoothLow (L n) S hS (f n)))) atTop (𝓝 0) := by + let G := fun s : Finset (Fin N) => schwartzPartialDerivative N j s K + let Q := fun n (s : Finset (Fin N)) => + schwartzTorusSample a N (L n) ha1 hN (hL n) (radianFourierKernel (G s)) + let F := fun n (s : Finset (Fin N)) => + expandingSchwartzFilter (L n) (partialFilterKernel S hS N j sᶜ) (f n) + let V := fun n (s : Finset (Fin N)) => expandingPhysicalMassVector a N (L n) ha ha1 hN (hL n) + (expandingProduct a N (L n) ha ha1 hN (hL n) (Q n s) (F n s)) + have hv (s : Finset (Fin N)) : Tendsto (fun n => V n s) atTop (𝓝 0) := by + rw [tendsto_zero_iff_norm_tendsto_zero] + have ht := tendsto_expandingCompactPhysical_filter a N M R ha ha1 hN L hL hLinf f hf hlocal + (partialFilterKernel S hS N j sᶜ) (G s) (schwartzPartialDerivative_zero N j s K R hK) + have he (n : ℕ) : ‖V n s‖ = ‖torusPhysicalL2Value (L n) + (expandingUnitTorusFunction a N (L n) (Q n s) * + expandingUnitTorusFunction a N (L n) (F n s))‖ := by + rw [← LinearIsometryEquiv.norm_map torusFourierIsometry (V n s)] + dsimp only [V] + rw [expandingPhysicalMassVector_isometry, expandingUnitTorusFunction_product] + change Tendsto (fun n => ‖torusPhysicalL2Value (L n) + (expandingUnitTorusFunction a N (L n) (Q n s) * + expandingUnitTorusFunction a N (L n) (F n s))‖) atTop (𝓝 0) at ht + simpa only [he] using ht + have hs := tendsto_finsetSum Finset.univ (fun s _ => hv s) + have he (n : ℕ) : expandingOrderedFourierEnergy a (L n) N (hL n) j + (expandingProduct a N (L n) ha ha1 hN (hL n) + (schwartzTorusSample a N (L n) ha1 hN (hL n) (radianFourierKernel K)) + (expandingSmoothLow (L n) S hS (f n))) = ∑ s : Finset (Fin N), V n s := + expandingSample_low_derivative_formula a (L n) S N ha ha1 hN (hL n) hS j K (f n) + simp_rw [← he] at hs + simpa only [Finset.sum_const_zero] using hs + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactEnergyError.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactEnergyError.lean new file mode 100644 index 0000000000000000000000000000000000000000..4798d7f75523b729a6658224759bfd4516727bab --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactEnergyError.lean @@ -0,0 +1,69 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.BoundedInnerNull + +namespace OAI + +/-! # The exact nonprincipal energy error vanishes on locally null sequences -/ + +open Filter Topology MeasureTheory + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) +local notation "T" => UnitAddTorus (Fin 12) +noncomputable local instance compactEnergyErrorMeasure : MeasureSpace UnitAddCircle := ⟨AddCircle.haarAddCircle⟩ +local instance compactEnergyErrorProbability : IsProbabilityMeasure (volume : Measure UnitAddCircle) := + inferInstanceAs (IsProbabilityMeasure AddCircle.haarAddCircle) + +variable (a Q M : ℝ) (N : ℕ) (ha : 0 < a) (ha1 : a < 1) + (hN : 8 < ((N + 1 : ℕ) : ℝ)) (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) + (hLinf : Tendsto L atTop atTop) (q : ℕ → FourierL2) + (hq : ExpandingCompactApproximation a (N + 1 : ℕ) ha1 hN L hL q) (hqb : ∀ n, ‖q n‖ ≤ Q) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) + (hlocal : ∀ R ε : ℝ, 0 < ε → ∀ᶠ n in atTop, ∀ y : E, ‖y‖ ≤ R → + ‖expandingTorusFunction a (N + 1 : ℕ) (L n) (f n) (euclideanToTorus ((L n)⁻¹ • y))‖ < ε) + (m : ℕ) (hm : 0 < m) (P : ℝ) (hP : 0 ≤ P) + (hQB : ∀ n (x : T), ‖expandingUnitTorusFunction a (N + 1 : ℕ) (L n) (q n) x‖ ^ (2 * m) ≤ P) + +include hLinf hq hqb hf hlocal hm in +theorem tendsto_expandingOrderedCommutator (j : Fin (N + 1) → Fin 12) : + Tendsto (fun n => expandingOrderedCommutator a (L n) (N + 1) ha ha1 hN (hL n) + m (q n) P hP (hQB n) j (f n)) atTop (𝓝 0) := by + have ht := tendsto_expandingOddFourierCommutator a Q M N ha ha1 hN L hL hLinf q hq hqb f hf hlocal m hm j + have hi := (torusFourierIsometry.continuous.tendsto 0).comp ht + simp only [Function.comp_def, map_zero] at hi + have he (n : ℕ) : torusFourierIsometry (expandingOddFourierCommutator a (L n) (N + 1) + ha ha1 hN (hL n) m (q n) (f n) j) = + expandingOrderedCommutator a (L n) (N + 1) ha ha1 hN (hL n) m (q n) P hP (hQB n) j (f n) := + torusOddCommutator_identification a (L n) (N + 1) ha ha1 hN (hL n) m (q n) P hP (hQB n) (f n) j + simpa only [he] using hi + +include hLinf hq hqb hf hlocal hm in +theorem tendsto_expandingCompactEnergy_error : + Tendsto (fun n => + inner ℝ (f n) (expandingLinearizedPotential a (N + 1 : ℕ) (L n) ha ha1 hN (hL n) m (q n) (f n)) - + ∑ j : Fin (N + 1) → Fin 12, + inner ℝ (expandingOrderedPhysicalEnergy a (L n) (N + 1) (hL n) j (f n)) + (torusPrincipalPotential m (expandingUnitTorusFunction a (N + 1 : ℕ) (L n) (q n)) + (expandingUnitTorusFunction a (N + 1 : ℕ) (L n) (q n)).continuous P hP (hQB n) + (expandingOrderedPhysicalEnergy a (L n) (N + 1) (hL n) j (f n)))) atTop (𝓝 0) := by + have hlo := tendsto_expandingLinearized_lowEnergy a Q M N ha ha1 hN L hL hLinf q hq hqb f hf hlocal m hm + have hlow := tendsto_inner_of_bounded_null + (fun n => expandingLowEnergy a (N + 1 : ℕ) (L n) (hL n) (f n)) _ M + (fun n => (expandingLowEnergy_norm_le a _ _ _ _).trans (hf n)) hlo + have htop (j : Fin (N + 1) → Fin 12) := tendsto_inner_of_bounded_null + (fun n => expandingOrderedPhysicalEnergy a (L n) (N + 1) (hL n) j (f n)) _ M + (fun n => (expandingOrderedPhysicalEnergy_norm a _ _ _ _ _).le.trans + ((expandingOrderedFourierEnergy_norm_le a _ _ _ _ _).trans (hf n))) + (tendsto_expandingOrderedCommutator a Q M N ha ha1 hN L hL hLinf q hq hqb f hf hlocal m hm P hP hQB j) + have ht := hlow.add (tendsto_finsetSum Finset.univ (fun j _ => htop j)) + simp only [Finset.sum_const_zero, add_zero] at ht + have he (n : ℕ) := expandingLinearized_energy_split a (L n) (N + 1) ha ha1 hN (hL n) + m (q n) P hP (hQB n) (f n) + dsimp only at he + convert ht using 1 + funext n + linarith [he n] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactFilterLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactFilterLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..610ed32c1b841803837eae54656198c985f5ad82 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactFilterLimit.lean @@ -0,0 +1,50 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingGeneralFilterLimit + +namespace OAI + +/-! # Compact physical multiplication after each fixed Schwartz filter -/ + +open Filter Topology MeasureTheory +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) +local notation "T" => UnitAddTorus (Fin 12) +noncomputable local instance expandingCompactFilterMeasure : MeasureSpace UnitAddCircle := ⟨AddCircle.haarAddCircle⟩ +local instance expandingCompactFilterProbability : IsProbabilityMeasure (volume : Measure UnitAddCircle) := + inferInstanceAs (IsProbabilityMeasure AddCircle.haarAddCircle) + +theorem tendsto_expandingCompactPhysical_filter (a k M R : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (hLinf : Tendsto L atTop atTop) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) + (hlocal : ∀ R ε : ℝ, 0 < ε → ∀ᶠ n in atTop, ∀ y : E, ‖y‖ ≤ R → + ‖expandingTorusFunction a k (L n) (f n) (euclideanToTorus ((L n)⁻¹ • y))‖ < ε) + (J K : 𝓢(E, ℂ)) (hK : ∀ y : E, R < ‖y‖ → K y = 0) : + Tendsto (fun n => ‖torusPhysicalL2Value (L n) + (expandingUnitTorusFunction a k (L n) + (schwartzTorusSample a k (L n) ha1 hk (hL n) (radianFourierKernel K)) * + expandingUnitTorusFunction a k (L n) (expandingSchwartzFilter (L n) J (f n)))‖) + atTop (𝓝 0) := by + have ht := tendsto_expandingSchwartzFilter_weightedL2 a k M ha ha1 hk L hL f hf hlocal J K (K.memLp 2) + have he : ∀ᶠ n in atTop, ‖torusPhysicalL2Value (L n) + (expandingUnitTorusFunction a k (L n) + (schwartzTorusSample a k (L n) ha1 hk (hL n) (radianFourierKernel K)) * + expandingUnitTorusFunction a k (L n) (expandingSchwartzFilter (L n) J (f n)))‖ ^ 2 = + ∫ y : E, ‖K y * expandingPhysicalContinuous a k (L n) ha ha1 hk (hL n) + (expandingSchwartzFilter (L n) J (f n)) y‖ ^ 2 := by + filter_upwards [hLinf.eventually (eventually_ge_atTop R)] with n hn + rw [torusPhysicalL2Value_norm_sq] + simp only [ContinuousMap.mul_apply] + apply expandingCompactWeight_integral a k (L n) R ha ha1 hk (hL n) _ K hK + calc + 2 * R ≤ 2 * L n := mul_le_mul_of_nonneg_left hn (by norm_num) + _ < 2 * Real.pi * L n := mul_lt_mul_of_pos_right + (by linarith [Real.pi_gt_three] : (2 : ℝ) < 2 * Real.pi) (by linarith [hL n]) + have hs := ht.congr' (he.mono fun _ hn => hn.symm) + simpa only [Real.sqrt_sq (norm_nonneg _), Real.sqrt_zero] using hs.sqrt + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactLowCommutator.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactLowCommutator.lean new file mode 100644 index 0000000000000000000000000000000000000000..eb4d7ef569b5cc472d98f00ad4d75f25edfea387 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactLowCommutator.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFilteredPhysicalEnergy +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingCompactDerivativeLimit +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingCompactPhysicalLimit +import OAI.MathematicalPhysics.DefocusingNLS.Linear.TorusProductCommutator + +namespace OAI + +/-! # Compactness of the actual low-frequency product commutator -/ + +open Filter Topology +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem tendsto_expandingSample_low_commutator (a M R S : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hS : 0 < S) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (hLinf : Tendsto L atTop atTop) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) + (hlocal : ∀ R ε : ℝ, 0 < ε → ∀ᶠ n in atTop, ∀ y : E, ‖y‖ ≤ R → + ‖expandingTorusFunction a N (L n) (f n) (euclideanToTorus ((L n)⁻¹ • y))‖ < ε) + (K : 𝓢(E, ℂ)) (hK : ∀ y : E, R < ‖y‖ → K y = 0) (j : Fin N → Fin 12) : + Tendsto (fun n => expandingProductCommutator a (L n) N ha ha1 hN (hL n) j + (schwartzTorusSample a N (L n) ha1 hN (hL n) (radianFourierKernel K)) + (expandingSmoothLow (L n) S hS (f n))) atTop (𝓝 0) := by + let q := fun n => schwartzTorusSample a N (L n) ha1 hN (hL n) (radianFourierKernel K) + let u := fun n => expandingSmoothLow (L n) S hS (f n) + have hfirst := tendsto_expandingSample_low_derivative a M R S N ha ha1 hN hS + L hL hLinf f hf hlocal K hK j + have hfirst' := (torusFourierIsometry.continuous.tendsto 0).comp hfirst + have hsecond := tendsto_expandingCompactPhysical_derivative a N M R S ha ha1 hN hS + N j L hL hLinf f hf hlocal K hK + rw [← tendsto_zero_iff_norm_tendsto_zero] at hsecond + have he (n : ℕ) : torusFourierIsometry + (expandingProductCommutator a (L n) N ha ha1 hN (hL n) j (q n) (u n)) = + torusFourierIsometry (expandingOrderedFourierEnergy a (L n) N (hL n) j + (expandingProduct a N (L n) ha ha1 hN (hL n) (q n) (u n))) - + torusPhysicalL2Value (L n) (expandingUnitTorusFunction a N (L n) (q n) * + expandingUnitTorusFunction a N (L n) (expandingSmoothDerivative (L n) S hS N j (f n))) := by + rw [torusProductCommutator_physical] + dsimp only [u] + rw [expandingOrderedPhysicalEnergy_smoothLow a (L n) S N ha ha1 hN (hL n) hS, + torusL2Product_physical] + rfl + have ht := hfirst'.sub hsecond + simp only [map_zero, sub_zero] at ht + rw [tendsto_zero_iff_norm_tendsto_zero] + change Tendsto (fun n => torusFourierIsometry + (expandingOrderedFourierEnergy a (L n) N (hL n) j + (expandingProduct a N (L n) ha ha1 hN (hL n) (q n) (u n))) - + torusPhysicalL2Value (L n) (expandingUnitTorusFunction a N (L n) (q n) * + expandingUnitTorusFunction a N (L n) (expandingSmoothDerivative (L n) S hS N j (f n)))) + atTop (𝓝 0) at ht + simp_rw [← he] at ht + simpa only [LinearIsometryEquiv.norm_map, norm_zero] using ht.norm + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactLowProduct.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactLowProduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..9442ec7394a4927e2b497fea8cfaafffa628917b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactLowProduct.lean @@ -0,0 +1,40 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingLowMassLimit +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingCompactMassLimit + +namespace OAI + +/-! # Compact lower-order product for the actual unfiltered field -/ + +open Filter Topology +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem tendsto_expandingSample_lowEnergy_product (a M R : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (hLinf : Tendsto L atTop atTop) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) + (hlocal : ∀ R ε : ℝ, 0 < ε → ∀ᶠ n in atTop, ∀ y : E, ‖y‖ ≤ R → + ‖expandingTorusFunction a N (L n) (f n) (euclideanToTorus ((L n)⁻¹ • y))‖ < ε) + (K : 𝓢(E, ℂ)) (hK : ∀ y : E, R < ‖y‖ → K y = 0) : + Tendsto (fun n => expandingLowEnergy a N (L n) (hL n) + (expandingProduct a N (L n) ha ha1 hN (hL n) + (schwartzTorusSample a N (L n) ha1 hN (hL n) (radianFourierKernel K)) (f n))) + atTop (𝓝 0) := by + obtain ⟨C, hC, hc⟩ := exists_schwartzTorusSample_norm_bound a N ha1 hN (radianFourierKernel K) + let A : ℝ := 2 * Real.sqrt (4 ^ (N : ℝ)) * expandingEmbeddingBound a N + have hA : 0 ≤ A := by dsimp [A]; unfold expandingEmbeddingBound; positivity + let g := fun n => expandingProduct a N (L n) ha ha1 hN (hL n) + (schwartzTorusSample a N (L n) ha1 hN (hL n) (radianFourierKernel K)) (f n) + have hg (n : ℕ) : ‖g n‖ ≤ A * C * M := + (expandingProduct_norm_le a N (L n) ha ha1 hN (hL n) _ _).trans + (mul_le_mul (mul_le_mul_of_nonneg_left (hc (L n) (hL n)) hA) + (hf n) (norm_nonneg _) (mul_nonneg hA hC)) + exact tendsto_expandingLowEnergy_of_mass a (A * C * M) N ha ha1 hN L hL g hg + (tendsto_expandingSample_product_mass a N M R ha ha1 hN L hL hLinf f hf hlocal K hK) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactMassLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactMassLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..02d144306c5592b7740842bb52e2222c80e0d073 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactMassLimit.lean @@ -0,0 +1,56 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingCompactFilterLimit +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPhysicalFourier + +namespace OAI + +/-! # Compact physical mass of an unfiltered locally vanishing sequence -/ + +open Filter Topology MeasureTheory +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) +local notation "T" => UnitAddTorus (Fin 12) +noncomputable local instance compactMassLimitMeasure : MeasureSpace UnitAddCircle := ⟨AddCircle.haarAddCircle⟩ +local instance compactMassLimitProbability : IsProbabilityMeasure (volume : Measure UnitAddCircle) := + inferInstanceAs (IsProbabilityMeasure AddCircle.haarAddCircle) + +theorem tendsto_expandingSample_product_mass (a k M R : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (hLinf : Tendsto L atTop atTop) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) + (hlocal : ∀ R ε : ℝ, 0 < ε → ∀ᶠ n in atTop, ∀ y : E, ‖y‖ ≤ R → + ‖expandingTorusFunction a k (L n) (f n) (euclideanToTorus ((L n)⁻¹ • y))‖ < ε) + (K : 𝓢(E, ℂ)) (hK : ∀ y : E, R < ‖y‖ → K y = 0) : + Tendsto (fun n => ‖expandingPhysicalMassVector a k (L n) ha ha1 hk (hL n) + (expandingProduct a k (L n) ha ha1 hk (hL n) + (schwartzTorusSample a k (L n) ha1 hk (hL n) (radianFourierKernel K)) (f n))‖) + atTop (𝓝 0) := by + have hb (n : ℕ) (y : E) : + ‖expandingPhysicalContinuous a k (L n) ha ha1 hk (hL n) (f n) y‖ ≤ + expandingEmbeddingBound a k * M := + (expandingPhysicalContinuous_norm_le a k (L n) ha ha1 hk (hL n) (f n) y).trans + (mul_le_mul_of_nonneg_left (hf n) (by unfold expandingEmbeddingBound; positivity)) + have ht := tendsto_weightedL2_of_locally_uniform_zero (expandingEmbeddingBound a k * M) + K (K.memLp 2) (fun n => expandingPhysicalContinuous a k (L n) ha ha1 hk (hL n) (f n)) hb (by simpa only [expandingPhysicalContinuous_apply] using hlocal) + have he : ∀ᶠ n in atTop, ‖expandingPhysicalMassVector a k (L n) ha ha1 hk (hL n) + (expandingProduct a k (L n) ha ha1 hk (hL n) + (schwartzTorusSample a k (L n) ha1 hk (hL n) (radianFourierKernel K)) (f n))‖ ^ 2 = + ∫ y : E, ‖K y * expandingPhysicalContinuous a k (L n) ha ha1 hk (hL n) (f n) y‖ ^ 2 := by + filter_upwards [hLinf.eventually (eventually_ge_atTop R)] with n hn + rw [← LinearIsometryEquiv.norm_map torusFourierIsometry, + expandingPhysicalMassVector_isometry, expandingUnitTorusFunction_product, + torusPhysicalL2Value_norm_sq] + simp only [ContinuousMap.mul_apply] + apply expandingCompactWeight_integral a k (L n) R ha ha1 hk (hL n) _ K hK + calc + 2 * R ≤ 2 * L n := mul_le_mul_of_nonneg_left hn (by norm_num) + _ < 2 * Real.pi * L n := mul_lt_mul_of_pos_right + (by linarith [Real.pi_gt_three] : (2 : ℝ) < 2 * Real.pi) (by linarith [hL n]) + have hs := ht.congr' (he.mono fun _ hn => hn.symm) + simpa only [Real.sqrt_sq (norm_nonneg _), Real.sqrt_zero] using hs.sqrt + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactPhysicalLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactPhysicalLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..5947e56528e22142e2f0518a4e362f3eb4621325 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactPhysicalLimit.lean @@ -0,0 +1,43 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingCompactWeightLimit +import OAI.MathematicalPhysics.DefocusingNLS.Linear.TorusPhysicalL2 + +namespace OAI + +/-! # Norm compactness of the sampled coefficient times filtered derivatives -/ + +open Filter Topology MeasureTheory +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) +local notation "T" => UnitAddTorus (Fin 12) +noncomputable local instance expandingCompactPhysicalMeasure : MeasureSpace UnitAddCircle := ⟨AddCircle.haarAddCircle⟩ +local instance expandingCompactPhysicalProbability : IsProbabilityMeasure (volume : Measure UnitAddCircle) := + inferInstanceAs (IsProbabilityMeasure AddCircle.haarAddCircle) + +theorem tendsto_expandingCompactPhysical_derivative (a k M R S : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hS : 0 < S) + (N : ℕ) (j : Fin N → Fin 12) (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) + (hLinf : Tendsto L atTop atTop) (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) + (hlocal : ∀ R ε : ℝ, 0 < ε → ∀ᶠ n in atTop, ∀ y : E, ‖y‖ ≤ R → + ‖expandingTorusFunction a k (L n) (f n) (euclideanToTorus ((L n)⁻¹ • y))‖ < ε) + (K : 𝓢(E, ℂ)) (hK : ∀ y : E, R < ‖y‖ → K y = 0) : + Tendsto (fun n => ‖torusPhysicalL2Value (L n) + (expandingUnitTorusFunction a k (L n) + (schwartzTorusSample a k (L n) ha1 hk (hL n) (radianFourierKernel K)) * + expandingUnitTorusFunction a k (L n) + (expandingSmoothDerivative (L n) S hS N j (f n)))‖) atTop (𝓝 0) := by + have ht := tendsto_expandingCompactWeight_derivative a k M R S ha ha1 hk hS N j + L hL hLinf f hf hlocal K hK + have hs : Tendsto (fun n => ‖torusPhysicalL2Value (L n) + (expandingUnitTorusFunction a k (L n) + (schwartzTorusSample a k (L n) ha1 hk (hL n) (radianFourierKernel K)) * + expandingUnitTorusFunction a k (L n) + (expandingSmoothDerivative (L n) S hS N j (f n)))‖ ^ 2) atTop (𝓝 0) := by + simpa only [torusPhysicalL2Value_norm_sq, ContinuousMap.mul_apply] using ht + simpa only [Real.sqrt_sq (norm_nonneg _), Real.sqrt_zero] using hs.sqrt + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactProductLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactProductLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..041cf504897dca780c2e91eba94550229cf04c53 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactProductLimit.lean @@ -0,0 +1,50 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingCompactDerivativeLimit +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingMassDerivativeNorm + +namespace OAI + +/-! # Strong compactness of a sampled coefficient after smooth frequency cutoff -/ + +open Filter Topology +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem tendsto_expandingSample_low_product (a M R S : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hS : 0 < S) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (hLinf : Tendsto L atTop atTop) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) + (hlocal : ∀ R ε : ℝ, 0 < ε → ∀ᶠ n in atTop, ∀ y : E, ‖y‖ ≤ R → + ‖expandingTorusFunction a N (L n) (f n) (euclideanToTorus ((L n)⁻¹ • y))‖ < ε) + (K : 𝓢(E, ℂ)) (hK : ∀ y : E, R < ‖y‖ → K y = 0) : + Tendsto (fun n => expandingProduct a N (L n) ha ha1 hN (hL n) + (schwartzTorusSample a N (L n) ha1 hN (hL n) (radianFourierKernel K)) + (expandingSmoothLow (L n) S hS (f n))) atTop (𝓝 0) := by + let q := fun n => schwartzTorusSample a N (L n) ha1 hN (hL n) (radianFourierKernel K) + let u := fun n => expandingSmoothLow (L n) S hS (f n) + let g := fun n => expandingProduct a N (L n) ha ha1 hN (hL n) (q n) (u n) + apply tendsto_expanding_of_mass_derivatives_zero a N ha ha1 hN L hL g + · have ht := tendsto_expandingCompactPhysical_filter a N M R ha ha1 hN L hL hLinf f hf hlocal + (radianInverseKernel (smoothFrequencyCutoff S hS)) K hK + have he (n : ℕ) : ‖expandingPhysicalMassVector a N (L n) ha ha1 hN (hL n) (g n)‖ = + ‖torusPhysicalL2Value (L n) (expandingUnitTorusFunction a N (L n) (q n) * + expandingUnitTorusFunction a N (L n) + (expandingSchwartzFilter (L n) (radianInverseKernel (smoothFrequencyCutoff S hS)) (f n)))‖ := by + rw [← LinearIsometryEquiv.norm_map torusFourierIsometry + (expandingPhysicalMassVector a N (L n) ha ha1 hN (hL n) (g n)), + expandingPhysicalMassVector_isometry] + dsimp only [g] + rw [expandingUnitTorusFunction_product] + dsimp only [u] + rw [expandingSmoothLow_eq_convolution] + simpa only [he] using ht + · intro j + have ht := tendsto_expandingSample_low_derivative a M R S N ha ha1 hN hS + L hL hLinf f hf hlocal K hK j + simpa only [norm_zero] using ht.norm + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactWeightIntegral.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactWeightIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..db632c57d2afadc39dcaa148a319647ce2d0ace4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactWeightIntegral.lean @@ -0,0 +1,36 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.TorusCompactWeightIntegral +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.UnitTorusPhysical + +namespace OAI + +/-! # Physical L² identity for the actual sampled torus coefficient -/ + +open MeasureTheory +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) +local notation "T" => UnitAddTorus (Fin 12) +noncomputable local instance expandingCompactWeightMeasure : MeasureSpace UnitAddCircle := ⟨AddCircle.haarAddCircle⟩ +local instance expandingCompactWeightProbability : IsProbabilityMeasure (volume : Measure UnitAddCircle) := + inferInstanceAs (IsProbabilityMeasure AddCircle.haarAddCircle) + +theorem expandingCompactWeight_integral (a k L R : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (hLR : 2 * R < 2 * Real.pi * L) (K : 𝓢(E, ℂ)) + (hK : ∀ y : E, R < ‖y‖ → K y = 0) (f : FourierL2) : + (2 * Real.pi * L) ^ 12 * (∫ x : T, + ‖expandingUnitTorusFunction a k L + (schwartzTorusSample a k L ha1 hk hL (radianFourierKernel K)) x * + expandingUnitTorusFunction a k L f x‖ ^ 2) = + ∫ y : E, ‖K y * expandingPhysicalContinuous a k L ha ha1 hk hL f y‖ ^ 2 := by + rw [expandingUnitTorusFunction_sample a k L ha ha1 hk hL] + rw [separatedSchwartz_torus_weighted_integral L R (by linarith) hLR K hK] + apply integral_congr_ae + filter_upwards [] with y + rw [expandingUnitTorusFunction_physical a k L ha ha1 hk hL] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactWeightLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactWeightLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..2b404e1b62eeed730637fd9ef7bbe6b0dd2cfa7e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCompactWeightLimit.lean @@ -0,0 +1,50 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingCompactWeightIntegral +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFilteredWeightedLimit + +namespace OAI + +/-! # Compactly supported torus coefficients annihilate localized weak-null filtered data -/ + +open Filter Topology MeasureTheory +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) +local notation "T" => UnitAddTorus (Fin 12) +noncomputable local instance expandingCompactLimitMeasure : MeasureSpace UnitAddCircle := ⟨AddCircle.haarAddCircle⟩ +local instance expandingCompactLimitProbability : IsProbabilityMeasure (volume : Measure UnitAddCircle) := + inferInstanceAs (IsProbabilityMeasure AddCircle.haarAddCircle) + +theorem tendsto_expandingCompactWeight_derivative (a k M R S : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hS : 0 < S) + (N : ℕ) (j : Fin N → Fin 12) (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) + (hLinf : Tendsto L atTop atTop) (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) + (hlocal : ∀ R ε : ℝ, 0 < ε → ∀ᶠ n in atTop, ∀ y : E, ‖y‖ ≤ R → + ‖expandingTorusFunction a k (L n) (f n) (euclideanToTorus ((L n)⁻¹ • y))‖ < ε) + (K : 𝓢(E, ℂ)) (hK : ∀ y : E, R < ‖y‖ → K y = 0) : + Tendsto (fun n => (2 * Real.pi * L n) ^ 12 * (∫ x : T, + ‖expandingUnitTorusFunction a k (L n) + (schwartzTorusSample a k (L n) ha1 hk (hL n) (radianFourierKernel K)) x * + expandingUnitTorusFunction a k (L n) + (expandingSmoothDerivative (L n) S hS N j (f n)) x‖ ^ 2)) atTop (𝓝 0) := by + have ht := tendsto_expandingSmoothDerivative_weightedL2 a k M S ha ha1 hk hS N j + L hL f hf hlocal K (K.memLp 2) + have he : ∀ᶠ n in atTop, (2 * Real.pi * L n) ^ 12 * (∫ x : T, + ‖expandingUnitTorusFunction a k (L n) + (schwartzTorusSample a k (L n) ha1 hk (hL n) (radianFourierKernel K)) x * + expandingUnitTorusFunction a k (L n) + (expandingSmoothDerivative (L n) S hS N j (f n)) x‖ ^ 2) = + ∫ y : E, ‖K y * expandingPhysicalContinuous a k (L n) ha ha1 hk (hL n) + (expandingSmoothDerivative (L n) S hS N j (f n)) y‖ ^ 2 := by + filter_upwards [hLinf.eventually (eventually_ge_atTop R)] with n hn + apply expandingCompactWeight_integral a k (L n) R ha ha1 hk (hL n) _ K hK + calc + 2 * R ≤ 2 * L n := mul_le_mul_of_nonneg_left hn (by norm_num) + _ < 2 * Real.pi * L n := mul_lt_mul_of_pos_right + (by linarith [Real.pi_gt_three] : (2 : ℝ) < 2 * Real.pi) (by linarith [hL n]) + exact ht.congr' (he.mono fun _ hn => hn.symm) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingContinuousRealization.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingContinuousRealization.lean new file mode 100644 index 0000000000000000000000000000000000000000..1fc529d9e6242c2fe023a19cc9280ffefc282e41 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingContinuousRealization.lean @@ -0,0 +1,69 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingBlowupObservation +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFilteredLimit + +namespace OAI + +/-! # Joint continuity of the actual physical ball observation -/ + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) +local notation "Radius" => {L : ℝ // 1 ≤ L} + +noncomputable def expandingTorusRealization (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) : + FourierL2 →L[ℂ] C(SchrodingerTorus, ℂ) := + LinearMap.mkContinuous + { toFun := expandingTorusFunction a k L + map_add' := by + intro f g + ext x + simp only [expandingTorusFunction_eq_evaluation a k L ha ha1 hk hL, map_add, + ContinuousMap.add_apply] + map_smul' := by + intro c f + ext x + simp only [expandingTorusFunction_eq_evaluation a k L ha ha1 hk hL, map_smul, + ContinuousMap.smul_apply, RingHom.id_apply] } + (expandingEmbeddingBound a k) (expandingTorusFunction_norm_le a k L ha ha1 hk hL) + +theorem continuous_expandingPhysical_observation (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) : + Continuous (fun p : (Radius × FourierL2) × E => + expandingTorusFunction a k p.1.1.1 p.1.2 + (euclideanToTorus (p.1.1.1⁻¹ • p.2))) := by + have hi : Continuous (fun p : (Radius × FourierL2) × E => + expandingInverseTransfer a k p.1.1.1 ha hk p.1.1.2 p.1.2) := + ((continuous_expandingInverseTransfer a k ha hk).comp + (continuous_fst.comp continuous_fst)).clm_apply (continuous_snd.comp continuous_fst) + have hf : Continuous (fun p : (Radius × FourierL2) × E => + expandingTorusFunction a k 1 + (expandingInverseTransfer a k p.1.1.1 ha hk p.1.1.2 p.1.2)) := + (expandingTorusRealization a k 1 ha ha1 hk le_rfl).continuous.comp hi + have hy : Continuous (fun p : (Radius × FourierL2) × E => + euclideanToTorus (p.1.1.1⁻¹ • p.2)) := by + unfold euclideanToTorus + apply continuous_pi + intro j + have hR : Continuous (fun p : (Radius × FourierL2) × E => p.1.1.1⁻¹) := + (continuous_subtype_val.comp (continuous_fst.comp continuous_fst)).inv₀ + (fun p => by change p.1.1.1 ≠ 0; linarith [p.1.1.2]) + have hY : Continuous (fun p : (Radius × FourierL2) × E => p.2 j) := by fun_prop + exact (AddCircle.continuous_mk' (2 * Real.pi)).comp (hR.mul hY) + have he := continuous_eval.comp (hf.prodMk hy) + simpa only [Function.comp_def, expandingInverseTransfer_function a k _ ha ha1 hk] using he + +theorem continuous_expandingPhysicalBall (a k R : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) : + Continuous (fun p : Radius × FourierL2 => + expandingPhysicalBall a k p.1.1 R ha ha1 hk p.1.2 p.2) := by + apply ContinuousMap.continuous_of_continuous_uncurry _ + have hm : Continuous (fun p : (Radius × FourierL2) × Metric.closedBall (0 : E) R => + (p.1, (p.2 : E))) := + continuous_fst.prodMk (continuous_subtype_val.comp continuous_snd) + have h := (continuous_expandingPhysical_observation a k ha ha1 hk).comp hm + simpa only [Function.uncurry_def, Function.comp_def, expandingPhysicalBall_apply] using h + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingContinuousStep.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingContinuousStep.lean new file mode 100644 index 0000000000000000000000000000000000000000..8ddf4796f912e28aecb7aa034d0c33fc920e369e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingContinuousStep.lean @@ -0,0 +1,68 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfileContinuity +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingStepExistence + +namespace OAI + +/-! # A continuous actual nonlinear step for varying scale and initial data + +The already proved uniform small-data construction now yields a jointly +continuous selected trajectory and endpoint remainder. Uniqueness of the +small trajectory makes this independent of the existence proof's choices. +-/ + +open Set + +namespace DefocusingNLS + +attribute [local irreducible] expandingPicard expandingPerturbationReaction + expandingProfileTrajectory + +theorem exists_expandingContinuous_step + {P : Type*} [TopologicalSpace P] (a b k T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hT : 0 ≤ T) + (m : ℕ) (R : ℝ) (hR : 0 ≤ R) : + ∃ δ A : ℝ, 0 < δ ∧ 0 < A ∧ ∀ + (L : P → {L : ℝ // 1 ≤ L}) (q g : P → C(Icc (0 : ℝ) T, FourierL2)) (G : ℝ), + Continuous L → Continuous q → Continuous g → 0 ≤ G → G ≤ δ → + (hq : ∀ p t, ‖q p t‖ ≤ R) → (∀ p t, ‖g p t‖ ≤ G) → + ∃ (V : P × {f : FourierL2 // ‖f‖ ≤ δ} → C(Icc (0 : ℝ) T, FourierL2)) + (h : P × {f : FourierL2 // ‖f‖ ≤ δ} → FourierL2), + Continuous V ∧ Continuous h ∧ + (∀ z, V z = expandingPicard a b k (L z.1).1 T ha hk (L z.1).2 hT + (expandingPerturbationReaction a k (L z.1).1 T ha ha1 hk (L z.1).2 m + (q z.1) (g z.1)) z.2.1 (V z)) ∧ + (∀ z, ‖V z‖ ≤ A * (‖z.2.1‖ + G)) ∧ (∀ z, ‖V z‖ ≤ 1 / 2) ∧ + (∀ z, V z ⟨T, hT, le_rfl⟩ = + expandingProfileTrajectory a b k (L z.1).1 T ha ha1 hk (L z.1).2 hT + m R hR (q z.1) (hq z.1) z.2.1 ⟨T, hT, le_rfl⟩ + h z) := by + obtain ⟨δ, A, hδ, hA, _, hexists⟩ := + exists_expandingPerturbation_step_radius a b k T ha ha1 hk hT m R hR + refine ⟨δ, A, hδ, hA, ?_⟩ + intro L q g G hL hq hg hG hGδ hqb hgb + choose V hV hVbound hVhalf using + (fun z : P × {f : FourierL2 // ‖f‖ ≤ δ} => + hexists (L z.1).1 (L z.1).2 (q z.1) (g z.1) G hG hGδ (hqb z.1) (hgb z.1) + z.2.1 z.2.2) + let h : P × {f : FourierL2 // ‖f‖ ≤ δ} → FourierL2 := fun z => + V z ⟨T, hT, le_rfl⟩ - expandingProfileTrajectory a b k (L z.1).1 T ha ha1 hk + (L z.1).2 hT m R hR (q z.1) (hqb z.1) z.2.1 ⟨T, hT, le_rfl⟩ + have hu₀ : Continuous (fun z : P × {f : FourierL2 // ‖f‖ ≤ δ} => z.2.1) := + continuous_subtype_val.comp continuous_snd + have hcV : Continuous V := continuous_expandingPerturbation_family + (P := P × {f : FourierL2 // ‖f‖ ≤ δ}) a b k T R + ha ha1 hk hT m hR (fun z => L z.1) (hL.comp continuous_fst) + (fun z => q z.1) (fun z => g z.1) (hq.comp continuous_fst) (hg.comp continuous_fst) + (fun z => hqb z.1) (fun z => z.2.1) hu₀ V hV (fun z => (hVhalf z).trans (by norm_num)) + have hch : Continuous h := continuous_expandingStepRemainder_family + (P := P × {f : FourierL2 // ‖f‖ ≤ δ}) a b k T R + ha ha1 hk hT m hR (fun z => L z.1) (hL.comp continuous_fst) + (fun z => q z.1) (fun z => g z.1) (hq.comp continuous_fst) (hg.comp continuous_fst) + (fun z => hqb z.1) (fun z => z.2.1) hu₀ V hV (fun z => (hVhalf z).trans (by norm_num)) + refine ⟨V, h, hcV, hch, hV, hVbound, hVhalf, ?_⟩ + intro z + dsimp [h] + abel + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingConvolution.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingConvolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..47f5dad62618fe1d8bee9c86d223f3a8a6079e88 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingConvolution.lean @@ -0,0 +1,185 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFourier +import OAI.MathematicalPhysics.DefocusingNLS.Linear.SobolevConvolution + +namespace OAI + +/-! # Multiplication with the exact expanding-torus Fourier weight + +The constants below are independent of the expanding radius `L`. +-/ + +open scoped ENNReal + +namespace DefocusingNLS + +theorem weight_mul_norm_expandingFourierCoefficient (a k L : ℝ) (hL : 1 ≤ L) (f : FourierL2) + (n : frequencyLattice) : + expandingSobolevWeight a k L n * ‖expandingFourierCoefficient a k L f n‖ = ‖f n‖ := by + simpa only [norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_pos (expandingSobolevWeight_pos a k L hL n)] using + congrArg norm (weight_mul_expandingFourierCoefficient a k L hL f n) + +theorem norm_expandingFourierCoefficient_le (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (f : FourierL2) (n : frequencyLattice) : + ‖expandingFourierCoefficient a k L f n‖ ≤ expandingEmbeddingBound a k * ‖f‖ := by + have hs := summable_norm_expandingFourierCoefficient a k L ha ha1 hk hL f + have hn := hs.sum_le_tsum {n} (fun j _ => norm_nonneg (expandingFourierCoefficient a k L f j)) + have hn' : ‖expandingFourierCoefficient a k L f n‖ ≤ + ∑' j, ‖expandingFourierCoefficient a k L f j‖ := by simpa using hn + exact hn'.trans + (tsum_norm_expandingFourierCoefficient_le a k L ha ha1 hk hL f) + +/-- The physical coefficients of the product are the discrete convolution. -/ +noncomputable def expandingProductCoefficient (a k L : ℝ) (f g : FourierL2) + (n : frequencyLattice) : ℂ := + ∑' m, expandingFourierCoefficient a k L f m * expandingFourierCoefficient a k L g (n - m) + +theorem summable_norm_expandingProductTerms (a k L : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f g : FourierL2) + (n : frequencyLattice) : + Summable (fun m => ‖expandingFourierCoefficient a k L f m‖ * + ‖expandingFourierCoefficient a k L g (n - m)‖) := by + apply Summable.of_nonneg_of_le (fun m => mul_nonneg (norm_nonneg _) (norm_nonneg _)) + (fun m => mul_le_mul_of_nonneg_left (norm_expandingFourierCoefficient_le a k L ha ha1 hk hL g _) + (norm_nonneg _)) + exact (summable_norm_expandingFourierCoefficient a k L ha ha1 hk hL f).mul_right (expandingEmbeddingBound a k * ‖g‖) + +/-- The two unweighted Young convolutions which dominate the weighted product. -/ +noncomputable def expandingProductMajorant (a k L : ℝ) (f g : FourierL2) : FourierL2 := + Complex.ofReal (Real.sqrt ((4 : ℝ) ^ k)) • + (fourierConvolution (fun m => (‖expandingFourierCoefficient a k L f m‖ : ℂ)) (fourierAbsolute g) + + fourierConvolution (fun m => (‖expandingFourierCoefficient a k L g m‖ : ℂ)) (fourierAbsolute f)) + +theorem expandingProductMajorant_norm_apply (a k L : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f g : FourierL2) + (n : frequencyLattice) : + ‖expandingProductMajorant a k L f g n‖ = Real.sqrt (4 ^ k) * + ((∑' m, ‖expandingFourierCoefficient a k L f m‖ * ‖g (n - m)‖) + + ∑' m, ‖expandingFourierCoefficient a k L g m‖ * ‖f (n - m)‖) := by + simp only [expandingProductMajorant, lp.coeFn_smul, Pi.smul_apply, lp.coeFn_add, + Pi.add_apply, smul_eq_mul] + rw [absolute_convolution_apply _ (summable_norm_expandingFourierCoefficient a k L ha ha1 hk hL f), + absolute_convolution_apply _ (summable_norm_expandingFourierCoefficient a k L ha ha1 hk hL g), + ← Complex.ofReal_add, ← Complex.ofReal_mul, Complex.norm_real, Real.norm_eq_abs] + apply abs_of_nonneg + exact mul_nonneg (Real.sqrt_nonneg _) + (add_nonneg (tsum_nonneg (fun m => mul_nonneg (norm_nonneg _) (norm_nonneg _))) + (tsum_nonneg (fun m => mul_nonneg (norm_nonneg _) (norm_nonneg _)))) + +lemma expanding_weighted_product_term_bound (a k L : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f g : FourierL2) + (n m : frequencyLattice) : + expandingSobolevWeight a k L n * + (‖expandingFourierCoefficient a k L f m‖ * ‖expandingFourierCoefficient a k L g (n - m)‖) ≤ + Real.sqrt (4 ^ k) * (‖f m‖ * ‖expandingFourierCoefficient a k L g (n - m)‖ + + ‖expandingFourierCoefficient a k L f m‖ * ‖g (n - m)‖) := by + have hw := expandingSobolevWeight_add_le a k L ha ha1 hk hL m (n - m) + have hn : m + (n - m) = n := by abel + rw [hn] at hw + calc + _ ≤ (Real.sqrt (4 ^ k) * (expandingSobolevWeight a k L m + expandingSobolevWeight a k L (n - m))) * + (‖expandingFourierCoefficient a k L f m‖ * ‖expandingFourierCoefficient a k L g (n - m)‖) := + mul_le_mul_of_nonneg_right hw (mul_nonneg (norm_nonneg _) (norm_nonneg _)) + _ = _ := by + rw [← weight_mul_norm_expandingFourierCoefficient a k L hL f m, + ← weight_mul_norm_expandingFourierCoefficient a k L hL g (n - m)] + ring + +/-- The weighted convolution is bounded pointwise by an ℓ² vector. -/ +theorem weighted_expandingProduct_le_majorant (a k L : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f g : FourierL2) + (n : frequencyLattice) : + ‖(expandingSobolevWeight a k L n : ℂ) * expandingProductCoefficient a k L f g n‖ ≤ + ‖expandingProductMajorant a k L f g n‖ := by + let A := fun m : frequencyLattice => ‖f m‖ * ‖expandingFourierCoefficient a k L g (n - m)‖ + let B := fun m : frequencyLattice => ‖expandingFourierCoefficient a k L f m‖ * ‖g (n - m)‖ + have hA : Summable A := by + apply Summable.of_nonneg_of_le (fun m => mul_nonneg (norm_nonneg _) (norm_nonneg _)) + (fun m => mul_le_mul_of_nonneg_right + (lp.norm_apply_le_norm (by norm_num : (2 : ℝ≥0∞) ≠ 0) f m) (norm_nonneg _)) + exact ((Equiv.subLeft n).summable_iff.mpr + (summable_norm_expandingFourierCoefficient a k L ha ha1 hk hL g)).mul_left ‖f‖ + have hB : Summable B := by + apply Summable.of_nonneg_of_le (fun m => mul_nonneg (norm_nonneg _) (norm_nonneg _)) + (fun m => mul_le_mul_of_nonneg_left + (lp.norm_apply_le_norm (by norm_num : (2 : ℝ≥0∞) ≠ 0) g (n - m)) (norm_nonneg _)) + exact (summable_norm_expandingFourierCoefficient a k L ha ha1 hk hL f).mul_right ‖g‖ + have hp := summable_norm_expandingProductTerms a k L ha ha1 hk hL f g n + have hswap : (∑' m, A m) = + ∑' m, ‖expandingFourierCoefficient a k L g m‖ * ‖f (n - m)‖ := by + rw [← (Equiv.subLeft n).tsum_eq A] + simp only [A, Equiv.subLeft_apply, sub_sub_cancel, mul_comm] + rw [norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_pos (expandingSobolevWeight_pos a k L hL n), expandingProductMajorant_norm_apply a k L ha ha1 hk hL] + calc + _ ≤ expandingSobolevWeight a k L n * + ∑' m, ‖expandingFourierCoefficient a k L f m‖ * ‖expandingFourierCoefficient a k L g (n - m)‖ := by + apply mul_le_mul_of_nonneg_left _ (expandingSobolevWeight_pos a k L hL n).le + simpa only [expandingProductCoefficient, norm_mul] using + (norm_tsum_le_tsum_norm + (f := fun m => expandingFourierCoefficient a k L f m * expandingFourierCoefficient a k L g (n - m)) + (by simpa only [norm_mul] using hp)) + _ = ∑' m, expandingSobolevWeight a k L n * + (‖expandingFourierCoefficient a k L f m‖ * ‖expandingFourierCoefficient a k L g (n - m)‖) := + by rw [tsum_mul_left] + _ ≤ ∑' m, Real.sqrt (4 ^ k) * (A m + B m) := + (hp.mul_left _).tsum_le_tsum (fun m => expanding_weighted_product_term_bound a k L ha ha1 hk hL f g n m) + ((hA.add hB).mul_left _) + _ = _ := by rw [tsum_mul_left, hA.tsum_add hB, hswap]; ring + +/-- Multiplication closes with the exact expanding-torus Fourier weight. -/ +noncomputable def expandingProduct (a k L : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f g : FourierL2) : FourierL2 := + ⟨fun n => (expandingSobolevWeight a k L n : ℂ) * expandingProductCoefficient a k L f g n, + (lp.memℓp (expandingProductMajorant a k L f g)).mono' + (weighted_expandingProduct_le_majorant a k L ha ha1 hk hL f g)⟩ + +theorem expandingProduct_coefficient (a k L : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f g : FourierL2) + (n : frequencyLattice) : + expandingFourierCoefficient a k L (expandingProduct a k L ha ha1 hk hL f g) n = + expandingProductCoefficient a k L f g n := by + apply mul_left_cancel₀ (show (expandingSobolevWeight a k L n : ℂ) ≠ 0 from + Complex.ofReal_ne_zero.mpr (expandingSobolevWeight_pos a k L hL n).ne') + exact weight_mul_expandingFourierCoefficient a k L hL (expandingProduct a k L ha ha1 hk hL f g) n + +/-- A quantitative norm bound for the two-Young-convolution majorant. -/ +theorem expandingProductMajorant_norm_le (a k L : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f g : FourierL2) : + ‖expandingProductMajorant a k L f g‖ ≤ + 2 * Real.sqrt (4 ^ k) * expandingEmbeddingBound a k * ‖f‖ * ‖g‖ := by + have hf := summable_norm_expandingFourierCoefficient a k L ha ha1 hk hL f + have hg := summable_norm_expandingFourierCoefficient a k L ha ha1 hk hL g + have hcf := fourierConvolution_norm_le (fun m => (‖expandingFourierCoefficient a k L f m‖ : ℂ)) + (by simpa using hf) (fourierAbsolute g) + have hcg := fourierConvolution_norm_le (fun m => (‖expandingFourierCoefficient a k L g m‖ : ℂ)) + (by simpa using hg) (fourierAbsolute f) + simp only [Complex.norm_real, Real.norm_eq_abs, abs_norm, fourierAbsolute_norm] at hcf hcg + have hC : 0 ≤ Real.sqrt ((4 : ℝ) ^ k) := Real.sqrt_nonneg _ + calc + _ = Real.sqrt (4 ^ k) * ‖fourierConvolution + (fun m => (‖expandingFourierCoefficient a k L f m‖ : ℂ)) (fourierAbsolute g) + + fourierConvolution (fun m => (‖expandingFourierCoefficient a k L g m‖ : ℂ)) + (fourierAbsolute f)‖ := by + rw [expandingProductMajorant, norm_smul, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg hC] + _ ≤ Real.sqrt (4 ^ k) * + (‖fourierConvolution (fun m => (‖expandingFourierCoefficient a k L f m‖ : ℂ)) + (fourierAbsolute g)‖ + + ‖fourierConvolution (fun m => (‖expandingFourierCoefficient a k L g m‖ : ℂ)) + (fourierAbsolute f)‖) := mul_le_mul_of_nonneg_left (norm_add_le _ _) hC + _ ≤ Real.sqrt (4 ^ k) * ((∑' m, ‖expandingFourierCoefficient a k L f m‖) * ‖g‖ + + (∑' m, ‖expandingFourierCoefficient a k L g m‖) * ‖f‖) := + mul_le_mul_of_nonneg_left (add_le_add hcf hcg) hC + _ ≤ Real.sqrt (4 ^ k) * ((expandingEmbeddingBound a k * ‖f‖) * ‖g‖ + + (expandingEmbeddingBound a k * ‖g‖) * ‖f‖) := by + gcongr + · exact tsum_norm_expandingFourierCoefficient_le a k L ha ha1 hk hL f + · exact tsum_norm_expandingFourierCoefficient_le a k L ha ha1 hk hL g + _ = _ := by ring + +/-- The `Y_L` multiplication constant is independent of `L ≥ 1`. -/ +theorem expandingProduct_norm_le (a k L : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f g : FourierL2) : + ‖expandingProduct a k L ha ha1 hk hL f g‖ ≤ + 2 * Real.sqrt (4 ^ k) * expandingEmbeddingBound a k * ‖f‖ * ‖g‖ := by + exact (lp.norm_mono (by norm_num : (2 : ℝ≥0∞) ≠ 0) + (weighted_expandingProduct_le_majorant a k L ha ha1 hk hL f g)).trans + (expandingProductMajorant_norm_le a k L ha ha1 hk hL f g) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCoordinateMap.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCoordinateMap.lean new file mode 100644 index 0000000000000000000000000000000000000000..9be6657f414f57e6e7f8fe2a80fd7340ed52d0d6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCoordinateMap.lean @@ -0,0 +1,41 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousYLocalization + +namespace OAI + +/-! # Finite coordinates of localized torus data -/ + +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + +noncomputable def expandingCoordinates (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (χ : 𝓢(E, ℂ)) + (π : HomogeneousY a k →L[ℝ] F) (L : {L : ℝ // 1 ≤ L}) : FourierL2 →L[ℝ] F := + π.comp ((homogeneousLocalizationCLM a k L.1 ha ha1 hk L.2 χ).restrictScalars ℝ) + +@[simp] theorem expandingCoordinates_apply (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (χ : 𝓢(E, ℂ)) + (π : HomogeneousY a k →L[ℝ] F) (L : {L : ℝ // 1 ≤ L}) (f : FourierL2) : + expandingCoordinates a k ha ha1 hk χ π L f = + π (homogeneousLocalizationCLM a k L.1 ha ha1 hk L.2 χ f) := rfl + +theorem expandingCoordinates_norm_le (a k C : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hC : 0 ≤ C) (χ : 𝓢(E, ℂ)) + (π : HomogeneousY a k →L[ℝ] F) + (hCb : ∀ (L : ℝ) (hL : 1 ≤ L) (f : FourierL2), + ‖homogeneousLocalizationCLM a k L ha ha1 hk hL χ f‖ ≤ C * ‖f‖) + (L : {L : ℝ // 1 ≤ L}) : ‖expandingCoordinates a k ha ha1 hk χ π L‖ ≤ ‖π‖ * C := by + apply ContinuousLinearMap.opNorm_le_bound _ (mul_nonneg (norm_nonneg _) hC) + intro f + calc + _ ≤ ‖π‖ * ‖homogeneousLocalizationCLM a k L.1 ha ha1 hk L.2 χ f‖ := π.le_opNorm _ + _ ≤ ‖π‖ * (C * ‖f‖) := mul_le_mul_of_nonneg_left (hCb L.1 L.2 f) (norm_nonneg _) + _ = _ := (mul_assoc _ _ _).symm + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCoordinateSequence.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCoordinateSequence.lean new file mode 100644 index 0000000000000000000000000000000000000000..d135baa9f7e01436aaa83592872b1e5c9a1b6ac9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingCoordinateSequence.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingIdentifiedCompactness +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingCoordinateMap +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousRealCoordinateEvolution +import OAI.MathematicalPhysics.DefocusingNLS.Linear.WeakLinearCoordinates + +namespace OAI + +/-! # Finite-coordinate defects vanish along every bounded expanding sequence -/ + +open Set Filter Topology +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] [FiniteDimensional ℝ F] + +attribute [local irreducible] expandingProfileTrajectory + +theorem expandingProfile_coordinate_sequence (a b k T Q M C₀ : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 10 < k) (hT : 0 ≤ T) + (hQ : 0 ≤ Q) (hM : 0 ≤ M) (hC₀ : 0 ≤ C₀) (m : ℕ) + (χ : 𝓢(E, ℂ)) (ρ : ℝ) (hρ : 0 < ρ) (hχ : ∀ y : E, ‖y‖ ≤ ρ → χ y = 1) + (hCb : ∀ (L : ℝ) (hL : 1 ≤ L) (f : FourierL2), + ‖homogeneousLocalizationCLM a k L ha ha1 (by linarith) hL χ f‖ ≤ C₀ * ‖f‖) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (hLinf : Tendsto L atTop atTop) + (q : ℕ → C(Icc (0 : ℝ) T, FourierL2)) (hq : ∀ n t, ‖q n t‖ ≤ Q) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) (Q₀ : HomogeneousY a k) + (π : HomogeneousY a k →L[ℝ] F) (A : F →L[ℝ] F) + (hA : ∀ u, π (homogeneousLinearizedTrajectory a b k T ha ha1 (by linarith) hT m Q₀ u + ⟨T, hT, le_rfl⟩) = A (π u)) + (hqp : ∀ (s : Icc (0 : ℝ) T) (y : E), + Tendsto (fun n => expandingPhysicalContinuous a k (expandingRadius (L n) s) + ha ha1 (by linarith) ((hL n).trans (expandingRadius_ge (L n) s (hL n) s.2.1)) (q n s) y) + atTop (𝓝 (homogeneousPhysicalCLM a k ha ha1 (by linarith) Q₀ y))) : + ∀ ε : ℝ, 0 < ε → ∀ᶠ n in atTop, + ‖expandingCoordinates a k ha ha1 (by linarith) χ π + (expandingRadiusCurve (L n) T (hL n) ⟨T, hT, le_rfl⟩) + (expandingProfileTrajectory a b k (L n) T ha ha1 (by linarith) (hL n) hT + m Q hQ (q n) (hq n) (f n) ⟨T, hT, le_rfl⟩) - + A (expandingCoordinates a k ha ha1 (by linarith) χ π ⟨L n, hL n⟩ (f n))‖ < ε := by + have hk8 : 8 < k := by linarith + intro ε hε + by_contra h + obtain ⟨ψ, hψ, hbad⟩ := extraction_of_frequently_atTop (show ∃ᶠ n in atTop, + ε ≤ ‖expandingCoordinates a k ha ha1 hk8 χ π + (expandingRadiusCurve (L n) T (hL n) ⟨T, hT, le_rfl⟩) + (expandingProfileTrajectory a b k (L n) T ha ha1 hk8 (hL n) hT + m Q hQ (q n) (hq n) (f n) ⟨T, hT, le_rfl⟩) - + A (expandingCoordinates a k ha ha1 hk8 χ π ⟨L n, hL n⟩ (f n))‖ by + simpa only [not_eventually, not_lt] using h) + obtain ⟨φ, _hφ, _v, u₀, _hu₀, _hv, _hphysical, hweak⟩ := + expandingProfile_exists_identified_limit a b k T Q M C₀ ha ha1 hk hT hQ hM hC₀ m χ ρ hρ hχ hCb + (fun n => L (ψ n)) (fun n => hL (ψ n)) (hLinf.comp hψ.tendsto_atTop) + (fun n => q (ψ n)) (fun n => hq (ψ n)) (fun n => f (ψ n)) (fun n => hf (ψ n)) Q₀ + (fun t y => (hqp t y).comp hψ.tendsto_atTop) + let σ := fun n => ψ (φ n) + have hfina := tendsto_finite_coordinates_of_weak π _ _ (hweak ⟨T, hT, le_rfl⟩) + have hinit := tendsto_finite_coordinates_of_weak π _ _ (hweak ⟨0, le_rfl, hT⟩) + simp only [expandingProfileTrajectory_initial, expandingRadius, zero_div, Real.exp_zero, + mul_one, homogeneousLinearizedTrajectory_initial] at hinit + have htarget := A.continuous.continuousAt.tendsto.comp hinit + have hdefect := hfina.sub htarget + rw [hA, sub_self] at hdefect + have hnorm := hdefect.norm + have hsmall := hnorm.eventually (gt_mem_nhds (show ‖(0 : F)‖ < ε by simpa using hε)) + obtain ⟨j, hj⟩ := hsmall.exists + exact (not_lt_of_ge (hbad (φ j))) hj + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDecayingDuhamel.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDecayingDuhamel.lean new file mode 100644 index 0000000000000000000000000000000000000000..9f581d8eb0a17527dfb3392fb8e2b519484852e6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDecayingDuhamel.lean @@ -0,0 +1,62 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingWeightedDuhamel + +namespace OAI + +/-! # The decaying cutoff residual in the moving-scale Duhamel estimate + +The extra `exp(-t)` in the residual is integrable. Its propagated contribution +therefore retains the free decay with no factor depending on the slab length. +-/ + +open Set MeasureTheory + +namespace DefocusingNLS + +private theorem integral_exp_neg_Icc (t : ℝ) (ht : 0 ≤ t) : + (∫ τ in Icc 0 t, Real.exp (-τ)) = 1 - Real.exp (-t) := by + rw [integral_Icc_eq_integral_Ioc, ← intervalIntegral.integral_of_le ht] + have he : (fun τ : ℝ => Real.exp (-τ)) = fun τ => Real.exp ((-1 : ℝ) * τ) := by + funext τ + congr 1 + ring + rw [he, intervalIntegral.integral_comp_mul_left Real.exp (by norm_num : (-1 : ℝ) ≠ 0), + integral_exp] + simp only [neg_one_mul, mul_zero, Real.exp_zero, inv_neg, inv_one, smul_eq_mul] + ring + +/-- A source with the actual cutoff decay gives a free-decaying response. -/ +theorem expandingDuhamel_fast_source_norm_le (a b k L t C : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (ht : 0 ≤ t) (hC : 0 ≤ C) + (r : ℝ → FourierL2) + (hbound : ∀ τ ∈ Icc 0 t, ‖r τ‖ ≤ C * Real.exp (-(2 + a) * τ / 2)) : + ‖expandingDuhamel a b k L ha hk hL t r‖ ≤ C * Real.exp (-a * t / 2) := by + have hg : IntegrableOn (fun τ : ℝ => C * Real.exp (-a * t / 2) * Real.exp (-τ)) + (Icc 0 t) := (by fun_prop : Continuous + (fun τ : ℝ => C * Real.exp (-a * t / 2) * Real.exp (-τ))).continuousOn.integrableOn_compact + isCompact_Icc + have hi : ‖expandingDuhamel a b k L ha hk hL t r‖ ≤ + ∫ τ in Icc 0 t, C * Real.exp (-a * t / 2) * Real.exp (-τ) := by + apply norm_integral_le_of_norm_le hg + filter_upwards [ae_restrict_mem measurableSet_Icc] with τ hτ + rw [expandingDuhamelIntegrand_of_mem _ _ _ _ _ _ _ _ _ _ hτ] + apply (expandingFreeStep_norm_bound a b k (expandingRadius L τ) (t - τ) ha hk + (hL.trans (expandingRadius_ge L τ hL hτ.1)) (sub_nonneg.mpr hτ.2) (r τ)).trans + calc + _ ≤ Real.exp (-a * (t - τ) / 2) * (C * Real.exp (-(2 + a) * τ / 2)) := + mul_le_mul_of_nonneg_left (hbound τ hτ) (Real.exp_pos _).le + _ = C * Real.exp (-a * t / 2) * Real.exp (-τ) := by + have he : Real.exp (-a * (t - τ) / 2) * Real.exp (-(2 + a) * τ / 2) = + Real.exp (-a * t / 2) * Real.exp (-τ) := by + rw [← Real.exp_add, ← Real.exp_add] + congr 1 + ring + calc + _ = C * (Real.exp (-a * (t - τ) / 2) * Real.exp (-(2 + a) * τ / 2)) := by ring + _ = _ := by rw [he]; ring + rw [integral_const_mul, integral_exp_neg_Icc t ht] at hi + exact hi.trans (mul_le_of_le_one_right (mul_nonneg hC (Real.exp_pos _).le) + (by linarith [Real.exp_pos (-t)])) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDerivativeBounds.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDerivativeBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..81694e26d4e9d5c452c27436f2dfb158d07e248f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDerivativeBounds.lean @@ -0,0 +1,121 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingNonlinearity +import Mathlib.Analysis.Calculus.ContDiff.Bounds +import Mathlib.Analysis.Calculus.MeanValue + +namespace OAI + +/-! # Scale-uniform derivatives of the actual expanding-torus nonlinearity -/ + +open Set Metric + +namespace DefocusingNLS + +private theorem expanding_linear_two_jet_bound (L : FourierL2 →L[ℝ] FourierL2) + (R : ℝ) (hR : 0 ≤ R) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ f : FourierL2, ‖f‖ ≤ R → ∀ n : ℕ, n ≤ 2 → + ‖iteratedFDeriv ℝ n (fun g => L g) f‖ ≤ C := by + refine ⟨(‖L‖ + 1) * (R + 1), by positivity, ?_⟩ + intro f hf n hn + have hLn := norm_nonneg L + have hLR : 0 ≤ ‖L‖ * R := mul_nonneg hLn hR + interval_cases n + · rw [norm_iteratedFDeriv_zero] + have h := L.le_opNorm f + have h' := mul_le_mul_of_nonneg_left hf hLn + nlinarith + · rw [norm_iteratedFDeriv_one, L.fderiv] + nlinarith + · rw [← norm_iteratedFDeriv_fderiv (n := 1), norm_iteratedFDeriv_one] + have hderiv : fderiv ℝ (fun g => L g) = fun _ => L := funext (fun g => L.fderiv) + rw [hderiv] + simp only [fderiv_const_apply, norm_zero] + positivity + +private theorem expanding_bilinear_two_jet_bound (B : FourierL2 →L[ℝ] FourierL2 →L[ℝ] FourierL2) + (F G : FourierL2 → FourierL2) (hF : ContDiff ℝ ⊤ F) (hG : ContDiff ℝ ⊤ G) + (K : ℝ) (hK : 0 ≤ K) (hBK : ‖B‖ ≤ K) + (R A D : ℝ) (hA : 0 ≤ A) (hD : 0 ≤ D) + (hFb : ∀ f : FourierL2, ‖f‖ ≤ R → ∀ n : ℕ, n ≤ 2 → ‖iteratedFDeriv ℝ n F f‖ ≤ A) + (hGb : ∀ f : FourierL2, ‖f‖ ≤ R → ∀ n : ℕ, n ≤ 2 → ‖iteratedFDeriv ℝ n G f‖ ≤ D) : + ∀ f : FourierL2, ‖f‖ ≤ R → ∀ n : ℕ, n ≤ 2 → + ‖iteratedFDeriv ℝ n (fun g => B (F g) (G g)) f‖ ≤ 4 * K * A * D := by + intro f hf n hn + have hsum : (∑ i ∈ Finset.range (n + 1), (n.choose i : ℝ)) = (2 : ℝ) ^ n := by + exact_mod_cast Nat.sum_range_choose n + have hp : (2 : ℝ) ^ n ≤ 4 := by interval_cases n <;> norm_num + calc + _ ≤ ‖B‖ * ∑ i ∈ Finset.range (n + 1), + (n.choose i : ℝ) * ‖iteratedFDeriv ℝ i F f‖ * ‖iteratedFDeriv ℝ (n - i) G f‖ := + B.norm_iteratedFDeriv_le_of_bilinear hF hG f (by simp) + _ ≤ K * ∑ i ∈ Finset.range (n + 1), + (n.choose i : ℝ) * ‖iteratedFDeriv ℝ i F f‖ * ‖iteratedFDeriv ℝ (n - i) G f‖ := + mul_le_mul_of_nonneg_right hBK (by positivity) + _ ≤ K * ∑ i ∈ Finset.range (n + 1), (n.choose i : ℝ) * A * D := by + apply mul_le_mul_of_nonneg_left _ hK + apply Finset.sum_le_sum + intro i hi + have hi' : i ≤ n := Nat.le_of_lt_succ (Finset.mem_range.mp hi) + gcongr + · exact hFb f hf i (hi'.trans hn) + · exact hGb f hf (n - i) ((Nat.sub_le n i).trans hn) + _ = K * ((2 : ℝ) ^ n * A * D) := by + rw [← Finset.sum_mul, ← Finset.sum_mul, hsum] + _ = (K * A * D) * (2 : ℝ) ^ n := by ring + _ ≤ (K * A * D) * 4 := mul_le_mul_of_nonneg_left hp (by positivity) + _ = 4 * K * A * D := by ring + +/-- Derivatives through order two are bounded uniformly for every `L ≥ 1`. -/ +theorem exists_expandingOddPower_two_jet_bound (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) (R : ℝ) (hR : 0 ≤ R) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ (L : ℝ) (hL : 1 ≤ L) (f : FourierL2), ‖f‖ ≤ R → + ∀ n : ℕ, n ≤ 2 → ‖iteratedFDeriv ℝ n (expandingOddPower a k L ha ha1 hk hL m) f‖ ≤ C := by + obtain ⟨J, hJ, hJb⟩ := expanding_linear_two_jet_bound (ContinuousLinearMap.id ℝ FourierL2) R hR + obtain ⟨D, hD, hDb⟩ := expanding_linear_two_jet_bound sobolevConjugation R hR + let K := expandingAlgebraBound a k + have hK : 0 ≤ K := expandingAlgebraBound_nonneg a k + induction m with + | zero => + exact ⟨J, hJ, fun _ _ => hJb⟩ + | succ m ih => + obtain ⟨A, hA, hAb⟩ := ih + refine ⟨4 * K * (4 * K * A * D) * J, by positivity, ?_⟩ + intro L hL + let B := expandingRealBilinearProduct a k L ha ha1 hk hL + let F : FourierL2 → FourierL2 := fun f => + B (expandingOddPower a k L ha ha1 hk hL m f) (sobolevConjugation f) + have hBK : ‖B‖ ≤ K := expandingRealBilinearProduct_norm_le a k L ha ha1 hk hL + have hF : ContDiff ℝ ⊤ F := + (B.contDiff.comp (contDiff_expandingOddPower a k L ha ha1 hk hL m)).clm_apply + sobolevConjugation.contDiff + have hFb : ∀ f : FourierL2, ‖f‖ ≤ R → ∀ n : ℕ, n ≤ 2 → + ‖iteratedFDeriv ℝ n F f‖ ≤ 4 * K * A * D := + expanding_bilinear_two_jet_bound B (expandingOddPower a k L ha ha1 hk hL m) + sobolevConjugation (contDiff_expandingOddPower a k L ha ha1 hk hL m) + sobolevConjugation.contDiff K hK hBK R A D hA hD (hAb L hL) hDb + exact expanding_bilinear_two_jet_bound B F (fun f => f) hF contDiff_id K hK hBK + R (4 * K * A * D) J (by positivity) hJ hFb hJb + +/-- The derivative is Lipschitz on each ball, uniformly in the torus radius. -/ +theorem exists_expandingOddPower_derivative_lipschitz (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) (R : ℝ) (hR : 0 ≤ R) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ (L : ℝ) (hL : 1 ≤ L) (f g : FourierL2), + ‖f‖ ≤ R → ‖g‖ ≤ R → + ‖fderiv ℝ (expandingOddPower a k L ha ha1 hk hL m) f - + fderiv ℝ (expandingOddPower a k L ha ha1 hk hL m) g‖ ≤ C * ‖f - g‖ := by + obtain ⟨C, hC, hCb⟩ := exists_expandingOddPower_two_jet_bound a k ha ha1 hk m R hR + refine ⟨C, hC, ?_⟩ + intro L hL f g hf hg + have hdiff : Differentiable ℝ (fderiv ℝ (expandingOddPower a k L ha ha1 hk hL m)) := + (contDiff_infty_iff_fderiv.mp ((contDiff_expandingOddPower a k L ha ha1 hk hL m).of_le + (by simp))).2.differentiable (by simp) + apply (convex_closedBall (0 : FourierL2) R).norm_image_sub_le_of_norm_fderiv_le + (fun x hx => hdiff x) + · intro x hx + rw [← norm_iteratedFDeriv_one, norm_iteratedFDeriv_fderiv] + exact hCb L hL x (by simpa using hx) 2 le_rfl + · simpa using hg + · simpa using hf + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDerivativeWeight.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDerivativeWeight.lean new file mode 100644 index 0000000000000000000000000000000000000000..027cb62a8d69a04aacd0b93a7fe67fc4ab440d64 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDerivativeWeight.lean @@ -0,0 +1,86 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingWeightAddition + +namespace OAI + +/-! # One physical derivative costs one high-frequency Sobolev order uniformly in radius -/ + +namespace DefocusingNLS + +private theorem derivative_density_bound (a k L x : ℝ) (ha : 0 < a) (ha1 : a < 1) + (hk : 8 < k) (hL : 1 ≤ L) (hx : 0 ≤ x) : + ((L ^ (-2 : ℝ) + x ^ 2) ^ (6 - a) + x ^ (2 * k)) * x ^ 2 ≤ + (2 ^ (6 - a) + 1) ^ 2 * + ((L ^ (-2 : ℝ) + x ^ 2) ^ (6 - a) + x ^ (2 * (k + 1))) := by + by_cases hz : x = 0 + · subst x + simp only [ne_eq, OfNat.ofNat_ne_zero, not_false_eq_true, zero_pow, add_zero, mul_zero] + positivity + have hxp : 0 < x := lt_of_le_of_ne hx (Ne.symm hz) + have hp (s : ℝ) : x ^ (2 * s) * x ^ 2 = x ^ (2 * (s + 1)) := by + rw [← Real.rpow_natCast, ← Real.rpow_add hxp] + congr 1 + ring + let A := (L ^ (-2 : ℝ) + x ^ 2) ^ (6 - a) + let H := x ^ (2 * (k + 1)) + let C : ℝ := 2 ^ (6 - a) + 1 + have hA : 0 ≤ A := Real.rpow_nonneg (by positivity) _ + have hH : 0 ≤ H := Real.rpow_nonneg hx _ + have hC : 1 ≤ C := le_add_of_nonneg_left (by positivity) + have hlow : A * x ^ 2 ≤ C * (A + H) - H := by + by_cases hx1 : x ≤ 1 + · have hx2 : x ^ 2 ≤ 1 := by nlinarith + have hl := mul_le_mul_of_nonneg_left hx2 hA + have he : 0 ≤ (C - 1) * (A + H) := mul_nonneg (by linarith) (add_nonneg hA hH) + nlinarith + · have hx1' : 1 ≤ x := le_of_lt (lt_of_not_ge hx1) + have hLpow : L ^ (-2 : ℝ) ≤ 1 := + Real.rpow_le_one_of_one_le_of_nonpos hL (by norm_num) + have hbase : L ^ (-2 : ℝ) + x ^ 2 ≤ 2 * x ^ 2 := by nlinarith + have hAp : A ≤ 2 ^ (6 - a) * x ^ (2 * (6 - a)) := by + calc + A ≤ (2 * x ^ 2) ^ (6 - a) := Real.rpow_le_rpow (by positivity) hbase (by linarith) + _ = _ := by + rw [Real.mul_rpow (by norm_num) (sq_nonneg x), + ← Real.rpow_natCast, ← Real.rpow_mul hx] + norm_num + have he : x ^ (2 * (6 - a)) * x ^ 2 ≤ H := by + rw [hp] + exact Real.rpow_le_rpow_of_exponent_le hx1' (by linarith) + have hb : A * x ^ 2 ≤ 2 ^ (6 - a) * H := by + calc + _ ≤ (2 ^ (6 - a) * x ^ (2 * (6 - a))) * x ^ 2 := + mul_le_mul_of_nonneg_right hAp (sq_nonneg x) + _ = 2 ^ (6 - a) * (x ^ (2 * (6 - a)) * x ^ 2) := by ring + _ ≤ _ := mul_le_mul_of_nonneg_left he (by positivity) + have hh : 0 ≤ C * A := mul_nonneg (by linarith) hA + dsimp [C] at * + nlinarith + have hCsq : C ≤ C ^ 2 := by nlinarith + calc + _ = A * x ^ 2 + H := by rw [add_mul, hp] + _ ≤ C * (A + H) := by linarith + _ ≤ C ^ 2 * (A + H) := mul_le_mul_of_nonneg_right hCsq (add_nonneg hA hH) + _ = _ := rfl + +theorem expandingSobolevWeight_derivative_le (a k L : ℝ) (ha : 0 < a) (ha1 : a < 1) + (hk : 8 < k) (hL : 1 ≤ L) (n : frequencyLattice) : + expandingSobolevWeight a k L n * (‖n‖ / L) ≤ + (2 ^ (6 - a) + 1) * expandingSobolevWeight a (k + 1) L n := by + have hLp : 0 < L := by linarith + have hb := mul_le_mul_of_nonneg_left + (derivative_density_bound a k L (‖n‖ / L) ha ha1 hk hL (by positivity)) + (show 0 ≤ (2 * Real.pi * L) ^ (12 : ℕ) by positivity) + have hw (j : ℝ) : expandingSobolevWeight a j L n ^ 2 = + (2 * Real.pi * L) ^ (12 : ℕ) * + ((L ^ (-2 : ℝ) + (‖n‖ / L) ^ 2) ^ (6 - a) + (‖n‖ / L) ^ (2 * j)) := by + rw [expandingSobolevWeight_sq a j L hL, expandingSobolevWeightSq_original a j L hL] + have hs : (expandingSobolevWeight a k L n * (‖n‖ / L)) ^ 2 ≤ + ((2 ^ (6 - a) + 1) * expandingSobolevWeight a (k + 1) L n) ^ 2 := by + rw [mul_pow, mul_pow, hw k, hw (k + 1)] + nlinarith only [hb] + exact (sq_le_sq₀ (mul_nonneg (expandingSobolevWeight_pos a k L hL n).le (by positivity)) (by + exact mul_nonneg (by positivity) (expandingSobolevWeight_pos a (k + 1) L hL n).le)).mp hs + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDualForcingBound.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDualForcingBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..df28dbf02d1ac01c262f62bb7ee1a3e7f2cf8a7b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDualForcingBound.lean @@ -0,0 +1,66 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingDuhamelDuality + +namespace OAI + +/-! # Uniform domination for the actual dual Duhamel integrand -/ + +open Set MeasureTheory +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem expandingDualDuhamelIntegrand_eq (a b k L t : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (ht : 0 ≤ t) + (φ : 𝓢(E, ℂ)) (r : ℝ → FourierL2) (s : ℝ) : + expandingDualDuhamelIntegrand a b k L t ha ha1 hk hL φ r s = + expandingFourierTest a k (expandingRadius L t) ha ha1 hk + (hL.trans (expandingRadius_ge L t hL ht)) φ + (expandingDuhamelIntegrand a b k L ha hk hL t r s) := by + by_cases hs : s ∈ Icc 0 t + · simp only [expandingDualDuhamelIntegrand, dite_eq_left hs, + expandingDuhamelIntegrand_of_mem _ _ _ _ _ _ _ _ _ _ hs] + have h := expandingFreeStep_fourier_duality a b k (expandingRadius L s) (t - s) + ha ha1 hk (hL.trans (expandingRadius_ge L s hL hs.1)) (sub_nonneg.mpr hs.2) φ (r s) + simpa only [expandingDuhamel_destination] using h.symm + · simp only [expandingDualDuhamelIntegrand, expandingDuhamelIntegrand, + dite_eq_right hs, map_zero] + +theorem integrableOn_expandingDualDuhamelIntegrand (a b k L t : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (ht : 0 ≤ t) + (φ : 𝓢(E, ℂ)) (r : ℝ → FourierL2) (hr : ContinuousOn r (Icc 0 t)) : + IntegrableOn (expandingDualDuhamelIntegrand a b k L t ha ha1 hk hL φ r) (Icc 0 t) := by + have he : expandingDualDuhamelIntegrand a b k L t ha ha1 hk hL φ r = + fun s => expandingFourierTest a k (expandingRadius L t) ha ha1 hk + (hL.trans (expandingRadius_ge L t hL ht)) φ + (expandingDuhamelIntegrand a b k L ha hk hL t r s) := + funext (expandingDualDuhamelIntegrand_eq a b k L t ha ha1 hk hL ht φ r) + rw [he] + exact (expandingFourierTest a k (expandingRadius L t) ha ha1 hk + (hL.trans (expandingRadius_ge L t hL ht)) φ).integrable_comp + (integrableOn_expandingDuhamelIntegrand a b k L ha hk hL t r hr) + +theorem expandingDualDuhamelIntegrand_bound (a b k L t M : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (ht : 0 ≤ t) + (φ : 𝓢(E, ℂ)) (r : ℝ → FourierL2) (s : ℝ) (hs : s ∈ Icc 0 t) + (hr : ‖r s‖ ≤ M) : + ‖expandingDualDuhamelIntegrand a b k L t ha ha1 hk hL φ r s‖ ≤ + (expandingEmbeddingBound a k * SchwartzMap.seminorm ℂ 0 0 φ) * M := by + rw [expandingDualDuhamelIntegrand_eq a b k L t ha ha1 hk hL ht, + expandingDuhamelIntegrand_of_mem _ _ _ _ _ _ _ _ _ _ hs] + let F := expandingFourierTest a k (expandingRadius L t) ha ha1 hk + (hL.trans (expandingRadius_ge L t hL ht)) φ + have hf := expandingFreeStep_norm_bound a b k (expandingRadius L s) (t - s) ha hk + (hL.trans (expandingRadius_ge L s hL hs.1)) (sub_nonneg.mpr hs.2) (r s) + have he : Real.exp (-a * (t - s) / 2) ≤ 1 := Real.exp_le_one_iff.mpr (by nlinarith [hs.2]) + have hstep : ‖expandingFreeStep a b k (expandingRadius L s) (t - s) ha hk + (hL.trans (expandingRadius_ge L s hL hs.1)) (sub_nonneg.mpr hs.2) (r s)‖ ≤ M := + hf.trans ((mul_le_of_le_one_left (norm_nonneg _) he).trans hr) + exact (F.le_opNorm _).trans + (mul_le_mul (expandingFourierTest_norm_le a k _ ha ha1 hk _ φ) hstep + (norm_nonneg _) (by unfold expandingEmbeddingBound; positivity)) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDuhamel.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDuhamel.lean new file mode 100644 index 0000000000000000000000000000000000000000..5d1740b313300b705cd82075f87c15f8f83df011 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDuhamel.lean @@ -0,0 +1,134 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFreeContinuity +import Mathlib.MeasureTheory.Integral.Bochner.Set + +namespace OAI + +/-! # Inhomogeneous propagation in the exact expanding Sobolev norms + +The forcing at time `τ` is represented in `Y_(L exp(τ/2))`. Its free transport +therefore lands in the same final space `Y_(L exp(t/2))` for every `τ ∈ [0,t]`. +The estimate keeps the exact exponential kernel and is uniform in `L ≥ 1`. +-/ + +open MeasureTheory Set + +namespace DefocusingNLS + +noncomputable def expandingDuhamelIntegrand (a b k L : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) + (t : ℝ) (r : ℝ → FourierL2) (τ : ℝ) : FourierL2 := + if h : τ ∈ Icc 0 t then + expandingFreeStep a b k (expandingRadius L τ) (t - τ) ha hk + (hL.trans (expandingRadius_ge L τ hL h.1)) (sub_nonneg.mpr h.2) (r τ) + else 0 + +noncomputable def expandingDuhamel (a b k L : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) + (t : ℝ) (r : ℝ → FourierL2) : FourierL2 := + ∫ τ in Icc 0 t, expandingDuhamelIntegrand a b k L ha hk hL t r τ + +@[simp] theorem expandingDuhamelIntegrand_of_mem (a b k L : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) + (t : ℝ) (r : ℝ → FourierL2) (τ : ℝ) (hτ : τ ∈ Icc 0 t) : + expandingDuhamelIntegrand a b k L ha hk hL t r τ = + expandingFreeStep a b k (expandingRadius L τ) (t - τ) ha hk + (hL.trans (expandingRadius_ge L τ hL hτ.1)) (sub_nonneg.mpr hτ.2) (r τ) := by + simp only [expandingDuhamelIntegrand, dite_eq_left hτ] + +/-- Every forcing time is transported into the prescribed final expanding torus. -/ +theorem expandingDuhamel_destination (L t τ : ℝ) : + expandingRadius (expandingRadius L τ) (t - τ) = expandingRadius L t := by + rw [expandingRadius_add] + congr 1 + ring + +theorem continuousOn_expandingDuhamelIntegrand (a b k L : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) + (t : ℝ) (r : ℝ → FourierL2) (hr : ContinuousOn r (Icc 0 t)) : + ContinuousOn (expandingDuhamelIntegrand a b k L ha hk hL t r) (Icc 0 t) := by + let p : Icc (0 : ℝ) t → ExpandingFreeParameters := fun τ => + (⟨expandingRadius L τ, hL.trans (expandingRadius_ge L τ hL τ.2.1)⟩, + ⟨t - τ, sub_nonneg.mpr τ.2.2⟩) + have hp : Continuous p := by + apply Continuous.prodMk + · apply Continuous.subtype_mk + unfold expandingRadius + exact continuous_const.mul (Real.continuous_exp.comp (continuous_subtype_val.div_const 2)) + · apply Continuous.subtype_mk + exact continuous_const.sub continuous_subtype_val + rw [continuousOn_iff_continuous_domRestrict] + convert (continuous_expandingFreeFamily_uncurry a b k ha hk).comp + (hp.prodMk hr.domRestrict) using 1 + ext τ + simp only [domRestrict_apply, expandingDuhamelIntegrand_of_mem _ _ _ _ _ _ _ _ _ _ τ.2] + rfl + +theorem integrableOn_expandingDuhamelIntegrand (a b k L : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) + (t : ℝ) (r : ℝ → FourierL2) (hr : ContinuousOn r (Icc 0 t)) : + IntegrableOn (expandingDuhamelIntegrand a b k L ha hk hL t r) (Icc 0 t) := + (continuousOn_expandingDuhamelIntegrand a b k L ha hk hL t r hr).integrableOn_compact isCompact_Icc + +/-- Variation of constants has the manuscript's `exp(-a (t-τ)/2)` bound. -/ +theorem expandingDuhamel_norm_le (a b k L : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) + (t : ℝ) (r : ℝ → FourierL2) (hr : ContinuousOn r (Icc 0 t)) : + ‖expandingDuhamel a b k L ha hk hL t r‖ ≤ + ∫ τ in Icc 0 t, Real.exp (-a * (t - τ) / 2) * ‖r τ‖ := by + have hg : IntegrableOn (fun τ => Real.exp (-a * (t - τ) / 2) * ‖r τ‖) (Icc 0 t) := + ((Real.continuous_exp.comp (by fun_prop)).continuousOn.mul hr.norm).integrableOn_compact + isCompact_Icc + apply norm_integral_le_of_norm_le hg + filter_upwards [ae_restrict_mem measurableSet_Icc] with τ hτ + rw [expandingDuhamelIntegrand_of_mem _ _ _ _ _ _ _ _ _ _ hτ] + exact expandingFreeStep_norm_bound a b k (expandingRadius L τ) (t - τ) ha hk + (hL.trans (expandingRadius_ge L τ hL hτ.1)) (sub_nonneg.mpr hτ.2) (r τ) + +/-- The inhomogeneous operator is linear in continuous forcing histories. -/ +theorem expandingDuhamel_sub (a b k L : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) + (t : ℝ) (r q : ℝ → FourierL2) + (hr : ContinuousOn r (Icc 0 t)) (hq : ContinuousOn q (Icc 0 t)) : + expandingDuhamel a b k L ha hk hL t (fun τ => r τ - q τ) = + expandingDuhamel a b k L ha hk hL t r - expandingDuhamel a b k L ha hk hL t q := by + unfold expandingDuhamel + rw [← integral_sub (integrableOn_expandingDuhamelIntegrand a b k L ha hk hL t r hr) + (integrableOn_expandingDuhamelIntegrand a b k L ha hk hL t q hq)] + apply integral_congr_ae + filter_upwards [ae_restrict_mem measurableSet_Icc] with τ hτ + simp only [expandingDuhamelIntegrand_of_mem _ _ _ _ _ _ _ _ _ _ hτ, map_sub] + +/-- The same exponential kernel controls perturbations of the forcing history. -/ +theorem expandingDuhamel_sub_norm_le (a b k L : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) + (t : ℝ) (r q : ℝ → FourierL2) + (hr : ContinuousOn r (Icc 0 t)) (hq : ContinuousOn q (Icc 0 t)) : + ‖expandingDuhamel a b k L ha hk hL t r - expandingDuhamel a b k L ha hk hL t q‖ ≤ + ∫ τ in Icc 0 t, Real.exp (-a * (t - τ) / 2) * ‖r τ - q τ‖ := by + rw [← expandingDuhamel_sub a b k L ha hk hL t r q hr hq] + exact expandingDuhamel_norm_le a b k L ha hk hL t (fun τ => r τ - q τ) (hr.sub hq) + +/-- A bounded forcing gives a scale-independent short-time estimate. -/ +theorem expandingDuhamel_norm_le_mul (a b k L : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) + (t C : ℝ) (ht : 0 ≤ t) (r : ℝ → FourierL2) + (hr : ContinuousOn r (Icc 0 t)) (hbound : ∀ τ ∈ Icc 0 t, ‖r τ‖ ≤ C) : + ‖expandingDuhamel a b k L ha hk hL t r‖ ≤ t * C := by + have _hi := integrableOn_expandingDuhamelIntegrand a b k L ha hk hL t r hr + have hpoint (τ : ℝ) (hτ : τ ∈ Icc 0 t) : + ‖expandingDuhamelIntegrand a b k L ha hk hL t r τ‖ ≤ C := by + rw [expandingDuhamelIntegrand_of_mem _ _ _ _ _ _ _ _ _ _ hτ] + apply (expandingFreeStep_norm_bound a b k (expandingRadius L τ) (t - τ) ha hk + (hL.trans (expandingRadius_ge L τ hL hτ.1)) (sub_nonneg.mpr hτ.2) (r τ)).trans + exact (mul_le_of_le_one_left (norm_nonneg _) (Real.exp_le_one_iff.mpr (by + nlinarith [hτ.2]))).trans (hbound τ hτ) + have hb := norm_integral_le_of_norm_le (f := expandingDuhamelIntegrand a b k L ha hk hL t r) + (μ := volume.restrict (Icc 0 t)) (g := fun _ => C) + (integrableOn_const isCompact_Icc.measure_ne_top) + (by filter_upwards [ae_restrict_mem measurableSet_Icc] with τ hτ; exact hpoint τ hτ) + simpa only [expandingDuhamel, setIntegral_const, Real.volume_real_Icc_of_le ht, sub_zero, + smul_eq_mul] using hb + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDuhamelContinuity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDuhamelContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..04080be9b46ff4862f1f61b4edb2b4e8d26cc54f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDuhamelContinuity.lean @@ -0,0 +1,136 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingDuhamel +import Mathlib.Topology.Order.ProjIcc +import Mathlib.MeasureTheory.Integral.IntervalIntegral.Basic + +namespace OAI + +/-! # Continuity of the moving-scale Duhamel map + +Rescaling the integration time to the fixed unit interval gives strong +continuity, including at time zero, without operator-norm continuity. +-/ + +open Set MeasureTheory + +namespace DefocusingNLS + +attribute [local irreducible] expandingFreeStep expandingFreeFamily + +private noncomputable def unitTime (u : ℝ) : Icc (0 : ℝ) 1 := + projIcc 0 1 zero_le_one u + +private noncomputable def expandingDuhamelParameters (p : ExpandingFreeParameters) + (u : ℝ) : ExpandingFreeParameters := + (⟨expandingRadius p.1.1 ((p.2 : ℝ) * unitTime u), + p.1.2.trans (expandingRadius_ge _ _ p.1.2 (mul_nonneg p.2.2 (unitTime u).2.1))⟩, + ⟨(p.2 : ℝ) - (p.2 : ℝ) * unitTime u, + sub_nonneg.mpr (mul_le_of_le_one_right p.2.2 (unitTime u).2.2)⟩) + +private theorem continuous_expandingDuhamelParameters : + Continuous (fun z : ExpandingFreeParameters × ℝ => expandingDuhamelParameters z.1 z.2) := by + have hL : Continuous (fun z : ExpandingFreeParameters × ℝ => z.1.1.1) := + continuous_subtype_val.comp (continuous_fst.comp continuous_fst) + have hs : Continuous (fun z : ExpandingFreeParameters × ℝ => (z.1.2 : ℝ)) := + continuous_subtype_val.comp (continuous_snd.comp continuous_fst) + have hu : Continuous (fun z : ExpandingFreeParameters × ℝ => (unitTime z.2 : ℝ)) := + continuous_subtype_val.comp (continuous_projIcc.comp continuous_snd) + apply Continuous.prodMk + · apply Continuous.subtype_mk + exact hL.mul (Real.continuous_exp.comp ((hs.mul hu).div_const 2)) + · apply Continuous.subtype_mk + exact hs.sub (hs.mul hu) + +private noncomputable def expandingUnitDuhamelIntegrand (a b k : ℝ) + (ha : 0 < a) (hk : 8 < k) (r : ℝ → FourierL2) + (p : ExpandingFreeParameters) (u : ℝ) : FourierL2 := + expandingFreeFamily a b k ha hk (expandingDuhamelParameters p u) + (r ((p.2 : ℝ) * unitTime u)) + +private theorem continuous_expandingUnitDuhamelIntegrand (a b k : ℝ) + (ha : 0 < a) (hk : 8 < k) (r : ℝ → FourierL2) (hr : Continuous r) : + Continuous (fun z : ExpandingFreeParameters × ℝ => + expandingUnitDuhamelIntegrand a b k ha hk r z.1 z.2) := by + have harg : Continuous (fun z : ExpandingFreeParameters × ℝ => + (expandingDuhamelParameters z.1 z.2, r ((z.1.2 : ℝ) * unitTime z.2))) := by + apply continuous_expandingDuhamelParameters.prodMk + apply hr.comp + exact (continuous_subtype_val.comp (continuous_snd.comp continuous_fst)).mul + (continuous_subtype_val.comp (continuous_projIcc.comp continuous_snd)) + unfold expandingUnitDuhamelIntegrand + exact (continuous_expandingFreeFamily_uncurry a b k ha hk).comp harg + +private theorem expandingUnitDuhamelIntegrand_eq (a b k : ℝ) + (ha : 0 < a) (hk : 8 < k) (r : ℝ → FourierL2) + (p : ExpandingFreeParameters) (u : ℝ) (hu : u ∈ Icc 0 1) : + expandingUnitDuhamelIntegrand a b k ha hk r p u = + expandingDuhamelIntegrand a b k p.1.1 ha hk p.1.2 p.2 r ((p.2 : ℝ) * u) := by + have htu : (p.2 : ℝ) * u ∈ Icc (0 : ℝ) (p.2 : ℝ) := + ⟨mul_nonneg p.2.2 hu.1, mul_le_of_le_one_right p.2.2 hu.2⟩ + rw [expandingDuhamelIntegrand_of_mem _ _ _ _ _ _ _ _ _ _ htu] + simp only [expandingUnitDuhamelIntegrand, expandingFreeFamily, expandingDuhamelParameters, + unitTime, projIcc_of_mem _ hu] + rfl + +/-- A fixed unit-interval integral represents the moving-scale Duhamel term exactly. -/ +theorem expandingDuhamel_eq_unitIntegral (a b k : ℝ) + (ha : 0 < a) (hk : 8 < k) (r : ℝ → FourierL2) + (p : ExpandingFreeParameters) : + expandingDuhamel a b k p.1.1 ha hk p.1.2 p.2 r = + (p.2 : ℝ) • ∫ u in Icc (0 : ℝ) 1, + expandingUnitDuhamelIntegrand a b k ha hk r p u := by + have hrescale := intervalIntegral.smul_integral_comp_mul_left + (a := 0) (b := 1) + (expandingDuhamelIntegrand a b k p.1.1 ha hk p.1.2 p.2 r) (p.2 : ℝ) + simp only [mul_zero, mul_one] at hrescale + rw [intervalIntegral.integral_of_le zero_le_one, + intervalIntegral.integral_of_le (show (0 : ℝ) ≤ (p.2 : ℝ) from p.2.2), + ← integral_Icc_eq_integral_Ioc, ← integral_Icc_eq_integral_Ioc] at hrescale + rw [expandingDuhamel, ← hrescale] + congr 1 + apply setIntegral_congr_fun measurableSet_Icc + intro u hu + exact (expandingUnitDuhamelIntegrand_eq a b k ha hk r p u hu).symm + +/-- The inhomogeneous solution depends strongly continuously on starting scale and time. -/ +theorem continuous_expandingDuhamel (a b k : ℝ) + (ha : 0 < a) (hk : 8 < k) (r : ℝ → FourierL2) (hr : Continuous r) : + Continuous (fun p : ExpandingFreeParameters => + expandingDuhamel a b k p.1.1 ha hk p.1.2 p.2 r) := by + let hLc : LocallyCompactSpace {L : ℝ // 1 ≤ L} := + (isClosed_Ici : IsClosed (Ici (1 : ℝ))).locallyCompactSpace + let hSc : LocallyCompactSpace {s : ℝ // 0 ≤ s} := + (isClosed_Ici : IsClosed (Ici (0 : ℝ))).locallyCompactSpace + let : LocallyCompactSpace ExpandingFreeParameters := + @Prod.locallyCompactSpace _ _ _ _ hLc hSc + simp only [expandingDuhamel_eq_unitIntegral] + exact (continuous_subtype_val.comp continuous_snd).smul + (continuous_parametric_integral_of_continuous + (continuous_expandingUnitDuhamelIntegrand a b k ha hk r hr) isCompact_Icc) + +/-- Continuous forcing on a closed time slab yields a continuous inhomogeneous solution. -/ +theorem continuousOn_expandingDuhamel (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (r : ℝ → FourierL2) (hr : ContinuousOn r (Icc 0 T)) : + ContinuousOn (fun t => expandingDuhamel a b k L ha hk hL t r) (Icc 0 T) := by + let r' : ℝ → FourierL2 := fun t => r (projIcc 0 T hT t) + have hr' : Continuous r' := hr.domRestrict.comp continuous_projIcc + have hp : Continuous (fun t : Icc (0 : ℝ) T => + ((⟨L, hL⟩, ⟨t.1, t.2.1⟩) : ExpandingFreeParameters)) := + continuous_const.prodMk (continuous_subtype_val.subtype_mk _) + rw [continuousOn_iff_continuous_domRestrict] + convert (continuous_expandingDuhamel a b k ha hk r' hr').comp hp using 1 + apply funext + intro t + change expandingDuhamel a b k L ha hk hL t r = + expandingDuhamel a b k L ha hk hL t r' + unfold expandingDuhamel + apply setIntegral_congr_fun measurableSet_Icc + intro τ hτ + rw [expandingDuhamelIntegrand_of_mem _ _ _ _ _ _ _ _ _ _ hτ, + expandingDuhamelIntegrand_of_mem _ _ _ _ _ _ _ _ _ _ hτ] + have hτT : τ ∈ Icc 0 T := ⟨hτ.1, hτ.2.trans t.2.2⟩ + simp only [r', projIcc_of_mem _ hτT] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDuhamelDuality.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDuhamelDuality.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3d8cf1aace874521f63430c66fb1553d603647e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDuhamelDuality.lean @@ -0,0 +1,62 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFreeDuality +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingDuhamel + +namespace OAI + +/-! # The exact Schwartz-tested variation-of-constants formula -/ + +open Set MeasureTheory +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +noncomputable def expandingDualDuhamelIntegrand (a b k L t : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (φ : 𝓢(E, ℂ)) (r : ℝ → FourierL2) (τ : ℝ) : ℂ := + if h : τ ∈ Icc 0 t then + expandingFourierTest a k (expandingRadius L τ) ha ha1 hk + (hL.trans (expandingRadius_ge L τ hL h.1)) + (homogeneousFreeDualTest a b (t - τ) φ) (r τ) + else 0 + +theorem expandingDuhamel_fourier_duality (a b k L t : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (ht : 0 ≤ t) + (φ : 𝓢(E, ℂ)) (r : ℝ → FourierL2) (hr : ContinuousOn r (Icc 0 t)) : + expandingFourierTest a k (expandingRadius L t) ha ha1 hk + (hL.trans (expandingRadius_ge L t hL ht)) φ + (expandingDuhamel a b k L ha hk hL t r) = + ∫ τ in Icc 0 t, expandingDualDuhamelIntegrand a b k L t ha ha1 hk hL φ r τ := by + let F := expandingFourierTest a k (expandingRadius L t) ha ha1 hk + (hL.trans (expandingRadius_ge L t hL ht)) φ + have hI := integrableOn_expandingDuhamelIntegrand a b k L ha hk hL t r hr + calc + _ = ∫ τ in Icc 0 t, F (expandingDuhamelIntegrand a b k L ha hk hL t r τ) := + (F.integral_comp_comm hI).symm + _ = _ := by + apply integral_congr_ae + filter_upwards [ae_restrict_mem measurableSet_Icc] with τ hτ + simp only [expandingDuhamelIntegrand_of_mem _ _ _ _ _ _ _ _ _ _ hτ, + expandingDualDuhamelIntegrand, dite_eq_left hτ] + have h := expandingFreeStep_fourier_duality a b k (expandingRadius L τ) (t - τ) + ha ha1 hk (hL.trans (expandingRadius_ge L τ hL hτ.1)) + (sub_nonneg.mpr hτ.2) φ (r τ) + simpa only [expandingDuhamel_destination, F] using h + +theorem expandingMild_fourier_duality (a b k L t : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (ht : 0 ≤ t) + (φ : 𝓢(E, ℂ)) (f u : FourierL2) (r : ℝ → FourierL2) + (hr : ContinuousOn r (Icc 0 t)) + (hu : u = expandingFreeStep a b k L t ha hk hL ht f + + expandingDuhamel a b k L ha hk hL t r) : + expandingFourierTest a k (expandingRadius L t) ha ha1 hk + (hL.trans (expandingRadius_ge L t hL ht)) φ u = + expandingFourierTest a k L ha ha1 hk hL (homogeneousFreeDualTest a b t φ) f + + ∫ τ in Icc 0 t, expandingDualDuhamelIntegrand a b k L t ha ha1 hk hL φ r τ := by + rw [hu, map_add, expandingFreeStep_fourier_duality, + expandingDuhamel_fourier_duality a b k L t ha ha1 hk hL ht φ r hr] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDuhamelFamily.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDuhamelFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..c7b995ada0f601d47c7277c63eac7c927156944e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDuhamelFamily.lean @@ -0,0 +1,125 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingDuhamelLinear +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingDuhamelContinuity +import Mathlib.Topology.CompactOpen + +namespace OAI + +/-! # Joint scale and forcing continuity of the finite-slab Duhamel operator + +The operator has a uniform finite-slab bound and is strongly continuous in +the starting radius. These two properties give joint continuity in the +radius and the forcing path, without operator-norm continuity of the free +Schrödinger propagator. +-/ + +open Set Filter Topology + +namespace DefocusingNLS + +theorem continuous_operator_apply_of_uniform_bound + {P E F : Type*} [TopologicalSpace P] [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] + (A : P → E →L[ℝ] F) (C : ℝ) (hA : ∀ p, ‖A p‖ ≤ C) + (hstrong : ∀ x : E, Continuous (fun p => A p x)) : + Continuous (fun z : P × E => A z.1 z.2) := by + rw [continuous_iff_continuousAt] + intro p + have hzero : Tendsto (fun z : P × E => A z.1 (z.2 - p.2)) (𝓝 p) (𝓝 0) := by + have hb (z : P × E) : ‖A z.1 (z.2 - p.2)‖ ≤ C * ‖z.2 - p.2‖ := + ((A z.1).le_opNorm (z.2 - p.2)).trans + (mul_le_mul_of_nonneg_right (hA z.1) (norm_nonneg _)) + apply squeeze_zero_norm hb + have hc : Continuous (fun z : P × E => C * ‖z.2 - p.2‖) := + ((continuous_snd.sub continuous_const).norm).const_mul C + simpa only [sub_self, norm_zero, mul_zero] using (hc.continuousAt (x := p)).tendsto + have hbase : Tendsto (fun z : P × E => A z.1 p.2) (𝓝 p) (𝓝 (A p.1 p.2)) := + ((hstrong p.2).comp continuous_fst).continuousAt.tendsto + simpa only [ContinuousAt, map_sub, sub_add_cancel, zero_add] using hzero.add hbase + +noncomputable def expandingForcingExtension (M : ℝ) (hM : 0 ≤ M) + (f : C(Icc (0 : ℝ) M, FourierL2)) : ℝ → FourierL2 := + fun t => f (projIcc 0 M hM t) + +theorem continuous_expandingForcingExtension (M : ℝ) (hM : 0 ≤ M) + (f : C(Icc (0 : ℝ) M, FourierL2)) : + Continuous (expandingForcingExtension M hM f) := f.continuous.comp continuous_projIcc + +noncomputable def expandingDuhamelSlab (a b k L M : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hM : 0 ≤ M) : + C(Icc (0 : ℝ) M, FourierL2) →L[ℝ] C(Icc (0 : ℝ) M, FourierL2) := + LinearMap.mkContinuous + { toFun := fun f => + ⟨fun t => expandingDuhamel a b k L ha hk hL t (expandingForcingExtension M hM f), by + let p : Icc (0 : ℝ) M → ExpandingFreeParameters := + fun t => (⟨L, hL⟩, ⟨t.1, t.2.1⟩) + have hp : Continuous p := + continuous_const.prodMk (continuous_subtype_val.subtype_mk _) + exact (continuous_expandingDuhamel a b k ha hk _ + (continuous_expandingForcingExtension M hM f)).comp hp⟩ + map_add' := by + intro f g + apply ContinuousMap.ext + intro t + exact expandingDuhamel_add a b k L ha hk hL t + (expandingForcingExtension M hM f) (expandingForcingExtension M hM g) + (continuous_expandingForcingExtension M hM f).continuousOn + (continuous_expandingForcingExtension M hM g).continuousOn + map_smul' := by + intro c f + apply ContinuousMap.ext + intro t + exact expandingDuhamel_real_smul a b k L ha hk hL t c + (expandingForcingExtension M hM f) } + M (by + intro f + apply (ContinuousMap.norm_le _ (mul_nonneg hM (norm_nonneg f))).2 + intro t + apply (expandingDuhamel_norm_le_mul a b k L ha hk hL t ‖f‖ t.2.1 + (expandingForcingExtension M hM f) + (continuous_expandingForcingExtension M hM f).continuousOn + (fun τ _ => ContinuousMap.norm_coe_le_norm f _)).trans + exact mul_le_mul_of_nonneg_right t.2.2 (norm_nonneg f)) + +@[simp] theorem expandingDuhamelSlab_apply (a b k L M : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hM : 0 ≤ M) + (f : C(Icc (0 : ℝ) M, FourierL2)) (t : Icc (0 : ℝ) M) : + expandingDuhamelSlab a b k L M ha hk hL hM f t = + expandingDuhamel a b k L ha hk hL t (expandingForcingExtension M hM f) := rfl + +theorem expandingDuhamelSlab_norm_le (a b k L M : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hM : 0 ≤ M) : + ‖expandingDuhamelSlab a b k L M ha hk hL hM‖ ≤ M := by + apply ContinuousLinearMap.opNorm_le_bound _ hM + intro f + apply (ContinuousMap.norm_le _ (mul_nonneg hM (norm_nonneg f))).2 + intro t + apply (expandingDuhamel_norm_le_mul a b k L ha hk hL t ‖f‖ t.2.1 + (expandingForcingExtension M hM f) + (continuous_expandingForcingExtension M hM f).continuousOn + (fun τ _ => ContinuousMap.norm_coe_le_norm f _)).trans + exact mul_le_mul_of_nonneg_right t.2.2 (norm_nonneg f) + +theorem continuous_expandingDuhamelSlab_strong (a b k M : ℝ) + (ha : 0 < a) (hk : 8 < k) (hM : 0 ≤ M) + (f : C(Icc (0 : ℝ) M, FourierL2)) : + Continuous (fun L : {L : ℝ // 1 ≤ L} => expandingDuhamelSlab a b k L.1 M ha hk L.2 hM f) := by + apply ContinuousMap.continuous_of_continuous_uncurry + let p : {L : ℝ // 1 ≤ L} × Icc (0 : ℝ) M → ExpandingFreeParameters := + fun z => (z.1, ⟨z.2.1, z.2.2.1⟩) + have hp : Continuous p := + continuous_fst.prodMk ((continuous_subtype_val.comp continuous_snd).subtype_mk _) + exact (continuous_expandingDuhamel a b k ha hk _ + (continuous_expandingForcingExtension M hM f)).comp hp + +theorem continuous_expandingDuhamelSlab (a b k M : ℝ) + (ha : 0 < a) (hk : 8 < k) (hM : 0 ≤ M) : + Continuous (fun p : {L : ℝ // 1 ≤ L} × C(Icc (0 : ℝ) M, FourierL2) => + expandingDuhamelSlab a b k p.1.1 M ha hk p.1.2 hM p.2) := + continuous_operator_apply_of_uniform_bound + (fun L : {L : ℝ // 1 ≤ L} => expandingDuhamelSlab a b k L.1 M ha hk L.2 hM) M + (fun L => expandingDuhamelSlab_norm_le a b k L.1 M ha hk L.2 hM) + (continuous_expandingDuhamelSlab_strong a b k M ha hk hM) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDuhamelLinear.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDuhamelLinear.lean new file mode 100644 index 0000000000000000000000000000000000000000..c72ef1047eb070cbcb716de1e531e39abff767d1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDuhamelLinear.lean @@ -0,0 +1,51 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingDuhamel + +namespace OAI + +/-! # Linearity of the moving-scale inhomogeneous term -/ + +open Set MeasureTheory + +namespace DefocusingNLS + +attribute [local irreducible] expandingFreeStep + +@[simp] theorem expandingDuhamel_zero (a b k L : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (t : ℝ) : + expandingDuhamel a b k L ha hk hL t (fun _ => 0) = 0 := by + unfold expandingDuhamel + have hz : expandingDuhamelIntegrand a b k L ha hk hL t (fun _ => 0) = 0 := by + funext τ + unfold expandingDuhamelIntegrand + split_ifs <;> simp only [map_zero, Pi.zero_apply] + simp only [hz, Pi.zero_apply, integral_zero] + +theorem expandingDuhamel_add (a b k L : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) + (t : ℝ) (r q : ℝ → FourierL2) + (hr : ContinuousOn r (Icc 0 t)) (hq : ContinuousOn q (Icc 0 t)) : + expandingDuhamel a b k L ha hk hL t (fun τ => r τ + q τ) = + expandingDuhamel a b k L ha hk hL t r + + expandingDuhamel a b k L ha hk hL t q := by + unfold expandingDuhamel + rw [← integral_add (integrableOn_expandingDuhamelIntegrand a b k L ha hk hL t r hr) + (integrableOn_expandingDuhamelIntegrand a b k L ha hk hL t q hq)] + apply integral_congr_ae + filter_upwards [ae_restrict_mem measurableSet_Icc] with τ hτ + simp only [expandingDuhamelIntegrand_of_mem _ _ _ _ _ _ _ _ _ _ hτ, map_add] + +theorem expandingDuhamel_real_smul (a b k L : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) + (t c : ℝ) (r : ℝ → FourierL2) : + expandingDuhamel a b k L ha hk hL t (fun τ => c • r τ) = + c • expandingDuhamel a b k L ha hk hL t r := by + unfold expandingDuhamel + rw [← integral_smul] + apply integral_congr_ae + filter_upwards [ae_restrict_mem measurableSet_Icc] with τ hτ + simp only [expandingDuhamelIntegrand_of_mem _ _ _ _ _ _ _ _ _ _ hτ, + ContinuousLinearMap.map_smul_of_tower] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDuhamelRestart.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDuhamelRestart.lean new file mode 100644 index 0000000000000000000000000000000000000000..657684a3a719c5fbca0aabefe1f800d6c8ac1db3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingDuhamelRestart.lean @@ -0,0 +1,124 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingDuhamelContinuity + +namespace OAI + +/-! # Restarting the inhomogeneous moving-scale evolution + +Splitting the Duhamel integral gives the exact restart identity at the +larger radius `L exp(s/2)`. This permits uniform short slabs to be joined. +-/ + +open Set MeasureTheory + +namespace DefocusingNLS + +attribute [local irreducible] expandingFreeStep + +theorem expandingDuhamel_eq_intervalIntegral (a b k L t : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (ht : 0 ≤ t) (r : ℝ → FourierL2) : + expandingDuhamel a b k L ha hk hL t r = + ∫ τ in 0..t, expandingDuhamelIntegrand a b k L ha hk hL t r τ := by + rw [expandingDuhamel, intervalIntegral.integral_of_le ht, ← integral_Icc_eq_integral_Ioc] + +private theorem expandingFreeStep_after_kernel (a b k L s t : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hs : 0 ≤ s) (ht : 0 ≤ t) + (r : ℝ → FourierL2) (τ : ℝ) (hτ : τ ∈ Icc 0 s) : + expandingFreeStep a b k (expandingRadius L s) t ha hk + (hL.trans (expandingRadius_ge L s hL hs)) ht + (expandingDuhamelIntegrand a b k L ha hk hL s r τ) = + expandingDuhamelIntegrand a b k L ha hk hL (s + t) r τ := by + change 0 ≤ τ ∧ τ ≤ s at hτ + have hτ' : τ ∈ Icc 0 (s + t) := ⟨hτ.1, by linarith [hτ.2]⟩ + rw [expandingDuhamelIntegrand_of_mem _ _ _ _ _ _ _ _ _ _ hτ, + expandingDuhamelIntegrand_of_mem _ _ _ _ _ _ _ _ _ _ hτ'] + have hR : expandingRadius (expandingRadius L τ) (s - τ) = expandingRadius L s := by + rw [expandingRadius_add] + congr 1 + ring + have hd : (s - τ) + t = (s + t) - τ := by ring + have h := congrArg (fun A : FourierL2 →L[ℂ] FourierL2 => A (r τ)) + (expandingFreeStep_add a b k (expandingRadius L τ) (s - τ) t ha hk + (hL.trans (expandingRadius_ge L τ hL hτ.1)) (sub_nonneg.mpr hτ.2) ht) + simp only [ContinuousLinearMap.comp_apply] at h + simpa only [hR, hd] using h + +private theorem expanding_shifted_kernel (a b k L s t : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hs : 0 ≤ s) + (r : ℝ → FourierL2) (τ : ℝ) (hτ : τ ∈ Icc 0 t) : + expandingDuhamelIntegrand a b k L ha hk hL (s + t) r (s + τ) = + expandingDuhamelIntegrand a b k (expandingRadius L s) ha hk + (hL.trans (expandingRadius_ge L s hL hs)) t (fun u => r (s + u)) τ := by + change 0 ≤ τ ∧ τ ≤ t at hτ + have hτ' : s + τ ∈ Icc 0 (s + t) := ⟨by linarith [hτ.1], by linarith [hτ.2]⟩ + rw [expandingDuhamelIntegrand_of_mem _ _ _ _ _ _ _ _ _ _ hτ', + expandingDuhamelIntegrand_of_mem _ _ _ _ _ _ _ _ _ _ hτ] + congr 2 + · exact (expandingRadius_add L s τ).symm + · ring + +/-- Exact inhomogeneous restart, with the radius advanced at the restart time. -/ +theorem expandingDuhamel_restart (a b k L s t : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hs : 0 ≤ s) (ht : 0 ≤ t) + (r : ℝ → FourierL2) (hr : ContinuousOn r (Icc 0 (s + t))) : + expandingDuhamel a b k L ha hk hL (s + t) r = + expandingFreeStep a b k (expandingRadius L s) t ha hk + (hL.trans (expandingRadius_ge L s hL hs)) ht + (expandingDuhamel a b k L ha hk hL s r) + + expandingDuhamel a b k (expandingRadius L s) ha hk + (hL.trans (expandingRadius_ge L s hL hs)) t (fun u => r (s + u)) := by + let F := expandingDuhamelIntegrand a b k L ha hk hL (s + t) r + have hs' : s ≤ s + t := by linarith + have hr₀ : ContinuousOn r (Icc 0 s) := hr.mono (Icc_subset_Icc le_rfl hs') + have hc : ContinuousOn F (Icc 0 (s + t)) := + continuousOn_expandingDuhamelIntegrand a b k L ha hk hL (s + t) r hr + have h₁ : IntervalIntegrable F volume 0 s := + (hc.mono (Icc_subset_Icc le_rfl hs')).intervalIntegrable_of_Icc hs + have h₂ : IntervalIntegrable F volume s (s + t) := + (hc.mono (Icc_subset_Icc hs le_rfl)).intervalIntegrable_of_Icc hs' + have hfirst : (∫ τ in 0..s, F τ) = + expandingFreeStep a b k (expandingRadius L s) t ha hk + (hL.trans (expandingRadius_ge L s hL hs)) ht + (expandingDuhamel a b k L ha hk hL s r) := by + rw [expandingDuhamel_eq_intervalIntegral a b k L s ha hk hL hs r, + ← ContinuousLinearMap.intervalIntegral_comp_comm _ + ((continuousOn_expandingDuhamelIntegrand a b k L ha hk hL s r hr₀).intervalIntegrable_of_Icc hs)] + apply intervalIntegral.integral_congr + intro τ hτ + rw [uIcc_of_le hs] at hτ + exact (expandingFreeStep_after_kernel a b k L s t ha hk hL hs ht r τ hτ).symm + have hsecond : (∫ τ in s..s + t, F τ) = + expandingDuhamel a b k (expandingRadius L s) ha hk + (hL.trans (expandingRadius_ge L s hL hs)) t (fun u => r (s + u)) := by + have hshift := intervalIntegral.integral_comp_add_left (a := 0) (b := t) F s + simp only [add_zero] at hshift + rw [← hshift, expandingDuhamel_eq_intervalIntegral a b k (expandingRadius L s) t ha hk + (hL.trans (expandingRadius_ge L s hL hs)) ht] + apply intervalIntegral.integral_congr + intro τ hτ + rw [uIcc_of_le ht] at hτ + exact expanding_shifted_kernel a b k L s t ha hk hL hs r τ hτ + rw [expandingDuhamel_eq_intervalIntegral a b k L (s + t) ha hk hL (add_nonneg hs ht), + ← intervalIntegral.integral_add_adjacent_intervals h₁ h₂, hfirst, hsecond] + +/-- Restarting a mild trajectory preserves its actual forcing and advances the radius. -/ +theorem expandingMild_restart (a b k L s t : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hs : 0 ≤ s) (ht : 0 ≤ t) + (r : ℝ → FourierL2) (hr : ContinuousOn r (Icc 0 (s + t))) (u₀ : FourierL2) : + expandingFreeStep a b k L (s + t) ha hk hL (add_nonneg hs ht) u₀ + + expandingDuhamel a b k L ha hk hL (s + t) r = + expandingFreeStep a b k (expandingRadius L s) t ha hk + (hL.trans (expandingRadius_ge L s hL hs)) ht + (expandingFreeStep a b k L s ha hk hL hs u₀ + + expandingDuhamel a b k L ha hk hL s r) + + expandingDuhamel a b k (expandingRadius L s) ha hk + (hL.trans (expandingRadius_ge L s hL hs)) t (fun u => r (s + u)) := by + rw [expandingDuhamel_restart a b k L s t ha hk hL hs ht r hr, map_add] + have h := congrArg (fun A : FourierL2 →L[ℂ] FourierL2 => A u₀) + (expandingFreeStep_add a b k L s t ha hk hL hs ht) + simp only [ContinuousLinearMap.comp_apply] at h + rw [h] + abel + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingEnergyComponents.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingEnergyComponents.lean new file mode 100644 index 0000000000000000000000000000000000000000..a189deb2bab4295b34d31e1c4b902789d5566e04 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingEnergyComponents.lean @@ -0,0 +1,115 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFreeStep + +namespace OAI + +/-! # The two exact energy components on an expanding torus + +The normalized Fourier space has a fixed Hilbert norm. These two bounded +observations recover the low and high terms of the radius-dependent norm. +-/ + +open scoped ENNReal + +namespace DefocusingNLS + +noncomputable def expandingLowFraction (a k L : ℝ) (n : frequencyLattice) : ℝ := + L ^ (2 * a) * (1 + ‖n‖ ^ 2) ^ (6 - a) / expandingSobolevWeightSq a k L n + +theorem expandingLowFraction_bounds (a k L : ℝ) (hL : 1 ≤ L) + (n : frequencyLattice) : 0 ≤ expandingLowFraction a k L n ∧ + expandingLowFraction a k L n ≤ 1 := by + constructor + · exact div_nonneg (by positivity) (expandingSobolevWeightSq_pos a k L hL n).le + · apply (div_le_one (expandingSobolevWeightSq_pos a k L hL n)).mpr + unfold expandingSobolevWeightSq + exact le_add_of_nonneg_right (by positivity) + +theorem expandingHighFraction_eq (a k L : ℝ) (hL : 1 ≤ L) + (n : frequencyLattice) : + 1 - expandingLowFraction a k L n = + L ^ (12 - 2 * k) * ‖n‖ ^ (2 * k) / expandingSobolevWeightSq a k L n := by + have hp := (expandingSobolevWeightSq_pos a k L hL n).ne' + unfold expandingLowFraction + field_simp + unfold expandingSobolevWeightSq + ring + +noncomputable def fourierEnergyComponent (w : frequencyLattice → ℝ) + (hw : ∀ n, 0 ≤ w n ∧ w n ≤ 1) : FourierL2 →L[ℂ] FourierL2 := + let F : FourierL2 → FourierL2 := fun f => + ⟨fun n => (Real.sqrt (w n) : ℂ) * f n, by + apply (lp.memℓp f).mono' + intro n + rw [norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (Real.sqrt_nonneg _)] + exact mul_le_of_le_one_left (norm_nonneg _) (Real.sqrt_le_one.mpr (hw n).2)⟩ + LinearMap.mkContinuous + { toFun := F + map_add' := by intro f g; ext n; exact mul_add _ _ _ + map_smul' := by intro c f; ext n; change _ * (c * _) = c * (_ * _); ring } + 1 (by + intro f + rw [one_mul] + apply lp.norm_mono (by norm_num : (2 : ℝ≥0∞) ≠ 0) + intro n + change ‖(Real.sqrt (w n) : ℂ) * f n‖ ≤ ‖f n‖ + rw [norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (Real.sqrt_nonneg _)] + exact mul_le_of_le_one_left (norm_nonneg _) (Real.sqrt_le_one.mpr (hw n).2)) + +@[simp] theorem fourierEnergyComponent_apply (w : frequencyLattice → ℝ) + (hw : ∀ n, 0 ≤ w n ∧ w n ≤ 1) (f : FourierL2) (n : frequencyLattice) : + fourierEnergyComponent w hw f n = (Real.sqrt (w n) : ℂ) * f n := rfl + +theorem fourierEnergyComponent_norm_sq (w : frequencyLattice → ℝ) + (hw : ∀ n, 0 ≤ w n ∧ w n ≤ 1) (f : FourierL2) : + ‖fourierEnergyComponent w hw f‖ ^ 2 = ∑' n, w n * ‖f n‖ ^ 2 := by + have he := lp.norm_rpow_eq_tsum (p := 2) (by norm_num) + (fourierEnergyComponent w hw f) + simp only [ENNReal.toReal_ofNat, Real.rpow_two] at he + rw [he] + apply tsum_congr + intro n + rw [fourierEnergyComponent_apply, norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (Real.sqrt_nonneg _), mul_pow, Real.sq_sqrt (hw n).1] + +theorem summable_fourierEnergyComponent (w : frequencyLattice → ℝ) + (hw : ∀ n, 0 ≤ w n ∧ w n ≤ 1) (f : FourierL2) : + Summable (fun n => w n * ‖f n‖ ^ 2) := by + have h := lp.hasSum_norm (p := 2) (by norm_num) (fourierEnergyComponent w hw f) + simp only [ENNReal.toReal_ofNat, Real.rpow_two] at h + convert h.summable using 1 + funext n + rw [fourierEnergyComponent_apply, norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (Real.sqrt_nonneg _), mul_pow, Real.sq_sqrt (hw n).1] + +noncomputable def expandingLowEnergy (a k L : ℝ) (hL : 1 ≤ L) : + FourierL2 →L[ℂ] FourierL2 := + fourierEnergyComponent (expandingLowFraction a k L) (expandingLowFraction_bounds a k L hL) + +noncomputable def expandingHighEnergy (a k L : ℝ) (hL : 1 ≤ L) : + FourierL2 →L[ℂ] FourierL2 := + fourierEnergyComponent (fun n => 1 - expandingLowFraction a k L n) + (fun n => ⟨sub_nonneg.mpr (expandingLowFraction_bounds a k L hL n).2, + sub_le_self _ (expandingLowFraction_bounds a k L hL n).1⟩) + +theorem expandingEnergy_norm_sq (a k L : ℝ) (hL : 1 ≤ L) (f : FourierL2) : + ‖f‖ ^ 2 = ‖expandingLowEnergy a k L hL f‖ ^ 2 + + ‖expandingHighEnergy a k L hL f‖ ^ 2 := by + have hl := summable_fourierEnergyComponent (expandingLowFraction a k L) + (expandingLowFraction_bounds a k L hL) f + have hh := summable_fourierEnergyComponent (fun n => 1 - expandingLowFraction a k L n) + (fun n => ⟨sub_nonneg.mpr (expandingLowFraction_bounds a k L hL n).2, + sub_le_self _ (expandingLowFraction_bounds a k L hL n).1⟩) f + rw [expandingLowEnergy, expandingHighEnergy, fourierEnergyComponent_norm_sq, + fourierEnergyComponent_norm_sq, ← hl.tsum_add hh] + have he := lp.norm_rpow_eq_tsum (p := 2) (by norm_num) f + simp only [ENNReal.toReal_ofNat, Real.rpow_two] at he + rw [he] + apply tsum_congr + intro n + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingEnergyInner.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingEnergyInner.lean new file mode 100644 index 0000000000000000000000000000000000000000..fee51a3dd562c63ff1f418e768e0f444b1d8dade --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingEnergyInner.lean @@ -0,0 +1,50 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingEnergyScaling +import Mathlib.Analysis.InnerProductSpace.Calculus + +namespace OAI + +/-! # Polarization of the exact expanding-torus energy identities -/ + +namespace DefocusingNLS + +theorem expandingEnergy_inner (a k L : ℝ) (hL : 1 ≤ L) (f g : FourierL2) : + inner ℝ f g = inner ℝ (expandingLowEnergy a k L hL f) (expandingLowEnergy a k L hL g) + + inner ℝ (expandingHighEnergy a k L hL f) (expandingHighEnergy a k L hL g) := by + have h := expandingEnergy_norm_sq a k L hL (f + g) + simp only [map_add] at h + rw [norm_add_sq_real, norm_add_sq_real, norm_add_sq_real, + expandingEnergy_norm_sq a k L hL f, expandingEnergy_norm_sq a k L hL g] at h + linarith + +theorem expandingLowEnergy_free_inner (a b k L s : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hs : 0 ≤ s) (f g : FourierL2) : + inner ℝ (expandingLowEnergy a k (expandingRadius L s) + (hL.trans (expandingRadius_ge L s hL hs)) (expandingFreeStep a b k L s ha hk hL hs f)) + (expandingLowEnergy a k (expandingRadius L s) + (hL.trans (expandingRadius_ge L s hL hs)) (expandingFreeStep a b k L s ha hk hL hs g)) = + Real.exp (-a * s) * inner ℝ (expandingLowEnergy a k L hL f) (expandingLowEnergy a k L hL g) := by + have h := expandingLowEnergy_free a b k L s ha hk hL hs (f + g) + simp only [map_add] at h + rw [norm_add_sq_real, norm_add_sq_real, + expandingLowEnergy_free a b k L s ha hk hL hs f, + expandingLowEnergy_free a b k L s ha hk hL hs g] at h + nlinarith [h] + +theorem expandingHighEnergy_free_inner (a b k L s : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hs : 0 ≤ s) (f g : FourierL2) : + inner ℝ (expandingHighEnergy a k (expandingRadius L s) + (hL.trans (expandingRadius_ge L s hL hs)) (expandingFreeStep a b k L s ha hk hL hs f)) + (expandingHighEnergy a k (expandingRadius L s) + (hL.trans (expandingRadius_ge L s hL hs)) (expandingFreeStep a b k L s ha hk hL hs g)) = + Real.exp ((6 - 2 * a - k) * s) * + inner ℝ (expandingHighEnergy a k L hL f) (expandingHighEnergy a k L hL g) := by + have h := expandingHighEnergy_free a b k L s ha hk hL hs (f + g) + simp only [map_add] at h + rw [norm_add_sq_real, norm_add_sq_real, + expandingHighEnergy_free a b k L s ha hk hL hs f, + expandingHighEnergy_free a b k L s ha hk hL hs g] at h + nlinarith [h] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingEnergyObservation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingEnergyObservation.lean new file mode 100644 index 0000000000000000000000000000000000000000..d9bcaed39cc8d75e5ee857741a9ac742539b5473 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingEnergyObservation.lean @@ -0,0 +1,57 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingNonprincipalObservation + +namespace OAI + +/-! # Dissipative energy with a compact physical observation on large tori -/ + +open Filter Topology MeasureTheory + +namespace DefocusingNLS + +local notation "T" => UnitAddTorus (Fin 12) +local notation "Radius" => {L : ℝ // 1 ≤ L} +noncomputable local instance energyObservationMeasure : MeasureSpace UnitAddCircle := ⟨AddCircle.haarAddCircle⟩ +local instance energyObservationProbability : IsProbabilityMeasure (volume : Measure UnitAddCircle) := + inferInstanceAs (IsProbabilityMeasure AddCircle.haarAddCircle) + +theorem exists_expandingEnergy_observation (a Q : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < ((N + 1 : ℕ) : ℝ)) (hQ : 0 ≤ Q) + (q : Radius → FourierL2) (hqb : ∀ L, ‖q L‖ ≤ Q) + (hq : ∀ (L : ℕ → Radius), Tendsto (fun n => (L n).1) atTop atTop → + ExpandingCompactApproximation a (N + 1 : ℕ) ha1 hN + (fun n => (L n).1) (fun n => (L n).2) (fun n => q (L n))) + (m : ℕ) (hm : 0 < m) (P : ℝ) (hP : 0 ≤ P) + (hQB : ∀ (L : Radius) (x : T), ‖expandingUnitTorusFunction a (N + 1 : ℕ) L.1 (q L) x‖ ^ (2 * m) ≤ P) + (hgap : 0 < (N + 1 : ℕ) + 2 * a - 6 - 2 * ((2 * (m : ℝ) + 1) * P)) : + ∃ c : ℝ, 0 < c ∧ ∃ n : ℕ, ∃ C : ℝ, 0 ≤ C ∧ + ∀ (L : Radius), (n : ℝ) ≤ L.1 → ∀ f : FourierL2, + -a * ‖expandingLowEnergy a (N + 1 : ℕ) L.1 L.2 f‖ ^ 2 + + (6 - 2 * a - (N + 1 : ℕ)) * ‖expandingHighEnergy a (N + 1 : ℕ) L.1 L.2 f‖ ^ 2 + + 2 * inner ℝ f (expandingLinearizedPotential a (N + 1 : ℕ) L.1 ha ha1 hN L.2 m (q L) f) ≤ + -c * ‖f‖ ^ 2 + C * ‖expandingPhysicalBall a (N + 1 : ℕ) L.1 n ha ha1 hN L.2 f‖ ^ 2 := by + let B := (2 * (m : ℝ) + 1) * P + let g := (N + 1 : ℕ) + 2 * a - 6 - 2 * B + let γ := min a g + have hγ : 0 < γ := lt_min ha hgap + obtain ⟨n, C, hC, herror⟩ := exists_expandingNonprincipal_observation a Q N ha ha1 hN hQ q hqb hq + m hm P hP hQB (γ / 4) (by positivity) + refine ⟨γ / 2, half_pos hγ, n, 2 * C, by positivity, ?_⟩ + intro L hL f + have he := herror L hL f + have hp := expandingOrderedPrincipal_energy_le a L.1 (N + 1) m L.2 + (expandingUnitTorusFunction a (N + 1 : ℕ) L.1 (q L)) + (expandingUnitTorusFunction a (N + 1 : ℕ) L.1 (q L)).continuous P hP (hQB L) f + have hnorm := expandingEnergy_norm_sq a (N + 1 : ℕ) L.1 L.2 f + have hl := mul_nonneg (sub_nonneg.mpr (min_le_left a g)) + (sq_nonneg ‖expandingLowEnergy a (N + 1 : ℕ) L.1 L.2 f‖) + have hh := mul_nonneg (sub_nonneg.mpr (min_le_right a g)) + (sq_nonneg ‖expandingHighEnergy a (N + 1 : ℕ) L.1 L.2 f‖) + change 0 ≤ (a - γ) * _ at hl + change 0 ≤ (g - γ) * _ at hh + unfold expandingNonprincipalEnergy at he + dsimp only [B, g] at hh + nlinarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingEnergyScaling.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingEnergyScaling.lean new file mode 100644 index 0000000000000000000000000000000000000000..92b0c47ac7ba6a20b1b7f9f655fb0e26a2f06ff7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingEnergyScaling.lean @@ -0,0 +1,122 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingEnergyComponents + +namespace OAI + +/-! # Exact transport of the two expanding-torus energies -/ + +namespace DefocusingNLS + +theorem expandingRadius_rpow (L s p : ℝ) (hL : 1 ≤ L) : + expandingRadius L s ^ p = Real.exp (p * s / 2) * L ^ p := by + unfold expandingRadius + rw [Real.mul_rpow (by linarith : 0 ≤ L) (Real.exp_pos _).le, ← Real.exp_mul] + rw [mul_comm (L ^ p)] + congr 2 + ring + +theorem expandingScaleRatio_sq (a k L M : ℝ) (hL : 1 ≤ L) (hM : 1 ≤ M) + (n : frequencyLattice) : + expandingScaleRatio a k L M n ^ 2 = + expandingSobolevWeightSq a k M n / expandingSobolevWeightSq a k L n := by + rw [expandingScaleRatio, div_pow, expandingSobolevWeight_sq a k M hM, + expandingSobolevWeight_sq a k L hL] + have hC : (2 * Real.pi) ^ 12 ≠ 0 := by positivity + field_simp + +theorem expandingLowFraction_transport (a k L s : ℝ) (hL : 1 ≤ L) + (hs : 0 ≤ s) (n : frequencyLattice) : + expandingLowFraction a k (expandingRadius L s) n * + expandingScaleRatio a k L (expandingRadius L s) n ^ 2 = + Real.exp (a * s) * expandingLowFraction a k L n := by + have hM := hL.trans (expandingRadius_ge L s hL hs) + rw [expandingScaleRatio_sq a k L _ hL hM] + unfold expandingLowFraction + rw [expandingRadius_rpow L s (2 * a) hL, + show 2 * a * s / 2 = a * s by ring] + have hW := (expandingSobolevWeightSq_pos a k L hL n).ne' + have hV := (expandingSobolevWeightSq_pos a k _ hM n).ne' + field_simp + +theorem expandingHighFraction_transport (a k L s : ℝ) (hL : 1 ≤ L) + (hs : 0 ≤ s) (n : frequencyLattice) : + (1 - expandingLowFraction a k (expandingRadius L s) n) * + expandingScaleRatio a k L (expandingRadius L s) n ^ 2 = + Real.exp ((6 - k) * s) * (1 - expandingLowFraction a k L n) := by + have hM := hL.trans (expandingRadius_ge L s hL hs) + rw [expandingScaleRatio_sq a k L _ hL hM, + expandingHighFraction_eq a k _ hM, expandingHighFraction_eq a k L hL, + expandingRadius_rpow L s (12 - 2 * k) hL, + show (12 - 2 * k) * s / 2 = (6 - k) * s by ring] + have hW := (expandingSobolevWeightSq_pos a k L hL n).ne' + have hV := (expandingSobolevWeightSq_pos a k _ hM n).ne' + field_simp + +theorem expandingFreeStep_mode_norm_sq (a b k L s : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hs : 0 ≤ s) + (f : FourierL2) (n : frequencyLattice) : + ‖expandingFreeStep a b k L s ha hk hL hs f n‖ ^ 2 = + Real.exp (-2 * a * s) * expandingScaleRatio a k L (expandingRadius L s) n ^ 2 * + ‖f n‖ ^ 2 := by + change ‖expandingFreeAmplitude a b s * + ((expandingScaleRatio a k L (expandingRadius L s) n : ℂ) * + (schrodingerMultiplier (expandingFreeTime L s) n * f n))‖ ^ 2 = _ + rw [norm_mul, norm_mul, norm_mul, expandingFreeAmplitude_norm, + schrodingerMultiplier_norm, one_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (expandingScaleRatio_nonneg a k L _ hL (expandingRadius_ge L s hL hs) n), + mul_pow, mul_pow, ← Real.exp_nat_mul] + norm_num only [Nat.cast_ofNat] + rw [show (2 : ℝ) * (-a * s) = -2 * a * s by ring] + ring + +theorem expandingLowEnergy_free (a b k L s : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hs : 0 ≤ s) (f : FourierL2) : + ‖expandingLowEnergy a k (expandingRadius L s) + (hL.trans (expandingRadius_ge L s hL hs)) + (expandingFreeStep a b k L s ha hk hL hs f)‖ ^ 2 = + Real.exp (-a * s) * ‖expandingLowEnergy a k L hL f‖ ^ 2 := by + simp only [expandingLowEnergy, fourierEnergyComponent_norm_sq] + rw [← tsum_mul_left] + apply tsum_congr + intro n + rw [expandingFreeStep_mode_norm_sq] + calc + _ = (Real.exp (-2 * a * s) * + (expandingLowFraction a k (expandingRadius L s) n * + expandingScaleRatio a k L (expandingRadius L s) n ^ 2)) * ‖f n‖ ^ 2 := by ring + _ = _ := by + rw [expandingLowFraction_transport a k L s hL hs, ← mul_assoc, ← Real.exp_add, + show -2 * a * s + a * s = -a * s by ring] + ring + +theorem expandingHighEnergy_free (a b k L s : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hs : 0 ≤ s) (f : FourierL2) : + ‖expandingHighEnergy a k (expandingRadius L s) + (hL.trans (expandingRadius_ge L s hL hs)) + (expandingFreeStep a b k L s ha hk hL hs f)‖ ^ 2 = + Real.exp ((6 - 2 * a - k) * s) * ‖expandingHighEnergy a k L hL f‖ ^ 2 := by + simp only [expandingHighEnergy, fourierEnergyComponent_norm_sq] + rw [← tsum_mul_left] + apply tsum_congr + intro n + rw [expandingFreeStep_mode_norm_sq] + calc + _ = (Real.exp (-2 * a * s) * + ((1 - expandingLowFraction a k (expandingRadius L s) n) * + expandingScaleRatio a k L (expandingRadius L s) n ^ 2)) * ‖f n‖ ^ 2 := by ring + _ = _ := by + rw [expandingHighFraction_transport a k L s hL hs, ← mul_assoc, ← Real.exp_add, + show -2 * a * s + (6 - k) * s = (6 - 2 * a - k) * s by ring] + ring + +theorem expandingFreeEnergy_norm_sq (a b k L s : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hs : 0 ≤ s) (f : FourierL2) : + ‖expandingFreeStep a b k L s ha hk hL hs f‖ ^ 2 = + Real.exp (-a * s) * ‖expandingLowEnergy a k L hL f‖ ^ 2 + + Real.exp ((6 - 2 * a - k) * s) * ‖expandingHighEnergy a k L hL f‖ ^ 2 := by + rw [expandingEnergy_norm_sq a k (expandingRadius L s) + (hL.trans (expandingRadius_ge L s hL hs)), + expandingLowEnergy_free, expandingHighEnergy_free] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingEscapedEnergy.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingEscapedEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..c6f70f6f86e0275b835af94d1e1b98bf2d1d747e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingEscapedEnergy.lean @@ -0,0 +1,80 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.SpacetimeObservationIntegral +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfileObservation +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfileUniformBound + +namespace OAI + +/-! # The full initial energy survives passage to a local physical limit -/ + +open Set Filter Topology + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +attribute [local irreducible] expandingProfileTrajectory expandingSpacetimePath + +theorem expandingProfile_escaped_energy (a b k T Q M c C R : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hT : 0 ≤ T) + (hQ : 0 ≤ Q) (hM : 0 ≤ M) (hc : 0 ≤ c) (hC : 0 ≤ C) (m : ℕ) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) + (q : ℕ → C(Icc (0 : ℝ) T, FourierL2)) (hq : ∀ n s, ‖q n s‖ ≤ Q) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) + (henergy : ∀ n (s : Icc (0 : ℝ) T) (w : FourierL2), + let l := expandingRadiusCurve (L n) T (hL n) s; + -a * ‖expandingLowEnergy a k l.1 l.2 w‖ ^ 2 + + (6 - 2 * a - k) * ‖expandingHighEnergy a k l.1 l.2 w‖ ^ 2 + + 2 * inner ℝ w (expandingLinearizedPotential a k l.1 ha ha1 hk l.2 m (q n s) w) ≤ + -c * ‖w‖ ^ 2 + C * ‖expandingPhysicalBall a k l.1 R ha ha1 hk l.2 w‖ ^ 2) + (v : C(Icc (0 : ℝ) T × E, ℂ)) + (hv : Tendsto (fun n => expandingSpacetimePath a k (L n) T ha ha1 hk (hL n) + (expandingProfileTrajectory a b k (L n) T ha ha1 hk (hL n) hT m Q hQ (q n) (hq n) (f n))) + atTop (𝓝 v)) : + ∀ ε : ℝ, 0 < ε → ∀ᶠ n in atTop, + ‖expandingProfileTrajectory a b k (L n) T ha ha1 hk (hL n) hT m Q hQ (q n) (hq n) + (f n) ⟨T, hT, le_rfl⟩‖ ^ 2 ≤ Real.exp (-c * T) * M ^ 2 + + (∫ s in (0 : ℝ)..T, Real.exp (-c * (T - s)) * + (C * ‖spacetimeBallPath T R v (projIcc 0 T hT s)‖ ^ 2)) + ε := by + let S := fun n => expandingProfileTrajectory a b k (L n) T ha ha1 hk (hL n) hT + m Q hQ (q n) (hq n) (f n) + let F := fun n => expandingSpacetimePath a k (L n) T ha ha1 hk (hL n) (S n) + obtain ⟨K, hK, hKb⟩ := exists_expandingProfileTrajectory_bound a b k ha ha1 hk m Q hQ + let A := (K + 1) * Real.exp ((K + 1) * T) * M + let B := expandingEmbeddingBound a k * A + have hA : 0 ≤ A := by dsimp [A]; positivity + have hB : 0 ≤ B := by dsimp [B, expandingEmbeddingBound]; positivity + have hSb (n : ℕ) (s : Icc (0 : ℝ) T) : ‖S n s‖ ≤ A := + ((ContinuousMap.norm_coe_le_norm (S n) s).trans + (hKb (L n) T (hL n) hT (q n) (hq n) (f n))).trans + (mul_le_mul_of_nonneg_left (hf n) (by positivity)) + have hI := tendsto_spacetime_observation_integral T R B c C hT hB hc hC F v + (fun n s y => expandingSpacetimePath_norm_le a k (L n) T A ha ha1 hk (hL n) (S n) + (hSb n) (s, y)) hv + intro ε hε + have hnear := (tendsto_order.mp hI).2 _ (lt_add_of_pos_right _ hε) + filter_upwards [hnear] with n hn + have he := expandingProfileTrajectory_observation_estimate a b k (L n) T ha ha1 hk + (hL n) hT m Q hQ (q n) (hq n) c C R (henergy n) (f n) ⟨T, hT, le_rfl⟩ + have hi : (∫ s in (0 : ℝ)..T, Real.exp (-c * (T - s)) * + (C * ‖spacetimeBallPath T R (F n) (projIcc 0 T hT s)‖ ^ 2)) = + (∫ s in (0 : ℝ)..T, let p := projIcc 0 T hT s; + Real.exp (-c * (T - s)) * (C * ‖expandingPhysicalBall a k + (expandingRadius (L n) p) R ha ha1 hk + ((hL n).trans (expandingRadius_ge (L n) p (hL n) p.2.1)) (S n p)‖ ^ 2)) := by + simp only [F, spacetimeBallPath_expanding] + rw [hi] at hn + change ‖S n ⟨T, hT, le_rfl⟩‖ ^ 2 ≤ Real.exp (-c * T) * ‖f n‖ ^ 2 + + (∫ s in (0 : ℝ)..T, let p := projIcc 0 T hT s; + Real.exp (-c * (T - s)) * (C * ‖expandingPhysicalBall a k + (expandingRadius (L n) p) R ha ha1 hk + ((hL n).trans (expandingRadius_ge (L n) p (hL n) p.2.1)) (S n p)‖ ^ 2)) at he + calc + _ ≤ Real.exp (-c * T) * ‖f n‖ ^ 2 + _ := he + _ ≤ Real.exp (-c * T) * M ^ 2 + _ := by + gcongr + exact hf n + _ ≤ _ := by linarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingEvaluation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..d47e54f6557e67184ff73a9247ba15dfb1c45b29 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingEvaluation.lean @@ -0,0 +1,55 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingNonlinearity + +namespace OAI + +/-! # Bounded observation for the exact expanding-torus model -/ + +open scoped ENNReal ComplexConjugate + +namespace DefocusingNLS + +noncomputable def expandingPointObservationVector (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (x : SchrodingerTorus) : FourierL2 := + ⟨fun n => (((expandingSobolevWeight a k L n)⁻¹ : ℝ) : ℂ) * + conj (torusCharacter n x), by + apply memℓp_gen + have hs := (summable_expandingSobolevWeight_inv a k L ha ha1 hk hL).1.mul_left + (((2 * Real.pi) ^ 12)⁻¹) + simpa only [ENNReal.toReal_ofNat, Real.rpow_two, norm_mul, Complex.norm_conj, + torusCharacter_norm_apply, mul_one, expanding_observation_weight_sq a k L hL] using hs⟩ + +noncomputable def expandingPointEvaluation (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (x : SchrodingerTorus) : FourierL2 →L[ℂ] ℂ := + innerSL ℂ (expandingPointObservationVector a k L ha ha1 hk hL x) + +theorem hasSum_expandingPointEvaluation (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (x : SchrodingerTorus) (f : FourierL2) : + HasSum (fun n => expandingFourierCoefficient a k L f n * torusCharacter n x) + (expandingPointEvaluation a k L ha ha1 hk hL x f) := by + have h := lp.hasSum_inner (𝕜 := ℂ) (expandingPointObservationVector a k L ha ha1 hk hL x) f + simpa [expandingPointObservationVector, expandingPointEvaluation, expandingFourierCoefficient, + RCLike.inner_apply', mul_assoc, mul_left_comm, mul_comm] using h + +theorem expandingTorusFunction_eq_evaluation (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (x : SchrodingerTorus) (f : FourierL2) : + expandingTorusFunction a k L f x = expandingPointEvaluation a k L ha ha1 hk hL x f := by + rw [expandingTorusFunction_apply a k L ha ha1 hk hL] + exact (hasSum_expandingPointEvaluation a k L ha ha1 hk hL x f).tsum_eq + +/-- Evaluation has one operator-norm bound for every expanding torus and every point. -/ +theorem expandingPointEvaluation_norm_le (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (x : SchrodingerTorus) : + ‖expandingPointEvaluation a k L ha ha1 hk hL x‖ ≤ expandingEmbeddingBound a k := by + apply ContinuousLinearMap.opNorm_le_bound _ (Real.sqrt_nonneg _) + intro f + rw [← expandingTorusFunction_eq_evaluation a k L ha ha1 hk hL] + exact expandingTorusFunction_point_bound a k L ha ha1 hk hL f x + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFilteredDerivatives.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFilteredDerivatives.lean new file mode 100644 index 0000000000000000000000000000000000000000..dcc45951cda2e46895c807a18512058ac0a8555c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFilteredDerivatives.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFilteredLimit +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousCommutatorSymbol + +namespace OAI + +/-! # Ordered frequency derivatives of the compactly filtered torus field -/ + +open Filter Topology MeasureTheory +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +noncomputable def smoothDerivativeKernel (R : ℝ) (hR : 0 < R) (N : ℕ) + (j : Fin N → Fin 12) : 𝓢(E, ℂ) := + homogeneousOrderedDerivative N j (radianInverseKernel (smoothFrequencyCutoff R hR)) + +theorem smoothDerivativeKernel_fourier (R : ℝ) (hR : 0 < R) (N : ℕ) + (j : Fin N → Fin 12) (ξ : E) : + radianFourierKernel (smoothDerivativeKernel R hR N j) ξ = + homogeneousOrderedSymbol N j ξ * smoothFrequencyCutoff R hR ξ := by + rw [smoothDerivativeKernel, homogeneousOrderedDerivative_fourier, + radianFourierKernel_inverseKernel] + rfl + +noncomputable def expandingSmoothDerivative (L R : ℝ) (hR : 0 < R) (N : ℕ) + (j : Fin N → Fin 12) : FourierL2 →L[ℂ] FourierL2 := + expandingSchwartzFilter L (smoothDerivativeKernel R hR N j) + +@[simp] theorem expandingSmoothDerivative_apply (L R : ℝ) (hR : 0 < R) (N : ℕ) + (j : Fin N → Fin 12) (f : FourierL2) (n : frequencyLattice) : + expandingSmoothDerivative L R hR N j f n = + (homogeneousOrderedSymbol N j (L⁻¹ • (n : E)) * + smoothFrequencyCutoff R hR (L⁻¹ • (n : E))) * f n := by + rw [expandingSmoothDerivative, expandingSchwartzFilter_apply, smoothDerivativeKernel_fourier] + +theorem expandingSmoothDerivative_physical (a k L R : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hR : 0 < R) + (N : ℕ) (j : Fin N → Fin 12) (f : FourierL2) (y : E) : + expandingPhysicalContinuous a k L ha ha1 hk hL (expandingSmoothDerivative L R hR N j f) y = + ∫ z : E, smoothDerivativeKernel R hR N j z * + expandingPhysicalContinuous a k L ha ha1 hk hL f (y - z) := + expandingSchwartzFilter_physical a k L ha ha1 hk hL _ f y + +theorem expandingSmoothDerivative_physical_bound (a k L R : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hR : 0 < R) + (N : ℕ) (j : Fin N → Fin 12) (f : FourierL2) (y : E) : + ‖expandingPhysicalContinuous a k L ha ha1 hk hL (expandingSmoothDerivative L R hR N j f) y‖ ≤ + expandingEmbeddingBound a k * (∫ z : E, ‖smoothDerivativeKernel R hR N j z‖) * ‖f‖ := by + refine (expandingPhysicalContinuous_norm_le a k L ha ha1 hk hL _ y).trans ?_ + have h := fourierBoundedMultiplier_norm_le + (∫ z : E, ‖smoothDerivativeKernel R hR N j z‖) + (integral_nonneg (fun _ => norm_nonneg _)) + (fun n : frequencyLattice => radianFourierKernel (smoothDerivativeKernel R hR N j) + (L⁻¹ • (n : E))) (fun _ => radianFourierKernel_norm_le_integral _ _) f + exact (mul_le_mul_of_nonneg_left h + (by unfold expandingEmbeddingBound; positivity)).trans_eq (mul_assoc _ _ _).symm + +theorem tendsto_expandingSmoothDerivative_local (a k M M₀ R S : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hM : 0 ≤ M) (hM₀ : 0 ≤ M₀) (hS : 0 < S) + (N : ℕ) (j : Fin N → Fin 12) (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) (v : C(E, ℂ)) (hv : ∀ y, ‖v y‖ ≤ M₀) + (hlocal : ∀ T ε : ℝ, 0 < ε → ∀ᶠ n in atTop, ∀ y : E, ‖y‖ ≤ T → + ‖expandingTorusFunction a k (L n) (f n) (euclideanToTorus ((L n)⁻¹ • y)) - v y‖ < ε) : + Tendsto (fun n => expandingPhysicalBall a k (L n) R ha ha1 hk (hL n) + (expandingSmoothDerivative (L n) S hS N j (f n))) atTop + (𝓝 (schwartzBallConvolution R (smoothDerivativeKernel S hS N j) v)) := + tendsto_expandingPhysicalBall_filter a k M M₀ R ha ha1 hk hM hM₀ L hL _ f hf v hv hlocal + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFilteredLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFilteredLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..ecb73c5e5c0f25ce9d1f22ca7facdfc64e2c55c5 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFilteredLimit.lean @@ -0,0 +1,69 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingSmoothCutoff + +namespace OAI + +/-! # Smoothly filtered expanding-torus data converge on physical compact sets -/ + +open Filter Topology MeasureTheory +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +noncomputable def expandingPhysicalBall (a k L R : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) : + C(Metric.closedBall (0 : E) R, ℂ) := + shiftedBallRestriction R (expandingPhysicalContinuous a k L ha ha1 hk hL f) 0 + +@[simp] theorem expandingPhysicalBall_apply (a k L R : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (f : FourierL2) (y : Metric.closedBall (0 : E) R) : + expandingPhysicalBall a k L R ha ha1 hk hL f y = + expandingTorusFunction a k L f (euclideanToTorus (L⁻¹ • (y : E))) := by + change expandingPhysicalContinuous a k L ha ha1 hk hL f ((y : E) - 0) = _ + rw [sub_zero, expandingPhysicalContinuous_apply] + +theorem expandingPhysicalBall_filter (a k L R : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (K : 𝓢(E, ℂ)) (f : FourierL2) : + expandingPhysicalBall a k L R ha ha1 hk hL (expandingSchwartzFilter L K f) = + schwartzBallConvolution R K (expandingPhysicalContinuous a k L ha ha1 hk hL f) := by + ext y + change expandingPhysicalContinuous a k L ha ha1 hk hL (expandingSchwartzFilter L K f) + ((y : E) - 0) = _ + rw [sub_zero] + exact expandingSchwartzFilter_ball a k L R ha ha1 hk hL K f y + +theorem tendsto_expandingPhysicalBall_filter (a k M M₀ R : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hM : 0 ≤ M) (hM₀ : 0 ≤ M₀) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (K : 𝓢(E, ℂ)) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) (v : C(E, ℂ)) + (hv : ∀ y, ‖v y‖ ≤ M₀) + (hlocal : ∀ S ε : ℝ, 0 < ε → ∀ᶠ n in atTop, ∀ y : E, ‖y‖ ≤ S → + ‖expandingTorusFunction a k (L n) (f n) (euclideanToTorus ((L n)⁻¹ • y)) - v y‖ < ε) : + Tendsto (fun n => expandingPhysicalBall a k (L n) R ha ha1 hk (hL n) + (expandingSchwartzFilter (L n) K (f n))) atTop (𝓝 (schwartzBallConvolution R K v)) := by + simp_rw [expandingPhysicalBall_filter] + apply tendsto_schwartzBallConvolution R (expandingEmbeddingBound a k * M) M₀ + (by unfold expandingEmbeddingBound; positivity) hM₀ K + (fun n => expandingPhysicalContinuous a k (L n) ha ha1 hk (hL n) (f n)) v ?_ hv ?_ + · intro n y + exact (expandingPhysicalContinuous_norm_le a k (L n) ha ha1 hk (hL n) (f n) y).trans + (mul_le_mul_of_nonneg_left (hf n) (by unfold expandingEmbeddingBound; positivity)) + · simpa only [expandingPhysicalContinuous_apply] using hlocal + +theorem tendsto_expandingPhysicalBall_smoothLow (a k M M₀ R S : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hM : 0 ≤ M) (hM₀ : 0 ≤ M₀) (hS : 0 < S) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) (v : C(E, ℂ)) (hv : ∀ y, ‖v y‖ ≤ M₀) + (hlocal : ∀ T ε : ℝ, 0 < ε → ∀ᶠ n in atTop, ∀ y : E, ‖y‖ ≤ T → + ‖expandingTorusFunction a k (L n) (f n) (euclideanToTorus ((L n)⁻¹ • y)) - v y‖ < ε) : + Tendsto (fun n => expandingPhysicalBall a k (L n) R ha ha1 hk (hL n) + (expandingSmoothLow (L n) S hS (f n))) atTop + (𝓝 (schwartzBallConvolution R (radianInverseKernel (smoothFrequencyCutoff S hS)) v)) := by + simp_rw [expandingSmoothLow_eq_convolution] + exact tendsto_expandingPhysicalBall_filter a k M M₀ R ha ha1 hk hM hM₀ L hL _ f hf v hv hlocal + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFilteredPhysicalEnergy.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFilteredPhysicalEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e78d27631fb002b7f23f06a4c79b71b799994ca --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFilteredPhysicalEnergy.lean @@ -0,0 +1,53 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingOrderedPhysicalSymbol +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFilteredDerivatives +import OAI.MathematicalPhysics.DefocusingNLS.Linear.TorusOrderedEnergy + +namespace OAI + +/-! # Physical realization of a filtered ordered derivative -/ + +open MeasureTheory + +namespace DefocusingNLS + +local notation "T" => UnitAddTorus (Fin 12) +noncomputable local instance filteredPhysicalEnergyMeasure : MeasureSpace UnitAddCircle := ⟨AddCircle.haarAddCircle⟩ +local instance filteredPhysicalEnergyProbability : IsProbabilityMeasure (volume : Measure UnitAddCircle) := + inferInstanceAs (IsProbabilityMeasure AddCircle.haarAddCircle) + +theorem expandingOrderedFourierEnergy_smoothLow (a L R : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hL : 1 ≤ L) (hR : 0 < R) + (j : Fin N → Fin 12) (f : FourierL2) : + expandingOrderedFourierEnergy a L N hL j (expandingSmoothLow L R hR f) = + expandingPhysicalMassVector a N L ha ha1 hN hL + (expandingSmoothDerivative L R hR N j f) := by + ext n + rw [expandingOrderedFourierEnergy_physical, expandingPhysicalMassVector_apply] + simp only [expandingFourierCoefficient, expandingSmoothLow_apply, + expandingSmoothDerivative_apply, Complex.real_smul] + push_cast + ring + +theorem expandingOrderedPhysicalEnergy_smoothLow (a L R : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hL : 1 ≤ L) (hR : 0 < R) + (j : Fin N → Fin 12) (f : FourierL2) : + expandingOrderedPhysicalEnergy a L N hL j (expandingSmoothLow L R hR f) = + torusPhysicalL2Value L (expandingUnitTorusFunction a N L + (expandingSmoothDerivative L R hR N j f)) := by + change torusFourierIsometry (expandingOrderedFourierEnergy a L N hL j + (expandingSmoothLow L R hR f)) = _ + rw [expandingOrderedFourierEnergy_smoothLow a L R N ha ha1 hN hL hR, + expandingPhysicalMassVector_isometry] + +theorem torusL2Product_physical (L : ℝ) (V f : C(T, ℂ)) : + torusL2Product V (torusPhysicalL2Value L f) = torusPhysicalL2Value L (V * f) := by + have hs := ((torusL2Product V).restrictScalars ℝ).map_smul + ((2 * Real.pi * L) ^ 6) (f.toLp 2 volume ℂ) + change torusL2Product V ((2 * Real.pi * L) ^ 6 • f.toLp 2 volume ℂ) = + (2 * Real.pi * L) ^ 6 • torusL2Product V (f.toLp 2 volume ℂ) at hs + rw [torusPhysicalL2Value, hs, torusL2Product_continuous] + rfl + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFilteredWeakLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFilteredWeakLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..e00897039d6c664b24ccb3bcfec7003699e4e9b6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFilteredWeakLimit.lean @@ -0,0 +1,49 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFilteredDerivatives + +namespace OAI + +/-! # Filtered derivative limits from the actual weak localization limit -/ + +open Filter Topology +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +noncomputable def homogeneousPhysicalContinuous (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (v : HomogeneousY a k) : C(E, ℂ) := + (homogeneousPhysicalCLM a k ha ha1 hk v).toContinuousMap + +theorem homogeneousPhysicalContinuous_bound (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (v : HomogeneousY a k) (y : E) : + ‖homogeneousPhysicalContinuous a k ha ha1 hk v y‖ ≤ ‖homogeneousPhysicalCLM a k ha ha1 hk v‖ := by + have h := (homogeneousPhysicalCLM a k ha ha1 hk v).toBCF.norm_coe_le_norm y + change ‖homogeneousPhysicalCLM a k ha ha1 hk v y‖ ≤ + ‖homogeneousPhysicalCLM a k ha ha1 hk v‖ at h + exact h + +theorem expandingFilteredDerivative_of_localized_weak (a k M B R S : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (hLinf : Tendsto L atTop atTop) + (χ : 𝓢(E, ℂ)) (ρ : ℝ) (hρ : 0 < ρ) (hχ : ∀ y : E, ‖y‖ ≤ ρ → χ y = 1) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) (v : HomogeneousY a k) + (hbound : ∀ n, ‖homogeneousLocalizationCLM a k (L n) ha ha1 hk (hL n) χ (f n)‖ ≤ B) + (hweak : ∀ ℓ : HomogeneousY a k →L[ℝ] ℂ, + Tendsto (fun n => ℓ (homogeneousLocalizationCLM a k (L n) ha ha1 hk (hL n) χ (f n))) + atTop (𝓝 (ℓ v))) (hS : 0 < S) (N : ℕ) (j : Fin N → Fin 12) : + Tendsto (fun n => expandingPhysicalBall a k (L n) R ha ha1 hk (hL n) + (expandingSmoothDerivative (L n) S hS N j (f n))) atTop + (𝓝 (schwartzBallConvolution R (smoothDerivativeKernel S hS N j) + (homogeneousPhysicalContinuous a k ha ha1 hk v))) := by + apply tendsto_expandingSmoothDerivative_local a k M + ‖homogeneousPhysicalCLM a k ha ha1 hk v‖ R S ha ha1 hk + ((norm_nonneg (f 0)).trans (hf 0)) (norm_nonneg _) hS N j L hL f hf + (homogeneousPhysicalContinuous a k ha ha1 hk v) + (homogeneousPhysicalContinuous_bound a k ha ha1 hk v) + exact expandingTorus_local_uniform_of_localized_weak a k B ha ha1 hk L hL hLinf + χ ρ hρ hχ f v hbound hweak + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFilteredWeightedLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFilteredWeightedLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..dc179ecd513e76958bd09d75a043f3f0fe3f1880 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFilteredWeightedLimit.lean @@ -0,0 +1,56 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFilteredWeakLimit +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.LocalWeightedCompact + +namespace OAI + +/-! # The weighted physical L² limit of actual filtered derivatives -/ + +open MeasureTheory Filter Topology +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem tendsto_expandingSmoothDerivative_weightedL2 (a k M S : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hS : 0 < S) + (N : ℕ) (j : Fin N → Fin 12) (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) + (hlocal : ∀ R ε : ℝ, 0 < ε → ∀ᶠ n in atTop, ∀ y : E, ‖y‖ ≤ R → + ‖expandingTorusFunction a k (L n) (f n) (euclideanToTorus ((L n)⁻¹ • y))‖ < ε) + (V : E → ℂ) (hV : MemLp V 2 volume) : + Tendsto (fun n => ∫ y : E, ‖V y * + expandingPhysicalContinuous a k (L n) ha ha1 hk (hL n) + (expandingSmoothDerivative (L n) S hS N j (f n)) y‖ ^ 2) atTop (𝓝 0) := by + let u := fun n => expandingPhysicalContinuous a k (L n) ha ha1 hk (hL n) + (expandingSmoothDerivative (L n) S hS N j (f n)) + let D := expandingEmbeddingBound a k * (∫ z : E, ‖smoothDerivativeKernel S hS N j z‖) + have hD : 0 ≤ D := mul_nonneg (by unfold expandingEmbeddingBound; positivity) + (integral_nonneg (fun _ => norm_nonneg _)) + apply tendsto_weightedL2_of_pointwise_zero (D * M) V hV u + · intro n y + exact (expandingSmoothDerivative_physical_bound a k (L n) S ha ha1 hk (hL n) hS N j (f n) y).trans + (mul_le_mul_of_nonneg_left (hf n) hD) + · intro y + let R := ‖y‖ + have hu := tendsto_expandingSmoothDerivative_local a k M 0 R S ha ha1 hk + ((norm_nonneg (f 0)).trans (hf 0)) le_rfl hS N j L hL f hf (0 : C(E, ℂ)) + (by simp) (by simpa only [ContinuousMap.zero_apply, sub_zero] using hlocal) + have hy : y ∈ Metric.closedBall (0 : E) R := by + simp only [Metric.mem_closedBall, dist_zero_right, R, le_refl] + have he := (ContinuousMap.evalCLM (R := ℂ) ⟨y, hy⟩).continuous.tendsto + (schwartzBallConvolution R (smoothDerivativeKernel S hS N j) (0 : C(E, ℂ))) + have hz : schwartzBallConvolution R (smoothDerivativeKernel S hS N j) (0 : C(E, ℂ)) = 0 := by + ext x + rw [schwartzBallConvolution_apply R 0 le_rfl _ _ (by simp)] + simp + have hh := he.comp hu + change Tendsto (fun n => expandingPhysicalBall a k (L n) R ha ha1 hk (hL n) + (expandingSmoothDerivative (L n) S hS N j (f n)) ⟨y, hy⟩) atTop _ at hh + rw [hz] at hh + simpa only [expandingPhysicalBall_apply, ContinuousMap.zero_apply, map_zero, + expandingPhysicalContinuous_apply, u] using hh + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFiniteLocalExistence.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFiniteLocalExistence.lean new file mode 100644 index 0000000000000000000000000000000000000000..3acf019f24822fef7104ddad8ef576b0b1a4837c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFiniteLocalExistence.lean @@ -0,0 +1,101 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingWeightedLocal + +namespace OAI + +/-! # Local nonlinear existence on an arbitrary fixed similarity slab + +Only a Lipschitz bound on a fixed state ball is used. Small initial data +and small forcing keep the exponentially weighted fixed point in that ball. +-/ + +open Set Metric + +namespace DefocusingNLS + +attribute [local irreducible] expandingFreeStep + +theorem exists_expandingMild_local_finiteSlab (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) (u₀ : FourierL2) + (K ρ R ε : ℝ) (hK : 0 ≤ K) (hρ : 0 ≤ ρ) (hε : 0 ≤ ε) + (hF : ∀ t x y, ‖x‖ ≤ R → ‖y‖ ≤ R → ‖F (t, x) - F (t, y)‖ ≤ K * ‖x - y‖) + (hzero : ∀ t, ‖F (t, 0)‖ ≤ ε) + (hball : Real.exp ((K + 1) * T) * ρ ≤ R) + (hdata : (K + 1) * ‖u₀‖ + ε ≤ ρ) : + ∃ u : C(Icc (0 : ℝ) T, FourierL2), + u = expandingPicard a b k L T ha hk hL hT F u₀ u ∧ + ‖u‖ ≤ Real.exp ((K + 1) * T) * ((K + 1) * ‖u₀‖ + ε) ∧ + ‖u‖ ≤ R := by + let η := K + 1 + have hη : 0 < η := by dsimp [η]; linarith + have hKη : K / η < 1 := (div_lt_one hη).2 (by dsimp [η]; linarith) + let P := expandingBieleckiPicard a b k L T η ha hk hL hT F u₀ + have hstate (z : C(Icc (0 : ℝ) T, FourierL2)) (hz : z ∈ closedBall 0 ρ) + (t : Icc (0 : ℝ) T) : ‖expandingTimeWeight T η z t‖ ≤ R := by + have hzn : ‖z‖ ≤ ρ := by simpa only [mem_closedBall, dist_zero_right] using hz + have hzt : ‖z t‖ ≤ ρ := (ContinuousMap.norm_coe_le_norm z t).trans hzn + change ‖Real.exp (η * t) • z t‖ ≤ R + rw [norm_smul, Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)] + exact (mul_le_mul (Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left t.2.2 hη.le)) hzt + (norm_nonneg _) (Real.exp_pos _).le).trans hball + have hpair (z w : C(Icc (0 : ℝ) T, FourierL2)) + (hz : z ∈ closedBall 0 ρ) (hw : w ∈ closedBall 0 ρ) : + dist (P z) (P w) ≤ K / η * dist z w := + expandingBieleckiPicard_pair_dist_le a b k L T η ha hk hL hT hη F u₀ K hK z w + (fun t => hF t _ _ (hstate z hz t) (hstate w hw t)) + have h0 : (0 : C(Icc (0 : ℝ) T, FourierL2)) ∈ closedBall 0 ρ := by simpa using hρ + have hP0 : ‖P 0‖ ≤ ‖u₀‖ + ε / η := + expandingBieleckiPicard_zero_bound a b k L T η ha hk hL hT hη F u₀ ε hε hzero + have hdata' : ‖u₀‖ + ε / η ≤ ρ / η := by + apply (le_div_iff₀ hη).mpr + rw [add_mul, div_mul_cancel₀ _ hη.ne'] + nlinarith [hdata] + have hidentity : K / η * ρ + ρ / η = ρ := by + calc + _ = (K + 1) * ρ / η := by ring + _ = ρ := mul_div_cancel_left₀ ρ hη.ne' + have hmap : MapsTo P (closedBall 0 ρ) (closedBall 0 ρ) := by + intro z hz + change dist (P z) 0 ≤ ρ + calc + dist (P z) 0 ≤ dist (P z) (P 0) + dist (P 0) 0 := dist_triangle _ _ _ + _ ≤ K / η * dist z 0 + (‖u₀‖ + ε / η) := add_le_add (hpair z 0 hz h0) hP0 + _ ≤ K / η * ρ + ρ / η := add_le_add + (mul_le_mul_of_nonneg_left hz (div_nonneg hK hη.le)) hdata' + _ = ρ := hidentity + have hcontract : ContractingWith ⟨K / η, div_nonneg hK hη.le⟩ + (hmap.restrict P (closedBall 0 ρ) (closedBall 0 ρ)) := by + refine ⟨hKη, LipschitzWith.of_dist_le_mul ?_⟩ + intro z w + exact hpair z.1 w.1 z.2 w.2 + obtain ⟨z, hz, hfix, _⟩ := hcontract.exists_fixedPoint' + isClosed_closedBall.isComplete hmap h0 (edist_ne_top _ _) + have hzbound : ‖z‖ ≤ η * ‖u₀‖ + ε := by + have hi : ‖z‖ ≤ K / η * ‖z‖ + (‖u₀‖ + ε / η) := by + calc + ‖z‖ = dist (P z) 0 := by rw [hfix, dist_zero_right] + _ ≤ dist (P z) (P 0) + dist (P 0) 0 := dist_triangle _ _ _ + _ ≤ K / η * dist z 0 + (‖u₀‖ + ε / η) := add_le_add (hpair z 0 hz h0) hP0 + _ = _ := by rw [dist_zero_right] + have hm := mul_le_mul_of_nonneg_right hi hη.le + have he : (K / η * ‖z‖ + (‖u₀‖ + ε / η)) * η = K * ‖z‖ + η * ‖u₀‖ + ε := by + calc + _ = (K / η * η) * ‖z‖ + η * ‖u₀‖ + ε / η * η := by ring + _ = _ := by rw [div_mul_cancel₀ _ hη.ne', div_mul_cancel₀ _ hη.ne'] + rw [he] at hm + dsimp [η] at hm ⊢ + nlinarith + let u := expandingTimeWeight T η z + have hu : u = expandingPicard a b k L T ha hk hL hT F u₀ u := by + have he := congrArg (expandingTimeWeight T η) hfix + simpa only [P, expandingBieleckiPicard, expandingTimeWeight_cancel, u] using he.symm + have hu_bound : ‖u‖ ≤ Real.exp (η * T) * (η * ‖u₀‖ + ε) := by + have he := expandingTimeWeight_dist_le T η hη.le z 0 + simp only [expandingTimeWeight_zero, dist_zero_right] at he + exact he.trans (mul_le_mul_of_nonneg_left hzbound (Real.exp_pos _).le) + refine ⟨u, hu, hu_bound, ?_⟩ + exact hu_bound.trans ((mul_le_mul_of_nonneg_left hdata (Real.exp_pos _).le).trans hball) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFiniteSlab.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFiniteSlab.lean new file mode 100644 index 0000000000000000000000000000000000000000..22162f7c055b62ee0d4fdd3ab2d21ca515863710 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFiniteSlab.lean @@ -0,0 +1,135 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingBielecki +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPotentialContinuity + +namespace OAI + +/-! # Uniform finite-slab bounds for the actual moving potential + +The Bielecki construction applies on every finite interval. Its initial-data +bound depends only on the slab length and the uniform bound on the profile, +not on the initial radius of the expanding torus. +-/ + +open Set + +namespace DefocusingNLS + +attribute [local irreducible] expandingFreeStep + +theorem expandingTimeWeight_dist_le (T η : ℝ) (hη : 0 ≤ η) + (u v : C(Icc (0 : ℝ) T, FourierL2)) : + dist (expandingTimeWeight T η u) (expandingTimeWeight T η v) ≤ + Real.exp (η * T) * dist u v := by + apply (ContinuousMap.dist_le (mul_nonneg (Real.exp_pos _).le dist_nonneg)).2 + intro t + change dist (Real.exp (η * t) • u t) (Real.exp (η * t) • v t) ≤ _ + rw [dist_eq_norm, ← smul_sub, norm_smul, Real.norm_eq_abs, + abs_of_pos (Real.exp_pos _)] + exact mul_le_mul + (Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left t.2.2 hη)) + (by simpa only [dist_eq_norm] using + (ContinuousMap.dist_apply_le_dist (f := u) (g := v) t)) + (norm_nonneg _) (Real.exp_pos _).le + +/-- Every mild trajectory becomes a fixed point of the weighted Picard map. -/ +theorem expandingBielecki_isFixedPt (a b k L T η : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) (u₀ : FourierL2) + (u : C(Icc (0 : ℝ) T, FourierL2)) + (hu : ∀ t : Icc (0 : ℝ) T, u t = + expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t (expandingReactionHistory T hT F u)) : + Function.IsFixedPt (expandingBieleckiPicard a b k L T η ha hk hL hT F u₀) + (expandingTimeWeight T (-η) u) := by + apply ContinuousMap.ext + intro t + change Real.exp (-η * t) • + (expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t + (expandingReactionHistory T hT F + (expandingTimeWeight T η (expandingTimeWeight T (-η) u)))) = _ + rw [expandingTimeWeight_cancel, ← hu t] + rfl + +/-- Dependence on the initial datum, uniformly in `L`, on an arbitrary finite slab. -/ +theorem expandingMildSolution_finiteSlab_initialData_bound (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) + (u₀ v₀ : FourierL2) (K : ℝ) (hK : 0 ≤ K) + (hF : ∀ t x y, ‖F (t, x) - F (t, y)‖ ≤ K * ‖x - y‖) + (u v : C(Icc (0 : ℝ) T, FourierL2)) + (hu : ∀ t : Icc (0 : ℝ) T, u t = + expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t (expandingReactionHistory T hT F u)) + (hv : ∀ t : Icc (0 : ℝ) T, v t = + expandingFreeStep a b k L t ha hk hL t.2.1 v₀ + + expandingDuhamel a b k L ha hk hL t (expandingReactionHistory T hT F v)) : + dist u v ≤ (K + 1) * Real.exp ((K + 1) * T) * dist u₀ v₀ := by + let η := K + 1 + have hη : 0 < η := by dsimp [η]; linarith + let P := expandingBieleckiPicard a b k L T η ha hk hL hT F u₀ + let Q := expandingBieleckiPicard a b k L T η ha hk hL hT F v₀ + let u' := expandingTimeWeight T (-η) u + let v' := expandingTimeWeight T (-η) v + have hP : ContractingWith ⟨K / η, div_nonneg hK hη.le⟩ P := + ⟨(div_lt_one hη).2 (by dsimp [η]; linarith), LipschitzWith.of_dist_le_mul + (expandingBieleckiPicard_dist_le a b k L T η ha hk hL hT hη F u₀ K hK hF)⟩ + have huP : Function.IsFixedPt P u' := + expandingBielecki_isFixedPt a b k L T η ha hk hL hT F u₀ u hu + have hvQ : Function.IsFixedPt Q v' := + expandingBielecki_isFixedPt a b k L T η ha hk hL hT F v₀ v hv + have hd : dist u' v' ≤ dist u₀ v₀ / (1 - K / η) := by + apply hP.dist_fixedPoint_fixedPoint_of_dist_le' Q huP hvQ + intro z + apply (ContinuousMap.dist_le dist_nonneg).2 + intro t + change dist + (Real.exp (-η * t) • (expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t + (expandingReactionHistory T hT F (expandingTimeWeight T η z)))) + (Real.exp (-η * t) • (expandingFreeStep a b k L t ha hk hL t.2.1 v₀ + + expandingDuhamel a b k L ha hk hL t + (expandingReactionHistory T hT F (expandingTimeWeight T η z)))) ≤ _ + rw [dist_eq_norm, ← smul_sub, add_sub_add_right_eq_sub, ← map_sub, + norm_smul, Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)] + have hfree : ‖expandingFreeStep a b k L t ha hk hL t.2.1 (u₀ - v₀)‖ ≤ dist u₀ v₀ := by + apply (expandingFreeStep_norm_bound a b k L t ha hk hL t.2.1 _).trans + rw [dist_eq_norm] + exact mul_le_of_le_one_left (norm_nonneg _) + (Real.exp_le_one_iff.mpr (by nlinarith [t.2.1])) + exact (mul_le_mul_of_nonneg_left hfree (Real.exp_pos _).le).trans + (mul_le_of_le_one_left dist_nonneg (Real.exp_le_one_iff.mpr (by + nlinarith [t.2.1]))) + have hden : 1 - K / η = 1 / η := by + apply (eq_div_iff hη.ne').2 + rw [sub_mul, div_mul_cancel₀ _ hη.ne', one_mul] + dsimp [η] + ring + rw [hden, div_div_eq_mul_div, div_one] at hd + have hout := expandingTimeWeight_dist_le T η hη.le u' v' + have heq : dist u v ≤ Real.exp (η * T) * dist u' v' := by + simpa only [u', v', expandingTimeWeight_cancel] using hout + calc + dist u v ≤ Real.exp (η * T) * dist u' v' := heq + _ ≤ Real.exp (η * T) * (dist u₀ v₀ * η) := + mul_le_mul_of_nonneg_left hd (Real.exp_pos _).le + _ = _ := by dsimp [η]; ring + +/-- The actual odd-power linearization along a bounded profile has a unique +solution on every finite slab, at every permitted starting radius. -/ +theorem existsUnique_expandingProfile_finiteSlab (a b k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (m : ℕ) (R : ℝ) (hR : 0 ≤ R) + (q g : C(Icc (0 : ℝ) T, FourierL2)) (u₀ : FourierL2) (hq : ∀ t, ‖q t‖ ≤ R) : + ∃! u : C(Icc (0 : ℝ) T, FourierL2), ∀ t : Icc (0 : ℝ) T, + u t = expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t + (expandingReactionHistory T hT + (expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q g) u) := by + obtain ⟨K, hK, hbound⟩ := exists_expandingProfileReaction_lipschitz a k ha ha1 hk m R hR + exact existsUnique_expandingMildSolution_finiteSlab a b k L T ha hk hL hT _ u₀ K hK + (hbound T (expandingRadiusCurve L T hL) q g hq) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFixedPhysical.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFixedPhysical.lean new file mode 100644 index 0000000000000000000000000000000000000000..387388ff2c633e7ca20d2a1df8f6666534a9992a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFixedPhysical.lean @@ -0,0 +1,27 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPhysicalPath +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingSobolevNonlinearity +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingBlowupObservation + +namespace OAI + +/-! # The fixed Sobolev path represents the same normalized torus function -/ + +open Set + +namespace DefocusingNLS + +theorem expandingFixedPhysical_value (a k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (u : C(Icc (0 : ℝ) T, FourierL2)) (t : Icc (0 : ℝ) T) (x : SchrodingerTorus) : + sobolevTorusFunction k (expandingToSobolev a k ha1 hk + (expandingPhysicalPath a k L T ha hk hL u t)) x = + expandingTorusFunction a k (expandingRadius L t) (u t) x := by + rw [sobolevTorusFunction_expandingToSobolev a k ha ha1 hk] + change expandingTorusFunction a k 1 + (expandingInverseTransfer a k (expandingRadius L t) ha hk + (hL.trans (expandingRadius_ge L t hL t.2.1)) (u t)) x = _ + exact DFunLike.congr_fun (expandingInverseTransfer_function a k _ ha ha1 hk _ _) x + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFourier.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..149329ddacfd1856bfd38a27c66b1375e140f165 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFourier.lean @@ -0,0 +1,139 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingWeightProduct +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingWeightAddition +import OAI.MathematicalPhysics.DefocusingNLS.Linear.FourierAbsolute + +namespace OAI + +/-! # The exact Y_L Fourier realization and uniform ℓ¹ embedding -/ + +open scoped ENNReal ComplexConjugate + +namespace DefocusingNLS + +/-- Physical Fourier coefficients for a vector whose ℓ² norm is the exact `Y_L` norm. -/ +noncomputable def expandingFourierCoefficient (a k L : ℝ) (f : FourierL2) + (n : frequencyLattice) : ℂ := + ((expandingSobolevWeight a k L n)⁻¹ : ℝ) * f n + +theorem weight_mul_expandingFourierCoefficient (a k L : ℝ) (hL : 1 ≤ L) + (f : FourierL2) (n : frequencyLattice) : + (expandingSobolevWeight a k L n : ℂ) * expandingFourierCoefficient a k L f n = f n := by + unfold expandingFourierCoefficient + rw [← mul_assoc, ← Complex.ofReal_mul, + mul_inv_cancel₀ (expandingSobolevWeight_pos a k L hL n).ne'] + simp + +/-- The Hilbert norm equals the manuscript's volume-weighted Fourier norm exactly. -/ +theorem expandingFourier_norm_sq (a k L : ℝ) (hL : 1 ≤ L) (f : FourierL2) : + (2 * Real.pi * L) ^ 12 * (∑' n : frequencyLattice, + ((L ^ (-2 : ℝ) + (‖n‖ / L) ^ 2) ^ (6 - a) + (‖n‖ / L) ^ (2 * k)) * + ‖expandingFourierCoefficient a k L f n‖ ^ 2) = ‖f‖ ^ 2 := by + rw [← tsum_mul_left] + have hn := lp.norm_rpow_eq_tsum (p := 2) (by norm_num) f + simp only [ENNReal.toReal_ofNat, Real.rpow_two] at hn + rw [hn] + apply tsum_congr + intro n + have he : (2 * Real.pi * L) ^ 12 * + ((L ^ (-2 : ℝ) + (‖n‖ / L) ^ 2) ^ (6 - a) + (‖n‖ / L) ^ (2 * k)) = + (expandingSobolevWeight a k L n) ^ 2 := by + rw [expandingSobolevWeight_sq a k L hL] + exact expandingSobolevWeightSq_original a k L hL n + rw [← mul_assoc, he, ← mul_pow] + have hw : expandingSobolevWeight a k L n * ‖expandingFourierCoefficient a k L f n‖ = + ‖f n‖ := by + simpa only [norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_pos (expandingSobolevWeight_pos a k L hL n)] using + congrArg norm (weight_mul_expandingFourierCoefficient a k L hL f n) + rw [hw] + +theorem expanding_observation_weight_sq (a k L : ℝ) (hL : 1 ≤ L) (n : frequencyLattice) : + ‖(((expandingSobolevWeight a k L n)⁻¹ : ℝ) : ℂ)‖ ^ 2 = + ((2 * Real.pi) ^ 12)⁻¹ * (expandingSobolevWeightSq a k L n)⁻¹ := by + simp only [Complex.norm_real, Real.norm_eq_abs, abs_inv, + abs_of_pos (expandingSobolevWeight_pos a k L hL n), inv_pow, + expandingSobolevWeight_sq a k L hL n, mul_inv_rev] + ring + +/-- Inverse weights form an ℓ² vector with a uniform norm as the torus expands. -/ +noncomputable def expandingObservationVector (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) : FourierL2 := + ⟨fun n => ((expandingSobolevWeight a k L n)⁻¹ : ℝ), by + apply memℓp_gen + have hs := (summable_expandingSobolevWeight_inv a k L ha ha1 hk hL).1.mul_left + (((2 * Real.pi) ^ 12)⁻¹) + simpa only [ENNReal.toReal_ofNat, Real.rpow_two, + expanding_observation_weight_sq a k L hL] using hs⟩ + +noncomputable def expandingEmbeddingBound (a k : ℝ) : ℝ := + Real.sqrt (((2 * Real.pi) ^ 12)⁻¹ * + (2 ^ 12 * (1 + 2 * (1 / (a / 6) + 1 / (k / 6 - 1))) ^ 12)) + +theorem expandingObservationVector_norm_le (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) : + ‖expandingObservationVector a k L ha ha1 hk hL‖ ≤ expandingEmbeddingBound a k := by + have he := lp.norm_rpow_eq_tsum (p := 2) (by norm_num) + (expandingObservationVector a k L ha ha1 hk hL) + simp only [ENNReal.toReal_ofNat, Real.rpow_two] at he + have he' : ‖expandingObservationVector a k L ha ha1 hk hL‖ ^ 2 = + ((2 * Real.pi) ^ 12)⁻¹ * ∑' n : frequencyLattice, + (expandingSobolevWeightSq a k L n)⁻¹ := by + rw [he, ← tsum_mul_left] + apply tsum_congr + intro n + exact expanding_observation_weight_sq a k L hL n + have hb := mul_le_mul_of_nonneg_left + (summable_expandingSobolevWeight_inv a k L ha ha1 hk hL).2 + (show 0 ≤ ((2 * Real.pi) ^ 12)⁻¹ by positivity) + rw [← he'] at hb + have hC : 0 ≤ ((2 * Real.pi) ^ 12)⁻¹ * + (2 ^ 12 * (1 + 2 * (1 / (a / 6) + 1 / (k / 6 - 1))) ^ 12) := by positivity + unfold expandingEmbeddingBound + nlinarith [Real.sq_sqrt hC, Real.sqrt_nonneg (((2 * Real.pi) ^ 12)⁻¹ * + (2 ^ 12 * (1 + 2 * (1 / (a / 6) + 1 / (k / 6 - 1))) ^ 12)), + norm_nonneg (expandingObservationVector a k L ha ha1 hk hL)] + +theorem hasSum_expandingFourierCoefficient (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) : + HasSum (expandingFourierCoefficient a k L f) + (inner ℂ (expandingObservationVector a k L ha ha1 hk hL) f) := by + change HasSum (fun n => expandingFourierCoefficient a k L f n) _ + have h := lp.hasSum_inner (𝕜 := ℂ) (expandingObservationVector a k L ha ha1 hk hL) f + simpa [expandingObservationVector, expandingFourierCoefficient, RCLike.inner_apply', mul_comm] using h + +theorem summable_norm_expandingFourierCoefficient (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) : + Summable (fun n => ‖expandingFourierCoefficient a k L f n‖) := + (hasSum_expandingFourierCoefficient a k L ha ha1 hk hL f).summable.norm + +theorem expandingFourierCoefficient_absolute (a k L : ℝ) (hL : 1 ≤ L) + (f : FourierL2) (n : frequencyLattice) : + expandingFourierCoefficient a k L (fourierAbsolute f) n = + (‖expandingFourierCoefficient a k L f n‖ : ℂ) := by + simp only [expandingFourierCoefficient, fourierAbsolute_apply, norm_mul, Complex.norm_real, + Real.norm_eq_abs, abs_inv, abs_of_pos (expandingSobolevWeight_pos a k L hL n), + Complex.ofReal_mul] + +/-- The ℓ¹ Fourier embedding constant is independent of the expanding scale. -/ +theorem tsum_norm_expandingFourierCoefficient_le (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) : + (∑' n, ‖expandingFourierCoefficient a k L f n‖) ≤ expandingEmbeddingBound a k * ‖f‖ := by + have h := hasSum_expandingFourierCoefficient a k L ha ha1 hk hL (fourierAbsolute f) + change HasSum (fun n => expandingFourierCoefficient a k L (fourierAbsolute f) n) _ at h + simp_rw [expandingFourierCoefficient_absolute a k L hL] at h + have hs := (summable_norm_expandingFourierCoefficient a k L ha ha1 hk hL f).hasSum.mapL + Complex.ofRealCLM + have hs' : HasSum (fun n => (‖expandingFourierCoefficient a k L f n‖ : ℂ)) + (Complex.ofReal (∑' n, ‖expandingFourierCoefficient a k L f n‖)) := by + simpa only [Complex.ofRealCLM_apply] using hs + have heq := h.unique hs' + have hb := norm_inner_le_norm (𝕜 := ℂ) + (expandingObservationVector a k L ha ha1 hk hL) (fourierAbsolute f) + rw [heq, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (tsum_nonneg (fun n => norm_nonneg _)), fourierAbsolute_norm] at hb + exact hb.trans (mul_le_mul_of_nonneg_right + (expandingObservationVector_norm_le a k L ha ha1 hk hL) (norm_nonneg f)) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFourierJetBound.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFourierJetBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..177778afdb5222bfa1d55a7f13739b9faec80f34 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFourierJetBound.lean @@ -0,0 +1,45 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFourierMomentBound + +namespace OAI + +/-! # Uniform bounds for the physical Fourier jet through order two -/ + +namespace DefocusingNLS + +noncomputable def expandingJetBound (a k : ℝ) : ℝ := + expandingEmbeddingBound a (k + 2) + expandingEmbeddingBound a k * Real.sqrt (2 ^ (6 - a) + 1) + +theorem summable_expandingFourier_jet (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) : + Summable (fun n => (1 + (‖n‖ / L) ^ 2) * ‖expandingFourierCoefficient a (k + 2) L f n‖) := by + simpa only [add_mul, one_mul] using + (summable_norm_expandingFourierCoefficient a (k + 2) L ha ha1 (by linarith) hL f).add + (summable_expandingFourier_secondMoment a k L ha ha1 hk hL f) + +theorem tsum_expandingFourier_jet_le (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) : + (∑' n, (1 + (‖n‖ / L) ^ 2) * ‖expandingFourierCoefficient a (k + 2) L f n‖) ≤ + expandingJetBound a k * ‖f‖ := by + simp_rw [add_mul, one_mul] + rw [Summable.tsum_add + (summable_norm_expandingFourierCoefficient a (k + 2) L ha ha1 (by linarith) hL f) + (summable_expandingFourier_secondMoment a k L ha ha1 hk hL f)] + have h0 := tsum_norm_expandingFourierCoefficient_le a (k + 2) L ha ha1 (by linarith) hL f + have h2 := tsum_expandingFourier_secondMoment_le a k L ha ha1 hk hL f + dsimp [expandingJetBound] + calc + _ ≤ expandingEmbeddingBound a (k + 2) * ‖f‖ + + expandingEmbeddingBound a k * Real.sqrt (2 ^ (6 - a) + 1) * ‖f‖ := add_le_add h0 h2 + _ = _ := by ring + +theorem sum_expandingFourier_jet_le (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) + (S : Finset frequencyLattice) : + (∑ n ∈ S, (1 + (‖n‖ / L) ^ 2) * ‖expandingFourierCoefficient a (k + 2) L f n‖) ≤ + expandingJetBound a k * ‖f‖ := + ((summable_expandingFourier_jet a k L ha ha1 hk hL f).sum_le_tsum S + (fun n _ => by positivity)).trans (tsum_expandingFourier_jet_le a k L ha ha1 hk hL f) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFourierMomentBound.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFourierMomentBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..ac8ce50539db95c7c0665c998be2a9d473a2a1ee --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFourierMomentBound.lean @@ -0,0 +1,36 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingQuadraticMultiplier + +namespace OAI + +/-! # Uniform second Fourier moment in physical coordinates -/ + +namespace DefocusingNLS + +theorem summable_expandingFourier_secondMoment (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) : + Summable (fun n => (‖n‖ / L) ^ 2 * ‖expandingFourierCoefficient a (k + 2) L f n‖) := by + have h := summable_norm_expandingFourierCoefficient a k L ha ha1 hk hL + (expandingQuadraticVector a k L ha ha1 hk hL f) + simpa only [expandingQuadraticVector_coefficient, norm_mul, Complex.norm_real, + Real.norm_eq_abs, abs_pow, sq_abs] using h + +theorem tsum_expandingFourier_secondMoment_le (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) : + (∑' n, (‖n‖ / L) ^ 2 * ‖expandingFourierCoefficient a (k + 2) L f n‖) ≤ + expandingEmbeddingBound a k * Real.sqrt (2 ^ (6 - a) + 1) * ‖f‖ := by + have h := tsum_norm_expandingFourierCoefficient_le a k L ha ha1 hk hL + (expandingQuadraticVector a k L ha ha1 hk hL f) + have hn (n : frequencyLattice) : + ‖expandingFourierCoefficient a k L (expandingQuadraticVector a k L ha ha1 hk hL f) n‖ = + (‖n‖ / L) ^ 2 * ‖expandingFourierCoefficient a (k + 2) L f n‖ := by + rw [expandingQuadraticVector_coefficient, norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (sq_nonneg _)] + simp only [hn] at h + exact h.trans (by + have hmul := mul_le_mul_of_nonneg_left (expandingQuadraticVector_norm a k L ha ha1 hk hL f) + (show 0 ≤ expandingEmbeddingBound a k by unfold expandingEmbeddingBound; positivity) + nlinarith) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFourierTest.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFourierTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..a80e09880e363e99481a1d595dc15002f0c313b2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFourierTest.lean @@ -0,0 +1,76 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingMultiplication +import OAI.MathematicalPhysics.DefocusingNLS.Linear.PeriodicSchwartzPairing + +namespace OAI + +/-! # Bounded Schwartz frequency tests on the expanding Fourier space -/ + +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem summable_expandingFourierTest (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (φ : 𝓢(E, ℂ)) (f : FourierL2) : + Summable (fun n => expandingFourierCoefficient a k L f n * φ (L⁻¹ • (n : E))) := by + apply ((summable_norm_expandingFourierCoefficient a k L ha ha1 hk hL f).mul_right + (SchwartzMap.seminorm ℂ 0 0 φ)).of_norm_bounded + intro n + rw [norm_mul] + exact mul_le_mul_of_nonneg_left (φ.norm_le_seminorm ℂ _) (norm_nonneg _) + +noncomputable def expandingFourierTest (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (φ : 𝓢(E, ℂ)) : FourierL2 →L[ℂ] ℂ := by + let F : FourierL2 →ₗ[ℂ] ℂ := + { toFun := fun f => ∑' n, expandingFourierCoefficient a k L f n * φ (L⁻¹ • (n : E)) + map_add' := by + intro f g + simp only [expandingFourierCoefficient_add, add_mul] + exact (summable_expandingFourierTest a k L ha ha1 hk hL φ f).tsum_add + (summable_expandingFourierTest a k L ha ha1 hk hL φ g) + map_smul' := by + intro c f + simp only [expandingFourierCoefficient_smul, mul_assoc, tsum_mul_left, + smul_eq_mul, RingHom.id_apply] } + refine F.mkContinuous (expandingEmbeddingBound a k * SchwartzMap.seminorm ℂ 0 0 φ) ?_ + intro f + change ‖∑' n, expandingFourierCoefficient a k L f n * φ (L⁻¹ • (n : E))‖ ≤ _ + apply (norm_tsum_le_tsum_norm + (summable_expandingFourierTest a k L ha ha1 hk hL φ f).norm).trans + calc + _ ≤ ∑' n, ‖expandingFourierCoefficient a k L f n‖ * SchwartzMap.seminorm ℂ 0 0 φ := by + apply Summable.tsum_le_tsum + (fun n => by + rw [norm_mul] + exact mul_le_mul_of_nonneg_left (φ.norm_le_seminorm ℂ _) (norm_nonneg _)) + (summable_expandingFourierTest a k L ha ha1 hk hL φ f).norm + ((summable_norm_expandingFourierCoefficient a k L ha ha1 hk hL f).mul_right _) + _ = (∑' n, ‖expandingFourierCoefficient a k L f n‖) * SchwartzMap.seminorm ℂ 0 0 φ := + tsum_mul_right + _ ≤ _ := by + simpa only [mul_assoc, mul_left_comm, mul_comm] using + mul_le_mul_of_nonneg_right + (tsum_norm_expandingFourierCoefficient_le a k L ha ha1 hk hL f) + (apply_nonneg (SchwartzMap.seminorm ℂ 0 0) φ) + +@[simp] theorem expandingFourierTest_apply (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (φ : 𝓢(E, ℂ)) (f : FourierL2) : + expandingFourierTest a k L ha ha1 hk hL φ f = + ∑' n, expandingFourierCoefficient a k L f n * φ (L⁻¹ • (n : E)) := rfl + +theorem expandingFourierTest_norm_le (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (φ : 𝓢(E, ℂ)) : + ‖expandingFourierTest a k L ha ha1 hk hL φ‖ ≤ + expandingEmbeddingBound a k * SchwartzMap.seminorm ℂ 0 0 φ := by + unfold expandingFourierTest + apply LinearMap.mkContinuous_norm_le + unfold expandingEmbeddingBound + positivity + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFourierTestLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFourierTestLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..947ea3ccf13699f7b526437e2fe1d25c54936155 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFourierTestLimit.lean @@ -0,0 +1,54 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFourierTest +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingSmoothFilter +import OAI.MathematicalPhysics.DefocusingNLS.Linear.SchwartzPairingLimit +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.PhysicalFourierTest + +namespace OAI + +/-! # Physical local limits determine all expanding Fourier test limits -/ + +open MeasureTheory Filter Topology +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem expandingFourierTest_physical (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (φ : 𝓢(E, ℂ)) (f : FourierL2) : + expandingFourierTest a k L ha ha1 hk hL φ f = + ∫ y : E, physicalFourierTest φ y * expandingPhysicalContinuous a k L ha ha1 hk hL f y := by + have h := hasSum_periodicSchwartzPairing L (physicalFourierTest φ) + (expandingFourierCoefficient a k L f) + (summable_norm_expandingFourierCoefficient a k L ha ha1 hk hL f) + change (∑' n, expandingFourierCoefficient a k L f n * φ (L⁻¹ • (n : E))) = + ∫ y : E, physicalFourierTest φ y * + spatialFourierSeries (expandingFourierCoefficient a k L f) (L⁻¹ • y) + simpa only [physicalFourierTest_kernel] using h.tsum_eq + +theorem expandingFourierTest_tendsto_of_physical (a k M : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) (v : HomogeneousY a k) + (hp : ∀ y : E, Tendsto (fun n => expandingPhysicalContinuous a k (L n) + ha ha1 hk (hL n) (f n) y) atTop (𝓝 (homogeneousPhysicalCLM a k ha ha1 hk v y))) + (φ : 𝓢(E, ℂ)) : + Tendsto (fun n => expandingFourierTest a k (L n) ha ha1 hk (hL n) φ (f n)) atTop + (𝓝 ((((2 * Real.pi) ^ (12 : ℕ))⁻¹ : ℂ) * homogeneousFourierPairing a k ha ha1 hk φ v)) := by + have h := tendsto_schwartzPairing_of_bounded_pointwise (physicalFourierTest φ) + (fun n => expandingPhysicalContinuous a k (L n) ha ha1 hk (hL n) (f n)) + (homogeneousPhysicalCLM a k ha ha1 hk v).toContinuousMap + (expandingEmbeddingBound a k * M) + (fun n y => (expandingPhysicalContinuous_norm_le a k (L n) ha ha1 hk (hL n) (f n) y).trans + (mul_le_mul_of_nonneg_left (hf n) (by unfold expandingEmbeddingBound; positivity))) hp + have he : (∫ y : E, physicalFourierTest φ y * + (homogeneousPhysicalCLM a k ha ha1 hk v).toContinuousMap y) = + (((2 * Real.pi) ^ (12 : ℕ))⁻¹ : ℂ) * homogeneousFourierPairing a k ha ha1 hk φ v := + homogeneousFourierPairing_physical a k ha ha1 hk φ v + rw [he] at h + simpa only [← expandingFourierTest_physical] using h + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFreeContinuity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFreeContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..6e70d0c34b2eb5a3c653d043b1fec33d8840d707 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFreeContinuity.lean @@ -0,0 +1,191 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFreeStep + +namespace OAI + +/-! # Strong continuity of the moving-scale free propagator + +Continuity is joint in the positive starting scale, forward time, and input. +No operator-norm continuity of Schrödinger evolution is asserted. +-/ + +open Filter Topology +open scoped ENNReal + +namespace DefocusingNLS + +abbrev ExpandingFreeParameters := {L : ℝ // 1 ≤ L} × NNReal + +noncomputable def expandingFreeFamily (a b k : ℝ) (ha : 0 < a) (hk : 8 < k) + (p : ExpandingFreeParameters) : FourierL2 →L[ℂ] FourierL2 := + expandingFreeStep a b k p.1.1 p.2 ha hk p.1.2 p.2.2 + +theorem expandingFreeFamily_apply_coordinate (a b k : ℝ) (ha : 0 < a) (hk : 8 < k) + (p : ExpandingFreeParameters) (f : FourierL2) (n : frequencyLattice) : + expandingFreeFamily a b k ha hk p f n = + expandingFreeAmplitude a b p.2 * + (expandingScaleRatio a k p.1.1 (expandingRadius p.1.1 p.2) n : ℂ) * + schrodingerMultiplier (expandingFreeTime p.1.1 p.2) n * f n := by + unfold expandingFreeFamily + change expandingFreeAmplitude a b p.2 * + ((expandingScaleRatio a k p.1.1 (expandingRadius p.1.1 p.2) n : ℂ) * + (schrodingerMultiplier (expandingFreeTime p.1.1 p.2) n * f n)) = _ + ring + +private theorem continuous_weight_on_positive (a k : ℝ) (n : frequencyLattice) : + Continuous (fun L : {L : ℝ // 0 < L} => expandingSobolevWeight a k L.1 n) := by + have hlow : Continuous (fun L : {L : ℝ // 0 < L} => L.1 ^ (2 * a)) := + continuous_subtype_val.rpow_const (fun L => Or.inl L.2.ne') + have hhigh : Continuous (fun L : {L : ℝ // 0 < L} => L.1 ^ (12 - 2 * k)) := + continuous_subtype_val.rpow_const (fun L => Or.inl L.2.ne') + unfold expandingSobolevWeight expandingSobolevWeightSq + exact continuous_const.mul (Real.continuous_sqrt.comp + ((hlow.mul continuous_const).add (hhigh.mul continuous_const))) + +private theorem continuous_family_coordinate (a b k : ℝ) (ha : 0 < a) (hk : 8 < k) + (f : FourierL2) (n : frequencyLattice) : + Continuous (fun p : ExpandingFreeParameters => expandingFreeFamily a b k ha hk p f n) := by + have hL : Continuous (fun p : ExpandingFreeParameters => p.1.1) := + continuous_subtype_val.comp continuous_fst + have hs : Continuous (fun p : ExpandingFreeParameters => (p.2 : ℝ)) := + continuous_subtype_val.comp continuous_snd + have hR : Continuous (fun p : ExpandingFreeParameters => expandingRadius p.1.1 p.2) := by + unfold expandingRadius + exact hL.mul (Real.continuous_exp.comp (hs.div_const 2)) + have hLp (p : ExpandingFreeParameters) : 0 < p.1.1 := lt_of_lt_of_le zero_lt_one p.1.2 + have hRp (p : ExpandingFreeParameters) : 0 < expandingRadius p.1.1 p.2 := + mul_pos (hLp p) (Real.exp_pos _) + have hwL : Continuous (fun p : ExpandingFreeParameters => expandingSobolevWeight a k p.1.1 n) := + (continuous_weight_on_positive a k n).comp (hL.subtype_mk hLp) + have hwR : Continuous (fun p : ExpandingFreeParameters => + expandingSobolevWeight a k (expandingRadius p.1.1 p.2) n) := + (continuous_weight_on_positive a k n).comp (hR.subtype_mk hRp) + have hratio : Continuous (fun p : ExpandingFreeParameters => + expandingScaleRatio a k p.1.1 (expandingRadius p.1.1 p.2) n) := + hwR.div hwL (fun p => (expandingSobolevWeight_pos a k p.1.1 p.1.2 n).ne') + have hamp : Continuous (fun p : ExpandingFreeParameters => expandingFreeAmplitude a b p.2) := by + unfold expandingFreeAmplitude + fun_prop + have htime : Continuous (fun p : ExpandingFreeParameters => expandingFreeTime p.1.1 p.2) := by + unfold expandingFreeTime + exact (hL.rpow_const (fun p => Or.inl (hLp p).ne')).mul + (continuous_const.sub (Real.continuous_exp.comp hs.neg)) + simp only [expandingFreeFamily_apply_coordinate] + exact (((hamp.mul (Complex.continuous_ofReal.comp hratio)).mul + ((continuous_schrodingerMultiplier n).comp htime)).mul continuous_const) + +private theorem family_coordinate_bound (a b k : ℝ) (ha : 0 < a) (hk : 8 < k) + (p : ExpandingFreeParameters) (f : FourierL2) (n : frequencyLattice) + (T : ℝ) (hsT : (p.2 : ℝ) ≤ T) : + ‖expandingFreeFamily a b k ha hk p f n‖ ≤ Real.exp (a * T / 2) * ‖f n‖ := by + have hratio := expandingScaleRatio_le a k p.1.1 (expandingRadius p.1.1 p.2) + ha hk p.1.2 (expandingRadius_ge p.1.1 p.2 p.1.2 p.2.2) n + have hR : expandingRadius p.1.1 p.2 / p.1.1 = Real.exp ((p.2 : ℝ) / 2) := by + unfold expandingRadius + field_simp [(lt_of_lt_of_le zero_lt_one p.1.2).ne'] + rw [hR, ← Real.exp_mul] at hratio + have hamp : Real.exp (-a * (p.2 : ℝ)) ≤ 1 := + Real.exp_le_one_iff.mpr (by nlinarith [p.2.2]) + rw [expandingFreeFamily_apply_coordinate, norm_mul, norm_mul, norm_mul, + expandingFreeAmplitude_norm, schrodingerMultiplier_norm, mul_one, Complex.norm_real, + Real.norm_eq_abs, abs_of_nonneg (expandingScaleRatio_nonneg a k p.1.1 + (expandingRadius p.1.1 p.2) p.1.2 (expandingRadius_ge _ _ p.1.2 p.2.2) n)] + calc + _ ≤ 1 * Real.exp ((p.2 : ℝ) / 2 * a) * ‖f n‖ := + mul_le_mul_of_nonneg_right + (mul_le_mul hamp hratio (expandingScaleRatio_nonneg a k p.1.1 + (expandingRadius p.1.1 p.2) p.1.2 (expandingRadius_ge _ _ p.1.2 p.2.2) n) + (by norm_num)) (norm_nonneg _) + _ ≤ Real.exp (a * T / 2) * ‖f n‖ := by + simp only [one_mul] + gcongr + nlinarith + +/-- Each fixed input has a strongly continuous free orbit, jointly in scale and time. -/ +theorem continuous_expandingFreeFamily (a b k : ℝ) (ha : 0 < a) (hk : 8 < k) + (f : FourierL2) : + Continuous (fun p : ExpandingFreeParameters => expandingFreeFamily a b k ha hk p f) := by + rw [continuous_iff_continuousAt] + intro p₀ + let K := Real.exp (a * ((p₀.2 : ℝ) + 1) / 2) + have hK : 0 < K := Real.exp_pos _ + have hnear : ∀ᶠ p : ExpandingFreeParameters in 𝓝 p₀, (p.2 : ℝ) < (p₀.2 : ℝ) + 1 := + ((continuous_subtype_val.comp continuous_snd).continuousAt.tendsto).eventually + (eventually_lt_nhds (by change (p₀.2 : ℝ) < (p₀.2 : ℝ) + 1; linarith)) + have hdom : Summable (fun n : frequencyLattice => 4 * K ^ 2 * ‖f n‖ ^ 2) := by + simpa only [ENNReal.toReal_ofNat, Real.rpow_two] using + ((lp.memℓp f).summable (by norm_num : 0 < (2 : ℝ≥0∞).toReal)).mul_left (4 * K ^ 2) + have hb : ∀ᶠ p : ExpandingFreeParameters in 𝓝 p₀, ∀ n, + ‖expandingFreeFamily a b k ha hk p f n - expandingFreeFamily a b k ha hk p₀ f n‖ ^ 2 ≤ + 4 * K ^ 2 * ‖f n‖ ^ 2 := by + filter_upwards [hnear] with p hp n + have hpB := family_coordinate_bound a b k ha hk p f n ((p₀.2 : ℝ) + 1) hp.le + have hqB := family_coordinate_bound a b k ha hk p₀ f n ((p₀.2 : ℝ) + 1) (by linarith) + have hdiff := norm_sub_le (expandingFreeFamily a b k ha hk p f n) + (expandingFreeFamily a b k ha hk p₀ f n) + change ‖expandingFreeFamily a b k ha hk p f n‖ ≤ K * ‖f n‖ at hpB + change ‖expandingFreeFamily a b k ha hk p₀ f n‖ ≤ K * ‖f n‖ at hqB + have hdiff' : ‖expandingFreeFamily a b k ha hk p f n - + expandingFreeFamily a b k ha hk p₀ f n‖ ≤ 2 * K * ‖f n‖ := by linarith + calc + _ ≤ (2 * K * ‖f n‖) ^ 2 := pow_le_pow_left₀ (norm_nonneg _) hdiff' 2 + _ = _ := by ring + have hlim := tendsto_tsum_of_dominated_convergence hdom + (f := fun p n => ‖expandingFreeFamily a b k ha hk p f n - + expandingFreeFamily a b k ha hk p₀ f n‖ ^ 2) (g := fun _ => (0 : ℝ)) (𝓕 := 𝓝 p₀) + (by + intro n + have hc : Continuous (fun p : ExpandingFreeParameters => + ‖expandingFreeFamily a b k ha hk p f n - + expandingFreeFamily a b k ha hk p₀ f n‖ ^ 2) := + (((continuous_family_coordinate a b k ha hk f n).sub continuous_const).norm.pow 2) + simpa using (hc.continuousAt (x := p₀)).tendsto) + (by + filter_upwards [hb] with p hp n + rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] + exact hp n) + have hsq : Tendsto (fun p => ‖expandingFreeFamily a b k ha hk p f - + expandingFreeFamily a b k ha hk p₀ f‖ ^ 2) (𝓝 p₀) (𝓝 0) := by + have heq (p : ExpandingFreeParameters) := lp.norm_rpow_eq_tsum (p := 2) (by norm_num) + (expandingFreeFamily a b k ha hk p f - expandingFreeFamily a b k ha hk p₀ f) + simp only [ENNReal.toReal_ofNat, Real.rpow_two, lp.coeFn_sub, Pi.sub_apply] at heq + simpa only [heq, tsum_zero] using hlim + have hn := Real.continuous_sqrt.continuousAt.tendsto.comp hsq + have hn' : Tendsto (fun p => ‖expandingFreeFamily a b k ha hk p f - + expandingFreeFamily a b k ha hk p₀ f‖) (𝓝 p₀) (𝓝 0) := by + simpa only [Function.comp_def, Real.sqrt_sq_eq_abs, abs_norm, Real.sqrt_zero] using hn + exact tendsto_iff_norm_sub_tendsto_zero.mpr hn' + +/-- Strong continuity for varying inputs, without an operator-norm assertion. -/ +theorem continuous_expandingFreeFamily_uncurry (a b k : ℝ) (ha : 0 < a) (hk : 8 < k) : + Continuous (fun p : ExpandingFreeParameters × FourierL2 => + expandingFreeFamily a b k ha hk p.1 p.2) := by + rw [continuous_iff_continuousAt] + intro p + apply Metric.tendsto_nhds.mpr + intro ε hε + have hu : ∀ᶠ q : ExpandingFreeParameters × FourierL2 in 𝓝 p, dist q.2 p.2 < ε / 2 := + continuous_snd.continuousAt.tendsto.eventually (Metric.ball_mem_nhds p.2 (by linarith)) + have hs : ∀ᶠ q : ExpandingFreeParameters × FourierL2 in 𝓝 p, + dist (expandingFreeFamily a b k ha hk q.1 p.2) + (expandingFreeFamily a b k ha hk p.1 p.2) < ε / 2 := + (((continuous_expandingFreeFamily a b k ha hk p.2).comp continuous_fst).continuousAt.tendsto).eventually + (Metric.ball_mem_nhds _ (by linarith)) + filter_upwards [hu, hs] with q hqu hqs + have hcontract : ‖expandingFreeFamily a b k ha hk q.1 (q.2 - p.2)‖ ≤ ‖q.2 - p.2‖ := by + have he := expandingFreeStep_norm_bound a b k q.1.1.1 q.1.2 ha hk q.1.1.2 q.1.2.2 (q.2 - p.2) + exact he.trans (mul_le_of_le_one_left (norm_nonneg _) (Real.exp_le_one_iff.mpr (by + nlinarith [q.1.2.2]))) + calc + _ ≤ dist (expandingFreeFamily a b k ha hk q.1 q.2) + (expandingFreeFamily a b k ha hk q.1 p.2) + + dist (expandingFreeFamily a b k ha hk q.1 p.2) + (expandingFreeFamily a b k ha hk p.1 p.2) := dist_triangle _ _ _ + _ ≤ dist q.2 p.2 + dist (expandingFreeFamily a b k ha hk q.1 p.2) + (expandingFreeFamily a b k ha hk p.1 p.2) := by + apply add_le_add_left + simpa only [dist_eq_norm, ← map_sub] using hcontract + _ < ε := by linarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFreeDuality.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFreeDuality.lean new file mode 100644 index 0000000000000000000000000000000000000000..6ce4647f204d203c084c4546a50c113d4a4de605 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFreeDuality.lean @@ -0,0 +1,51 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFourierTest +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPhysicalCharacter +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousFreeDuality + +namespace OAI + +/-! # The expanding-torus free step has the same Schwartz dual action as the whole-space group -/ + +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem expandingFreeTime_phase (L t : ℝ) (hL : 0 < L) (n : frequencyLattice) : + schrodingerMultiplier (expandingFreeTime L t) n = + homogeneousSchrodingerPhase (1 - Real.exp (-t)) (L⁻¹ • (n : E)) := by + have hpow : L ^ (-2 : ℝ) = (L⁻¹) ^ 2 := by + rw [show (-2 : ℝ) = -(2 : ℝ) by ring, Real.rpow_neg hL.le, + Real.rpow_two, inv_pow] + unfold schrodingerMultiplier homogeneousSchrodingerPhase expandingFreeTime + rw [hpow, norm_smul, Real.norm_eq_abs, abs_of_pos (inv_pos.mpr hL)] + congr 1 + change -Complex.I * (((L⁻¹) ^ 2 * (1 - Real.exp (-t)) * ‖n‖ ^ 2 : ℝ) : ℂ) = + (((-(1 - Real.exp (-t)) * (L⁻¹ * ‖n‖) ^ 2 : ℝ)) : ℂ) * Complex.I + push_cast + ring + +theorem expandingFreeStep_fourier_duality (a b k L t : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (ht : 0 ≤ t) + (φ : 𝓢(E, ℂ)) (f : FourierL2) : + expandingFourierTest a k (expandingRadius L t) ha ha1 hk + (hL.trans (expandingRadius_ge L t hL ht)) φ + (expandingFreeStep a b k L t ha hk hL ht f) = + expandingFourierTest a k L ha ha1 hk hL (homogeneousFreeDualTest a b t φ) f := by + simp only [expandingFourierTest_apply] + apply tsum_congr + intro n + rw [expandingFreeStep_coefficient, homogeneousFreeDualTest_apply, + ← expandingFreeTime_phase L t (lt_of_lt_of_le zero_lt_one hL) n] + have he : Real.exp (-t / 2) • (L⁻¹ • (n : E)) = + (expandingRadius L t)⁻¹ • (n : E) := by + rw [smul_smul, expandingRadius_inv, mul_comm] + rw [he] + change expandingFreeAmplitude a b t * _ * _ * _ = + _ * (expandingFreeAmplitude a b t * _ * _) + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFreeInverse.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFreeInverse.lean new file mode 100644 index 0000000000000000000000000000000000000000..01ba2b1ec477dd08206f6ddb6a82bd09b36f743e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFreeInverse.lean @@ -0,0 +1,100 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingWeightIdentification +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingDuhamelRestart + +namespace OAI + +/-! # The bounded inverse of each finite-time expanding free step + +This inverse is only used on finite slabs, to remove the free evolution +before differentiating a continuous forced solution in its energy norm. +-/ + +open Set Filter Topology + +namespace DefocusingNLS + +noncomputable def expandingFreeInverse (a b k L t : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (ht : 0 ≤ t) : + FourierL2 →L[ℂ] FourierL2 := + (expandingFreeAmplitude a b t)⁻¹ • + ((schrodingerFlow (-expandingFreeTime L t)).toContinuousLinearMap.comp + ((expandingScaleTransfer a k 1 L ha hk le_rfl hL).comp + (expandingInverseTransfer a k (expandingRadius L t) ha hk + (hL.trans (expandingRadius_ge L t hL ht))))) + +theorem expandingFreeInverse_apply (a b k L t : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (ht : 0 ≤ t) (f : FourierL2) : + expandingFreeInverse a b k L t ha hk hL ht f = + (expandingFreeAmplitude a b t)⁻¹ • schrodingerFlow (-expandingFreeTime L t) + (expandingScaleTransfer a k 1 L ha hk le_rfl hL + (expandingInverseTransfer a k (expandingRadius L t) ha hk + (hL.trans (expandingRadius_ge L t hL ht)) f)) := rfl + +theorem expandingFreeInverse_coefficient (a b k L t : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (ht : 0 ≤ t) + (f : FourierL2) (n : frequencyLattice) : + expandingFreeInverse a b k L t ha hk hL ht f n = + (expandingFreeAmplitude a b t)⁻¹ * schrodingerMultiplier (-expandingFreeTime L t) n * + ((expandingSobolevWeight a k L n / expandingSobolevWeight a k (expandingRadius L t) n : ℝ) : ℂ) * f n := by + change (expandingFreeAmplitude a b t)⁻¹ * + (schrodingerMultiplier (-expandingFreeTime L t) n * + ((expandingScaleRatio a k 1 L n : ℂ) * + ((expandingInverseRatio a k (expandingRadius L t) n : ℂ) * f n))) = _ + unfold expandingScaleRatio expandingInverseRatio + push_cast + have h1 := Complex.ofReal_ne_zero.mpr (expandingSobolevWeight_pos a k 1 le_rfl n).ne' + field_simp + +private theorem expandingFree_phase_inverse (t : ℝ) (n : frequencyLattice) : + schrodingerMultiplier (-t) n * schrodingerMultiplier t n = 1 := by + rw [← schrodingerMultiplier_add, neg_add_cancel, schrodingerMultiplier_zero] + +theorem expandingFreeInverse_left (a b k L t : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (ht : 0 ≤ t) (f : FourierL2) : + expandingFreeInverse a b k L t ha hk hL ht + (expandingFreeStep a b k L t ha hk hL ht f) = f := by + ext n + rw [expandingFreeInverse_coefficient] + change (expandingFreeAmplitude a b t)⁻¹ * _ * _ * + (expandingFreeAmplitude a b t * + ((expandingScaleRatio a k L (expandingRadius L t) n : ℂ) * + (schrodingerMultiplier (expandingFreeTime L t) n * f n))) = f n + unfold expandingScaleRatio + push_cast + have hA : expandingFreeAmplitude a b t ≠ 0 := Complex.exp_ne_zero _ + have hW := Complex.ofReal_ne_zero.mpr (expandingSobolevWeight_pos a k L hL n).ne' + have hV := Complex.ofReal_ne_zero.mpr (expandingSobolevWeight_pos a k _ + (hL.trans (expandingRadius_ge L t hL ht)) n).ne' + have hphase := expandingFree_phase_inverse (expandingFreeTime L t) n + calc + _ = (schrodingerMultiplier (-expandingFreeTime L t) n * + schrodingerMultiplier (expandingFreeTime L t) n) * f n := by field_simp + _ = _ := by rw [hphase, one_mul] + +theorem expandingFreeInverse_right (a b k L t : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (ht : 0 ≤ t) (f : FourierL2) : + expandingFreeStep a b k L t ha hk hL ht + (expandingFreeInverse a b k L t ha hk hL ht f) = f := by + have hleft : Function.LeftInverse + (expandingFreeInverse a b k L t ha hk hL ht) + (expandingFreeStep a b k L t ha hk hL ht) := + expandingFreeInverse_left a b k L t ha hk hL ht + have hinj : Function.Injective (expandingFreeInverse a b k L t ha hk hL ht) := by + intro u v huv + ext n + have hn := congrArg (fun g : FourierL2 => g n) huv + rw [expandingFreeInverse_coefficient, expandingFreeInverse_coefficient] at hn + apply mul_left_cancel₀ _ hn + have hW := Complex.ofReal_ne_zero.mpr (expandingSobolevWeight_pos a k L hL n).ne' + have hV := Complex.ofReal_ne_zero.mpr (expandingSobolevWeight_pos a k _ + (hL.trans (expandingRadius_ge L t hL ht)) n).ne' + have hA : expandingFreeAmplitude a b t ≠ 0 := Complex.exp_ne_zero _ + have hP : schrodingerMultiplier (-expandingFreeTime L t) n ≠ 0 := Complex.exp_ne_zero _ + simpa only [Complex.ofReal_div] using + mul_ne_zero (mul_ne_zero (inv_ne_zero hA) hP) (div_ne_zero hW hV) + apply hinj + exact hleft _ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFreeStep.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFreeStep.lean new file mode 100644 index 0000000000000000000000000000000000000000..89ed44640179430feec541d406abb706b03ebd6a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFreeStep.lean @@ -0,0 +1,173 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingScaleTransfer + +namespace OAI + +/-! # The exact free step on expanding tori + +This is the normalized-coordinate form of manuscript (lin:free-flow), +including the amplitude and the change from `Y_L` to `Y_(L exp(s/2))`. +-/ + +namespace DefocusingNLS + +noncomputable def expandingRadius (L s : ℝ) : ℝ := L * Real.exp (s / 2) + +theorem expandingRadius_ge (L s : ℝ) (hL : 1 ≤ L) (hs : 0 ≤ s) : + L ≤ expandingRadius L s := by + have he : 1 ≤ Real.exp (s / 2) := Real.one_le_exp_iff.mpr (by linarith) + exact le_mul_of_one_le_right (by linarith) he + +noncomputable def expandingFreeTime (L s : ℝ) : ℝ := + L ^ (-2 : ℝ) * (1 - Real.exp (-s)) + +noncomputable def expandingFreeAmplitude (a b s : ℝ) : ℂ := + Complex.exp (((-a * s : ℝ) : ℂ) + Complex.I * ((b * s : ℝ) : ℂ)) + +@[simp] theorem expandingFreeAmplitude_norm (a b s : ℝ) : + ‖expandingFreeAmplitude a b s‖ = Real.exp (-a * s) := by + simp [expandingFreeAmplitude, Complex.norm_exp] + +theorem expandingRadius_add (L s t : ℝ) : + expandingRadius (expandingRadius L s) t = expandingRadius L (s + t) := by + unfold expandingRadius + rw [mul_assoc, ← Real.exp_add] + congr 2 + ring + +theorem expandingFreeAmplitude_add (a b s t : ℝ) : + expandingFreeAmplitude a b (s + t) = + expandingFreeAmplitude a b s * expandingFreeAmplitude a b t := by + unfold expandingFreeAmplitude + rw [← Complex.exp_add] + congr 1 + push_cast + ring + +theorem expandingFreeTime_add (L s t : ℝ) (hL : 1 ≤ L) : + expandingFreeTime L (s + t) = + expandingFreeTime L s + expandingFreeTime (expandingRadius L s) t := by + have hR : expandingRadius L s ^ (-2 : ℝ) = L ^ (-2 : ℝ) * Real.exp (-s) := by + unfold expandingRadius + rw [Real.mul_rpow (by linarith : 0 ≤ L) (Real.exp_pos _).le, ← Real.exp_mul] + congr 2 + ring + unfold expandingFreeTime + rw [hR, neg_add, Real.exp_add] + ring + +/-- The free moving-scale operator, including the scalar similarity factor. -/ +noncomputable def expandingFreeStep (a b k L s : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hs : 0 ≤ s) : + FourierL2 →L[ℂ] FourierL2 := + expandingFreeAmplitude a b s • + (expandingScaleTransfer a k L (expandingRadius L s) ha hk hL + (expandingRadius_ge L s hL hs)).comp + (schrodingerFlow (expandingFreeTime L s)).toContinuousLinearMap + +theorem expandingFreeStep_apply (a b k L s : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hs : 0 ≤ s) (f : FourierL2) : + expandingFreeStep a b k L s ha hk hL hs f = + expandingFreeAmplitude a b s • + expandingScaleTransfer a k L (expandingRadius L s) ha hk hL + (expandingRadius_ge L s hL hs) (schrodingerFlow (expandingFreeTime L s) f) := rfl + +/-- The exact cancellation of the amplitude against the changing Sobolev weight. -/ +theorem expandingFreeStep_factor (a L s : ℝ) (hL : 1 ≤ L) : + Real.exp (-a * s) * (expandingRadius L s / L) ^ a = Real.exp (-a * s / 2) := by + have hLn : L ≠ 0 := by linarith + have hR : expandingRadius L s / L = Real.exp (s / 2) := by + unfold expandingRadius + field_simp + rw [hR, ← Real.exp_mul, ← Real.exp_add] + congr 1 + ring + +/-- The free step decays in the exact `Y_L` norms, uniformly in the starting scale. -/ +theorem expandingFreeStep_norm_bound (a b k L s : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hs : 0 ≤ s) (f : FourierL2) : + ‖expandingFreeStep a b k L s ha hk hL hs f‖ ≤ Real.exp (-a * s / 2) * ‖f‖ := by + rw [expandingFreeStep_apply, norm_smul, expandingFreeAmplitude_norm] + calc + _ ≤ Real.exp (-a * s) * + ((expandingRadius L s / L) ^ a * ‖schrodingerFlow (expandingFreeTime L s) f‖) := + mul_le_mul_of_nonneg_left + (expandingTransferVector_norm_le a k L (expandingRadius L s) ha hk hL + (expandingRadius_ge L s hL hs) _) (Real.exp_pos _).le + _ = _ := by rw [(schrodingerFlow (expandingFreeTime L s)).norm_map, + ← mul_assoc, expandingFreeStep_factor a L s hL] + +theorem expandingFreeStep_opNorm_le (a b k L s : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hs : 0 ≤ s) : + ‖expandingFreeStep a b k L s ha hk hL hs‖ ≤ Real.exp (-a * s / 2) := + ContinuousLinearMap.opNorm_le_bound _ (Real.exp_pos _).le + (expandingFreeStep_norm_bound a b k L s ha hk hL hs) + +theorem expandingFourierCoefficient_schrodingerFlow (a k L t : ℝ) + (f : FourierL2) (n : frequencyLattice) : + expandingFourierCoefficient a k L (schrodingerFlow t f) n = + schrodingerMultiplier t n * expandingFourierCoefficient a k L f n := by + simp only [expandingFourierCoefficient, schrodingerFlow_apply] + ring + +/-- The physical coefficients have exactly the phase in the manuscript's free formula. -/ +theorem expandingFreeStep_coefficient (a b k L s : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hs : 0 ≤ s) + (f : FourierL2) (n : frequencyLattice) : + expandingFourierCoefficient a k (expandingRadius L s) + (expandingFreeStep a b k L s ha hk hL hs f) n = + expandingFreeAmplitude a b s * schrodingerMultiplier (expandingFreeTime L s) n * + expandingFourierCoefficient a k L f n := by + rw [expandingFreeStep_apply, expandingFourierCoefficient_smul, + expandingScaleTransfer_coefficient, expandingFourierCoefficient_schrodingerFlow, mul_assoc] + +@[simp] theorem expandingFreeStep_zero (a b k L : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) : + expandingFreeStep a b k L 0 ha hk hL le_rfl = ContinuousLinearMap.id ℂ FourierL2 := by + ext f n + simp [expandingFreeStep, expandingFreeAmplitude, expandingFreeTime, expandingRadius] + +private theorem freeStep_coefficients_injective (a k L : ℝ) (hL : 1 ≤ L) : + Function.Injective (expandingFourierCoefficient a k L) := by + intro f g h + ext n + have hn := congrArg (fun z : ℂ => (expandingSobolevWeight a k L n : ℂ) * z) + (congrFun h n) + simpa only [weight_mul_expandingFourierCoefficient a k L hL] using hn + +/-- The free steps form the forward propagator on the moving family of tori. -/ +theorem expandingFreeStep_add (a b k L s t : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hs : 0 ≤ s) (ht : 0 ≤ t) : + (expandingFreeStep a b k (expandingRadius L s) t ha hk + (hL.trans (expandingRadius_ge L s hL hs)) ht).comp + (expandingFreeStep a b k L s ha hk hL hs) = + expandingFreeStep a b k L (s + t) ha hk hL (add_nonneg hs ht) := by + apply ContinuousLinearMap.ext + intro f + apply freeStep_coefficients_injective a k (expandingRadius L (s + t)) + (hL.trans (expandingRadius_ge L (s + t) hL (add_nonneg hs ht))) + funext n + change expandingFourierCoefficient a k (expandingRadius L (s + t)) + (expandingFreeStep a b k (expandingRadius L s) t ha hk + (hL.trans (expandingRadius_ge L s hL hs)) ht + (expandingFreeStep a b k L s ha hk hL hs f)) n = _ + calc + _ = expandingFreeAmplitude a b t * + schrodingerMultiplier (expandingFreeTime (expandingRadius L s) t) n * + expandingFourierCoefficient a k (expandingRadius L s) + (expandingFreeStep a b k L s ha hk hL hs f) n := by + simpa only [expandingRadius_add] using + expandingFreeStep_coefficient a b k (expandingRadius L s) t ha hk + (hL.trans (expandingRadius_ge L s hL hs)) ht + (expandingFreeStep a b k L s ha hk hL hs f) n + _ = expandingFreeAmplitude a b (s + t) * + schrodingerMultiplier (expandingFreeTime L (s + t)) n * + expandingFourierCoefficient a k L f n := by + rw [expandingFreeStep_coefficient, expandingFreeAmplitude_add, + expandingFreeTime_add L s t hL, schrodingerMultiplier_add] + ring + _ = _ := (expandingFreeStep_coefficient a b k L (s + t) ha hk hL + (add_nonneg hs ht) f n).symm + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFrequencyCutoff.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFrequencyCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..bb233181c6a729f03685cd6ebc1df675af35aa70 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingFrequencyCutoff.lean @@ -0,0 +1,90 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.TorusOddCommutator + +namespace OAI + +/-! # Small high-frequency tails for the actual physical commutator -/ + +open scoped ENNReal + +namespace DefocusingNLS + +noncomputable def expandingFrequencyLow (L R : ℝ) : FourierL2 →L[ℂ] FourierL2 := + let F : FourierL2 → FourierL2 := fun f => + ⟨fun n => if ‖n‖ < R * L then f n else 0, by + apply (lp.memℓp f).mono' + intro n + split_ifs <;> simp⟩ + LinearMap.mkContinuous + { toFun := F + map_add' := by + intro f g + ext n + change (if ‖n‖ < R * L then f n + g n else 0) = + (if ‖n‖ < R * L then f n else 0) + (if ‖n‖ < R * L then g n else 0) + split_ifs <;> simp + map_smul' := by + intro c f + ext n + change (if ‖n‖ < R * L then c * f n else 0) = c * (if ‖n‖ < R * L then f n else 0) + split_ifs <;> simp } + 1 (by + intro f + rw [one_mul] + apply lp.norm_mono (by norm_num : (2 : ℝ≥0∞) ≠ 0) + intro n + change ‖if ‖n‖ < R * L then f n else 0‖ ≤ ‖f n‖ + split_ifs <;> simp) + +@[simp] theorem expandingFrequencyLow_apply (L R : ℝ) (f : FourierL2) (n : frequencyLattice) : + expandingFrequencyLow L R f n = if ‖n‖ < R * L then f n else 0 := rfl + +noncomputable def expandingFrequencyHigh (L R : ℝ) : FourierL2 →L[ℂ] FourierL2 := + ContinuousLinearMap.id ℂ FourierL2 - expandingFrequencyLow L R + +@[simp] theorem expandingFrequencyHigh_apply (L R : ℝ) (f : FourierL2) (n : frequencyLattice) : + expandingFrequencyHigh L R f n = if ‖n‖ < R * L then 0 else f n := by + change f n - (if ‖n‖ < R * L then f n else 0) = _ + split_ifs <;> simp + +theorem expandingFrequencyHigh_norm_le (L R : ℝ) (f : FourierL2) : + ‖expandingFrequencyHigh L R f‖ ≤ ‖f‖ := by + apply lp.norm_mono (by norm_num : (2 : ℝ≥0∞) ≠ 0) + intro n + rw [expandingFrequencyHigh_apply] + split_ifs <;> simp + +theorem expandingFrequency_split (L R : ℝ) (f : FourierL2) : + f = expandingFrequencyLow L R f + expandingFrequencyHigh L R f := by + ext n + simp only [lp.coeFn_add, Pi.add_apply, expandingFrequencyLow_apply, expandingFrequencyHigh_apply] + split_ifs <;> simp + +theorem exists_torusOddCommutator_frequency_remainder (a : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < ((N + 1 : ℕ) : ℝ)) + (m : ℕ) (K : SchwartzMap (EuclideanSpace ℝ (Fin 12)) ℂ) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ (L R : ℝ) (hL : 1 ≤ L), 1 ≤ R → + let q := schwartzTorusSample a (N + 1 : ℕ) L ha1 hN hL K + ∀ (M : ℝ) (hM : 0 ≤ M) + (hQB : ∀ x : UnitAddTorus (Fin 12), ‖expandingUnitTorusFunction a (N + 1 : ℕ) L q x‖ ^ (2 * m) ≤ M) + (f : FourierL2) (j : Fin (N + 1) → Fin 12), + ‖expandingOrderedCommutator a L (N + 1) ha ha1 hN hL m q M hM hQB j f - + expandingOrderedCommutator a L (N + 1) ha ha1 hN hL m q M hM hQB j + (expandingFrequencyLow L R f)‖ ≤ (C / R) * ‖f‖ := by + obtain ⟨C, hC, hc⟩ := exists_torusOddCommutator_high_bound a N ha ha1 hN m K + refine ⟨C, hC, ?_⟩ + intro L R hL hR q M hM hQB f j + have hh := hc L R hL hR M hM hQB (expandingFrequencyHigh L R f) j (by + intro n hn + rw [expandingFrequencyHigh_apply] + split_ifs + rfl) + have he := congrArg (expandingOrderedCommutator a L (N + 1) ha ha1 hN hL m q M hM hQB j) + (expandingFrequency_split L R f) + rw [map_add] at he + rw [he, add_sub_cancel_left] + exact hh.trans (mul_le_mul_of_nonneg_left (expandingFrequencyHigh_norm_le L R f) + (div_nonneg hC (by linarith))) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingGeneralFilterLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingGeneralFilterLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..3cfca9122672a353223c070210ce1c502ff771b6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingGeneralFilterLimit.lean @@ -0,0 +1,77 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingCompactPhysicalLimit + +namespace OAI + +/-! # Weighted compactness for an arbitrary fixed Schwartz Fourier filter -/ + +open Filter Topology MeasureTheory +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) +local notation "T" => UnitAddTorus (Fin 12) +noncomputable local instance expandingGeneralFilterMeasure : MeasureSpace UnitAddCircle := ⟨AddCircle.haarAddCircle⟩ +local instance expandingGeneralFilterProbability : IsProbabilityMeasure (volume : Measure UnitAddCircle) := + inferInstanceAs (IsProbabilityMeasure AddCircle.haarAddCircle) + +variable (a k M : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) + (hlocal : ∀ R ε : ℝ, 0 < ε → ∀ᶠ n in atTop, ∀ y : E, ‖y‖ ≤ R → + ‖expandingTorusFunction a k (L n) (f n) (euclideanToTorus ((L n)⁻¹ • y))‖ < ε) + +include hf hlocal + +theorem tendsto_expandingSchwartzFilter_pointwise_zero (J : 𝓢(E, ℂ)) (y : E) : + Tendsto (fun n => expandingPhysicalContinuous a k (L n) ha ha1 hk (hL n) + (expandingSchwartzFilter (L n) J (f n)) y) atTop (𝓝 0) := by + have hM : 0 ≤ M := (norm_nonneg (f 0)).trans (hf 0) + let C := expandingEmbeddingBound a k * M + have hC : 0 ≤ C := mul_nonneg (by unfold expandingEmbeddingBound; positivity) hM + let u := fun n => expandingPhysicalContinuous a k (L n) ha ha1 hk (hL n) (f n) + have hb (n : ℕ) (x : E) : ‖u n x‖ ≤ C := + (expandingPhysicalContinuous_norm_le a k (L n) ha ha1 hk (hL n) (f n) x).trans + (mul_le_mul_of_nonneg_left (hf n) (by unfold expandingEmbeddingBound; positivity)) + have hc := tendsto_schwartzBallConvolution_zero ‖y‖ C hC J u hb + (by simpa only [u, expandingPhysicalContinuous_apply] using hlocal) + have hy : y ∈ Metric.closedBall (0 : E) ‖y‖ := by simp + have he := (ContinuousMap.evalCLM (R := ℂ) + (⟨y, hy⟩ : Metric.closedBall (0 : E) ‖y‖)).continuous.tendsto + (0 : C(Metric.closedBall (0 : E) ‖y‖, ℂ)) + have hh := he.comp hc + change Tendsto (fun n => schwartzBallConvolution ‖y‖ J (u n) ⟨y, hy⟩) atTop _ at hh + have heq (n : ℕ) : schwartzBallConvolution ‖y‖ J (u n) ⟨y, hy⟩ = + expandingPhysicalContinuous a k (L n) ha ha1 hk (hL n) + (expandingSchwartzFilter (L n) J (f n)) y := + (expandingSchwartzFilter_ball a k (L n) ‖y‖ ha ha1 hk (hL n) J (f n) ⟨y, hy⟩).symm + simpa only [heq, map_zero] using hh + +theorem tendsto_expandingSchwartzFilter_weightedL2 (J : 𝓢(E, ℂ)) + (V : E → ℂ) (hV : MemLp V 2 volume) : + Tendsto (fun n => ∫ y : E, ‖V y * + expandingPhysicalContinuous a k (L n) ha ha1 hk (hL n) + (expandingSchwartzFilter (L n) J (f n)) y‖ ^ 2) atTop (𝓝 0) := by + let C := expandingEmbeddingBound a k * (∫ z : E, ‖J z‖) + have hC : 0 ≤ C := mul_nonneg (by unfold expandingEmbeddingBound; positivity) + (integral_nonneg (fun _ => norm_nonneg _)) + apply tendsto_weightedL2_of_pointwise_zero (C * M) V hV + (fun n => expandingPhysicalContinuous a k (L n) ha ha1 hk (hL n) + (expandingSchwartzFilter (L n) J (f n))) ?_ + (tendsto_expandingSchwartzFilter_pointwise_zero a k M ha ha1 hk L hL f hf hlocal J) + intro n y + have hb := fourierBoundedMultiplier_norm_le (∫ z : E, ‖J z‖) + (integral_nonneg (fun _ => norm_nonneg _)) + (fun m : frequencyLattice => radianFourierKernel J ((L n)⁻¹ • (m : E))) + (fun _ => radianFourierKernel_norm_le_integral J _) (f n) + calc + _ ≤ expandingEmbeddingBound a k * ‖expandingSchwartzFilter (L n) J (f n)‖ := + expandingPhysicalContinuous_norm_le a k (L n) ha ha1 hk (hL n) _ y + _ ≤ expandingEmbeddingBound a k * ((∫ z : E, ‖J z‖) * ‖f n‖) := + mul_le_mul_of_nonneg_left hb (by unfold expandingEmbeddingBound; positivity) + _ = C * ‖f n‖ := (mul_assoc _ _ _).symm + _ ≤ C * M := mul_le_mul_of_nonneg_left (hf n) hC + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingGlobalTrajectory.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingGlobalTrajectory.lean new file mode 100644 index 0000000000000000000000000000000000000000..72fca7d06b9027a159fdc8fb241904ecf71412df --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingGlobalTrajectory.lean @@ -0,0 +1,113 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingBlowupTransfer +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingInitialData + +namespace OAI + +/-! # A global similarity solution identifies the actual maximal physical flow + +A path satisfying the nonlinear mild equation on every finite similarity +slab determines the maximal Sobolev flow, including its point observation +and endpoint. +-/ + +open Set Filter Topology + +namespace DefocusingNLS + +noncomputable def expandingSlabRestriction (u : ℝ → FourierL2) + (hu : ContinuousOn u (Ici 0)) (S : ℝ) : C(Icc (0 : ℝ) S, FourierL2) := + ⟨fun s => u s, (hu.mono (fun _ hs => hs.1)).domRestrict⟩ + +theorem exists_expanding_physical_slab (L t : ℝ) (hL : 0 < L) + (ht : t ∈ Ico 0 (L ^ (-2 : ℝ))) : + ∃ S : ℝ, 0 < S ∧ t ∈ Ico 0 (expandingFreeTime L S) := by + let s := expandingInverseClock L t + have hs : 0 ≤ s := expandingInverseClock_nonneg L t hL ht + refine ⟨s + 1, by linarith, ht.1, ?_⟩ + have he : expandingFreeTime L s = t := + expandingFreeTime_inverseClock L t hL + (expanding_clock_denominator_pos_of_lt L t hL ht.2) + rw [← he] + exact strictMono_expandingFreeTime L hL (by linarith) + +section Global + +variable (a b k L : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (m : ℕ) (ham : 2 * a * m = 1) + (u : ℝ → FourierL2) (hu : ContinuousOn u (Ici 0)) + (hsol : ∀ (S : ℝ) (hS : 0 < S), + expandingSlabRestriction u hu S = + expandingPicard a b k L S ha hk hL hS.le + (expandingNonlinearReaction a k L S ha ha1 hk hL m) (u 0) + (expandingSlabRestriction u hu S)) + +local notation "f₀" => expandingPhysicalInitialEquiv a k L ha ha1 hk hL (u 0) + +include b ham hu hsol + +theorem expandingGlobal_mem_maximal (t : ℝ) (ht : t ∈ Ico 0 (L ^ (-2 : ℝ))) : + t ∈ maximalSobolevInteractionDomain k (by linarith) m f₀ := by + obtain ⟨S, hS, htS⟩ := exists_expanding_physical_slab L t (by linarith) ht + let v := expandingSlabRestriction u hu S + have h := expandingSchrodingerTrajectory_eq_maximal a b k L S ha ha1 hk hL hS + m ham v (u 0) (hsol S hS) + dsimp only at h + have hinit : expandingSchrodingerTrajectory a b k L S ha ha1 hk hL hS.le v 0 = f₀ := by + rw [expandingSchrodingerTrajectory_initial_equiv] + rfl + rw [hinit] at h + exact h.1 htS + +theorem expandingGlobal_maximal_observation (t : ℝ) + (ht : t ∈ Ico 0 (L ^ (-2 : ℝ))) (x : SchrodingerTorus) : + sobolevTorusFunction k (maximalSobolevSchrodingerFlow k (by linarith) m f₀ t) x = + expandingPhysicalAmplitude a b L (expandingInverseClock L t) * + expandingTorusFunction a k (expandingRadius L (expandingInverseClock L t)) + (u (expandingInverseClock L t)) x := by + obtain ⟨S, hS, htS⟩ := exists_expanding_physical_slab L t (by linarith) ht + let v := expandingSlabRestriction u hu S + have h := expandingSchrodingerTrajectory_eq_maximal a b k L S ha ha1 hk hL hS + m ham v (u 0) (hsol S hS) + dsimp only at h + have hinit : expandingSchrodingerTrajectory a b k L S ha ha1 hk hL hS.le v 0 = f₀ := by + rw [expandingSchrodingerTrajectory_initial_equiv] + rfl + rw [hinit] at h + rw [← h.2 htS] + exact expandingSchrodingerTrajectory_observation a b k L S ha ha1 hk hL hS.le v t + ⟨htS.1, htS.2.le⟩ x + +/-- A stable similarity orbit transfers to a physical solution with finite-time +blowup and its prescribed limiting point observation. -/ +theorem expandingGlobal_rescaled_limit + (q : ℝ → FourierL2) (x : SchrodingerTorus) (c : ℂ) + (hq : ∀ s, 0 ≤ s → expandingTorusFunction a k (expandingRadius L s) (q s) x = c) + (hdecay : Tendsto (fun s => ‖u s - q s‖) atTop (𝓝 0)) : + Tendsto (fun t => (L ^ (-2 : ℝ) - t) ^ a * + ‖sobolevTorusFunction k (maximalSobolevSchrodingerFlow k (by linarith) m f₀ t) x‖) + (𝓝[<] (L ^ (-2 : ℝ))) (𝓝 ‖c‖) := by + have h := expanding_profile_rescaled_limit a b k L ha ha1 hk hL u q x c hq hdecay + apply h.congr' + filter_upwards [Ioo_mem_nhdsLT (Real.rpow_pos_of_pos (by linarith : 0 < L) + (-2 : ℝ))] with t ht + rw [expandingGlobal_maximal_observation a b k L ha ha1 hk hL m ham u hu hsol t + ⟨ht.1.le, ht.2⟩ x] + +theorem expandingGlobal_lifespan + (q : ℝ → FourierL2) (x : SchrodingerTorus) (c : ℂ) (hc : c ≠ 0) + (hq : ∀ s, 0 ≤ s → expandingTorusFunction a k (expandingRadius L s) (q s) x = c) + (hdecay : Tendsto (fun s => ‖u s - q s‖) atTop (𝓝 0)) : + BddAbove (maximalSobolevInteractionDomain k (by linarith) m f₀) ∧ + sSup (maximalSobolevInteractionDomain k (by linarith) m f₀) = L ^ (-2 : ℝ) := by + apply maximalSobolev_lifespan_of_forward_rescaled_observation k (by linarith) m f₀ + (L ^ (-2 : ℝ)) a ‖c‖ (Real.rpow_pos_of_pos (by linarith) _) ha (norm_pos_iff.mpr hc) + (fun t ht => expandingGlobal_mem_maximal a b k L ha ha1 hk hL m ham u hu hsol t ht) + (sobolevPointEvaluation k (by linarith) x) (sobolevPointEvaluation k (by linarith) x).continuous + simpa only [sobolevTorusFunction_apply k (by linarith)] using + expandingGlobal_rescaled_limit a b k L ha ha1 hk hL m ham u hu hsol q x c hq hdecay + +end Global + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingIdentifiedCompactness.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingIdentifiedCompactness.lean new file mode 100644 index 0000000000000000000000000000000000000000..53aa2b3dd9160626452fc341825c36bb21b1bdf9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingIdentifiedCompactness.lean @@ -0,0 +1,94 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfileCompactness +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingWeakLimitPath +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingWeakInitialBound +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfileLimitEquation + +namespace OAI + +/-! # Every bounded sequence of actual trajectories has an identified local limit -/ + +open Set Filter Topology +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +attribute [local irreducible] expandingProfileTrajectory expandingSpacetimePath + +theorem expandingProfile_exists_identified_limit (a b k T Q M C₀ : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 10 < k) (hT : 0 ≤ T) + (hQ : 0 ≤ Q) (hM : 0 ≤ M) (hC₀ : 0 ≤ C₀) (m : ℕ) + (χ : 𝓢(E, ℂ)) (ρ : ℝ) (hρ : 0 < ρ) (hχ : ∀ y : E, ‖y‖ ≤ ρ → χ y = 1) + (hCb : ∀ (L : ℝ) (hL : 1 ≤ L) (f : FourierL2), + ‖homogeneousLocalizationCLM a k L ha ha1 (by linarith) hL χ f‖ ≤ C₀ * ‖f‖) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (hLinf : Tendsto L atTop atTop) + (q : ℕ → C(Icc (0 : ℝ) T, FourierL2)) (hq : ∀ n t, ‖q n t‖ ≤ Q) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) (Q₀ : HomogeneousY a k) + (hqp : ∀ (s : Icc (0 : ℝ) T) (y : E), + Tendsto (fun n => expandingPhysicalContinuous a k (expandingRadius (L n) s) + ha ha1 (by linarith) ((hL n).trans (expandingRadius_ge (L n) s (hL n) s.2.1)) (q n s) y) + atTop (𝓝 (homogeneousPhysicalCLM a k ha ha1 (by linarith) Q₀ y))) : + ∃ φ : ℕ → ℕ, StrictMono φ ∧ ∃ v : C(Icc (0 : ℝ) T × E, ℂ), + ∃ u₀ : HomogeneousY a k, ‖u₀‖ ≤ C₀ * M ∧ + Tendsto (fun n => expandingProfilePhysicalPath a b k (L (φ n)) T + ha ha1 (by linarith) (hL (φ n)) hT m Q hQ (q (φ n)) (hq (φ n)) (f (φ n))) + atTop (𝓝 v) ∧ + (∀ t y, v (t, y) = homogeneousPhysicalCLM a k ha ha1 (by linarith) + (homogeneousLinearizedTrajectory a b k T ha ha1 (by linarith) hT m Q₀ u₀ t) y) ∧ + (∀ (t : Icc (0 : ℝ) T) (ℓ : HomogeneousY a k →L[ℝ] ℂ), + Tendsto (fun n => ℓ (homogeneousLocalizationCLM a k (expandingRadius (L (φ n)) t) + ha ha1 (by linarith) ((hL (φ n)).trans (expandingRadius_ge (L (φ n)) t (hL (φ n)) t.2.1)) χ + (expandingProfileTrajectory a b k (L (φ n)) T ha ha1 (by linarith) (hL (φ n)) hT + m Q hQ (q (φ n)) (hq (φ n)) (f (φ n)) t))) atTop + (𝓝 (ℓ (homogeneousLinearizedTrajectory a b k T ha ha1 (by linarith) hT m Q₀ u₀ t)))) := by + have hk8 : 8 < k := by linarith + have hc := exists_expandingProfile_localUniform_limit a b (k - 2) Q M T ha ha1 + (by linarith) hQ hM hT m L hL q hq f hf + simp only [sub_add_cancel] at hc + obtain ⟨v, φ, hφ, hv⟩ := hc + let S := fun n => expandingProfileTrajectory a b k (L (φ n)) T ha ha1 hk8 (hL (φ n)) hT + m Q hQ (q (φ n)) (hq (φ n)) (f (φ n)) + obtain ⟨K, hK, hKb⟩ := exists_expandingProfileTrajectory_bound a b k ha ha1 hk8 m Q hQ + let A := (K + 1) * Real.exp ((K + 1) * T) * M + have hSb (n : ℕ) (t : Icc (0 : ℝ) T) : ‖S n t‖ ≤ A := + ((ContinuousMap.norm_coe_le_norm (S n) t).trans + (hKb (L (φ n)) T (hL (φ n)) hT (q (φ n)) (hq (φ n)) (f (φ n)))).trans + (mul_le_mul_of_nonneg_left (hf (φ n)) (by positivity)) + obtain ⟨C, _hC, w, hw, hphysical, _hweakcont, _hsm, hweak⟩ := + expandingLimit_exists_weaklyContinuous_path a k A T ha ha1 hk8 hT + (fun n => L (φ n)) (fun n => hL (φ n)) (hLinf.comp hφ.tendsto_atTop) + χ ρ hρ hχ S hSb v hv + have hvc (y : E) : Continuous (fun t => homogeneousPhysicalCLM a k ha ha1 hk8 (w t) y) := + (v.continuous.comp (continuous_id.prodMk continuous_const)).congr (fun t => (hphysical t y).symm) + have hvp (t : Icc (0 : ℝ) T) (y : E) : + Tendsto (fun n => expandingPhysicalContinuous a k (expandingRadius (L (φ n)) t) + ha ha1 hk8 ((hL (φ n)).trans (expandingRadius_ge (L (φ n)) t (hL (φ n)) t.2.1)) + (S n t) y) atTop (𝓝 (homogeneousPhysicalCLM a k ha ha1 hk8 (w t) y)) := by + have h := ((continuous_eval_const (t, y)).tendsto v).comp hv + change Tendsto (fun n => expandingProfilePhysicalPath a b k (L (φ n)) T + ha ha1 hk8 (hL (φ n)) hT m Q hQ (q (φ n)) (hq (φ n)) (f (φ n)) (t, y)) + atTop (𝓝 (v (t, y))) at h + simp only [expandingPhysicalContinuous_apply, S] + simpa only [Function.comp_apply, expandingProfilePhysicalPath, expandingSpacetimePath_apply, + ← hphysical t y] using h + have hid := expandingProfile_limit_identification a b k T Q M (C * A) ha ha1 hk8 hT m hQ + (fun n => L (φ n)) (fun n => hL (φ n)) (fun n => q (φ n)) (fun n => hq (φ n)) + (fun n => f (φ n)) (fun n => hf (φ n)) Q₀ w hw hvc + (fun t y => (hqp t y).comp hφ.tendsto_atTop) hvp + have hinit : ‖w ⟨0, le_rfl, hT⟩‖ ≤ C₀ * M := by + apply expandingProfile_weak_initial_norm a b k T Q M C₀ ha ha1 hk8 hT m hQ hC₀ χ hCb + (fun n => L (φ n)) (fun n => hL (φ n)) (fun n => q (φ n)) (fun n => hq (φ n)) + (fun n => f (φ n)) (fun n => hf (φ n)) + intro ℓ + simpa only [expandingRadius, zero_div, Real.exp_zero, mul_one] using hweak ⟨0, le_rfl, hT⟩ ℓ + refine ⟨φ, hφ, v, w ⟨0, le_rfl, hT⟩, hinit, hv, ?_, ?_⟩ + · intro t y + exact (hphysical t y).symm.trans (congrArg (fun z => homogeneousPhysicalCLM a k ha ha1 hk8 z y) + (congrFun hid t)) + · intro t ℓ + simpa only [congrFun hid t] using hweak t ℓ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingInitialData.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingInitialData.lean new file mode 100644 index 0000000000000000000000000000000000000000..287618a77cbc0083a9208022423b1abac1ed719a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingInitialData.lean @@ -0,0 +1,51 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPhysicalTrajectory + +namespace OAI + +/-! # Physical initial data as a continuous linear equivalence + +For a fixed starting scale this map restores the physical amplitude and +changes the exact expanding Fourier norm to the standard Sobolev norm. +-/ + +open Set + +namespace DefocusingNLS + +noncomputable def expandingPhysicalInitialEquiv (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) : + FourierL2 ≃L[ℂ] FourierL2 := + (Units.mk0 (((L ^ (2 * a) : ℝ) : ℂ)) + (Complex.ofReal_ne_zero.mpr (Real.rpow_pos_of_pos (by linarith : 0 < L) _).ne')) • + ((ContinuousLinearEquiv.ofUnit (expandingWeightUnit a k L ha hk hL)).symm.trans + (expandingSobolevEquiv a k ha ha1 hk)) + +theorem expandingPhysicalInitialEquiv_apply (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) : + expandingPhysicalInitialEquiv a k L ha ha1 hk hL f = + ((L ^ (2 * a) : ℝ) : ℂ) • + expandingToSobolev a k ha1 hk (expandingInverseTransfer a k L ha hk hL f) := rfl + +theorem expandingSchrodingerTrajectory_initial_equiv (a b k L S : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hS : 0 ≤ S) + (u : C(Icc (0 : ℝ) S, FourierL2)) : + expandingSchrodingerTrajectory a b k L S ha ha1 hk hL hS u 0 = + expandingPhysicalInitialEquiv a k L ha ha1 hk hL (u ⟨0, le_rfl, hS⟩) := by + rw [expandingSchrodingerTrajectory_zero, expandingPhysicalInitialEquiv_apply] + +/-- Open sets in the exact starting norm give open sets of physical `H^k` data. -/ +theorem expandingPhysicalInitialEquiv_isOpen_image (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (V : Set FourierL2) (hV : IsOpen V) : + IsOpen (expandingPhysicalInitialEquiv a k L ha ha1 hk hL '' V) := + (expandingPhysicalInitialEquiv a k L ha ha1 hk hL).toHomeomorph.isOpenMap V hV + +theorem expandingPhysicalInitialEquiv_nonempty_image (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (V : Set FourierL2) (hV : V.Nonempty) : + (expandingPhysicalInitialEquiv a k L ha ha1 hk hL '' V).Nonempty := + hV.image _ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingInteractionPicture.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingInteractionPicture.lean new file mode 100644 index 0000000000000000000000000000000000000000..a96ee68d2d9f63b6aab5a207b39cc1ced58b6fdc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingInteractionPicture.lean @@ -0,0 +1,89 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingInversePath +import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus + +namespace OAI + +/-! # The forced expanding-torus evolution in the interaction picture + +The exact free inverse turns a mild solution with continuous forcing into +an ordinary Banach-valued primitive, without any extra spatial derivatives. +-/ + +open Set Filter Topology MeasureTheory + +namespace DefocusingNLS + +attribute [local irreducible] expandingFreeInverse expandingInversePath expandingFreeStep + expandingDuhamel + +theorem expandingDuhamel_pullback (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (r : ℝ → FourierL2) (hr : Continuous r) (s : Icc (0 : ℝ) T) : + let rC : C(Icc (0 : ℝ) T, FourierL2) := ⟨fun t => r t, hr.comp continuous_subtype_val⟩ + let R := expandingInversePath a b k L T ha hk hL rC + expandingFreeInverse a b k L s ha hk hL s.2.1 + (expandingDuhamel a b k L ha hk hL s r) = + ∫ τ in (0 : ℝ)..(s : ℝ), R (projIcc 0 T hT τ) := by + intro rC R + rw [expandingDuhamel_eq_intervalIntegral a b k L s ha hk hL s.2.1 r, + ← (expandingFreeInverse a b k L s ha hk hL s.2.1).intervalIntegral_comp_comm + ((continuousOn_expandingDuhamelIntegrand a b k L ha hk hL s r hr.continuousOn).intervalIntegrable_of_Icc s.2.1)] + apply intervalIntegral.integral_congr + intro τ hτ + rw [uIcc_of_le s.2.1] at hτ + dsimp only + rw [expandingDuhamelIntegrand_of_mem a b k L ha hk hL s r τ hτ, + expandingFreeInverse_after_kernel a b k L s τ ha hk hL hτ] + have hτT : τ ∈ Icc (0 : ℝ) T := ⟨hτ.1, hτ.2.trans s.2.2⟩ + rw [projIcc_of_mem hT hτT] + simp only [R, expandingInversePath_apply] + rfl + +theorem expandingMild_pullback (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (u : C(Icc (0 : ℝ) T, FourierL2)) (r : ℝ → FourierL2) (hr : Continuous r) + (f : FourierL2) + (hu : ∀ s : Icc (0 : ℝ) T, u s = + expandingFreeStep a b k L s ha hk hL s.2.1 f + + expandingDuhamel a b k L ha hk hL s r) + (s : Icc (0 : ℝ) T) : + let rC : C(Icc (0 : ℝ) T, FourierL2) := ⟨fun t => r t, hr.comp continuous_subtype_val⟩ + let R := expandingInversePath a b k L T ha hk hL rC + expandingInversePath a b k L T ha hk hL u s = + f + ∫ τ in (0 : ℝ)..(s : ℝ), R (projIcc 0 T hT τ) := by + intro rC R + rw [expandingInversePath_apply] + rw [hu, map_add, expandingFreeInverse_left] + exact congrArg (f + ·) (expandingDuhamel_pullback a b k L T ha hk hL hT r hr s) + +theorem hasDerivAt_expandingMild_pullback (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (u : C(Icc (0 : ℝ) T, FourierL2)) (r : ℝ → FourierL2) (hr : Continuous r) + (f : FourierL2) + (hu : ∀ s : Icc (0 : ℝ) T, u s = + expandingFreeStep a b k L s ha hk hL s.2.1 f + + expandingDuhamel a b k L ha hk hL s r) + (t : ℝ) (ht : t ∈ Ioo 0 T) : + HasDerivAt (fun s => expandingInversePath a b k L T ha hk hL u (projIcc 0 T hT s)) + (expandingFreeInverse a b k L t ha hk hL ht.1.le (r t)) t := by + let rC : C(Icc (0 : ℝ) T, FourierL2) := ⟨fun t => r t, hr.comp continuous_subtype_val⟩ + let R := expandingInversePath a b k L T ha hk hL rC + let Rext := fun τ => R (projIcc 0 T hT τ) + have hR : Continuous Rext := R.continuous.comp continuous_projIcc + have hd := (intervalIntegral.integral_hasDerivAt_right (hR.intervalIntegrable 0 t) + hR.aestronglyMeasurable.stronglyMeasurableAtFilter (hR.continuousAt (x := t))).const_add f + have he : (fun s => f + ∫ τ in (0 : ℝ)..s, Rext τ) =ᶠ[𝓝 t] + (fun s => expandingInversePath a b k L T ha hk hL u (projIcc 0 T hT s)) := by + filter_upwards [Ioo_mem_nhds ht.1 ht.2] with s hs + have hsT : s ∈ Icc (0 : ℝ) T := ⟨hs.1.le, hs.2.le⟩ + rw [projIcc_of_mem hT hsT] + exact (expandingMild_pullback a b k L T ha hk hL hT u r hr f hu ⟨s, hsT⟩).symm + apply (hd.congr_of_eventuallyEq he.symm).congr_deriv + dsimp [Rext] + rw [projIcc_of_mem hT ⟨ht.1.le, ht.2.le⟩] + simp only [R, expandingInversePath_apply] + rfl + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingInversePath.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingInversePath.lean new file mode 100644 index 0000000000000000000000000000000000000000..5294bd85f63954b244f2f57f53dd5fc17eda4813 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingInversePath.lean @@ -0,0 +1,78 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFreeInverse +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingDuhamelFamily +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPhysicalPath + +namespace OAI + +/-! # Continuous free pullback on a finite expanding slab -/ + +open Set + +namespace DefocusingNLS + +attribute [local irreducible] expandingFreeInverse expandingInverseTransfer + expandingScaleTransfer + +private theorem continuous_schrodinger_apply : + Continuous (fun p : ℝ × FourierL2 => schrodingerFlow p.1 p.2) := by + apply continuous_operator_apply_of_uniform_bound + (fun t => (schrodingerFlow t).toContinuousLinearMap.restrictScalars ℝ) 1 + · intro t + apply ContinuousLinearMap.opNorm_le_bound _ zero_le_one + intro f + change ‖schrodingerFlow t f‖ ≤ 1 * ‖f‖ + simp only [(schrodingerFlow t).norm_map, one_mul, le_refl] + · exact continuous_schrodingerFlow + +noncomputable def expandingInversePath (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) + (u : C(Icc (0 : ℝ) T, FourierL2)) : C(Icc (0 : ℝ) T, FourierL2) where + toFun t := expandingFreeInverse a b k L t ha hk hL t.2.1 (u t) + continuous_toFun := by + simp_rw [expandingFreeInverse_apply] + have hr := (expandingPhysicalPath a k L T ha hk hL u).continuous + have hx : Continuous (fun t : Icc (0 : ℝ) T => + expandingScaleTransfer a k 1 L ha hk le_rfl hL + (expandingPhysicalPath a k L T ha hk hL u t)) := + (expandingScaleTransfer a k 1 L ha hk le_rfl hL).continuous.comp hr + have ht : Continuous (fun t : Icc (0 : ℝ) T => -expandingFreeTime L t) := by + unfold expandingFreeTime + fun_prop + have hA : Continuous (fun t : Icc (0 : ℝ) T => (expandingFreeAmplitude a b t)⁻¹) := by + apply Continuous.inv₀ + · unfold expandingFreeAmplitude + fun_prop + · intro t + exact Complex.exp_ne_zero _ + exact hA.smul (continuous_schrodinger_apply.comp (ht.prodMk hx)) + +@[simp] theorem expandingInversePath_apply (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) + (u : C(Icc (0 : ℝ) T, FourierL2)) (t : Icc (0 : ℝ) T) : + expandingInversePath a b k L T ha hk hL u t = + expandingFreeInverse a b k L t ha hk hL t.2.1 (u t) := rfl + +theorem expandingInversePath_return (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) + (u : C(Icc (0 : ℝ) T, FourierL2)) (t : Icc (0 : ℝ) T) : + expandingFreeStep a b k L t ha hk hL t.2.1 + (expandingInversePath a b k L T ha hk hL u t) = u t := by + rw [expandingInversePath_apply, expandingFreeInverse_right] + +theorem expandingFreeInverse_after_kernel (a b k L t τ : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hτ : τ ∈ Icc 0 t) (f : FourierL2) : + expandingFreeInverse a b k L t ha hk hL (hτ.1.trans hτ.2) + (expandingFreeStep a b k (expandingRadius L τ) (t - τ) ha hk + (hL.trans (expandingRadius_ge L τ hL hτ.1)) (sub_nonneg.mpr hτ.2) f) = + expandingFreeInverse a b k L τ ha hk hL hτ.1 f := by + let v := expandingFreeInverse a b k L τ ha hk hL hτ.1 f + have hv : expandingFreeStep a b k L τ ha hk hL hτ.1 v = f := + expandingFreeInverse_right a b k L τ ha hk hL hτ.1 f + have hadd := congrArg (fun A : FourierL2 →L[ℂ] FourierL2 => A v) + (expandingFreeStep_add a b k L τ (t - τ) ha hk hL hτ.1 (sub_nonneg.mpr hτ.2)) + simp only [ContinuousLinearMap.comp_apply, add_sub_cancel, hv] at hadd + rw [hadd, expandingFreeInverse_left] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLimitRealization.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLimitRealization.lean new file mode 100644 index 0000000000000000000000000000000000000000..23ee986b5117d06e0d371f6bab29adc40f546101 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLimitRealization.lean @@ -0,0 +1,57 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingSpacetimeObservation +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingLocalConvergence +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousPhysicalWeakLimit + +namespace OAI + +/-! # Every time slice of a local space-time limit is a bounded Y vector -/ + +open Set Filter Topology +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +attribute [local irreducible] expandingTorusFunction + +theorem expandingLimit_exists_homogeneous_slices (a k M T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (hLinf : Tendsto L atTop atTop) + (χ : 𝓢(E, ℂ)) (ρ : ℝ) (hρ : 0 < ρ) (hχ : ∀ y : E, ‖y‖ ≤ ρ → χ y = 1) + (u : ℕ → C(Icc (0 : ℝ) T, FourierL2)) (hu : ∀ n t, ‖u n t‖ ≤ M) + (v : C(Icc (0 : ℝ) T × E, ℂ)) + (hv : Tendsto (fun n => expandingSpacetimePath a k (L n) T ha ha1 hk (hL n) (u n)) + atTop (𝓝 v)) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ t : Icc (0 : ℝ) T, + ∃ w : HomogeneousY a k, ‖w‖ ≤ C * M ∧ + (∀ y, homogeneousPhysicalCLM a k ha ha1 hk w y = v (t, y)) ∧ + ∀ ℓ : HomogeneousY a k →L[ℝ] ℂ, + Tendsto (fun n => ℓ (homogeneousLocalizationCLM a k (expandingRadius (L n) t) + ha ha1 hk (hL n |>.trans (expandingRadius_ge (L n) t (hL n) t.2.1)) χ (u n t))) + atTop (𝓝 (ℓ w)) := by + obtain ⟨C, hC, hCb⟩ := exists_homogeneousLocalization_bound a k ha ha1 hk χ + refine ⟨C, hC, fun t => ?_⟩ + let R := fun n => expandingRadius (L n) t + have hR (n : ℕ) : 1 ≤ R n := (hL n).trans (expandingRadius_ge (L n) t (hL n) t.2.1) + have hRinf : Tendsto R atTop atTop := hLinf.atTop_mul_const (Real.exp_pos _) + apply homogeneousY_exists_of_physical_limit a k (C * M) ha ha1 hk + (fun n => homogeneousLocalizationCLM a k (R n) ha ha1 hk (hR n) χ (u n t)) + (fun y => v (t, y)) + · intro n + exact (hCb (R n) (hR n) (u n t)).trans (mul_le_mul_of_nonneg_left (hu n t) hC) + · intro y + have hp := ((continuous_eval_const (t, y)).tendsto v).comp hv + have he : (fun n => homogeneousPhysicalCLM a k ha ha1 hk + (homogeneousLocalizationCLM a k (R n) ha ha1 hk (hR n) χ (u n t)) y) =ᶠ[atTop] + (fun n => expandingSpacetimePath a k (L n) T ha ha1 hk (hL n) (u n) (t, y)) := by + filter_upwards [eventually_expandingCutoff_one R hR hRinf χ ρ ‖y‖ hρ hχ] with n hn + rw [homogeneousLocalization_physical] + change χ ((R n)⁻¹ • y) * _ = _ + rw [hn y le_rfl, one_mul] + rfl + exact hp.congr' he.symm + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLinearization.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLinearization.lean new file mode 100644 index 0000000000000000000000000000000000000000..26973c8bcb42ef3b9fbc9f57978312850da31081 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLinearization.lean @@ -0,0 +1,62 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingTaylorRemainder +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingEvaluation + +namespace OAI + +/-! # Pointwise meaning of the uniform expanding-torus linearization -/ + +namespace DefocusingNLS + +/-- At each torus point, the Sobolev derivative is the scalar real derivative. -/ +theorem expandingOddPower_fderiv_pointwise (a k L : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (m : ℕ) + (q v : FourierL2) (x : SchrodingerTorus) : + expandingTorusFunction a k L (fderiv ℝ (expandingOddPower a k L ha ha1 hk hL m) q v) x = + oddPowerDerivative m (expandingTorusFunction a k L q x) (expandingTorusFunction a k L v x) := by + let E := (expandingPointEvaluation a k L ha ha1 hk hL x).restrictScalars ℝ + have hE (f : FourierL2) : E f = expandingTorusFunction a k L f x := + (expandingTorusFunction_eq_evaluation a k L ha ha1 hk hL x f).symm + have hN := ((contDiff_expandingOddPower a k L ha ha1 hk hL m).differentiable (by simp) q).hasFDerivAt + have hleft := E.hasFDerivAt.comp q hN + have hright := (hasFDerivAt_oddPowerNonlinearity m (E q)).comp q E.hasFDerivAt + have heq : (fun f : FourierL2 => E (expandingOddPower a k L ha ha1 hk hL m f)) = + (fun f : FourierL2 => oddPowerNonlinearity m (E f)) := by + funext f + simpa only [hE] using expandingOddPower_apply a k L ha ha1 hk hL m f x + have hderiv : E.comp (fderiv ℝ (expandingOddPower a k L ha ha1 hk hL m) q) = + (oddPowerDerivative m (E q)).comp E := by + apply hleft.unique + simpa only [Function.comp_def, ← heq] using hright + have h := congrArg (fun L : FourierL2 →L[ℝ] ℂ => L v) hderiv + simpa only [ContinuousLinearMap.comp_apply, hE] using h + +/-- The two circular components of the exact linearized odd-power operator. -/ +theorem expandingOddPower_fderiv_pointwise_explicit (a k L : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (m : ℕ) + (q v : FourierL2) (x : SchrodingerTorus) : + expandingTorusFunction a k L (fderiv ℝ (expandingOddPower a k L ha ha1 hk hL m) q v) x = + ((m + 1 : ℕ) : ℂ) * (expandingTorusFunction a k L q x) ^ m * + star (expandingTorusFunction a k L q x) ^ m * expandingTorusFunction a k L v x + + (m : ℂ) * (expandingTorusFunction a k L q x) ^ (m + 1) * + star (expandingTorusFunction a k L q x) ^ (m - 1) * star (expandingTorusFunction a k L v x) := by + rw [expandingOddPower_fderiv_pointwise] + simp [oddPowerDerivative, smul_eq_mul] + +/-- The abstract remainder evaluates to the actual scalar nonlinear Taylor remainder. -/ +theorem expandingNonlinearRemainder_pointwise (a k L : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (m : ℕ) + (q v : FourierL2) (x : SchrodingerTorus) : + expandingTorusFunction a k L (expandingNonlinearRemainder a k L ha ha1 hk hL m q v) x = + oddPowerNonlinearity m (expandingTorusFunction a k L q x + expandingTorusFunction a k L v x) - + oddPowerNonlinearity m (expandingTorusFunction a k L q x) - + oddPowerDerivative m (expandingTorusFunction a k L q x) (expandingTorusFunction a k L v x) := by + rw [expandingTorusFunction_eq_evaluation a k L ha ha1 hk hL] + unfold expandingNonlinearRemainder + rw [map_sub, map_sub] + simp only [← expandingTorusFunction_eq_evaluation a k L ha ha1 hk hL, expandingOddPower_apply, + expandingOddPower_fderiv_pointwise] + have hadd : expandingTorusFunction a k L (q + v) x = + expandingTorusFunction a k L q x + expandingTorusFunction a k L v x := by + simp only [expandingTorusFunction_eq_evaluation a k L ha ha1 hk hL, map_add] + rw [hadd] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLinearizedPhysicalLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLinearizedPhysicalLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..18f9dcbaa61c812c3e70b2ae86a970e4e0005b38 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLinearizedPhysicalLimit.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingSmoothFilter +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingOrderedCommutator +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousLinearization + +namespace OAI + +/-! # The actual linearized reaction passes to the physical limit -/ + +open Filter Topology + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem expandingLinearizedPotential_physical (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (m : ℕ) (q v : FourierL2) (y : E) : + expandingPhysicalContinuous a k L ha ha1 hk hL + (expandingLinearizedPotential a k L ha ha1 hk hL m q v) y = + -Complex.I * oddPowerDerivative m + (expandingPhysicalContinuous a k L ha ha1 hk hL q y) + (expandingPhysicalContinuous a k L ha ha1 hk hL v y) := by + simp only [expandingPhysicalContinuous_apply, expandingLinearizedPotential, + smul_apply] + rw [expandingTorusFunction_eq_evaluation a k L ha ha1 hk hL, map_smul] + simp only [← expandingTorusFunction_eq_evaluation a k L ha ha1 hk hL, + smul_eq_mul, expandingOddPower_fderiv_pointwise] + +theorem tendsto_expandingLinearizedPotential_physical (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (q v : ℕ → FourierL2) + (Q V : HomogeneousY a k) (y : E) + (hq : Tendsto (fun n => expandingPhysicalContinuous a k (L n) ha ha1 hk (hL n) (q n) y) + atTop (𝓝 (homogeneousPhysicalCLM a k ha ha1 hk Q y))) + (hv : Tendsto (fun n => expandingPhysicalContinuous a k (L n) ha ha1 hk (hL n) (v n) y) + atTop (𝓝 (homogeneousPhysicalCLM a k ha ha1 hk V y))) : + Tendsto (fun n => expandingPhysicalContinuous a k (L n) ha ha1 hk (hL n) + (expandingLinearizedPotential a k (L n) ha ha1 hk (hL n) m (q n) (v n)) y) + atTop (𝓝 (homogeneousPhysicalCLM a k ha ha1 hk + (homogeneousLinearizedPotential a k ha ha1 hk m Q V) y)) := by + have hc : Continuous (fun p : ℂ × ℂ => -Complex.I * oddPowerDerivative m p.1 p.2) := by + simp only [oddPowerDerivative, add_apply, + smul_apply, ContinuousLinearMap.id_apply, + ContinuousLinearEquiv.coe_coe, starL'_apply, smul_eq_mul] + fun_prop + have h := hc.continuousAt.tendsto.comp (hq.prodMk_nhds hv) + simpa only [Function.comp_def, expandingLinearizedPotential_physical, + homogeneousLinearizedPotential_physical] using h + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLocalConvergence.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLocalConvergence.lean new file mode 100644 index 0000000000000000000000000000000000000000..572e70835a3bea41ac0816e6c1a46a47e3761d32 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLocalConvergence.lean @@ -0,0 +1,92 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingLocalizedWeakLimit + +namespace OAI + +/-! # Local uniform convergence of the actual expanding-torus functions + +Once the radii diverge, a cutoff that equals one near the origin disappears +from every fixed physical ball. The weak localization limit then gives +uniform convergence of the original torus functions on that ball. +-/ + +open Filter Topology Set +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem eventually_expandingCutoff_one (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) + (hLinf : Tendsto L atTop atTop) (χ : 𝓢(E, ℂ)) (ρ R : ℝ) (hρ : 0 < ρ) + (hχ : ∀ y : E, ‖y‖ ≤ ρ → χ y = 1) : + ∀ᶠ n in atTop, ∀ y : E, ‖y‖ ≤ R → χ ((L n)⁻¹ • y) = 1 := by + filter_upwards [hLinf.eventually (eventually_ge_atTop (R / ρ))] with n hn y hy + apply hχ + have hLp : 0 < L n := by linarith [hL n] + rw [norm_smul, Real.norm_eq_abs, abs_of_pos (inv_pos.mpr hLp)] + calc + (L n)⁻¹ * ‖y‖ ≤ (L n)⁻¹ * R := mul_le_mul_of_nonneg_left hy (inv_nonneg.mpr hLp.le) + _ = R / L n := by ring + _ ≤ ρ := (div_le_iff₀ hLp).mpr (by + have hb := (div_le_iff₀ hρ).mp hn + nlinarith) + +theorem expandingTorus_local_uniform_of_localized_weak (a k M : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (hLinf : Tendsto L atTop atTop) + (χ : 𝓢(E, ℂ)) (ρ : ℝ) (hρ : 0 < ρ) (hχ : ∀ y : E, ‖y‖ ≤ ρ → χ y = 1) + (f : ℕ → FourierL2) (v : HomogeneousY a k) + (hbound : ∀ n, ‖homogeneousLocalizationCLM a k (L n) ha ha1 hk (hL n) χ (f n)‖ ≤ M) + (hweak : ∀ ℓ : HomogeneousY a k →L[ℝ] ℂ, + Tendsto (fun n => ℓ (homogeneousLocalizationCLM a k (L n) ha ha1 hk (hL n) χ (f n))) + atTop (𝓝 (ℓ v))) : + ∀ R ε : ℝ, 0 < ε → ∀ᶠ n in atTop, ∀ y : E, ‖y‖ ≤ R → + ‖expandingTorusFunction a k (L n) (f n) (euclideanToTorus ((L n)⁻¹ • y)) - + homogeneousPhysicalCLM a k ha ha1 hk v y‖ < ε := by + intro R ε hε + let S := Metric.closedBall (0 : E) R + let u := fun n => homogeneousLocalizationCLM a k (L n) ha ha1 hk (hL n) χ (f n) + let J := homogeneousLocalObservation a k ha ha1 hk S + have hJ := homogeneousLocalObservation_of_weakLimit a k M ha ha1 hk S u v hbound hweak + have hnorm := tendsto_iff_norm_sub_tendsto_zero.mp hJ + have hsmall : ∀ᶠ n in atTop, ‖J (u n) - J v‖ < ε := + hnorm.eventually (eventually_lt_nhds hε) + filter_upwards [hsmall, eventually_expandingCutoff_one L hL hLinf χ ρ R hρ hχ] + with n hn hcut y hy + have hyS : y ∈ S := by simpa only [S, Metric.mem_closedBall, dist_zero_right] using hy + have hb := (J (u n) - J v).norm_coe_le_norm ⟨y, hyS⟩ + have hp : J (u n) ⟨y, hyS⟩ = + expandingTorusFunction a k (L n) (f n) (euclideanToTorus ((L n)⁻¹ • y)) := by + rw [homogeneousLocalObservation_apply, homogeneousLocalization_physical] + exact (congrArg (fun z : ℂ => z * + expandingTorusFunction a k (L n) (f n) (euclideanToTorus ((L n)⁻¹ • y))) (hcut y hy)).trans + (one_mul _) + change ‖J (u n) ⟨y, hyS⟩ - J v ⟨y, hyS⟩‖ ≤ ‖J (u n) - J v‖ at hb + rw [hp] at hb + exact hb.trans_lt hn + +theorem exists_expandingTorus_local_limit (a k M : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (hLinf : Tendsto L atTop atTop) + (χ : 𝓢(E, ℂ)) (ρ : ℝ) (hρ : 0 < ρ) (hχ : ∀ y : E, ‖y‖ ≤ ρ → χ y = 1) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) : + ∃ v : HomogeneousY a k, ∃ φ : ℕ → ℕ, StrictMono φ ∧ + (∀ ℓ : HomogeneousY a k →L[ℝ] ℂ, + Tendsto (fun n => ℓ (homogeneousLocalizationCLM a k (L (φ n)) + ha ha1 hk (hL (φ n)) χ (f (φ n)))) atTop (𝓝 (ℓ v))) ∧ + (∀ R ε : ℝ, 0 < ε → ∀ᶠ n in atTop, ∀ y : E, ‖y‖ ≤ R → + ‖expandingTorusFunction a k (L (φ n)) (f (φ n)) + (euclideanToTorus ((L (φ n))⁻¹ • y)) - + homogeneousPhysicalCLM a k ha ha1 hk v y‖ < ε) := by + obtain ⟨_, _, v, _, φ, hφ, hweak, _⟩ := + exists_expandingLocalized_weakLimit a k M ha ha1 hk L hL χ f hf + obtain ⟨C, hC, hb⟩ := exists_homogeneousLocalization_bound a k ha ha1 hk χ + refine ⟨v, φ, hφ, hweak, ?_⟩ + exact expandingTorus_local_uniform_of_localized_weak a k (C * M) ha ha1 hk + (L ∘ φ) (fun n => hL (φ n)) (hLinf.comp hφ.tendsto_atTop) χ ρ hρ hχ + (f ∘ φ) v (fun n => (hb _ (hL (φ n)) _).trans + (mul_le_mul_of_nonneg_left (hf (φ n)) hC)) hweak + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLocalDependence.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLocalDependence.lean new file mode 100644 index 0000000000000000000000000000000000000000..87486b73d61c96186d3efdc134370bf750534bf0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLocalDependence.lean @@ -0,0 +1,89 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingWeightedLocal + +namespace OAI + +/-! # Finite-step dependence using only the two actual trajectories + +The odd-power reaction need not be globally Lipschitz. A uniform bound on +its difference along the two solutions gives the required finite-step +Lipschitz estimate for their initial data. +-/ + +open Set + +namespace DefocusingNLS + +attribute [local irreducible] expandingFreeStep + +theorem expandingBieleckiPicard_initial_dist_le (a b k L T η : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) (hη : 0 ≤ η) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) (u₀ v₀ : FourierL2) + (z : C(Icc (0 : ℝ) T, FourierL2)) : + dist (expandingBieleckiPicard a b k L T η ha hk hL hT F u₀ z) + (expandingBieleckiPicard a b k L T η ha hk hL hT F v₀ z) ≤ dist u₀ v₀ := by + apply (ContinuousMap.dist_le dist_nonneg).2 + intro t + change dist (Real.exp (-η * t) • + (expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + _)) + (Real.exp (-η * t) • + (expandingFreeStep a b k L t ha hk hL t.2.1 v₀ + _)) ≤ _ + rw [dist_eq_norm, ← smul_sub, add_sub_add_right_eq_sub, ← map_sub, + norm_smul, Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)] + have hb := expandingFreeStep_norm_bound a b k L t ha hk hL t.2.1 (u₀ - v₀) + have hfree : Real.exp (-a * (t : ℝ) / 2) ≤ 1 := + Real.exp_le_one_iff.mpr (by nlinarith [t.2.1]) + have hweight : Real.exp (-η * (t : ℝ)) ≤ 1 := + Real.exp_le_one_iff.mpr (by nlinarith [t.2.1]) + rw [dist_eq_norm] + exact (mul_le_mul_of_nonneg_left (hb.trans + (mul_le_of_le_one_left (norm_nonneg _) hfree)) (Real.exp_pos _).le).trans + (mul_le_of_le_one_left (norm_nonneg _) hweight) + +theorem expandingMild_finiteSlab_local_data_bound (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) (u₀ v₀ : FourierL2) + (K : ℝ) (hK : 0 ≤ K) (u v : C(Icc (0 : ℝ) T, FourierL2)) + (hF : ∀ t, ‖F (t, u t) - F (t, v t)‖ ≤ K * ‖u t - v t‖) + (hu : u = expandingPicard a b k L T ha hk hL hT F u₀ u) + (hv : v = expandingPicard a b k L T ha hk hL hT F v₀ v) : + dist u v ≤ Real.exp ((K + 1) * T) * ((K + 1) * dist u₀ v₀) := by + let η := K + 1 + have hη : 0 < η := by dsimp [η]; linarith + let u' := expandingTimeWeight T (-η) u + let v' := expandingTimeWeight T (-η) v + let P := expandingBieleckiPicard a b k L T η ha hk hL hT F u₀ + let Q := expandingBieleckiPicard a b k L T η ha hk hL hT F v₀ + have huP : P u' = u' := by + apply expandingBielecki_isFixedPt a b k L T η ha hk hL hT F u₀ u + intro t + exact congrArg (fun w : C(Icc (0 : ℝ) T, FourierL2) => w t) hu + have hvQ : Q v' = v' := by + apply expandingBielecki_isFixedPt a b k L T η ha hk hL hT F v₀ v + intro t + exact congrArg (fun w : C(Icc (0 : ℝ) T, FourierL2) => w t) hv + have hp := expandingBieleckiPicard_pair_dist_le a b k L T η ha hk hL hT hη F u₀ K hK u' v' + (by simpa only [u', v', expandingTimeWeight_cancel] using hF) + have hq := expandingBieleckiPicard_initial_dist_le a b k L T η ha hk hL hT hη.le F u₀ v₀ v' + have hi : dist u' v' ≤ K / η * dist u' v' + dist u₀ v₀ := by + calc + dist u' v' = dist (P u') (Q v') := by rw [huP, hvQ] + _ ≤ dist (P u') (P v') + dist (P v') (Q v') := dist_triangle _ _ _ + _ ≤ _ := add_le_add hp hq + have hd : dist u' v' ≤ η * dist u₀ v₀ := by + have hm := mul_le_mul_of_nonneg_right hi hη.le + have he : (K / η * dist u' v' + dist u₀ v₀) * η = + K * dist u' v' + η * dist u₀ v₀ := by + calc + _ = (K / η * η) * dist u' v' + η * dist u₀ v₀ := by ring + _ = _ := by rw [div_mul_cancel₀ _ hη.ne'] + rw [he] at hm + dsimp [η] at hm ⊢ + nlinarith + have he := expandingTimeWeight_dist_le T η hη.le u' v' + have hout : dist u v ≤ Real.exp (η * T) * dist u' v' := by + simpa only [u', v', expandingTimeWeight_cancel] using he + exact hout.trans (mul_le_mul_of_nonneg_left hd (Real.exp_pos _).le) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLocalizationBound.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLocalizationBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..a70bfd402f219bb074045b4889143831b0f58150 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLocalizationBound.lean @@ -0,0 +1,125 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPhysicalLocalization +import OAI.MathematicalPhysics.DefocusingNLS.Linear.LocalizationFourierEnergy +import OAI.MathematicalPhysics.DefocusingNLS.Linear.LocalizationFatou + +namespace OAI + +/-! # Uniform localization on the actual expanding-torus space + +The finite-cutoff estimate passes to the continuous periodic Fourier series. +The coefficient normalization is exactly the Y_L normalization already used +for the expanding flow, and every constant is independent of L ≥ 1. +-/ + +open Filter MeasureTheory Topology +open scoped SchwartzMap ENNReal + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +private theorem exists_localizedFourierSeries_energy_bound (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (χ : 𝓢(E, ℂ)) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ (L : ℝ), 1 ≤ L → ∀ (v : frequencyLattice → ℂ), + Summable (fun n => ‖v n‖) → + Summable (fun n => expandingSobolevWeightSq a k L n * ‖v n‖ ^ 2) → + Integrable (fun ξ => ‖ξ‖ ^ (2 * (6 - a)) * + ‖radianFourierIntegral (localizedFourierSeries L χ v) ξ‖ ^ 2) ∧ + Integrable (fun ξ => ‖ξ‖ ^ (2 * k) * + ‖radianFourierIntegral (localizedFourierSeries L χ v) ξ‖ ^ 2) ∧ + homogeneousFourierEnergy (6 - a) (localizedFourierSeries L χ v) + + homogeneousFourierEnergy k (localizedFourierSeries L χ v) ≤ + C * ∑' n, expandingSobolevWeightSq a k L n * ‖v n‖ ^ 2 := by + obtain ⟨C, hC, hfinite⟩ := exists_localizedFourierPolynomial_energy_bound a k ha ha1 hk χ + refine ⟨2 * C, by positivity, ?_⟩ + intro L hL v hv hW + have hLp : 0 < L := by linarith + let B : ℝ := C * ∑' n, expandingSobolevWeightSq a k L n * ‖v n‖ ^ 2 + have hB : 0 ≤ B := mul_nonneg hC (tsum_nonneg (fun n => + mul_nonneg (expandingSobolevWeightSq_pos a k L hL n).le (sq_nonneg _))) + have hfiniteB (S : Finset frequencyLattice) : + homogeneousFourierEnergy (6 - a) (localizedFourierPolynomial L χ S v) + + homogeneousFourierEnergy k (localizedFourierPolynomial L χ S v) ≤ B := by + exact (hfinite L hL S v).trans (mul_le_mul_of_nonneg_left + (hW.sum_le_tsum S (fun n _ => + mul_nonneg (expandingSobolevWeightSq_pos a k L hL n).le (sq_nonneg _))) hC) + have horder (s : ℝ) (hs : s = 6 - a ∨ s = k) : + Integrable (fun ξ => ‖ξ‖ ^ (2 * s) * + ‖radianFourierIntegral (localizedFourierSeries L χ v) ξ‖ ^ 2) ∧ + homogeneousFourierEnergy s (localizedFourierSeries L χ v) ≤ B := by + have hsp : 0 ≤ s := by rcases hs with rfl | rfl <;> linarith + have hb (S : Finset frequencyLattice) : + homogeneousFourierEnergy s (localizedFourierPolynomial L χ S v) ≤ B := by + rcases hs with rfl | rfl + · exact (le_add_of_nonneg_right (integral_nonneg (fun ξ => by positivity))).trans (hfiniteB S) + · exact (le_add_of_nonneg_left (integral_nonneg (fun ξ => by positivity))).trans (hfiniteB S) + have hlim (ξ : E) := tendsto_localizedFourierPolynomial_transform L hLp χ v hv ξ + have hpass := localization_integral_limit + (fun S ξ => ‖ξ‖ ^ (2 * s) * + ‖radianFourierIntegral (localizedFourierPolynomial L χ S v) ξ‖ ^ 2) + (fun ξ => ‖ξ‖ ^ (2 * s) * + ‖radianFourierIntegral (localizedFourierSeries L χ v) ξ‖ ^ 2) + B hB (fun S => integrable_localizedFourierPolynomial_energy s L hsp hLp χ S v) + (fun _ _ => by positivity) (fun _ => by positivity) + (fun ξ => ((hlim ξ).norm.pow 2).const_mul _) hb + exact hpass + have hlow := horder (6 - a) (Or.inl rfl) + have hhigh := horder k (Or.inr rfl) + refine ⟨hlow.1, hhigh.1, ?_⟩ + have hlo := hlow.2 + have hhi := hhigh.2 + dsimp [B] at hlo hhi + nlinarith + +private theorem expanding_coefficient_localization_energy (a k L : ℝ) (hL : 1 ≤ L) + (f : FourierL2) (n : frequencyLattice) : + expandingSobolevWeightSq a k L n * ‖expandingFourierCoefficient a k L f n‖ ^ 2 = + ((2 * Real.pi) ^ (12 : ℕ))⁻¹ * ‖f n‖ ^ 2 := by + unfold expandingFourierCoefficient + rw [norm_mul, mul_pow, expanding_observation_weight_sq a k L hL] + calc + _ = ((2 * Real.pi) ^ (12 : ℕ))⁻¹ * + (expandingSobolevWeightSq a k L n * (expandingSobolevWeightSq a k L n)⁻¹) * + ‖f n‖ ^ 2 := by ring + _ = _ := by rw [mul_inv_cancel₀ (expandingSobolevWeightSq_pos a k L hL n).ne']; ring + +/-- The actual physical cutoff has a uniform two-order homogeneous Fourier bound. +This is the squared version of (lin:J-bound), with fixed Fourier normalization absorbed in C. -/ +theorem exists_expandingPhysicalLocalization_bound (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (χ : 𝓢(E, ℂ)) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ (L : ℝ), 1 ≤ L → ∀ (f : FourierL2), + Integrable (fun ξ => ‖ξ‖ ^ (2 * (6 - a)) * + ‖radianFourierIntegral (expandingPhysicalLocalization a k L χ f) ξ‖ ^ 2) ∧ + Integrable (fun ξ => ‖ξ‖ ^ (2 * k) * + ‖radianFourierIntegral (expandingPhysicalLocalization a k L χ f) ξ‖ ^ 2) ∧ + homogeneousFourierEnergy (6 - a) (expandingPhysicalLocalization a k L χ f) + + homogeneousFourierEnergy k (expandingPhysicalLocalization a k L χ f) ≤ C * ‖f‖ ^ 2 := by + obtain ⟨C, hC, hbound⟩ := exists_localizedFourierSeries_energy_bound a k ha ha1 hk χ + refine ⟨C * ((2 * Real.pi) ^ (12 : ℕ))⁻¹, by positivity, ?_⟩ + intro L hL f + have hs : Summable (fun n : frequencyLattice => ‖f n‖ ^ 2) := by + simpa only [ENNReal.toReal_ofNat, Real.rpow_two] using + (lp.memℓp f).summable (by norm_num : 0 < (2 : ℝ≥0∞).toReal) + have hW : Summable (fun n => expandingSobolevWeightSq a k L n * + ‖expandingFourierCoefficient a k L f n‖ ^ 2) := by + simp only [expanding_coefficient_localization_energy a k L hL] + exact hs.mul_left _ + have heq : (∑' n, expandingSobolevWeightSq a k L n * + ‖expandingFourierCoefficient a k L f n‖ ^ 2) = + ((2 * Real.pi) ^ (12 : ℕ))⁻¹ * ‖f‖ ^ 2 := by + simp_rw [expanding_coefficient_localization_energy a k L hL] + rw [tsum_mul_left] + congr 1 + have he := lp.norm_rpow_eq_tsum (p := 2) (by norm_num) f + simpa only [ENNReal.toReal_ofNat, Real.rpow_two] using he.symm + rw [expandingPhysicalLocalization_eq_series a k L ha ha1 hk hL] + have h := hbound L hL (expandingFourierCoefficient a k L f) + (summable_norm_expandingFourierCoefficient a k L ha ha1 hk hL f) hW + refine ⟨h.1, h.2.1, ?_⟩ + have hb := h.2.2 + rw [heq] at hb + simpa only [mul_assoc] using hb + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLocalizationEnergy.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLocalizationEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..26788a52f66939ff43304a614ffc82168989b073 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLocalizationEnergy.lean @@ -0,0 +1,59 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.SchwartzSobolevLocalization +import OAI.MathematicalPhysics.DefocusingNLS.Linear.LocalizationWeightComparison + +namespace OAI + +/-! # Uniform two-order localization energy bound + +This combines the mixed Fourier estimate with precisely the manuscript's +Y_L weights at s₀ = 6-a and k. It is the finite Fourier energy estimate; +the physical cutoff and Fourier-normalization identification is separate. +-/ + +open MeasureTheory +open scoped SchwartzMap + +namespace DefocusingNLS + +theorem exists_expanding_localization_energy_bound (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (K : 𝓢(EuclideanSpace ℝ (Fin 12), ℂ)) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ (L : ℝ), 1 ≤ L → + ∀ (S : Finset frequencyLattice) (v : frequencyLattice → ℂ), + L ^ (2 * a) * (∫ x, (1 + ‖x‖ ^ 2) ^ (6 - a) * + ‖∑ n ∈ S, v n * K (x - n)‖ ^ 2) + + L ^ (12 - 2 * k) * (∫ x, (1 + ‖x‖ ^ 2) ^ k * + ‖∑ n ∈ S, v n * K (x - n)‖ ^ 2) ≤ + C * ∑ n ∈ S, expandingSobolevWeightSq a k L n * ‖v n‖ ^ 2 := by + obtain ⟨C₀, hC₀, hlow⟩ := exists_schwartz_sobolev_localization_bound (6 - a) (by linarith) K + obtain ⟨C₁, hC₁, hhigh⟩ := exists_schwartz_sobolev_localization_bound k (by linarith) K + refine ⟨C₀ + C₁ * 2 ^ k, by positivity, ?_⟩ + intro L hL S v + let E : ℝ := ∑ n ∈ S, expandingSobolevWeightSq a k L n * ‖v n‖ ^ 2 + have hlowSum : L ^ (2 * a) * ∑ n ∈ S, (1 + ‖n‖ ^ 2) ^ (6 - a) * ‖v n‖ ^ 2 ≤ E := by + rw [Finset.mul_sum] + apply Finset.sum_le_sum + intro n _ + simpa only [mul_assoc] using mul_le_mul_of_nonneg_right + (localization_low_weight_le a k L hL n) (sq_nonneg ‖v n‖) + have hhighSum : L ^ (12 - 2 * k) * ∑ n ∈ S, (1 + ‖n‖ ^ 2) ^ k * ‖v n‖ ^ 2 ≤ + 2 ^ k * E := by + rw [Finset.mul_sum, show 2 ^ k * E = + ∑ n ∈ S, 2 ^ k * (expandingSobolevWeightSq a k L n * ‖v n‖ ^ 2) by + dsimp [E]; rw [Finset.mul_sum]] + apply Finset.sum_le_sum + intro n _ + simpa only [mul_assoc] using mul_le_mul_of_nonneg_right + (localization_high_weight_le a k L ha ha1 hk hL n) (sq_nonneg ‖v n‖) + have hlo := mul_le_mul_of_nonneg_left (hlow S v).2 + (show 0 ≤ L ^ (2 * a) by positivity) + have hhi := mul_le_mul_of_nonneg_left (hhigh S v).2 + (show 0 ≤ L ^ (12 - 2 * k) by positivity) + have hlo' := mul_le_mul_of_nonneg_left hlowSum hC₀ + have hhi' := mul_le_mul_of_nonneg_left hhighSum hC₁ + dsimp [E] at * + nlinarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLocalizedWeakLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLocalizedWeakLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..eac59f4c0279674e9e6100cb47eb1d45538617f8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLocalizedWeakLimit.lean @@ -0,0 +1,63 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousLocalizationPhysical +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousWeakSubsequence +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousWeakObservation + +namespace OAI + +/-! # Weak limits of bounded data on expanding tori + +The actual localization has a uniform Y bound. Its weak subsequences +therefore converge strongly under every compact physical observation. +-/ + +open Filter Topology Set +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem homogeneousLocalObservation_of_weakLimit (a k M : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (S : Set E) [CompactSpace S] + (u : ℕ → HomogeneousY a k) (v : HomogeneousY a k) (hu : ∀ n, ‖u n‖ ≤ M) + (hweak : ∀ ℓ : HomogeneousY a k →L[ℝ] ℂ, + Tendsto (fun n => ℓ (u n)) atTop (𝓝 (ℓ v))) : + Tendsto (fun n => homogeneousLocalObservation a k ha ha1 hk S (u n)) + atTop (𝓝 (homogeneousLocalObservation a k ha ha1 hk S v)) := by + have hbound (n : ℕ) : ‖u n - v‖ ≤ M + ‖v‖ := by + linarith [norm_sub_le (u n) v, hu n] + have hw (ℓ : HomogeneousY a k →L[ℝ] ℂ) : + Tendsto (fun n => ℓ (u n - v)) atTop (𝓝 0) := by + simpa only [map_sub, sub_self] using (hweak ℓ).sub_const (ℓ v) + have h := tendsto_homogeneousLocalObservation_of_weakNull a k (M + ‖v‖) + ha ha1 hk S (fun n => u n - v) hbound hw + have hn := h.norm + simp only [map_sub, norm_zero] at hn + exact tendsto_iff_norm_sub_tendsto_zero.mpr hn + +theorem exists_expandingLocalized_weakLimit (a k M : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (χ : 𝓢(E, ℂ)) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) : + ∃ C : ℝ, 0 ≤ C ∧ ∃ v : HomogeneousY a k, ‖v‖ ≤ C * M ∧ + ∃ φ : ℕ → ℕ, StrictMono φ ∧ + (∀ ℓ : HomogeneousY a k →L[ℝ] ℂ, + Tendsto (fun n => ℓ (homogeneousLocalizationCLM a k (L (φ n)) + ha ha1 hk (hL (φ n)) χ (f (φ n)))) atTop (𝓝 (ℓ v))) ∧ + (∀ (S : Set E) (_ : CompactSpace S), + Tendsto (fun n => homogeneousLocalObservation a k ha ha1 hk S + (homogeneousLocalizationCLM a k (L (φ n)) ha ha1 hk (hL (φ n)) χ (f (φ n)))) + atTop (𝓝 (homogeneousLocalObservation a k ha ha1 hk S v))) := by + obtain ⟨C, hC, hb⟩ := exists_homogeneousLocalization_bound a k ha ha1 hk χ + let w := fun n => homogeneousLocalizationCLM a k (L n) ha ha1 hk (hL n) χ (f n) + have hw (n : ℕ) : ‖w n‖ ≤ C * M := + (hb (L n) (hL n) (f n)).trans (mul_le_mul_of_nonneg_left (hf n) hC) + obtain ⟨v, hv, φ, hφ, hweak⟩ := homogeneousY_weak_subsequence a k (C * M) ha1 hk w hw + refine ⟨C, hC, v, hv, φ, hφ, hweak, ?_⟩ + intro S hS + exact homogeneousLocalObservation_of_weakLimit a k (C * M) ha ha1 hk S + (fun n => w (φ n)) v (fun n => hw (φ n)) hweak + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLowInterpolation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLowInterpolation.lean new file mode 100644 index 0000000000000000000000000000000000000000..ceb6e53e701d6644531d76be7a2c431c276609c4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLowInterpolation.lean @@ -0,0 +1,44 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingLowPhysicalEnergy +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.LowWeightInterpolation + +namespace OAI + +/-! # Uniform lower-energy interpolation on every expanding torus -/ + +open scoped ENNReal + +namespace DefocusingNLS + +theorem expandingLowEnergy_interpolation (a ε : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hε : 0 < ε) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ (L : ℝ) (hL : 1 ≤ L) (f : FourierL2), + ‖expandingLowEnergy a N L hL f‖ ^ 2 ≤ ε * ‖f‖ ^ 2 + + C * ‖expandingPhysicalMassVector a N L ha ha1 hN hL f‖ ^ 2 := by + obtain ⟨C, hC, hc⟩ := lowBesselWeight_interpolation a N ε ha ha1 hN hε + refine ⟨C, hC, ?_⟩ + intro L hL f + have hcoord (n : frequencyLattice) : ‖expandingLowEnergy a N L hL f n‖ ^ 2 ≤ + ε * ‖f n‖ ^ 2 + C * ‖expandingPhysicalMassVector a N L ha ha1 hN hL f n‖ ^ 2 := by + have hw := hc (L ^ (-2 : ℝ)) (‖n‖ / L) (by positivity) + (Real.rpow_le_one_of_one_le_of_nonpos hL (by norm_num)) + (div_nonneg (norm_nonneg _) (by linarith)) + rw [show (2 : ℝ) * (N : ℝ) = ((2 * N : ℕ) : ℝ) by push_cast; rfl, + Real.rpow_natCast] at hw + rw [expandingLowEnergy_coordinate_physical a L N hL f n, + expandingNorm_coordinate_physical a L N hL f n, + expandingPhysicalMassVector_coordinate_sq a N L ha ha1 hN hL f n] + have hA : 0 ≤ (L ^ (-2 : ℝ) + (‖n‖ / L) ^ 2) ^ (6 - a) := by positivity + have hh := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hw + (show 0 ≤ (2 * Real.pi * L) ^ 12 by positivity)) + (sq_nonneg ‖expandingFourierCoefficient a N L f n‖) + nlinarith [mul_nonneg hε.le (mul_nonneg + (mul_nonneg (show 0 ≤ (2 * Real.pi * L) ^ 12 by positivity) hA) + (sq_nonneg ‖expandingFourierCoefficient a N L f n‖))] + have hs (g : FourierL2) : HasSum (fun n : frequencyLattice => ‖g n‖ ^ 2) (‖g‖ ^ 2) := by + simpa only [ENNReal.toReal_ofNat, Real.rpow_two] using lp.hasSum_norm (p := 2) (by norm_num) g + exact hasSum_le hcoord (hs _) (((hs f).mul_left ε).add + ((hs (expandingPhysicalMassVector a N L ha ha1 hN hL f)).mul_left C)) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLowMassLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLowMassLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..90eaba79637f2a70662dc1b47808b4d4232ce20b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLowMassLimit.lean @@ -0,0 +1,50 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingLowInterpolation + +namespace OAI + +/-! # Vanishing lower energy from bounded Sobolev norm and vanishing mass -/ + +open Filter Topology + +namespace DefocusingNLS + +theorem expandingLowEnergy_norm_le (a k L : ℝ) (hL : 1 ≤ L) (f : FourierL2) : + ‖expandingLowEnergy a k L hL f‖ ≤ ‖f‖ := by + have he := expandingEnergy_norm_sq a k L hL f + nlinarith [sq_nonneg ‖expandingHighEnergy a k L hL f‖, norm_nonneg f, + norm_nonneg (expandingLowEnergy a k L hL f)] + +theorem tendsto_expandingLowEnergy_of_mass (a M : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) + (hmass : Tendsto (fun n => ‖expandingPhysicalMassVector a N (L n) ha ha1 hN (hL n) (f n)‖) + atTop (𝓝 0)) : + Tendsto (fun n => expandingLowEnergy a N (L n) (hL n) (f n)) atTop (𝓝 0) := by + have hM : 0 ≤ M := (norm_nonneg (f 0)).trans (hf 0) + have hs : Tendsto (fun n => ‖expandingLowEnergy a N (L n) (hL n) (f n)‖ ^ 2) + atTop (𝓝 0) := by + apply tendsto_order.2 + constructor + · intro r hr + exact Eventually.of_forall (fun n => hr.trans_le (sq_nonneg _)) + · intro ε hε + let δ := ε / (2 * (M ^ 2 + 1)) + have hδ : 0 < δ := by dsimp [δ]; positivity + obtain ⟨C, _, hc⟩ := expandingLowEnergy_interpolation a δ N ha ha1 hN hδ + have hz : Tendsto (fun n => C * + ‖expandingPhysicalMassVector a N (L n) ha ha1 hN (hL n) (f n)‖ ^ 2) atTop (𝓝 0) := by + simpa only [zero_pow (by norm_num : (2 : ℕ) ≠ 0), mul_zero] using (hmass.pow 2).const_mul C + have he := hz.eventually (gt_mem_nhds (show 0 < ε / 2 by positivity)) + have hδM : δ * M ^ 2 ≤ ε / 2 := by + have hi : δ * (2 * (M ^ 2 + 1)) = ε := div_mul_cancel₀ _ (by positivity) + nlinarith [hδ.le] + filter_upwards [he] with n hn + have hb := mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (norm_nonneg _) (hf n) 2) hδ.le + have hi := hc (L n) (hL n) (f n) + linarith + rw [tendsto_zero_iff_norm_tendsto_zero] + simpa only [Real.sqrt_sq (norm_nonneg _), Real.sqrt_zero] using hs.sqrt + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLowPhysicalEnergy.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLowPhysicalEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..8247f259a5e1a6f9ef7ac5b2ba396c1503c2117e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLowPhysicalEnergy.lean @@ -0,0 +1,51 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingMassDerivativeEnergy + +namespace OAI + +/-! # The exact physical Fourier weight of the lower energy component -/ + +namespace DefocusingNLS + +theorem expandingNorm_coordinate_physical (a L : ℝ) (N : ℕ) (hL : 1 ≤ L) + (f : FourierL2) (n : frequencyLattice) : + ‖f n‖ ^ 2 = (2 * Real.pi * L) ^ 12 * + ((L ^ (-2 : ℝ) + (‖n‖ / L) ^ 2) ^ (6 - a) + (‖n‖ / L) ^ (2 * N)) * + ‖expandingFourierCoefficient a N L f n‖ ^ 2 := by + have hw : expandingSobolevWeight a N L n ^ 2 = (2 * Real.pi * L) ^ 12 * + ((L ^ (-2 : ℝ) + (‖n‖ / L) ^ 2) ^ (6 - a) + (‖n‖ / L) ^ (2 * N)) := by + rw [expandingSobolevWeight_sq a N L hL, ← expandingSobolevWeightSq_original a N L hL] + congr 2 + rw [show (2 : ℝ) * (N : ℝ) = ((2 * N : ℕ) : ℝ) by push_cast; rfl, Real.rpow_natCast] + have hf := congrArg (fun z : ℂ => ‖z‖ ^ 2) (weight_mul_expandingFourierCoefficient a N L hL f n) + simp only [norm_mul, Complex.norm_real, Real.norm_eq_abs, sq_abs, mul_pow] at hf + rw [← hf, hw] + +theorem expandingEnergy_coordinate_split (a L : ℝ) (N : ℕ) (hL : 1 ≤ L) + (f : FourierL2) (n : frequencyLattice) : + ‖expandingLowEnergy a N L hL f n‖ ^ 2 + + (∑ j : Fin N → Fin 12, ‖expandingOrderedFourierEnergy a L N hL j f n‖ ^ 2) = ‖f n‖ ^ 2 := by + have hlo : ‖expandingLowEnergy a N L hL f n‖ ^ 2 = + expandingLowFraction a N L n * ‖f n‖ ^ 2 := by + rw [expandingLowEnergy, fourierEnergyComponent_apply, norm_mul, mul_pow, + Complex.norm_real, Real.norm_eq_abs, sq_abs, + Real.sq_sqrt (expandingLowFraction_bounds a N L hL n).1] + have hhi : (∑ j : Fin N → Fin 12, ‖expandingOrderedFourierEnergy a L N hL j f n‖ ^ 2) = + (1 - expandingLowFraction a N L n) * ‖f n‖ ^ 2 := by + simp only [expandingOrderedFourierEnergy_apply, norm_mul, mul_pow] + rw [← Finset.sum_mul, expandingOrderedMultiplier_sq_sum a L N hL n] + rw [hlo, hhi] + ring + +theorem expandingLowEnergy_coordinate_physical (a L : ℝ) (N : ℕ) (hL : 1 ≤ L) + (f : FourierL2) (n : frequencyLattice) : + ‖expandingLowEnergy a N L hL f n‖ ^ 2 = (2 * Real.pi * L) ^ 12 * + (L ^ (-2 : ℝ) + (‖n‖ / L) ^ 2) ^ (6 - a) * + ‖expandingFourierCoefficient a N L f n‖ ^ 2 := by + have he := expandingEnergy_coordinate_split a L N hL f n + rw [expandingOrderedFourierEnergy_coordinate_sq_sum a L N hL f n, + expandingNorm_coordinate_physical a L N hL f n] at he + nlinarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLowerWeightBound.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLowerWeightBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..e2a2f3797dc7ce14cd6f61e8e582d10a46ec42bf --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingLowerWeightBound.lean @@ -0,0 +1,44 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingOrderedPhysicalSymbol + +namespace OAI + +/-! # Lower-order frequency weight controlled by mass and top derivatives -/ + +namespace DefocusingNLS + +theorem lowerFrequencyWeight_le_mass_top (x r s : ℝ) (N : ℕ) + (hx : 0 ≤ x) (hx1 : x ≤ 1) (hr : 0 ≤ r) (hs : 0 ≤ s) (hsN : s ≤ N) : + (x + r ^ 2) ^ s ≤ (2 : ℝ) ^ N * (1 + r ^ (2 * N)) := by + by_cases hr1 : r ≤ 1 + · have hr2 : r ^ 2 ≤ 1 := by nlinarith + calc + _ ≤ (2 : ℝ) ^ s := Real.rpow_le_rpow (by positivity) (by linarith) hs + _ ≤ (2 : ℝ) ^ (N : ℝ) := Real.rpow_le_rpow_of_exponent_le (by norm_num) hsN + _ = (2 : ℝ) ^ N := Real.rpow_natCast 2 N + _ ≤ _ := le_mul_of_one_le_right (by positivity) + (le_add_of_nonneg_right (pow_nonneg hr _)) + · have hr1' : 1 ≤ r := (lt_of_not_ge hr1).le + have hr2 : 1 ≤ r ^ 2 := by nlinarith + calc + _ ≤ (x + r ^ 2) ^ (N : ℝ) := + Real.rpow_le_rpow_of_exponent_le (by linarith) hsN + _ = (x + r ^ 2) ^ N := Real.rpow_natCast _ N + _ ≤ (2 * r ^ 2) ^ N := pow_le_pow_left₀ (by positivity) (by linarith) N + _ = (2 : ℝ) ^ N * r ^ (2 * N) := by rw [mul_pow, ← pow_mul] + _ ≤ _ := mul_le_mul_of_nonneg_left (le_add_of_nonneg_left (by norm_num)) (by positivity) + +theorem expandingLowerWeight_le_mass_top (a L : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hL : 1 ≤ L) + (n : frequencyLattice) : + (L ^ (-2 : ℝ) + (‖n‖ / L) ^ 2) ^ (6 - a) ≤ + (2 : ℝ) ^ N * (1 + (‖n‖ / L) ^ (2 * N)) := by + apply lowerFrequencyWeight_le_mass_top _ _ _ N + · positivity + · exact Real.rpow_le_one_of_one_le_of_nonpos hL (by norm_num) + · exact div_nonneg (norm_nonneg _) (by linarith) + · linarith + · linarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMassDerivativeEnergy.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMassDerivativeEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..519b32eb5ed4f96fdfdd409669a3b575faf007a9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMassDerivativeEnergy.lean @@ -0,0 +1,62 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingLowerWeightBound + +namespace OAI + +/-! # The exact expanding norm is controlled by physical mass and top derivatives -/ + +open scoped ENNReal + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem expandingPhysicalMassVector_coordinate_sq (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) (n : frequencyLattice) : + ‖expandingPhysicalMassVector a k L ha ha1 hk hL f n‖ ^ 2 = + (2 * Real.pi * L) ^ 12 * ‖expandingFourierCoefficient a k L f n‖ ^ 2 := by + rw [expandingPhysicalMassVector_apply, norm_smul, mul_pow, Real.norm_eq_abs, sq_abs, ← pow_mul] + +theorem expandingOrderedFourierEnergy_coordinate_sq_sum (a L : ℝ) (N : ℕ) + (hL : 1 ≤ L) (f : FourierL2) (n : frequencyLattice) : + (∑ j : Fin N → Fin 12, ‖expandingOrderedFourierEnergy a L N hL j f n‖ ^ 2) = + (2 * Real.pi * L) ^ 12 * (‖n‖ / L) ^ (2 * N) * + ‖expandingFourierCoefficient a N L f n‖ ^ 2 := by + have hn : ‖L⁻¹ • (n : E)‖ = ‖n‖ / L := by + rw [norm_smul, Real.norm_eq_abs, abs_of_pos (by positivity : 0 < L⁻¹), Submodule.norm_coe] + ring + have he (j : Fin N → Fin 12) : ‖expandingOrderedFourierEnergy a L N hL j f n‖ ^ 2 = + (2 * Real.pi * L) ^ 12 * ‖homogeneousOrderedSymbol N j (L⁻¹ • (n : E))‖ ^ 2 * + ‖expandingFourierCoefficient a N L f n‖ ^ 2 := by + rw [expandingOrderedFourierEnergy_physical] + simp only [norm_mul, mul_pow, Complex.norm_ofNat, Complex.norm_real, Complex.norm_pow, + Real.norm_eq_abs, abs_of_pos Real.pi_pos, abs_of_pos (show 0 < L by linarith)] + ring + simp_rw [he] + rw [← Finset.sum_mul, ← Finset.mul_sum, homogeneousOrderedSymbol_sq_sum, hn] + +theorem expandingMassDerivative_coordinate_bound (a L : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hL : 1 ≤ L) + (f : FourierL2) (n : frequencyLattice) : + ‖f n‖ ^ 2 ≤ ((2 : ℝ) ^ N + 1) * + (‖expandingPhysicalMassVector a N L ha ha1 hN hL f n‖ ^ 2 + + ∑ j : Fin N → Fin 12, ‖expandingOrderedFourierEnergy a L N hL j f n‖ ^ 2) := by + have hw : expandingSobolevWeight a N L n ^ 2 = (2 * Real.pi * L) ^ 12 * + ((L ^ (-2 : ℝ) + (‖n‖ / L) ^ 2) ^ (6 - a) + (‖n‖ / L) ^ (2 * N)) := by + rw [expandingSobolevWeight_sq a N L hL, ← expandingSobolevWeightSq_original a N L hL] + congr 2 + rw [show (2 : ℝ) * (N : ℝ) = ((2 * N : ℕ) : ℝ) by push_cast; rfl, Real.rpow_natCast] + have hf := congrArg (fun z : ℂ => ‖z‖ ^ 2) (weight_mul_expandingFourierCoefficient a N L hL f n) + simp only [norm_mul, Complex.norm_real, Real.norm_eq_abs, sq_abs, mul_pow] at hf + rw [← hf, hw, expandingPhysicalMassVector_coordinate_sq, + expandingOrderedFourierEnergy_coordinate_sq_sum] + have hlo := expandingLowerWeight_le_mass_top a L N ha ha1 hN hL n + have hweight : (L ^ (-2 : ℝ) + (‖n‖ / L) ^ 2) ^ (6 - a) + (‖n‖ / L) ^ (2 * N) ≤ + ((2 : ℝ) ^ N + 1) * (1 + (‖n‖ / L) ^ (2 * N)) := by nlinarith + calc + _ ≤ (2 * Real.pi * L) ^ 12 * (((2 : ℝ) ^ N + 1) * (1 + (‖n‖ / L) ^ (2 * N))) * + ‖expandingFourierCoefficient a N L f n‖ ^ 2 := by gcongr + _ = _ := by ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMassDerivativeNorm.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMassDerivativeNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..2d7c5fdc73c8730f3c5ca20d24a2e102c781b877 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMassDerivativeNorm.lean @@ -0,0 +1,54 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingMassDerivativeEnergy + +namespace OAI + +/-! # Strong convergence from physical mass and the top derivative components -/ + +open Filter Topology +open scoped ENNReal + +namespace DefocusingNLS + +theorem expandingMassDerivative_norm_bound (a L : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hL : 1 ≤ L) (f : FourierL2) : + ‖f‖ ^ 2 ≤ ((2 : ℝ) ^ N + 1) * + (‖expandingPhysicalMassVector a N L ha ha1 hN hL f‖ ^ 2 + + ∑ j : Fin N → Fin 12, ‖expandingOrderedFourierEnergy a L N hL j f‖ ^ 2) := by + have hf : HasSum (fun n : frequencyLattice => ‖f n‖ ^ 2) (‖f‖ ^ 2) := by + simpa only [ENNReal.toReal_ofNat, Real.rpow_two] using lp.hasSum_norm (p := 2) (by norm_num) f + have hm : HasSum (fun n : frequencyLattice => + ‖expandingPhysicalMassVector a N L ha ha1 hN hL f n‖ ^ 2) + (‖expandingPhysicalMassVector a N L ha ha1 hN hL f‖ ^ 2) := by + simpa only [ENNReal.toReal_ofNat, Real.rpow_two] using + lp.hasSum_norm (p := 2) (by norm_num) (expandingPhysicalMassVector a N L ha ha1 hN hL f) + have hd (j : Fin N → Fin 12) : HasSum (fun n : frequencyLattice => + ‖expandingOrderedFourierEnergy a L N hL j f n‖ ^ 2) + (‖expandingOrderedFourierEnergy a L N hL j f‖ ^ 2) := by + simpa only [ENNReal.toReal_ofNat, Real.rpow_two] using + lp.hasSum_norm (p := 2) (by norm_num) (expandingOrderedFourierEnergy a L N hL j f) + have hs := (hm.add (hasSum_sum (s := Finset.univ) (fun j _ => hd j))).mul_left ((2 : ℝ) ^ N + 1) + exact hasSum_le (expandingMassDerivative_coordinate_bound a L N ha ha1 hN hL f) hf hs + +theorem tendsto_expanding_of_mass_derivatives_zero (a : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (f : ℕ → FourierL2) + (hm : Tendsto (fun n => ‖expandingPhysicalMassVector a N (L n) ha ha1 hN (hL n) (f n)‖) + atTop (𝓝 0)) + (hd : ∀ j : Fin N → Fin 12, Tendsto + (fun n => ‖expandingOrderedFourierEnergy a (L n) N (hL n) j (f n)‖) atTop (𝓝 0)) : + Tendsto f atTop (𝓝 0) := by + have hs := tendsto_finsetSum Finset.univ (fun j _ => (hd j).pow 2) + have hu : Tendsto (fun n => ((2 : ℝ) ^ N + 1) * + (‖expandingPhysicalMassVector a N (L n) ha ha1 hN (hL n) (f n)‖ ^ 2 + + ∑ j : Fin N → Fin 12, ‖expandingOrderedFourierEnergy a (L n) N (hL n) j (f n)‖ ^ 2)) + atTop (𝓝 0) := by + simpa only [zero_pow (by norm_num : (2 : ℕ) ≠ 0), Finset.sum_const_zero, add_zero, mul_zero] + using ((hm.pow 2).add hs).const_mul ((2 : ℝ) ^ N + 1) + have hsq := squeeze_zero (fun n => sq_nonneg ‖f n‖) + (fun n => expandingMassDerivative_norm_bound a (L n) N ha ha1 hN (hL n) (f n)) hu + rw [tendsto_zero_iff_norm_tendsto_zero] + simpa only [Real.sqrt_sq (norm_nonneg _), Real.sqrt_zero] using hsq.sqrt + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMildContraction.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMildContraction.lean new file mode 100644 index 0000000000000000000000000000000000000000..dad62942b8a9b9725781da6a02bc533dc0ff812f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMildContraction.lean @@ -0,0 +1,183 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingDuhamelContinuity +import Mathlib.Topology.MetricSpace.Contracting +import Mathlib.Topology.ContinuousMap.Compact + +namespace OAI + +/-! # A short-time mild contraction on expanding tori + +A jointly continuous reaction with a uniform Lipschitz bound gives a unique +mild trajectory whenever `T K < 1`. The interval length depends on the +reaction bound and is independent of the starting torus scale. +-/ + +open Set MeasureTheory + +namespace DefocusingNLS + +attribute [local irreducible] expandingFreeStep + +noncomputable def expandingReactionHistory (T : ℝ) (hT : 0 ≤ T) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) + (u : C(Icc (0 : ℝ) T, FourierL2)) : ℝ → FourierL2 := + fun t => F (projIcc 0 T hT t, u (projIcc 0 T hT t)) + +theorem continuous_expandingReactionHistory (T : ℝ) (hT : 0 ≤ T) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) + (u : C(Icc (0 : ℝ) T, FourierL2)) : + Continuous (expandingReactionHistory T hT F u) := + F.continuous.comp (continuous_projIcc.prodMk (u.continuous.comp continuous_projIcc)) + +noncomputable def expandingPicard (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) (u₀ : FourierL2) + (u : C(Icc (0 : ℝ) T, FourierL2)) : C(Icc (0 : ℝ) T, FourierL2) where + toFun t := expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t (expandingReactionHistory T hT F u) + continuous_toFun := by + have hp : Continuous (fun t : Icc (0 : ℝ) T => + ((⟨L, hL⟩, ⟨t.1, t.2.1⟩) : ExpandingFreeParameters)) := + continuous_const.prodMk (continuous_subtype_val.subtype_mk _) + exact ((continuous_expandingFreeFamily a b k ha hk u₀).comp hp).add + ((continuous_expandingDuhamel a b k ha hk _ + (continuous_expandingReactionHistory T hT F u)).comp hp) + +/-- The Picard contraction constant is `T K`, with no dependence on `L`. -/ +theorem expandingPicard_dist_le (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) (u₀ : FourierL2) + (K : ℝ) (hK : 0 ≤ K) + (hF : ∀ t x y, ‖F (t, x) - F (t, y)‖ ≤ K * ‖x - y‖) + (u v : C(Icc (0 : ℝ) T, FourierL2)) : + dist (expandingPicard a b k L T ha hk hL hT F u₀ u) + (expandingPicard a b k L T ha hk hL hT F u₀ v) ≤ T * K * dist u v := by + apply (ContinuousMap.dist_le (by positivity)).2 + intro t + let ru := expandingReactionHistory T hT F u + let rv := expandingReactionHistory T hT F v + have hru : Continuous ru := continuous_expandingReactionHistory T hT F u + have hrv : Continuous rv := continuous_expandingReactionHistory T hT F v + have hbound : ∀ τ ∈ Icc (0 : ℝ) t, ‖ru τ - rv τ‖ ≤ K * dist u v := by + intro τ hτ + change ‖F (projIcc 0 T hT τ, _) - F (projIcc 0 T hT τ, _)‖ ≤ _ + exact (hF _ _ _).trans (mul_le_mul_of_nonneg_left + (by simpa only [dist_eq_norm] using + (ContinuousMap.dist_apply_le_dist (f := u) (g := v) (projIcc 0 T hT τ))) hK) + have hb := expandingDuhamel_norm_le_mul a b k L ha hk hL t (K * dist u v) + t.2.1 (fun τ => ru τ - rv τ) (hru.sub hrv).continuousOn hbound + change dist + (expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t ru) + (expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t rv) ≤ _ + rw [dist_add_left, dist_eq_norm, + ← expandingDuhamel_sub a b k L ha hk hL t ru rv hru.continuousOn hrv.continuousOn] + apply hb.trans + calc + (t : ℝ) * (K * dist u v) ≤ T * (K * dist u v) := + mul_le_mul_of_nonneg_right t.2.2 (mul_nonneg hK dist_nonneg) + _ = _ := by ring + +/-- Existence and uniqueness of the actual moving-scale mild equation on a short slab. -/ +theorem existsUnique_expandingMildSolution (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) (u₀ : FourierL2) + (K : ℝ) (hK : 0 ≤ K) (hTK : T * K < 1) + (hF : ∀ t x y, ‖F (t, x) - F (t, y)‖ ≤ K * ‖x - y‖) : + ∃! u : C(Icc (0 : ℝ) T, FourierL2), ∀ t : Icc (0 : ℝ) T, + u t = expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t (expandingReactionHistory T hT F u) := by + let P := expandingPicard a b k L T ha hk hL hT F u₀ + have hP : ContractingWith ⟨T * K, mul_nonneg hT hK⟩ P := + ⟨hTK, LipschitzWith.of_dist_le_mul + (expandingPicard_dist_le a b k L T ha hk hL hT F u₀ K hK hF)⟩ + refine ⟨hP.fixedPoint P, ?_, ?_⟩ + · intro t + exact (congrArg (fun u : C(Icc (0 : ℝ) T, FourierL2) => u t) + hP.fixedPoint_isFixedPt).symm + · intro u hu + apply hP.fixedPoint_unique + apply ContinuousMap.ext + intro t + exact (hu t).symm + +/-- Short-slab dependence on the initial datum is uniform in the torus scale. -/ +theorem expandingMildSolution_initialData_bound (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) + (u₀ v₀ : FourierL2) (K : ℝ) (hK : 0 ≤ K) (hTK : T * K < 1) + (hF : ∀ t x y, ‖F (t, x) - F (t, y)‖ ≤ K * ‖x - y‖) + (u v : C(Icc (0 : ℝ) T, FourierL2)) + (hu : ∀ t : Icc (0 : ℝ) T, u t = + expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t (expandingReactionHistory T hT F u)) + (hv : ∀ t : Icc (0 : ℝ) T, v t = + expandingFreeStep a b k L t ha hk hL t.2.1 v₀ + + expandingDuhamel a b k L ha hk hL t (expandingReactionHistory T hT F v)) : + dist u v ≤ dist u₀ v₀ / (1 - T * K) := by + let P := expandingPicard a b k L T ha hk hL hT F u₀ + let Q := expandingPicard a b k L T ha hk hL hT F v₀ + have hP : ContractingWith ⟨T * K, mul_nonneg hT hK⟩ P := + ⟨hTK, LipschitzWith.of_dist_le_mul + (expandingPicard_dist_le a b k L T ha hk hL hT F u₀ K hK hF)⟩ + have huP : Function.IsFixedPt P u := by + apply ContinuousMap.ext + intro t + exact (hu t).symm + have hvQ : Function.IsFixedPt Q v := by + apply ContinuousMap.ext + intro t + exact (hv t).symm + apply hP.dist_fixedPoint_fixedPoint_of_dist_le' Q huP hvQ + intro z + apply (ContinuousMap.dist_le dist_nonneg).2 + intro t + change dist + (expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t (expandingReactionHistory T hT F z)) + (expandingFreeStep a b k L t ha hk hL t.2.1 v₀ + + expandingDuhamel a b k L ha hk hL t (expandingReactionHistory T hT F z)) ≤ _ + rw [dist_add_right, dist_eq_norm, ← map_sub] + apply (expandingFreeStep_norm_bound a b k L t ha hk hL t.2.1 (u₀ - v₀)).trans + rw [dist_eq_norm] + exact mul_le_of_le_one_left (norm_nonneg _) (Real.exp_le_one_iff.mpr (by nlinarith [t.2.1])) + +/-- The real-linear potential enters with the exact Schrödinger factor `-i`. -/ +noncomputable def expandingLinearReaction (T : ℝ) + (B : C(Icc (0 : ℝ) T, FourierL2 →L[ℝ] FourierL2)) + (g : C(Icc (0 : ℝ) T, FourierL2)) : + C((Icc (0 : ℝ) T) × FourierL2, FourierL2) where + toFun p := -Complex.I • B p.1 p.2 + g p.1 + continuous_toFun := + (((B.continuous.comp continuous_fst).clm_apply continuous_snd).const_smul (-Complex.I : ℂ)).add + (g.continuous.comp continuous_fst) + +theorem expandingLinearReaction_lipschitz (T : ℝ) + (B : C(Icc (0 : ℝ) T, FourierL2 →L[ℝ] FourierL2)) + (g : C(Icc (0 : ℝ) T, FourierL2)) (K : ℝ) + (hB : ∀ t, ‖B t‖ ≤ K) (t : Icc (0 : ℝ) T) (x y : FourierL2) : + ‖expandingLinearReaction T B g (t, x) - expandingLinearReaction T B g (t, y)‖ ≤ + K * ‖x - y‖ := by + change ‖(-Complex.I • B t x + g t) - (-Complex.I • B t y + g t)‖ ≤ _ + rw [add_sub_add_right_eq_sub, ← smul_sub, ← map_sub, norm_smul] + simp only [norm_neg, Complex.norm_I, one_mul] + exact ((B t).le_opNorm (x - y)).trans + (mul_le_mul_of_nonneg_right (hB t) (norm_nonneg _)) + +/-- Uniformly bounded continuous real-linear potentials have a unique short-slab +propagator, including a continuous source term. -/ +theorem existsUnique_expandingLinearMildSolution (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (B : C(Icc (0 : ℝ) T, FourierL2 →L[ℝ] FourierL2)) + (g : C(Icc (0 : ℝ) T, FourierL2)) (u₀ : FourierL2) + (K : ℝ) (hK : 0 ≤ K) (hTK : T * K < 1) (hB : ∀ t, ‖B t‖ ≤ K) : + ∃! u : C(Icc (0 : ℝ) T, FourierL2), ∀ t : Icc (0 : ℝ) T, + u t = expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t + (expandingReactionHistory T hT (expandingLinearReaction T B g) u) := + existsUnique_expandingMildSolution a b k L T ha hk hL hT + (expandingLinearReaction T B g) u₀ K hK hTK (expandingLinearReaction_lipschitz T B g K hB) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMildEnergy.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMildEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..25039d9a01b4118e484a64809276622ac4e3988f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMildEnergy.lean @@ -0,0 +1,112 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingInteractionPicture +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingEnergyInner + +namespace OAI + +/-! # Energy differentiation for the actual expanding mild equation + +The proof takes place in the free interaction picture. The solution and +forcing need only be continuous in the exact moving Sobolev norm. +-/ + +open Set Filter Topology + +namespace DefocusingNLS + +attribute [local irreducible] expandingLowEnergy expandingHighEnergy expandingFreeStep + expandingFreeInverse expandingInversePath expandingDuhamel + +private theorem expanding_component_derivative (a b k L T c : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (J₀ : FourierL2 →L[ℝ] FourierL2) + (J : Icc (0 : ℝ) T → FourierL2 →L[ℝ] FourierL2) + (hnorm : ∀ s g, ‖J s (expandingFreeStep a b k L s ha hk hL s.2.1 g)‖ ^ 2 = + Real.exp (c * s) * ‖J₀ g‖ ^ 2) + (hinner : ∀ s g h, + inner ℝ (J s (expandingFreeStep a b k L s ha hk hL s.2.1 g)) + (J s (expandingFreeStep a b k L s ha hk hL s.2.1 h)) = + Real.exp (c * s) * inner ℝ (J₀ g) (J₀ h)) + (u : C(Icc (0 : ℝ) T, FourierL2)) (r : ℝ → FourierL2) (hr : Continuous r) + (f : FourierL2) + (hu : ∀ s : Icc (0 : ℝ) T, u s = + expandingFreeStep a b k L s ha hk hL s.2.1 f + + expandingDuhamel a b k L ha hk hL s r) + (t : ℝ) (ht : t ∈ Ioo 0 T) : + HasDerivAt (fun τ => ‖J (projIcc 0 T hT τ) (u (projIcc 0 T hT τ))‖ ^ 2) + (c * ‖J (projIcc 0 T hT t) (u (projIcc 0 T hT t))‖ ^ 2 + + 2 * inner ℝ (J (projIcc 0 T hT t) (u (projIcc 0 T hT t))) + (J (projIcc 0 T hT t) (r t))) t := by + let v := expandingInversePath a b k L T ha hk hL u + let p := fun τ => projIcc 0 T hT τ + have hreturn (s : Icc (0 : ℝ) T) : + expandingFreeStep a b k L s ha hk hL s.2.1 (v s) = u s := + expandingInversePath_return a b k L T ha hk hL u s + have he (s : Icc (0 : ℝ) T) : ‖J s (u s)‖ ^ 2 = + Real.exp (c * s) * ‖J₀ (v s)‖ ^ 2 := by + simpa only [hreturn] using hnorm s (v s) + have hv := hasDerivAt_expandingMild_pullback a b k L T ha hk hL hT u r hr f hu t ht + have hJ := J₀.hasFDerivAt.comp_hasDerivAt t hv + have hd := (((hasDerivAt_id t).const_mul c).exp).mul hJ.norm_sq + have hsame : (fun τ => Real.exp (c * τ) * ‖J₀ (v (p τ))‖ ^ 2) =ᶠ[𝓝 t] + (fun τ => ‖J (p τ) (u (p τ))‖ ^ 2) := by + filter_upwards [Ioo_mem_nhds ht.1 ht.2] with τ hτ + have hp : p τ = ⟨τ, hτ.1.le, hτ.2.le⟩ := projIcc_of_mem hT ⟨hτ.1.le, hτ.2.le⟩ + rw [hp] + exact (he ⟨τ, hτ.1.le, hτ.2.le⟩).symm + have hi : inner ℝ (J (p t) (u (p t))) (J (p t) (r t)) = + Real.exp (c * t) * inner ℝ (J₀ (v (p t))) + (J₀ (expandingFreeInverse a b k L t ha hk hL ht.1.le (r t))) := by + have hi := hinner ⟨t, ht.1.le, ht.2.le⟩ (v ⟨t, ht.1.le, ht.2.le⟩) + (expandingFreeInverse a b k L t ha hk hL ht.1.le (r t)) + rw [hreturn, expandingFreeInverse_right] at hi + simpa only [p, projIcc_of_mem hT ⟨ht.1.le, ht.2.le⟩] using hi + apply (hd.congr_of_eventuallyEq hsame.symm).congr_deriv + change (Real.exp (c * t) * (c * 1)) * ‖J₀ (v (p t))‖ ^ 2 + + Real.exp (c * t) * (2 * inner ℝ (J₀ (v (p t))) + (J₀ (expandingFreeInverse a b k L t ha hk hL ht.1.le (r t)))) = _ + rw [he, hi] + dsimp [p] + rw [projIcc_of_mem hT ⟨ht.1.le, ht.2.le⟩] + ring + +theorem hasDerivAt_expandingMildEnergy (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (u : C(Icc (0 : ℝ) T, FourierL2)) (r : ℝ → FourierL2) (hr : Continuous r) + (f : FourierL2) + (hu : ∀ s : Icc (0 : ℝ) T, u s = + expandingFreeStep a b k L s ha hk hL s.2.1 f + + expandingDuhamel a b k L ha hk hL s r) + (t : ℝ) (ht : t ∈ Ioo 0 T) : + let s := projIcc 0 T hT t + let hR := hL.trans (expandingRadius_ge L s hL s.2.1) + HasDerivAt (fun τ => ‖u (projIcc 0 T hT τ)‖ ^ 2) + (-a * ‖expandingLowEnergy a k (expandingRadius L s) hR (u s)‖ ^ 2 + + (6 - 2 * a - k) * ‖expandingHighEnergy a k (expandingRadius L s) hR (u s)‖ ^ 2 + + 2 * inner ℝ (u s) (r t)) t := by + dsimp only + have hlo := expanding_component_derivative a b k L T (-a) ha hk hL hT + ((expandingLowEnergy a k L hL).restrictScalars ℝ) + (fun s => (expandingLowEnergy a k (expandingRadius L s) + (hL.trans (expandingRadius_ge L s hL s.2.1))).restrictScalars ℝ) + (fun s g => expandingLowEnergy_free a b k L s ha hk hL s.2.1 g) + (fun s g h => expandingLowEnergy_free_inner a b k L s ha hk hL s.2.1 g h) + u r hr f hu t ht + have hhi := expanding_component_derivative a b k L T (6 - 2 * a - k) ha hk hL hT + ((expandingHighEnergy a k L hL).restrictScalars ℝ) + (fun s => (expandingHighEnergy a k (expandingRadius L s) + (hL.trans (expandingRadius_ge L s hL s.2.1))).restrictScalars ℝ) + (fun s g => expandingHighEnergy_free a b k L s ha hk hL s.2.1 g) + (fun s g h => expandingHighEnergy_free_inner a b k L s ha hk hL s.2.1 g h) + u r hr f hu t ht + simp only [ContinuousLinearMap.coe_restrictScalars'] at hlo hhi + convert hlo.add hhi using 1 + · funext τ + exact expandingEnergy_norm_sq a k _ + (hL.trans (expandingRadius_ge L _ hL (projIcc 0 T hT τ).2.1)) _ + · rw [expandingEnergy_inner a k _ + (hL.trans (expandingRadius_ge L _ hL (projIcc 0 T hT t).2.1))] + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMildEnergyBalance.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMildEnergyBalance.lean new file mode 100644 index 0000000000000000000000000000000000000000..a5932f982b1b27f9a2a38077bb75804d4a45a2a2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMildEnergyBalance.lean @@ -0,0 +1,96 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingMildEnergy + +namespace OAI + +/-! # Integrated energy balance on a finite expanding torus slab -/ + +open Set MeasureTheory + +namespace DefocusingNLS + +attribute [local irreducible] expandingLowEnergy expandingHighEnergy expandingFreeStep + expandingFreeInverse expandingInversePath + +theorem continuous_expandingLowEnergy_sq (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) + (u : C(Icc (0 : ℝ) T, FourierL2)) : + Continuous (fun s : Icc (0 : ℝ) T => + ‖expandingLowEnergy a k (expandingRadius L s) + (hL.trans (expandingRadius_ge L s hL s.2.1)) (u s)‖ ^ 2) := by + let v := expandingInversePath a b k L T ha hk hL u + have he (s : Icc (0 : ℝ) T) : + ‖expandingLowEnergy a k (expandingRadius L s) + (hL.trans (expandingRadius_ge L s hL s.2.1)) (u s)‖ ^ 2 = + Real.exp (-a * s) * ‖expandingLowEnergy a k L hL (v s)‖ ^ 2 := by + have hret : expandingFreeStep a b k L s ha hk hL s.2.1 (v s) = u s := + expandingInversePath_return a b k L T ha hk hL u s + simpa only [hret] using expandingLowEnergy_free a b k L s ha hk hL s.2.1 (v s) + simp_rw [he] + exact (Real.continuous_exp.comp (continuous_const.mul continuous_subtype_val)).mul + (((expandingLowEnergy a k L hL).continuous.comp v.continuous).norm.pow 2) + +theorem continuous_expandingHighEnergy_sq (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) + (u : C(Icc (0 : ℝ) T, FourierL2)) : + Continuous (fun s : Icc (0 : ℝ) T => + ‖expandingHighEnergy a k (expandingRadius L s) + (hL.trans (expandingRadius_ge L s hL s.2.1)) (u s)‖ ^ 2) := by + let v := expandingInversePath a b k L T ha hk hL u + have he (s : Icc (0 : ℝ) T) : + ‖expandingHighEnergy a k (expandingRadius L s) + (hL.trans (expandingRadius_ge L s hL s.2.1)) (u s)‖ ^ 2 = + Real.exp ((6 - 2 * a - k) * s) * ‖expandingHighEnergy a k L hL (v s)‖ ^ 2 := by + have hret : expandingFreeStep a b k L s ha hk hL s.2.1 (v s) = u s := + expandingInversePath_return a b k L T ha hk hL u s + simpa only [hret] using expandingHighEnergy_free a b k L s ha hk hL s.2.1 (v s) + simp_rw [he] + exact (Real.continuous_exp.comp (continuous_const.mul continuous_subtype_val)).mul + (((expandingHighEnergy a k L hL).continuous.comp v.continuous).norm.pow 2) + +theorem expandingMildEnergy_balance (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (u : C(Icc (0 : ℝ) T, FourierL2)) (r : ℝ → FourierL2) (hr : Continuous r) + (f : FourierL2) + (hu : ∀ s : Icc (0 : ℝ) T, u s = + expandingFreeStep a b k L s ha hk hL s.2.1 f + + expandingDuhamel a b k L ha hk hL s r) + (t : Icc (0 : ℝ) T) : + ‖u t‖ ^ 2 = ‖f‖ ^ 2 + ∫ τ in (0 : ℝ)..(t : ℝ), + (let s := projIcc 0 T hT τ; + let hR := hL.trans (expandingRadius_ge L s hL s.2.1); + -a * ‖expandingLowEnergy a k (expandingRadius L s) hR (u s)‖ ^ 2 + + (6 - 2 * a - k) * ‖expandingHighEnergy a k (expandingRadius L s) hR (u s)‖ ^ 2 + + 2 * inner ℝ (u s) (r τ)) := by + let p := fun τ => projIcc 0 T hT τ + let F := fun τ => ‖u (p τ)‖ ^ 2 + let D := fun τ => + -a * ‖expandingLowEnergy a k (expandingRadius L (p τ)) + (hL.trans (expandingRadius_ge L (p τ) hL (p τ).2.1)) (u (p τ))‖ ^ 2 + + (6 - 2 * a - k) * ‖expandingHighEnergy a k (expandingRadius L (p τ)) + (hL.trans (expandingRadius_ge L (p τ) hL (p τ).2.1)) (u (p τ))‖ ^ 2 + + 2 * inner ℝ (u (p τ)) (r τ) + have hF : Continuous F := (u.continuous.comp continuous_projIcc).norm.pow 2 + have hD : Continuous D := + ((continuous_const.mul ((continuous_expandingLowEnergy_sq a b k L T ha hk hL u).comp + continuous_projIcc)).add + (continuous_const.mul ((continuous_expandingHighEnergy_sq a b k L T ha hk hL u).comp + continuous_projIcc))).add + (continuous_const.mul ((u.continuous.comp continuous_projIcc).inner hr)) + have hd (τ : ℝ) (hτ : τ ∈ Ioo 0 (t : ℝ)) : HasDerivAt F (D τ) τ := + hasDerivAt_expandingMildEnergy a b k L T ha hk hL hT u r hr f hu τ + ⟨hτ.1, hτ.2.trans_le t.2.2⟩ + have hi := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le t.2.1 hF.continuousOn hd + (hD.intervalIntegrable 0 t) + have hp0 : p 0 = ⟨0, le_rfl, hT⟩ := projIcc_of_mem hT ⟨le_rfl, hT⟩ + have hpt : p t = t := projIcc_of_mem hT t.2 + have hu0 : u ⟨0, le_rfl, hT⟩ = f := by + have h := hu ⟨0, le_rfl, hT⟩ + simpa [expandingFreeStep_zero, expandingDuhamel] using h + change ‖u t‖ ^ 2 = ‖f‖ ^ 2 + ∫ τ in (0 : ℝ)..(t : ℝ), D τ + dsimp only [F] at hi + rw [hp0, hpt, hu0] at hi + linarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMildLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMildLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..8430722d68c318c5ba89ad68d992165ce2a2af14 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMildLimit.lean @@ -0,0 +1,94 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFourierTestLimit +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingDualForcingBound +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousDuhamelDuality +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousFourierTestExt + +namespace OAI + +/-! # Physical limits of bounded expanding mild solutions are whole-space mild solutions -/ + +open Set MeasureTheory Filter Topology +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem expandingMild_physical_limit (a b k t M U G : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (ht : 0 ≤ t) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) + (f u : ℕ → FourierL2) (r : ℕ → ℝ → FourierL2) + (hf : ∀ n, ‖f n‖ ≤ M) (hu : ∀ n, ‖u n‖ ≤ U) + (hr : ∀ n s, s ∈ Icc 0 t → ‖r n s‖ ≤ G) + (hrc : ∀ n, ContinuousOn (r n) (Icc 0 t)) + (hmild : ∀ n, u n = expandingFreeStep a b k (L n) t ha hk (hL n) ht (f n) + + expandingDuhamel a b k (L n) ha hk (hL n) t (r n)) + (v₀ v : HomogeneousY a k) (g : ℝ → HomogeneousY a k) + (hg : StronglyMeasurable g) (hgi : IntegrableOn g (Icc 0 t)) + (hp₀ : ∀ y : E, Tendsto (fun n => expandingPhysicalContinuous a k (L n) + ha ha1 hk (hL n) (f n) y) atTop (𝓝 (homogeneousPhysicalCLM a k ha ha1 hk v₀ y))) + (hp : ∀ y : E, Tendsto (fun n => expandingPhysicalContinuous a k (expandingRadius (L n) t) + ha ha1 hk ((hL n).trans (expandingRadius_ge (L n) t (hL n) ht)) (u n) y) + atTop (𝓝 (homogeneousPhysicalCLM a k ha ha1 hk v y))) + (hpg : ∀ s (hs : s ∈ Icc 0 t) (y : E), + Tendsto (fun n => expandingPhysicalContinuous a k (expandingRadius (L n) s) + ha ha1 hk ((hL n).trans (expandingRadius_ge (L n) s (hL n) hs.1)) (r n s) y) + atTop (𝓝 (homogeneousPhysicalCLM a k ha ha1 hk (g s) y))) : + v = homogeneousFreeOperator a b k t ha ha1 hk v₀ + + homogeneousDuhamel a b k ha ha1 hk t g := by + apply homogeneousFourierPairing_ext a k ha ha1 hk + intro φ + let c : ℂ := ((2 * Real.pi) ^ (12 : ℕ))⁻¹ + let D := fun s => homogeneousFourierPairing a k ha ha1 hk + (homogeneousFreeDualTest a b (t - s) φ) (g s) + let F := fun n => expandingDualDuhamelIntegrand a b k (L n) t ha ha1 hk (hL n) φ (r n) + have h₀ := expandingFourierTest_tendsto_of_physical a k M ha ha1 hk L hL f hf v₀ hp₀ + (homogeneousFreeDualTest a b t φ) + have hv := expandingFourierTest_tendsto_of_physical a k U ha ha1 hk + (fun n => expandingRadius (L n) t) + (fun n => (hL n).trans (expandingRadius_ge (L n) t (hL n) ht)) u hu v hp φ + have hd (s : ℝ) (hs : s ∈ Icc 0 t) : + Tendsto (fun n => F n s) atTop (𝓝 (c * D s)) := by + have h := expandingFourierTest_tendsto_of_physical a k G ha ha1 hk + (fun n => expandingRadius (L n) s) + (fun n => (hL n).trans (expandingRadius_ge (L n) s (hL n) hs.1)) + (fun n => r n s) (fun n => hr n s hs) (g s) (hpg s hs) + (homogeneousFreeDualTest a b (t - s) φ) + simpa only [F, D, c, expandingDualDuhamelIntegrand, dite_eq_left hs] using h + have hI : Tendsto (fun n => ∫ s in Icc 0 t, F n s) atTop + (𝓝 (c * ∫ s in Icc 0 t, D s)) := by + have h := tendsto_integral_of_dominated_convergence + (μ := volume.restrict (Icc 0 t)) + (fun _ => (expandingEmbeddingBound a k * SchwartzMap.seminorm ℂ 0 0 φ) * G) + (fun n => (integrableOn_expandingDualDuhamelIntegrand a b k (L n) t + ha ha1 hk (hL n) ht φ (r n) (hrc n)).aestronglyMeasurable) + (integrableOn_const isCompact_Icc.measure_ne_top) + (fun n => by + filter_upwards [ae_restrict_mem measurableSet_Icc] with s hs + exact expandingDualDuhamelIntegrand_bound a b k (L n) t G + ha ha1 hk (hL n) ht φ (r n) s hs (hr n s hs)) + (by + filter_upwards [ae_restrict_mem measurableSet_Icc] with s hs + exact hd s hs) + simpa only [integral_const_mul] using h + have hsum := h₀.add hI + have hsame : Tendsto (fun n => expandingFourierTest a k (expandingRadius (L n) t) + ha ha1 hk ((hL n).trans (expandingRadius_ge (L n) t (hL n) ht)) φ (u n)) atTop + (𝓝 (c * homogeneousFourierPairing a k ha ha1 hk + (homogeneousFreeDualTest a b t φ) v₀ + c * ∫ s in Icc 0 t, D s)) := by + convert hsum using 1 + funext n + exact expandingMild_fourier_duality a b k (L n) t ha ha1 hk (hL n) ht φ + (f n) (u n) (r n) (hrc n) (hmild n) + have he := tendsto_nhds_unique hv hsame + rw [map_add, homogeneousFreeOperator_fourier_duality, + homogeneousDuhamel_fourier_duality a b k t ha ha1 hk ht φ g hg hgi] + have hc : c ≠ 0 := by + have hp : (2 * (Real.pi : ℂ)) ≠ 0 := by exact_mod_cast Real.two_pi_pos.ne' + exact inv_ne_zero (pow_ne_zero _ hp) + apply mul_left_cancel₀ hc + simpa only [mul_add, c, D] using he + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMildStrong.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMildStrong.lean new file mode 100644 index 0000000000000000000000000000000000000000..350359b17be882f9a09494f25a8ebc1625aa19d9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMildStrong.lean @@ -0,0 +1,65 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPhysicalPath +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingStrongEquation + +namespace OAI + +/-! # The moving-scale mild solution is a strong Sobolev solution + +Pulling back the exact weights identifies the changing spaces with the +radius-one Fourier space. The resulting curve satisfies the physical +Schrödinger equation with the expected two-derivative loss. +-/ + +open Set + +namespace DefocusingNLS + +theorem hasDerivAt_expandingMild_strong (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (u : C(Icc (0 : ℝ) T, FourierL2)) (r : ℝ → FourierL2) (hr : Continuous r) + (u₀ : FourierL2) + (hu : ∀ s : Icc (0 : ℝ) T, u s = + expandingFreeStep a b k L s ha hk hL s.2.1 u₀ + + expandingDuhamel a b k L ha hk hL s r) + (t : ℝ) (ht : t ∈ Ioo 0 T) : + let rC : C(Icc (0 : ℝ) T, FourierL2) := ⟨fun s => r s, hr.comp continuous_subtype_val⟩ + let w := fun s => expandingPhysicalPath a k L T ha hk hL u (projIcc 0 T hT s) + let j := fun s => expandingPhysicalPath a k L T ha hk hL rC (projIcc 0 T hT s) + HasDerivAt (fun s => lowerSobolevInclusion (w s)) (expandingReducedField a b L w j t) t := by + intro rC w j + apply hasDerivAt_expandingReducedField a b L 0 T w j + (((expandingPhysicalPath a k L T ha hk hL u).continuous.comp continuous_projIcc).continuousOn) + (((expandingPhysicalPath a k L T ha hk hL rC).continuous.comp continuous_projIcc).continuousOn) + _ t ht + intro s hs n + let uExt := fun τ => u (projIcc 0 T hT τ) + have hue (τ : ℝ) (hτ : τ ∈ Icc 0 T) : uExt τ = + expandingFreeStep a b k L τ ha hk hL hτ.1 u₀ + + expandingDuhamel a b k L ha hk hL τ r := by + change u (projIcc 0 T hT τ) = _ + rw [projIcc_of_mem _ hτ] + exact hu ⟨τ, hτ⟩ + have hm := hasDerivAt_expandingMild_coefficient a b k L T ha hk hL uExt r u₀ + hr.continuousOn hue s hs n + have hp := hasDerivAt_expandingPhysicalPath_coordinate a k L T ha hk hL hT u s hs n + _ hm + apply hp.congr_deriv + change (expandingSobolevWeight a k 1 n : ℂ) * + (expandingModeRate a b L s n * + expandingFourierCoefficient a k (expandingRadius L s) (uExt s) n + + expandingFourierCoefficient a k (expandingRadius L s) (r s) n) = + expandingModeRate a b L s n * + expandingPhysicalPath a k L T ha hk hL u (projIcc 0 T hT s) n + + expandingPhysicalPath a k L T ha hk hL rC (projIcc 0 T hT s) n + dsimp [uExt] + rw [projIcc_of_mem _ ⟨hs.1.le, hs.2.le⟩, + expandingPhysicalPath_coefficient, expandingPhysicalPath_coefficient] + change (expandingSobolevWeight a k 1 n : ℂ) * (_ * _ + _) = + _ * ((expandingSobolevWeight a k 1 n : ℂ) * _) + + (expandingSobolevWeight a k 1 n : ℂ) * + expandingFourierCoefficient a k (expandingRadius L s) (r s) n + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingModeConverse.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingModeConverse.lean new file mode 100644 index 0000000000000000000000000000000000000000..7b1513b5b5187e27e7a3148618819e0aca7d1359 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingModeConverse.lean @@ -0,0 +1,86 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingModeEquation + +namespace OAI + +/-! # The physical moving-mode equation implies the mild equation -/ + +open Set MeasureTheory + +namespace DefocusingNLS + +theorem hasDerivAt_expandingMode_interaction (a b L t : ℝ) (n : frequencyLattice) + (c r : ℝ → ℂ) + (hc : HasDerivAt c (expandingModeRate a b L t n * c t + r t) t) : + HasDerivAt (fun s => (expandingFreeMode a b L s n)⁻¹ * c s) + ((expandingFreeMode a b L t n)⁻¹ * r t) t := by + have h := ((hasDerivAt_expandingFreeMode a b L t n).inv + (expandingFreeMode_ne_zero a b L t n)).mul hc + apply h.congr_deriv + change -(expandingModeRate a b L t n * expandingFreeMode a b L t n) / + expandingFreeMode a b L t n ^ 2 * c t + + (expandingFreeMode a b L t n)⁻¹ * (expandingModeRate a b L t n * c t + r t) = + (expandingFreeMode a b L t n)⁻¹ * r t + field_simp [expandingFreeMode_ne_zero a b L t n] + ring + +theorem expandingMode_variation_of_constants (a b L T : ℝ) (n : frequencyLattice) + (c r : ℝ → ℂ) (hc : ContinuousOn c (Icc 0 T)) (hr : ContinuousOn r (Icc 0 T)) + (hode : ∀ t ∈ Ioo 0 T, HasDerivAt c (expandingModeRate a b L t n * c t + r t) t) + (t : ℝ) (ht : t ∈ Icc 0 T) : + c t = expandingFreeMode a b L t n * + (c 0 + ∫ s in Icc 0 t, (expandingFreeMode a b L s n)⁻¹ * r s) := by + have hinv : Continuous (fun s => (expandingFreeMode a b L s n)⁻¹) := + (continuous_expandingFreeMode a b L n).inv₀ (expandingFreeMode_ne_zero a b L · n) + have hcont : ContinuousOn (fun s => (expandingFreeMode a b L s n)⁻¹ * c s) (Icc 0 t) := + hinv.continuousOn.mul (hc.mono (Icc_subset_Icc le_rfl ht.2)) + have hint : IntervalIntegrable (fun s => (expandingFreeMode a b L s n)⁻¹ * r s) + volume 0 t := + (hinv.continuousOn.mul (hr.mono (Icc_subset_Icc le_rfl ht.2))).intervalIntegrable_of_Icc ht.1 + have he := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le ht.1 hcont + (fun s hs => hasDerivAt_expandingMode_interaction a b L s n c r + (hode s ⟨hs.1, hs.2.trans_le ht.2⟩)) hint + have hzero : expandingFreeMode a b L 0 n = 1 := by + simp [expandingFreeMode, expandingFreeAmplitude, expandingFreeTime, + schrodingerMultiplier] + rw [hzero, inv_one, one_mul, intervalIntegral.integral_of_le ht.1, + ← integral_Icc_eq_integral_Ioc] at he + have hF := expandingFreeMode_ne_zero a b L t n + calc + c t = expandingFreeMode a b L t n * ((expandingFreeMode a b L t n)⁻¹ * c t) := by + rw [← mul_assoc, mul_inv_cancel₀ hF, one_mul] + _ = _ := by congr 1; exact (sub_eq_iff_eq_add.mp he.symm).trans (add_comm _ _) + +/-- Equality of all physical coefficients identifies the actual vector path. +Only continuity at the slab endpoints is required there. -/ +theorem expandingMild_of_mode_equation (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) + (u r : ℝ → FourierL2) (hu : ContinuousOn u (Icc 0 T)) (hr : ContinuousOn r (Icc 0 T)) + (hode : ∀ t ∈ Ioo 0 T, ∀ n : frequencyLattice, + HasDerivAt (fun s => expandingFourierCoefficient a k (expandingRadius L s) (u s) n) + (expandingModeRate a b L t n * + expandingFourierCoefficient a k (expandingRadius L t) (u t) n + + expandingFourierCoefficient a k (expandingRadius L t) (r t) n) t) + (t : ℝ) (ht : t ∈ Icc 0 T) : + u t = expandingFreeStep a b k L t ha hk hL ht.1 (u 0) + + expandingDuhamel a b k L ha hk hL t r := by + ext n + have hR : 1 ≤ expandingRadius L t := hL.trans (expandingRadius_ge L t hL ht.1) + rw [← weight_mul_expandingFourierCoefficient a k (expandingRadius L t) hR (u t) n, + ← weight_mul_expandingFourierCoefficient a k (expandingRadius L t) hR + (expandingFreeStep a b k L t ha hk hL ht.1 (u 0) + + expandingDuhamel a b k L ha hk hL t r) n] + congr 1 + rw [expandingMild_coefficient a b k L t ha hk hL ht.1 r + (hr.mono (Icc_subset_Icc le_rfl ht.2)) (u 0) n] + have he := expandingMode_variation_of_constants a b L T n + (fun s => expandingFourierCoefficient a k (expandingRadius L s) (u s) n) + (fun s => expandingFourierCoefficient a k (expandingRadius L s) (r s) n) + (continuousOn_expandingPhysicalCoefficient a k L T hL u hu n) + (continuousOn_expandingPhysicalCoefficient a k L T hL r hr n) + (fun s hs => hode s hs n) t ht + have hR0 : expandingRadius L 0 = L := by simp [expandingRadius] + simpa only [hR0] using he + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingModeDuhamel.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingModeDuhamel.lean new file mode 100644 index 0000000000000000000000000000000000000000..be8561e4b828aba9c27209ecc73d7ee8e95b8731 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingModeDuhamel.lean @@ -0,0 +1,100 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingDuhamelRestart +import Mathlib.MeasureTheory.Integral.Bochner.ContinuousLinearMap + +namespace OAI + +/-! # Fourier-mode variation of constants on the moving torus + +The normalized Hilbert-space Duhamel construction has the exact physical +Fourier integrating factor. The Fourier modes refer to fixed `y/L_s`, as +in the manuscript's interpretation of the expanding-torus equation. +-/ + +open Set MeasureTheory + +namespace DefocusingNLS + +noncomputable def expandingFreeMode (a b L s : ℝ) (n : frequencyLattice) : ℂ := + expandingFreeAmplitude a b s * schrodingerMultiplier (expandingFreeTime L s) n + +theorem expandingFreeMode_ne_zero (a b L s : ℝ) (n : frequencyLattice) : + expandingFreeMode a b L s n ≠ 0 := + mul_ne_zero (Complex.exp_ne_zero _) + (Complex.exp_ne_zero _) + +theorem expandingFreeMode_add (a b L s t : ℝ) (hL : 1 ≤ L) (n : frequencyLattice) : + expandingFreeMode a b L (s + t) n = + expandingFreeMode a b L s n * expandingFreeMode a b (expandingRadius L s) t n := by + unfold expandingFreeMode + rw [expandingFreeAmplitude_add, expandingFreeTime_add L s t hL, schrodingerMultiplier_add] + ring + +theorem expandingFreeMode_kernel (a b L s τ : ℝ) (hL : 1 ≤ L) (n : frequencyLattice) : + expandingFreeMode a b (expandingRadius L τ) (s - τ) n = + expandingFreeMode a b L s n * (expandingFreeMode a b L τ n)⁻¹ := by + have h := expandingFreeMode_add a b L τ (s - τ) hL n + rw [add_sub_cancel] at h + apply (eq_mul_inv_iff_mul_eq₀ (expandingFreeMode_ne_zero a b L τ n)).2 + rw [mul_comm, ← h] + +/-- Physical coefficient evaluation at a fixed radius is continuous linear. -/ +noncomputable def expandingCoefficientCLM (a k L : ℝ) (n : frequencyLattice) : + FourierL2 →L[ℂ] ℂ := + (((expandingSobolevWeight a k L n)⁻¹ : ℝ) : ℂ) • + lp.evalCLM ℂ (fun _ : frequencyLattice => ℂ) 2 n + +@[simp] theorem expandingCoefficientCLM_apply (a k L : ℝ) + (n : frequencyLattice) (f : FourierL2) : + expandingCoefficientCLM a k L n f = expandingFourierCoefficient a k L f n := rfl + +/-- The physical Fourier coefficient of Duhamel is its scalar variation of constants. -/ +theorem expandingDuhamel_coefficient (a b k L t : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (r : ℝ → FourierL2) + (hr : ContinuousOn r (Icc 0 t)) (n : frequencyLattice) : + expandingFourierCoefficient a k (expandingRadius L t) + (expandingDuhamel a b k L ha hk hL t r) n = + expandingFreeMode a b L t n * ∫ τ in Icc 0 t, + (expandingFreeMode a b L τ n)⁻¹ * + expandingFourierCoefficient a k (expandingRadius L τ) (r τ) n := by + let E := expandingCoefficientCLM a k (expandingRadius L t) n + have hI := integrableOn_expandingDuhamelIntegrand a b k L ha hk hL t r hr + calc + _ = ∫ τ in Icc 0 t, E (expandingDuhamelIntegrand a b k L ha hk hL t r τ) := + (E.integral_comp_comm hI).symm + _ = ∫ τ in Icc 0 t, expandingFreeMode a b L t n * + ((expandingFreeMode a b L τ n)⁻¹ * + expandingFourierCoefficient a k (expandingRadius L τ) (r τ) n) := by + apply integral_congr_ae + filter_upwards [ae_restrict_mem measurableSet_Icc] with τ hτ + change expandingFourierCoefficient a k (expandingRadius L t) + (expandingDuhamelIntegrand a b k L ha hk hL t r τ) n = _ + rw [expandingDuhamelIntegrand_of_mem _ _ _ _ _ _ _ _ _ _ hτ] + have h := expandingFreeStep_coefficient a b k (expandingRadius L τ) (t - τ) + ha hk (hL.trans (expandingRadius_ge L τ hL hτ.1)) (sub_nonneg.mpr hτ.2) (r τ) n + rw [expandingDuhamel_destination] at h + rw [h] + change expandingFreeMode a b (expandingRadius L τ) (t - τ) n * _ = _ + rw [expandingFreeMode_kernel a b L t τ hL n, mul_assoc] + _ = _ := integral_const_mul _ _ + +/-- Every continuous mild trajectory satisfies the exact modewise integral equation. -/ +theorem expandingMild_coefficient (a b k L t : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (ht : 0 ≤ t) + (r : ℝ → FourierL2) (hr : ContinuousOn r (Icc 0 t)) + (u₀ : FourierL2) (n : frequencyLattice) : + expandingFourierCoefficient a k (expandingRadius L t) + (expandingFreeStep a b k L t ha hk hL ht u₀ + + expandingDuhamel a b k L ha hk hL t r) n = + expandingFreeMode a b L t n * + (expandingFourierCoefficient a k L u₀ n + ∫ τ in Icc 0 t, + (expandingFreeMode a b L τ n)⁻¹ * + expandingFourierCoefficient a k (expandingRadius L τ) (r τ) n) := by + rw [← expandingCoefficientCLM_apply, map_add, expandingCoefficientCLM_apply, + expandingCoefficientCLM_apply, expandingDuhamel_coefficient a b k L t ha hk hL r hr n, + expandingFreeStep_coefficient a b k L t ha hk hL ht u₀ n] + change expandingFreeMode a b L t n * _ + expandingFreeMode a b L t n * _ = _ + exact (mul_add _ _ _).symm + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingModeEquation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingModeEquation.lean new file mode 100644 index 0000000000000000000000000000000000000000..18c288000135af146af0c05093b5c635adbcf648 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingModeEquation.lean @@ -0,0 +1,144 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingModeDuhamel +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPotentialContinuity +import OAI.MathematicalPhysics.DefocusingNLS.Linear.SchrodingerGenerator +import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus + +namespace OAI + +/-! # The actual Fourier-mode equation on an expanding torus + +At fixed normalized torus position, each physical coefficient solves the +Schrödinger equation with the expected frequency factor `L_s⁻² |n|²`. +-/ + +open Set Filter Topology MeasureTheory + +namespace DefocusingNLS + +noncomputable def expandingModeRate (a b L s : ℝ) (n : frequencyLattice) : ℂ := + (-(a : ℂ) + Complex.I * b) - + Complex.I * ((L ^ (-2 : ℝ) * Real.exp (-s) * ‖n‖ ^ 2 : ℝ) : ℂ) + +theorem hasDerivAt_expandingFreeTime (L s : ℝ) : + HasDerivAt (expandingFreeTime L) (L ^ (-2 : ℝ) * Real.exp (-s)) s := by + have h := ((hasDerivAt_const s (1 : ℝ)).sub + (((hasDerivAt_id s).neg).exp)).const_mul (L ^ (-2 : ℝ)) + convert h using 1 + · rfl + · dsimp + ring + +theorem hasDerivAt_expandingFreeAmplitude (a b s : ℝ) : + HasDerivAt (expandingFreeAmplitude a b) + ((-(a : ℂ) + Complex.I * b) * expandingFreeAmplitude a b s) s := by + let C : ℂ := -(a : ℂ) + Complex.I * b + have h : HasDerivAt (fun t : ℝ => Complex.exp (C * (t : ℂ))) + (Complex.exp (C * (s : ℂ)) * C) s := by + simpa only [id_eq, mul_one] using + (((hasDerivAt_id (s : ℂ)).const_mul C).cexp).comp_ofReal + have heq : (fun t : ℝ => Complex.exp (C * (t : ℂ))) = expandingFreeAmplitude a b := by + funext t + unfold expandingFreeAmplitude + congr 1 + dsimp [C] + push_cast + ring + rw [heq] at h + apply h.congr_deriv + have hs : Complex.exp (C * (s : ℂ)) = expandingFreeAmplitude a b s := congrFun heq s + rw [hs] + exact mul_comm _ _ + +theorem hasDerivAt_expandingFreeMode (a b L s : ℝ) (n : frequencyLattice) : + HasDerivAt (fun t => expandingFreeMode a b L t n) + (expandingModeRate a b L s n * expandingFreeMode a b L s n) s := by + have hp := (hasDerivAt_schrodingerMultiplier_mul n 1 (expandingFreeTime L s)).scomp s + (hasDerivAt_expandingFreeTime L s) + simp only [mul_one] at hp + have h := (hasDerivAt_expandingFreeAmplitude a b s).mul hp + convert h using 1 + · rfl + · unfold expandingModeRate expandingFreeMode + simp only [Complex.real_smul, Function.comp_def] + push_cast + ring + +theorem continuous_expandingFreeMode (a b L : ℝ) (n : frequencyLattice) : + Continuous (fun t => expandingFreeMode a b L t n) := + continuous_iff_continuousAt.mpr (fun t => + (hasDerivAt_expandingFreeMode a b L t n).continuousAt) + +/-- Physical coefficient evaluation is jointly continuous in the radius and vector. -/ +theorem continuous_expandingFourierCoefficient (a k : ℝ) (n : frequencyLattice) : + Continuous (fun p : {L : ℝ // 1 ≤ L} × FourierL2 => + expandingFourierCoefficient a k p.1.1 p.2 n) := by + have hL : Continuous (fun p : {L : ℝ // 1 ≤ L} × FourierL2 => p.1.1) := + continuous_subtype_val.comp continuous_fst + have hl : Continuous (fun p : {L : ℝ // 1 ≤ L} × FourierL2 => p.1.1 ^ (2 * a)) := + hL.rpow_const (fun p => Or.inl (ne_of_gt (lt_of_lt_of_le zero_lt_one p.1.2))) + have hh : Continuous (fun p : {L : ℝ // 1 ≤ L} × FourierL2 => p.1.1 ^ (12 - 2 * k)) := + hL.rpow_const (fun p => Or.inl (ne_of_gt (lt_of_lt_of_le zero_lt_one p.1.2))) + have hw : Continuous (fun p : {L : ℝ // 1 ≤ L} × FourierL2 => + expandingSobolevWeight a k p.1.1 n) := by + unfold expandingSobolevWeight expandingSobolevWeightSq + exact continuous_const.mul (Real.continuous_sqrt.comp + ((hl.mul continuous_const).add (hh.mul continuous_const))) + exact (Complex.continuous_ofReal.comp + (hw.inv₀ (fun p => (expandingSobolevWeight_pos a k p.1.1 p.1.2 n).ne'))).mul + ((lp.evalCLM ℂ (fun _ : frequencyLattice => ℂ) 2 n).continuous.comp continuous_snd) + +theorem continuousOn_expandingPhysicalCoefficient (a k L T : ℝ) (hL : 1 ≤ L) + (r : ℝ → FourierL2) (hr : ContinuousOn r (Icc 0 T)) (n : frequencyLattice) : + ContinuousOn (fun t => expandingFourierCoefficient a k (expandingRadius L t) (r t) n) + (Icc 0 T) := by + rw [continuousOn_iff_continuous_domRestrict] + exact (continuous_expandingFourierCoefficient a k n).comp + ((expandingRadiusCurve L T hL).continuous.prodMk hr.domRestrict) + +/-- Differentiating the exact mild formula gives the actual moving Fourier equation. -/ +theorem hasDerivAt_expandingMild_coefficient (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) + (u r : ℝ → FourierL2) (u₀ : FourierL2) (hr : ContinuousOn r (Icc 0 T)) + (hu : ∀ (s : ℝ) (hs : s ∈ Icc 0 T), u s = expandingFreeStep a b k L s ha hk hL hs.1 u₀ + + expandingDuhamel a b k L ha hk hL s r) + (t : ℝ) (ht : t ∈ Ioo 0 T) (n : frequencyLattice) : + HasDerivAt (fun s => expandingFourierCoefficient a k (expandingRadius L s) (u s) n) + (expandingModeRate a b L t n * + expandingFourierCoefficient a k (expandingRadius L t) (u t) n + + expandingFourierCoefficient a k (expandingRadius L t) (r t) n) t := by + let c := expandingFourierCoefficient a k L u₀ n + let f := fun s => (expandingFreeMode a b L s n)⁻¹ * + expandingFourierCoefficient a k (expandingRadius L s) (r s) n + have hf : ContinuousOn f (Icc 0 T) := + ((continuous_expandingFreeMode a b L n).inv₀ + (expandingFreeMode_ne_zero a b L · n)).continuousOn.mul + (continuousOn_expandingPhysicalCoefficient a k L T hL r hr n) + have hI := intervalIntegral.integral_hasDerivAt_right + ((hf.mono (Icc_subset_Icc le_rfl ht.2.le)).intervalIntegrable_of_Icc ht.1.le) + (ContinuousOn.stronglyMeasurableAtFilter isOpen_Ioo (hf.mono Ioo_subset_Icc_self) t ht) + (hf.continuousAt (Icc_mem_nhds ht.1 ht.2)) + have hd := (hasDerivAt_expandingFreeMode a b L t n).mul + ((hasDerivAt_const t c).add hI) + have heq : (fun s => expandingFreeMode a b L s n * (c + ∫ τ in 0..s, f τ)) =ᶠ[𝓝 t] + (fun s => expandingFourierCoefficient a k (expandingRadius L s) (u s) n) := by + filter_upwards [Ioo_mem_nhds ht.1 ht.2] with s hs + rw [hu s ⟨hs.1.le, hs.2.le⟩, + expandingMild_coefficient a b k L s ha hk hL hs.1.le r + (hr.mono (Icc_subset_Icc le_rfl hs.2.le)) u₀ n] + congr 2 + rw [intervalIntegral.integral_of_le hs.1.le, ← integral_Icc_eq_integral_Ioc] + have heqt := heq.eq_of_nhds + apply (hd.congr_of_eventuallyEq heq.symm).congr_deriv + rw [← heqt] + dsimp [f] + have hc : expandingFreeMode a b L t n * + ((expandingFreeMode a b L t n)⁻¹ * + expandingFourierCoefficient a k (expandingRadius L t) (r t) n) = + expandingFourierCoefficient a k (expandingRadius L t) (r t) n := by + rw [← mul_assoc, mul_inv_cancel₀ (expandingFreeMode_ne_zero a b L t n), one_mul] + rw [zero_add, hc] + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMomentCommutator.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMomentCommutator.lean new file mode 100644 index 0000000000000000000000000000000000000000..78ef23ef7215ee6dfdff89ec74f9dda774879641 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMomentCommutator.lean @@ -0,0 +1,45 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProductCommutatorBound +import OAI.MathematicalPhysics.DefocusingNLS.Linear.LatticeMomentAlgebra + +namespace OAI + +/-! # Polynomial moments supply the high-frequency commutator estimate -/ + +namespace DefocusingNLS + +theorem latticeMoment_to_commutator (L : ℝ) (hL : 1 ≤ L) (N : ℕ) + (c : frequencyLattice → ℂ) (hc : Summable (latticeMomentMass L (N + 1) c)) : + Summable (expandingCommutatorMoment L N c) ∧ + (∑' m, expandingCommutatorMoment L N c m) ≤ + 2 ^ N * ∑' m, latticeMomentMass L (N + 1) c m := by + have hpoint (m : frequencyLattice) : expandingCommutatorMoment L N c m ≤ + 2 ^ N * latticeMomentMass L (N + 1) c m := by + have hLp : 0 < L := by linarith + have hr : 0 ≤ ‖m‖ / L := div_nonneg (norm_nonneg _) hLp.le + have hpoly : (‖m‖ / L) * (2 + ‖m‖ / L) ^ N ≤ + 2 ^ N * (1 + ‖m‖ / L) ^ (N + 1) := by + calc + _ ≤ (1 + ‖m‖ / L) * (2 * (1 + ‖m‖ / L)) ^ N := by gcongr <;> linarith + _ = _ := by rw [mul_pow, pow_succ]; ring + have h := mul_le_mul_of_nonneg_left hpoly (norm_nonneg (c m)) + dsimp only [expandingCommutatorMoment, latticeMomentMass, latticeMomentWeight] + convert h using 1 <;> ring + have hs := Summable.of_nonneg_of_le (expandingCommutatorMoment_nonneg L hL N c) + hpoint (hc.mul_left (2 ^ N)) + exact ⟨hs, (hs.tsum_le_tsum hpoint (hc.mul_left _)).trans_eq tsum_mul_left⟩ + +theorem expandingProductCommutator_high_moment (a L R : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < ((N + 1 : ℕ) : ℝ)) + (hL : 1 ≤ L) (hR : 1 ≤ R) (j : Fin (N + 1) → Fin 12) (q f : FourierL2) + (hM : Summable (latticeMomentMass L (N + 1) (expandingFourierCoefficient a (N + 1 : ℕ) L q))) + (hf : ∀ n : frequencyLattice, ‖n‖ < R * L → f n = 0) : + ‖expandingProductCommutator a L (N + 1) ha ha1 hN hL j q f‖ ≤ + ((N + 1 : ℕ) / R) * (2 ^ N * + ∑' m, latticeMomentMass L (N + 1) (expandingFourierCoefficient a (N + 1 : ℕ) L q) m) * ‖f‖ := by + obtain ⟨hs, hb⟩ := latticeMoment_to_commutator L hL N _ hM + exact (expandingProductCommutator_high_norm_le a L R N ha ha1 hN hL hR j q f hs hf).trans + (mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hb (by positivity)) (norm_nonneg f)) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMultiplication.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMultiplication.lean new file mode 100644 index 0000000000000000000000000000000000000000..dbab59e17bd4466abd41611e8e60b9bcadd2c511 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingMultiplication.lean @@ -0,0 +1,95 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingConvolution +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingTorus +import Mathlib.Analysis.Normed.Operator.Bilinear + +namespace OAI + +/-! # The uniform expanding-torus algebra -/ + +namespace DefocusingNLS + +lemma expandingFourierCoefficient_add (a k L : ℝ) (f g : FourierL2) (n : frequencyLattice) : + expandingFourierCoefficient a k L (f + g) n = + expandingFourierCoefficient a k L f n + expandingFourierCoefficient a k L g n := by + simp only [expandingFourierCoefficient, lp.coeFn_add, Pi.add_apply, mul_add] + +lemma expandingFourierCoefficient_smul (a k L : ℝ) (c : ℂ) (f : FourierL2) (n : frequencyLattice) : + expandingFourierCoefficient a k L (c • f) n = c * expandingFourierCoefficient a k L f n := by + simp only [expandingFourierCoefficient, lp.coeFn_smul, Pi.smul_apply, Algebra.smul_def] + simp only [Algebra.algebraMap_self, RingHom.id_apply] + ring + +lemma summable_expandingProductTerms (a k L : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f g : FourierL2) + (n : frequencyLattice) : Summable (fun m => + expandingFourierCoefficient a k L f m * expandingFourierCoefficient a k L g (n - m)) := by + apply Summable.of_norm + simpa only [norm_mul] using summable_norm_expandingProductTerms a k L ha ha1 hk hL f g n + +theorem expandingProduct_comm (a k L : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f g : FourierL2) : + expandingProduct a k L ha ha1 hk hL f g = expandingProduct a k L ha ha1 hk hL g f := by + ext n + change (expandingSobolevWeight a k L n : ℂ) * expandingProductCoefficient a k L f g n = + (expandingSobolevWeight a k L n : ℂ) * expandingProductCoefficient a k L g f n + congr 1 + unfold expandingProductCoefficient + rw [← (Equiv.subLeft n).tsum_eq (fun m => + expandingFourierCoefficient a k L f m * expandingFourierCoefficient a k L g (n - m))] + simp only [Equiv.subLeft_apply, sub_sub_cancel, mul_comm] + +theorem expandingProduct_add_left (a k L : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f g h : FourierL2) : + expandingProduct a k L ha ha1 hk hL (f + g) h = expandingProduct a k L ha ha1 hk hL f h + expandingProduct a k L ha ha1 hk hL g h := by + ext n + change (expandingSobolevWeight a k L n : ℂ) * expandingProductCoefficient a k L (f + g) h n = + (expandingSobolevWeight a k L n : ℂ) * expandingProductCoefficient a k L f h n + + (expandingSobolevWeight a k L n : ℂ) * expandingProductCoefficient a k L g h n + unfold expandingProductCoefficient + simp only [expandingFourierCoefficient_add, add_mul] + rw [(summable_expandingProductTerms a k L ha ha1 hk hL f h n).tsum_add + (summable_expandingProductTerms a k L ha ha1 hk hL g h n)] + ring + +theorem expandingProduct_smul_left (a k L : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (c : ℂ) (f g : FourierL2) : + expandingProduct a k L ha ha1 hk hL (c • f) g = c • expandingProduct a k L ha ha1 hk hL f g := by + ext n + change (expandingSobolevWeight a k L n : ℂ) * expandingProductCoefficient a k L (c • f) g n = + c * ((expandingSobolevWeight a k L n : ℂ) * expandingProductCoefficient a k L f g n) + unfold expandingProductCoefficient + simp only [expandingFourierCoefficient_smul, mul_assoc, tsum_mul_left] + ring + +theorem expandingProduct_add_right (a k L : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f g h : FourierL2) : + expandingProduct a k L ha ha1 hk hL f (g + h) = expandingProduct a k L ha ha1 hk hL f g + expandingProduct a k L ha ha1 hk hL f h := by + rw [expandingProduct_comm a k L ha ha1 hk hL f (g + h), expandingProduct_add_left, + expandingProduct_comm a k L ha ha1 hk hL g f, expandingProduct_comm a k L ha ha1 hk hL h f] + +theorem expandingProduct_smul_right (a k L : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (c : ℂ) (f g : FourierL2) : + expandingProduct a k L ha ha1 hk hL f (c • g) = c • expandingProduct a k L ha ha1 hk hL f g := by + rw [expandingProduct_comm a k L ha ha1 hk hL f (c • g), expandingProduct_smul_left, expandingProduct_comm a k L ha ha1 hk hL g f] + +/-- The exact `Y_L` product is continuous bilinear, with norm bounded independently of `L`. -/ +noncomputable def expandingBilinearProduct (a k L : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) : + FourierL2 →L[ℂ] FourierL2 →L[ℂ] FourierL2 := + (LinearMap.mk₂ ℂ (expandingProduct a k L ha ha1 hk hL) + (expandingProduct_add_left a k L ha ha1 hk hL) (expandingProduct_smul_left a k L ha ha1 hk hL) + (expandingProduct_add_right a k L ha ha1 hk hL) (expandingProduct_smul_right a k L ha ha1 hk hL)).mkContinuous₂ + (2 * Real.sqrt (4 ^ k) * expandingEmbeddingBound a k) (expandingProduct_norm_le a k L ha ha1 hk hL) + +@[simp] theorem expandingBilinearProduct_apply (a k L : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f g : FourierL2) : + expandingBilinearProduct a k L ha ha1 hk hL f g = expandingProduct a k L ha ha1 hk hL f g := rfl + +/-- The uniform algebra product agrees with the product of represented functions. -/ +theorem expandingTorusFunction_product (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f g : FourierL2) : + expandingTorusFunction a k L (expandingProduct a k L ha ha1 hk hL f g) = + expandingTorusFunction a k L f * expandingTorusFunction a k L g := by + ext x + simp only [ContinuousMap.mul_apply, expandingTorusFunction_apply a k L ha ha1 hk hL, + expandingProduct_coefficient] + exact (tsum_fourier_product (expandingFourierCoefficient a k L f) + (expandingFourierCoefficient a k L g) + (summable_norm_expandingFourierCoefficient a k L ha ha1 hk hL f) + (summable_norm_expandingFourierCoefficient a k L ha ha1 hk hL g) x).symm + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingNearbyTransfer.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingNearbyTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e92418a8769fd34ba71dfa4382479899502a82b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingNearbyTransfer.lean @@ -0,0 +1,97 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingWeightIdentification + +namespace OAI + +/-! # Uniform transfer between nearby expanding radii -/ + +open scoped ENNReal + +namespace DefocusingNLS + +noncomputable def expandingNearbyTransfer (a k : ℝ) (ha : 0 < a) (hk : 8 < k) + (L M : {R : ℝ // 1 ≤ R}) : FourierL2 →L[ℂ] FourierL2 := + (expandingScaleTransfer a k 1 M.1 ha hk le_rfl M.2).comp + (expandingInverseTransfer a k L.1 ha hk L.2) + +theorem expandingNearbyTransfer_apply (a k : ℝ) (ha : 0 < a) (hk : 8 < k) + (L M : {R : ℝ // 1 ≤ R}) (f : FourierL2) (n : frequencyLattice) : + expandingNearbyTransfer a k ha hk L M f n = + (expandingSobolevWeight a k M.1 n / expandingSobolevWeight a k L.1 n : ℝ) * f n := by + change (expandingScaleRatio a k 1 M.1 n : ℂ) * + ((expandingInverseRatio a k L.1 n : ℂ) * f n) = _ + unfold expandingScaleRatio expandingInverseRatio + push_cast + have hp := Complex.ofReal_ne_zero.mpr (expandingSobolevWeight_pos a k 1 le_rfl n).ne' + field_simp + +private theorem weight_nearby_bound (a k : ℝ) (ha : 0 < a) (hk : 8 < k) + (L M : {R : ℝ // 1 ≤ R}) (hML : M.1 ≤ 2 * L.1) (hLM : L.1 ≤ 2 * M.1) + (n : frequencyLattice) : + expandingSobolevWeight a k M.1 n ≤ + (2 ^ a + 2 ^ (k - 6)) * expandingSobolevWeight a k L.1 n := by + have hLp : 0 < L.1 := lt_of_lt_of_le zero_lt_one L.2 + have hMp : 0 < M.1 := lt_of_lt_of_le zero_lt_one M.2 + let C : ℝ := 2 ^ a + 2 ^ (k - 6) + have hC : 0 ≤ C := by dsimp [C]; positivity + have hlo : M.1 ^ a ≤ C * L.1 ^ a := by + calc + _ ≤ (2 * L.1) ^ a := Real.rpow_le_rpow hMp.le hML ha.le + _ = 2 ^ a * L.1 ^ a := Real.mul_rpow (by norm_num) hLp.le + _ ≤ C * L.1 ^ a := by dsimp [C]; nlinarith [Real.rpow_pos_of_pos (by norm_num : (0 : ℝ) < 2) (k - 6), Real.rpow_pos_of_pos hLp a] + have hhi : M.1 ^ (6 - k) ≤ C * L.1 ^ (6 - k) := by + have hcomp := Real.rpow_le_rpow_of_nonpos (by positivity : 0 < L.1 / 2) + (show L.1 / 2 ≤ M.1 by linarith) (by linarith : 6 - k ≤ 0) + have hid : (L.1 / 2) ^ (6 - k) = 2 ^ (k - 6) * L.1 ^ (6 - k) := by + rw [Real.div_rpow hLp.le (by norm_num), div_eq_inv_mul, + ← Real.rpow_neg (by norm_num : (0 : ℝ) ≤ 2)] + congr 1 + ring_nf + calc + _ ≤ (L.1 / 2) ^ (6 - k) := hcomp + _ = 2 ^ (k - 6) * L.1 ^ (6 - k) := hid + _ ≤ C * L.1 ^ (6 - k) := by dsimp [C]; nlinarith [Real.rpow_pos_of_pos (by norm_num : (0 : ℝ) < 2) a, Real.rpow_pos_of_pos hLp (6 - k)] + have sqr (R : ℝ) (hR : 0 ≤ R) (s : ℝ) : (R ^ s) ^ 2 = R ^ (2 * s) := by + rw [← Real.rpow_natCast, ← Real.rpow_mul hR] + congr 1 + ring_nf + have hs : expandingSobolevWeightSq a k M.1 n ≤ C ^ 2 * expandingSobolevWeightSq a k L.1 n := by + unfold expandingSobolevWeightSq + have hl := pow_le_pow_left₀ (Real.rpow_nonneg hMp.le a) hlo 2 + have hh := pow_le_pow_left₀ (Real.rpow_nonneg hMp.le (6 - k)) hhi 2 + rw [mul_pow, sqr M.1 hMp.le a, sqr L.1 hLp.le a] at hl + rw [mul_pow, sqr M.1 hMp.le (6 - k), sqr L.1 hLp.le (6 - k)] at hh + rw [show 2 * (6 - k) = 12 - 2 * k by ring] at hh + calc + _ ≤ C ^ 2 * L.1 ^ (2 * a) * (1 + ‖n‖ ^ 2) ^ (6 - a) + + C ^ 2 * L.1 ^ (12 - 2 * k) * ‖n‖ ^ (2 * k) := + add_le_add (mul_le_mul_of_nonneg_right hl (by positivity)) + (mul_le_mul_of_nonneg_right hh (by positivity)) + _ = _ := by ring + have hroot := Real.sqrt_le_sqrt hs + rw [Real.sqrt_mul (sq_nonneg C), Real.sqrt_sq hC] at hroot + simpa only [expandingSobolevWeight, mul_left_comm, mul_assoc] using + mul_le_mul_of_nonneg_left hroot (by positivity : 0 ≤ (2 * Real.pi) ^ 6) + +theorem expandingNearbyTransfer_norm_le (a k : ℝ) (ha : 0 < a) (hk : 8 < k) + (L M : {R : ℝ // 1 ≤ R}) (hML : M.1 ≤ 2 * L.1) (hLM : L.1 ≤ 2 * M.1) : + ‖expandingNearbyTransfer a k ha hk L M‖ ≤ 2 ^ a + 2 ^ (k - 6) := by + let C : ℝ := 2 ^ a + 2 ^ (k - 6) + have hC : 0 ≤ C := by dsimp [C]; positivity + apply ContinuousLinearMap.opNorm_le_bound _ hC + intro f + calc + _ ≤ ‖C • f‖ := by + apply lp.norm_mono (by norm_num : (2 : ℝ≥0∞) ≠ 0) + intro n + rw [expandingNearbyTransfer_apply, norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (div_nonneg (expandingSobolevWeight_pos a k M.1 M.2 n).le + (expandingSobolevWeight_pos a k L.1 L.2 n).le)] + simp only [lp.coeFn_smul, Pi.smul_apply, norm_smul, Real.norm_eq_abs, abs_of_nonneg hC] + apply mul_le_mul_of_nonneg_right _ (norm_nonneg _) + exact (div_le_iff₀ (expandingSobolevWeight_pos a k L.1 L.2 n)).mpr + (weight_nearby_bound a k ha hk L M hML hLM n) + _ = C * ‖f‖ := by rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg hC] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingNonlinearStepError.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingNonlinearStepError.lean new file mode 100644 index 0000000000000000000000000000000000000000..dffed7a53a865e91061c7fab307058ad82edfb9d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingNonlinearStepError.lean @@ -0,0 +1,72 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPerturbationReaction + +namespace OAI + +/-! # Quadratic deviation from the actual linearized evolution + +On a fixed finite slab, a bounded nonlinear perturbation differs from its +linearized evolution by the quadratic Taylor term and the profile defect. +This is the quantitative comparison part of the manuscript's `nl:step`. +-/ + +open Set + +namespace DefocusingNLS + +attribute [local irreducible] expandingFreeStep + +theorem expandingPerturbation_linear_mild (a b k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) (m : ℕ) + (q g v : C(Icc (0 : ℝ) T, FourierL2)) (v₀ : FourierL2) + (hv : v = expandingPicard a b k L T ha hk hL hT + (expandingPerturbationReaction a k L T ha ha1 hk hL m q g) v₀ v) : + ∀ t : Icc (0 : ℝ) T, v t = + expandingFreeStep a b k L t ha hk hL t.2.1 v₀ + + expandingDuhamel a b k L ha hk hL t + (expandingReactionHistory T hT + (expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q + (expandingPerturbationSource a k L T ha ha1 hk hL m q g v)) v) := by + have he : expandingReactionHistory T hT + (expandingPerturbationReaction a k L T ha ha1 hk hL m q g) v = + expandingReactionHistory T hT + (expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q + (expandingPerturbationSource a k L T ha ha1 hk hL m q g v)) v := by + funext τ + exact expandingPerturbationReaction_split a k L T ha ha1 hk hL m q g v + (projIcc 0 T hT τ) + intro t + have h := congrArg (fun w : C(Icc (0 : ℝ) T, FourierL2) => w t) hv + change v t = expandingFreeStep a b k L t ha hk hL t.2.1 v₀ + + expandingDuhamel a b k L ha hk hL t + (expandingReactionHistory T hT + (expandingPerturbationReaction a k L T ha ha1 hk hL m q g) v) at h + rwa [he] at h + +/-- The comparison constant is independent of the starting radius. The +perturbation is an actual nonlinear mild solution, not an abstract error. -/ +theorem exists_expandingNonlinearStep_quadratic_error (a b k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) (R : ℝ) (hR : 0 ≤ R) : + ∃ K C : ℝ, 0 ≤ K ∧ 0 ≤ C ∧ ∀ (L T : ℝ) (hL : 1 ≤ L) (hT : 0 ≤ T) + (q g v w : C(Icc (0 : ℝ) T, FourierL2)) (v₀ : FourierL2) (d G : ℝ), + 0 ≤ d → d ≤ 1 → 0 ≤ G → (∀ t, ‖q t‖ ≤ R) → (∀ t, ‖g t‖ ≤ G) → + (∀ t, ‖v t‖ ≤ d) → + v = expandingPicard a b k L T ha hk hL hT + (expandingPerturbationReaction a k L T ha ha1 hk hL m q g) v₀ v → + (∀ t : Icc (0 : ℝ) T, w t = + expandingFreeStep a b k L t ha hk hL t.2.1 v₀ + + expandingDuhamel a b k L ha hk hL t + (expandingReactionHistory T hT + (expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q 0) w)) → + dist v w ≤ Real.exp ((K + 1) * T) * (C * d ^ 2 + G) := by + obtain ⟨K, hK, hresponse⟩ := exists_expandingProfile_response_bound a b k ha ha1 hk m R hR + obtain ⟨C, hC, hsource⟩ := exists_expandingPerturbationSource_bound a k ha ha1 hk m R hR + refine ⟨K, C, hK, hC, ?_⟩ + intro L T hL hT q g v w v₀ d G hd hd1 hG hq hg hv hvsol hwsol + exact hresponse L T hL hT q + (expandingPerturbationSource a k L T ha ha1 hk hL m q g v) v₀ (C * d ^ 2 + G) + (by positivity) hq (hsource L T hL q g v d G hd hd1 hG hq hg hv) v w + (expandingPerturbation_linear_mild a b k L T ha ha1 hk hL hT m q g v v₀ hvsol) hwsol + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingNonlinearStrong.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingNonlinearStrong.lean new file mode 100644 index 0000000000000000000000000000000000000000..723cf8cfa722c117630dc6c43aec7e54201b803f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingNonlinearStrong.lean @@ -0,0 +1,78 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingResidualStability +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingMildStrong + +namespace OAI + +/-! # The actual nonlinear mild trajectory satisfies the strong equation + +The coefficient-preserving inverse weight map intertwines the nonlinearities. +The resulting fixed-space curve has its strong derivative with two fewer +Sobolev derivatives, exactly as the linear and forced curves do. +-/ + +open Set + +namespace DefocusingNLS + +attribute [local irreducible] expandingFreeStep + +theorem expandingInverseTransfer_oddPower (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (m : ℕ) + (f : FourierL2) : + expandingInverseTransfer a k L ha hk hL (expandingOddPower a k L ha ha1 hk hL m f) = + expandingOddPower a k 1 ha ha1 hk le_rfl m + (expandingInverseTransfer a k L ha hk hL f) := by + rw [expandingOddPower_transport a k L ha ha1 hk hL m f] + exact congrArg (fun A : FourierL2 →L[ℂ] FourierL2 => + A (expandingOddPower a k 1 ha ha1 hk le_rfl m + (expandingInverseTransfer a k L ha hk hL f))) + (expandingWeightUnit a k L ha hk hL).inv_val + +theorem hasDerivAt_expandingNonlinearMild (a b k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (m : ℕ) (u : C(Icc (0 : ℝ) T, FourierL2)) (u₀ : FourierL2) + (hu : u = expandingPicard a b k L T ha hk hL hT + (expandingNonlinearReaction a k L T ha ha1 hk hL m) u₀ u) + (t : ℝ) (ht : t ∈ Ioo 0 T) : + let w := fun s => expandingPhysicalPath a k L T ha hk hL u (projIcc 0 T hT s) + HasDerivAt (fun s => lowerSobolevInclusion (w s)) + ((-(a : ℂ) + Complex.I * b) • lowerSobolevInclusion (w t) + + (L ^ (-2 : ℝ) * Real.exp (-t)) • lowerSobolevGenerator (w t) + + (-Complex.I) • lowerSobolevInclusion + (expandingOddPower a k 1 ha ha1 hk le_rfl m (w t))) t := by + intro w + let F := expandingNonlinearReaction a k L T ha ha1 hk hL m + let r := expandingReactionHistory T hT F u + have hr : Continuous r := continuous_expandingReactionHistory T hT F u + have hu' (s : Icc (0 : ℝ) T) : u s = + expandingFreeStep a b k L s ha hk hL s.2.1 u₀ + + expandingDuhamel a b k L ha hk hL s r := + congrArg (fun v : C(Icc (0 : ℝ) T, FourierL2) => v s) hu + have hs := hasDerivAt_expandingMild_strong a b k L T ha hk hL hT u r hr u₀ hu' t ht + let rC : C(Icc (0 : ℝ) T, FourierL2) := ⟨fun s => r s, hr.comp continuous_subtype_val⟩ + let j := fun s => expandingPhysicalPath a k L T ha hk hL rC (projIcc 0 T hT s) + change HasDerivAt (fun s => lowerSobolevInclusion (w s)) + (expandingReducedField a b L w j t) t at hs + have hj : j t = (-Complex.I) • expandingOddPower a k 1 ha ha1 hk le_rfl m (w t) := by + let s := projIcc 0 T hT t + have hp : projIcc 0 T hT (s : ℝ) = s := projIcc_of_mem _ s.2 + have hR : 1 ≤ expandingRadius L s := hL.trans (expandingRadius_ge L s hL s.2.1) + change expandingInverseTransfer a k (expandingRadius L s) ha hk + hR (r s) = _ + change expandingInverseTransfer a k (expandingRadius L s) ha hk + hR + (F (projIcc 0 T hT s, u (projIcc 0 T hT s))) = _ + rw [hp] + change expandingInverseTransfer a k (expandingRadius L s) ha hk + hR + ((-Complex.I) • expandingOddPower a k (expandingRadius L s) ha ha1 hk + hR m (u s)) = _ + rw [map_smul, expandingInverseTransfer_oddPower a k (expandingRadius L s) ha ha1 hk hR m (u s)] + rfl + unfold expandingReducedField at hs + rw [hj, map_smul] at hs + exact hs + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingNonlinearity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingNonlinearity.lean new file mode 100644 index 0000000000000000000000000000000000000000..eaeb731086e4925dc0c1976eb86f6d0a3b69060d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingNonlinearity.lean @@ -0,0 +1,124 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingMultiplication +import OAI.MathematicalPhysics.DefocusingNLS.Linear.SobolevNonlinearity + +namespace OAI + +/-! # The actual odd-power map on the expanding-torus norm -/ + +open scoped ComplexConjugate + +namespace DefocusingNLS + +theorem expandingFourierCoefficient_conjugate (a k L : ℝ) (f : FourierL2) + (n : frequencyLattice) : + expandingFourierCoefficient a k L (fourierConjugate f) n = + conj (expandingFourierCoefficient a k L f (-n)) := by + have hw : expandingSobolevWeight a k L (-n) = expandingSobolevWeight a k L n := by + simp [expandingSobolevWeight, expandingSobolevWeightSq] + simp only [expandingFourierCoefficient, fourierConjugate_apply, map_mul, + Complex.conj_ofReal, hw] + +theorem expandingTorusFunction_conjugate (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (f : FourierL2) (x : SchrodingerTorus) : + expandingTorusFunction a k L (fourierConjugate f) x = + conj (expandingTorusFunction a k L f x) := by + rw [expandingTorusFunction_apply a k L ha ha1 hk hL, + expandingTorusFunction_apply a k L ha ha1 hk hL, Complex.conj_tsum, + ← (Equiv.neg frequencyLattice).tsum_eq + (fun n => expandingFourierCoefficient a k L (fourierConjugate f) n * torusCharacter n x)] + simp only [Equiv.neg_apply, expandingFourierCoefficient_conjugate, neg_neg, + torusCharacter_neg, map_mul] + +noncomputable def expandingRealBilinearProduct (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) : + FourierL2 →L[ℝ] FourierL2 →L[ℝ] FourierL2 := + (expandingBilinearProduct a k L ha ha1 hk hL).bilinearRestrictScalars ℝ + +@[simp] theorem expandingRealBilinearProduct_apply (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f g : FourierL2) : + expandingRealBilinearProduct a k L ha ha1 hk hL f g = + expandingProduct a k L ha ha1 hk hL f g := rfl + +noncomputable def expandingAlgebraBound (a k : ℝ) : ℝ := + 2 * Real.sqrt (4 ^ k) * expandingEmbeddingBound a k + +theorem expandingAlgebraBound_nonneg (a k : ℝ) : 0 ≤ expandingAlgebraBound a k := by + unfold expandingAlgebraBound expandingEmbeddingBound + positivity + +theorem expandingRealBilinearProduct_norm_le (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) : + ‖expandingRealBilinearProduct a k L ha ha1 hk hL‖ ≤ expandingAlgebraBound a k := by + apply ContinuousLinearMap.opNorm_le_bound₂ _ (expandingAlgebraBound_nonneg a k) + intro f g + exact expandingProduct_norm_le a k L ha ha1 hk hL f g + +/-- The Fourier realization of the scalar polynomial `|u|^(2m) u`. -/ +noncomputable def expandingOddPower (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) : + ℕ → FourierL2 → FourierL2 + | 0, f => f + | m + 1, f => expandingProduct a k L ha ha1 hk hL + (expandingProduct a k L ha ha1 hk hL + (expandingOddPower a k L ha ha1 hk hL m f) (fourierConjugate f)) f + +theorem expandingOddPower_apply (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (m : ℕ) + (f : FourierL2) (x : SchrodingerTorus) : + expandingTorusFunction a k L (expandingOddPower a k L ha ha1 hk hL m f) x = + oddPowerNonlinearity m (expandingTorusFunction a k L f x) := by + induction m with + | zero => simp [expandingOddPower, oddPowerNonlinearity] + | succ m ih => + simp only [expandingOddPower, expandingTorusFunction_product a k L ha ha1 hk hL, + ContinuousMap.mul_apply, expandingTorusFunction_conjugate a k L ha ha1 hk hL, ih] + simp only [oddPowerNonlinearity, pow_succ, starRingEnd_apply] + ring + +/-- The expanding-torus nonlinearity is smooth as a real Banach-space map. -/ +theorem contDiff_expandingOddPower (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (m : ℕ) : + ContDiff ℝ ⊤ (expandingOddPower a k L ha ha1 hk hL m) := by + induction m with + | zero => exact contDiff_id + | succ m ih => + have hconj : ContDiff ℝ ⊤ (fourierConjugate : FourierL2 → FourierL2) := + sobolevConjugation.contDiff + exact ((expandingRealBilinearProduct a k L ha ha1 hk hL).contDiff.comp + (((expandingRealBilinearProduct a k L ha ha1 hk hL).contDiff.comp ih).clm_apply + hconj)).clm_apply contDiff_id + +/-- Polynomial growth has a constant independent of the expanding radius. -/ +theorem norm_expandingOddPower_le (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (m : ℕ) (f : FourierL2) : + ‖expandingOddPower a k L ha ha1 hk hL m f‖ ≤ + expandingAlgebraBound a k ^ (2 * m) * ‖f‖ ^ (2 * m + 1) := by + let C := expandingAlgebraBound a k + have hC : 0 ≤ C := expandingAlgebraBound_nonneg a k + have hprod (u v : FourierL2) : + ‖expandingProduct a k L ha ha1 hk hL u v‖ ≤ C * ‖u‖ * ‖v‖ := + expandingProduct_norm_le a k L ha ha1 hk hL u v + induction m with + | zero => simp [expandingOddPower] + | succ m ih => + change ‖expandingProduct a k L ha ha1 hk hL + (expandingProduct a k L ha ha1 hk hL + (expandingOddPower a k L ha ha1 hk hL m f) (fourierConjugate f)) f‖ ≤ _ + calc + _ ≤ C * ‖expandingProduct a k L ha ha1 hk hL + (expandingOddPower a k L ha ha1 hk hL m f) (fourierConjugate f)‖ * ‖f‖ := hprod _ _ + _ ≤ C * (C * ‖expandingOddPower a k L ha ha1 hk hL m f‖ * ‖f‖) * ‖f‖ := by + gcongr + simpa only [fourierConjugate_norm] using + hprod (expandingOddPower a k L ha ha1 hk hL m f) (fourierConjugate f) + _ ≤ C * (C * (C ^ (2 * m) * ‖f‖ ^ (2 * m + 1)) * ‖f‖) * ‖f‖ := by gcongr + _ = _ := by + change C * (C * (C ^ (2 * m) * ‖f‖ ^ (2 * m + 1)) * ‖f‖) * ‖f‖ = + C ^ (2 * (m + 1)) * ‖f‖ ^ (2 * (m + 1) + 1) + simp only [Nat.mul_add, Nat.mul_one, pow_succ] + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingNonlinearityTransport.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingNonlinearityTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..299c09b67030cd6b54afd2e73b234d14d30a13b3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingNonlinearityTransport.lean @@ -0,0 +1,140 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingWeightIdentification +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingDerivativeBounds + +namespace OAI + +/-! # Continuity of the actual polynomial at a varying torus scale + +The coefficient-preserving identification intertwines the exact Fourier +products and conjugation. Thus the varying-scale nonlinearity is conjugate +to the already smooth radius-one polynomial. +-/ + +open scoped ComplexConjugate + +namespace DefocusingNLS + +private theorem coefficient_injective (a k L : ℝ) (hL : 1 ≤ L) : + Function.Injective (expandingFourierCoefficient a k L) := by + intro f g h + ext n + simpa only [weight_mul_expandingFourierCoefficient a k L hL] using + congrArg (fun z : ℂ => (expandingSobolevWeight a k L n : ℂ) * z) (congrFun h n) + +theorem expandingScaleTransfer_product (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f g : FourierL2) : + expandingScaleTransfer a k 1 L ha hk le_rfl hL + (expandingProduct a k 1 ha ha1 hk le_rfl f g) = + expandingProduct a k L ha ha1 hk hL + (expandingScaleTransfer a k 1 L ha hk le_rfl hL f) + (expandingScaleTransfer a k 1 L ha hk le_rfl hL g) := by + apply coefficient_injective a k L hL + funext n + rw [expandingScaleTransfer_coefficient, expandingProduct_coefficient, + expandingProduct_coefficient] + unfold expandingProductCoefficient + apply tsum_congr + intro j + rw [expandingScaleTransfer_coefficient, expandingScaleTransfer_coefficient] + +theorem expandingScaleTransfer_conjugate (a k L : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) : + expandingScaleTransfer a k 1 L ha hk le_rfl hL (fourierConjugate f) = + fourierConjugate (expandingScaleTransfer a k 1 L ha hk le_rfl hL f) := by + apply coefficient_injective a k L hL + funext n + rw [expandingScaleTransfer_coefficient, expandingFourierCoefficient_conjugate, + expandingFourierCoefficient_conjugate, expandingScaleTransfer_coefficient] + +theorem expandingScaleTransfer_oddPower (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (m : ℕ) (f : FourierL2) : + expandingScaleTransfer a k 1 L ha hk le_rfl hL + (expandingOddPower a k 1 ha ha1 hk le_rfl m f) = + expandingOddPower a k L ha ha1 hk hL m + (expandingScaleTransfer a k 1 L ha hk le_rfl hL f) := by + induction m with + | zero => rfl + | succ m ih => + simp only [expandingOddPower, expandingScaleTransfer_product, + expandingScaleTransfer_conjugate, ih] + +private theorem transfer_inverse_apply (a k L : ℝ) (ha : 0 < a) (hk : 8 < k) + (hL : 1 ≤ L) (f : FourierL2) : + expandingScaleTransfer a k 1 L ha hk le_rfl hL + (expandingInverseTransfer a k L ha hk hL f) = f := by + have h := (expandingWeightUnit a k L ha hk hL).val_inv + exact congrArg (fun A : FourierL2 →L[ℂ] FourierL2 => A f) h + +/-- Exact conjugation of the actual polynomial by the weight identification. -/ +theorem expandingOddPower_transport (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (m : ℕ) (f : FourierL2) : + expandingOddPower a k L ha ha1 hk hL m f = + expandingScaleTransfer a k 1 L ha hk le_rfl hL + (expandingOddPower a k 1 ha ha1 hk le_rfl m + (expandingInverseTransfer a k L ha hk hL f)) := by + rw [expandingScaleTransfer_oddPower, transfer_inverse_apply] + +/-- The polynomial is jointly continuous in scale and input in the exact norms. -/ +theorem continuous_expandingOddPower_scale (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) : + Continuous (fun p : {L : ℝ // 1 ≤ L} × FourierL2 => + expandingOddPower a k p.1.1 ha ha1 hk p.1.2 m p.2) := by + have heq : (fun p : {L : ℝ // 1 ≤ L} × FourierL2 => + expandingOddPower a k p.1.1 ha ha1 hk p.1.2 m p.2) = + (fun p => expandingScaleTransfer a k 1 p.1.1 ha hk le_rfl p.1.2 + (expandingOddPower a k 1 ha ha1 hk le_rfl m + (expandingInverseTransfer a k p.1.1 ha hk p.1.2 p.2))) := + funext (fun p => expandingOddPower_transport a k p.1.1 ha ha1 hk p.1.2 m p.2) + rw [heq] + exact ((continuous_expandingScaleTransfer_from_one a k ha hk).comp continuous_fst).clm_apply + ((contDiff_expandingOddPower a k 1 ha ha1 hk le_rfl m).continuous.comp + (((continuous_expandingInverseTransfer a k ha hk).comp continuous_fst).clm_apply + continuous_snd)) + +/-- The linearization is the derivative of the same conjugated polynomial. -/ +theorem fderiv_expandingOddPower_transport (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (m : ℕ) (q v : FourierL2) : + fderiv ℝ (expandingOddPower a k L ha ha1 hk hL m) q v = + expandingScaleTransfer a k 1 L ha hk le_rfl hL + (fderiv ℝ (expandingOddPower a k 1 ha ha1 hk le_rfl m) + (expandingInverseTransfer a k L ha hk hL q) + (expandingInverseTransfer a k L ha hk hL v)) := by + let T := (expandingScaleTransfer a k 1 L ha hk le_rfl hL).restrictScalars ℝ + let S := (expandingInverseTransfer a k L ha hk hL).restrictScalars ℝ + have hN := (contDiff_expandingOddPower a k 1 ha ha1 hk le_rfl m).differentiable + (by simp) (S q) + have h := T.hasFDerivAt.comp q (hN.hasFDerivAt.comp q S.hasFDerivAt) + have heq : (fun x => T (expandingOddPower a k 1 ha ha1 hk le_rfl m (S x))) = + expandingOddPower a k L ha ha1 hk hL m := by + funext x + exact (expandingOddPower_transport a k L ha ha1 hk hL m x).symm + simp only [Function.comp_def] at h + rw [heq] at h + exact congrArg (fun A : FourierL2 →L[ℝ] FourierL2 => A v) h.fderiv + +/-- Joint strong continuity of the actual linearized potential in scale, profile and input. -/ +theorem continuous_expandingLinearization_scale (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) : + Continuous (fun p : {L : ℝ // 1 ≤ L} × (FourierL2 × FourierL2) => + fderiv ℝ (expandingOddPower a k p.1.1 ha ha1 hk p.1.2 m) p.2.1 p.2.2) := by + have heq : (fun p : {L : ℝ // 1 ≤ L} × (FourierL2 × FourierL2) => + fderiv ℝ (expandingOddPower a k p.1.1 ha ha1 hk p.1.2 m) p.2.1 p.2.2) = + (fun p => expandingScaleTransfer a k 1 p.1.1 ha hk le_rfl p.1.2 + (fderiv ℝ (expandingOddPower a k 1 ha ha1 hk le_rfl m) + (expandingInverseTransfer a k p.1.1 ha hk p.1.2 p.2.1) + (expandingInverseTransfer a k p.1.1 ha hk p.1.2 p.2.2))) := + funext (fun p => fderiv_expandingOddPower_transport a k p.1.1 ha ha1 hk p.1.2 m p.2.1 p.2.2) + rw [heq] + have hT := (continuous_expandingScaleTransfer_from_one a k ha hk).comp + (continuous_fst : Continuous (fun p : {L : ℝ // 1 ≤ L} × (FourierL2 × FourierL2) => p.1)) + have hS := (continuous_expandingInverseTransfer a k ha hk).comp + (continuous_fst : Continuous (fun p : {L : ℝ // 1 ≤ L} × (FourierL2 × FourierL2) => p.1)) + exact hT.clm_apply + ((((contDiff_expandingOddPower a k 1 ha ha1 hk le_rfl m).continuous_fderiv + (by simp)).comp (hS.clm_apply (continuous_fst.comp continuous_snd))).clm_apply + (hS.clm_apply (continuous_snd.comp continuous_snd))) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingNonprincipalEnergy.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingNonprincipalEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..0964b57819a74aba76183696f02ff2c8f10e4bab --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingNonprincipalEnergy.lean @@ -0,0 +1,90 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingCompactEnergyError + +namespace OAI + +/-! # The actual nonprincipal quadratic form and its uniform bounds -/ + +open MeasureTheory + +namespace DefocusingNLS + +local notation "T" => UnitAddTorus (Fin 12) +noncomputable local instance nonprincipalEnergyMeasure : MeasureSpace UnitAddCircle := ⟨AddCircle.haarAddCircle⟩ +local instance nonprincipalEnergyProbability : IsProbabilityMeasure (volume : Measure UnitAddCircle) := + inferInstanceAs (IsProbabilityMeasure AddCircle.haarAddCircle) + +noncomputable def expandingNonprincipalEnergy (a L : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hL : 1 ≤ L) + (m : ℕ) (q : FourierL2) (P : ℝ) (hP : 0 ≤ P) + (hQB : ∀ x : T, ‖expandingUnitTorusFunction a N L q x‖ ^ (2 * m) ≤ P) + (f : FourierL2) : ℝ := + inner ℝ f (expandingLinearizedPotential a N L ha ha1 hN hL m q f) - + ∑ j : Fin N → Fin 12, + inner ℝ (expandingOrderedPhysicalEnergy a L N hL j f) + (torusPrincipalPotential m (expandingUnitTorusFunction a N L q) + (expandingUnitTorusFunction a N L q).continuous P hP hQB + (expandingOrderedPhysicalEnergy a L N hL j f)) + +theorem expandingNonprincipalEnergy_smul (a L : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hL : 1 ≤ L) + (m : ℕ) (q : FourierL2) (P : ℝ) (hP : 0 ≤ P) + (hQB : ∀ x : T, ‖expandingUnitTorusFunction a N L q x‖ ^ (2 * m) ≤ P) + (c : ℝ) (f : FourierL2) : + expandingNonprincipalEnergy a L N ha ha1 hN hL m q P hP hQB (c • f) = + c ^ 2 * expandingNonprincipalEnergy a L N ha ha1 hN hL m q P hP hQB f := by + unfold expandingNonprincipalEnergy + simp only [ContinuousLinearMap.map_smul_of_tower, real_inner_smul_left, real_inner_smul_right] + simp only [← mul_assoc, ← Finset.mul_sum] + ring + +theorem expandingNonprincipalEnergy_le (a L : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hL : 1 ≤ L) + (m : ℕ) (q : FourierL2) (P : ℝ) (hP : 0 ≤ P) + (hQB : ∀ x : T, ‖expandingUnitTorusFunction a N L q x‖ ^ (2 * m) ≤ P) + (D : ℝ) (hD : ‖expandingLinearizedPotential a N L ha ha1 hN hL m q‖ ≤ D) + (f : FourierL2) : + expandingNonprincipalEnergy a L N ha ha1 hN hL m q P hP hQB f ≤ + (D + (2 * (m : ℝ) + 1) * P) * ‖f‖ ^ 2 := by + let B := (2 * (m : ℝ) + 1) * P + let V := torusPrincipalPotential m (expandingUnitTorusFunction a N L q) + (expandingUnitTorusFunction a N L q).continuous P hP hQB + let U := expandingOrderedPhysicalEnergy a L N hL + have hpair : inner ℝ f (expandingLinearizedPotential a N L ha ha1 hN hL m q f) ≤ D * ‖f‖ ^ 2 := by + calc + _ ≤ ‖f‖ * ‖expandingLinearizedPotential a N L ha ha1 hN hL m q f‖ := real_inner_le_norm _ _ + _ ≤ ‖f‖ * (D * ‖f‖) := by + gcongr + exact (ContinuousLinearMap.le_opNorm _ f).trans (mul_le_mul_of_nonneg_right hD (norm_nonneg f)) + _ = _ := by ring + have hneg (j : Fin N → Fin 12) : -inner ℝ (U j f) (V (U j f)) ≤ B * ‖U j f‖ ^ 2 := by + calc + _ ≤ |inner ℝ (U j f) (V (U j f))| := neg_le_abs _ + _ ≤ ‖U j f‖ * ‖V (U j f)‖ := abs_real_inner_le_norm _ _ + _ ≤ ‖U j f‖ * (B * ‖U j f‖) := + mul_le_mul_of_nonneg_left + (torusPrincipalAction_norm_le m (expandingUnitTorusFunction a N L q) + (expandingUnitTorusFunction a N L q).continuous P hP hQB (U j f)) (norm_nonneg _) + _ = _ := by ring + have hsum := Finset.sum_le_sum (fun j (_ : j ∈ Finset.univ) => hneg j) + rw [Finset.sum_neg_distrib, ← Finset.mul_sum, expandingOrderedPhysicalEnergy_norm_sq] at hsum + have hhigh : ‖expandingHighEnergy a N L hL f‖ ^ 2 ≤ ‖f‖ ^ 2 := by + have he := expandingEnergy_norm_sq a N L hL f + nlinarith [sq_nonneg ‖expandingLowEnergy a N L hL f‖] + have htotal := hsum.trans (mul_le_mul_of_nonneg_left hhigh (show 0 ≤ B by dsimp [B]; positivity)) + change inner ℝ f _ - ∑ j, inner ℝ (U j f) (V (U j f)) ≤ _ + dsimp only [B] at htotal + linarith + +theorem exists_expandingLinearized_norm_bound (a k Q : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hQ : 0 ≤ Q) (m : ℕ) : + ∃ D : ℝ, 0 ≤ D ∧ ∀ (L : ℝ) (hL : 1 ≤ L) (q : FourierL2), ‖q‖ ≤ Q → + ‖expandingLinearizedPotential a k L ha ha1 hk hL m q‖ ≤ D := by + obtain ⟨D, hD, hb⟩ := exists_expandingOddPower_two_jet_bound a k ha ha1 hk m Q hQ + refine ⟨D, hD, fun L hL q hq => ?_⟩ + have he := hb L hL q hq 1 (by norm_num) + simpa only [norm_iteratedFDeriv_one, expandingLinearizedPotential, norm_smul, + norm_neg, Complex.norm_I, one_mul] using he + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingNonprincipalObservation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingNonprincipalObservation.lean new file mode 100644 index 0000000000000000000000000000000000000000..785734c0eb312164e9762cecc114cf16f081aa8b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingNonprincipalObservation.lean @@ -0,0 +1,50 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingNonprincipalEnergy +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingQuadraticObservation + +namespace OAI + +/-! # Uniform compact observation for the actual odd-power energy error -/ + +open Filter Topology MeasureTheory + +namespace DefocusingNLS + +local notation "T" => UnitAddTorus (Fin 12) +local notation "Radius" => {L : ℝ // 1 ≤ L} +noncomputable local instance nonprincipalObservationMeasure : MeasureSpace UnitAddCircle := ⟨AddCircle.haarAddCircle⟩ +local instance nonprincipalObservationProbability : IsProbabilityMeasure (volume : Measure UnitAddCircle) := + inferInstanceAs (IsProbabilityMeasure AddCircle.haarAddCircle) + +theorem exists_expandingNonprincipal_observation (a Q : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < ((N + 1 : ℕ) : ℝ)) (hQ : 0 ≤ Q) + (q : Radius → FourierL2) (hqb : ∀ L, ‖q L‖ ≤ Q) + (hq : ∀ (L : ℕ → Radius), Tendsto (fun n => (L n).1) atTop atTop → + ExpandingCompactApproximation a (N + 1 : ℕ) ha1 hN + (fun n => (L n).1) (fun n => (L n).2) (fun n => q (L n))) + (m : ℕ) (hm : 0 < m) (P : ℝ) (hP : 0 ≤ P) + (hQB : ∀ (L : Radius) (x : T), ‖expandingUnitTorusFunction a (N + 1 : ℕ) L.1 (q L) x‖ ^ (2 * m) ≤ P) + (ε : ℝ) (hε : 0 < ε) : + ∃ n : ℕ, ∃ C : ℝ, 0 ≤ C ∧ ∀ (L : Radius), (n : ℝ) ≤ L.1 → ∀ f : FourierL2, + expandingNonprincipalEnergy a L.1 (N + 1) ha ha1 hN L.2 m (q L) P hP (hQB L) f ≤ + ε * ‖f‖ ^ 2 + C * + ‖expandingPhysicalBall a (N + 1 : ℕ) L.1 n ha ha1 hN L.2 f‖ ^ 2 := by + let F : Radius → FourierL2 → ℝ := fun L f => + expandingNonprincipalEnergy a L.1 (N + 1) ha ha1 hN L.2 m (q L) P hP (hQB L) f + obtain ⟨D, hD, hDb⟩ := exists_expandingLinearized_norm_bound a (N + 1 : ℕ) Q ha ha1 hN hQ m + let B := D + (2 * (m : ℝ) + 1) * P + have hB : 0 ≤ B := by dsimp [B]; positivity + obtain ⟨n, hn⟩ := exists_expanding_observation_threshold a (N + 1 : ℕ) F (by + intro L hLinf f hf hlocal + exact tendsto_expandingCompactEnergy_error a Q 1 N ha ha1 hN + (fun j => (L j).1) (fun j => (L j).2) hLinf (fun j => q (L j)) (hq L hLinf) + (fun j => hqb (L j)) f hf hlocal m hm P hP (fun j => hQB (L j))) ε hε + refine ⟨n, B * ((n : ℝ) + 1) ^ 2, by positivity, ?_⟩ + exact expanding_quadratic_observation_estimate a (N + 1 : ℕ) ha ha1 hN F B hB + (fun L f => expandingNonprincipalEnergy_le a L.1 (N + 1) ha ha1 hN L.2 m (q L) + P hP (hQB L) D (hDb L.1 L.2 (q L) (hqb L)) f) + (fun L c f => expandingNonprincipalEnergy_smul a L.1 (N + 1) ha ha1 hN L.2 m (q L) + P hP (hQB L) c f) ε hε n hn + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingObservedFamily.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingObservedFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..c2a08b7419a5d1e29404744813f89c4cce789502 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingObservedFamily.lean @@ -0,0 +1,40 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfileObservation + +namespace OAI + +/-! # An observed coefficient family controls every later expanding slab -/ + +open Set + +namespace DefocusingNLS + +local notation "Radius" => {L : ℝ // 1 ≤ L} + +theorem expandingObservedFamily_energy (a b k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) + (q : C(Radius, FourierL2)) (Q : ℝ) (hQ : 0 ≤ Q) (hq : ∀ l, ‖q l‖ ≤ Q) + (c C R L₀ : ℝ) + (henergy : ∀ (l : Radius), L₀ ≤ l.1 → ∀ v : FourierL2, + -a * ‖expandingLowEnergy a k l.1 l.2 v‖ ^ 2 + + (6 - 2 * a - k) * ‖expandingHighEnergy a k l.1 l.2 v‖ ^ 2 + + 2 * inner ℝ v (expandingLinearizedPotential a k l.1 ha ha1 hk l.2 m (q l) v) ≤ + -c * ‖v‖ ^ 2 + C * ‖expandingPhysicalBall a k l.1 R ha ha1 hk l.2 v‖ ^ 2) + (L T : ℝ) (hL : 1 ≤ L) (hT : 0 ≤ T) (hLL : L₀ ≤ L) + (f : FourierL2) (t : Icc (0 : ℝ) T) : + let l := expandingRadiusCurve L T hL + let p := q.comp l + let S := expandingProfileTrajectory a b k L T ha ha1 hk hL hT m Q hQ p (fun s => hq (l s)) f + ‖S t‖ ^ 2 ≤ Real.exp (-c * t) * ‖f‖ ^ 2 + + ∫ τ in (0 : ℝ)..(t : ℝ), + (let s := projIcc 0 T hT τ; + Real.exp (-c * ((t : ℝ) - τ)) * + (C * ‖expandingPhysicalBall a k (l s).1 R ha ha1 hk (l s).2 (S s)‖ ^ 2)) := by + intro l p S + apply expandingProfileTrajectory_observation_estimate a b k L T ha ha1 hk hL hT m Q hQ p + (fun s => hq (l s)) c C R + intro s v + exact henergy (l s) (hLL.trans (expandingRadius_ge L s hL s.2.1)) v + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOddCommutator.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOddCommutator.lean new file mode 100644 index 0000000000000000000000000000000000000000..b8bfb88416f745e3a072429f453bb36b6fe56b7b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOddCommutator.lean @@ -0,0 +1,46 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingMomentCommutator +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingCircularMoment +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingOrderedConjugate +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingOrderedCommutator + +namespace OAI + +/-! # The full scalar odd-power commutator in Fourier coordinates -/ + +namespace DefocusingNLS + +attribute [local irreducible] expandingCircularCoefficient expandingAnticircularCoefficient + expandingProduct expandingFourierCoefficient expandingOrderedFourierEnergy + +noncomputable def expandingOddFourierCommutator (a L : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hL : 1 ≤ L) + (m : ℕ) (q f : FourierL2) (j : Fin N → Fin 12) : FourierL2 := + expandingOrderedFourierEnergy a L N hL j (expandingLinearizedPotential a N L ha ha1 hN hL m q f) - + (-Complex.I) • + (fourierConvolution (expandingFourierCoefficient a N L + (expandingCircularCoefficient a N L ha ha1 hN hL m q)) + (expandingOrderedFourierEnergy a L N hL j f) + + fourierConvolution (expandingFourierCoefficient a N L + (expandingAnticircularCoefficient a N L ha ha1 hN hL m q)) + (fourierConjugate (expandingOrderedFourierEnergy a L N hL j f))) + +theorem expandingOddFourierCommutator_eq (a L : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hL : 1 ≤ L) + (m : ℕ) (q f : FourierL2) (j : Fin N → Fin 12) : + expandingOddFourierCommutator a L N ha ha1 hN hL m q f j = + (-Complex.I) • + (expandingProductCommutator a L N ha ha1 hN hL j + (expandingCircularCoefficient a N L ha ha1 hN hL m q) f + + expandingProductCommutator a L N ha ha1 hN hL j + (expandingAnticircularCoefficient a N L ha ha1 hN hL m q) (fourierConjugate f)) := by + unfold expandingOddFourierCommutator + change expandingOrderedFourierEnergy a L N hL j + ((-Complex.I) • fderiv ℝ (expandingOddPower a N L ha ha1 hN hL m) q f) - _ = _ + rw [map_smul, expandingOddPower_derivative_algebra a N L ha ha1 hN hL, map_add] + simp only [expandingProductCommutator, expandingOrderedFourierEnergy_conjugate, + smul_sub, smul_add] + abel + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOddCommutatorBound.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOddCommutatorBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..174acf335598dae7219a82bee8e3c7bc8067573d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOddCommutatorBound.lean @@ -0,0 +1,93 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingOddCommutator +import OAI.MathematicalPhysics.DefocusingNLS.Linear.SchwartzPolynomialMoment + +namespace OAI + +/-! # Radius-uniform high-frequency gain for the complete odd-power linearization -/ + +open scoped SchwartzMap + +namespace DefocusingNLS + +attribute [local irreducible] expandingCircularCoefficient expandingAnticircularCoefficient + expandingProduct expandingFourierCoefficient expandingOrderedFourierEnergy + +noncomputable def oddCommutatorMomentBound (m : ℕ) (M : ℝ) : ℝ := + (m + 1 : ℕ) * (M ^ m * M ^ m) + (m : ℝ) * (M ^ (m + 1) * M ^ (m - 1)) + +theorem oddCommutatorMomentBound_nonneg (m : ℕ) (M : ℝ) (hM : 0 ≤ M) : + 0 ≤ oddCommutatorMomentBound m M := by unfold oddCommutatorMomentBound; positivity + +theorem oddCommutatorMomentBound_mono (m : ℕ) {M D : ℝ} (hM : 0 ≤ M) (hMD : M ≤ D) : + oddCommutatorMomentBound m M ≤ oddCommutatorMomentBound m D := by + unfold oddCommutatorMomentBound + have hD : 0 ≤ D := hM.trans hMD + gcongr + +theorem expandingOddFourierCommutator_high_norm (a L R : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < ((N + 1 : ℕ) : ℝ)) + (hL : 1 ≤ L) (hR : 1 ≤ R) (m : ℕ) (q f : FourierL2) (j : Fin (N + 1) → Fin 12) + (hq : Summable (latticeMomentMass L (N + 1) (expandingFourierCoefficient a (N + 1 : ℕ) L q))) + (hf : ∀ n : frequencyLattice, ‖n‖ < R * L → f n = 0) : + let M := ∑' n, latticeMomentMass L (N + 1) (expandingFourierCoefficient a (N + 1 : ℕ) L q) n + ‖expandingOddFourierCommutator a L (N + 1) ha ha1 hN hL m q f j‖ ≤ + ((N + 1 : ℕ) / R) * 2 ^ N * oddCommutatorMomentBound m M * ‖f‖ := by + intro M + let A := expandingCircularCoefficient a (N + 1 : ℕ) L ha ha1 hN hL m q + let B := expandingAnticircularCoefficient a (N + 1 : ℕ) L ha ha1 hN hL m q + have hA := expandingCircular_moment a (N + 1 : ℕ) L ha ha1 hN hL (N + 1) m q hq + have hB := expandingAnticircular_moment a (N + 1 : ℕ) L ha ha1 hN hL (N + 1) m q hq + have hfconj : ∀ n : frequencyLattice, ‖n‖ < R * L → fourierConjugate f n = 0 := by + intro n hn + rw [fourierConjugate_apply, hf (-n) (by simpa only [norm_neg] using hn)] + simp + have hcA := expandingProductCommutator_high_moment a L R N ha ha1 hN hL hR j A f hA.1 hf + have hcB := expandingProductCommutator_high_moment a L R N ha ha1 hN hL hR j B (fourierConjugate f) hB.1 hfconj + rw [fourierConjugate_norm] at hcB + rw [expandingOddFourierCommutator_eq, norm_smul, norm_neg, Complex.norm_I, one_mul] + calc + _ ≤ ‖expandingProductCommutator a L (N + 1) ha ha1 hN hL j A f‖ + + ‖expandingProductCommutator a L (N + 1) ha ha1 hN hL j B (fourierConjugate f)‖ := norm_add_le _ _ + _ ≤ ((N + 1 : ℕ) / R) * (2 ^ N * (∑' n, latticeMomentMass L (N + 1) (expandingFourierCoefficient a (N + 1 : ℕ) L A) n)) * ‖f‖ + + ((N + 1 : ℕ) / R) * (2 ^ N * (∑' n, latticeMomentMass L (N + 1) (expandingFourierCoefficient a (N + 1 : ℕ) L B) n)) * ‖f‖ := add_le_add hcA hcB + _ ≤ ((N + 1 : ℕ) / R) * (2 ^ N * ((m + 1 : ℕ) * (M ^ m * M ^ m))) * ‖f‖ + + ((N + 1 : ℕ) / R) * (2 ^ N * ((m : ℝ) * (M ^ (m + 1) * M ^ (m - 1)))) * ‖f‖ := by + gcongr + · exact hA.2 + · exact hB.2 + _ = _ := by unfold oddCommutatorMomentBound; ring + +theorem exists_expandingOddFourierCommutator_high_bound (a : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < ((N + 1 : ℕ) : ℝ)) + (m : ℕ) (K : 𝓢(EuclideanSpace ℝ (Fin 12), ℂ)) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ (L R : ℝ) (hL : 1 ≤ L), 1 ≤ R → + ∀ (f : FourierL2) (j : Fin (N + 1) → Fin 12), + (∀ n : frequencyLattice, ‖n‖ < R * L → f n = 0) → + ‖expandingOddFourierCommutator a L (N + 1) ha ha1 hN hL m + (schwartzTorusSample a (N + 1 : ℕ) L ha1 hN hL K) f j‖ ≤ (C / R) * ‖f‖ := by + obtain ⟨D, hD, hd⟩ := exists_schwartzPolynomialMoment_bound a (N + 1 : ℕ) ha ha1 hN (N + 1) K + refine ⟨(N + 1 : ℕ) * 2 ^ N * oddCommutatorMomentBound m D, by + exact mul_nonneg (by positivity) (oddCommutatorMomentBound_nonneg m D hD), ?_⟩ + intro L R hL hR f j hf + let q := schwartzTorusSample a (N + 1 : ℕ) L ha1 hN hL K + obtain ⟨hs, hb⟩ := hd L hL + have hcoeff : expandingFourierCoefficient a (N + 1 : ℕ) L q = schwartzLatticeCoefficient L K := by + funext n + exact schwartzTorusSample_coefficient a (N + 1 : ℕ) L ha1 hN hL K n + have hc := expandingOddFourierCommutator_high_norm a L R N ha ha1 hN hL hR m q f j + (by simpa only [hcoeff] using hs) hf + rw [hcoeff] at hc + have hmass : 0 ≤ ∑' n, latticeMomentMass L (N + 1) (schwartzLatticeCoefficient L K) n := + tsum_nonneg (fun n => mul_nonneg + (le_trans zero_le_one (latticeMomentWeight_one_le L hL (N + 1) n)) (norm_nonneg _)) + calc + _ ≤ ((N + 1 : ℕ) / R) * 2 ^ N * + oddCommutatorMomentBound m (∑' n, latticeMomentMass L (N + 1) (schwartzLatticeCoefficient L K) n) * ‖f‖ := hc + _ ≤ ((N + 1 : ℕ) / R) * 2 ^ N * oddCommutatorMomentBound m D * ‖f‖ := by + gcongr + exact oddCommutatorMomentBound_mono m hmass hb + _ = _ := by ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOddCompactness.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOddCompactness.lean new file mode 100644 index 0000000000000000000000000000000000000000..ab58c2fc6b9038f7fa9a31585c09d8e28a9d16d1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOddCompactness.lean @@ -0,0 +1,76 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingApproximationCoefficients +import OAI.MathematicalPhysics.DefocusingNLS.Linear.TorusOddCommutator + +namespace OAI + +/-! # Compactness of the actual odd-power commutator and lower energy -/ + +open Filter Topology + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +variable (a Q M : ℝ) (N : ℕ) (ha : 0 < a) (ha1 : a < 1) + (hN : 8 < ((N + 1 : ℕ) : ℝ)) (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) + (hLinf : Tendsto L atTop atTop) (q : ℕ → FourierL2) + (hq : ExpandingCompactApproximation a (N + 1 : ℕ) ha1 hN L hL q) (hqb : ∀ n, ‖q n‖ ≤ Q) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) + (hlocal : ∀ R ε : ℝ, 0 < ε → ∀ᶠ n in atTop, ∀ y : E, ‖y‖ ≤ R → + ‖expandingTorusFunction a (N + 1 : ℕ) (L n) (f n) (euclideanToTorus ((L n)⁻¹ • y))‖ < ε) + (m : ℕ) (hm : 0 < m) + +include ha ha1 hN hL hlocal in +private theorem local_conjugate : + ∀ R ε : ℝ, 0 < ε → ∀ᶠ n in atTop, ∀ y : E, ‖y‖ ≤ R → + ‖expandingTorusFunction a (N + 1 : ℕ) (L n) (fourierConjugate (f n)) + (euclideanToTorus ((L n)⁻¹ • y))‖ < ε := by + intro R ε hε + filter_upwards [hlocal R ε hε] with n hn + intro y hy + simpa only [expandingTorusFunction_conjugate a (N + 1 : ℕ) (L n) ha ha1 hN (hL n), + Complex.norm_conj] using hn y hy + +include hLinf hq hqb hf hlocal hm + +theorem tendsto_expandingOddFourierCommutator (j : Fin (N + 1) → Fin 12) : + Tendsto (fun n => expandingOddFourierCommutator a (L n) (N + 1) ha ha1 hN (hL n) + m (q n) (f n) j) atTop (𝓝 0) := by + obtain ⟨hc, hd⟩ := expandingOdd_coefficients_compact a (N + 1 : ℕ) Q ha ha1 hN + L hL hLinf q hq hqb m hm + have hfirst := tendsto_expandingApproximate_commutator a M N ha ha1 hN L hL hLinf _ hc f hf hlocal j + have hconj := local_conjugate a N ha ha1 hN L hL f hlocal + have hsecond := tendsto_expandingApproximate_commutator a M N ha ha1 hN L hL hLinf _ hd + (fun n => fourierConjugate (f n)) (fun n => by simpa only [fourierConjugate_norm] using hf n) hconj j + simpa only [expandingOddFourierCommutator_eq, add_zero, smul_zero] using + (hfirst.add hsecond).const_smul (-Complex.I) + +theorem tendsto_expandingLinearized_lowEnergy : + Tendsto (fun n => expandingLowEnergy a (N + 1 : ℕ) (L n) (hL n) + (expandingLinearizedPotential a (N + 1 : ℕ) (L n) ha ha1 hN (hL n) m (q n) (f n))) + atTop (𝓝 0) := by + obtain ⟨hc, hd⟩ := expandingOdd_coefficients_compact a (N + 1 : ℕ) Q ha ha1 hN + L hL hLinf q hq hqb m hm + have hfirst := tendsto_expandingApproximate_lowEnergy_product a M (N + 1) ha ha1 hN + L hL hLinf _ hc f hf hlocal + have hconj := local_conjugate a N ha ha1 hN L hL f hlocal + have hsecond := tendsto_expandingApproximate_lowEnergy_product a M (N + 1) ha ha1 hN + L hL hLinf _ hd (fun n => fourierConjugate (f n)) + (fun n => by simpa only [fourierConjugate_norm] using hf n) hconj + have he (n : ℕ) : expandingLowEnergy a (N + 1 : ℕ) (L n) (hL n) + (expandingLinearizedPotential a (N + 1 : ℕ) (L n) ha ha1 hN (hL n) m (q n) (f n)) = + (-Complex.I) • (expandingLowEnergy a (N + 1 : ℕ) (L n) (hL n) + (expandingProduct a (N + 1 : ℕ) (L n) ha ha1 hN (hL n) + (expandingCircularCoefficient a (N + 1 : ℕ) (L n) ha ha1 hN (hL n) m (q n)) (f n)) + + expandingLowEnergy a (N + 1 : ℕ) (L n) (hL n) + (expandingProduct a (N + 1 : ℕ) (L n) ha ha1 hN (hL n) + (expandingAnticircularCoefficient a (N + 1 : ℕ) (L n) ha ha1 hN (hL n) m (q n)) + (fourierConjugate (f n)))) := by + change expandingLowEnergy _ _ _ _ ((-Complex.I) • fderiv ℝ + (expandingOddPower a (N + 1 : ℕ) (L n) ha ha1 hN (hL n) m) (q n) (f n)) = _ + rw [expandingOddPower_derivative_algebra, map_smul, map_add] + simpa only [he, add_zero, smul_zero] using (hfirst.add hsecond).const_smul (-Complex.I) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOneDimensional.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOneDimensional.lean new file mode 100644 index 0000000000000000000000000000000000000000..3818da3c1aa1cedb6a8c9189df5ea021411f1503 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOneDimensional.lean @@ -0,0 +1,129 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingSobolevWeights + +namespace OAI + +/-! # The scale-uniform one-dimensional inverse-weight bound -/ + +open Set MeasureTheory + +namespace DefocusingNLS + +theorem continuous_expandingOneDimKernel (a k L : ℝ) (hk : 8 < k) (hL : 1 ≤ L) : + Continuous (expandingOneDimKernel a k L) := by + have hlow : Continuous (fun x : ℝ => (1 + x ^ 2) ^ ((6 - a) / 12)) := + (continuous_const.add (continuous_id.pow 2)).rpow_const + (fun x : ℝ => Or.inl (ne_of_gt (show 0 < 1 + x ^ 2 by positivity))) + have hhigh : Continuous (fun x : ℝ => |x| ^ (k / 6)) := + continuous_abs.rpow_const (fun _ => Or.inr (by linarith)) + exact ((continuous_const.mul hlow).add (continuous_const.mul hhigh)).inv₀ + (fun x => (expandingOneDimWeight_pos a k L x hL).ne') + +private theorem expanding_low_integral (a L : ℝ) (ha : 0 < a) (hL : 1 ≤ L) : + (∫ x in Ioc 0 L, L ^ (-a / 6) * x ^ (a / 6 - 1)) = 1 / (a / 6) := by + have hLp : 0 < L := by linarith + rw [← intervalIntegral.integral_of_le hLp.le, intervalIntegral.integral_const_mul, + integral_rpow (Or.inl (by linarith))] + have he : a / 6 - 1 + 1 = a / 6 := by ring + rw [he, Real.zero_rpow (by positivity : a / 6 ≠ 0), sub_zero] + calc + _ = (L ^ (-a / 6) * L ^ (a / 6)) / (a / 6) := by ring + _ = _ := by + rw [← Real.rpow_add hLp, show -a / 6 + a / 6 = 0 by ring, Real.rpow_zero] + +private theorem expanding_high_integral (k L : ℝ) (hk : 8 < k) (hL : 1 ≤ L) : + (∫ x in Ioi L, L ^ (k / 6 - 1) * x ^ (-k / 6)) = 1 / (k / 6 - 1) := by + have hLp : 0 < L := by linarith + rw [integral_const_mul, integral_Ioi_rpow_of_lt (by linarith) hLp] + have he : -k / 6 + 1 = -(k / 6 - 1) := by ring + rw [he, div_neg, neg_div, neg_neg] + calc + _ = (L ^ (k / 6 - 1) * L ^ (-(k / 6 - 1))) / (k / 6 - 1) := by ring + _ = _ := by + rw [← Real.rpow_add hLp, add_neg_cancel, Real.rpow_zero] + +/-- The inverse one-dimensional weight has an integral bounded independently of `L`. -/ +theorem expandingOneDimKernel_integrable_bound (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) : + IntegrableOn (expandingOneDimKernel a k L) (Ioi 0) ∧ + (∫ x in Ioi 0, expandingOneDimKernel a k L x) ≤ + 1 / (a / 6) + 1 / (k / 6 - 1) := by + have hLp : 0 < L := by linarith + have hlow : IntegrableOn (fun x : ℝ => L ^ (-a / 6) * x ^ (a / 6 - 1)) (Ioc 0 L) := by + have hp : IntegrableOn (fun x : ℝ => x ^ (a / 6 - 1)) (Ioc 0 L) := by + apply (integrableOn_Ioc_iff_integrableOn_Ioo + (f := fun x : ℝ => x ^ (a / 6 - 1)) (by finiteness)).mpr + exact (intervalIntegral.integrableOn_Ioo_rpow_iff hLp).mpr (by linarith) + exact hp.const_mul _ + have hhigh : IntegrableOn (fun x : ℝ => L ^ (k / 6 - 1) * x ^ (-k / 6)) (Ioi L) := + (integrableOn_Ioi_rpow_of_lt (by linarith) hLp).const_mul _ + have hc : AEStronglyMeasurable (expandingOneDimKernel a k L) (volume : Measure ℝ) := + (continuous_expandingOneDimKernel a k L hk hL).aestronglyMeasurable + have hklow : IntegrableOn (expandingOneDimKernel a k L) (Ioc 0 L) := by + apply hlow.mono' hc.restrict + filter_upwards [ae_restrict_mem measurableSet_Ioc] with x hx + rw [Real.norm_eq_abs, abs_of_nonneg (expandingOneDimKernel_nonneg a k L x hL)] + exact expandingOneDimKernel_le_low a k L x ha ha1 hL hx.1 + have hkhigh : IntegrableOn (expandingOneDimKernel a k L) (Ioi L) := by + apply hhigh.mono' hc.restrict + filter_upwards [ae_restrict_mem measurableSet_Ioi] with x hx + rw [Real.norm_eq_abs, abs_of_nonneg (expandingOneDimKernel_nonneg a k L x hL)] + exact expandingOneDimKernel_le_high a k L x hL (hLp.trans hx) + have hunion : Ioc 0 L ∪ Ioi L = Ioi (0 : ℝ) := Ioc_union_Ioi_eq_Ioi hLp.le + have hdis : Disjoint (Ioc (0 : ℝ) L) (Ioi L) := by + apply Set.disjoint_left.mpr + intro x hx hy + exact (not_lt_of_ge hx.2) hy + refine ⟨by rw [← hunion]; exact hklow.union hkhigh, ?_⟩ + rw [← hunion, setIntegral_union hdis measurableSet_Ioi hklow hkhigh] + calc + _ ≤ (∫ x in Ioc 0 L, L ^ (-a / 6) * x ^ (a / 6 - 1)) + + ∫ x in Ioi L, L ^ (k / 6 - 1) * x ^ (-k / 6) := by + apply add_le_add + · exact setIntegral_mono_on hklow hlow measurableSet_Ioc + (fun x hx => expandingOneDimKernel_le_low a k L x ha ha1 hL hx.1) + · exact setIntegral_mono_on hkhigh hhigh measurableSet_Ioi + (fun x hx => expandingOneDimKernel_le_high a k L x hL (hLp.trans hx)) + _ = _ := by rw [expanding_low_integral a L ha hL, expanding_high_integral k L hk hL] + +/-- The full integer inverse-weight sum is uniformly bounded on all expanding scales. -/ +theorem expandingOneDimKernel_integer_sum_bound (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) : + Summable (fun n : ℤ => expandingOneDimKernel a k L n) ∧ + (∑' n : ℤ, expandingOneDimKernel a k L n) ≤ + 1 + 2 * (1 / (a / 6) + 1 / (k / 6 - 1)) := by + have hanti := expandingOneDimKernel_antitone a k L ha ha1 hk hL + obtain ⟨hint, hib⟩ := expandingOneDimKernel_integrable_bound a k L ha ha1 hk hL + have hnon : ∀ x ∈ Ioi (0 : ℝ), 0 ≤ expandingOneDimKernel a k L x := + fun x _ => expandingOneDimKernel_nonneg a k L x hL + have hs : Summable (fun n : ℕ => expandingOneDimKernel a k L (n : ℝ)) := + hanti.summable_of_integrableOn_Ioi_zero hint hnon + have hs1 : Summable (fun n : ℕ => expandingOneDimKernel a k L (n + 1)) := + by simpa only [Nat.cast_add, Nat.cast_one] using (summable_nat_add_iff 1).mpr hs + have hneg : Summable (fun n : ℕ => + expandingOneDimKernel a k L (((-((n : ℤ) + 1)) : ℤ) : ℝ)) := by + simpa only [Int.cast_neg, Int.cast_add, Int.cast_natCast, Int.cast_one, + expandingOneDimKernel_even] using hs1 + have hnat : Summable (fun n : ℕ => expandingOneDimKernel a k L ((n : ℤ) : ℝ)) := + by simpa only [Int.cast_natCast] using hs + have hintsum : Summable (fun n : ℤ => expandingOneDimKernel a k L (n : ℝ)) := + Summable.of_nat_of_neg_add_one + (f := fun n : ℤ => expandingOneDimKernel a k L (n : ℝ)) hnat hneg + refine ⟨hintsum, ?_⟩ + rw [tsum_of_nat_of_neg_add_one + (f := fun n : ℤ => expandingOneDimKernel a k L (n : ℝ)) hnat hneg] + simp only [Int.cast_neg, Int.cast_add, Int.cast_natCast, Int.cast_one, + expandingOneDimKernel_even] + have hb0 : (∑' n : ℕ, expandingOneDimKernel a k L (n : ℝ)) ≤ + expandingOneDimKernel a k L 0 + (1 / (a / 6) + 1 / (k / 6 - 1)) := + (hanti.tsum_le_integral hint hnon).trans + (add_le_add le_rfl hib) + have hb1 : (∑' n : ℕ, expandingOneDimKernel a k L (n + 1 : ℕ)) ≤ + 1 / (a / 6) + 1 / (k / 6 - 1) := + (hanti.tsum_add_one_le_integral hint hnon).trans hib + simp only [Nat.cast_add, Nat.cast_one] at hb1 + have hz := expandingOneDimKernel_zero_le a k L ha hk hL + linarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOrderedCommutator.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOrderedCommutator.lean new file mode 100644 index 0000000000000000000000000000000000000000..01c1a2a34b956f2dd6553d1dd15fa884523a12d3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOrderedCommutator.lean @@ -0,0 +1,95 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.TorusOrderedEnergy +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingEnergyInner +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingLinearization + +namespace OAI + +/-! # Exact principal and commutator splitting of the torus linearization + +The remainder below is formed from the actual odd-power derivative and +the actual physical Fourier derivative components. Its definition adds +no spectral or compactness assumption. +-/ + +open MeasureTheory + +namespace DefocusingNLS + +local notation "T" => UnitAddTorus (Fin 12) +noncomputable local instance expandingOrderedCommutatorMeasureSpace : MeasureSpace UnitAddCircle := ⟨AddCircle.haarAddCircle⟩ +local instance expandingOrderedCommutatorProbability : IsProbabilityMeasure (volume : Measure UnitAddCircle) := + inferInstanceAs (IsProbabilityMeasure AddCircle.haarAddCircle) + +noncomputable def expandingLinearizedPotential (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (m : ℕ) (q : FourierL2) : + FourierL2 →L[ℝ] FourierL2 := + (-Complex.I) • fderiv ℝ (expandingOddPower a k L ha ha1 hk hL m) q + +noncomputable def expandingOrderedCommutator (a L : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hL : 1 ≤ L) + (m : ℕ) (q : FourierL2) (M : ℝ) (hM : 0 ≤ M) + (hQB : ∀ x : T, ‖expandingUnitTorusFunction a N L q x‖ ^ (2 * m) ≤ M) + (j : Fin N → Fin 12) : FourierL2 →L[ℝ] Lp ℂ 2 (volume : Measure T) := + ((expandingOrderedPhysicalEnergy a L N hL j).restrictScalars ℝ).comp + (expandingLinearizedPotential a N L ha ha1 hN hL m q) - + (torusPrincipalPotential m (expandingUnitTorusFunction a N L q) + (expandingUnitTorusFunction a N L q).continuous M hM hQB).comp + ((expandingOrderedPhysicalEnergy a L N hL j).restrictScalars ℝ) + +theorem expandingOrderedCommutator_split (a L : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hL : 1 ≤ L) + (m : ℕ) (q : FourierL2) (M : ℝ) (hM : 0 ≤ M) + (hQB : ∀ x : T, ‖expandingUnitTorusFunction a N L q x‖ ^ (2 * m) ≤ M) + (j : Fin N → Fin 12) (f : FourierL2) : + expandingOrderedPhysicalEnergy a L N hL j + (expandingLinearizedPotential a N L ha ha1 hN hL m q f) = + torusPrincipalPotential m (expandingUnitTorusFunction a N L q) + (expandingUnitTorusFunction a N L q).continuous M hM hQB + (expandingOrderedPhysicalEnergy a L N hL j f) + + expandingOrderedCommutator a L N ha ha1 hN hL m q M hM hQB j f := by + simp only [expandingOrderedCommutator, sub_apply, + ContinuousLinearMap.comp_apply, ContinuousLinearMap.coe_restrictScalars'] + abel + +theorem expandingLinearized_energy_split (a L : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hL : 1 ≤ L) + (m : ℕ) (q : FourierL2) (M : ℝ) (hM : 0 ≤ M) + (hQB : ∀ x : T, ‖expandingUnitTorusFunction a N L q x‖ ^ (2 * m) ≤ M) + (f : FourierL2) : + let B := expandingLinearizedPotential a N L ha ha1 hN hL m q + let D := expandingOrderedPhysicalEnergy a L N hL + let P := torusPrincipalPotential m (expandingUnitTorusFunction a N L q) + (expandingUnitTorusFunction a N L q).continuous M hM hQB + inner ℝ f (B f) = + inner ℝ (expandingLowEnergy a N L hL f) (expandingLowEnergy a N L hL (B f)) + + (∑ j, inner ℝ (D j f) (P (D j f))) + + ∑ j, inner ℝ (D j f) (expandingOrderedCommutator a L N ha ha1 hN hL m q M hM hQB j f) := by + intro B D P + dsimp only [B, D, P] + rw [expandingEnergy_inner a N L hL f (B f), + ← expandingOrderedPhysicalEnergy_inner a L N hL f (B f)] + simp only [B, expandingOrderedCommutator_split a L N ha ha1 hN hL m q M hM hQB, + inner_add_right, Finset.sum_add_distrib] + ring + +theorem expandingLinearized_energy_le (a L : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hL : 1 ≤ L) + (m : ℕ) (q : FourierL2) (M : ℝ) (hM : 0 ≤ M) + (hQB : ∀ x : T, ‖expandingUnitTorusFunction a N L q x‖ ^ (2 * m) ≤ M) + (f : FourierL2) : + let B := expandingLinearizedPotential a N L ha ha1 hN hL m q + let D := expandingOrderedPhysicalEnergy a L N hL + inner ℝ f (B f) ≤ + inner ℝ (expandingLowEnergy a N L hL f) (expandingLowEnergy a N L hL (B f)) + + ((2 * (m : ℝ) + 1) * M) * ‖expandingHighEnergy a N L hL f‖ ^ 2 + + ∑ j, inner ℝ (D j f) (expandingOrderedCommutator a L N ha ha1 hN hL m q M hM hQB j f) := by + intro B D + have he := expandingLinearized_energy_split a L N ha ha1 hN hL m q M hM hQB f + have hb := expandingOrderedPrincipal_energy_le a L N m hL + (expandingUnitTorusFunction a N L q) (expandingUnitTorusFunction a N L q).continuous M hM hQB f + dsimp only at he hb + linarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOrderedConjugate.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOrderedConjugate.lean new file mode 100644 index 0000000000000000000000000000000000000000..2dd9044d88253c5db039b277446cf3f9fcbd9fe0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOrderedConjugate.lean @@ -0,0 +1,41 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingOrderedEnergy +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingNonlinearity + +namespace OAI + +/-! # Real differentiation commutes with physical complex conjugation -/ + +open scoped ComplexConjugate + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem homogeneousOrderedSymbol_conjugate (N : ℕ) (j : Fin N → Fin 12) (ξ : E) : + conj (homogeneousOrderedSymbol N j (-ξ)) = homogeneousOrderedSymbol N j ξ := by + simp only [homogeneousOrderedSymbol, map_prod] + apply Finset.prod_congr rfl + intro i _ + change conj ((-(ξ (j i)) : ℝ) * Complex.I) = (ξ (j i) : ℂ) * Complex.I + simp only [map_mul, Complex.conj_ofReal, map_neg, Complex.conj_I, Complex.ofReal_neg] + ring + +theorem expandingOrderedMultiplier_conjugate (a L : ℝ) (N : ℕ) + (j : Fin N → Fin 12) (n : frequencyLattice) : + conj (expandingOrderedMultiplier a L N j (-n)) = expandingOrderedMultiplier a L N j n := by + simp only [expandingOrderedMultiplier, map_mul, Complex.conj_ofReal, + Submodule.coe_neg, homogeneousOrderedSymbol_conjugate] + congr 2 + simp only [expandingSobolevWeight, expandingSobolevWeightSq, norm_neg] + +theorem expandingOrderedFourierEnergy_conjugate (a L : ℝ) (N : ℕ) (hL : 1 ≤ L) + (j : Fin N → Fin 12) (f : FourierL2) : + expandingOrderedFourierEnergy a L N hL j (fourierConjugate f) = + fourierConjugate (expandingOrderedFourierEnergy a L N hL j f) := by + ext n + simp only [expandingOrderedFourierEnergy_apply, fourierConjugate_apply, map_mul, + expandingOrderedMultiplier_conjugate] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOrderedEnergy.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOrderedEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..e3caa666c65c102454b8c2c2e43aa522555a1b51 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOrderedEnergy.lean @@ -0,0 +1,111 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingEnergyComponents +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousCommutatorSymbol + +namespace OAI + +/-! # Ordered derivative components of the exact torus high energy -/ + +open scoped ENNReal + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem homogeneousOrderedSymbol_sq_sum (N : ℕ) (ξ : E) : + (∑ j : Fin N → Fin 12, ‖homogeneousOrderedSymbol N j ξ‖ ^ 2) = ‖ξ‖ ^ (2 * N) := by + have he (j : Fin N → Fin 12) : ‖homogeneousOrderedSymbol N j ξ‖ ^ 2 = + ∏ i, (ξ (j i)) ^ 2 := by + rw [homogeneousOrderedSymbol, norm_prod, ← Finset.prod_pow] + apply Finset.prod_congr rfl + intro i _ + rw [norm_mul, Complex.norm_real, Complex.norm_I, mul_one, Real.norm_eq_abs, sq_abs] + simp_rw [he] + rw [← Fintype.sum_pow (fun i : Fin 12 => (ξ i) ^ 2) N, + ← EuclideanSpace.real_norm_sq_eq, pow_mul] + +noncomputable def expandingOrderedMultiplier (a L : ℝ) (N : ℕ) + (j : Fin N → Fin 12) (n : frequencyLattice) : ℂ := + (((2 * Real.pi) ^ 6 * L ^ (6 - (N : ℝ)) / + expandingSobolevWeight a N L n : ℝ) : ℂ) * homogeneousOrderedSymbol N j n + +theorem expandingOrderedMultiplier_sq_sum (a L : ℝ) (N : ℕ) (hL : 1 ≤ L) + (n : frequencyLattice) : + (∑ j : Fin N → Fin 12, ‖expandingOrderedMultiplier a L N j n‖ ^ 2) = + 1 - expandingLowFraction a N L n := by + have hc : ((2 * Real.pi) ^ 6 * L ^ (6 - (N : ℝ)) / + expandingSobolevWeight a N L n) ^ 2 = + L ^ (12 - 2 * (N : ℝ)) / expandingSobolevWeightSq a N L n := by + rw [div_pow, mul_pow, ← pow_mul, expandingSobolevWeight_sq a N L hL] + have hpow : (L ^ (6 - (N : ℝ))) ^ 2 = L ^ (12 - 2 * (N : ℝ)) := by + rw [← Real.rpow_natCast, ← Real.rpow_mul (by linarith : 0 ≤ L)] + congr 1 + ring + rw [hpow] + norm_num only [Nat.reduceMul] + have hP : (2 * Real.pi) ^ 12 ≠ 0 := by positivity + field_simp + simp only [expandingOrderedMultiplier, norm_mul, mul_pow, Complex.norm_real, + Real.norm_eq_abs, sq_abs] + simp only [mul_pow] at hc + rw [← Finset.mul_sum, homogeneousOrderedSymbol_sq_sum, hc, + expandingHighFraction_eq a N L hL] + have hpow : ‖n‖ ^ (2 * (N : ℝ)) = ‖n‖ ^ (2 * N) := by + rw [show (2 : ℝ) * (N : ℝ) = ((2 * N : ℕ) : ℝ) by push_cast; rfl, Real.rpow_natCast] + rw [hpow] + rw [Submodule.norm_coe] + ring + +theorem expandingOrderedMultiplier_norm_le (a L : ℝ) (N : ℕ) (hL : 1 ≤ L) + (j : Fin N → Fin 12) (n : frequencyLattice) : + ‖expandingOrderedMultiplier a L N j n‖ ≤ 1 := by + have hi : ‖expandingOrderedMultiplier a L N j n‖ ^ 2 ≤ + ∑ i : Fin N → Fin 12, ‖expandingOrderedMultiplier a L N i n‖ ^ 2 := + Finset.single_le_sum (f := fun i => ‖expandingOrderedMultiplier a L N i n‖ ^ 2) + (fun i _ => sq_nonneg _) (Finset.mem_univ j) + rw [expandingOrderedMultiplier_sq_sum a L N hL n] at hi + have hf := (expandingLowFraction_bounds a N L hL n).1 + nlinarith [norm_nonneg (expandingOrderedMultiplier a L N j n)] + +noncomputable def expandingOrderedFourierEnergy (a L : ℝ) (N : ℕ) (hL : 1 ≤ L) + (j : Fin N → Fin 12) : FourierL2 →L[ℂ] FourierL2 := + let F : FourierL2 → FourierL2 := fun f => + ⟨fun n => expandingOrderedMultiplier a L N j n * f n, by + apply (lp.memℓp f).mono' + intro n + rw [norm_mul] + exact mul_le_of_le_one_left (norm_nonneg _) (expandingOrderedMultiplier_norm_le a L N hL j n)⟩ + LinearMap.mkContinuous + { toFun := F + map_add' := by intro f g; ext n; exact mul_add _ _ _ + map_smul' := by intro c f; ext n; change _ * (c * _) = c * (_ * _); ring } + 1 (by + intro f + rw [one_mul] + apply lp.norm_mono (by norm_num : (2 : ℝ≥0∞) ≠ 0) + intro n + change ‖expandingOrderedMultiplier a L N j n * f n‖ ≤ ‖f n‖ + rw [norm_mul] + exact mul_le_of_le_one_left (norm_nonneg _) (expandingOrderedMultiplier_norm_le a L N hL j n)) + +@[simp] theorem expandingOrderedFourierEnergy_apply (a L : ℝ) (N : ℕ) (hL : 1 ≤ L) + (j : Fin N → Fin 12) (f : FourierL2) (n : frequencyLattice) : + expandingOrderedFourierEnergy a L N hL j f n = expandingOrderedMultiplier a L N j n * f n := rfl + +theorem expandingOrderedFourierEnergy_norm_sq (a L : ℝ) (N : ℕ) (hL : 1 ≤ L) (f : FourierL2) : + (∑ j : Fin N → Fin 12, ‖expandingOrderedFourierEnergy a L N hL j f‖ ^ 2) = + ‖expandingHighEnergy a N L hL f‖ ^ 2 := by + have hs (j : Fin N → Fin 12) : HasSum + (fun n => ‖expandingOrderedFourierEnergy a L N hL j f n‖ ^ 2) + (‖expandingOrderedFourierEnergy a L N hL j f‖ ^ 2) := by + simpa only [ENNReal.toReal_ofNat, Real.rpow_two] using + lp.hasSum_norm (p := 2) (by norm_num) (expandingOrderedFourierEnergy a L N hL j f) + have hsum := hasSum_sum (s := Finset.univ) (fun j _ => hs j) + rw [← hsum.tsum_eq, expandingHighEnergy, fourierEnergyComponent_norm_sq] + apply tsum_congr + intro n + simp only [expandingOrderedFourierEnergy_apply, norm_mul, mul_pow] + rw [← Finset.sum_mul, expandingOrderedMultiplier_sq_sum a L N hL n] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOrderedPhysicalSymbol.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOrderedPhysicalSymbol.lean new file mode 100644 index 0000000000000000000000000000000000000000..c92e0f8d8d3233512baa3c6f5b6f961d63c19726 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOrderedPhysicalSymbol.lean @@ -0,0 +1,44 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingOrderedEnergy +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPhysicalFourier + +namespace OAI + +/-! # Ordered torus energy in the physical frequency convention -/ + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem homogeneousOrderedSymbol_smul (N : ℕ) (j : Fin N → Fin 12) (c : ℝ) (ξ : E) : + homogeneousOrderedSymbol N j (c • ξ) = (c : ℂ) ^ N * homogeneousOrderedSymbol N j ξ := by + unfold homogeneousOrderedSymbol + simp only [PiLp.smul_apply, smul_eq_mul, Complex.ofReal_mul] + simp_rw [mul_assoc] + rw [Finset.prod_mul_distrib] + simp + +theorem expandingOrderedPhysical_scale (L : ℝ) (hL : 0 < L) (N : ℕ) : + (2 * Real.pi * L) ^ 6 * (L⁻¹) ^ N = (2 * Real.pi) ^ 6 * L ^ (6 - (N : ℝ)) := by + have hp : L ^ (6 - (N : ℝ)) = L ^ (6 : ℕ) * (L⁻¹) ^ N := by + rw [Real.rpow_sub hL] + simp only [Real.rpow_natCast, div_eq_mul_inv, inv_pow] + rw [Real.rpow_ofNat] + rw [hp, mul_pow] + ring + +theorem expandingOrderedFourierEnergy_physical (a L : ℝ) (N : ℕ) (hL : 1 ≤ L) + (j : Fin N → Fin 12) (f : FourierL2) (n : frequencyLattice) : + expandingOrderedFourierEnergy a L N hL j f n = + ((2 * Real.pi * L) ^ 6 : ℂ) * homogeneousOrderedSymbol N j (L⁻¹ • (n : E)) * + expandingFourierCoefficient a N L f n := by + rw [expandingOrderedFourierEnergy_apply, homogeneousOrderedSymbol_smul] + have hp := congrArg Complex.ofReal (expandingOrderedPhysical_scale L (by linarith) N) + simp only [Complex.ofReal_mul, Complex.ofReal_pow, Complex.ofReal_inv] at hp + unfold expandingOrderedMultiplier expandingFourierCoefficient + push_cast at hp ⊢ + linear_combination -(homogeneousOrderedSymbol N j n * + (expandingSobolevWeight a N L n : ℂ)⁻¹ * f n) * hp + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOrderedSymbol.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOrderedSymbol.lean new file mode 100644 index 0000000000000000000000000000000000000000..b439fc6a7955fa112768ff0de6468272e1b1f058 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingOrderedSymbol.lean @@ -0,0 +1,85 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingOrderedEnergy + +namespace OAI + +/-! # Scale-uniform frequency gain for the ordered torus commutator -/ + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +noncomputable def expandingOrderedFactor (a L : ℝ) (N : ℕ) (n : frequencyLattice) : ℝ := + (2 * Real.pi) ^ 6 * L ^ (6 - (N : ℝ)) / expandingSobolevWeight a N L n + +theorem expandingOrderedFactor_nonneg (a L : ℝ) (N : ℕ) (hL : 1 ≤ L) + (n : frequencyLattice) : 0 ≤ expandingOrderedFactor a L N n := by + unfold expandingOrderedFactor + exact div_nonneg (mul_nonneg (by positivity) (by positivity)) + (expandingSobolevWeight_pos a N L hL n).le + +theorem expandingOrderedFactor_radial_le (a L : ℝ) (N : ℕ) (hL : 1 ≤ L) + (n : frequencyLattice) : expandingOrderedFactor a L N n * ‖n‖ ^ N ≤ 1 := by + have he := expandingOrderedMultiplier_sq_sum a L N hL n + have hs : (∑ j : Fin N → Fin 12, ‖expandingOrderedMultiplier a L N j n‖ ^ 2) = + (expandingOrderedFactor a L N n * ‖n‖ ^ N) ^ 2 := by + simp only [expandingOrderedMultiplier, norm_mul, mul_pow, Complex.norm_real, + Real.norm_eq_abs, sq_abs] + rw [← Finset.mul_sum, homogeneousOrderedSymbol_sq_sum, Submodule.norm_coe] + dsimp only [expandingOrderedFactor] + ring + rw [hs] at he + have hl := (expandingLowFraction_bounds a N L hL n).1 + nlinarith + +noncomputable def expandingOrderedDifference (a L : ℝ) (N : ℕ) + (j : Fin N → Fin 12) (m n : frequencyLattice) : ℂ := + (expandingOrderedFactor a L N n : ℂ) * + (homogeneousOrderedSymbol N j (n + m) - homogeneousOrderedSymbol N j n) + +theorem expandingOrderedDifference_high (a L R : ℝ) (N : ℕ) + (hL : 1 ≤ L) (hR : 1 ≤ R) (j : Fin (N + 1) → Fin 12) + (m n : frequencyLattice) (hn : R * L ≤ ‖n‖) : + ‖expandingOrderedDifference a L (N + 1) j m n‖ ≤ + ((N + 1 : ℕ) / R) * (‖m‖ / L) * (2 + ‖m‖ / L) ^ N := by + have hLp : 0 < L := by linarith + have hRp : 0 < R := by linarith + have hnL : L ≤ ‖n‖ := (le_mul_of_one_le_left hLp.le hR).trans hn + have hnn : 0 < ‖n‖ := hLp.trans_le hnL + have hsum : ‖(n + m : frequencyLattice)‖ + ‖n‖ ≤ + (2 + ‖m‖ / L) * ‖n‖ := by + have h := mul_le_mul_of_nonneg_left hnL (div_nonneg (norm_nonneg m) hLp.le) + have he : (‖m‖ / L) * L = ‖m‖ := div_mul_cancel₀ _ hLp.ne' + rw [he] at h + nlinarith [norm_add_le n m] + have hd := homogeneousOrderedSymbol_sub_le N j (n + m : frequencyLattice) n + have hdif : ((n + m : frequencyLattice) : E) - (n : E) = (m : E) := by + change (n : E) + (m : E) - (n : E) = (m : E) + abel + rw [hdif, Submodule.norm_coe, Submodule.norm_coe, Submodule.norm_coe] at hd + have hp : (‖n + m‖ + ‖n‖) ^ N ≤ (2 + ‖m‖ / L) ^ N * ‖n‖ ^ N := by + simpa only [mul_pow] using pow_le_pow_left₀ (by positivity) hsum N + have hfac := expandingOrderedFactor_radial_le a L (N + 1) hL n + have hgain : expandingOrderedFactor a L (N + 1) n * ‖n‖ ^ N ≤ (R * L)⁻¹ := by + rw [← one_div (R * L)] + apply (le_div_iff₀ (mul_pos hRp hLp)).mpr + calc + _ ≤ expandingOrderedFactor a L (N + 1) n * ‖n‖ ^ N * ‖n‖ := + mul_le_mul_of_nonneg_left hn (mul_nonneg (expandingOrderedFactor_nonneg _ _ _ hL _) (by positivity)) + _ = expandingOrderedFactor a L (N + 1) n * ‖n‖ ^ (N + 1) := by rw [pow_succ]; ring + _ ≤ 1 := hfac + rw [expandingOrderedDifference, norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (expandingOrderedFactor_nonneg _ _ _ hL _)] + calc + _ ≤ expandingOrderedFactor a L (N + 1) n * + ((N + 1 : ℕ) * ‖m‖ * ((2 + ‖m‖ / L) ^ N * ‖n‖ ^ N)) := + mul_le_mul_of_nonneg_left (hd.trans (mul_le_mul_of_nonneg_left hp (by positivity))) + (expandingOrderedFactor_nonneg _ _ _ hL _) + _ = ((N + 1 : ℕ) * ‖m‖ * (2 + ‖m‖ / L) ^ N) * + (expandingOrderedFactor a L (N + 1) n * ‖n‖ ^ N) := by ring + _ ≤ ((N + 1 : ℕ) * ‖m‖ * (2 + ‖m‖ / L) ^ N) * (R * L)⁻¹ := + mul_le_mul_of_nonneg_left hgain (by positivity) + _ = _ := by rw [mul_inv_rev]; simp only [div_eq_mul_inv]; ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPerturbationContinuity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPerturbationContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..ae03579f5ca64daad29ca25a643ce80820e68c5f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPerturbationContinuity.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingSolutionContinuity +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPerturbationExistence + +namespace OAI + +/-! # Continuity of the actual nonlinear perturbation with varying scale + +The profile, residual and initial perturbation may all vary continuously. +Every bounded family solving the actual local polynomial equation is then +continuous in the finite-slab norm. This applies to the small solutions +already constructed by the uniform nonlinear step theorem. +-/ + +open Set + +namespace DefocusingNLS + +theorem continuous_expandingRadiusCurve_family + {P : Type*} [TopologicalSpace P] (T : ℝ) + (L : P → {L : ℝ // 1 ≤ L}) (hL : Continuous L) : + Continuous (fun z : P × Icc (0 : ℝ) T => + expandingRadiusCurve (L z.1).1 T (L z.1).2 z.2) := by + apply Continuous.subtype_mk + exact (continuous_subtype_val.comp (hL.comp continuous_fst)).mul + (Real.continuous_exp.comp ((continuous_subtype_val.comp continuous_snd).div_const 2)) + +theorem continuous_expandingPerturbationReaction_family + {P : Type*} [TopologicalSpace P] (a k T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) + (L : P → {L : ℝ // 1 ≤ L}) (hL : Continuous L) + (q g : P → C(Icc (0 : ℝ) T, FourierL2)) (hq : Continuous q) (hg : Continuous g) : + Continuous (fun z : P × ((Icc (0 : ℝ) T) × FourierL2) => + expandingPerturbationReaction a k (L z.1).1 T ha ha1 hk (L z.1).2 m + (q z.1) (g z.1) z.2) := by + have hl : Continuous (fun z : P × ((Icc (0 : ℝ) T) × FourierL2) => + expandingRadiusCurve (L z.1).1 T (L z.1).2 z.2.1) := + (continuous_expandingRadiusCurve_family T L hL).comp + (continuous_fst.prodMk (continuous_fst.comp continuous_snd)) + have hqv : Continuous (fun z : P × ((Icc (0 : ℝ) T) × FourierL2) => q z.1 z.2.1) := + continuous_eval.comp ((hq.comp continuous_fst).prodMk (continuous_fst.comp continuous_snd)) + have hgv : Continuous (fun z : P × ((Icc (0 : ℝ) T) × FourierL2) => g z.1 z.2.1) := + continuous_eval.comp ((hg.comp continuous_fst).prodMk (continuous_fst.comp continuous_snd)) + exact ((((continuous_expandingOddPower_scale a k ha ha1 hk m).comp + (hl.prodMk (hqv.add (continuous_snd.comp continuous_snd)))).sub + ((continuous_expandingOddPower_scale a k ha ha1 hk m).comp (hl.prodMk hqv))).const_smul + (-Complex.I : ℂ)).sub hgv + +theorem continuous_expandingPerturbation_family + {P : Type*} [TopologicalSpace P] (a b k T R : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hT : 0 ≤ T) + (m : ℕ) (hR : 0 ≤ R) + (L : P → {L : ℝ // 1 ≤ L}) (hL : Continuous L) + (q g : P → C(Icc (0 : ℝ) T, FourierL2)) (hq : Continuous q) (hg : Continuous g) + (hqbound : ∀ p t, ‖q p t‖ ≤ R) + (u₀ : P → FourierL2) (hu₀ : Continuous u₀) + (u : P → C(Icc (0 : ℝ) T, FourierL2)) + (hu : ∀ p, u p = expandingPicard a b k (L p).1 T ha hk (L p).2 hT + (expandingPerturbationReaction a k (L p).1 T ha ha1 hk (L p).2 m (q p) (g p)) + (u₀ p) (u p)) + (hub : ∀ p, ‖u p‖ ≤ 1) : + Continuous u := by + obtain ⟨K, hK, hlip⟩ := exists_expandingPerturbationReaction_local_lipschitz + a k ha ha1 hk m R hR + apply continuous_expandingMild_bounded_family a b k T 1 K ha hk hT hK L hL + (fun p => expandingPerturbationReaction a k (L p).1 T ha ha1 hk (L p).2 m (q p) (g p)) + (continuous_expandingPerturbationReaction_family a k T ha ha1 hk m L hL q g hq hg) + u₀ hu₀ u hu + · intro p t + exact (ContinuousMap.norm_coe_le_norm (u p) t).trans (hub p) + · intro p + exact hlip (L p).1 T (L p).2 (q p) (g p) (hqbound p) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPerturbationEquation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPerturbationEquation.lean new file mode 100644 index 0000000000000000000000000000000000000000..e2155e4627c8cd6d98d938b59dabfcc9118112ad --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPerturbationEquation.lean @@ -0,0 +1,101 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPerturbationReaction +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingResidualStability + +namespace OAI + +/-! # The nonlinear perturbation equation is the actual Schrödinger mild equation + +Subtracting a forced profile gives exactly the reaction used in the nonlinear +step estimates. Conversely, adding that profile to a perturbation solution +reconstructs an unforced nonlinear mild solution. +-/ + +open Set + +namespace DefocusingNLS + +attribute [local irreducible] expandingFreeStep + +theorem expandingPerturbation_add_mild (a b k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) (m : ℕ) + (q g v : C(Icc (0 : ℝ) T, FourierL2)) (q₀ v₀ : FourierL2) + (hq : ∀ t : Icc (0 : ℝ) T, q t = + expandingFreeStep a b k L t ha hk hL t.2.1 q₀ + + expandingDuhamel a b k L ha hk hL t (fun τ => + expandingReactionHistory T hT + (expandingNonlinearReaction a k L T ha ha1 hk hL m) q τ + + g (projIcc 0 T hT τ))) + (hv : v = expandingPicard a b k L T ha hk hL hT + (expandingPerturbationReaction a k L T ha ha1 hk hL m q g) v₀ v) : + q + v = expandingPicard a b k L T ha hk hL hT + (expandingNonlinearReaction a k L T ha ha1 hk hL m) (q₀ + v₀) (q + v) := by + let N := expandingNonlinearReaction a k L T ha ha1 hk hL m + let P := expandingPerturbationReaction a k L T ha ha1 hk hL m q g + let r := fun τ => expandingReactionHistory T hT N q τ + g (projIcc 0 T hT τ) + let f := expandingReactionHistory T hT P v + have hr : Continuous r := (continuous_expandingReactionHistory T hT N q).add + (g.continuous.comp continuous_projIcc) + have hf : Continuous f := continuous_expandingReactionHistory T hT P v + have he : expandingReactionHistory T hT N (q + v) = fun τ => r τ + f τ := by + funext τ + let s := projIcc 0 T hT τ + let H : FourierL2 → FourierL2 := expandingOddPower a k + (expandingRadiusCurve L T hL s).1 ha ha1 hk (expandingRadiusCurve L T hL s).2 m + change (-Complex.I) • H (q s + v s) = ((-Complex.I) • H (q s) + g s) + + ((-Complex.I) • (H (q s + v s) - H (q s)) - g s) + simp only [smul_sub] + abel + apply ContinuousMap.ext + intro t + have hv' := congrArg (fun w : C(Icc (0 : ℝ) T, FourierL2) => w t) hv + change v t = expandingFreeStep a b k L t ha hk hL t.2.1 v₀ + + expandingDuhamel a b k L ha hk hL t f at hv' + change q t + v t = expandingFreeStep a b k L t ha hk hL t.2.1 (q₀ + v₀) + + expandingDuhamel a b k L ha hk hL t (expandingReactionHistory T hT N (q + v)) + rw [hq t, hv', map_add, he, expandingDuhamel_add a b k L ha hk hL t r f + hr.continuousOn hf.continuousOn] + abel + +theorem expandingPerturbation_sub_mild (a b k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) (m : ℕ) + (q g u : C(Icc (0 : ℝ) T, FourierL2)) (q₀ u₀ : FourierL2) + (hq : ∀ t : Icc (0 : ℝ) T, q t = + expandingFreeStep a b k L t ha hk hL t.2.1 q₀ + + expandingDuhamel a b k L ha hk hL t (fun τ => + expandingReactionHistory T hT + (expandingNonlinearReaction a k L T ha ha1 hk hL m) q τ + + g (projIcc 0 T hT τ))) + (hu : u = expandingPicard a b k L T ha hk hL hT + (expandingNonlinearReaction a k L T ha ha1 hk hL m) u₀ u) : + u - q = expandingPicard a b k L T ha hk hL hT + (expandingPerturbationReaction a k L T ha ha1 hk hL m q g) (u₀ - q₀) (u - q) := by + let N := expandingNonlinearReaction a k L T ha ha1 hk hL m + let P := expandingPerturbationReaction a k L T ha ha1 hk hL m q g + let r := fun τ => expandingReactionHistory T hT N q τ + g (projIcc 0 T hT τ) + let f := expandingReactionHistory T hT N u + have hr : Continuous r := (continuous_expandingReactionHistory T hT N q).add + (g.continuous.comp continuous_projIcc) + have hf : Continuous f := continuous_expandingReactionHistory T hT N u + have he : expandingReactionHistory T hT P (u - q) = fun τ => f τ - r τ := by + funext τ + let s := projIcc 0 T hT τ + let H : FourierL2 → FourierL2 := expandingOddPower a k + (expandingRadiusCurve L T hL s).1 ha ha1 hk (expandingRadiusCurve L T hL s).2 m + change (-Complex.I) • (H (q s + (u s - q s)) - H (q s)) - g s = + (-Complex.I) • H (u s) - ((-Complex.I) • H (q s) + g s) + rw [show q s + (u s - q s) = u s by abel, smul_sub] + abel + apply ContinuousMap.ext + intro t + have hu' := congrArg (fun w : C(Icc (0 : ℝ) T, FourierL2) => w t) hu + change u t = expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t f at hu' + change u t - q t = expandingFreeStep a b k L t ha hk hL t.2.1 (u₀ - q₀) + + expandingDuhamel a b k L ha hk hL t (expandingReactionHistory T hT P (u - q)) + rw [hu', hq t, map_sub, he, expandingDuhamel_sub a b k L ha hk hL t f r + hf.continuousOn hr.continuousOn] + abel + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPerturbationExistence.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPerturbationExistence.lean new file mode 100644 index 0000000000000000000000000000000000000000..4c927e6628348155f4b488d4758853cc2437c807 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPerturbationExistence.lean @@ -0,0 +1,71 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFiniteLocalExistence +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPerturbationReaction +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingResidualStability + +namespace OAI + +/-! # Small nonlinear perturbations on an arbitrary fixed step + +The nonlinear reaction is the actual odd-power increment around a bounded +profile. Its local Lipschitz constant and its admissible forcing size are +uniform in the starting torus radius. +-/ + +open Set + +namespace DefocusingNLS + +theorem exists_expandingPerturbationReaction_local_lipschitz (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) (R : ℝ) (hR : 0 ≤ R) : + ∃ K : ℝ, 0 ≤ K ∧ ∀ (L T : ℝ) (hL : 1 ≤ L) + (q g : C(Icc (0 : ℝ) T, FourierL2)), (∀ t, ‖q t‖ ≤ R) → + ∀ t x y, ‖x‖ ≤ 1 → ‖y‖ ≤ 1 → + ‖expandingPerturbationReaction a k L T ha ha1 hk hL m q g (t, x) - + expandingPerturbationReaction a k L T ha ha1 hk hL m q g (t, y)‖ ≤ K * ‖x - y‖ := by + obtain ⟨K, hK, hb⟩ := exists_expandingOddPower_lipschitz_on_ball a k ha ha1 hk m + (R + 1) (by linarith) + refine ⟨K, hK, ?_⟩ + intro L T hL q g hq t x y hx hy + change ‖((-Complex.I) • (_ - _) - g t) - ((-Complex.I) • (_ - _) - g t)‖ ≤ _ + rw [sub_sub_sub_cancel_right, ← smul_sub, sub_sub_sub_cancel_right, + norm_smul, norm_neg, Complex.norm_I, one_mul] + have h := hb (expandingRadiusCurve L T hL t).1 (expandingRadiusCurve L T hL t).2 + (q t + x) (q t + y) ((norm_add_le _ _).trans (add_le_add (hq t) hx)) + ((norm_add_le _ _).trans (add_le_add (hq t) hy)) + simpa only [add_sub_add_left_eq_sub] using h + +@[simp] theorem expandingPerturbationReaction_zero (a k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (m : ℕ) + (q g : C(Icc (0 : ℝ) T, FourierL2)) (t : Icc (0 : ℝ) T) : + expandingPerturbationReaction a k L T ha ha1 hk hL m q g (t, 0) = -g t := by + change (-Complex.I) • (_ - _) - g t = -g t + simp only [add_zero, sub_self, smul_zero, zero_sub] + +/-- The step length may be fixed arbitrarily. Smallness depends on that +length and the fixed profile bound, not on the starting torus radius. -/ +theorem exists_expandingPerturbation_finiteSlab (a b k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) (R : ℝ) (hR : 0 ≤ R) : + ∃ K : ℝ, 0 ≤ K ∧ ∀ (L T : ℝ) (hL : 1 ≤ L) (hT : 0 ≤ T) + (q g : C(Icc (0 : ℝ) T, FourierL2)) (v₀ : FourierL2) (G : ℝ), + 0 ≤ G → (∀ t, ‖q t‖ ≤ R) → (∀ t, ‖g t‖ ≤ G) → + (K + 1) * ‖v₀‖ + G ≤ Real.exp (-(K + 1) * T) → + ∃ v : C(Icc (0 : ℝ) T, FourierL2), + v = expandingPicard a b k L T ha hk hL hT + (expandingPerturbationReaction a k L T ha ha1 hk hL m q g) v₀ v ∧ + ‖v‖ ≤ Real.exp ((K + 1) * T) * ((K + 1) * ‖v₀‖ + G) ∧ ‖v‖ ≤ 1 := by + obtain ⟨K, hK, hlip⟩ := exists_expandingPerturbationReaction_local_lipschitz + a k ha ha1 hk m R hR + refine ⟨K, hK, ?_⟩ + intro L T hL hT q g v₀ G hG hq hg hsmall + apply exists_expandingMild_local_finiteSlab a b k L T ha hk hL hT + (expandingPerturbationReaction a k L T ha ha1 hk hL m q g) v₀ K + (Real.exp (-(K + 1) * T)) 1 G hK (Real.exp_pos _).le hG + (hlip L T hL q g hq) _ _ hsmall + · intro t + rw [expandingPerturbationReaction_zero, norm_neg] + exact hg t + · rw [← Real.exp_add, show (K + 1) * T + -(K + 1) * T = 0 by ring, Real.exp_zero] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPerturbationReaction.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPerturbationReaction.lean new file mode 100644 index 0000000000000000000000000000000000000000..f47cc05d6a02a1057bfe0960b379920a04a29f25 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPerturbationReaction.lean @@ -0,0 +1,118 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfileResponse + +namespace OAI + +/-! # Exact nonlinear perturbation and quadratic forcing + +The perturbation of the actual odd-power equation splits into its profile +linearization and its Taylor remainder. The estimates are uniform in the +expanding torus radius and are the nonlinear ingredients of `nl:step`. +-/ + +open Set + +namespace DefocusingNLS + +noncomputable def expandingPerturbationReaction (a k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (m : ℕ) + (q g : C(Icc (0 : ℝ) T, FourierL2)) : + C((Icc (0 : ℝ) T) × FourierL2, FourierL2) where + toFun p := (-Complex.I) • + (expandingOddPower a k (expandingRadiusCurve L T hL p.1).1 ha ha1 hk + (expandingRadiusCurve L T hL p.1).2 m (q p.1 + p.2) - + expandingOddPower a k (expandingRadiusCurve L T hL p.1).1 ha ha1 hk + (expandingRadiusCurve L T hL p.1).2 m (q p.1)) - g p.1 + continuous_toFun := by + have hl := (expandingRadiusCurve L T hL).continuous.comp + (continuous_fst : Continuous (Prod.fst : (Icc (0 : ℝ) T) × FourierL2 → _)) + have hq := q.continuous.comp + (continuous_fst : Continuous (Prod.fst : (Icc (0 : ℝ) T) × FourierL2 → _)) + exact (((continuous_expandingOddPower_scale a k ha ha1 hk m).comp + (hl.prodMk (hq.add continuous_snd))).sub + ((continuous_expandingOddPower_scale a k ha ha1 hk m).comp (hl.prodMk hq))).const_smul + (-Complex.I) |>.sub (g.continuous.comp continuous_fst) + +noncomputable def expandingPerturbationSource (a k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (m : ℕ) + (q g v : C(Icc (0 : ℝ) T, FourierL2)) : C(Icc (0 : ℝ) T, FourierL2) where + toFun t := expandingPerturbationReaction a k L T ha ha1 hk hL m q g (t, v t) - + expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q 0 (t, v t) + continuous_toFun := + ((expandingPerturbationReaction a k L T ha ha1 hk hL m q g).continuous.comp + (continuous_id.prodMk v.continuous)).sub + ((expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q 0).continuous.comp + (continuous_id.prodMk v.continuous)) + +theorem expandingPerturbationSource_apply (a k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (m : ℕ) + (q g v : C(Icc (0 : ℝ) T, FourierL2)) (t : Icc (0 : ℝ) T) : + expandingPerturbationSource a k L T ha ha1 hk hL m q g v t = + (-Complex.I) • expandingNonlinearRemainder a k (expandingRadiusCurve L T hL t).1 + ha ha1 hk (expandingRadiusCurve L T hL t).2 m (q t) (v t) - g t := by + change (-Complex.I) • (_ - _) - g t - ((-Complex.I) • _ + 0) = _ + simp only [expandingNonlinearRemainder, smul_sub, add_zero] + abel + +theorem expandingPerturbationReaction_split (a k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (m : ℕ) + (q g v : C(Icc (0 : ℝ) T, FourierL2)) (t : Icc (0 : ℝ) T) : + expandingPerturbationReaction a k L T ha ha1 hk hL m q g (t, v t) = + expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q + (expandingPerturbationSource a k L T ha ha1 hk hL m q g v) (t, v t) := by + let A : FourierL2 := expandingPerturbationReaction a k L T ha ha1 hk hL m q g (t, v t) + let D : FourierL2 := (-Complex.I) • + fderiv ℝ (expandingOddPower a k (expandingRadiusCurve L T hL t).1 ha ha1 hk + (expandingRadiusCurve L T hL t).2 m) (q t) (v t) + change A = D + (A - (D + 0)) + abel + +theorem exists_expandingPerturbationSource_bound (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) (R : ℝ) (hR : 0 ≤ R) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ (L T : ℝ) (hL : 1 ≤ L) + (q g v : C(Icc (0 : ℝ) T, FourierL2)) (d G : ℝ), + 0 ≤ d → d ≤ 1 → 0 ≤ G → (∀ t, ‖q t‖ ≤ R) → (∀ t, ‖g t‖ ≤ G) → + (∀ t, ‖v t‖ ≤ d) → ∀ t, + ‖expandingPerturbationSource a k L T ha ha1 hk hL m q g v t‖ ≤ C * d ^ 2 + G := by + obtain ⟨C, hC, hb⟩ := exists_expandingNonlinearRemainder_quadratic a k ha ha1 hk m R hR + refine ⟨C, hC, ?_⟩ + intro L T hL q g v d G hd hd1 hG hq hg hv t + rw [expandingPerturbationSource_apply] + calc + _ ≤ ‖(-Complex.I) • expandingNonlinearRemainder a k + (expandingRadiusCurve L T hL t).1 ha ha1 hk (expandingRadiusCurve L T hL t).2 + m (q t) (v t)‖ + ‖g t‖ := norm_sub_le _ _ + _ = ‖expandingNonlinearRemainder a k (expandingRadiusCurve L T hL t).1 ha ha1 hk + (expandingRadiusCurve L T hL t).2 m (q t) (v t)‖ + ‖g t‖ := by + rw [norm_smul, norm_neg, Complex.norm_I, one_mul] + _ ≤ C * ‖v t‖ ^ 2 + G := add_le_add + (hb _ (expandingRadiusCurve L T hL t).2 _ _ (hq t) ((hv t).trans hd1)) (hg t) + _ ≤ C * d ^ 2 + G := add_le_add (mul_le_mul_of_nonneg_left + (pow_le_pow_left₀ (norm_nonneg _) (hv t) 2) hC) le_rfl + +theorem exists_expandingPerturbationSource_lipschitz (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) (R : ℝ) (hR : 0 ≤ R) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ (L T : ℝ) (hL : 1 ≤ L) + (q g v w : C(Icc (0 : ℝ) T, FourierL2)) (d : ℝ), + 0 ≤ d → d ≤ 1 → (∀ t, ‖q t‖ ≤ R) → (∀ t, ‖v t‖ ≤ d) → + (∀ t, ‖w t‖ ≤ d) → ∀ t, + ‖expandingPerturbationSource a k L T ha ha1 hk hL m q g v t - + expandingPerturbationSource a k L T ha ha1 hk hL m q g w t‖ ≤ + (2 * C * d) * dist v w := by + obtain ⟨C, hC, hb⟩ := exists_expandingNonlinearRemainder_lipschitz a k ha ha1 hk m R hR + refine ⟨C, hC, ?_⟩ + intro L T hL q g v w d hd hd1 hq hv hw t + rw [expandingPerturbationSource_apply, expandingPerturbationSource_apply, + sub_sub_sub_cancel_right, ← smul_sub, norm_smul, norm_neg, Complex.norm_I, one_mul] + calc + _ ≤ C * (‖v t‖ + ‖w t‖) * ‖v t - w t‖ := + hb _ (expandingRadiusCurve L T hL t).2 _ _ _ (hq t) ((hv t).trans hd1) ((hw t).trans hd1) + _ ≤ (2 * C * d) * dist v w := by + apply mul_le_mul + · nlinarith [mul_le_mul_of_nonneg_left (add_le_add (hv t) (hw t)) hC] + · simpa only [dist_eq_norm] using ContinuousMap.dist_apply_le_dist (f := v) (g := w) t + · exact norm_nonneg _ + · positivity + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalAmplitude.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalAmplitude.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f2cab810e25cb0795a08ffd6131c49252e61bb0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalAmplitude.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingModeEquation +import OAI.MathematicalPhysics.DefocusingNLS.Linear.SobolevAmplitude + +namespace OAI + +/-! # The amplitude restoring physical Schrödinger time + +For `2 a m = 1`, the factor below has precisely the nonlinear scaling +required by the clock `L⁻² (1 - exp(-s))`. +-/ + +namespace DefocusingNLS + +noncomputable def expandingPhysicalAmplitude (a b L s : ℝ) : ℂ := + (L ^ (2 * a) : ℝ) * expandingFreeAmplitude (-a) (-b) s + +theorem expandingPhysicalAmplitude_norm (a b L s : ℝ) (hL : 0 < L) : + ‖expandingPhysicalAmplitude a b L s‖ = L ^ (2 * a) * Real.exp (a * s) := by + rw [expandingPhysicalAmplitude, norm_mul, Complex.norm_real, + Real.norm_eq_abs, abs_of_pos (Real.rpow_pos_of_pos hL _), expandingFreeAmplitude_norm] + simp only [neg_neg] + +theorem hasDerivAt_expandingPhysicalAmplitude (a b L s : ℝ) : + HasDerivAt (expandingPhysicalAmplitude a b L) + (((a : ℂ) - Complex.I * b) * expandingPhysicalAmplitude a b L s) s := by + have h := (hasDerivAt_expandingFreeAmplitude (-a) (-b) s).const_mul + ((L ^ (2 * a) : ℝ) : ℂ) + convert h using 1 + · rfl + · unfold expandingPhysicalAmplitude + push_cast + ring + +theorem expandingPhysicalAmplitude_power (a b L s : ℝ) (hL : 0 < L) + (m : ℕ) (ham : 2 * a * m = 1) : + ‖expandingPhysicalAmplitude a b L s‖ ^ (2 * m) = L ^ 2 * Real.exp s := by + have he : 2 * a * ((2 * m : ℕ) : ℝ) = 2 := by + push_cast + nlinarith [ham] + have hes : a * s * ((2 * m : ℕ) : ℝ) = s := by + calc + _ = (2 * a * (m : ℝ)) * s := by push_cast; ring + _ = s := by rw [ham, one_mul] + rw [expandingPhysicalAmplitude_norm a b L s hL, mul_pow, + ← Real.rpow_natCast, ← Real.rpow_mul hL.le, he, Real.rpow_two, + ← Real.exp_nat_mul] + congr 2 + simpa only [mul_comm] using hes + +theorem expandingPhysicalAmplitude_clock (a b L s : ℝ) (hL : 0 < L) + (m : ℕ) (ham : 2 * a * m = 1) : + (L ^ (-2 : ℝ) * Real.exp (-s)) * + ‖expandingPhysicalAmplitude a b L s‖ ^ (2 * m) = 1 := by + rw [expandingPhysicalAmplitude_power a b L s hL m ham] + have hLp : L ^ (-2 : ℝ) * L ^ 2 = 1 := by + rw [← Real.rpow_two, ← Real.rpow_add hL] + norm_num + have he : Real.exp (-s) * Real.exp s = 1 := by + rw [← Real.exp_add] + simp + calc + _ = (L ^ (-2 : ℝ) * L ^ 2) * (Real.exp (-s) * Real.exp s) := by ring + _ = 1 := by rw [hLp, he, one_mul] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalCharacter.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalCharacter.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd2d01929abcd37c19e555c70f537bc93808601b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalCharacter.lean @@ -0,0 +1,42 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingModeEquation +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPhysicalLocalization + +namespace OAI + +/-! # The exact motion of a Fourier character at a fixed physical point -/ + +open scoped RealInnerProductSpace + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem expandingRadius_inv (L t : ℝ) : + (expandingRadius L t)⁻¹ = L⁻¹ * Real.exp (-t / 2) := by + unfold expandingRadius + rw [mul_inv_rev, ← Real.exp_neg] + rw [mul_comm] + congr 1 + ring_nf + +theorem hasDerivAt_expandingRadius_inv (L t : ℝ) : + HasDerivAt (fun s => (expandingRadius L s)⁻¹) (-((expandingRadius L t)⁻¹) / 2) t := by + simp_rw [expandingRadius_inv] + have h := ((((hasDerivAt_id t).neg).div_const 2).exp).const_mul L⁻¹ + apply h.congr_deriv + dsimp + ring + +theorem hasDerivAt_expandingPhysicalCharacter (L t : ℝ) (n : frequencyLattice) (y : E) : + HasDerivAt (fun s => spatialFourierCharacter n ((expandingRadius L s)⁻¹ • y)) + (((-((expandingRadius L t)⁻¹) / 2 * ⟪y, (n : E)⟫ : ℝ) : ℂ) * Complex.I * + spatialFourierCharacter n ((expandingRadius L t)⁻¹ • y)) t := by + have h := (((hasDerivAt_expandingRadius_inv L t).mul_const ⟪y, (n : E)⟫).ofReal_comp.mul_const Complex.I).cexp + unfold spatialFourierCharacter + simp only [real_inner_smul_left] + convert h using 1 + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalClock.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalClock.lean new file mode 100644 index 0000000000000000000000000000000000000000..8628f06b1eb983330c24661fc772e4d531086f5b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalClock.lean @@ -0,0 +1,64 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPhysicalAmplitude +import Mathlib.Analysis.SpecialFunctions.Log.Deriv + +namespace OAI + +/-! # The inverse clock for the physical Schrödinger solution -/ + +namespace DefocusingNLS + +noncomputable def expandingInverseClock (L t : ℝ) : ℝ := + -Real.log (1 - L ^ 2 * t) + +theorem exp_neg_expandingInverseClock (L t : ℝ) (ht : 0 < 1 - L ^ 2 * t) : + Real.exp (-expandingInverseClock L t) = 1 - L ^ 2 * t := by + simp only [expandingInverseClock, neg_neg] + exact Real.exp_log ht + +private theorem radius_clock_cancel (L : ℝ) (hL : 0 < L) : + L ^ 2 * L ^ (-2 : ℝ) = 1 := by + rw [← Real.rpow_two, ← Real.rpow_add hL] + norm_num + +theorem expandingInverseClock_freeTime (L s : ℝ) (hL : 0 < L) : + expandingInverseClock L (expandingFreeTime L s) = s := by + have he : 1 - L ^ 2 * expandingFreeTime L s = Real.exp (-s) := by + unfold expandingFreeTime + rw [← mul_assoc, radius_clock_cancel L hL] + ring + rw [expandingInverseClock, he, Real.log_exp, neg_neg] + +theorem expandingFreeTime_inverseClock (L t : ℝ) (hL : 0 < L) + (ht : 0 < 1 - L ^ 2 * t) : + expandingFreeTime L (expandingInverseClock L t) = t := by + rw [expandingFreeTime, exp_neg_expandingInverseClock L t ht] + have hc : L ^ (-2 : ℝ) * L ^ 2 = 1 := by + rw [mul_comm] + exact radius_clock_cancel L hL + calc + _ = (L ^ (-2 : ℝ) * L ^ 2) * t := by ring + _ = t := by rw [hc, one_mul] + +theorem hasDerivAt_expandingInverseClock (L t : ℝ) (ht : 0 < 1 - L ^ 2 * t) : + HasDerivAt (expandingInverseClock L) (L ^ 2 / (1 - L ^ 2 * t)) t := by + have h := ((((hasDerivAt_const t (1 : ℝ)).sub + ((hasDerivAt_id t).const_mul (L ^ 2))).log ht.ne').neg) + convert h using 1 + · rfl + · dsimp + ring + +theorem expandingInverseClock_derivative_cancel (L t : ℝ) (hL : 0 < L) + (ht : 0 < 1 - L ^ 2 * t) : + (L ^ (-2 : ℝ) * Real.exp (-expandingInverseClock L t)) * + (L ^ 2 / (1 - L ^ 2 * t)) = 1 := by + rw [exp_neg_expandingInverseClock L t ht] + have hc := radius_clock_cancel L hL + have hb := ht.ne' + calc + _ = (L ^ (-2 : ℝ) * L ^ 2) * ((1 - L ^ 2 * t) / (1 - L ^ 2 * t)) := by ring + _ = 1 := by rw [mul_comm (L ^ (-2 : ℝ)) (L ^ 2), hc, div_self hb, one_mul] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalDerivativeBound.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalDerivativeBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..03d6be47afef66fe393202278990aea46d5acc2b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalDerivativeBound.lean @@ -0,0 +1,53 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPhysicalModeRate +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFourierJetBound + +namespace OAI + +/-! # Radius-uniform bounds for finite physical Fourier time derivatives -/ + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem expandingPhysicalDerivative_sum_bound (a b k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (f g : FourierL2) (y : E) (S : Finset frequencyLattice) : + (∑ n ∈ S, ‖(physicalModeRate a b L n y * expandingFourierCoefficient a (k + 2) L f n + + expandingFourierCoefficient a (k + 2) L g n) * spatialFourierCharacter n (L⁻¹ • y)‖) ≤ + (|a| + |b| + 1 + ‖y‖ / 2) * expandingJetBound a k * ‖f‖ + + expandingEmbeddingBound a (k + 2) * ‖g‖ := by + let K := |a| + |b| + 1 + ‖y‖ / 2 + have hK : 0 ≤ K := by dsimp [K]; positivity + have ht (n : frequencyLattice) : + ‖(physicalModeRate a b L n y * expandingFourierCoefficient a (k + 2) L f n + + expandingFourierCoefficient a (k + 2) L g n) * spatialFourierCharacter n (L⁻¹ • y)‖ ≤ + K * ((1 + (‖n‖ / L) ^ 2) * ‖expandingFourierCoefficient a (k + 2) L f n‖) + + ‖expandingFourierCoefficient a (k + 2) L g n‖ := by + rw [norm_mul, spatialFourierCharacter_norm, mul_one] + calc + _ ≤ ‖physicalModeRate a b L n y * expandingFourierCoefficient a (k + 2) L f n‖ + + ‖expandingFourierCoefficient a (k + 2) L g n‖ := norm_add_le _ _ + _ ≤ _ := by + rw [norm_mul] + have h := mul_le_mul_of_nonneg_right + (physicalModeRate_norm_le a b L (by linarith) n y) + (norm_nonneg (expandingFourierCoefficient a (k + 2) L f n)) + dsimp only [K] + nlinarith + calc + _ ≤ ∑ n ∈ S, (K * ((1 + (‖n‖ / L) ^ 2) * ‖expandingFourierCoefficient a (k + 2) L f n‖) + + ‖expandingFourierCoefficient a (k + 2) L g n‖) := Finset.sum_le_sum (fun n _ => ht n) + _ = K * (∑ n ∈ S, (1 + (‖n‖ / L) ^ 2) * ‖expandingFourierCoefficient a (k + 2) L f n‖) + + ∑ n ∈ S, ‖expandingFourierCoefficient a (k + 2) L g n‖ := by + rw [Finset.sum_add_distrib, Finset.mul_sum] + _ ≤ K * (expandingJetBound a k * ‖f‖) + expandingEmbeddingBound a (k + 2) * ‖g‖ := by + apply add_le_add + · exact mul_le_mul_of_nonneg_left (sum_expandingFourier_jet_le a k L ha ha1 hk hL f S) hK + · exact ((summable_norm_expandingFourierCoefficient a (k + 2) L ha ha1 (by linarith) hL g).sum_le_tsum + S (fun n _ => norm_nonneg _)).trans + (tsum_norm_expandingFourierCoefficient_le a (k + 2) L ha ha1 (by linarith) hL g) + _ = _ := by ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalEquation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalEquation.lean new file mode 100644 index 0000000000000000000000000000000000000000..8d1d5500cc69046c2d1b637ea4a178d47a7ccfe1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalEquation.lean @@ -0,0 +1,82 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPhysicalClock +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingSobolevStrong + +namespace OAI + +/-! # Restoring the physical nonlinear Schrödinger equation + +The normalization uses the exact relation `2 a m = 1`. Both the amplitude +and the nonlinear coefficient are restored before changing time. +-/ + +namespace DefocusingNLS + +theorem expandingPhysicalAmplitude_nonlinearity (a b k L s : ℝ) + (hk : 6 < k) (hL : 0 < L) (m : ℕ) (ham : 2 * a * m = 1) + (v : FourierL2) : + (L ^ (-2 : ℝ) * Real.exp (-s)) • lowerSobolevInclusion + (sobolevOddPower k hk m (expandingPhysicalAmplitude a b L s • v)) = + expandingPhysicalAmplitude a b L s • lowerSobolevInclusion + (sobolevOddPower k hk m v) := by + rw [sobolevOddPower_smul_norm, map_smul, map_smul] + have hq : (((L ^ (-2 : ℝ) * Real.exp (-s)) : ℝ) : ℂ) * + ((‖expandingPhysicalAmplitude a b L s‖ ^ (2 * m) : ℝ) : ℂ) = 1 := by + exact_mod_cast expandingPhysicalAmplitude_clock a b L s hL m ham + ext n + simp only [lp.coeFn_smul, Pi.smul_apply, smul_eq_mul, Complex.real_smul] + calc + _ = ((((L ^ (-2 : ℝ) * Real.exp (-s)) : ℝ) : ℂ) * + ((‖expandingPhysicalAmplitude a b L s‖ ^ (2 * m) : ℝ) : ℂ)) * + (expandingPhysicalAmplitude a b L s * + lowerSobolevInclusion (sobolevOddPower k hk m v) n) := by ring + _ = _ := by rw [hq, one_mul] + +theorem hasDerivAt_expandingPhysicalAmplitude_curve (a b k L : ℝ) + (hk : 6 < k) (hL : 0 < L) (m : ℕ) (ham : 2 * a * m = 1) + (v : ℝ → FourierL2) (s : ℝ) + (hv : HasDerivAt (fun t => lowerSobolevInclusion (v t)) + ((-(a : ℂ) + Complex.I * b) • lowerSobolevInclusion (v s) + + (L ^ (-2 : ℝ) * Real.exp (-s)) • lowerSobolevGenerator (v s) + + (-Complex.I) • lowerSobolevInclusion (sobolevOddPower k hk m (v s))) s) : + let U := fun t => expandingPhysicalAmplitude a b L t • v t + HasDerivAt (fun t => lowerSobolevInclusion (U t)) + ((L ^ (-2 : ℝ) * Real.exp (-s)) • + (lowerSobolevGenerator (U s) - + Complex.I • lowerSobolevInclusion (sobolevOddPower k hk m (U s)))) s := by + intro U + have h := (hasDerivAt_expandingPhysicalAmplitude a b L s).smul hv + convert h using 1 + · funext t + exact map_smul lowerSobolevInclusion _ _ + · have hN := expandingPhysicalAmplitude_nonlinearity a b k L s hk hL m ham (v s) + dsimp [U] + rw [smul_sub, smul_comm (L ^ (-2 : ℝ) * Real.exp (-s)) Complex.I, hN, map_smul] + ext n + simp only [lp.coeFn_add, Pi.add_apply, lp.coeFn_sub, Pi.sub_apply, + lp.coeFn_smul, Pi.smul_apply, smul_eq_mul, Complex.real_smul] + ring + +theorem hasDerivAt_expandingPhysicalEquation (a b k L : ℝ) + (hk : 6 < k) (hL : 0 < L) (m : ℕ) (ham : 2 * a * m = 1) + (v : ℝ → FourierL2) (t : ℝ) (ht : 0 < 1 - L ^ 2 * t) + (hv : HasDerivAt (fun s => lowerSobolevInclusion (v s)) + ((-(a : ℂ) + Complex.I * b) • lowerSobolevInclusion (v (expandingInverseClock L t)) + + (L ^ (-2 : ℝ) * Real.exp (-expandingInverseClock L t)) • + lowerSobolevGenerator (v (expandingInverseClock L t)) + + (-Complex.I) • lowerSobolevInclusion + (sobolevOddPower k hk m (v (expandingInverseClock L t)))) + (expandingInverseClock L t)) : + let U := fun τ => expandingPhysicalAmplitude a b L (expandingInverseClock L τ) • + v (expandingInverseClock L τ) + HasDerivAt (fun τ => lowerSobolevInclusion (U τ)) + (lowerSobolevGenerator (U t) - + Complex.I • lowerSobolevInclusion (sobolevOddPower k hk m (U t))) t := by + intro U + have h := (hasDerivAt_expandingPhysicalAmplitude_curve a b k L hk hL m ham + v (expandingInverseClock L t) hv).scomp t (hasDerivAt_expandingInverseClock L t ht) + apply h.congr_deriv + rw [smul_smul, mul_comm, expandingInverseClock_derivative_cancel L t hL ht, one_smul] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalFourier.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalFourier.lean new file mode 100644 index 0000000000000000000000000000000000000000..d16095589380d8e02702d3267bdf5b044de2a08c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalFourier.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.FourierBoundedMultiplier +import OAI.MathematicalPhysics.DefocusingNLS.Linear.TorusPhysicalL2 + +namespace OAI + +/-! # The unweighted physical Fourier vector and volume-normalized mass -/ + +open MeasureTheory +open scoped ENNReal + +namespace DefocusingNLS + +local notation "T" => UnitAddTorus (Fin 12) +noncomputable local instance expandingPhysicalFourierMeasure : MeasureSpace UnitAddCircle := ⟨AddCircle.haarAddCircle⟩ +local instance expandingPhysicalFourierProbability : IsProbabilityMeasure (volume : Measure UnitAddCircle) := + inferInstanceAs (IsProbabilityMeasure AddCircle.haarAddCircle) + +noncomputable def expandingPhysicalFourier (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) : FourierL2 →L[ℂ] FourierL2 := + fourierBoundedMultiplier ‖expandingObservationVector a k L ha ha1 hk hL‖ (norm_nonneg _) + (fun n => ((expandingSobolevWeight a k L n)⁻¹ : ℝ)) + (fun n => lp.norm_apply_le_norm (by norm_num : (2 : ℝ≥0∞) ≠ 0) + (expandingObservationVector a k L ha ha1 hk hL) n) + +@[simp] theorem expandingPhysicalFourier_apply (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) (n : frequencyLattice) : + expandingPhysicalFourier a k L ha ha1 hk hL f n = expandingFourierCoefficient a k L f n := rfl + +theorem expandingPhysicalFourier_isometry (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) : + torusFourierIsometry (expandingPhysicalFourier a k L ha ha1 hk hL f) = + (expandingUnitTorusFunction a k L f).toLp 2 volume ℂ := by + apply torusFourierIsometry_eq_continuous + intro n + exact expandingUnitTorusFunction_coefficient a k L ha ha1 hk hL f n + +noncomputable def expandingPhysicalMassVector (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) : FourierL2 := + ((2 * Real.pi * L) ^ 6 : ℝ) • expandingPhysicalFourier a k L ha ha1 hk hL f + +@[simp] theorem expandingPhysicalMassVector_apply (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) (n : frequencyLattice) : + expandingPhysicalMassVector a k L ha ha1 hk hL f n = + ((2 * Real.pi * L) ^ 6 : ℝ) • expandingFourierCoefficient a k L f n := rfl + +theorem expandingPhysicalMassVector_isometry (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) : + torusFourierIsometry (expandingPhysicalMassVector a k L ha ha1 hk hL f) = + torusPhysicalL2Value L (expandingUnitTorusFunction a k L f) := by + have hs := (torusFourierIsometry.toContinuousLinearEquiv.toContinuousLinearMap.restrictScalars ℝ).map_smul + ((2 * Real.pi * L) ^ 6) (expandingPhysicalFourier a k L ha ha1 hk hL f) + change torusFourierIsometry ((2 * Real.pi * L) ^ 6 • + expandingPhysicalFourier a k L ha ha1 hk hL f) = + (2 * Real.pi * L) ^ 6 • torusFourierIsometry (expandingPhysicalFourier a k L ha ha1 hk hL f) at hs + rw [expandingPhysicalMassVector, hs, expandingPhysicalFourier_isometry] + rfl + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalLocalization.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalLocalization.lean new file mode 100644 index 0000000000000000000000000000000000000000..a1e1e09b5825aa2c2440fc873e6feb667a418686 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalLocalization.lean @@ -0,0 +1,69 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Profile.RadianFourierSeries +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingTorus +import OAI.MathematicalPhysics.DefocusingNLS.Linear.TorusDerivatives + +namespace OAI + +/-! # The actual torus cutoff in Euclidean coordinates + +This identifies the Euclidean Fourier-series localization with χ(y/L)v(y) +for the previously constructed continuous function on the expanding torus. +-/ + +open MeasureTheory +open scoped SchwartzMap RealInnerProductSpace + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +noncomputable def euclideanToTorus (y : E) : SchrodingerTorus := + fun j => (y j : AddCircle (2 * Real.pi)) + +theorem torusCharacter_euclidean (n : frequencyLattice) (y : E) : + torusCharacter n (euclideanToTorus y) = spatialFourierCharacter n y := by + have hcoordinate (j : Fin 12) : + fourier (frequencyCoordinates n j) (y j : AddCircle (2 * Real.pi)) = + Complex.exp (((y j * (n : E) j : ℝ) : ℂ) * Complex.I) := by + rw [fourier_coe_apply] + congr 1 + have hn : (frequencyCoordinates n j : ℂ) = (((n : E) j : ℝ) : ℂ) := by + exact_mod_cast frequencyCoordinates_coe n j + rw [hn] + push_cast + field_simp + change (∏ j : Fin 12, fourier (frequencyCoordinates n j) + (y j : AddCircle (2 * Real.pi))) = _ + simp_rw [hcoordinate] + rw [← Complex.exp_sum] + unfold spatialFourierCharacter + congr 1 + rw [← Finset.sum_mul, ← Complex.ofReal_sum] + congr 1 + simp only [PiLp.inner_apply, RCLike.inner_apply', conj_trivial] + +/-- χ(y/L) times the genuine continuous expanding-torus function. -/ +noncomputable def expandingPhysicalLocalization (a k L : ℝ) (χ : 𝓢(E, ℂ)) + (f : FourierL2) (y : E) : ℂ := + χ (L⁻¹ • y) * expandingTorusFunction a k L f (euclideanToTorus (L⁻¹ • y)) + +theorem expandingPhysicalLocalization_eq_series (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (χ : 𝓢(E, ℂ)) (f : FourierL2) : + expandingPhysicalLocalization a k L χ f = + localizedFourierSeries L χ (expandingFourierCoefficient a k L f) := by + funext y + unfold expandingPhysicalLocalization localizedFourierSeries spatialFourierSeries + rw [expandingTorusFunction_apply a k L ha ha1 hk hL] + simp only [torusCharacter_euclidean] + +theorem integrable_expandingPhysicalLocalization (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (χ : 𝓢(E, ℂ)) (f : FourierL2) : Integrable (expandingPhysicalLocalization a k L χ f) := by + rw [expandingPhysicalLocalization_eq_series a k L ha ha1 hk hL] + exact integrable_localizedFourierSeries L (by linarith) χ _ + (summable_norm_expandingFourierCoefficient a k L ha ha1 hk hL f) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalModeRate.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalModeRate.lean new file mode 100644 index 0000000000000000000000000000000000000000..4412bcf8e814f6b6999d7a87719b79ad1cda203b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalModeRate.lean @@ -0,0 +1,44 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.PhysicalModeRateBound +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingEnergyScaling + +namespace OAI + +/-! # The moving Fourier equation at a fixed Euclidean point -/ + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem expandingModeRate_physical (a b L t : ℝ) (hL : 1 ≤ L) (n : frequencyLattice) : + expandingModeRate a b L t n = + (-(a : ℂ) + Complex.I * b) - Complex.I * (((‖n‖ / expandingRadius L t) ^ 2 : ℝ) : ℂ) := by + have hp := expandingRadius_rpow L t (-2) hL + have he : -(2 : ℝ) * t / 2 = -t := by ring + rw [he] at hp + have hi : (expandingRadius L t ^ 2)⁻¹ = L ^ (-2 : ℝ) * Real.exp (-t) := by + rw [show (-2 : ℝ) = -(2 : ℝ) by norm_num, + Real.rpow_neg (show 0 ≤ expandingRadius L t by unfold expandingRadius; positivity), Real.rpow_two] at hp + simpa only [mul_comm] using hp + have hq : (‖n‖ / expandingRadius L t) ^ 2 = L ^ (-2 : ℝ) * Real.exp (-t) * ‖n‖ ^ 2 := by + rw [div_pow, div_eq_mul_inv, hi] + ring + rw [hq] + rfl + +theorem hasDerivAt_expandingPhysicalMode (a b k L t : ℝ) (hL : 1 ≤ L) + (n : frequencyLattice) (y : E) (u : ℝ → FourierL2) (g : ℂ) + (hu : HasDerivAt (fun s => expandingFourierCoefficient a k (expandingRadius L s) (u s) n) + (expandingModeRate a b L t n * expandingFourierCoefficient a k (expandingRadius L t) (u t) n + g) t) : + HasDerivAt (fun s => expandingFourierCoefficient a k (expandingRadius L s) (u s) n * + spatialFourierCharacter n ((expandingRadius L s)⁻¹ • y)) + ((physicalModeRate a b (expandingRadius L t) n y * + expandingFourierCoefficient a k (expandingRadius L t) (u t) n + g) * + spatialFourierCharacter n ((expandingRadius L t)⁻¹ • y)) t := by + apply (hasDerivAt_expandingPhysicalTerm a k L t n y u _ hu).congr_deriv + rw [expandingModeRate_physical a b L t hL] + unfold physicalModeRate + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalPath.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalPath.lean new file mode 100644 index 0000000000000000000000000000000000000000..f16caa9fc4078447cc60f6dd3d055991a7420fee --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalPath.lean @@ -0,0 +1,51 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingModeEquation + +namespace OAI + +/-! # Continuous identification with a fixed Fourier Sobolev space + +Inverse weight transfer keeps physical Fourier coefficients unchanged. +It permits strong time derivatives to be stated in one fixed Banach space. +-/ + +open Set Filter Topology + +namespace DefocusingNLS + +noncomputable def expandingPhysicalPath (a k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) + (u : C(Icc (0 : ℝ) T, FourierL2)) : C(Icc (0 : ℝ) T, FourierL2) where + toFun t := expandingInverseTransfer a k (expandingRadius L t) ha hk + (hL.trans (expandingRadius_ge L t hL t.2.1)) (u t) + continuous_toFun := + ((continuous_expandingInverseTransfer a k ha hk).comp + (expandingRadiusCurve L T hL).continuous).clm_apply u.continuous + +theorem expandingPhysicalPath_coefficient (a k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) + (u : C(Icc (0 : ℝ) T, FourierL2)) (t : Icc (0 : ℝ) T) (n : frequencyLattice) : + expandingPhysicalPath a k L T ha hk hL u t n = + (expandingSobolevWeight a k 1 n : ℂ) * + expandingFourierCoefficient a k (expandingRadius L t) (u t) n := by + change (expandingInverseRatio a k (expandingRadius L t) n : ℂ) * u t n = _ + unfold expandingInverseRatio expandingFourierCoefficient + push_cast + rw [div_eq_mul_inv, mul_assoc] + +/-- A physical Fourier-coordinate derivative transports into the fixed weighted model. -/ +theorem hasDerivAt_expandingPhysicalPath_coordinate (a k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (u : C(Icc (0 : ℝ) T, FourierL2)) (t : ℝ) (ht : t ∈ Ioo 0 T) + (n : frequencyLattice) (d : ℂ) + (hd : HasDerivAt (fun s => expandingFourierCoefficient a k (expandingRadius L s) + (u (projIcc 0 T hT s)) n) d t) : + HasDerivAt (fun s => expandingPhysicalPath a k L T ha hk hL u (projIcc 0 T hT s) n) + ((expandingSobolevWeight a k 1 n : ℂ) * d) t := by + apply (hd.const_mul _).congr_of_eventuallyEq + filter_upwards [Ioo_mem_nhds ht.1 ht.2] with s hs + rw [projIcc_of_mem _ ⟨hs.1.le, hs.2.le⟩, + expandingPhysicalPath_coefficient a k L T ha hk hL u ⟨s, hs.1.le, hs.2.le⟩ n] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalPolynomial.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalPolynomial.lean new file mode 100644 index 0000000000000000000000000000000000000000..502c3662f3f4f0c4c5b0756edbad8b26aef72105 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalPolynomial.lean @@ -0,0 +1,58 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPhysicalDerivativeBound + +namespace OAI + +/-! # Finite physical Fourier sums along a continuous expanding trajectory -/ + +open Set Filter Topology + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +noncomputable def expandingPhysicalPolynomial (a k L T : ℝ) (hT : 0 ≤ T) + (u : C(Icc (0 : ℝ) T, FourierL2)) (S : Finset frequencyLattice) (y : E) (τ : ℝ) : ℂ := + let s := projIcc 0 T hT τ + ∑ n ∈ S, expandingFourierCoefficient a k (expandingRadius L s) (u s) n * + spatialFourierCharacter n ((expandingRadius L s)⁻¹ • y) + +theorem continuous_expandingPhysicalPolynomial (a k L T : ℝ) (hL : 1 ≤ L) (hT : 0 ≤ T) + (u : C(Icc (0 : ℝ) T, FourierL2)) (S : Finset frequencyLattice) (y : E) : + Continuous (expandingPhysicalPolynomial a k L T hT u S y) := by + apply continuous_finsetSum + intro n _ + have hc : Continuous (fun τ : ℝ => + expandingFourierCoefficient a k (expandingRadius L (projIcc 0 T hT τ)) + (u (projIcc 0 T hT τ)) n) := (continuous_expandingFourierCoefficient a k n).comp + (((expandingRadiusCurve L T hL).continuous.comp continuous_projIcc).prodMk + (u.continuous.comp continuous_projIcc)) + have hi : Continuous (fun τ : ℝ => (expandingRadius L τ)⁻¹) := + continuous_iff_continuousAt.mpr (fun τ => (hasDerivAt_expandingRadius_inv L τ).continuousAt) + have hy : Continuous (fun τ : ℝ => spatialFourierCharacter n + ((expandingRadius L (projIcc 0 T hT τ))⁻¹ • y)) := + (continuous_spatialFourierCharacter n).comp + ((hi.comp (continuous_subtype_val.comp continuous_projIcc)).smul continuous_const) + exact hc.mul hy + +theorem hasDerivAt_expandingPhysicalPolynomial (a b k L T : ℝ) (hL : 1 ≤ L) (hT : 0 ≤ T) + (u : C(Icc (0 : ℝ) T, FourierL2)) (g : ℝ → FourierL2) + (S : Finset frequencyLattice) (y : E) (t : ℝ) (ht : t ∈ Ioo 0 T) + (hmode : ∀ n : frequencyLattice, + HasDerivAt (fun τ => expandingFourierCoefficient a k (expandingRadius L τ) (u (projIcc 0 T hT τ)) n) + (expandingModeRate a b L t n * expandingFourierCoefficient a k (expandingRadius L t) + (u (projIcc 0 T hT t)) n + expandingFourierCoefficient a k (expandingRadius L t) (g t) n) t) : + HasDerivAt (expandingPhysicalPolynomial a k L T hT u S y) + (∑ n ∈ S, (physicalModeRate a b (expandingRadius L t) n y * + expandingFourierCoefficient a k (expandingRadius L t) (u (projIcc 0 T hT t)) n + + expandingFourierCoefficient a k (expandingRadius L t) (g t) n) * + spatialFourierCharacter n ((expandingRadius L t)⁻¹ • y)) t := by + have hd := HasDerivAt.sum (u := S) (fun n _ => + hasDerivAt_expandingPhysicalMode a b k L t hL n y + (fun τ => u (projIcc 0 T hT τ)) _ (hmode n)) + apply hd.congr_of_eventuallyEq + filter_upwards [Ioo_mem_nhds ht.1 ht.2] with τ hτ + simp only [expandingPhysicalPolynomial, Finset.sum_apply, projIcc_of_mem hT ⟨hτ.1.le, hτ.2.le⟩] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalSpaceBound.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalSpaceBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..99d5177787c72aefa8437cf89d4fe3bd40f84b79 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalSpaceBound.lean @@ -0,0 +1,54 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.PhysicalCharacterLipschitz +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFourierJetBound + +namespace OAI + +/-! # A radius-uniform spatial modulus for the actual Fourier realization -/ + +open Filter Topology + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem hasSum_expandingPhysical (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) (y : E) : + HasSum (fun n => expandingFourierCoefficient a k L f n * spatialFourierCharacter n (L⁻¹ • y)) + (expandingTorusFunction a k L f (euclideanToTorus (L⁻¹ • y))) := by + have h := (summable_expandingTorusTerm a k L ha ha1 hk hL f).hasSum.mapL + (ContinuousMap.evalCLM (R := ℂ) (euclideanToTorus (L⁻¹ • y))) + simpa [expandingTorusTerm, expandingTorusFunction, torusCharacter_euclidean] using h + +theorem expandingPhysical_space_bound (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) (x y : E) : + ‖expandingTorusFunction a (k + 2) L f (euclideanToTorus (L⁻¹ • x)) - + expandingTorusFunction a (k + 2) L f (euclideanToTorus (L⁻¹ • y))‖ ≤ + expandingJetBound a k * ‖f‖ * ‖x - y‖ := by + have hx := hasSum_expandingPhysical a (k + 2) L ha ha1 (by linarith) hL f x + have hy := hasSum_expandingPhysical a (k + 2) L ha ha1 (by linarith) hL f y + have hterm (n : frequencyLattice) : + ‖expandingFourierCoefficient a (k + 2) L f n * spatialFourierCharacter n (L⁻¹ • x) - + expandingFourierCoefficient a (k + 2) L f n * spatialFourierCharacter n (L⁻¹ • y)‖ ≤ + ((1 + (‖n‖ / L) ^ 2) * ‖expandingFourierCoefficient a (k + 2) L f n‖) * ‖x - y‖ := by + rw [← mul_sub, norm_mul] + have h := scaledFourierCharacter_lipschitz L (by linarith) n x y + have hr : ‖n‖ / L ≤ 1 + (‖n‖ / L) ^ 2 := by nlinarith [sq_nonneg (‖n‖ / L - 1)] + calc + _ ≤ ‖expandingFourierCoefficient a (k + 2) L f n‖ * ((‖n‖ / L) * ‖x - y‖) := + mul_le_mul_of_nonneg_left h (norm_nonneg _) + _ ≤ ‖expandingFourierCoefficient a (k + 2) L f n‖ * ((1 + (‖n‖ / L) ^ 2) * ‖x - y‖) := by gcongr + _ = _ := by ring + apply le_of_tendsto (hx.sub hy).norm + filter_upwards [] with S + calc + _ ≤ ∑ n ∈ S, ‖expandingFourierCoefficient a (k + 2) L f n * spatialFourierCharacter n (L⁻¹ • x) - + expandingFourierCoefficient a (k + 2) L f n * spatialFourierCharacter n (L⁻¹ • y)‖ := norm_sum_le _ _ + _ ≤ ∑ n ∈ S, ((1 + (‖n‖ / L) ^ 2) * ‖expandingFourierCoefficient a (k + 2) L f n‖) * ‖x - y‖ := + Finset.sum_le_sum (fun n _ => hterm n) + _ = (∑ n ∈ S, (1 + (‖n‖ / L) ^ 2) * ‖expandingFourierCoefficient a (k + 2) L f n‖) * ‖x - y‖ := + (Finset.sum_mul ..).symm + _ ≤ _ := mul_le_mul_of_nonneg_right (sum_expandingFourier_jet_le a k L ha ha1 hk hL f S) (norm_nonneg _) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalTermDerivative.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalTermDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..f9e4709385495e67be5936d276579aa132d372d0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalTermDerivative.lean @@ -0,0 +1,26 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPhysicalCharacter + +namespace OAI + +/-! # Time derivative of one actual Fourier term at a fixed physical point -/ + +open scoped RealInnerProductSpace + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem hasDerivAt_expandingPhysicalTerm (a k L t : ℝ) (n : frequencyLattice) (y : E) + (u : ℝ → FourierL2) (d : ℂ) + (hu : HasDerivAt (fun s => expandingFourierCoefficient a k (expandingRadius L s) (u s) n) d t) : + HasDerivAt (fun s => expandingFourierCoefficient a k (expandingRadius L s) (u s) n * + spatialFourierCharacter n ((expandingRadius L s)⁻¹ • y)) + ((d + ((-((expandingRadius L t)⁻¹) / 2 * ⟪y, (n : E)⟫ : ℝ) : ℂ) * Complex.I * + expandingFourierCoefficient a k (expandingRadius L t) (u t) n) * + spatialFourierCharacter n ((expandingRadius L t)⁻¹ • y)) t := by + convert hu.mul (hasDerivAt_expandingPhysicalCharacter L t n y) using 1 + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalTimeBound.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalTimeBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..39a8ee012a5e4fa0d39299488325534d12a36845 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalTimeBound.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPolynomialTimeBound +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPolynomialLimit + +namespace OAI + +/-! # Uniform physical time control for the actual infinite Fourier series -/ + +open Set Filter Topology + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem expandingPhysical_time_bound (a b k L T M G : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (u : C(Icc (0 : ℝ) T, FourierL2)) (g : ℝ → FourierL2) + (hu : ∀ s, ‖u s‖ ≤ M) (hg : ∀ s ∈ Icc 0 T, ‖g s‖ ≤ G) + (hmode : ∀ t ∈ Ioo 0 T, ∀ n : frequencyLattice, + HasDerivAt (fun τ => expandingFourierCoefficient a (k + 2) (expandingRadius L τ) (u (projIcc 0 T hT τ)) n) + (expandingModeRate a b L t n * expandingFourierCoefficient a (k + 2) (expandingRadius L t) + (u (projIcc 0 T hT t)) n + expandingFourierCoefficient a (k + 2) (expandingRadius L t) (g t) n) t) + (y : E) (s t : Icc (0 : ℝ) T) : + ‖expandingTorusFunction a (k + 2) (expandingRadius L t) (u t) + (euclideanToTorus ((expandingRadius L t)⁻¹ • y)) - + expandingTorusFunction a (k + 2) (expandingRadius L s) (u s) + (euclideanToTorus ((expandingRadius L s)⁻¹ • y))‖ ≤ + ((|a| + |b| + 1 + ‖y‖ / 2) * expandingJetBound a k * M + + expandingEmbeddingBound a (k + 2) * G) * |(t : ℝ) - s| := by + have ht := tendsto_expandingPhysicalPolynomial a (k + 2) L T ha ha1 (by linarith) hL hT u y t + have hs := tendsto_expandingPhysicalPolynomial a (k + 2) L T ha ha1 (by linarith) hL hT u y s + exact le_of_tendsto (ht.sub hs).norm (Filter.Eventually.of_forall (fun S => + expandingPhysicalPolynomial_time_bound a b k L T M G ha ha1 hk hL hT u g hu hg hmode S y s t s.2 t.2)) + +theorem expandingMild_physical_time_bound (a b k L T M G : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (u : C(Icc (0 : ℝ) T, FourierL2)) (g : ℝ → FourierL2) (f : FourierL2) + (hgcont : ContinuousOn g (Icc 0 T)) + (hsol : ∀ s : Icc (0 : ℝ) T, + u s = expandingFreeStep a b (k + 2) L s ha (by linarith) hL s.2.1 f + + expandingDuhamel a b (k + 2) L ha (by linarith) hL s g) + (hu : ∀ s, ‖u s‖ ≤ M) (hg : ∀ s ∈ Icc 0 T, ‖g s‖ ≤ G) + (y : E) (s t : Icc (0 : ℝ) T) : + ‖expandingTorusFunction a (k + 2) (expandingRadius L t) (u t) + (euclideanToTorus ((expandingRadius L t)⁻¹ • y)) - + expandingTorusFunction a (k + 2) (expandingRadius L s) (u s) + (euclideanToTorus ((expandingRadius L s)⁻¹ • y))‖ ≤ + ((|a| + |b| + 1 + ‖y‖ / 2) * expandingJetBound a k * M + + expandingEmbeddingBound a (k + 2) * G) * |(t : ℝ) - s| := by + apply expandingPhysical_time_bound a b k L T M G ha ha1 hk hL hT u g hu hg + intro τ hτ n + apply hasDerivAt_expandingMild_coefficient a b (k + 2) L T ha (by linarith) hL + (fun τ => u (projIcc 0 T hT τ)) g f hgcont + · intro σ hσ + rw [projIcc_of_mem hT hσ] + exact hsol ⟨σ, hσ⟩ + · exact hτ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalTrajectory.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalTrajectory.lean new file mode 100644 index 0000000000000000000000000000000000000000..1cc819031991c22f51eb5ac13550c2f30fbf7da7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPhysicalTrajectory.lean @@ -0,0 +1,144 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPhysicalEquation +import OAI.MathematicalPhysics.DefocusingNLS.Linear.SobolevForwardMaximal + +namespace OAI + +/-! # The constructed moving-scale solution belongs to the maximal physical flow -/ + +open Set Filter Topology + +namespace DefocusingNLS + +theorem strictMono_expandingFreeTime (L : ℝ) (hL : 0 < L) : + StrictMono (expandingFreeTime L) := by + intro s t hst + unfold expandingFreeTime + apply mul_lt_mul_of_pos_left _ (Real.rpow_pos_of_pos hL _) + have he := Real.exp_lt_exp.mpr (neg_lt_neg hst) + linarith + +theorem expanding_clock_denominator_pos (L S t : ℝ) (hL : 0 < L) + (ht : t ≤ expandingFreeTime L S) : 0 < 1 - L ^ 2 * t := by + have hc : L ^ 2 * L ^ (-2 : ℝ) = 1 := by + rw [← Real.rpow_two, ← Real.rpow_add hL] + norm_num + have he : 1 - L ^ 2 * expandingFreeTime L S = Real.exp (-S) := by + unfold expandingFreeTime + rw [← mul_assoc, hc] + ring + have hle := mul_le_mul_of_nonneg_left ht (sq_nonneg L) + linarith [Real.exp_pos (-S)] + +theorem expandingInverseClock_mem_Icc (L S t : ℝ) (hL : 0 < L) + (ht : t ∈ Icc 0 (expandingFreeTime L S)) : expandingInverseClock L t ∈ Icc 0 S := by + have hd := expanding_clock_denominator_pos L S t hL ht.2 + have he := expandingFreeTime_inverseClock L t hL hd + have hm := strictMono_expandingFreeTime L hL + constructor + · apply hm.le_iff_le.mp + rw [he] + simpa only [expandingFreeTime, neg_zero, Real.exp_zero, sub_self, mul_zero] using ht.1 + · apply hm.le_iff_le.mp + simpa only [he] using ht.2 + +theorem expandingInverseClock_mem_Ioo (L S t : ℝ) (hL : 0 < L) + (ht : t ∈ Ioo 0 (expandingFreeTime L S)) : expandingInverseClock L t ∈ Ioo 0 S := by + have hd := expanding_clock_denominator_pos L S t hL ht.2.le + have he := expandingFreeTime_inverseClock L t hL hd + have hm := strictMono_expandingFreeTime L hL + constructor + · apply hm.lt_iff_lt.mp + rw [he] + simpa only [expandingFreeTime, neg_zero, Real.exp_zero, sub_self, mul_zero] using ht.1 + · apply hm.lt_iff_lt.mp + simpa only [he] using ht.2 + +noncomputable def expandingSchrodingerTrajectory (a b k L S : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hS : 0 ≤ S) + (u : C(Icc (0 : ℝ) S, FourierL2)) (t : ℝ) : FourierL2 := + expandingPhysicalAmplitude a b L (expandingInverseClock L t) • + expandingToSobolev a k ha1 hk + (expandingPhysicalPath a k L S ha hk hL u (projIcc 0 S hS (expandingInverseClock L t))) + +theorem expandingSchrodingerTrajectory_zero (a b k L S : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hS : 0 ≤ S) + (u : C(Icc (0 : ℝ) S, FourierL2)) : + expandingSchrodingerTrajectory a b k L S ha ha1 hk hL hS u 0 = + ((L ^ (2 * a) : ℝ) : ℂ) • expandingToSobolev a k ha1 hk + (expandingInverseTransfer a k L ha hk hL (u ⟨0, le_rfl, hS⟩)) := by + simp [expandingSchrodingerTrajectory, expandingInverseClock, expandingPhysicalAmplitude, + expandingFreeAmplitude, expandingPhysicalPath, expandingRadius] + +theorem continuousOn_expandingSchrodingerTrajectory (a b k L S : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hS : 0 ≤ S) + (u : C(Icc (0 : ℝ) S, FourierL2)) : + ContinuousOn (expandingSchrodingerTrajectory a b k L S ha ha1 hk hL hS u) + (Icc 0 (expandingFreeTime L S)) := by + have hLp : 0 < L := by linarith + have hc : ContinuousOn (expandingInverseClock L) (Icc 0 (expandingFreeTime L S)) := by + have hb : Continuous (fun t : ℝ => 1 - L ^ 2 * t) := by fun_prop + exact (hb.continuousOn.log (fun t ht => + (expanding_clock_denominator_pos L S t hLp ht.2).ne')).neg + have hA : Continuous (expandingPhysicalAmplitude a b L) := + continuous_iff_continuousAt.mpr (fun s => + (hasDerivAt_expandingPhysicalAmplitude a b L s).continuousAt) + have hV : Continuous (fun s => expandingToSobolev a k ha1 hk + (expandingPhysicalPath a k L S ha hk hL u (projIcc 0 S hS s))) := + (expandingToSobolev a k ha1 hk).continuous.comp + ((expandingPhysicalPath a k L S ha hk hL u).continuous.comp continuous_projIcc) + exact (hA.comp_continuousOn hc).smul (hV.comp_continuousOn hc) + +theorem hasDerivAt_expandingSchrodingerTrajectory (a b k L S : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hS : 0 ≤ S) + (m : ℕ) (ham : 2 * a * m = 1) + (u : C(Icc (0 : ℝ) S, FourierL2)) (u₀ : FourierL2) + (hu : u = expandingPicard a b k L S ha hk hL hS + (expandingNonlinearReaction a k L S ha ha1 hk hL m) u₀ u) + (t : ℝ) (ht : t ∈ Ioo 0 (expandingFreeTime L S)) : + HasDerivAt (fun s => lowerSobolevInclusion + (expandingSchrodingerTrajectory a b k L S ha ha1 hk hL hS u s)) + (lowerSobolevGenerator (expandingSchrodingerTrajectory a b k L S ha ha1 hk hL hS u t) - + Complex.I • lowerSobolevInclusion (sobolevOddPower k (by linarith) m + (expandingSchrodingerTrajectory a b k L S ha ha1 hk hL hS u t))) t := by + have hLp : 0 < L := by linarith + have hs := expandingInverseClock_mem_Ioo L S t hLp ht + let v : ℝ → FourierL2 := fun s => expandingToSobolev a k ha1 hk + (expandingPhysicalPath a k L S ha hk hL u (projIcc 0 S hS s)) + have hv := hasDerivAt_expandingNonlinearMild_sobolev a b k L S ha ha1 hk hL hS m u u₀ hu + (expandingInverseClock L t) hs + change HasDerivAt (fun s => lowerSobolevInclusion (v s)) + ((-(a : ℂ) + Complex.I * b) • lowerSobolevInclusion (v (expandingInverseClock L t)) + + (L ^ (-2 : ℝ) * Real.exp (-expandingInverseClock L t)) • + lowerSobolevGenerator (v (expandingInverseClock L t)) + + (-Complex.I) • lowerSobolevInclusion + (sobolevOddPower k (by linarith) m (v (expandingInverseClock L t)))) + (expandingInverseClock L t) at hv + have h := hasDerivAt_expandingPhysicalEquation a b k L (by linarith) hLp m ham v t + (expanding_clock_denominator_pos L S t hLp ht.2.le) + hv + exact h + +/-- The actual Picard trajectory, after exact time/amplitude/weight conversion, +is the unique maximal Sobolev Schrödinger solution on its forward slab. -/ +theorem expandingSchrodingerTrajectory_eq_maximal (a b k L S : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hS : 0 < S) + (m : ℕ) (ham : 2 * a * m = 1) + (u : C(Icc (0 : ℝ) S, FourierL2)) (u₀ : FourierL2) + (hu : u = expandingPicard a b k L S ha hk hL hS.le + (expandingNonlinearReaction a k L S ha ha1 hk hL m) u₀ u) : + let U := expandingSchrodingerTrajectory a b k L S ha ha1 hk hL hS.le u + Ico 0 (expandingFreeTime L S) ⊆ maximalSobolevInteractionDomain k (by linarith) m (U 0) ∧ + EqOn U (maximalSobolevSchrodingerFlow k (by linarith) m (U 0)) + (Ico 0 (expandingFreeTime L S)) := by + intro U + have htime : 0 < expandingFreeTime L S := by + have h := strictMono_expandingFreeTime L (by linarith) hS + simpa only [expandingFreeTime, neg_zero, Real.exp_zero, sub_self, mul_zero] using h + exact forwardStrongSobolevSolution_restricts_maximal k (by linarith) m U _ htime + (continuousOn_expandingSchrodingerTrajectory a b k L S ha ha1 hk hL hS.le u) + (fun t ht => hasDerivAt_expandingSchrodingerTrajectory a b k L S ha ha1 hk hL hS.le + m ham u u₀ hu t ht) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPicardContinuity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPicardContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..c1d151641d972e40e81c728338738d68f1ea4850 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPicardContinuity.lean @@ -0,0 +1,113 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingDuhamelFamily +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingBielecki + +namespace OAI + +/-! # Joint continuity of the actual moving-scale Picard operator + +The reaction is allowed to vary with the parameter in the topology of joint +point evaluation. Compactness of the time slab turns this into continuity +of its forcing history. Together with the strongly continuous free family +and the uniformly bounded Duhamel operator this gives the required path +continuity without an operator-norm assertion for Schrödinger evolution. +-/ + +open Set + +namespace DefocusingNLS + +attribute [local irreducible] expandingFreeStep + +noncomputable def expandingReactionSlab (T : ℝ) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) + (u : C(Icc (0 : ℝ) T, FourierL2)) : C(Icc (0 : ℝ) T, FourierL2) := + ⟨fun t => F (t, u t), F.continuous.comp (continuous_id.prodMk u.continuous)⟩ + +theorem continuous_expandingReactionSlab + {P : Type*} [TopologicalSpace P] (T : ℝ) + (F : P → C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) + (hF : Continuous (fun z : P × ((Icc (0 : ℝ) T) × FourierL2) => F z.1 z.2)) : + Continuous (fun z : P × C(Icc (0 : ℝ) T, FourierL2) => + expandingReactionSlab T (F z.1) z.2) := by + apply ContinuousMap.continuous_of_continuous_uncurry + exact hF.comp ((continuous_fst.comp continuous_fst).prodMk + (continuous_snd.prodMk (continuous_eval.comp + ((continuous_snd.comp continuous_fst).prodMk continuous_snd)))) + +noncomputable def expandingFreeSlab (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (u₀ : FourierL2) : + C(Icc (0 : ℝ) T, FourierL2) := + ⟨fun t => expandingFreeStep a b k L t ha hk hL t.2.1 u₀, by + let p : Icc (0 : ℝ) T → ExpandingFreeParameters := + fun t => (⟨L, hL⟩, ⟨t.1, t.2.1⟩) + have hp : Continuous p := + continuous_const.prodMk (continuous_subtype_val.subtype_mk _) + exact (continuous_expandingFreeFamily a b k ha hk u₀).comp hp⟩ + +theorem continuous_expandingFreeSlab (a b k T : ℝ) (ha : 0 < a) (hk : 8 < k) : + Continuous (fun z : {L : ℝ // 1 ≤ L} × FourierL2 => + expandingFreeSlab a b k z.1.1 T ha hk z.1.2 z.2) := by + apply ContinuousMap.continuous_of_continuous_uncurry + let p : ({L : ℝ // 1 ≤ L} × FourierL2) × Icc (0 : ℝ) T → + ExpandingFreeParameters × FourierL2 := + fun z => ((z.1.1, ⟨z.2.1, z.2.2.1⟩), z.1.2) + have hp : Continuous p := + (((continuous_fst.comp continuous_fst).prodMk + ((continuous_subtype_val.comp continuous_snd).subtype_mk _)).prodMk + (continuous_snd.comp continuous_fst)) + exact (continuous_expandingFreeFamily_uncurry a b k ha hk).comp hp + +theorem expandingPicard_eq_slab (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) (u₀ : FourierL2) + (u : C(Icc (0 : ℝ) T, FourierL2)) : + expandingPicard a b k L T ha hk hL hT F u₀ u = + expandingFreeSlab a b k L T ha hk hL u₀ + + expandingDuhamelSlab a b k L T ha hk hL hT (expandingReactionSlab T F u) := by + apply ContinuousMap.ext + intro t + change expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t (expandingReactionHistory T hT F u) = + expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t + (expandingForcingExtension T hT (expandingReactionSlab T F u)) + rfl + +theorem continuous_expandingPicard_family + {P : Type*} [TopologicalSpace P] (a b k T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hT : 0 ≤ T) + (L : P → {L : ℝ // 1 ≤ L}) (hL : Continuous L) + (F : P → C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) + (hF : Continuous (fun z : P × ((Icc (0 : ℝ) T) × FourierL2) => F z.1 z.2)) + (u₀ : P → FourierL2) (hu₀ : Continuous u₀) : + Continuous (fun z : P × C(Icc (0 : ℝ) T, FourierL2) => + expandingPicard a b k (L z.1).1 T ha hk (L z.1).2 hT (F z.1) (u₀ z.1) z.2) := by + simp only [expandingPicard_eq_slab] + exact ((continuous_expandingFreeSlab a b k T ha hk).comp + ((hL.comp continuous_fst).prodMk (hu₀.comp continuous_fst))).add + ((continuous_expandingDuhamelSlab a b k T ha hk hT).comp + ((hL.comp continuous_fst).prodMk (continuous_expandingReactionSlab T F hF))) + +theorem continuous_expandingTimeWeight (T η : ℝ) : + Continuous (expandingTimeWeight T η) := by + apply ContinuousMap.continuous_of_continuous_uncurry + exact (Real.continuous_exp.comp + (continuous_const.mul (continuous_subtype_val.comp continuous_snd))).smul continuous_eval + +theorem continuous_expandingBieleckiPicard_family + {P : Type*} [TopologicalSpace P] (a b k T η : ℝ) + (ha : 0 < a) (hk : 8 < k) (hT : 0 ≤ T) + (L : P → {L : ℝ // 1 ≤ L}) (hL : Continuous L) + (F : P → C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) + (hF : Continuous (fun z : P × ((Icc (0 : ℝ) T) × FourierL2) => F z.1 z.2)) + (u₀ : P → FourierL2) (hu₀ : Continuous u₀) : + Continuous (fun z : P × C(Icc (0 : ℝ) T, FourierL2) => + expandingBieleckiPicard a b k (L z.1).1 T η ha hk (L z.1).2 hT + (F z.1) (u₀ z.1) z.2) := + (continuous_expandingTimeWeight T (-η)).comp + ((continuous_expandingPicard_family a b k T ha hk hT L hL F hF u₀ hu₀).comp + (continuous_fst.prodMk ((continuous_expandingTimeWeight T η).comp continuous_snd))) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPolynomial.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPolynomial.lean new file mode 100644 index 0000000000000000000000000000000000000000..72b92d81434132897fa6afcadbb7568b41a8da46 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPolynomial.lean @@ -0,0 +1,102 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingLinearization +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.UnitTorusCoefficients + +namespace OAI + +/-! # Polynomial coefficient fields for the exact scalar linearization -/ + +open scoped ComplexConjugate + +namespace DefocusingNLS + +noncomputable def expandingConstant (a k L : ℝ) (c : ℂ) : FourierL2 := + lp.single 2 0 ((expandingSobolevWeight a k L 0 : ℂ) * c) + +theorem expandingConstant_coefficient (a k L : ℝ) (hL : 1 ≤ L) (c : ℂ) (n : frequencyLattice) : + expandingFourierCoefficient a k L (expandingConstant a k L c) n = if n = 0 then c else 0 := by + classical + by_cases hn : n = 0 + · subst n + simp only [ite_true] + apply mul_left_cancel₀ (Complex.ofReal_ne_zero.mpr (expandingSobolevWeight_pos a k L hL 0).ne') + rw [weight_mul_expandingFourierCoefficient a k L hL] + simp [expandingConstant] + · simp [expandingConstant, expandingFourierCoefficient, lp.single_apply, hn] + +theorem expandingConstant_function (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (c : ℂ) (x : SchrodingerTorus) : + expandingTorusFunction a k L (expandingConstant a k L c) x = c := by + classical + have hz : frequencyCoordinates (0 : frequencyLattice) = 0 := frequencyCoordinatesEquiv.map_zero + rw [expandingTorusFunction_apply a k L ha ha1 hk hL] + simp only [expandingConstant_coefficient a k L hL] + rw [tsum_eq_single 0] + · simp [torusCharacter, hz] + · intro n hn + simp [hn] + +noncomputable def expandingPower (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (q : FourierL2) : ℕ → FourierL2 + | 0 => expandingConstant a k L 1 + | n + 1 => expandingProduct a k L ha ha1 hk hL q (expandingPower a k L ha ha1 hk hL q n) + +theorem expandingPower_function (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (q : FourierL2) (n : ℕ) (x : SchrodingerTorus) : + expandingTorusFunction a k L (expandingPower a k L ha ha1 hk hL q n) x = + (expandingTorusFunction a k L q x) ^ n := by + induction n with + | zero => simp only [expandingPower, expandingConstant_function a k L ha ha1 hk hL, pow_zero] + | succ n ih => + simp only [expandingPower, expandingTorusFunction_product a k L ha ha1 hk hL, + ContinuousMap.mul_apply, ih, pow_succ] + ring + +theorem expandingTorusFunction_injective (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) : + Function.Injective (expandingTorusFunction a k L) := by + intro f g hfg + ext n + have he := expandingFourierCoefficient_eq_of_torus_eq a k L ha ha1 hk hL f g + (fun x => congrArg (fun F : C(SchrodingerTorus, ℂ) => F (euclideanToTorus x)) hfg) n + rw [← weight_mul_expandingFourierCoefficient a k L hL f n, + ← weight_mul_expandingFourierCoefficient a k L hL g n, he] + +noncomputable def expandingCircularCoefficient (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (m : ℕ) (q : FourierL2) : FourierL2 := + ((m + 1 : ℕ) : ℂ) • expandingProduct a k L ha ha1 hk hL + (expandingPower a k L ha ha1 hk hL q m) + (expandingPower a k L ha ha1 hk hL (fourierConjugate q) m) + +noncomputable def expandingAnticircularCoefficient (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (m : ℕ) (q : FourierL2) : FourierL2 := + (m : ℂ) • expandingProduct a k L ha ha1 hk hL + (expandingPower a k L ha ha1 hk hL q (m + 1)) + (expandingPower a k L ha ha1 hk hL (fourierConjugate q) (m - 1)) + +theorem expandingOddPower_derivative_algebra (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (m : ℕ) (q f : FourierL2) : + fderiv ℝ (expandingOddPower a k L ha ha1 hk hL m) q f = + expandingProduct a k L ha ha1 hk hL + (expandingCircularCoefficient a k L ha ha1 hk hL m q) f + + expandingProduct a k L ha ha1 hk hL + (expandingAnticircularCoefficient a k L ha ha1 hk hL m q) (fourierConjugate f) := by + apply expandingTorusFunction_injective a k L ha ha1 hk hL + ext x + have hadd (u v : FourierL2) : expandingTorusFunction a k L (u + v) x = + expandingTorusFunction a k L u x + expandingTorusFunction a k L v x := by + simp only [expandingTorusFunction_eq_evaluation a k L ha ha1 hk hL, map_add] + have hsmul (c : ℂ) (u : FourierL2) : expandingTorusFunction a k L (c • u) x = + c * expandingTorusFunction a k L u x := by + simp only [expandingTorusFunction_eq_evaluation a k L ha ha1 hk hL, map_smul, smul_eq_mul] + rw [expandingOddPower_fderiv_pointwise_explicit] + simp only [expandingCircularCoefficient, expandingAnticircularCoefficient, hadd, hsmul, + expandingTorusFunction_product a k L ha ha1 hk hL, ContinuousMap.mul_apply, + expandingPower_function a k L ha ha1 hk hL, + expandingTorusFunction_conjugate a k L ha ha1 hk hL, starRingEnd_apply] + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPolynomialLimit.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPolynomialLimit.lean new file mode 100644 index 0000000000000000000000000000000000000000..b156ad208f5e5ee25733051fb6a3b2e983254949 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPolynomialLimit.lean @@ -0,0 +1,29 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPhysicalPolynomial + +namespace OAI + +/-! # Finite physical Fourier sums converge to the actual torus function -/ + +open Set Filter Topology + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem tendsto_expandingPhysicalPolynomial (a k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (u : C(Icc (0 : ℝ) T, FourierL2)) (y : E) (t : Icc (0 : ℝ) T) : + Tendsto (fun S : Finset frequencyLattice => expandingPhysicalPolynomial a k L T hT u S y t) + atTop (𝓝 (expandingTorusFunction a k (expandingRadius L t) (u t) + (euclideanToTorus ((expandingRadius L t)⁻¹ • y)))) := by + have hR : 1 ≤ expandingRadius L t := hL.trans (expandingRadius_ge L t hL t.2.1) + have h := (summable_expandingTorusTerm a k (expandingRadius L t) ha ha1 hk hR (u t)).hasSum.mapL + (ContinuousMap.evalCLM (R := ℂ) (euclideanToTorus ((expandingRadius L t)⁻¹ • y))) + change Tendsto _ atTop _ at h + simpa [expandingPhysicalPolynomial, projIcc_of_mem hT t.2, + expandingTorusTerm, ContinuousMap.smul_apply, smul_eq_mul, + torusCharacter_euclidean, expandingTorusFunction] using h + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPolynomialMoment.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPolynomialMoment.lean new file mode 100644 index 0000000000000000000000000000000000000000..de09a504dbfe2686c4f8927388cdfb4f23ce5768 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPolynomialMoment.lean @@ -0,0 +1,103 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPolynomial +import OAI.MathematicalPhysics.DefocusingNLS.Linear.LatticeMomentAlgebra + +namespace OAI + +/-! # Fourier moments of the actual nonlinear coefficient fields -/ + +open scoped ComplexConjugate + +namespace DefocusingNLS + +attribute [local irreducible] expandingProduct expandingFourierCoefficient expandingPower + expandingConstant fourierConjugate + +variable (a k L : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (N : ℕ) + +theorem expandingProduct_moment (q f : FourierL2) + (hq : Summable (latticeMomentMass L N (expandingFourierCoefficient a k L q))) + (hf : Summable (latticeMomentMass L N (expandingFourierCoefficient a k L f))) : + Summable (latticeMomentMass L N (expandingFourierCoefficient a k L + (expandingProduct a k L ha ha1 hk hL q f))) ∧ + (∑' n, latticeMomentMass L N (expandingFourierCoefficient a k L + (expandingProduct a k L ha ha1 hk hL q f)) n) ≤ + (∑' n, latticeMomentMass L N (expandingFourierCoefficient a k L q) n) * + ∑' n, latticeMomentMass L N (expandingFourierCoefficient a k L f) n := by + have he : expandingFourierCoefficient a k L (expandingProduct a k L ha ha1 hk hL q f) = + fun n => ∑' m, expandingFourierCoefficient a k L q m * expandingFourierCoefficient a k L f (n - m) := by + funext n + exact expandingProduct_coefficient a k L ha ha1 hk hL q f n + rw [he] + exact latticeMoment_convolution L hL N (expandingFourierCoefficient a k L q) + (expandingFourierCoefficient a k L f) hq hf + +theorem expandingScalar_moment (c : ℂ) (q : FourierL2) + (hq : Summable (latticeMomentMass L N (expandingFourierCoefficient a k L q))) : + Summable (latticeMomentMass L N (expandingFourierCoefficient a k L (c • q))) ∧ + (∑' n, latticeMomentMass L N (expandingFourierCoefficient a k L (c • q)) n) = + ‖c‖ * ∑' n, latticeMomentMass L N (expandingFourierCoefficient a k L q) n := by + have he (n : frequencyLattice) : + latticeMomentMass L N (expandingFourierCoefficient a k L (c • q)) n = + ‖c‖ * latticeMomentMass L N (expandingFourierCoefficient a k L q) n := by + rw [latticeMomentMass, expandingFourierCoefficient_smul, norm_mul] + unfold latticeMomentMass + ring + rw [show latticeMomentMass L N (expandingFourierCoefficient a k L (c • q)) = + (fun n => ‖c‖ * latticeMomentMass L N (expandingFourierCoefficient a k L q) n) from funext he] + exact ⟨hq.mul_left _, tsum_mul_left⟩ + +theorem expandingConjugate_moment (q : FourierL2) + (hq : Summable (latticeMomentMass L N (expandingFourierCoefficient a k L q))) : + Summable (latticeMomentMass L N (expandingFourierCoefficient a k L (fourierConjugate q))) ∧ + (∑' n, latticeMomentMass L N (expandingFourierCoefficient a k L (fourierConjugate q)) n) = + ∑' n, latticeMomentMass L N (expandingFourierCoefficient a k L q) n := by + have he (n : frequencyLattice) : + latticeMomentMass L N (expandingFourierCoefficient a k L (fourierConjugate q)) n = + latticeMomentMass L N (expandingFourierCoefficient a k L q) (-n) := by + simp only [latticeMomentMass, expandingFourierCoefficient_conjugate, Complex.norm_conj, + latticeMomentWeight, norm_neg] + rw [show latticeMomentMass L N (expandingFourierCoefficient a k L (fourierConjugate q)) = + (fun n => latticeMomentMass L N (expandingFourierCoefficient a k L q) (-n)) from funext he] + exact ⟨(Equiv.neg frequencyLattice).summable_iff.mpr hq, + (Equiv.neg frequencyLattice).tsum_eq _⟩ + +include hL in +theorem expandingConstant_moment (c : ℂ) : + HasSum (latticeMomentMass L N (expandingFourierCoefficient a k L (expandingConstant a k L c))) ‖c‖ := by + classical + have he : latticeMomentMass L N (expandingFourierCoefficient a k L (expandingConstant a k L c)) = + (fun n : frequencyLattice => if n = 0 then ‖c‖ else 0) := by + funext n + rw [latticeMomentMass, expandingConstant_coefficient a k L hL] + by_cases hn : n = 0 + · subst n + simp [latticeMomentWeight] + · simp [hn] + rw [he] + exact hasSum_ite_eq 0 ‖c‖ + +theorem expandingPower_moment (q : FourierL2) + (hq : Summable (latticeMomentMass L N (expandingFourierCoefficient a k L q))) (m : ℕ) : + Summable (latticeMomentMass L N (expandingFourierCoefficient a k L + (expandingPower a k L ha ha1 hk hL q m))) ∧ + (∑' n, latticeMomentMass L N (expandingFourierCoefficient a k L + (expandingPower a k L ha ha1 hk hL q m)) n) ≤ + (∑' n, latticeMomentMass L N (expandingFourierCoefficient a k L q) n) ^ m := by + induction m with + | zero => + simp only [expandingPower] + have h := expandingConstant_moment a k L hL N (1 : ℂ) + exact ⟨h.summable, by simp only [h.tsum_eq, norm_one, pow_zero, le_refl]⟩ + | succ m ih => + simp only [expandingPower] + obtain ⟨hs, hb⟩ := expandingProduct_moment a k L ha ha1 hk hL N q + (expandingPower a k L ha ha1 hk hL q m) hq ih.1 + refine ⟨hs, hb.trans ?_⟩ + rw [pow_succ'] + apply mul_le_mul_of_nonneg_left ih.2 + exact tsum_nonneg (fun n => mul_nonneg + (le_trans zero_le_one (latticeMomentWeight_one_le L hL N n)) (norm_nonneg _)) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPolynomialTimeBound.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPolynomialTimeBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..0dd937c5c395cf5ea1ada8465e4221c6adbd5c13 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPolynomialTimeBound.lean @@ -0,0 +1,49 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPhysicalPolynomial +import OAI.MathematicalPhysics.DefocusingNLS.Certificates.InteriorDerivativeLipschitz + +namespace OAI + +/-! # A uniform time modulus for finite physical Fourier sums -/ + +open Set + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem expandingPhysicalPolynomial_time_bound (a b k L T M G : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (u : C(Icc (0 : ℝ) T, FourierL2)) (g : ℝ → FourierL2) + (hu : ∀ s, ‖u s‖ ≤ M) (hg : ∀ s ∈ Icc 0 T, ‖g s‖ ≤ G) + (hmode : ∀ t ∈ Ioo 0 T, ∀ n : frequencyLattice, + HasDerivAt (fun τ => expandingFourierCoefficient a (k + 2) (expandingRadius L τ) (u (projIcc 0 T hT τ)) n) + (expandingModeRate a b L t n * expandingFourierCoefficient a (k + 2) (expandingRadius L t) + (u (projIcc 0 T hT t)) n + expandingFourierCoefficient a (k + 2) (expandingRadius L t) (g t) n) t) + (S : Finset frequencyLattice) (y : E) (s t : ℝ) (hs : s ∈ Icc 0 T) (ht : t ∈ Icc 0 T) : + ‖expandingPhysicalPolynomial a (k + 2) L T hT u S y t - + expandingPhysicalPolynomial a (k + 2) L T hT u S y s‖ ≤ + ((|a| + |b| + 1 + ‖y‖ / 2) * expandingJetBound a k * M + + expandingEmbeddingBound a (k + 2) * G) * |t - s| := by + let D := fun τ => ∑ n ∈ S, + (physicalModeRate a b (expandingRadius L τ) n y * + expandingFourierCoefficient a (k + 2) (expandingRadius L τ) (u (projIcc 0 T hT τ)) n + + expandingFourierCoefficient a (k + 2) (expandingRadius L τ) (g τ) n) * + spatialFourierCharacter n ((expandingRadius L τ)⁻¹ • y) + apply norm_sub_le_of_interior_derivative _ D T _ hT + (continuous_expandingPhysicalPolynomial a (k + 2) L T hL hT u S y) + (fun τ hτ => hasDerivAt_expandingPhysicalPolynomial a b (k + 2) L T hL hT u g S y τ hτ (hmode τ hτ)) + ?_ s t hs ht + intro τ hτ + have hR : 1 ≤ expandingRadius L τ := hL.trans (expandingRadius_ge L τ hL hτ.1.le) + have he := expandingPhysicalDerivative_sum_bound a b k (expandingRadius L τ) ha ha1 hk hR + (u (projIcc 0 T hT τ)) (g τ) y S + have hb := (norm_sum_le S _).trans he + dsimp only [D] + apply hb.trans + apply add_le_add + · exact mul_le_mul_of_nonneg_left (hu _) (by unfold expandingJetBound expandingEmbeddingBound; positivity) + · exact mul_le_mul_of_nonneg_left (hg τ ⟨hτ.1.le, hτ.2.le⟩) (by unfold expandingEmbeddingBound; positivity) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPositivePower.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPositivePower.lean new file mode 100644 index 0000000000000000000000000000000000000000..245625b07406dfef65169ba3eb762deee4ca679e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPositivePower.lean @@ -0,0 +1,53 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProductDifference +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPolynomial + +namespace OAI + +/-! # Uniform bounds for positive powers in the expanding Sobolev algebra -/ + +namespace DefocusingNLS + +theorem expandingProduct_one_right (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (q : FourierL2) : + expandingProduct a k L ha ha1 hk hL q (expandingConstant a k L 1) = q := by + apply expandingTorusFunction_injective a k L ha ha1 hk hL + ext x + rw [expandingTorusFunction_product, ContinuousMap.mul_apply, + expandingConstant_function a k L ha ha1 hk hL, mul_one] + +theorem expandingPower_one (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (q : FourierL2) : + expandingPower a k L ha ha1 hk hL q 1 = q := by + apply expandingTorusFunction_injective a k L ha ha1 hk hL + ext x + rw [expandingPower_function, pow_one] + +theorem expandingPower_positive_norm_le (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (q : FourierL2) (n : ℕ) : + ‖expandingPower a k L ha ha1 hk hL q (n + 1)‖ ≤ + expandingAlgebraBound a k ^ n * ‖q‖ ^ (n + 1) := by + induction n with + | zero => rw [expandingPower_one]; simp + | succ n ih => + change ‖expandingProduct a k L ha ha1 hk hL q + (expandingPower a k L ha ha1 hk hL q (n + 1))‖ ≤ _ + calc + _ ≤ expandingAlgebraBound a k * ‖q‖ * + ‖expandingPower a k L ha ha1 hk hL q (n + 1)‖ := + expandingProduct_norm_le a k L ha ha1 hk hL _ _ + _ ≤ expandingAlgebraBound a k * ‖q‖ * + (expandingAlgebraBound a k ^ n * ‖q‖ ^ (n + 1)) := + mul_le_mul_of_nonneg_left ih (mul_nonneg (expandingAlgebraBound_nonneg a k) (norm_nonneg _)) + _ = _ := by rw [pow_succ, pow_succ ‖q‖]; ring + +theorem expandingAnticircularCoefficient_one (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (q : FourierL2) : + expandingAnticircularCoefficient a k L ha ha1 hk hL 1 q = + expandingPower a k L ha ha1 hk hL q 2 := by + simp only [expandingAnticircularCoefficient, Nat.cast_one, Nat.reduceSub, + expandingPower, one_smul, expandingProduct_one_right] + + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPotentialContinuity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPotentialContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..cb6f61a14f92d8d7f6da8aaab3429c8de1af2f04 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingPotentialContinuity.lean @@ -0,0 +1,103 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingNonlinearityTransport +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingMildContraction +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingLinearization + +namespace OAI + +/-! # The actual nonautonomous linearized potential + +A continuous profile and a continuous expanding radius give the potential +`-i D(|u|^(2m)u)|q(t)`. Its short-time construction uses the uniform exact +`Y_L` derivative bounds already proved, not a separately assumed potential. +-/ + +namespace DefocusingNLS + +/-- The actual real-linearized odd-power reaction along a moving profile. -/ +noncomputable def expandingProfileReaction (a k T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) + (l : C(Set.Icc (0 : ℝ) T, {L : ℝ // 1 ≤ L})) + (q g : C(Set.Icc (0 : ℝ) T, FourierL2)) : + C((Set.Icc (0 : ℝ) T) × FourierL2, FourierL2) where + toFun p := -Complex.I • + fderiv ℝ (expandingOddPower a k (l p.1).1 ha ha1 hk (l p.1).2 m) (q p.1) p.2 + g p.1 + continuous_toFun := by + have hp : Continuous (fun p : (Set.Icc (0 : ℝ) T) × FourierL2 => + (l p.1, (q p.1, p.2))) := + (l.continuous.comp continuous_fst).prodMk + ((q.continuous.comp continuous_fst).prodMk continuous_snd) + exact (((continuous_expandingLinearization_scale a k ha ha1 hk m).comp hp).const_smul + (-Complex.I : ℂ)).add (g.continuous.comp continuous_fst) + +/-- One Lipschitz bound applies to every starting scale and every bounded profile. -/ +theorem exists_expandingProfileReaction_lipschitz (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) (R : ℝ) (hR : 0 ≤ R) : + ∃ K : ℝ, 0 ≤ K ∧ ∀ (T : ℝ) + (l : C(Set.Icc (0 : ℝ) T, {L : ℝ // 1 ≤ L})) + (q g : C(Set.Icc (0 : ℝ) T, FourierL2)), + (∀ t, ‖q t‖ ≤ R) → ∀ t x y, + ‖expandingProfileReaction a k T ha ha1 hk m l q g (t, x) - + expandingProfileReaction a k T ha ha1 hk m l q g (t, y)‖ ≤ K * ‖x - y‖ := by + obtain ⟨K, hK, hbound⟩ := exists_expandingOddPower_two_jet_bound a k ha ha1 hk m R hR + refine ⟨K, hK, ?_⟩ + intro T l q g hq t x y + have hD : ‖fderiv ℝ (expandingOddPower a k (l t).1 ha ha1 hk (l t).2 m) (q t)‖ ≤ K := by + rw [← norm_iteratedFDeriv_one] + exact hbound (l t).1 (l t).2 (q t) (hq t) 1 (by decide) + change ‖(-Complex.I • + fderiv ℝ (expandingOddPower a k (l t).1 ha ha1 hk (l t).2 m) (q t) x + g t) - + (-Complex.I • + fderiv ℝ (expandingOddPower a k (l t).1 ha ha1 hk (l t).2 m) (q t) y + g t)‖ ≤ _ + rw [add_sub_add_right_eq_sub, ← smul_sub, ← map_sub, norm_smul] + simp only [norm_neg, Complex.norm_I, one_mul] + exact ((fderiv ℝ (expandingOddPower a k (l t).1 ha ha1 hk (l t).2 m) (q t)).le_opNorm + (x - y)).trans (mul_le_mul_of_nonneg_right hD (norm_nonneg _)) + +/-- The radius follows exactly the manuscript's moving family `L exp(t/2)`. -/ +noncomputable def expandingRadiusCurve (L T : ℝ) (hL : 1 ≤ L) : + C(Set.Icc (0 : ℝ) T, {M : ℝ // 1 ≤ M}) where + toFun t := ⟨expandingRadius L t, hL.trans (expandingRadius_ge L t hL t.2.1)⟩ + continuous_toFun := by + apply Continuous.subtype_mk + exact continuous_const.mul (Real.continuous_exp.comp (continuous_subtype_val.div_const 2)) + +/-- The reaction is exactly the scalar linearized Schrödinger potential at each point. -/ +theorem expandingProfileReaction_pointwise (a k T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) + (l : C(Set.Icc (0 : ℝ) T, {L : ℝ // 1 ≤ L})) + (q g : C(Set.Icc (0 : ℝ) T, FourierL2)) + (t : Set.Icc (0 : ℝ) T) (v : FourierL2) (x : SchrodingerTorus) : + expandingTorusFunction a k (l t).1 + (expandingProfileReaction a k T ha ha1 hk m l q g (t, v)) x = + -Complex.I * oddPowerDerivative m + (expandingTorusFunction a k (l t).1 (q t) x) + (expandingTorusFunction a k (l t).1 v x) + + expandingTorusFunction a k (l t).1 (g t) x := by + rw [expandingTorusFunction_eq_evaluation a k (l t).1 ha ha1 hk (l t).2] + change expandingPointEvaluation a k (l t).1 ha ha1 hk (l t).2 x + (-Complex.I • _ + g t) = _ + rw [map_add, map_smul] + simp only [← expandingTorusFunction_eq_evaluation a k (l t).1 ha ha1 hk (l t).2, + smul_eq_mul, expandingOddPower_fderiv_pointwise] + +/-- Uniform short-slab existence for the actual varying-scale linearized potential. -/ +theorem exists_expandingProfile_mild_bound (a b k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) (R : ℝ) (hR : 0 ≤ R) : + ∃ K : ℝ, 0 ≤ K ∧ ∀ (L T : ℝ) (hL : 1 ≤ L) (hT : 0 ≤ T), T * K < 1 → + ∀ (q g : C(Set.Icc (0 : ℝ) T, FourierL2)) (u₀ : FourierL2), + (∀ t, ‖q t‖ ≤ R) → + ∃! u : C(Set.Icc (0 : ℝ) T, FourierL2), ∀ t : Set.Icc (0 : ℝ) T, + u t = expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t + (expandingReactionHistory T hT + (expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q g) u) := by + obtain ⟨K, hK, hbound⟩ := exists_expandingProfileReaction_lipschitz a k ha ha1 hk m R hR + refine ⟨K, hK, ?_⟩ + intro L T hL hT hTK q g u₀ hq + exact existsUnique_expandingMildSolution a b k L T ha hk hL hT + (expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q g) + u₀ K hK hTK (hbound T (expandingRadiusCurve L T hL) q g hq) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProductCommutator.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProductCommutator.lean new file mode 100644 index 0000000000000000000000000000000000000000..604a5e9e5a5e928930d22deb76775879ec6d6ec6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProductCommutator.lean @@ -0,0 +1,76 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.TorusFourierProduct +import OAI.MathematicalPhysics.DefocusingNLS.Linear.TorusOrderedEnergy +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingOrderedSymbol +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingMultiplication + +namespace OAI + +/-! # The exact Fourier kernel of the physical product commutator -/ + +namespace DefocusingNLS + +noncomputable def expandingProductCommutator (a L : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hL : 1 ≤ L) + (j : Fin N → Fin 12) (q f : FourierL2) : FourierL2 := + expandingOrderedFourierEnergy a L N hL j (expandingProduct a N L ha ha1 hN hL q f) - + fourierConvolution (expandingFourierCoefficient a N L q) + (expandingOrderedFourierEnergy a L N hL j f) + +theorem expandingOrderedMultiplier_mul_weight (a L : ℝ) (N : ℕ) (hL : 1 ≤ L) + (j : Fin N → Fin 12) (n : frequencyLattice) : + expandingOrderedMultiplier a L N j n * (expandingSobolevWeight a N L n : ℂ) = + (((2 * Real.pi) ^ 6 * L ^ (6 - (N : ℝ)) : ℝ) : ℂ) * homogeneousOrderedSymbol N j n := by + unfold expandingOrderedMultiplier + push_cast + field_simp [(Complex.ofReal_ne_zero.mpr (expandingSobolevWeight_pos a N L hL n).ne')] + +theorem expandingProductCommutator_kernel (a L : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hL : 1 ≤ L) + (j : Fin N → Fin 12) (q f : FourierL2) (n : frequencyLattice) : + expandingProductCommutator a L N ha ha1 hN hL j q f n = + ∑' m, expandingFourierCoefficient a N L q m * + expandingOrderedDifference a L N j m (n - m) * f (n - m) := by + let C : ℂ := (((2 * Real.pi) ^ 6 * L ^ (6 - (N : ℝ)) : ℝ) : ℂ) + let A : frequencyLattice → ℂ := fun m => C * homogeneousOrderedSymbol N j n * + (expandingFourierCoefficient a N L q m * expandingFourierCoefficient a N L f (n - m)) + let B : frequencyLattice → ℂ := fun m => expandingFourierCoefficient a N L q m * + (expandingOrderedMultiplier a L N j (n - m) * f (n - m)) + have hA : Summable A := + (summable_expandingProductTerms a N L ha ha1 hN hL q f n).mul_left _ + have hB : Summable B := by + have h := (summable_fourierConvolution_terms (expandingFourierCoefficient a N L q) + (summable_norm_expandingFourierCoefficient a N L ha ha1 hN hL q) + (expandingOrderedFourierEnergy a L N hL j f)).hasSum.mapL + (lp.evalCLM ℂ (fun _ : frequencyLattice => ℂ) 2 n) + have hs := h.summable + change Summable (fun m => expandingFourierCoefficient a N L q m * + expandingOrderedFourierEnergy a L N hL j f (n - m)) at hs + simpa only [expandingOrderedFourierEnergy_apply, B] using hs + have hterm (m : frequencyLattice) : A m - B m = + expandingFourierCoefficient a N L q m * + expandingOrderedDifference a L N j m (n - m) * f (n - m) := by + have hm : ((n - m : frequencyLattice) : EuclideanSpace ℝ (Fin 12)) + m = n := by + change (n : EuclideanSpace ℝ (Fin 12)) - m + m = n + exact sub_add_cancel _ _ + dsimp only [A, B, C, expandingOrderedDifference, expandingOrderedFactor, + expandingOrderedMultiplier, expandingFourierCoefficient] + rw [hm] + push_cast + ring + rw [show (fun m => expandingFourierCoefficient a N L q m * + expandingOrderedDifference a L N j m (n - m) * f (n - m)) = + (fun m => A m - B m) from funext (fun m => (hterm m).symm), hA.tsum_sub hB] + change expandingOrderedFourierEnergy a L N hL j + (expandingProduct a N L ha ha1 hN hL q f) n - + fourierConvolution (expandingFourierCoefficient a N L q) + (expandingOrderedFourierEnergy a L N hL j f) n = _ + rw [fourierConvolution_apply _ (summable_norm_expandingFourierCoefficient a N L ha ha1 hN hL q)] + congr 1 + · change expandingOrderedMultiplier a L N j n * + ((expandingSobolevWeight a N L n : ℂ) * expandingProductCoefficient a N L q f n) = _ + rw [← mul_assoc, expandingOrderedMultiplier_mul_weight a L N hL] + exact (tsum_mul_left).symm + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProductCommutatorBound.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProductCommutatorBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..53d7c950026840ef894e11b6ec1ed32f153c6cea --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProductCommutatorBound.lean @@ -0,0 +1,84 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProductCommutator + +namespace OAI + +/-! # A uniform high-frequency estimate for the actual product commutator -/ + +open scoped ENNReal + +namespace DefocusingNLS + +noncomputable def expandingCommutatorMoment (L : ℝ) (N : ℕ) + (c : frequencyLattice → ℂ) (m : frequencyLattice) : ℝ := + ‖c m‖ * (‖m‖ / L) * (2 + ‖m‖ / L) ^ N + +theorem expandingCommutatorMoment_nonneg (L : ℝ) (hL : 1 ≤ L) (N : ℕ) + (c : frequencyLattice → ℂ) (m : frequencyLattice) : + 0 ≤ expandingCommutatorMoment L N c m := by + unfold expandingCommutatorMoment + positivity + +theorem expandingProductCommutator_high_norm_le (a L R : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < ((N + 1 : ℕ) : ℝ)) + (hL : 1 ≤ L) (hR : 1 ≤ R) (j : Fin (N + 1) → Fin 12) (q f : FourierL2) + (hM : Summable (expandingCommutatorMoment L N (expandingFourierCoefficient a ((N + 1 : ℕ) : ℝ) L q))) + (hf : ∀ n : frequencyLattice, ‖n‖ < R * L → f n = 0) : + ‖expandingProductCommutator a L (N + 1) ha ha1 hN hL j q f‖ ≤ + ((N + 1 : ℕ) / R) * + (∑' m, expandingCommutatorMoment L N (expandingFourierCoefficient a ((N + 1 : ℕ) : ℝ) L q) m) * ‖f‖ := by + let K := expandingCommutatorMoment L N (expandingFourierCoefficient a ((N + 1 : ℕ) : ℝ) L q) + let c : ℝ := (N + 1 : ℕ) / R + let g := fourierConvolution (fun m => (K m : ℂ)) (fourierAbsolute f) + have hK (m : frequencyLattice) : 0 ≤ K m := expandingCommutatorMoment_nonneg L hL N _ m + have hc : 0 ≤ c := div_nonneg (by positivity) (by linarith) + have hKsum : Summable (fun m => ‖(K m : ℂ)‖) := by + simpa only [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (hK _)] using hM + have hgn (n : frequencyLattice) : ‖g n‖ = ∑' m, K m * ‖f (n - m)‖ := by + dsimp only [g] + rw [fourierConvolution_apply _ hKsum] + simp only [fourierAbsolute_apply, ← Complex.ofReal_mul, ← Complex.ofReal_tsum, + Complex.norm_real, Real.norm_eq_abs] + exact abs_of_nonneg (tsum_nonneg (fun m => mul_nonneg (hK m) (norm_nonneg _))) + have hpoint (n : frequencyLattice) : + ‖expandingProductCommutator a L (N + 1) ha ha1 hN hL j q f n‖ ≤ c * ‖g n‖ := by + let F := fun m => expandingFourierCoefficient a ((N + 1 : ℕ) : ℝ) L q m * + expandingOrderedDifference a L (N + 1) j m (n - m) * f (n - m) + have hterm (m : frequencyLattice) : ‖F m‖ ≤ c * (K m * ‖f (n - m)‖) := by + by_cases h : ‖n - m‖ < R * L + · simp only [F, hf _ h, mul_zero, norm_zero] + exact le_rfl + · have hd := expandingOrderedDifference_high a L R N hL hR j m (n - m) (le_of_not_gt h) + have hb := mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_left hd (norm_nonneg (expandingFourierCoefficient a ((N + 1 : ℕ) : ℝ) L q m))) + (norm_nonneg (f (n - m))) + dsimp only [F, K, c, expandingCommutatorMoment] + rw [norm_mul, norm_mul] + convert hb using 1; ring + have hs : Summable (fun m => K m * ‖f (n - m)‖) := + Summable.of_nonneg_of_le (fun m => mul_nonneg (hK m) (norm_nonneg _)) + (fun m => mul_le_mul_of_nonneg_left + (lp.norm_apply_le_norm (by norm_num : (2 : ℝ≥0∞) ≠ 0) f (n - m)) (hK m)) + (hM.mul_right ‖f‖) + have hF : Summable (fun m => ‖F m‖) := + Summable.of_nonneg_of_le (fun m => norm_nonneg _) hterm (hs.mul_left c) + rw [expandingProductCommutator_kernel] + change ‖∑' m, F m‖ ≤ c * ‖g n‖ + calc + _ ≤ ∑' m, ‖F m‖ := norm_tsum_le_tsum_norm hF + _ ≤ ∑' m, c * (K m * ‖f (n - m)‖) := hF.tsum_le_tsum hterm (hs.mul_left c) + _ = c * ‖g n‖ := by rw [tsum_mul_left, hgn] + have hnorm : ‖expandingProductCommutator a L (N + 1) ha ha1 hN hL j q f‖ ≤ ‖(c : ℂ) • g‖ := by + apply lp.norm_mono (by norm_num : (2 : ℝ≥0∞) ≠ 0) + intro n + simpa only [lp.coeFn_smul, Pi.smul_apply, norm_smul, Complex.norm_real, + Real.norm_eq_abs, abs_of_nonneg hc] using hpoint n + have hg := fourierConvolution_norm_le (fun m => (K m : ℂ)) hKsum (fourierAbsolute f) + simp only [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (hK _), fourierAbsolute_norm] at hg + calc + _ ≤ c * ‖g‖ := by simpa only [norm_smul, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg hc] using hnorm + _ ≤ c * ((∑' m, K m) * ‖f‖) := mul_le_mul_of_nonneg_left hg hc + _ = _ := by dsimp only [c, K]; ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProductCommutatorLinear.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProductCommutatorLinear.lean new file mode 100644 index 0000000000000000000000000000000000000000..6b715214f6811cd8633ca4d2fae6736ddd9f69cf --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProductCommutatorLinear.lean @@ -0,0 +1,22 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.TorusProductCommutator + +namespace OAI + +/-! # Linearity of the physical product commutator in the field -/ + +namespace DefocusingNLS + +theorem expandingProductCommutator_add (a L : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hL : 1 ≤ L) + (j : Fin N → Fin 12) (q f g : FourierL2) : + expandingProductCommutator a L N ha ha1 hN hL j q (f + g) = + expandingProductCommutator a L N ha ha1 hN hL j q f + + expandingProductCommutator a L N ha ha1 hN hL j q g := by + apply torusFourierIsometry.injective + rw [map_add] + simp only [torusProductCommutator_physical, expandingProduct_add_right, map_add] + abel + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProductDerivativeFormula.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProductDerivativeFormula.lean new file mode 100644 index 0000000000000000000000000000000000000000..79d9ab4817ab4152aa2c1cd89addd4561ffb9f83 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProductDerivativeFormula.lean @@ -0,0 +1,72 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingOrderedPhysicalSymbol +import OAI.MathematicalPhysics.DefocusingNLS.Linear.SchwartzPartialDerivative +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingMultiplication + +namespace OAI + +/-! # Exact Cartesian product rule for the normalized Fourier energy -/ + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem expandingProduct_derivative_formula (a L : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hL : 1 ≤ L) + (j : Fin N → Fin 12) (q f : FourierL2) (qs fs : Finset (Fin N) → FourierL2) + (hq : ∀ s n, expandingFourierCoefficient a N L (qs s) n = + homogeneousPartialSymbol N j s (L⁻¹ • (n : E)) * expandingFourierCoefficient a N L q n) + (hf : ∀ s n, expandingFourierCoefficient a N L (fs s) n = + homogeneousPartialSymbol N j sᶜ (L⁻¹ • (n : E)) * expandingFourierCoefficient a N L f n) : + expandingOrderedFourierEnergy a L N hL j (expandingProduct a N L ha ha1 hN hL q f) = + ∑ s : Finset (Fin N), expandingPhysicalMassVector a N L ha ha1 hN hL + (expandingProduct a N L ha ha1 hN hL (qs s) (fs s)) := by + classical + ext n + change _ = (lp.evalCLM ℂ (fun _ : frequencyLattice => ℂ) 2 n) _ + rw [map_sum, expandingOrderedFourierEnergy_physical] + change _ = ∑ s : Finset (Fin N), (expandingPhysicalMassVector a N L ha ha1 hN hL + (expandingProduct a N L ha ha1 hN hL (qs s) (fs s))) n + simp only [expandingPhysicalMassVector_apply, Complex.real_smul, + expandingProduct_coefficient] + push_cast + let D : ℂ := (2 * Real.pi * L) ^ (6 : ℕ) + have hs (s : Finset (Fin N)) : HasSum (fun m : frequencyLattice => + D * (expandingFourierCoefficient a N L (qs s) m * + expandingFourierCoefficient a N L (fs s) (n - m))) + (D * expandingProductCoefficient a N L (qs s) (fs s) n) := + (summable_expandingProductTerms a N L ha ha1 hN hL (qs s) (fs s) n).hasSum.mul_left D + have hsum := hasSum_sum (s := Finset.univ) (fun s _ => hs s) + have he (m : frequencyLattice) : + (∑ s : Finset (Fin N), D * (expandingFourierCoefficient a N L (qs s) m * + expandingFourierCoefficient a N L (fs s) (n - m))) = + (D * homogeneousOrderedSymbol N j (L⁻¹ • (n : E))) * + (expandingFourierCoefficient a N L q m * expandingFourierCoefficient a N L f (n - m)) := by + simp_rw [hq, hf] + have harg : L⁻¹ • (m : E) + L⁻¹ • ((n - m : frequencyLattice) : E) = L⁻¹ • (n : E) := by + rw [← smul_add] + congr 1 + change (m : E) + ((n : E) - (m : E)) = (n : E) + abel + calc + _ = (D * ∑ s : Finset (Fin N), + homogeneousPartialSymbol N j s (L⁻¹ • (m : E)) * + homogeneousPartialSymbol N j sᶜ (L⁻¹ • ((n - m : frequencyLattice) : E))) * + (expandingFourierCoefficient a N L q m * expandingFourierCoefficient a N L f (n - m)) := by + rw [Finset.mul_sum, Finset.sum_mul] + apply Finset.sum_congr rfl + intro s _ + ring + _ = _ := by rw [← homogeneousOrderedSymbol_add, harg] + have hfun : (fun m : frequencyLattice => ∑ s : Finset (Fin N), + D * (expandingFourierCoefficient a N L (qs s) m * + expandingFourierCoefficient a N L (fs s) (n - m))) = + (fun m => (D * homogeneousOrderedSymbol N j (L⁻¹ • (n : E))) * + (expandingFourierCoefficient a N L q m * expandingFourierCoefficient a N L f (n - m))) := + funext he + rw [hfun] at hsum + exact ((summable_expandingProductTerms a N L ha ha1 hN hL q f n).hasSum.mul_left + (D * homogeneousOrderedSymbol N j (L⁻¹ • (n : E)))).unique hsum + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProductDifference.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProductDifference.lean new file mode 100644 index 0000000000000000000000000000000000000000..415a83df72139045fed59f42e6faad44375a36fa --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProductDifference.lean @@ -0,0 +1,27 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingCommutatorCoefficient + +namespace OAI + +/-! # The uniform bilinear difference estimate in the expanding norm -/ + +namespace DefocusingNLS + +theorem expandingProduct_difference_norm (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (q r q' r' : FourierL2) : + ‖expandingProduct a k L ha ha1 hk hL q r - expandingProduct a k L ha ha1 hk hL q' r'‖ ≤ + expandingAlgebraBound a k * (‖q - q'‖ * ‖r‖ + ‖q'‖ * ‖r - r'‖) := by + let B := expandingBilinearProduct a k L ha ha1 hk hL + have he : B q r - B q' r' = B (q - q') r + B q' (r - r') := by + simp only [map_sub, sub_apply] + abel + change ‖B q r - B q' r'‖ ≤ _ + rw [he] + exact (norm_add_le _ _).trans + ((add_le_add (expandingProduct_norm_le a k L ha ha1 hk hL _ _) + (expandingProduct_norm_le a k L ha ha1 hk hL _ _)).trans_eq (by + unfold expandingAlgebraBound + ring)) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProductSmoothRemainder.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProductSmoothRemainder.lean new file mode 100644 index 0000000000000000000000000000000000000000..055634e614da0c1d95d40c71a4b6202046a0ccae --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProductSmoothRemainder.lean @@ -0,0 +1,41 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProductCommutatorLinear +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingSmoothCutoff + +namespace OAI + +/-! # The product commutator remainder after smooth frequency cutoff -/ + +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem exists_expandingProductCommutator_smooth_remainder (a : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < ((N + 1 : ℕ) : ℝ)) (K : 𝓢(E, ℂ)) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ (L R : ℝ) (hL : 1 ≤ L) (hR : 1 ≤ R), + let q := schwartzTorusSample a (N + 1 : ℕ) L ha1 hN hL K + ∀ (f : FourierL2) (j : Fin (N + 1) → Fin 12), + ‖expandingProductCommutator a L (N + 1) ha ha1 hN hL j q f - + expandingProductCommutator a L (N + 1) ha ha1 hN hL j q + (expandingSmoothLow L R (by linarith) f)‖ ≤ (C / R) * ‖f‖ := by + obtain ⟨C, hC, hc⟩ := exists_schwartzProductCommutator_high_bound a N ha ha1 hN K + refine ⟨C, hC, ?_⟩ + intro L R hL hR q f j + have hp : 0 < R := by linarith + have hh := hc L R hL hR j (expandingSmoothHigh L R hp f) + (expandingSmoothHigh_low_zero L R (by linarith) hp f) + dsimp only at hh + rw [← torusProductCommutator_physical, LinearIsometryEquiv.norm_map] at hh + have he : f = expandingSmoothLow L R hp f + expandingSmoothHigh L R hp f := by + change f = expandingSmoothLow L R hp f + (f - expandingSmoothLow L R hp f) + abel + have hmap := congrArg (expandingProductCommutator a L (N + 1) ha ha1 hN hL j q) he + rw [expandingProductCommutator_add] at hmap + rw [hmap, add_sub_cancel_left] + exact hh.trans (mul_le_mul_of_nonneg_left (expandingSmoothHigh_norm_le L R hp f) + (div_nonneg hC (by linarith))) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileCompactness.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileCompactness.lean new file mode 100644 index 0000000000000000000000000000000000000000..307d1e7a9b9895780c4aeda80683b7d2d7e86f0a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileCompactness.lean @@ -0,0 +1,81 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfilePhysicalPath +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.LocalUniformSubsequence +import Mathlib.Topology.MetricSpace.Equicontinuity + +namespace OAI + +/-! # Local space-time compactness of the actual expanding-torus flow -/ + +open Set Filter Topology + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +attribute [local irreducible] expandingProfileTrajectory expandingTorusFunction expandingSpacetimePath + +theorem exists_expandingProfile_localUniform_limit (a b k Q M T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hQ : 0 ≤ Q) (hM : 0 ≤ M) + (hT : 0 ≤ T) (m : ℕ) (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) + (q : ℕ → C(Icc (0 : ℝ) T, FourierL2)) (hq : ∀ n t, ‖q n t‖ ≤ Q) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) : + ∃ v : C(Icc (0 : ℝ) T × E, ℂ), ∃ φ : ℕ → ℕ, StrictMono φ ∧ + Tendsto (fun n => expandingProfilePhysicalPath a b (k + 2) (L (φ n)) T + ha ha1 (by linarith) (hL (φ n)) hT m Q hQ (q (φ n)) (hq (φ n)) (f (φ n))) + atTop (𝓝 v) := by + let F := fun n => expandingProfilePhysicalPath a b (k + 2) (L n) T + ha ha1 (by linarith) (hL n) hT m Q hQ (q n) (hq n) (f n) + let U := fun n => expandingProfileTrajectory a b (k + 2) (L n) T + ha ha1 (by linarith) (hL n) hT m Q hQ (q n) (hq n) (f n) + obtain ⟨K, hK, hKb⟩ := exists_expandingProfileTrajectory_bound a b (k + 2) + ha ha1 (by linarith) m Q hQ + let A := (K + 1) * Real.exp ((K + 1) * T) * M + have hA : 0 ≤ A := by dsimp [A]; positivity + have hU (n : ℕ) (t : Icc (0 : ℝ) T) : ‖U n t‖ ≤ A := by + apply (ContinuousMap.norm_coe_le_norm (U n) t).trans + exact (hKb (L n) T (hL n) hT (q n) (hq n) (f n)).trans + (mul_le_mul_of_nonneg_left (hf n) (by positivity)) + have hspace (n : ℕ) (t : Icc (0 : ℝ) T) (x y : E) : + ‖F n (t, x) - F n (t, y)‖ ≤ expandingJetBound a k * A * ‖x - y‖ := + expandingSpacetimePath_space_bound a k (L n) T A ha ha1 hk (hL n) (U n) (hU n) t x y + have hJA : 0 ≤ expandingJetBound a k * A := + mul_nonneg (by dsimp [expandingJetBound, expandingEmbeddingBound]; positivity) hA + have heq : Equicontinuous (fun n => (F n : Icc (0 : ℝ) T × E → ℂ)) := by + intro p + obtain ⟨C, hC, hCb⟩ := exists_expandingProfile_time_bound a b k Q M T ‖p.2‖ + ha ha1 hk hQ hM hT (norm_nonneg _) m + apply Metric.equicontinuousAt_of_continuity_modulus + (fun z => (C + expandingJetBound a k * A) * dist p z) + (by + have hc : Continuous (fun z : Icc (0 : ℝ) T × E => + (C + expandingJetBound a k * A) * dist p z) := + continuous_const.mul (continuous_const.dist continuous_id) + simpa only [dist_self, mul_zero] using hc.tendsto p) + filter_upwards [] with z n + rw [dist_eq_norm] + have ht : ‖F n p - F n (z.1, p.2)‖ ≤ C * |(p.1 : ℝ) - z.1| := by + simpa only [F, expandingProfilePhysicalPath, expandingSpacetimePath_apply] using + hCb (L n) (hL n) (q n) (hq n) (f n) (hf n) z.1 p.1 p.2 le_rfl + have hd₁ : |(p.1 : ℝ) - z.1| ≤ dist p z := + le_max_left _ _ + have hd₂ : ‖p.2 - z.2‖ ≤ dist p z := by + change dist p.2 z.2 ≤ max (dist p.1 z.1) (dist p.2 z.2) + exact le_max_right _ _ + calc + _ ≤ ‖F n p - F n (z.1, p.2)‖ + ‖F n (z.1, p.2) - F n z‖ := + norm_sub_le_norm_sub_add_norm_sub _ _ _ + _ ≤ C * |(p.1 : ℝ) - z.1| + expandingJetBound a k * A * ‖p.2 - z.2‖ := + add_le_add ht (hspace n z.1 p.2 z.2) + _ ≤ C * dist p z + expandingJetBound a k * A * dist p z := + add_le_add (mul_le_mul_of_nonneg_left hd₁ hC) + (mul_le_mul_of_nonneg_left hd₂ hJA) + _ = _ := (add_mul _ _ _).symm + apply exists_localUniform_subsequence F heq + intro p + exact ⟨expandingEmbeddingBound a (k + 2) * A, fun n => + expandingSpacetimePath_norm_le a (k + 2) (L n) T A ha ha1 (by linarith) + (hL n) (U n) (hU n) p⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileContinuity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..ea4f3abf0ecf57271fe1c9a0ab7e00bd0c2e0e91 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileContinuity.lean @@ -0,0 +1,87 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPerturbationContinuity + +namespace OAI + +/-! # Joint scale and data continuity of the actual profile propagator + +The potential is the derivative of the actual odd-power map. Its strong +joint continuity and uniform boundedness suffice on a finite slab; the +Schrödinger group is never required to be continuous in operator norm. +-/ + +open Set + +namespace DefocusingNLS + +theorem continuous_expandingProfileReaction_family + {P : Type*} [TopologicalSpace P] (a k T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) + (L : P → {L : ℝ // 1 ≤ L}) (hL : Continuous L) + (q g : P → C(Icc (0 : ℝ) T, FourierL2)) (hq : Continuous q) (hg : Continuous g) : + Continuous (fun z : P × ((Icc (0 : ℝ) T) × FourierL2) => + expandingProfileReaction a k T ha ha1 hk m + (expandingRadiusCurve (L z.1).1 T (L z.1).2) (q z.1) (g z.1) z.2) := by + have hl : Continuous (fun z : P × ((Icc (0 : ℝ) T) × FourierL2) => + expandingRadiusCurve (L z.1).1 T (L z.1).2 z.2.1) := + (continuous_expandingRadiusCurve_family T L hL).comp + (continuous_fst.prodMk (continuous_fst.comp continuous_snd)) + have hqv : Continuous (fun z : P × ((Icc (0 : ℝ) T) × FourierL2) => q z.1 z.2.1) := + continuous_eval.comp ((hq.comp continuous_fst).prodMk (continuous_fst.comp continuous_snd)) + have hgv : Continuous (fun z : P × ((Icc (0 : ℝ) T) × FourierL2) => g z.1 z.2.1) := + continuous_eval.comp ((hg.comp continuous_fst).prodMk (continuous_fst.comp continuous_snd)) + exact (((continuous_expandingLinearization_scale a k ha ha1 hk m).comp + (hl.prodMk (hqv.prodMk (continuous_snd.comp continuous_snd)))).const_smul + (-Complex.I : ℂ)).add hgv + +theorem continuous_expandingProfileTrajectory_family + {P : Type*} [TopologicalSpace P] (a b k T R : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hT : 0 ≤ T) + (m : ℕ) (hR : 0 ≤ R) + (L : P → {L : ℝ // 1 ≤ L}) (hL : Continuous L) + (q : P → C(Icc (0 : ℝ) T, FourierL2)) (hq : Continuous q) + (hqbound : ∀ p t, ‖q p t‖ ≤ R) + (u₀ : P → FourierL2) (hu₀ : Continuous u₀) : + Continuous (fun p => expandingProfileTrajectory a b k (L p).1 T ha ha1 hk + (L p).2 hT m R hR (q p) (hqbound p) (u₀ p)) := by + obtain ⟨K, hK, hbound⟩ := exists_expandingProfileReaction_lipschitz a k ha ha1 hk m R hR + let u := fun p => expandingProfileTrajectory a b k (L p).1 T ha ha1 hk + (L p).2 hT m R hR (q p) (hqbound p) (u₀ p) + apply continuous_expandingMild_family a b k T K ha hk hT hK L hL + (fun p => expandingProfileReaction a k T ha ha1 hk m + (expandingRadiusCurve (L p).1 T (L p).2) (q p) 0) + (continuous_expandingProfileReaction_family a k T ha ha1 hk m L hL q (fun _ => 0) + hq continuous_const) u₀ hu₀ u + · intro p + apply ContinuousMap.ext + intro t + exact expandingProfileTrajectory_eq a b k (L p).1 T ha ha1 hk (L p).2 hT m R hR + (q p) (hqbound p) (u₀ p) t + · intro p j t + exact hbound T (expandingRadiusCurve (L p).1 T (L p).2) (q p) 0 (hqbound p) + t (u p t) (u j t) + +theorem continuous_expandingStepRemainder_family + {P : Type*} [TopologicalSpace P] (a b k T R : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hT : 0 ≤ T) + (m : ℕ) (hR : 0 ≤ R) + (L : P → {L : ℝ // 1 ≤ L}) (hL : Continuous L) + (q g : P → C(Icc (0 : ℝ) T, FourierL2)) (hq : Continuous q) (hg : Continuous g) + (hqbound : ∀ p t, ‖q p t‖ ≤ R) + (u₀ : P → FourierL2) (hu₀ : Continuous u₀) + (u : P → C(Icc (0 : ℝ) T, FourierL2)) + (hu : ∀ p, u p = expandingPicard a b k (L p).1 T ha hk (L p).2 hT + (expandingPerturbationReaction a k (L p).1 T ha ha1 hk (L p).2 m (q p) (g p)) + (u₀ p) (u p)) (hub : ∀ p, ‖u p‖ ≤ 1) : + Continuous (fun p => u p ⟨T, hT, le_rfl⟩ - + expandingProfileTrajectory a b k (L p).1 T ha ha1 hk (L p).2 hT m R hR + (q p) (hqbound p) (u₀ p) ⟨T, hT, le_rfl⟩) := + (continuous_eval_const _ |>.comp + (continuous_expandingPerturbation_family a b k T R ha ha1 hk hT m hR L hL q g + hq hg hqbound u₀ hu₀ u hu hub)).sub + (continuous_eval_const _ |>.comp + (continuous_expandingProfileTrajectory_family a b k T R ha ha1 hk hT m hR + L hL q hq hqbound u₀ hu₀)) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileDifference.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileDifference.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3c0c455b776e6065e66e65008b21888cc50ecb7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileDifference.lean @@ -0,0 +1,100 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingNonlinearStepError +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingLocalDependence +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPerturbationExistence + +namespace OAI + +/-! # Differences in the actual profile-linearized evolution + +Subtracting two forced linearized trajectories preserves the linearized +equation, with the difference of their initial data and forcing. +-/ + +open Set + +namespace DefocusingNLS + +attribute [local irreducible] expandingFreeStep + +theorem expandingProfileTrajectory_sub (a b k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (m : ℕ) (R : ℝ) (hR : 0 ≤ R) (q : C(Icc (0 : ℝ) T, FourierL2)) + (hq : ∀ t, ‖q t‖ ≤ R) (u₀ v₀ : FourierL2) : + expandingProfileTrajectory a b k L T ha ha1 hk hL hT m R hR q hq (u₀ - v₀) = + expandingProfileTrajectory a b k L T ha ha1 hk hL hT m R hR q hq u₀ - + expandingProfileTrajectory a b k L T ha ha1 hk hL hT m R hR q hq v₀ := by + have hn : expandingProfileTrajectory a b k L T ha ha1 hk hL hT m R hR q hq (-v₀) = + -expandingProfileTrajectory a b k L T ha ha1 hk hL hT m R hR q hq v₀ := by + simpa only [neg_one_smul] using + expandingProfileTrajectory_smul a b k L T ha ha1 hk hL hT m R hR q hq (-1) v₀ + simpa only [sub_eq_add_neg, hn] using + expandingProfileTrajectory_add a b k L T ha ha1 hk hL hT m R hR q hq u₀ (-v₀) + +theorem expandingProfile_mild_sub (a b k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) (m : ℕ) + (q g h u v : C(Icc (0 : ℝ) T, FourierL2)) (u₀ v₀ : FourierL2) + (hu : ∀ t : Icc (0 : ℝ) T, u t = + expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t + (expandingReactionHistory T hT + (expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q g) u)) + (hv : ∀ t : Icc (0 : ℝ) T, v t = + expandingFreeStep a b k L t ha hk hL t.2.1 v₀ + + expandingDuhamel a b k L ha hk hL t + (expandingReactionHistory T hT + (expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q h) v)) : + ∀ t : Icc (0 : ℝ) T, (u - v) t = + expandingFreeStep a b k L t ha hk hL t.2.1 (u₀ - v₀) + + expandingDuhamel a b k L ha hk hL t + (expandingReactionHistory T hT + (expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q (g - h)) + (u - v)) := by + let F := expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q g + let G := expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q h + let H := expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q (g - h) + let r := expandingReactionHistory T hT F u + let s := expandingReactionHistory T hT G v + have hr : Continuous r := continuous_expandingReactionHistory T hT F u + have hs : Continuous s := continuous_expandingReactionHistory T hT G v + have he : expandingReactionHistory T hT H (u - v) = fun τ => r τ - s τ := by + funext τ + let t := projIcc 0 T hT τ + let D : FourierL2 →L[ℝ] FourierL2 := + fderiv ℝ (expandingOddPower a k (expandingRadiusCurve L T hL t).1 + ha ha1 hk (expandingRadiusCurve L T hL t).2 m) (q t) + change (-Complex.I) • D (u t - v t) + (g t - h t) = + ((-Complex.I) • D (u t) + g t) - ((-Complex.I) • D (v t) + h t) + rw [map_sub, smul_sub] + abel + intro t + change u t - v t = expandingFreeStep a b k L t ha hk hL t.2.1 (u₀ - v₀) + + expandingDuhamel a b k L ha hk hL t (expandingReactionHistory T hT H (u - v)) + rw [hu t, hv t, he, expandingDuhamel_sub a b k L ha hk hL t r s + hr.continuousOn hs.continuousOn, map_sub] + abel + +/-- The nonlinear difference is a forced trajectory of the actual profile +linearization; the common profile defect cancels from its source. -/ +theorem expandingPerturbation_difference_linear_mild (a b k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) (m : ℕ) + (q g u v : C(Icc (0 : ℝ) T, FourierL2)) (u₀ v₀ : FourierL2) + (hu : u = expandingPicard a b k L T ha hk hL hT + (expandingPerturbationReaction a k L T ha ha1 hk hL m q g) u₀ u) + (hv : v = expandingPicard a b k L T ha hk hL hT + (expandingPerturbationReaction a k L T ha ha1 hk hL m q g) v₀ v) : + ∀ t : Icc (0 : ℝ) T, (u - v) t = + expandingFreeStep a b k L t ha hk hL t.2.1 (u₀ - v₀) + + expandingDuhamel a b k L ha hk hL t + (expandingReactionHistory T hT + (expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q + (expandingPerturbationSource a k L T ha ha1 hk hL m q g u - + expandingPerturbationSource a k L T ha ha1 hk hL m q g v)) (u - v)) := + expandingProfile_mild_sub a b k L T ha ha1 hk hL hT m q + (expandingPerturbationSource a k L T ha ha1 hk hL m q g u) + (expandingPerturbationSource a k L T ha ha1 hk hL m q g v) u v u₀ v₀ + (expandingPerturbation_linear_mild a b k L T ha ha1 hk hL hT m q g u u₀ hu) + (expandingPerturbation_linear_mild a b k L T ha ha1 hk hL hT m q g v v₀ hv) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileEnergy.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..50019fe42114a3809018d16b5f3e49d4d1edf07a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileEnergy.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingMildEnergyBalance +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfilePropagator + +namespace OAI + +/-! # Exact energy balance for the constructed torus profile propagator + +The forcing is the derivative of the actual odd-power nonlinearity at the +given moving profile. The trajectory is the already constructed unique +finite-slab solution, rather than an assumed energy solution. +-/ + +open Set MeasureTheory + +namespace DefocusingNLS + +attribute [local irreducible] expandingProfileTrajectory expandingLowEnergy expandingHighEnergy + +theorem expandingProfileTrajectory_energy_balance (a b k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (m : ℕ) (R : ℝ) (hR : 0 ≤ R) + (q : C(Icc (0 : ℝ) T, FourierL2)) (hq : ∀ t, ‖q t‖ ≤ R) + (f : FourierL2) (t : Icc (0 : ℝ) T) : + let S := expandingProfileTrajectory a b k L T ha ha1 hk hL hT m R hR q hq f + let l := expandingRadiusCurve L T hL + ‖S t‖ ^ 2 = ‖f‖ ^ 2 + ∫ τ in (0 : ℝ)..(t : ℝ), + (let s := projIcc 0 T hT τ; + -a * ‖expandingLowEnergy a k (l s).1 (l s).2 (S s)‖ ^ 2 + + (6 - 2 * a - k) * ‖expandingHighEnergy a k (l s).1 (l s).2 (S s)‖ ^ 2 + + 2 * inner ℝ (S s) ((-Complex.I) • + fderiv ℝ (expandingOddPower a k (l s).1 ha ha1 hk (l s).2 m) (q s) (S s))) := by + intro S l + let F := expandingProfileReaction a k T ha ha1 hk m l q 0 + let r := expandingReactionHistory T hT F S + have hr : Continuous r := continuous_expandingReactionHistory T hT F S + have hu (s : Icc (0 : ℝ) T) : S s = + expandingFreeStep a b k L s ha hk hL s.2.1 f + + expandingDuhamel a b k L ha hk hL s r := + expandingProfileTrajectory_eq a b k L T ha ha1 hk hL hT m R hR q hq f s + have he := expandingMildEnergy_balance a b k L T ha hk hL hT S r hr f hu t + have hforce (τ : ℝ) : r τ = + (-Complex.I) • fderiv ℝ + (expandingOddPower a k (l (projIcc 0 T hT τ)).1 ha ha1 hk + (l (projIcc 0 T hT τ)).2 m) (q (projIcc 0 T hT τ)) (S (projIcc 0 T hT τ)) := by + change (-Complex.I) • _ + (0 : FourierL2) = _ + exact add_zero _ + simp_rw [hforce] at he + exact he + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileEnergyDerivative.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileEnergyDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..5962c6268244defc96d108179e96a013f6f330d1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileEnergyDerivative.lean @@ -0,0 +1,36 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfileEnergy +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingOrderedCommutator + +namespace OAI + +/-! # The actual propagator's pointwise energy derivative -/ + +open Set + +namespace DefocusingNLS + +theorem hasDerivAt_expandingProfile_energy (a b k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (m : ℕ) (R : ℝ) (hR : 0 ≤ R) + (q : C(Icc (0 : ℝ) T, FourierL2)) (hq : ∀ s, ‖q s‖ ≤ R) + (f : FourierL2) (t : ℝ) (ht : t ∈ Ioo 0 T) : + let S := expandingProfileTrajectory a b k L T ha ha1 hk hL hT m R hR q hq f + let l := expandingRadiusCurve L T hL + let s := projIcc 0 T hT t + HasDerivAt (fun τ => ‖S (projIcc 0 T hT τ)‖ ^ 2) + (-a * ‖expandingLowEnergy a k (l s).1 (l s).2 (S s)‖ ^ 2 + + (6 - 2 * a - k) * ‖expandingHighEnergy a k (l s).1 (l s).2 (S s)‖ ^ 2 + + 2 * inner ℝ (S s) (expandingLinearizedPotential a k (l s).1 ha ha1 hk (l s).2 m (q s) (S s))) t := by + intro S l s + let r := expandingReactionHistory T hT (expandingProfileReaction a k T ha ha1 hk m l q 0) S + have hr : Continuous r := continuous_expandingReactionHistory T hT _ S + have he := hasDerivAt_expandingMildEnergy a b k L T ha hk hL hT S r hr f + (fun s => expandingProfileTrajectory_eq a b k L T ha ha1 hk hL hT m R hR q hq f s) t ht + have hrt : r t = expandingLinearizedPotential a k (l s).1 ha ha1 hk (l s).2 m (q s) (S s) := by + change (-Complex.I) • _ + (0 : FourierL2) = _ + exact add_zero _ + simpa only [hrt, l, s, expandingRadiusCurve, ContinuousMap.coe_mk] using he + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileEquation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileEquation.lean new file mode 100644 index 0000000000000000000000000000000000000000..47a8ff5465362d44394f99d8d541ae7766e4d01f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileEquation.lean @@ -0,0 +1,57 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingModeEquation +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfilePropagator + +namespace OAI + +/-! # The profile propagator solves the actual moving-torus mode equation -/ + +open Set + +namespace DefocusingNLS + +/-- The constructed propagator has the prescribed real-linearized potential in every +physical Fourier mode. Time is differentiated at fixed normalized torus position. -/ +theorem hasDerivAt_expandingProfileTrajectory_coefficient + (a b k L T : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (hL : 1 ≤ L) (hT : 0 ≤ T) (m : ℕ) (R : ℝ) (hR : 0 ≤ R) + (q : C(Icc (0 : ℝ) T, FourierL2)) (hq : ∀ t, ‖q t‖ ≤ R) + (u₀ : FourierL2) (t : ℝ) (ht : t ∈ Ioo 0 T) (n : frequencyLattice) : + let S := expandingProfileTrajectory a b k L T ha ha1 hk hL hT m R hR q hq u₀ + let t' : Icc (0 : ℝ) T := ⟨t, ht.1.le, ht.2.le⟩ + HasDerivAt (fun s => expandingFourierCoefficient a k (expandingRadius L s) + (S (projIcc 0 T hT s)) n) + (expandingModeRate a b L t n * + expandingFourierCoefficient a k (expandingRadius L t) (S t') n - + Complex.I * expandingFourierCoefficient a k (expandingRadius L t) + (fderiv ℝ (expandingOddPower a k (expandingRadius L t) ha ha1 hk + (hL.trans (expandingRadius_ge L t hL ht.1.le)) m) (q t') (S t')) n) t := by + intro S t' + let F := expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q 0 + let u : ℝ → FourierL2 := fun s => S (projIcc 0 T hT s) + let r := expandingReactionHistory T hT F S + have hr : Continuous r := continuous_expandingReactionHistory T hT F S + have hu (s : ℝ) (hs : s ∈ Icc 0 T) : + u s = expandingFreeStep a b k L s ha hk hL hs.1 u₀ + + expandingDuhamel a b k L ha hk hL s r := by + change S (projIcc 0 T hT s) = _ + rw [projIcc_of_mem _ hs] + exact expandingProfileTrajectory_eq a b k L T ha ha1 hk hL hT m R hR q hq u₀ ⟨s, hs⟩ + have h := hasDerivAt_expandingMild_coefficient a b k L T ha hk hL u r u₀ hr.continuousOn + hu t ht n + have hut : u t = S t' := by + dsimp [u, t'] + rw [projIcc_of_mem _ ⟨ht.1.le, ht.2.le⟩] + have hrt : r t = -Complex.I • + fderiv ℝ (expandingOddPower a k (expandingRadius L t) ha ha1 hk + (hL.trans (expandingRadius_ge L t hL ht.1.le)) m) (q t') (S t') := by + dsimp [r, expandingReactionHistory] + rw [projIcc_of_mem _ ⟨ht.1.le, ht.2.le⟩] + change -Complex.I • (_ : FourierL2) + (0 : FourierL2) = _ + exact add_zero _ + apply h.congr_deriv + rw [hut, hrt, expandingFourierCoefficient_smul] + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileInitial.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileInitial.lean new file mode 100644 index 0000000000000000000000000000000000000000..2a024a1553e8c4e0b1352590484975ce26b84dda --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileInitial.lean @@ -0,0 +1,23 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfilePropagator + +namespace OAI + +/-! # Initial value of the constructed expanding-torus propagator -/ + +open Set + +namespace DefocusingNLS + +attribute [local irreducible] expandingProfileTrajectory + +theorem expandingProfileTrajectory_initial (a b k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (m : ℕ) (Q : ℝ) (hQ : 0 ≤ Q) (q : C(Icc (0 : ℝ) T, FourierL2)) + (hq : ∀ t, ‖q t‖ ≤ Q) (f : FourierL2) : + expandingProfileTrajectory a b k L T ha ha1 hk hL hT m Q hQ q hq f ⟨0, le_rfl, hT⟩ = f := by + rw [expandingProfileTrajectory_eq] + simp [expandingDuhamel] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileLimitEquation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileLimitEquation.lean new file mode 100644 index 0000000000000000000000000000000000000000..fac568b0923c96993f4480326d8c069a3fc0d78e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileLimitEquation.lean @@ -0,0 +1,118 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingMildLimit +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousWeakMildIdentification +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingLinearizedPhysicalLimit +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfileUniformBound +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfileInitial +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingNonprincipalEnergy + +namespace OAI + +/-! # The actual profile-trajectory limit satisfies the whole-space linearized mild equation -/ + +open Set MeasureTheory Filter Topology + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +attribute [local irreducible] expandingProfileTrajectory expandingTorusFunction + +theorem expandingProfile_limit_equation (a b k T Q M C : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hT : 0 ≤ T) + (m : ℕ) (hQ : 0 ≤ Q) (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) + (q : ℕ → C(Icc (0 : ℝ) T, FourierL2)) (hq : ∀ n s, ‖q n s‖ ≤ Q) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) + (Q₀ : HomogeneousY a k) (v : Icc (0 : ℝ) T → HomogeneousY a k) + (hv : ∀ s, ‖v s‖ ≤ C) + (hvc : ∀ y : E, Continuous (fun s => homogeneousPhysicalCLM a k ha ha1 hk (v s) y)) + (hqp : ∀ (s : Icc (0 : ℝ) T) (y : E), + Tendsto (fun n => expandingPhysicalContinuous a k (expandingRadius (L n) s) + ha ha1 hk ((hL n).trans (expandingRadius_ge (L n) s (hL n) s.2.1)) (q n s) y) + atTop (𝓝 (homogeneousPhysicalCLM a k ha ha1 hk Q₀ y))) + (hvp : ∀ (s : Icc (0 : ℝ) T) (y : E), + Tendsto (fun n => expandingPhysicalContinuous a k (expandingRadius (L n) s) + ha ha1 hk ((hL n).trans (expandingRadius_ge (L n) s (hL n) s.2.1)) + (expandingProfileTrajectory a b k (L n) T ha ha1 hk (hL n) hT m Q hQ (q n) (hq n) (f n) s) y) + atTop (𝓝 (homogeneousPhysicalCLM a k ha ha1 hk (v s) y))) + (t : Icc (0 : ℝ) T) : + v t = homogeneousFreeOperator a b k t ha ha1 hk (v ⟨0, le_rfl, hT⟩) + + homogeneousDuhamel a b k ha ha1 hk t + (fun s => homogeneousLinearizedPotential a k ha ha1 hk m Q₀ (v (projIcc 0 T hT s))) := by + let S := fun n => expandingProfileTrajectory a b k (L n) T ha ha1 hk (hL n) hT + m Q hQ (q n) (hq n) (f n) + let r := fun n => expandingReactionHistory T hT + (expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve (L n) T (hL n)) (q n) 0) (S n) + let B := homogeneousLinearizedPotential a k ha ha1 hk m Q₀ + obtain ⟨K, hK, hKb⟩ := exists_expandingProfileTrajectory_bound a b k ha ha1 hk m Q hQ + obtain ⟨D, hD, hDb⟩ := exists_expandingLinearized_norm_bound a k Q ha ha1 hk hQ m + let A := (K + 1) * Real.exp ((K + 1) * T) * M + have hSb (n : ℕ) (s : Icc (0 : ℝ) T) : ‖S n s‖ ≤ A := + ((ContinuousMap.norm_coe_le_norm (S n) s).trans + (hKb (L n) T (hL n) hT (q n) (hq n) (f n))).trans + (mul_le_mul_of_nonneg_left (hf n) (by positivity)) + have hrcont (n : ℕ) : Continuous (r n) := continuous_expandingReactionHistory T hT _ (S n) + have hre (n : ℕ) (s : ℝ) : r n s = + expandingLinearizedPotential a k (expandingRadius (L n) (projIcc 0 T hT s)) ha ha1 hk + ((hL n).trans (expandingRadius_ge (L n) _ (hL n) (projIcc 0 T hT s).2.1)) m + (q n (projIcc 0 T hT s)) (S n (projIcc 0 T hT s)) := by + change (-Complex.I) • (_ : FourierL2) + (0 : FourierL2) = _ + exact add_zero _ + have hrb (n : ℕ) (s : ℝ) : ‖r n s‖ ≤ D * A := by + rw [hre] + exact (ContinuousLinearMap.le_opNorm _ _).trans + ((mul_le_mul_of_nonneg_right (hDb _ _ _ (hq n _)) (norm_nonneg _)).trans + (mul_le_mul_of_nonneg_left (hSb n _) hD)) + have hsub : Icc (0 : ℝ) t ⊆ Icc (0 : ℝ) T := fun s hs => ⟨hs.1, hs.2.trans t.2.2⟩ + have hgiT : IntegrableOn (fun s => B (v (projIcc 0 T hT s))) (Icc 0 T) := + B.integrable_comp (integrableOn_homogeneous_clamped a k T C ha ha1 hk hT v hv hvc) + have hgi : IntegrableOn (fun s => B (v (projIcc 0 T hT s))) (Icc 0 t) := + hgiT.mono_set hsub + apply expandingMild_physical_limit a b k t M A (D * A) ha ha1 hk t.2.1 L hL f + (fun n => S n t) r hf (fun n => hSb n t) (fun n s _ => hrb n s) + (fun n => (hrcont n).continuousOn) + (fun n => expandingProfileTrajectory_eq a b k (L n) T ha ha1 hk (hL n) hT + m Q hQ (q n) (hq n) (f n) t) + (v ⟨0, le_rfl, hT⟩) (v t) (fun s => B (v (projIcc 0 T hT s))) + (B.continuous.comp_stronglyMeasurable + (stronglyMeasurable_homogeneous_clamped a k T ha ha1 hk hT v hvc)) hgi + · intro y + have h := hvp ⟨0, le_rfl, hT⟩ y + simpa only [expandingProfileTrajectory_initial, expandingRadius, zero_div, + Real.exp_zero, mul_one] using h + · exact hvp t + · intro s hs y + have he : projIcc 0 T hT s = ⟨s, hsub hs⟩ := projIcc_of_mem _ (hsub hs) + have h := tendsto_expandingLinearizedPotential_physical a k ha ha1 hk m + (fun n => expandingRadius (L n) s) + (fun n => (hL n).trans (expandingRadius_ge (L n) s (hL n) hs.1)) + (fun n => q n ⟨s, hsub hs⟩) (fun n => S n ⟨s, hsub hs⟩) + Q₀ (v ⟨s, hsub hs⟩) y (hqp ⟨s, hsub hs⟩ y) (hvp ⟨s, hsub hs⟩ y) + simpa only [hre, he, B] using h + +theorem expandingProfile_limit_identification (a b k T Q M C : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hT : 0 ≤ T) + (m : ℕ) (hQ : 0 ≤ Q) (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) + (q : ℕ → C(Icc (0 : ℝ) T, FourierL2)) (hq : ∀ n s, ‖q n s‖ ≤ Q) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) + (Q₀ : HomogeneousY a k) (v : Icc (0 : ℝ) T → HomogeneousY a k) + (hv : ∀ s, ‖v s‖ ≤ C) + (hvc : ∀ y : E, Continuous (fun s => homogeneousPhysicalCLM a k ha ha1 hk (v s) y)) + (hqp : ∀ (s : Icc (0 : ℝ) T) (y : E), + Tendsto (fun n => expandingPhysicalContinuous a k (expandingRadius (L n) s) + ha ha1 hk ((hL n).trans (expandingRadius_ge (L n) s (hL n) s.2.1)) (q n s) y) + atTop (𝓝 (homogeneousPhysicalCLM a k ha ha1 hk Q₀ y))) + (hvp : ∀ (s : Icc (0 : ℝ) T) (y : E), + Tendsto (fun n => expandingPhysicalContinuous a k (expandingRadius (L n) s) + ha ha1 hk ((hL n).trans (expandingRadius_ge (L n) s (hL n) s.2.1)) + (expandingProfileTrajectory a b k (L n) T ha ha1 hk (hL n) hT m Q hQ (q n) (hq n) (f n) s) y) + atTop (𝓝 (homogeneousPhysicalCLM a k ha ha1 hk (v s) y))) + : v = fun t => homogeneousLinearizedTrajectory a b k T ha ha1 hk hT m Q₀ + (v ⟨0, le_rfl, hT⟩) t := by + apply homogeneousLinearizedTrajectory_eq_of_bounded_mild a b k T C ha ha1 hk hT m Q₀ + (v ⟨0, le_rfl, hT⟩) v hv hvc + exact fun t => expandingProfile_limit_equation a b k T Q M C ha ha1 hk hT m hQ L hL q hq + f hf Q₀ v hv hvc hqp hvp t + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileObservation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileObservation.lean new file mode 100644 index 0000000000000000000000000000000000000000..c9e6e149c6288604cfa05e26817ca37a4b7cb046 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileObservation.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfileEnergyDerivative +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingContinuousRealization +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.WeightedEnergyEstimate + +namespace OAI + +/-! # The actual torus propagator obeys the compact-observation energy estimate -/ + +open Set + +namespace DefocusingNLS + +theorem expandingProfileTrajectory_observation_estimate (a b k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (m : ℕ) (Q : ℝ) (hQ : 0 ≤ Q) + (q : C(Icc (0 : ℝ) T, FourierL2)) (hq : ∀ s, ‖q s‖ ≤ Q) + (c C R : ℝ) + (henergy : ∀ (s : Icc (0 : ℝ) T) (v : FourierL2), + let l := expandingRadiusCurve L T hL s; + -a * ‖expandingLowEnergy a k l.1 l.2 v‖ ^ 2 + + (6 - 2 * a - k) * ‖expandingHighEnergy a k l.1 l.2 v‖ ^ 2 + + 2 * inner ℝ v (expandingLinearizedPotential a k l.1 ha ha1 hk l.2 m (q s) v) ≤ + -c * ‖v‖ ^ 2 + C * ‖expandingPhysicalBall a k l.1 R ha ha1 hk l.2 v‖ ^ 2) + (f : FourierL2) (t : Icc (0 : ℝ) T) : + let S := expandingProfileTrajectory a b k L T ha ha1 hk hL hT m Q hQ q hq f + let l := expandingRadiusCurve L T hL + ‖S t‖ ^ 2 ≤ Real.exp (-c * t) * ‖f‖ ^ 2 + + ∫ τ in (0 : ℝ)..(t : ℝ), + (let s := projIcc 0 T hT τ; + Real.exp (-c * ((t : ℝ) - τ)) * + (C * ‖expandingPhysicalBall a k (l s).1 R ha ha1 hk (l s).2 (S s)‖ ^ 2)) := by + intro S l + let p := fun τ => projIcc 0 T hT τ + let F := fun τ => ‖S (p τ)‖ ^ 2 + let r := expandingReactionHistory T hT (expandingProfileReaction a k T ha ha1 hk m l q 0) S + let D := fun τ => + -a * ‖expandingLowEnergy a k (l (p τ)).1 (l (p τ)).2 (S (p τ))‖ ^ 2 + + (6 - 2 * a - k) * ‖expandingHighEnergy a k (l (p τ)).1 (l (p τ)).2 (S (p τ))‖ ^ 2 + + 2 * inner ℝ (S (p τ)) (r τ) + let H := fun τ => C * ‖expandingPhysicalBall a k (l (p τ)).1 R ha ha1 hk (l (p τ)).2 (S (p τ))‖ ^ 2 + have hF : Continuous F := (S.continuous.comp continuous_projIcc).norm.pow 2 + have hr : Continuous r := continuous_expandingReactionHistory T hT _ S + have hforce (τ : ℝ) : r τ = + expandingLinearizedPotential a k (l (p τ)).1 ha ha1 hk (l (p τ)).2 m (q (p τ)) (S (p τ)) := by + change (-Complex.I) • _ + (0 : FourierL2) = _ + exact add_zero _ + have hD : Continuous D := + ((continuous_const.mul ((continuous_expandingLowEnergy_sq a b k L T ha hk hL S).comp + continuous_projIcc)).add + (continuous_const.mul ((continuous_expandingHighEnergy_sq a b k L T ha hk hL S).comp + continuous_projIcc))).add + (continuous_const.mul ((S.continuous.comp continuous_projIcc).inner hr)) + have hH : Continuous H := continuous_const.mul + (((continuous_expandingPhysicalBall a k R ha ha1 hk).comp + ((l.continuous.comp continuous_projIcc).prodMk + (S.continuous.comp continuous_projIcc))).norm.pow 2) + have hd (τ : ℝ) (hτ : τ ∈ Ioo 0 (t : ℝ)) : HasDerivAt F (D τ) τ := + hasDerivAt_expandingMildEnergy a b k L T ha hk hL hT S r hr f + (fun s => expandingProfileTrajectory_eq a b k L T ha ha1 hk hL hT m Q hQ q hq f s) + τ ⟨hτ.1, hτ.2.trans_le t.2.2⟩ + have hb (τ : ℝ) (_hτ : τ ∈ Icc 0 (t : ℝ)) : D τ ≤ -c * F τ + H τ := by + dsimp only [D] + rw [hforce] + exact henergy (p τ) (S (p τ)) + have h := energy_decay_estimate F D H c t t.2.1 hF hD hH hd hb + have hpt : p t = t := projIcc_of_mem hT t.2 + have hp0 : p 0 = ⟨0, le_rfl, hT⟩ := projIcc_of_mem hT ⟨le_rfl, hT⟩ + have hS0 : S ⟨0, le_rfl, hT⟩ = f := by + have he := expandingProfileTrajectory_eq a b k L T ha ha1 hk hL hT m Q hQ q hq f ⟨0, le_rfl, hT⟩ + simpa [expandingFreeStep_zero, expandingDuhamel] using he + simpa only [F, H, hpt, hp0, hS0] using h + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileOperator.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileOperator.lean new file mode 100644 index 0000000000000000000000000000000000000000..a971604096e49bcf55ed8888a2ea4fd74315754c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileOperator.lean @@ -0,0 +1,50 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfileUniformBound + +namespace OAI + +/-! # The actual finite-slab solution as a bounded real-linear operator -/ + +open Set + +namespace DefocusingNLS + +attribute [local irreducible] expandingProfileTrajectory + +noncomputable def expandingProfileOperator (a b k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (m : ℕ) (Q : ℝ) (hQ : 0 ≤ Q) (q : C(Icc (0 : ℝ) T, FourierL2)) + (hq : ∀ t, ‖q t‖ ≤ Q) : FourierL2 →L[ℝ] C(Icc (0 : ℝ) T, FourierL2) := + let S := expandingProfileTrajectory a b k L T ha ha1 hk hL hT m Q hQ q hq + let K := Classical.choose (exists_expandingProfileTrajectory_bound a b k ha ha1 hk m Q hQ) + let A : FourierL2 →ₗ[ℝ] C(Icc (0 : ℝ) T, FourierL2) := + { toFun := S + map_add' := expandingProfileTrajectory_add a b k L T ha ha1 hk hL hT m Q hQ q hq + map_smul' := expandingProfileTrajectory_smul a b k L T ha ha1 hk hL hT m Q hQ q hq } + A.mkContinuous ((K + 1) * Real.exp ((K + 1) * T)) + ((Classical.choose_spec (exists_expandingProfileTrajectory_bound a b k ha ha1 hk m Q hQ)).2 + L T hL hT q hq) + +@[simp] theorem expandingProfileOperator_apply (a b k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (m : ℕ) (Q : ℝ) (hQ : 0 ≤ Q) (q : C(Icc (0 : ℝ) T, FourierL2)) + (hq : ∀ t, ‖q t‖ ≤ Q) (f : FourierL2) : + expandingProfileOperator a b k L T ha ha1 hk hL hT m Q hQ q hq f = + expandingProfileTrajectory a b k L T ha ha1 hk hL hT m Q hQ q hq f := rfl + +noncomputable def expandingProfileEndpoint (a b k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (m : ℕ) (Q : ℝ) (hQ : 0 ≤ Q) (q : C(Icc (0 : ℝ) T, FourierL2)) + (hq : ∀ t, ‖q t‖ ≤ Q) : FourierL2 →L[ℝ] FourierL2 := + (ContinuousMap.evalCLM (R := ℝ) ⟨T, hT, le_rfl⟩).comp + (expandingProfileOperator a b k L T ha ha1 hk hL hT m Q hQ q hq) + +@[simp] theorem expandingProfileEndpoint_apply (a b k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (m : ℕ) (Q : ℝ) (hQ : 0 ≤ Q) (q : C(Icc (0 : ℝ) T, FourierL2)) + (hq : ∀ t, ‖q t‖ ≤ Q) (f : FourierL2) : + expandingProfileEndpoint a b k L T ha ha1 hk hL hT m Q hQ q hq f = + expandingProfileTrajectory a b k L T ha ha1 hk hL hT m Q hQ q hq f ⟨T, hT, le_rfl⟩ := rfl + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfilePhysicalEquation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfilePhysicalEquation.lean new file mode 100644 index 0000000000000000000000000000000000000000..0b461ae767403ba69135a7a705ca97f75da25497 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfilePhysicalEquation.lean @@ -0,0 +1,46 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfilePointwise +import OAI.MathematicalPhysics.DefocusingNLS.Profile.MovingSobolevEquation + +namespace OAI + +/-! # The actual profile propagator at fixed physical positions -/ + +open Set + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +attribute [local irreducible] expandingProfileTrajectory expandingTorusFunction + +theorem hasDerivAt_expandingProfile_physical (a b k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (m : ℕ) (Q : ℝ) (hQ : 0 ≤ Q) (q : C(Icc (0 : ℝ) T, FourierL2)) + (hq : ∀ s, ‖q s‖ ≤ Q) (f : FourierL2) (t : ℝ) (ht : t ∈ Ioo 0 T) (y : E) : + let S := expandingProfileTrajectory a b k L T ha ha1 hk hL hT m Q hQ q hq f + let W := fun s => expandingToSobolev a k ha1 hk + (expandingPhysicalPath a k L T ha hk hL S (projIcc 0 T hT s)) + let Z := fun s => expandingToSobolev a k ha1 hk + (expandingPhysicalPath a k L T ha hk hL q (projIcc 0 T hT s)) + let x := fun s => euclideanToTorus ((expandingRadius L s)⁻¹ • y) + HasDerivAt (fun s => sobolevTorusFunction k (W s) (x s)) + (((-(a : ℂ) + Complex.I * b) * sobolevTorusFunction k (W t) (x t) + + ((L ^ (-2 : ℝ) * Real.exp (-t) : ℝ) : ℂ) * + (Complex.I * torusFourierLaplacian k (W t) (x t)) - + Complex.I * oddPowerDerivative m (sobolevTorusFunction k (Z t) (x t)) + (sobolevTorusFunction k (W t) (x t))) + + (-((expandingRadius L t)⁻¹) / 2) • + sobolevPhysicalDirectional k (W t) ((expandingRadius L t)⁻¹ • y) y) t := by + intro S W Z x + let r := expandingReactionHistory T hT + (expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q 0) S + have hr : Continuous r := continuous_expandingReactionHistory T hT _ S + have hs := hasDerivAt_expandingMild_strong a b k L T ha hk hL hT S r hr f + (fun s => expandingProfileTrajectory_eq a b k L T ha ha1 hk hL hT m Q hQ q hq f s) t ht + have h := hasDerivAt_expandingToSobolev_reduced a b k L ha1 hk _ _ t hs + exact hasDerivAt_sobolev_moving_point k L hk W t y _ _ h + (hasDerivAt_expandingProfile_pointwise a b k L T ha ha1 hk hL hT m Q hQ q hq f t ht (x t)) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfilePhysicalPath.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfilePhysicalPath.lean new file mode 100644 index 0000000000000000000000000000000000000000..616931b8678dbcc05b16160084f60d262f96e4fc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfilePhysicalPath.lean @@ -0,0 +1,25 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingSpacetimeObservation +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfileTimeEquicontinuity + +namespace OAI + +/-! # The actual linearized trajectory in physical space-time coordinates -/ + +open Set + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +attribute [local irreducible] expandingProfileTrajectory expandingTorusFunction expandingSpacetimePath + +noncomputable def expandingProfilePhysicalPath (a b k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (m : ℕ) (Q : ℝ) (hQ : 0 ≤ Q) (q : C(Icc (0 : ℝ) T, FourierL2)) + (hq : ∀ t, ‖q t‖ ≤ Q) (f : FourierL2) : C(Icc (0 : ℝ) T × E, ℂ) := + expandingSpacetimePath a k L T ha ha1 hk hL + (expandingProfileTrajectory a b k L T ha ha1 hk hL hT m Q hQ q hq f) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfilePointwise.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfilePointwise.lean new file mode 100644 index 0000000000000000000000000000000000000000..e785e00ec694d5be965f15989564f0bfb7718bb1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfilePointwise.lean @@ -0,0 +1,79 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFixedPhysical +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingReducedTransfer +import OAI.MathematicalPhysics.DefocusingNLS.Linear.SobolevForcedEvaluation +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfilePropagator + +namespace OAI + +/-! # The actual profile propagator satisfies the pointwise normalized torus equation -/ + +open Set + +namespace DefocusingNLS + +attribute [local irreducible] expandingProfileTrajectory expandingTorusFunction + +theorem hasDerivAt_expandingProfile_pointwise (a b k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (m : ℕ) (Q : ℝ) (hQ : 0 ≤ Q) (q : C(Icc (0 : ℝ) T, FourierL2)) + (hq : ∀ s, ‖q s‖ ≤ Q) (f : FourierL2) (t : ℝ) (ht : t ∈ Ioo 0 T) + (x : SchrodingerTorus) : + let S := expandingProfileTrajectory a b k L T ha ha1 hk hL hT m Q hQ q hq f + let W := fun s => expandingToSobolev a k ha1 hk + (expandingPhysicalPath a k L T ha hk hL S (projIcc 0 T hT s)) + let Z := fun s => expandingToSobolev a k ha1 hk + (expandingPhysicalPath a k L T ha hk hL q (projIcc 0 T hT s)) + HasDerivAt (fun s => sobolevTorusFunction k (W s) x) + ((-(a : ℂ) + Complex.I * b) * sobolevTorusFunction k (W t) x + + ((L ^ (-2 : ℝ) * Real.exp (-t) : ℝ) : ℂ) * + (Complex.I * torusFourierLaplacian k (W t) x) - + Complex.I * oddPowerDerivative m (sobolevTorusFunction k (Z t) x) + (sobolevTorusFunction k (W t) x)) t := by + intro S W Z + let r := expandingReactionHistory T hT + (expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q 0) S + have hr : Continuous r := continuous_expandingReactionHistory T hT _ S + let rC : C(Icc (0 : ℝ) T, FourierL2) := ⟨fun s => r s, hr.comp continuous_subtype_val⟩ + let G := fun s => expandingToSobolev a k ha1 hk + (expandingPhysicalPath a k L T ha hk hL rC (projIcc 0 T hT s)) + have hs := hasDerivAt_expandingMild_strong a b k L T ha hk hL hT S r hr f + (fun s => expandingProfileTrajectory_eq a b k L T ha ha1 hk hL hT m Q hQ q hq f s) t ht + have h := hasDerivAt_expandingToSobolev_reduced a b k L ha1 hk _ _ t hs + have h' : HasDerivAt (fun s => lowerSobolevInclusion (W s)) + ((-(a : ℂ) + Complex.I * b) • lowerSobolevInclusion (W t) + + ((L ^ (-2 : ℝ) * Real.exp (-t) : ℝ) : ℂ) • lowerSobolevGenerator (W t) + + lowerSobolevInclusion (G t)) t := by + apply h.congr_deriv + change (-(a : ℂ) + Complex.I * b) • lowerSobolevInclusion (W t) + + (L ^ (-2 : ℝ) * Real.exp (-t)) • lowerSobolevGenerator (W t) + + lowerSobolevInclusion (G t) = _ + apply congrArg (fun v : FourierL2 => + (-(a : ℂ) + Complex.I * b) • lowerSobolevInclusion (W t) + v + lowerSobolevInclusion (G t)) + ext n + simp only [lp.coeFn_smul, Pi.smul_apply, Complex.real_smul, smul_eq_mul] + have hp := hasDerivAt_forcedTorusFunction k hk W t x + (-(a : ℂ) + Complex.I * b) (((L ^ (-2 : ℝ) * Real.exp (-t) : ℝ) : ℂ)) (G t) h' + have hg : sobolevTorusFunction k (G t) x = -Complex.I * + oddPowerDerivative m (sobolevTorusFunction k (Z t) x) (sobolevTorusFunction k (W t) x) := by + simp only [G, Z, W, expandingFixedPhysical_value a k L T ha ha1 hk hL] + let s := projIcc 0 T hT t + have hs' : projIcc 0 T hT (s : ℝ) = s := projIcc_of_mem _ s.2 + change expandingTorusFunction a k (expandingRadius L s) (r s) x = _ + dsimp [r, expandingReactionHistory] + rw [hs'] + change expandingTorusFunction a k (expandingRadius L s) + ((-Complex.I) • fderiv ℝ (expandingOddPower a k (expandingRadius L s) ha ha1 hk + (hL.trans (expandingRadius_ge L s hL s.2.1)) m) (q s) (S s) + 0) x = _ + rw [add_zero, expandingTorusFunction_eq_evaluation a k _ ha ha1 hk + (hL.trans (expandingRadius_ge L s hL s.2.1)), map_smul] + simp only [← expandingTorusFunction_eq_evaluation a k _ ha ha1 hk + (hL.trans (expandingRadius_ge L s hL s.2.1)), smul_eq_mul, + expandingOddPower_fderiv_pointwise] + rfl + convert hp using 1 + rw [hg] + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfilePropagator.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfilePropagator.lean new file mode 100644 index 0000000000000000000000000000000000000000..e1a75e680f54598437c7dffd7880b773212b1c7c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfilePropagator.lean @@ -0,0 +1,148 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFiniteSlab +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingDuhamelLinear + +namespace OAI + +/-! # The finite-slab propagator for the actual linearized profile + +The solution operator is real-linear and bounded in the exact expanding +Sobolev coordinates. Its bound depends on the profile bound and elapsed +time, and is independent of the starting radius. +-/ + +open Set + +namespace DefocusingNLS + +attribute [local irreducible] expandingFreeStep + +section Trajectory + +variable (a b k L T : ℝ) (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (hL : 1 ≤ L) (hT : 0 ≤ T) (m : ℕ) (R : ℝ) (hR : 0 ≤ R) + (q : C(Icc (0 : ℝ) T, FourierL2)) (hq : ∀ t, ‖q t‖ ≤ R) + +local notation "F" => expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q 0 + +noncomputable def expandingProfileTrajectory (u₀ : FourierL2) : + C(Icc (0 : ℝ) T, FourierL2) := + Classical.choose (existsUnique_expandingProfile_finiteSlab a b k L T ha ha1 hk hL hT + m R hR q 0 u₀ hq).exists + +local notation "S" => expandingProfileTrajectory a b k L T ha ha1 hk hL hT m R hR q hq + +theorem expandingProfileTrajectory_eq (u₀ : FourierL2) (t : Icc (0 : ℝ) T) : + S u₀ t = expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t (expandingReactionHistory T hT F (S u₀)) := + Classical.choose_spec (existsUnique_expandingProfile_finiteSlab a b k L T ha ha1 hk hL hT + m R hR q 0 u₀ hq).exists t + +theorem expandingProfileTrajectory_unique (u₀ : FourierL2) + (u : C(Icc (0 : ℝ) T, FourierL2)) + (hu : ∀ t : Icc (0 : ℝ) T, u t = expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t (expandingReactionHistory T hT F u)) : + u = S u₀ := + (existsUnique_expandingProfile_finiteSlab a b k L T ha ha1 hk hL hT m R hR q 0 u₀ hq).unique + hu (expandingProfileTrajectory_eq a b k L T ha ha1 hk hL hT m R hR q hq u₀) + +private theorem profile_history_zero : expandingReactionHistory T hT F 0 = fun _ => 0 := by + funext τ + let τ' := projIcc 0 T hT τ + let l := expandingRadiusCurve L T hL + let D : FourierL2 →L[ℝ] FourierL2 := + fderiv ℝ (expandingOddPower a k (l τ').1 ha ha1 hk (l τ').2 m) (q τ') + change -Complex.I • D 0 + 0 = 0 + simp only [map_zero, smul_zero, add_zero] + +private theorem profile_history_add (u v : C(Icc (0 : ℝ) T, FourierL2)) : + expandingReactionHistory T hT F (u + v) = fun τ => + expandingReactionHistory T hT F u τ + expandingReactionHistory T hT F v τ := by + funext τ + let τ' := projIcc 0 T hT τ + let l := expandingRadiusCurve L T hL + let D : FourierL2 →L[ℝ] FourierL2 := + fderiv ℝ (expandingOddPower a k (l τ').1 ha ha1 hk (l τ').2 m) (q τ') + change -Complex.I • D (u τ' + v τ') + 0 = + (-Complex.I • D (u τ') + 0) + (-Complex.I • D (v τ') + 0) + simp only [map_add, smul_add, add_zero] + +private theorem profile_history_smul (c : ℝ) (u : C(Icc (0 : ℝ) T, FourierL2)) : + expandingReactionHistory T hT F (c • u) = fun τ => + c • expandingReactionHistory T hT F u τ := by + funext τ + let τ' := projIcc 0 T hT τ + let l := expandingRadiusCurve L T hL + let D : FourierL2 →L[ℝ] FourierL2 := + fderiv ℝ (expandingOddPower a k (l τ').1 ha ha1 hk (l τ').2 m) (q τ') + change -Complex.I • D (c • u τ') + 0 = + c • (-Complex.I • D (u τ') + 0) + simp only [map_smul, add_zero] + exact smul_comm _ _ _ + +@[simp] theorem expandingProfileTrajectory_zero : S 0 = 0 := by + symm + apply expandingProfileTrajectory_unique a b k L T ha ha1 hk hL hT m R hR q hq + intro t + rw [profile_history_zero a k L T ha ha1 hk hL hT m q, + expandingDuhamel_zero, map_zero, add_zero] + rfl + +theorem expandingProfileTrajectory_add (u₀ v₀ : FourierL2) : S (u₀ + v₀) = S u₀ + S v₀ := by + symm + apply expandingProfileTrajectory_unique a b k L T ha ha1 hk hL hT m R hR q hq + intro t + rw [profile_history_add a k L T ha ha1 hk hL hT m q, + expandingDuhamel_add a b k L ha hk hL t _ _ + (continuous_expandingReactionHistory T hT F (S u₀)).continuousOn + (continuous_expandingReactionHistory T hT F (S v₀)).continuousOn, map_add] + change S u₀ t + S v₀ t = _ + rw [expandingProfileTrajectory_eq a b k L T ha ha1 hk hL hT m R hR q hq u₀, + expandingProfileTrajectory_eq a b k L T ha ha1 hk hL hT m R hR q hq v₀] + abel + +theorem expandingProfileTrajectory_smul (c : ℝ) (u₀ : FourierL2) : S (c • u₀) = c • S u₀ := by + symm + apply expandingProfileTrajectory_unique a b k L T ha ha1 hk hL hT m R hR q hq + intro t + rw [profile_history_smul a k L T ha ha1 hk hL hT m q, + expandingDuhamel_real_smul, ContinuousLinearMap.map_smul_of_tower] + change c • S u₀ t = _ + rw [expandingProfileTrajectory_eq a b k L T ha ha1 hk hL hT m R hR q hq u₀, smul_add] + +end Trajectory + +/-- One uniform growth rate yields bounded real-linear finite-slab propagators +for every permitted radius and bounded continuous profile. -/ +theorem exists_expandingProfile_propagator (a b k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) (R : ℝ) (hR : 0 ≤ R) : + ∃ K : ℝ, 0 ≤ K ∧ ∀ (L T : ℝ) (hL : 1 ≤ L) (hT : 0 ≤ T) + (q : C(Icc (0 : ℝ) T, FourierL2)) (_hq : ∀ t, ‖q t‖ ≤ R), + ∃ U : FourierL2 →L[ℝ] C(Icc (0 : ℝ) T, FourierL2), + (∀ u₀ t, U u₀ t = expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t (expandingReactionHistory T hT + (expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q 0) (U u₀))) ∧ + ‖U‖ ≤ (K + 1) * Real.exp ((K + 1) * T) := by + obtain ⟨K, hK, hbound⟩ := exists_expandingProfileReaction_lipschitz a k ha ha1 hk m R hR + refine ⟨K, hK, ?_⟩ + intro L T hL hT q hq + let S := expandingProfileTrajectory a b k L T ha ha1 hk hL hT m R hR q hq + let F := expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q 0 + let A : FourierL2 →ₗ[ℝ] C(Icc (0 : ℝ) T, FourierL2) := + { toFun := S + map_add' := expandingProfileTrajectory_add a b k L T ha ha1 hk hL hT m R hR q hq + map_smul' := expandingProfileTrajectory_smul a b k L T ha ha1 hk hL hT m R hR q hq } + have hC : 0 ≤ (K + 1) * Real.exp ((K + 1) * T) := by positivity + have hA : ∀ u₀, ‖A u₀‖ ≤ (K + 1) * Real.exp ((K + 1) * T) * ‖u₀‖ := by + intro u₀ + have h := expandingMildSolution_finiteSlab_initialData_bound a b k L T ha hk hL hT F + u₀ 0 K hK (hbound T (expandingRadiusCurve L T hL) q 0 hq) (S u₀) (S 0) + (expandingProfileTrajectory_eq a b k L T ha ha1 hk hL hT m R hR q hq u₀) + (expandingProfileTrajectory_eq a b k L T ha ha1 hk hL hT m R hR q hq 0) + simpa only [A, LinearMap.coe_mk, AddHom.coe_mk, S, expandingProfileTrajectory_zero, dist_zero_right] using h + let U := A.mkContinuous ((K + 1) * Real.exp ((K + 1) * T)) hA + refine ⟨U, ?_, LinearMap.mkContinuous_norm_le _ hC hA⟩ + exact expandingProfileTrajectory_eq a b k L T ha ha1 hk hL hT m R hR q hq + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileResponse.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileResponse.lean new file mode 100644 index 0000000000000000000000000000000000000000..fc9ab9852a457445c87bd3d84ad5929c9fb299a7 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileResponse.lean @@ -0,0 +1,132 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfilePropagator + +namespace OAI + +/-! # Uniform finite-slab response to forcing in the actual linearized equation + +An exponential time weight bounds the response on an arbitrary fixed slab. +The constants are independent of the initial torus radius and use the +actual odd-power derivative along the given bounded profile. +-/ + +open Set + +namespace DefocusingNLS + +attribute [local irreducible] expandingFreeStep + +theorem expandingMild_finiteSlab_residual_bound (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) (u₀ : FourierL2) + (K ε : ℝ) (hK : 0 ≤ K) (hε : 0 ≤ ε) + (hF : ∀ t x y, ‖F (t, x) - F (t, y)‖ ≤ K * ‖x - y‖) + (u v : C(Icc (0 : ℝ) T, FourierL2)) + (hu : ∀ t : Icc (0 : ℝ) T, u t = + expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t (expandingReactionHistory T hT F u)) + (hv : ∀ t : Icc (0 : ℝ) T, + Real.exp (-(K + 1) * t) * + ‖v t - expandingPicard a b k L T ha hk hL hT F u₀ v t‖ ≤ ε) : + dist u v ≤ Real.exp ((K + 1) * T) * ((K + 1) * ε) := by + let η := K + 1 + have hη : 0 < η := by dsimp [η]; linarith + let P := expandingBieleckiPicard a b k L T η ha hk hL hT F u₀ + let u' := expandingTimeWeight T (-η) u + let v' := expandingTimeWeight T (-η) v + have hKη : K / η < 1 := (div_lt_one hη).2 (by dsimp [η]; linarith) + have hP : ContractingWith ⟨K / η, div_nonneg hK hη.le⟩ P := + ⟨hKη, LipschitzWith.of_dist_le_mul + (expandingBieleckiPicard_dist_le a b k L T η ha hk hL hT hη F u₀ K hK hF)⟩ + have huP : Function.IsFixedPt P u' := + expandingBielecki_isFixedPt a b k L T η ha hk hL hT F u₀ u hu + have hvP : dist v' (P v') ≤ ε := by + apply (ContinuousMap.dist_le hε).2 + intro t + change dist (Real.exp (-η * t) • v t) + (Real.exp (-η * t) • + expandingPicard a b k L T ha hk hL hT F u₀ + (expandingTimeWeight T η (expandingTimeWeight T (-η) v)) t) ≤ ε + rw [expandingTimeWeight_cancel, dist_eq_norm, ← smul_sub, norm_smul, + Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)] + exact hv t + have hd := (hP.dist_le_of_fixedPoint v' huP).trans + (div_le_div_of_nonneg_right hvP (sub_nonneg.mpr hKη.le)) + change dist v' u' ≤ ε / (1 - K / η) at hd + have hden : 1 - K / η = 1 / η := by + apply (eq_div_iff hη.ne').2 + rw [sub_mul, div_mul_cancel₀ _ hη.ne', one_mul] + dsimp [η] + ring + rw [hden, div_div_eq_mul_div, div_one] at hd + have hout := expandingTimeWeight_dist_le T η hη.le u' v' + have heq : dist u v ≤ Real.exp (η * T) * dist u' v' := by + simpa only [u', v', expandingTimeWeight_cancel] using hout + calc + dist u v ≤ Real.exp (η * T) * dist u' v' := heq + _ ≤ Real.exp (η * T) * (ε * η) := + mul_le_mul_of_nonneg_left (by simpa only [dist_comm] using hd) (Real.exp_pos _).le + _ = _ := by dsimp [η]; ring + +/-- Bounded forcing in the actual profile linearization has a response bound +on every finite slab, uniformly in the starting radius. -/ +theorem exists_expandingProfile_response_bound (a b k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) (R : ℝ) (hR : 0 ≤ R) : + ∃ K : ℝ, 0 ≤ K ∧ ∀ (L T : ℝ) (hL : 1 ≤ L) (hT : 0 ≤ T) + (q g : C(Icc (0 : ℝ) T, FourierL2)) (u₀ : FourierL2) + (G : ℝ), 0 ≤ G → (∀ t, ‖q t‖ ≤ R) → (∀ t, ‖g t‖ ≤ G) → + ∀ u v : C(Icc (0 : ℝ) T, FourierL2), + (∀ t : Icc (0 : ℝ) T, u t = + expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t + (expandingReactionHistory T hT + (expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q g) u)) → + (∀ t : Icc (0 : ℝ) T, v t = + expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t + (expandingReactionHistory T hT + (expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q 0) v)) → + dist u v ≤ Real.exp ((K + 1) * T) * G := by + obtain ⟨K, hK, hbound⟩ := exists_expandingProfileReaction_lipschitz a k ha ha1 hk m R hR + refine ⟨K, hK, ?_⟩ + intro L T hL hT q g u₀ G hG hq hg u v hu hv + let η := K + 1 + have hη : 0 < η := by dsimp [η]; linarith + let F := expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q g + let F₀ := expandingProfileReaction a k T ha ha1 hk m (expandingRadiusCurve L T hL) q 0 + let r₀ := expandingReactionHistory T hT F₀ v + let r := fun τ : ℝ => g (projIcc 0 T hT τ) + have hr₀ : Continuous r₀ := continuous_expandingReactionHistory T hT F₀ v + have hr : Continuous r := g.continuous.comp continuous_projIcc + have hsplit : expandingReactionHistory T hT F v = fun τ => r₀ τ + r τ := by + funext τ + change (-Complex.I • _ + g (projIcc 0 T hT τ)) = + (-Complex.I • _ + 0) + g (projIcc 0 T hT τ) + rw [add_zero] + have hdef (t : Icc (0 : ℝ) T) : + expandingPicard a b k L T ha hk hL hT F u₀ v t = + v t + expandingDuhamel a b k L ha hk hL t r := by + change expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t (expandingReactionHistory T hT F v) = _ + rw [hsplit, expandingDuhamel_add a b k L ha hk hL t r₀ r + hr₀.continuousOn hr.continuousOn, ← add_assoc, ← hv t] + have hdef_bound (t : Icc (0 : ℝ) T) : + Real.exp (-(K + 1) * t) * + ‖v t - expandingPicard a b k L T ha hk hL hT F u₀ v t‖ ≤ G / η := by + rw [hdef] + rw [show v t - (v t + expandingDuhamel a b k L ha hk hL t r) = + -expandingDuhamel a b k L ha hk hL t r by abel, norm_neg] + have hb := expandingDuhamel_weighted_norm_le a b k L η t G ha hk hL hη t.2.1 hG r + (fun τ hτ => (hg _).trans (le_mul_of_one_le_right hG + (Real.one_le_exp_iff.mpr (mul_nonneg hη.le hτ.1)))) + exact hb + have hb := expandingMild_finiteSlab_residual_bound a b k L T ha hk hL hT F u₀ K (G / η) + hK (div_nonneg hG hη.le) (hbound T (expandingRadiusCurve L T hL) q g hq) + u v hu hdef_bound + have he : (K + 1) * (G / η) = G := by + change η * (G / η) = G + exact mul_div_cancel₀ G hη.ne' + rwa [he] at hb + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileTimeEquicontinuity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileTimeEquicontinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..2d78312d05bc8c57f0a0b2d8981d87916abbb097 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileTimeEquicontinuity.lean @@ -0,0 +1,61 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPhysicalTimeBound +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfileUniformBound +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingNonprincipalEnergy + +namespace OAI + +/-! # Uniform time equicontinuity of actual torus propagators on physical balls -/ + +open Set + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem exists_expandingProfile_time_bound (a b k Q M T R : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hQ : 0 ≤ Q) (hM : 0 ≤ M) + (hT : 0 ≤ T) (hR : 0 ≤ R) (m : ℕ) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ (L : ℝ) (hL : 1 ≤ L) + (q : C(Icc (0 : ℝ) T, FourierL2)) (hq : ∀ t, ‖q t‖ ≤ Q) + (f : FourierL2), ‖f‖ ≤ M → ∀ (s t : Icc (0 : ℝ) T) (y : E), ‖y‖ ≤ R → + let S := expandingProfileTrajectory a b (k + 2) L T ha ha1 (by linarith) hL hT m Q hQ q hq f; + ‖expandingTorusFunction a (k + 2) (expandingRadius L t) (S t) + (euclideanToTorus ((expandingRadius L t)⁻¹ • y)) - + expandingTorusFunction a (k + 2) (expandingRadius L s) (S s) + (euclideanToTorus ((expandingRadius L s)⁻¹ • y))‖ ≤ C * |(t : ℝ) - s| := by + obtain ⟨K, hK, hKb⟩ := exists_expandingProfileTrajectory_bound a b (k + 2) ha ha1 (by linarith) m Q hQ + obtain ⟨D, hD, hDb⟩ := exists_expandingLinearized_norm_bound a (k + 2) Q ha ha1 (by linarith) hQ m + let A := (K + 1) * Real.exp ((K + 1) * T) * M + have hA : 0 ≤ A := by dsimp [A]; positivity + let C := (|a| + |b| + 1 + R / 2) * expandingJetBound a k * A + expandingEmbeddingBound a (k + 2) * (D * A) + have hC : 0 ≤ C := by dsimp [C, expandingJetBound, expandingEmbeddingBound]; positivity + refine ⟨C, hC, ?_⟩ + intro L hL q hq f hf s t y hy S + let l := expandingRadiusCurve L T hL + let g := expandingReactionHistory T hT (expandingProfileReaction a (k + 2) T ha ha1 (by linarith) m l q 0) S + have hgcont : Continuous g := continuous_expandingReactionHistory T hT _ S + have hSb (s : Icc (0 : ℝ) T) : ‖S s‖ ≤ A := + ((ContinuousMap.norm_coe_le_norm S s).trans (hKb L T hL hT q hq f)).trans + (mul_le_mul_of_nonneg_left hf (by positivity)) + have hgb (τ : ℝ) (_hτ : τ ∈ Icc 0 T) : ‖g τ‖ ≤ D * A := by + let v := projIcc 0 T hT τ + have he : g τ = expandingLinearizedPotential a (k + 2) (l v).1 ha ha1 (by linarith) (l v).2 m (q v) (S v) := by + change (-Complex.I) • _ + (0 : FourierL2) = _ + exact add_zero _ + rw [he] + exact (ContinuousLinearMap.le_opNorm _ _).trans + ((mul_le_mul_of_nonneg_right (hDb (l v).1 (l v).2 (q v) (hq v)) (norm_nonneg _)).trans + (mul_le_mul_of_nonneg_left (hSb v) hD)) + have hb := expandingMild_physical_time_bound a b k L T A (D * A) ha ha1 hk hL hT S g f hgcont.continuousOn + (fun v => expandingProfileTrajectory_eq a b (k + 2) L T ha ha1 (by linarith) hL hT m Q hQ q hq f v) + hSb hgb y s t + apply hb.trans + apply mul_le_mul_of_nonneg_right _ (abs_nonneg _) + dsimp only [C] + gcongr + dsimp [expandingJetBound, expandingEmbeddingBound] + positivity + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileUniformBound.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileUniformBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..3d2242adc5e63f418314a7d07652ad4072e5a77b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingProfileUniformBound.lean @@ -0,0 +1,24 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfilePropagator + +namespace OAI + +/-! # The constructed propagator has one norm bound for every starting radius -/ + +namespace DefocusingNLS + +theorem exists_expandingProfileTrajectory_bound (a b k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) (Q : ℝ) (hQ : 0 ≤ Q) : + ∃ K : ℝ, 0 ≤ K ∧ ∀ (L T : ℝ) (hL : 1 ≤ L) (hT : 0 ≤ T) + (q : C(Set.Icc (0 : ℝ) T, FourierL2)) (hq : ∀ t, ‖q t‖ ≤ Q) (f : FourierL2), + ‖expandingProfileTrajectory a b k L T ha ha1 hk hL hT m Q hQ q hq f‖ ≤ + (K + 1) * Real.exp ((K + 1) * T) * ‖f‖ := by + obtain ⟨K, hK, hb⟩ := exists_expandingProfile_propagator a b k ha ha1 hk m Q hQ + refine ⟨K, hK, fun L T hL hT q hq f => ?_⟩ + obtain ⟨U, hU, hUb⟩ := hb L T hL hT q hq + have he := expandingProfileTrajectory_unique a b k L T ha ha1 hk hL hT m Q hQ q hq f (U f) (hU f) + rw [← he] + exact (U.le_opNorm f).trans (mul_le_mul_of_nonneg_right hUb (norm_nonneg f)) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingQuadraticMultiplier.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingQuadraticMultiplier.lean new file mode 100644 index 0000000000000000000000000000000000000000..8879ee64ecd4766a1fdacc02f612fe725a1b9dea --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingQuadraticMultiplier.lean @@ -0,0 +1,65 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingQuadraticWeight + +namespace OAI + +/-! # A uniformly bounded multiplier representing two physical derivatives -/ + +open scoped ENNReal + +namespace DefocusingNLS + +noncomputable def expandingQuadraticRatio (a k L : ℝ) (n : frequencyLattice) : ℝ := + (‖n‖ / L) ^ 2 * expandingSobolevWeight a k L n / expandingSobolevWeight a (k + 2) L n + +theorem expandingQuadraticRatio_bounds (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (n : frequencyLattice) : + 0 ≤ expandingQuadraticRatio a k L n ∧ + expandingQuadraticRatio a k L n ≤ Real.sqrt (2 ^ (6 - a) + 1) := by + constructor + · exact div_nonneg (mul_nonneg (sq_nonneg _) (expandingSobolevWeight_pos a k L hL n).le) + (expandingSobolevWeight_pos a (k + 2) L hL n).le + · exact (div_le_iff₀ (expandingSobolevWeight_pos a (k + 2) L hL n)).mpr + (expandingSobolevWeight_quadratic a k L ha ha1 hk hL n) + +noncomputable def expandingQuadraticVector (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) : FourierL2 := + ⟨fun n => (expandingQuadraticRatio a k L n : ℂ) * f n, by + apply (lp.memℓp ((Real.sqrt (2 ^ (6 - a) + 1) : ℝ) • f)).mono' + intro n + simp only [lp.coeFn_smul, Pi.smul_apply, norm_smul, Real.norm_eq_abs, norm_mul, + Complex.norm_real, abs_of_nonneg (expandingQuadraticRatio_bounds a k L ha ha1 hk hL n).1, + abs_of_nonneg (Real.sqrt_nonneg _)] + exact mul_le_mul_of_nonneg_right (expandingQuadraticRatio_bounds a k L ha ha1 hk hL n).2 + (norm_nonneg _)⟩ + +theorem expandingQuadraticVector_norm (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) : + ‖expandingQuadraticVector a k L ha ha1 hk hL f‖ ≤ Real.sqrt (2 ^ (6 - a) + 1) * ‖f‖ := by + calc + _ ≤ ‖(Real.sqrt (2 ^ (6 - a) + 1) : ℝ) • f‖ := by + apply lp.norm_mono (by norm_num : (2 : ℝ≥0∞) ≠ 0) + intro n + change ‖(expandingQuadraticRatio a k L n : ℂ) * f n‖ ≤ + ‖Real.sqrt (2 ^ (6 - a) + 1) • f n‖ + simp only [norm_mul, norm_smul, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (expandingQuadraticRatio_bounds a k L ha ha1 hk hL n).1, + abs_of_nonneg (Real.sqrt_nonneg _)] + exact mul_le_mul_of_nonneg_right (expandingQuadraticRatio_bounds a k L ha ha1 hk hL n).2 + (norm_nonneg _) + _ = _ := by rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg (Real.sqrt_nonneg _)] + +theorem expandingQuadraticVector_coefficient (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) (n : frequencyLattice) : + expandingFourierCoefficient a k L (expandingQuadraticVector a k L ha ha1 hk hL f) n = + ((‖n‖ / L) ^ 2 : ℝ) * expandingFourierCoefficient a (k + 2) L f n := by + change (((expandingSobolevWeight a k L n)⁻¹ : ℝ) : ℂ) * + (((expandingQuadraticRatio a k L n : ℝ) : ℂ) * f n) = _ + unfold expandingQuadraticRatio expandingFourierCoefficient + push_cast + have hw : (expandingSobolevWeight a k L n : ℂ) ≠ 0 := + Complex.ofReal_ne_zero.mpr (expandingSobolevWeight_pos a k L hL n).ne' + field_simp + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingQuadraticObservation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingQuadraticObservation.lean new file mode 100644 index 0000000000000000000000000000000000000000..c81abce712d719abd0894f6beaa81df8189d83ee --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingQuadraticObservation.lean @@ -0,0 +1,80 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingSequentialObservation +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingBallScalar + +namespace OAI + +/-! # Quadratic compact errors are small modulo a physical ball observation -/ + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) +local notation "Radius" => {L : ℝ // 1 ≤ L} + +theorem expanding_quadratic_observation_estimate (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (F : Radius → FourierL2 → ℝ) (B : ℝ) (hB : 0 ≤ B) + (hbound : ∀ L f, F L f ≤ B * ‖f‖ ^ 2) + (hscale : ∀ L (c : ℝ) f, F L (c • f) = c ^ 2 * F L f) + (ε : ℝ) (hε : 0 < ε) (n : ℕ) + (hsmall : ∀ (L : Radius), (n : ℝ) ≤ L.1 → ∀ f : FourierL2, + ‖f‖ ≤ 1 → + (∀ y : E, ‖y‖ ≤ (n : ℝ) → + ‖expandingTorusFunction a k L.1 f (euclideanToTorus (L.1⁻¹ • y))‖ ≤ + 1 / ((n : ℝ) + 1)) → F L f ≤ ε) : + ∀ (L : Radius), (n : ℝ) ≤ L.1 → ∀ f : FourierL2, + F L f ≤ ε * ‖f‖ ^ 2 + B * ((n : ℝ) + 1) ^ 2 * + ‖expandingPhysicalBall a k L.1 n ha ha1 hk L.2 f‖ ^ 2 := by + intro L hL f + by_cases hf : f = 0 + · subst f + have hz : F L 0 ≤ 0 := by simpa using hbound L 0 + simpa only [norm_zero, zero_pow (by decide : 2 ≠ 0), mul_zero, zero_add] using + hz.trans (show 0 ≤ B * ((n : ℝ) + 1) ^ 2 * + ‖expandingPhysicalBall a k L.1 n ha ha1 hk L.2 0‖ ^ 2 by positivity) + have hfp : 0 < ‖f‖ := norm_pos_iff.mpr hf + let s := ‖expandingPhysicalBall a k L.1 n ha ha1 hk L.2 f‖ + have hs : 0 ≤ s := norm_nonneg _ + have hnp : 0 < (n : ℝ) + 1 := by positivity + by_cases hlocal : s ≤ ‖f‖ / ((n : ℝ) + 1) + · let w : FourierL2 := ‖f‖⁻¹ • f + have hwn : ‖w‖ = 1 := by + dsimp only [w] + rw [norm_smul, Real.norm_eq_abs, abs_of_pos (inv_pos.mpr hfp), inv_mul_cancel₀ hfp.ne'] + have hwlocal : ∀ y : E, ‖y‖ ≤ (n : ℝ) → + ‖expandingTorusFunction a k L.1 w (euclideanToTorus (L.1⁻¹ • y))‖ ≤ + 1 / ((n : ℝ) + 1) := by + intro y hy + have hb := expandingPhysicalBall_point_le a k L.1 n ha ha1 hk L.2 w y hy + have he : ‖expandingPhysicalBall a k L.1 n ha ha1 hk L.2 w‖ = ‖f‖⁻¹ * s := by + dsimp only [w] + rw [expandingPhysicalBall_smul, norm_smul, Real.norm_eq_abs, abs_of_pos (inv_pos.mpr hfp)] + rw [he] at hb + apply hb.trans + calc + ‖f‖⁻¹ * s ≤ ‖f‖⁻¹ * (‖f‖ / ((n : ℝ) + 1)) := + mul_le_mul_of_nonneg_left hlocal (inv_nonneg.mpr hfp.le) + _ = 1 / ((n : ℝ) + 1) := by field_simp + have hw := hsmall L hL w hwn.le hwlocal + have hfw : ‖f‖ • w = f := by + dsimp only [w] + rw [smul_smul, mul_inv_cancel₀ hfp.ne', one_smul] + have he := hscale L ‖f‖ w + rw [hfw] at he + calc + F L f = ‖f‖ ^ 2 * F L w := he + _ ≤ ‖f‖ ^ 2 * ε := mul_le_mul_of_nonneg_left hw (sq_nonneg _) + _ ≤ _ := by nlinarith [mul_nonneg (mul_nonneg hB (sq_nonneg ((n : ℝ) + 1))) (sq_nonneg s)] + · have hfs : ‖f‖ ≤ ((n : ℝ) + 1) * s := by + have ht := (div_lt_iff₀ hnp).mp (lt_of_not_ge hlocal) + nlinarith + have hsq : ‖f‖ ^ 2 ≤ ((n : ℝ) + 1) ^ 2 * s ^ 2 := by + nlinarith [sq_nonneg (((n : ℝ) + 1) * s - ‖f‖)] + have hm := mul_le_mul_of_nonneg_left hsq hB + calc + F L f ≤ B * ‖f‖ ^ 2 := hbound L f + _ ≤ B * ((n : ℝ) + 1) ^ 2 * s ^ 2 := by nlinarith + _ ≤ _ := by nlinarith [mul_nonneg hε.le (sq_nonneg ‖f‖)] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingQuadraticWeight.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingQuadraticWeight.lean new file mode 100644 index 0000000000000000000000000000000000000000..42d7a0213a8f687fa81ed34fa0962706ef211286 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingQuadraticWeight.lean @@ -0,0 +1,35 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.PhysicalQuadraticWeight + +namespace OAI + +/-! # The physical Laplacian multiplier between adjacent expanding norms -/ + +namespace DefocusingNLS + +theorem expandingSobolevWeight_quadratic (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (n : frequencyLattice) : + (‖n‖ / L) ^ 2 * expandingSobolevWeight a k L n ≤ + Real.sqrt (2 ^ (6 - a) + 1) * expandingSobolevWeight a (k + 2) L n := by + have hLp : 0 < L := by linarith + have hx : 0 ≤ L ^ (-2 : ℝ) := Real.rpow_nonneg hLp.le _ + have hx1 : L ^ (-2 : ℝ) ≤ 1 := Real.rpow_le_one_of_one_le_of_nonpos hL (by norm_num) + have h := physical_quadratic_weight a k (L ^ (-2 : ℝ)) (‖n‖ / L) ha ha1 hk hx hx1 + (div_nonneg (norm_nonneg _) hLp.le) + have hw (j : ℝ) : expandingSobolevWeight a j L n ^ 2 = + (2 * Real.pi * L) ^ 12 * ((L ^ (-2 : ℝ) + (‖n‖ / L) ^ 2) ^ (6 - a) + (‖n‖ / L) ^ (2 * j)) := by + rw [expandingSobolevWeight_sq a j L hL] + exact (expandingSobolevWeightSq_original a j L hL n).symm + have hsq : ((‖n‖ / L) ^ 2 * expandingSobolevWeight a k L n) ^ 2 ≤ + (Real.sqrt (2 ^ (6 - a) + 1) * expandingSobolevWeight a (k + 2) L n) ^ 2 := by + rw [mul_pow, mul_pow, Real.sq_sqrt (by positivity), hw k, hw (k + 2)] + have hd := mul_le_mul_of_nonneg_left h (show 0 ≤ (2 * Real.pi * L) ^ 12 by positivity) + nlinarith + have hl : 0 ≤ (‖n‖ / L) ^ 2 * expandingSobolevWeight a k L n := by + exact mul_nonneg (sq_nonneg _) (expandingSobolevWeight_pos a k L hL n).le + have hr : 0 ≤ Real.sqrt (2 ^ (6 - a) + 1) * expandingSobolevWeight a (k + 2) L n := + mul_nonneg (Real.sqrt_nonneg _) (expandingSobolevWeight_pos a (k + 2) L hL n).le + nlinarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingReducedTransfer.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingReducedTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..378e261eeb7d61d617725242805963b850f638c2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingReducedTransfer.lean @@ -0,0 +1,26 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingMildStrong +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingSobolevNonlinearity + +namespace OAI + +/-! # Transferring the forced reduced equation to the standard Sobolev model -/ + +namespace DefocusingNLS + +theorem hasDerivAt_expandingToSobolev_reduced (a b k L : ℝ) + (ha1 : a < 1) (hk : 8 < k) (w r : ℝ → FourierL2) (t : ℝ) + (hw : HasDerivAt (fun s => lowerSobolevInclusion (w s)) + (expandingReducedField a b L w r t) t) : + HasDerivAt (fun s => lowerSobolevInclusion (expandingToSobolev a k ha1 hk (w s))) + (expandingReducedField a b L (fun s => expandingToSobolev a k ha1 hk (w s)) + (fun s => expandingToSobolev a k ha1 hk (r s)) t) t := by + have h := ((expandingToSobolev a k ha1 hk).restrictScalars ℝ).hasFDerivAt.comp_hasDerivAt t hw + have hreal (c : ℝ) (f : FourierL2) : + expandingToSobolev a k ha1 hk (c • f) = c • expandingToSobolev a k ha1 hk f := + (expandingToSobolev a k ha1 hk).toLinearMap.map_smul_of_tower c f + simpa only [Function.comp_def, ContinuousLinearMap.coe_restrictScalars', expandingReducedField, + map_add, map_smul, hreal, expandingToSobolev_lowerInclusion, expandingToSobolev_lowerGenerator] using h + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingResidualStability.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingResidualStability.lean new file mode 100644 index 0000000000000000000000000000000000000000..1e3b7f522c67cc7e0d0dc5268622ee756317f023 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingResidualStability.lean @@ -0,0 +1,149 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingMildContraction +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingDerivativeBounds +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingNonlinearityTransport +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPotentialContinuity + +namespace OAI + +/-! # Short-slab stability from the actual nonlinear mild defect + +The Lipschitz estimate is required only along the two bounded trajectories. +No global Lipschitz hypothesis is imposed on the odd-power polynomial. +-/ + +open Set Metric + +namespace DefocusingNLS + +attribute [local irreducible] expandingFreeStep + +theorem exists_expandingOddPower_lipschitz_on_ball (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) (R : ℝ) (hR : 0 ≤ R) : + ∃ K : ℝ, 0 ≤ K ∧ ∀ (L : ℝ) (hL : 1 ≤ L) (f g : FourierL2), + ‖f‖ ≤ R → ‖g‖ ≤ R → + ‖expandingOddPower a k L ha ha1 hk hL m f - + expandingOddPower a k L ha ha1 hk hL m g‖ ≤ K * ‖f - g‖ := by + obtain ⟨K, hK, hb⟩ := exists_expandingOddPower_two_jet_bound a k ha ha1 hk m R hR + refine ⟨K, hK, ?_⟩ + intro L hL f g hf hg + apply (convex_closedBall (0 : FourierL2) R).norm_image_sub_le_of_norm_fderiv_le + (fun x _ => (contDiff_expandingOddPower a k L ha ha1 hk hL m).differentiable (by simp) x) + · intro x hx + rw [← norm_iteratedFDeriv_one] + exact hb L hL x (by simpa using hx) 1 (by omega) + · simpa using hg + · simpa using hf + +noncomputable def expandingNonlinearReaction (a k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (m : ℕ) : + C((Icc (0 : ℝ) T) × FourierL2, FourierL2) where + toFun p := (-Complex.I) • expandingOddPower a k (expandingRadiusCurve L T hL p.1).1 + ha ha1 hk (expandingRadiusCurve L T hL p.1).2 m p.2 + continuous_toFun := ((continuous_expandingOddPower_scale a k ha ha1 hk m).comp + (((expandingRadiusCurve L T hL).continuous.comp continuous_fst).prodMk continuous_snd)).const_smul + (-Complex.I) + +theorem expandingPicard_pair_dist_le (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) (u₀ : FourierL2) + (K : ℝ) (hK : 0 ≤ K) (u v : C(Icc (0 : ℝ) T, FourierL2)) + (hF : ∀ t, ‖F (t, u t) - F (t, v t)‖ ≤ K * ‖u t - v t‖) : + dist (expandingPicard a b k L T ha hk hL hT F u₀ u) + (expandingPicard a b k L T ha hk hL hT F u₀ v) ≤ T * K * dist u v := by + apply (ContinuousMap.dist_le (by positivity)).2 + intro t + let ru := expandingReactionHistory T hT F u + let rv := expandingReactionHistory T hT F v + have hru : Continuous ru := continuous_expandingReactionHistory T hT F u + have hrv : Continuous rv := continuous_expandingReactionHistory T hT F v + have hb : ∀ s ∈ Icc (0 : ℝ) t, ‖ru s - rv s‖ ≤ K * dist u v := by + intro s _ + exact (hF (projIcc 0 T hT s)).trans (mul_le_mul_of_nonneg_left + (by simpa only [dist_eq_norm] using + ContinuousMap.dist_apply_le_dist (f := u) (g := v) (projIcc 0 T hT s)) hK) + have hbound := expandingDuhamel_norm_le_mul a b k L ha hk hL t + (K * dist u v) t.2.1 (fun s => ru s - rv s) (hru.sub hrv).continuousOn hb + change dist + (expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + expandingDuhamel a b k L ha hk hL t ru) + (expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + expandingDuhamel a b k L ha hk hL t rv) ≤ _ + rw [dist_add_left, dist_eq_norm, + ← expandingDuhamel_sub a b k L ha hk hL t ru rv hru.continuousOn hrv.continuousOn] + apply hbound.trans + calc + (t : ℝ) * (K * dist u v) ≤ T * (K * dist u v) := + mul_le_mul_of_nonneg_right t.2.2 (mul_nonneg hK dist_nonneg) + _ = T * K * dist u v := by ring + +theorem expandingPicard_initial_dist_le (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) (u₀ v₀ : FourierL2) + (v : C(Icc (0 : ℝ) T, FourierL2)) : + dist (expandingPicard a b k L T ha hk hL hT F u₀ v) + (expandingPicard a b k L T ha hk hL hT F v₀ v) ≤ dist u₀ v₀ := by + apply (ContinuousMap.dist_le dist_nonneg).2 + intro t + change dist + (expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + _) + (expandingFreeStep a b k L t ha hk hL t.2.1 v₀ + _) ≤ _ + rw [dist_add_right, dist_eq_norm, ← map_sub] + apply (expandingFreeStep_norm_bound a b k L t ha hk hL t.2.1 (u₀ - v₀)).trans + rw [dist_eq_norm] + exact mul_le_of_le_one_left (norm_nonneg _) + (Real.exp_le_one_iff.mpr (by nlinarith [t.2.1])) + +theorem expandingMild_residual_stability (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) (u₀ v₀ : FourierL2) + (K : ℝ) (hK : 0 ≤ K) (hTK : T * K < 1) + (u v : C(Icc (0 : ℝ) T, FourierL2)) + (hF : ∀ t, ‖F (t, u t) - F (t, v t)‖ ≤ K * ‖u t - v t‖) + (hu : u = expandingPicard a b k L T ha hk hL hT F u₀ u) + (ε : ℝ) (hε : dist v (expandingPicard a b k L T ha hk hL hT F v₀ v) ≤ ε) : + dist u v ≤ (dist u₀ v₀ + ε) / (1 - T * K) := by + have hpair := expandingPicard_pair_dist_le a b k L T ha hk hL hT F u₀ K hK u v hF + have hinit : dist (expandingPicard a b k L T ha hk hL hT F u₀ v) + (expandingPicard a b k L T ha hk hL hT F v₀ v) ≤ dist u₀ v₀ := + expandingPicard_initial_dist_le a b k L T ha hk hL hT F u₀ v₀ v + have hdist : dist u v ≤ T * K * dist u v + dist u₀ v₀ + ε := by + calc + dist u v = dist (expandingPicard a b k L T ha hk hL hT F u₀ u) v := by rw [← hu] + _ ≤ dist (expandingPicard a b k L T ha hk hL hT F u₀ u) + (expandingPicard a b k L T ha hk hL hT F u₀ v) + + dist (expandingPicard a b k L T ha hk hL hT F u₀ v) v := dist_triangle _ _ _ + _ ≤ T * K * dist u v + (dist u₀ v₀ + ε) := by + apply add_le_add hpair + exact (dist_triangle _ (expandingPicard a b k L T ha hk hL hT F v₀ v) _).trans + (add_le_add hinit (by simpa only [dist_comm] using hε)) + _ = _ := by ring + apply (le_div_iff₀ (by linarith : 0 < 1 - T * K)).mpr + nlinarith + +/-- The short-time stability constant for the actual odd-power equation is +independent of the starting scale. -/ +theorem exists_expandingNonlinear_residual_stability (a b k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) (R : ℝ) (hR : 0 ≤ R) : + ∃ K : ℝ, 0 ≤ K ∧ ∀ (L T : ℝ) (hL : 1 ≤ L) (hT : 0 ≤ T), T * K < 1 → + ∀ (u v : C(Icc (0 : ℝ) T, FourierL2)), + (∀ t, ‖u t‖ ≤ R) → (∀ t, ‖v t‖ ≤ R) → ∀ (u₀ v₀ : FourierL2) (ε : ℝ), + u = expandingPicard a b k L T ha hk hL hT + (expandingNonlinearReaction a k L T ha ha1 hk hL m) u₀ u → + dist v (expandingPicard a b k L T ha hk hL hT + (expandingNonlinearReaction a k L T ha ha1 hk hL m) v₀ v) ≤ ε → + dist u v ≤ (dist u₀ v₀ + ε) / (1 - T * K) := by + obtain ⟨K, hK, hb⟩ := exists_expandingOddPower_lipschitz_on_ball a k ha ha1 hk m R hR + refine ⟨K, hK, ?_⟩ + intro L T hL hT hTK u v huR hvR u₀ v₀ ε hu hv + apply expandingMild_residual_stability a b k L T ha hk hL hT _ u₀ v₀ K hK hTK u v + _ hu ε hv + intro t + change ‖(-Complex.I) • expandingOddPower a k (expandingRadiusCurve L T hL t).1 + ha ha1 hk (expandingRadiusCurve L T hL t).2 m (u t) - + (-Complex.I) • expandingOddPower a k (expandingRadiusCurve L T hL t).1 + ha ha1 hk (expandingRadiusCurve L T hL t).2 m (v t)‖ ≤ _ + rw [← smul_sub, norm_smul] + simp only [norm_neg, Complex.norm_I, one_mul] + exact hb _ (expandingRadiusCurve L T hL t).2 _ _ (huR t) (hvR t) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSampleDerivativeFormula.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSampleDerivativeFormula.lean new file mode 100644 index 0000000000000000000000000000000000000000..17cc5538071931a5c36b8565f99a05ea7c94e7ca --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSampleDerivativeFormula.lean @@ -0,0 +1,38 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProductDerivativeFormula +import OAI.MathematicalPhysics.DefocusingNLS.Linear.SchwartzPartialKernel +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingSmoothCutoff + +namespace OAI + +/-! # The product rule for the actual sampled coefficient and smooth cutoff -/ + +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem expandingSample_low_derivative_formula (a L R : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < (N : ℝ)) (hL : 1 ≤ L) (hR : 0 < R) + (j : Fin N → Fin 12) (K : 𝓢(E, ℂ)) (f : FourierL2) : + expandingOrderedFourierEnergy a L N hL j + (expandingProduct a N L ha ha1 hN hL + (schwartzTorusSample a N L ha1 hN hL (radianFourierKernel K)) (expandingSmoothLow L R hR f)) = + ∑ s : Finset (Fin N), expandingPhysicalMassVector a N L ha ha1 hN hL + (expandingProduct a N L ha ha1 hN hL + (schwartzTorusSample a N L ha1 hN hL + (radianFourierKernel (schwartzPartialDerivative N j s K))) + (expandingSchwartzFilter L (partialFilterKernel R hR N j sᶜ) f)) := by + apply expandingProduct_derivative_formula a L N ha ha1 hN hL j + · intro s n + rw [schwartzTorusSample_coefficient, schwartzTorusSample_coefficient] + simp only [schwartzLatticeCoefficient, schwartzPartialDerivative_fourier] + ring + · intro s n + simp only [expandingFourierCoefficient, expandingSchwartzFilter_apply, + expandingSmoothLow_apply, partialFilterKernel_fourier] + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingScaleTransfer.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingScaleTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..d3b4f7e117617c0e808022311a8c17945be5621d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingScaleTransfer.lean @@ -0,0 +1,184 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingEvaluation + +namespace OAI + +/-! # Canonical transfer between expanding-torus norms + +The transfer keeps the physical Fourier coefficients in normalized coordinates +and has the exact growth bound `(M / L)^a` when `1 ≤ L ≤ M`. +-/ + +open scoped ENNReal + +namespace DefocusingNLS + +theorem expandingSobolevWeightSq_scale_le (a k L M : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hLM : L ≤ M) (n : frequencyLattice) : + expandingSobolevWeightSq a k M n ≤ + (M / L) ^ (2 * a) * expandingSobolevWeightSq a k L n := by + have hLp : 0 < L := by linarith + have hMp : 0 < M := by linarith + have hR : 1 ≤ M / L := (le_div_iff₀ hLp).mpr (by simpa using hLM) + have hRpow : 1 ≤ (M / L) ^ (2 * a) := Real.one_le_rpow hR (by positivity) + have hlo : M ^ (2 * a) = (M / L) ^ (2 * a) * L ^ (2 * a) := by + rw [Real.div_rpow hMp.le hLp.le] + exact (div_mul_cancel₀ _ (Real.rpow_pos_of_pos hLp _).ne').symm + have hhi : M ^ (12 - 2 * k) ≤ L ^ (12 - 2 * k) := + Real.rpow_le_rpow_of_nonpos hLp hLM (by linarith) + unfold expandingSobolevWeightSq + rw [hlo, mul_add] + apply add_le_add + · exact le_of_eq (mul_assoc _ _ _) + · calc + _ ≤ L ^ (12 - 2 * k) * ‖n‖ ^ (2 * k) := + mul_le_mul_of_nonneg_right hhi (by positivity) + _ ≤ (M / L) ^ (2 * a) * (L ^ (12 - 2 * k) * ‖n‖ ^ (2 * k)) := + le_mul_of_one_le_left (by positivity) hRpow + +theorem expandingSobolevWeight_scale_le (a k L M : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hLM : L ≤ M) (n : frequencyLattice) : + expandingSobolevWeight a k M n ≤ (M / L) ^ a * expandingSobolevWeight a k L n := by + have hLp : 0 < L := by linarith + have hMp : 0 < M := by linarith + have hQp : 0 < M / L := div_pos hMp hLp + have hQ : ((M / L) ^ a) ^ 2 = (M / L) ^ (2 * a) := by + rw [← Real.rpow_natCast, ← Real.rpow_mul hQp.le] + congr 1 + ring + have h := Real.sqrt_le_sqrt (expandingSobolevWeightSq_scale_le a k L M ha hk hL hLM n) + rw [← hQ, Real.sqrt_mul (sq_nonneg _), Real.sqrt_sq (Real.rpow_nonneg hQp.le _)] at h + unfold expandingSobolevWeight + calc + _ ≤ (2 * Real.pi) ^ 6 * ((M / L) ^ a * Real.sqrt (expandingSobolevWeightSq a k L n)) := + mul_le_mul_of_nonneg_left h (by positivity) + _ = _ := by ring + +noncomputable def expandingScaleRatio (a k L M : ℝ) (n : frequencyLattice) : ℝ := + expandingSobolevWeight a k M n / expandingSobolevWeight a k L n + +theorem expandingScaleRatio_nonneg (a k L M : ℝ) + (hL : 1 ≤ L) (hLM : L ≤ M) (n : frequencyLattice) : + 0 ≤ expandingScaleRatio a k L M n := + (div_pos (expandingSobolevWeight_pos a k M (hL.trans hLM) n) + (expandingSobolevWeight_pos a k L hL n)).le + +theorem expandingScaleRatio_le (a k L M : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hLM : L ≤ M) (n : frequencyLattice) : + expandingScaleRatio a k L M n ≤ (M / L) ^ a := by + apply (div_le_iff₀ (expandingSobolevWeight_pos a k L hL n)).mpr + exact expandingSobolevWeight_scale_le a k L M ha hk hL hLM n + +noncomputable def expandingTransferVector (a k L M : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hLM : L ≤ M) (f : FourierL2) : FourierL2 := + ⟨fun n => (expandingScaleRatio a k L M n : ℂ) * f n, by + apply (lp.memℓp (((M / L) ^ a : ℝ) • f)).mono' + intro n + simp only [lp.coeFn_smul, Pi.smul_apply, norm_smul, Real.norm_eq_abs, norm_mul, + Complex.norm_real, abs_of_nonneg (expandingScaleRatio_nonneg a k L M hL hLM n)] + exact mul_le_mul_of_nonneg_right ((expandingScaleRatio_le a k L M ha hk hL hLM n).trans + (le_abs_self _)) + (norm_nonneg _)⟩ + +@[simp] theorem expandingTransferVector_apply (a k L M : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hLM : L ≤ M) + (f : FourierL2) (n : frequencyLattice) : + expandingTransferVector a k L M ha hk hL hLM f n = + (expandingScaleRatio a k L M n : ℂ) * f n := rfl + +theorem expandingTransferVector_norm_le (a k L M : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hLM : L ≤ M) (f : FourierL2) : + ‖expandingTransferVector a k L M ha hk hL hLM f‖ ≤ (M / L) ^ a * ‖f‖ := by + calc + _ ≤ ‖((M / L) ^ a : ℝ) • f‖ := by + apply lp.norm_mono (by norm_num : (2 : ℝ≥0∞) ≠ 0) + intro n + simp only [expandingTransferVector_apply, lp.coeFn_smul, Pi.smul_apply, + norm_smul, Real.norm_eq_abs, norm_mul, Complex.norm_real, + abs_of_nonneg (expandingScaleRatio_nonneg a k L M hL hLM n)] + exact mul_le_mul_of_nonneg_right ((expandingScaleRatio_le a k L M ha hk hL hLM n).trans + (le_abs_self _)) + (norm_nonneg _) + _ = _ := by + rw [norm_smul, Real.norm_eq_abs, + abs_of_nonneg (Real.rpow_nonneg (div_nonneg (by linarith) (by linarith)) a)] + +/-- Continuous complex-linear transfer with the physical coefficients fixed. -/ +noncomputable def expandingScaleTransfer (a k L M : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hLM : L ≤ M) : FourierL2 →L[ℂ] FourierL2 := + LinearMap.mkContinuous + { toFun := expandingTransferVector a k L M ha hk hL hLM + map_add' := by + intro f g + ext n + simp only [expandingTransferVector_apply, lp.coeFn_add, Pi.add_apply, mul_add] + map_smul' := by + intro c f + ext n + simp only [expandingTransferVector_apply, lp.coeFn_smul, Pi.smul_apply, smul_eq_mul, RingHom.id_apply] + ring } + ((M / L) ^ a) (expandingTransferVector_norm_le a k L M ha hk hL hLM) + +theorem expandingScaleTransfer_norm_le (a k L M : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hLM : L ≤ M) : + ‖expandingScaleTransfer a k L M ha hk hL hLM‖ ≤ (M / L) ^ a := by + apply ContinuousLinearMap.opNorm_le_bound _ + (Real.rpow_nonneg (div_nonneg (by linarith) (by linarith)) a) + exact expandingTransferVector_norm_le a k L M ha hk hL hLM + +theorem expandingScaleTransfer_coefficient (a k L M : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hLM : L ≤ M) + (f : FourierL2) (n : frequencyLattice) : + expandingFourierCoefficient a k M (expandingScaleTransfer a k L M ha hk hL hLM f) n = + expandingFourierCoefficient a k L f n := by + change (((expandingSobolevWeight a k M n)⁻¹ : ℝ) : ℂ) * + ((expandingScaleRatio a k L M n : ℂ) * f n) = _ + unfold expandingScaleRatio expandingFourierCoefficient + rw [Complex.ofReal_div, Complex.ofReal_inv, Complex.ofReal_inv] + have hM : (expandingSobolevWeight a k M n : ℂ) ≠ 0 := + Complex.ofReal_ne_zero.mpr (expandingSobolevWeight_pos a k M (hL.trans hLM) n).ne' + have hLn : (expandingSobolevWeight a k L n : ℂ) ≠ 0 := + Complex.ofReal_ne_zero.mpr (expandingSobolevWeight_pos a k L hL n).ne' + field_simp [hM, hLn] + +/-- Transfer represents the same function in normalized torus coordinates. -/ +theorem expandingScaleTransfer_function (a k L M : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hLM : L ≤ M) + (f : FourierL2) : + expandingTorusFunction a k M (expandingScaleTransfer a k L M ha hk hL hLM f) = + expandingTorusFunction a k L f := by + ext x + simp only [expandingTorusFunction_apply a k M ha ha1 hk (hL.trans hLM), + expandingTorusFunction_apply a k L ha ha1 hk hL, expandingScaleTransfer_coefficient] + +private theorem expandingCoefficient_injective (a k L : ℝ) (hL : 1 ≤ L) : + Function.Injective (expandingFourierCoefficient a k L) := by + intro f g h + ext n + have hn := congrFun h n + have he := congrArg (fun z : ℂ => (expandingSobolevWeight a k L n : ℂ) * z) hn + simpa only [weight_mul_expandingFourierCoefficient a k L hL] using he + +@[simp] theorem expandingScaleTransfer_self (a k L : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) : + expandingScaleTransfer a k L L ha hk hL le_rfl = ContinuousLinearMap.id ℂ FourierL2 := by + apply ContinuousLinearMap.ext + intro f + apply expandingCoefficient_injective a k L hL + funext n + exact expandingScaleTransfer_coefficient a k L L ha hk hL le_rfl f n + +/-- Canonical scale changes compose without an additional normalization. -/ +theorem expandingScaleTransfer_comp (a k L M N : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hLM : L ≤ M) (hMN : M ≤ N) : + (expandingScaleTransfer a k M N ha hk (hL.trans hLM) hMN).comp + (expandingScaleTransfer a k L M ha hk hL hLM) = + expandingScaleTransfer a k L N ha hk hL (hLM.trans hMN) := by + apply ContinuousLinearMap.ext + intro f + apply expandingCoefficient_injective a k N ((hL.trans hLM).trans hMN) + funext n + simp only [ContinuousLinearMap.comp_apply, expandingScaleTransfer_coefficient] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSequentialObservation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSequentialObservation.lean new file mode 100644 index 0000000000000000000000000000000000000000..13c3f2ed5ec1711ec100f589d063389e9b19429d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSequentialObservation.lean @@ -0,0 +1,54 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFilteredLimit +import Mathlib.Analysis.SpecificLimits.Basic + +namespace OAI + +/-! # A local observation threshold from the expanding-domain sequence criterion -/ + +open Filter Topology + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) +local notation "Radius" => {L : ℝ // 1 ≤ L} + +/-- A functional vanishing on all bounded, locally null sequences has a uniform +smallness threshold on a sufficiently large physical ball. -/ +theorem exists_expanding_observation_threshold (a k : ℝ) + (F : Radius → FourierL2 → ℝ) + (hseq : ∀ (L : ℕ → Radius), Tendsto (fun n => (L n).1) atTop atTop → + ∀ (f : ℕ → FourierL2), (∀ n, ‖f n‖ ≤ 1) → + (∀ R ε : ℝ, 0 < ε → ∀ᶠ n in atTop, ∀ y : E, ‖y‖ ≤ R → + ‖expandingTorusFunction a k (L n).1 (f n) + (euclideanToTorus ((L n).1⁻¹ • y))‖ < ε) → + Tendsto (fun n => F (L n) (f n)) atTop (𝓝 0)) + (ε : ℝ) (hε : 0 < ε) : + ∃ n : ℕ, ∀ (L : Radius), (n : ℝ) ≤ L.1 → ∀ f : FourierL2, + ‖f‖ ≤ 1 → + (∀ y : E, ‖y‖ ≤ (n : ℝ) → + ‖expandingTorusFunction a k L.1 f (euclideanToTorus (L.1⁻¹ • y))‖ ≤ + 1 / ((n : ℝ) + 1)) → F L f ≤ ε := by + classical + by_contra hn + push Not at hn + choose L hL f hf hlocal hbad using hn + have hLinf : Tendsto (fun n => (L n).1) atTop atTop := + tendsto_atTop_mono hL tendsto_natCast_atTop_atTop + have hnull : ∀ R δ : ℝ, 0 < δ → ∀ᶠ n in atTop, ∀ y : E, ‖y‖ ≤ R → + ‖expandingTorusFunction a k (L n).1 (f n) + (euclideanToTorus ((L n).1⁻¹ • y))‖ < δ := by + intro R δ hδ + have hr : ∀ᶠ n : ℕ in atTop, R ≤ (n : ℝ) := + tendsto_natCast_atTop_atTop.eventually (eventually_ge_atTop R) + have hd : ∀ᶠ n : ℕ in atTop, 1 / ((n : ℝ) + 1) < δ := + (tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ)).eventually (gt_mem_nhds hδ) + filter_upwards [hr, hd] with n hRn hdn + intro y hy + exact (hlocal n y (hy.trans hRn)).trans_lt hdn + have ht := hseq L hLinf f hf hnull + obtain ⟨n, hn⟩ := (ht.eventually (gt_mem_nhds hε)).exists + exact (hbad n).not_gt hn + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSlabMild.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSlabMild.lean new file mode 100644 index 0000000000000000000000000000000000000000..344adf690d72c608e7aec5645527ef1ff6c9d8b0 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSlabMild.lean @@ -0,0 +1,148 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.StableGraphSlabGluing +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingDuhamelRestart +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingGlobalTrajectory + +namespace OAI + +/-! # From adjacent mild equations to the global similarity equation + +The exact restart identity transports the actual forcing at each successive +radius. Consequently a continuous path satisfying the equation on every +equal slab satisfies the original mild equation on every finite interval. +-/ + +open Set Filter Topology MeasureTheory + +namespace DefocusingNLS + +attribute [local irreducible] expandingFreeStep + +@[simp] theorem expandingPicard_initial (a b k L T : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) (u₀ : FourierL2) + (u : C(Icc (0 : ℝ) T, FourierL2)) : + expandingPicard a b k L T ha hk hL hT F u₀ u ⟨0, le_rfl, hT⟩ = u₀ := by + change expandingFreeStep a b k L 0 ha hk hL le_rfl u₀ + + expandingDuhamel a b k L ha hk hL 0 _ = u₀ + rw [expandingFreeStep_zero] + simp [expandingDuhamel] + +theorem expandingDuhamel_congr_on (a b k L t : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (r q : ℝ → FourierL2) + (heq : EqOn r q (Icc 0 t)) : + expandingDuhamel a b k L ha hk hL t r = + expandingDuhamel a b k L ha hk hL t q := by + unfold expandingDuhamel + apply integral_congr_ae + filter_upwards [ae_restrict_mem measurableSet_Icc] with s hs + simp only [expandingDuhamelIntegrand_of_mem _ _ _ _ _ _ _ _ _ _ hs, heq hs] + +theorem expandingMild_global_of_local (a b k L M : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hM : 0 < M) + (u r : ℝ → FourierL2) (hr : ContinuousOn r (Ici 0)) + (hloc : ∀ (n : ℕ) (s : ℝ) (hs : s ∈ Icc 0 M), + u ((n : ℝ) * M + s) = + expandingFreeStep a b k (expandingRadius L ((n : ℝ) * M)) s ha hk + (hL.trans (expandingRadius_ge L _ hL (by positivity))) hs.1 + (u ((n : ℝ) * M)) + + expandingDuhamel a b k (expandingRadius L ((n : ℝ) * M)) ha hk + (hL.trans (expandingRadius_ge L _ hL (by positivity))) s + (fun τ => r ((n : ℝ) * M + τ))) + (t : ℝ) (ht : 0 ≤ t) : + u t = expandingFreeStep a b k L t ha hk hL ht (u 0) + + expandingDuhamel a b k L ha hk hL t r := by + have hgrid (n : ℕ) : + u ((n : ℝ) * M) = + expandingFreeStep a b k L ((n : ℝ) * M) ha hk hL (by positivity) (u 0) + + expandingDuhamel a b k L ha hk hL ((n : ℝ) * M) r := by + induction n with + | zero => + simp only [Nat.cast_zero, zero_mul, expandingFreeStep_zero, + ContinuousLinearMap.id_apply] + simp [expandingDuhamel] + | succ n ih => + have hn : 0 ≤ (n : ℝ) * M := by positivity + have hrestart := expandingMild_restart a b k L ((n : ℝ) * M) M + ha hk hL hn hM.le r (hr.mono (fun _ hx => hx.1)) (u 0) + have he := hloc n M ⟨hM.le, le_rfl⟩ + rw [ih] at he + have hresult := he.trans hrestart.symm + simpa only [Nat.cast_add, Nat.cast_one, add_mul, one_mul] using hresult + let n := ⌊t / M⌋₊ + let s := t - (n : ℝ) * M + have hn : 0 ≤ (n : ℝ) * M := by positivity + have hinterval := equalSlabInterval_floor M hM t ht + have hs : s ∈ Icc 0 M := by + constructor <;> dsimp [s, n] <;> linarith [hinterval.1, hinterval.2] + have he : (n : ℝ) * M + s = t := by dsimp [s]; ring + have hrestart := expandingMild_restart a b k L ((n : ℝ) * M) s ha hk hL hn hs.1 r + (hr.mono (fun _ hx => hx.1)) (u 0) + have hresult := hloc n s hs + rw [hgrid n] at hresult + simpa only [he] using hresult.trans hrestart.symm + +noncomputable def expandingGlobalReaction (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (m : ℕ) (u : ℝ → FourierL2) (t : ℝ) : FourierL2 := + (-Complex.I) • expandingOddPower a k (expandingRadius L (max 0 t)) ha ha1 hk + (hL.trans (expandingRadius_ge L _ hL (le_max_left _ _))) m (u t) + +theorem continuousOn_expandingGlobalReaction (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (m : ℕ) (u : ℝ → FourierL2) (hu : ContinuousOn u (Ici 0)) : + ContinuousOn (expandingGlobalReaction a k L ha ha1 hk hL m u) (Ici 0) := by + let R : ℝ → {R : ℝ // 1 ≤ R} := fun t => + ⟨expandingRadius L (max 0 t), + hL.trans (expandingRadius_ge L _ hL (le_max_left _ _))⟩ + have hR : Continuous R := by + apply Continuous.subtype_mk + unfold expandingRadius + fun_prop + exact ((continuous_expandingOddPower_scale a k ha ha1 hk m).comp_continuousOn + (hR.continuousOn.prodMk hu)).const_smul (-Complex.I) + +theorem expandingGlobalReaction_history (a k L S : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hS : 0 ≤ S) + (m : ℕ) (u : ℝ → FourierL2) (hu : ContinuousOn u (Ici 0)) + (t : ℝ) (ht : t ∈ Icc 0 S) : + expandingGlobalReaction a k L ha ha1 hk hL m u t = + expandingReactionHistory S hS + (expandingNonlinearReaction a k L S ha ha1 hk hL m) + (expandingSlabRestriction u hu S) t := by + simp only [expandingReactionHistory, projIcc_of_mem _ ht] + change (-Complex.I) • expandingOddPower a k (expandingRadius L (max 0 t)) + ha ha1 hk _ m (u t) = + (-Complex.I) • expandingOddPower a k (expandingRadius L t) ha ha1 hk _ m (u t) + simp only [max_eq_right ht.1] + +theorem expandingGlobal_picard_of_local (a b k L M : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hM : 0 < M) + (m : ℕ) (u : ℝ → FourierL2) (hu : ContinuousOn u (Ici 0)) + (hloc : ∀ (n : ℕ) (s : ℝ) (hs : s ∈ Icc 0 M), + u ((n : ℝ) * M + s) = + expandingFreeStep a b k (expandingRadius L ((n : ℝ) * M)) s ha hk + (hL.trans (expandingRadius_ge L _ hL (by positivity))) hs.1 + (u ((n : ℝ) * M)) + + expandingDuhamel a b k (expandingRadius L ((n : ℝ) * M)) ha hk + (hL.trans (expandingRadius_ge L _ hL (by positivity))) s + (fun τ => expandingGlobalReaction a k L ha ha1 hk hL m u ((n : ℝ) * M + τ))) + (S : ℝ) (hS : 0 < S) : + expandingSlabRestriction u hu S = + expandingPicard a b k L S ha hk hL hS.le + (expandingNonlinearReaction a k L S ha ha1 hk hL m) (u 0) + (expandingSlabRestriction u hu S) := by + apply ContinuousMap.ext + intro t + change u t = expandingFreeStep a b k L t ha hk hL t.2.1 (u 0) + _ + rw [expandingMild_global_of_local a b k L M ha hk hL hM u + (expandingGlobalReaction a k L ha ha1 hk hL m u) + (continuousOn_expandingGlobalReaction a k L ha ha1 hk hL m u hu) hloc t t.2.1] + congr 1 + apply expandingDuhamel_congr_on + intro τ hτ + exact expandingGlobalReaction_history a k L S ha ha1 hk hL hS.le m u hu τ + ⟨hτ.1, hτ.2.trans t.2.2⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSlabTrajectory.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSlabTrajectory.lean new file mode 100644 index 0000000000000000000000000000000000000000..a4ddab0cef1af37c597d900182348342fed7da32 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSlabTrajectory.lean @@ -0,0 +1,85 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingSlabMild + +namespace OAI + +/-! # Joining actual nonlinear similarity slabs + +The finite paths here solve the polynomial equation at the correctly +advanced radius. Their endpoint identity produces a global path solving +that same equation on every finite interval. +-/ + +open Set + +namespace DefocusingNLS + +attribute [local irreducible] expandingFreeStep gluedSlabPath + +theorem expandingGluedSlabs_local (a b k L M : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hM : 0 < M) + (m : ℕ) (W : ℕ → C(Icc (0 : ℝ) M, FourierL2)) + (hjoin : ∀ n, W n ⟨M, hM.le, le_rfl⟩ = W (n + 1) ⟨0, le_rfl, hM.le⟩) + (hsol : ∀ n, + W n = expandingPicard a b k (expandingRadius L ((n : ℝ) * M)) M ha hk + (hL.trans (expandingRadius_ge L _ hL (by positivity))) hM.le + (expandingNonlinearReaction a k (expandingRadius L ((n : ℝ) * M)) M ha ha1 hk + (hL.trans (expandingRadius_ge L _ hL (by positivity))) m) + (W n ⟨0, le_rfl, hM.le⟩) (W n)) + (n : ℕ) (s : ℝ) (hs : s ∈ Icc 0 M) : + let u := gluedSlabPath M hM W hjoin + u ((n : ℝ) * M + s) = + expandingFreeStep a b k (expandingRadius L ((n : ℝ) * M)) s ha hk + (hL.trans (expandingRadius_ge L _ hL (by positivity))) hs.1 + (u ((n : ℝ) * M)) + + expandingDuhamel a b k (expandingRadius L ((n : ℝ) * M)) ha hk + (hL.trans (expandingRadius_ge L _ hL (by positivity))) s + (fun τ => expandingGlobalReaction a k L ha ha1 hk hL m u ((n : ℝ) * M + τ)) := by + intro u + let Ln := expandingRadius L ((n : ℝ) * M) + have hLn : 1 ≤ Ln := hL.trans (expandingRadius_ge L _ hL (by positivity)) + let r := expandingReactionHistory M hM.le + (expandingNonlinearReaction a k Ln M ha ha1 hk hLn m) (W n) + have he := congrArg (fun f : C(Icc (0 : ℝ) M, FourierL2) => f ⟨s, hs⟩) (hsol n) + change W n ⟨s, hs⟩ = expandingFreeStep a b k Ln s ha hk hLn hs.1 + (W n ⟨0, le_rfl, hM.le⟩) + expandingDuhamel a b k Ln ha hk hLn s r at he + have hzero : u ((n : ℝ) * M) = W n ⟨0, le_rfl, hM.le⟩ := by + simpa only [add_zero] using gluedSlabPath_at M hM W hjoin n ⟨0, le_rfl, hM.le⟩ + rw [show u ((n : ℝ) * M + s) = W n ⟨s, hs⟩ from + gluedSlabPath_at M hM W hjoin n ⟨s, hs⟩, hzero, he] + congr 1 + apply expandingDuhamel_congr_on + intro τ hτ + have hτM : τ ∈ Icc 0 M := ⟨hτ.1, hτ.2.trans hs.2⟩ + have hpos : 0 ≤ (n : ℝ) * M + τ := add_nonneg (by positivity) hτ.1 + have huτ : u ((n : ℝ) * M + τ) = W n ⟨τ, hτM⟩ := + gluedSlabPath_at M hM W hjoin n ⟨τ, hτM⟩ + dsimp only [r, expandingReactionHistory] + rw [projIcc_of_mem _ hτM] + change (-Complex.I) • expandingOddPower a k (expandingRadius Ln τ) ha ha1 hk _ m + (W n ⟨τ, hτM⟩) = _ + simp only [expandingGlobalReaction, max_eq_right hpos, huτ] + simp only [Ln, expandingRadius_add] + +theorem expandingGluedSlabs_picard (a b k L M : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hM : 0 < M) + (m : ℕ) (W : ℕ → C(Icc (0 : ℝ) M, FourierL2)) + (hjoin : ∀ n, W n ⟨M, hM.le, le_rfl⟩ = W (n + 1) ⟨0, le_rfl, hM.le⟩) + (hsol : ∀ n, + W n = expandingPicard a b k (expandingRadius L ((n : ℝ) * M)) M ha hk + (hL.trans (expandingRadius_ge L _ hL (by positivity))) hM.le + (expandingNonlinearReaction a k (expandingRadius L ((n : ℝ) * M)) M ha ha1 hk + (hL.trans (expandingRadius_ge L _ hL (by positivity))) m) + (W n ⟨0, le_rfl, hM.le⟩) (W n)) + (S : ℝ) (hS : 0 < S) : + let u := gluedSlabPath M hM W hjoin + expandingSlabRestriction u (continuousOn_gluedSlabPath M hM W hjoin) S = + expandingPicard a b k L S ha hk hL hS.le + (expandingNonlinearReaction a k L S ha ha1 hk hL m) (u 0) + (expandingSlabRestriction u (continuousOn_gluedSlabPath M hM W hjoin) S) := by + exact expandingGlobal_picard_of_local a b k L M ha ha1 hk hL hM m _ + (continuousOn_gluedSlabPath M hM W hjoin) + (expandingGluedSlabs_local a b k L M ha ha1 hk hL hM m W hjoin hsol) S hS + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSmoothCutoff.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSmoothCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..f433b28ca32b8123d9c4204f9ce736c094a3b84c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSmoothCutoff.lean @@ -0,0 +1,85 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingSmoothFilter +import OAI.MathematicalPhysics.DefocusingNLS.Linear.SchwartzFrequencyCutoff +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFrequencyCutoff + +namespace OAI + +/-! # Smooth frequency splitting with the actual commutator remainder bound -/ + +open scoped SchwartzMap ENNReal + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +noncomputable def expandingSmoothLow (L R : ℝ) (hR : 0 < R) : FourierL2 →L[ℂ] FourierL2 := + fourierBoundedMultiplier 1 (by norm_num) + (fun n : frequencyLattice => smoothFrequencyCutoff R hR (L⁻¹ • (n : E))) + (fun _ => smoothFrequencyCutoff_norm_le R hR _) + +@[simp] theorem expandingSmoothLow_apply (L R : ℝ) (hR : 0 < R) + (f : FourierL2) (n : frequencyLattice) : + expandingSmoothLow L R hR f n = smoothFrequencyCutoff R hR (L⁻¹ • (n : E)) * f n := rfl + +noncomputable def expandingSmoothHigh (L R : ℝ) (hR : 0 < R) : FourierL2 →L[ℂ] FourierL2 := + ContinuousLinearMap.id ℂ FourierL2 - expandingSmoothLow L R hR + +@[simp] theorem expandingSmoothHigh_apply (L R : ℝ) (hR : 0 < R) + (f : FourierL2) (n : frequencyLattice) : + expandingSmoothHigh L R hR f n = + (1 - smoothFrequencyCutoff R hR (L⁻¹ • (n : E))) * f n := by + change f n - smoothFrequencyCutoff R hR (L⁻¹ • (n : E)) * f n = _ + ring + +theorem expandingSmoothHigh_norm_le (L R : ℝ) (hR : 0 < R) (f : FourierL2) : + ‖expandingSmoothHigh L R hR f‖ ≤ ‖f‖ := by + apply lp.norm_mono (by norm_num : (2 : ℝ≥0∞) ≠ 0) + intro n + rw [expandingSmoothHigh_apply, norm_mul] + exact mul_le_of_le_one_left (norm_nonneg _) (one_sub_smoothFrequencyCutoff_norm_le R hR _) + +theorem expandingSmoothHigh_low_zero (L R : ℝ) (hL : 0 < L) (hR : 0 < R) + (f : FourierL2) (n : frequencyLattice) (hn : ‖n‖ < R * L) : + expandingSmoothHigh L R hR f n = 0 := by + rw [expandingSmoothHigh_apply, smoothFrequencyCutoff_one] + · ring + · rw [norm_smul, Real.norm_eq_abs, abs_of_pos (inv_pos.mpr hL), Submodule.norm_coe] + have hh : ‖n‖ / L ≤ R := (div_le_iff₀ hL).mpr hn.le + simpa only [div_eq_mul_inv, mul_comm] using hh + +theorem expandingSmoothLow_eq_convolution (L R : ℝ) (hR : 0 < R) : + expandingSmoothLow L R hR = + expandingSchwartzFilter L (radianInverseKernel (smoothFrequencyCutoff R hR)) := by + ext f n + rw [expandingSmoothLow_apply, expandingSchwartzFilter_apply, radianFourierKernel_inverseKernel] + +theorem exists_torusOddCommutator_smooth_remainder (a : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hN : 8 < ((N + 1 : ℕ) : ℝ)) + (m : ℕ) (K : 𝓢(E, ℂ)) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ (L R : ℝ) (hL : 1 ≤ L) (hR : 1 ≤ R), + let q := schwartzTorusSample a (N + 1 : ℕ) L ha1 hN hL K + ∀ (M : ℝ) (hM : 0 ≤ M) + (hQB : ∀ x : UnitAddTorus (Fin 12), ‖expandingUnitTorusFunction a (N + 1 : ℕ) L q x‖ ^ (2 * m) ≤ M) + (f : FourierL2) (j : Fin (N + 1) → Fin 12), + ‖expandingOrderedCommutator a L (N + 1) ha ha1 hN hL m q M hM hQB j f - + expandingOrderedCommutator a L (N + 1) ha ha1 hN hL m q M hM hQB j + (expandingSmoothLow L R (by linarith) f)‖ ≤ (C / R) * ‖f‖ := by + obtain ⟨C, hC, hc⟩ := exists_torusOddCommutator_high_bound a N ha ha1 hN m K + refine ⟨C, hC, ?_⟩ + intro L R hL hR q M hM hQB f j + have hp : 0 < R := by linarith + have hh := hc L R hL hR M hM hQB (expandingSmoothHigh L R hp f) j + (expandingSmoothHigh_low_zero L R (by linarith) hp f) + have he : f = expandingSmoothLow L R hp f + expandingSmoothHigh L R hp f := by + change f = expandingSmoothLow L R hp f + (f - expandingSmoothLow L R hp f) + abel + have hmap := congrArg + (expandingOrderedCommutator a L (N + 1) ha ha1 hN hL m q M hM hQB j) he + rw [map_add] at hmap + rw [hmap, add_sub_cancel_left] + exact hh.trans (mul_le_mul_of_nonneg_left (expandingSmoothHigh_norm_le L R hp f) + (div_nonneg hC (by linarith))) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSmoothFilter.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSmoothFilter.lean new file mode 100644 index 0000000000000000000000000000000000000000..016aee1498697eceff009338c243e98490d587e6 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSmoothFilter.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.FourierBoundedMultiplier +import OAI.MathematicalPhysics.DefocusingNLS.Linear.SchwartzFourierConvolution +import OAI.MathematicalPhysics.DefocusingNLS.Linear.SchwartzLocalConvolution + +namespace OAI + +/-! # Schwartz convolution is the exact smooth Fourier filter on expanding tori -/ + +open MeasureTheory +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +noncomputable def expandingPhysicalContinuous (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) : C(E, ℂ) where + toFun y := spatialFourierSeries (expandingFourierCoefficient a k L f) (L⁻¹ • y) + continuous_toFun := (continuous_spatialFourierSeries _ + (summable_norm_expandingFourierCoefficient a k L ha ha1 hk hL f)).comp + (continuous_const_smul L⁻¹) + +theorem expandingPhysicalContinuous_apply (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) (y : E) : + expandingPhysicalContinuous a k L ha ha1 hk hL f y = + expandingTorusFunction a k L f (euclideanToTorus (L⁻¹ • y)) := by + rw [expandingTorusFunction_apply a k L ha ha1 hk hL] + simp only [expandingPhysicalContinuous, ContinuousMap.coe_mk, spatialFourierSeries, + torusCharacter_euclidean] + +theorem expandingPhysicalContinuous_norm_le (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) (y : E) : + ‖expandingPhysicalContinuous a k L ha ha1 hk hL f y‖ ≤ expandingEmbeddingBound a k * ‖f‖ := by + rw [expandingPhysicalContinuous_apply] + exact expandingTorusFunction_point_bound a k L ha ha1 hk hL f _ + +noncomputable def expandingSchwartzFilter (L : ℝ) (K : 𝓢(E, ℂ)) : FourierL2 →L[ℂ] FourierL2 := + fourierBoundedMultiplier (∫ z : E, ‖K z‖) (integral_nonneg (fun _ => norm_nonneg _)) + (fun n : frequencyLattice => radianFourierKernel K (L⁻¹ • (n : E))) + (fun _ => radianFourierKernel_norm_le_integral K _) + +@[simp] theorem expandingSchwartzFilter_apply (L : ℝ) (K : 𝓢(E, ℂ)) + (f : FourierL2) (n : frequencyLattice) : + expandingSchwartzFilter L K f n = radianFourierKernel K (L⁻¹ • (n : E)) * f n := rfl + +theorem expandingSchwartzFilter_physical (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (K : 𝓢(E, ℂ)) (f : FourierL2) (y : E) : + expandingPhysicalContinuous a k L ha ha1 hk hL (expandingSchwartzFilter L K f) y = + ∫ z : E, K z * expandingPhysicalContinuous a k L ha ha1 hk hL f (y - z) := by + change spatialFourierSeries (expandingFourierCoefficient a k L (expandingSchwartzFilter L K f)) + (L⁻¹ • y) = _ + have he : expandingFourierCoefficient a k L (expandingSchwartzFilter L K f) = + fun n : frequencyLattice => radianFourierKernel K (L⁻¹ • (n : E)) * + expandingFourierCoefficient a k L f n := by + funext n + exact expandingFourierCoefficient_multiplier a k L _ _ _ _ f n + rw [he] + exact schwartzFourierConvolution_eq L K _ + (summable_norm_expandingFourierCoefficient a k L ha ha1 hk hL f) y + +theorem expandingSchwartzFilter_ball (a k L R : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (K : 𝓢(E, ℂ)) (f : FourierL2) (y : Metric.closedBall (0 : E) R) : + expandingPhysicalContinuous a k L ha ha1 hk hL (expandingSchwartzFilter L K f) y = + schwartzBallConvolution R K (expandingPhysicalContinuous a k L ha ha1 hk hL f) y := by + rw [expandingSchwartzFilter_physical, schwartzBallConvolution_apply R + (expandingEmbeddingBound a k * ‖f‖) (by unfold expandingEmbeddingBound; positivity)] + exact expandingPhysicalContinuous_norm_le a k L ha ha1 hk hL f + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSobolevComparison.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSobolevComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..c399bb9c66c3d1d4c75034a8796fe03cb810bc26 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSobolevComparison.lean @@ -0,0 +1,78 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingWeightIdentification + +namespace OAI + +/-! # The fixed expanding norm is equivalent to the usual Sobolev norm + +The weight comparison at radius one identifies the expanding-space +solution with the standard Sobolev flow. +-/ + +namespace DefocusingNLS + +theorem expandingSobolevWeightSq_one_le_standard (a k : ℝ) + (ha : 0 < a) (hk : 8 < k) (n : frequencyLattice) : + expandingSobolevWeightSq a k 1 n ≤ 2 * (1 + ‖n‖ ^ 2) ^ k := by + have hpow : ‖n‖ ^ (2 * k) = (‖n‖ ^ 2) ^ k := by + simpa using Real.rpow_natCast_mul (norm_nonneg n) 2 k + have hlo : (1 + ‖n‖ ^ 2) ^ (6 - a) ≤ (1 + ‖n‖ ^ 2) ^ k := + Real.rpow_le_rpow_of_exponent_le (by nlinarith [sq_nonneg ‖n‖]) (by linarith) + have hhi : (‖n‖ ^ 2) ^ k ≤ (1 + ‖n‖ ^ 2) ^ k := + Real.rpow_le_rpow (sq_nonneg _) (by linarith) (by linarith) + simp only [expandingSobolevWeightSq, Real.one_rpow, one_mul, hpow] + linarith + +theorem standard_le_expandingSobolevWeightSq_one (a k : ℝ) + (ha1 : a < 1) (hk : 8 < k) (n : frequencyLattice) : + (1 + ‖n‖ ^ 2) ^ k ≤ 2 ^ k * expandingSobolevWeightSq a k 1 n := by + have hpow : ‖n‖ ^ (2 * k) = (‖n‖ ^ 2) ^ k := by + simpa using Real.rpow_natCast_mul (norm_nonneg n) 2 k + have hnonneg : 0 ≤ (1 + ‖n‖ ^ 2) ^ (6 - a) := by positivity + simp only [expandingSobolevWeightSq, Real.one_rpow, one_mul, hpow] + by_cases hn : ‖n‖ ≤ 1 + · have hn2 : ‖n‖ ^ 2 ≤ 1 := by nlinarith [norm_nonneg n] + have hstd : (1 + ‖n‖ ^ 2) ^ k ≤ (2 : ℝ) ^ k := + Real.rpow_le_rpow (by positivity) (by linarith) (by linarith) + have hlo : 1 ≤ (1 + ‖n‖ ^ 2) ^ (6 - a) := + Real.one_le_rpow (by nlinarith [sq_nonneg ‖n‖]) (by linarith) + exact hstd.trans (le_mul_of_one_le_right (by positivity) + (hlo.trans (le_add_of_nonneg_right (by positivity)))) + · have hn2 : 1 ≤ ‖n‖ ^ 2 := by nlinarith [norm_nonneg n] + calc + (1 + ‖n‖ ^ 2) ^ k ≤ (2 * ‖n‖ ^ 2) ^ k := + Real.rpow_le_rpow (by positivity) (by linarith) (by linarith) + _ = 2 ^ k * (‖n‖ ^ 2) ^ k := Real.mul_rpow (by norm_num) (sq_nonneg _) + _ ≤ 2 ^ k * ((1 + ‖n‖ ^ 2) ^ (6 - a) + (‖n‖ ^ 2) ^ k) := + mul_le_mul_of_nonneg_left (le_add_of_nonneg_left hnonneg) (by positivity) + +private theorem sqrt_standard_power (k : ℝ) (n : frequencyLattice) : + Real.sqrt ((1 + ‖n‖ ^ 2) ^ k) = (1 + ‖n‖ ^ 2) ^ (k / 2) := by + rw [Real.sqrt_eq_rpow, ← Real.rpow_mul (by positivity)] + congr 1 + ring + +theorem expandingSobolevWeight_one_le_standard (a k : ℝ) + (ha : 0 < a) (hk : 8 < k) (n : frequencyLattice) : + expandingSobolevWeight a k 1 n ≤ + ((2 * Real.pi) ^ 6 * Real.sqrt 2) * (1 + ‖n‖ ^ 2) ^ (k / 2) := by + have h := Real.sqrt_le_sqrt (expandingSobolevWeightSq_one_le_standard a k ha hk n) + rw [Real.sqrt_mul (by norm_num : (0 : ℝ) ≤ 2), sqrt_standard_power] at h + exact (mul_le_mul_of_nonneg_left h (by positivity)).trans_eq (by + ring) + +theorem standard_le_expandingSobolevWeight_one (a k : ℝ) + (ha1 : a < 1) (hk : 8 < k) (n : frequencyLattice) : + (1 + ‖n‖ ^ 2) ^ (k / 2) ≤ + ((2 * Real.pi) ^ 6)⁻¹ * Real.sqrt (2 ^ k) * expandingSobolevWeight a k 1 n := by + have h := Real.sqrt_le_sqrt (standard_le_expandingSobolevWeightSq_one a k ha1 hk n) + rw [sqrt_standard_power, Real.sqrt_mul (by positivity)] at h + calc + _ ≤ Real.sqrt (2 ^ k) * Real.sqrt (expandingSobolevWeightSq a k 1 n) := h + _ = _ := by + unfold expandingSobolevWeight + have hp : (2 * Real.pi) ^ 6 ≠ 0 := by positivity + field_simp + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSobolevEquiv.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSobolevEquiv.lean new file mode 100644 index 0000000000000000000000000000000000000000..16b2daf0bd8a3e15fa2ec19f914d88d81c40f6f8 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSobolevEquiv.lean @@ -0,0 +1,148 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingSobolevComparison + +namespace OAI + +/-! # Coefficient-preserving identification of fixed expanding and Sobolev norms -/ + +open scoped ENNReal + +namespace DefocusingNLS + +private noncomputable def boundedRealDiagonalVector (c : ℝ) (hc : 0 ≤ c) + (w : frequencyLattice → ℝ) (hw : ∀ n, 0 ≤ w n ∧ w n ≤ c) (f : FourierL2) : FourierL2 := + ⟨fun n => (w n : ℂ) * f n, by + apply (lp.memℓp (c • f)).mono' + intro n + simp only [lp.coeFn_smul, Pi.smul_apply, norm_smul, Real.norm_eq_abs, + norm_mul, Complex.norm_real, abs_of_nonneg (hw n).1, abs_of_nonneg hc] + exact mul_le_mul_of_nonneg_right (hw n).2 (norm_nonneg _)⟩ + +private theorem boundedRealDiagonalVector_norm_le (c : ℝ) (hc : 0 ≤ c) + (w : frequencyLattice → ℝ) (hw : ∀ n, 0 ≤ w n ∧ w n ≤ c) (f : FourierL2) : + ‖boundedRealDiagonalVector c hc w hw f‖ ≤ c * ‖f‖ := by + calc + _ ≤ ‖c • f‖ := by + apply lp.norm_mono (by norm_num : (2 : ℝ≥0∞) ≠ 0) + intro n + change ‖(w n : ℂ) * f n‖ ≤ ‖c • f n‖ + rw [norm_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (hw n).1, + norm_smul, Real.norm_eq_abs, abs_of_nonneg hc] + exact mul_le_mul_of_nonneg_right (hw n).2 (norm_nonneg _) + _ = _ := by rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg hc] + +private noncomputable def boundedRealDiagonal (c : ℝ) (hc : 0 ≤ c) + (w : frequencyLattice → ℝ) (hw : ∀ n, 0 ≤ w n ∧ w n ≤ c) : FourierL2 →L[ℂ] FourierL2 := + LinearMap.mkContinuous + { toFun := boundedRealDiagonalVector c hc w hw + map_add' := by + intro f g + ext n + change (w n : ℂ) * (f n + g n) = (w n : ℂ) * f n + (w n : ℂ) * g n + ring + map_smul' := by + intro z f + ext n + change (w n : ℂ) * (z * f n) = z * ((w n : ℂ) * f n) + ring } + c (boundedRealDiagonalVector_norm_le c hc w hw) + +noncomputable def standardSobolevWeight (k : ℝ) (n : frequencyLattice) : ℝ := + (1 + ‖n‖ ^ 2) ^ (k / 2) + +theorem standardSobolevWeight_pos (k : ℝ) (n : frequencyLattice) : + 0 < standardSobolevWeight k n := Real.rpow_pos_of_pos (by positivity) _ + +noncomputable def expandingToSobolevRatio (a k : ℝ) (n : frequencyLattice) : ℝ := + standardSobolevWeight k n / expandingSobolevWeight a k 1 n + +noncomputable def sobolevToExpandingRatio (a k : ℝ) (n : frequencyLattice) : ℝ := + expandingSobolevWeight a k 1 n / standardSobolevWeight k n + +private theorem expandingToSobolevRatio_bounds (a k : ℝ) (ha1 : a < 1) (hk : 8 < k) + (n : frequencyLattice) : + 0 ≤ expandingToSobolevRatio a k n ∧ + expandingToSobolevRatio a k n ≤ ((2 * Real.pi) ^ 6)⁻¹ * Real.sqrt (2 ^ k) := by + constructor + · exact (div_pos (standardSobolevWeight_pos k n) + (expandingSobolevWeight_pos a k 1 le_rfl n)).le + · apply (div_le_iff₀ (expandingSobolevWeight_pos a k 1 le_rfl n)).mpr + exact standard_le_expandingSobolevWeight_one a k ha1 hk n + +private theorem sobolevToExpandingRatio_bounds (a k : ℝ) (ha : 0 < a) (hk : 8 < k) + (n : frequencyLattice) : + 0 ≤ sobolevToExpandingRatio a k n ∧ + sobolevToExpandingRatio a k n ≤ (2 * Real.pi) ^ 6 * Real.sqrt 2 := by + constructor + · exact (div_pos (expandingSobolevWeight_pos a k 1 le_rfl n) + (standardSobolevWeight_pos k n)).le + · apply (div_le_iff₀ (standardSobolevWeight_pos k n)).mpr + exact expandingSobolevWeight_one_le_standard a k ha hk n + +/-- The physical Fourier coefficients are unchanged; only their weights change. -/ +noncomputable def expandingToSobolev (a k : ℝ) (ha1 : a < 1) (hk : 8 < k) : + FourierL2 →L[ℂ] FourierL2 := + boundedRealDiagonal (((2 * Real.pi) ^ 6)⁻¹ * Real.sqrt (2 ^ k)) (by positivity) + (expandingToSobolevRatio a k) (expandingToSobolevRatio_bounds a k ha1 hk) + +noncomputable def sobolevToExpanding (a k : ℝ) (ha : 0 < a) (hk : 8 < k) : + FourierL2 →L[ℂ] FourierL2 := + boundedRealDiagonal ((2 * Real.pi) ^ 6 * Real.sqrt 2) (by positivity) + (sobolevToExpandingRatio a k) (sobolevToExpandingRatio_bounds a k ha hk) + +@[simp] theorem expandingToSobolev_apply (a k : ℝ) (ha1 : a < 1) (hk : 8 < k) + (f : FourierL2) (n : frequencyLattice) : + expandingToSobolev a k ha1 hk f n = (expandingToSobolevRatio a k n : ℂ) * f n := rfl + +@[simp] theorem sobolevToExpanding_apply (a k : ℝ) (ha : 0 < a) (hk : 8 < k) + (f : FourierL2) (n : frequencyLattice) : + sobolevToExpanding a k ha hk f n = (sobolevToExpandingRatio a k n : ℂ) * f n := rfl + +theorem sobolevToExpanding_expandingToSobolev (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (f : FourierL2) : + sobolevToExpanding a k ha hk (expandingToSobolev a k ha1 hk f) = f := by + ext n + simp only [sobolevToExpanding_apply, expandingToSobolev_apply, + sobolevToExpandingRatio, expandingToSobolevRatio, Complex.ofReal_div] + have hs : (standardSobolevWeight k n : ℂ) ≠ 0 := + Complex.ofReal_ne_zero.mpr (standardSobolevWeight_pos k n).ne' + have he : (expandingSobolevWeight a k 1 n : ℂ) ≠ 0 := + Complex.ofReal_ne_zero.mpr (expandingSobolevWeight_pos a k 1 le_rfl n).ne' + field_simp + +theorem expandingToSobolev_sobolevToExpanding (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (f : FourierL2) : + expandingToSobolev a k ha1 hk (sobolevToExpanding a k ha hk f) = f := by + ext n + simp only [sobolevToExpanding_apply, expandingToSobolev_apply, + sobolevToExpandingRatio, expandingToSobolevRatio, Complex.ofReal_div] + have hs : (standardSobolevWeight k n : ℂ) ≠ 0 := + Complex.ofReal_ne_zero.mpr (standardSobolevWeight_pos k n).ne' + have he : (expandingSobolevWeight a k 1 n : ℂ) ≠ 0 := + Complex.ofReal_ne_zero.mpr (expandingSobolevWeight_pos a k 1 le_rfl n).ne' + field_simp + +noncomputable def expandingSobolevEquiv (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) : FourierL2 ≃L[ℂ] FourierL2 where + toLinearEquiv := + { toLinearMap := (expandingToSobolev a k ha1 hk).toLinearMap + invFun := sobolevToExpanding a k ha hk + left_inv := sobolevToExpanding_expandingToSobolev a k ha ha1 hk + right_inv := expandingToSobolev_sobolevToExpanding a k ha ha1 hk } + continuous_toFun := (expandingToSobolev a k ha1 hk).continuous + continuous_invFun := (sobolevToExpanding a k ha hk).continuous + +theorem expandingToSobolev_coefficient (a k : ℝ) (ha1 : a < 1) (hk : 8 < k) + (f : FourierL2) (n : frequencyLattice) : + sobolevFourierCoefficient k (expandingToSobolev a k ha1 hk f) n = + expandingFourierCoefficient a k 1 f n := by + have hp := (standardSobolevWeight_pos k n).ne' + have hw : (1 + ‖n‖ ^ 2) ^ (-k / 2) = (standardSobolevWeight k n)⁻¹ := by + rw [standardSobolevWeight, show -k / 2 = -(k / 2) by ring, Real.rpow_neg (by positivity)] + simp only [sobolevFourierCoefficient, expandingToSobolev_apply, hw, Complex.real_smul, + expandingToSobolevRatio, expandingFourierCoefficient, Complex.ofReal_div, Complex.ofReal_inv] + have hc : (standardSobolevWeight k n : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr hp + field_simp + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSobolevNonlinearity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSobolevNonlinearity.lean new file mode 100644 index 0000000000000000000000000000000000000000..96524678a0bd081c67920c59cd59aea6a2825f1a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSobolevNonlinearity.lean @@ -0,0 +1,89 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingSobolevEquiv +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingNonlinearity +import OAI.MathematicalPhysics.DefocusingNLS.Linear.SchrodingerGenerator + +namespace OAI + +/-! # The fixed-weight identification preserves the actual nonlinearity + +Both models represent the same Fourier coefficients. Consequently the change +of norm intertwines multiplication, conjugation and the Schrödinger generator. +-/ + +open scoped ComplexConjugate + +namespace DefocusingNLS + +private theorem coefficient_injective (k : ℝ) : + Function.Injective (sobolevFourierCoefficient k) := by + intro f g h + ext n + calc + f n = (sobolevProductWeight k n : ℂ) * sobolevFourierCoefficient k f n := + (weight_mul_sobolevFourierCoefficient k f n).symm + _ = (sobolevProductWeight k n : ℂ) * sobolevFourierCoefficient k g n := by rw [h] + _ = g n := weight_mul_sobolevFourierCoefficient k g n + +theorem expandingToSobolev_product (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (f g : FourierL2) : + expandingToSobolev a k ha1 hk (expandingProduct a k 1 ha ha1 hk le_rfl f g) = + sobolevProduct k (by linarith) (expandingToSobolev a k ha1 hk f) + (expandingToSobolev a k ha1 hk g) := by + apply coefficient_injective k + funext n + rw [expandingToSobolev_coefficient, expandingProduct_coefficient, + sobolevProduct_coefficient] + unfold expandingProductCoefficient sobolevProductCoefficient + apply tsum_congr + intro j + rw [expandingToSobolev_coefficient, expandingToSobolev_coefficient] + +theorem expandingToSobolev_conjugate (a k : ℝ) + (ha1 : a < 1) (hk : 8 < k) (f : FourierL2) : + expandingToSobolev a k ha1 hk (fourierConjugate f) = + fourierConjugate (expandingToSobolev a k ha1 hk f) := by + apply coefficient_injective k + funext n + rw [expandingToSobolev_coefficient, expandingFourierCoefficient_conjugate, + sobolevFourierCoefficient_conjugate, expandingToSobolev_coefficient] + +theorem expandingToSobolev_oddPower (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) (f : FourierL2) : + expandingToSobolev a k ha1 hk (expandingOddPower a k 1 ha ha1 hk le_rfl m f) = + sobolevOddPower k (by linarith) m (expandingToSobolev a k ha1 hk f) := by + induction m with + | zero => rfl + | succ m ih => + simp only [expandingOddPower, sobolevOddPower, expandingToSobolev_product, + expandingToSobolev_conjugate, ih] + +theorem expandingToSobolev_lowerInclusion (a k : ℝ) + (ha1 : a < 1) (hk : 8 < k) (f : FourierL2) : + expandingToSobolev a k ha1 hk (lowerSobolevInclusion f) = + lowerSobolevInclusion (expandingToSobolev a k ha1 hk f) := by + ext n + simp only [expandingToSobolev_apply, lowerSobolevInclusion_apply] + ring + +theorem expandingToSobolev_lowerGenerator (a k : ℝ) + (ha1 : a < 1) (hk : 8 < k) (f : FourierL2) : + expandingToSobolev a k ha1 hk (lowerSobolevGenerator f) = + lowerSobolevGenerator (expandingToSobolev a k ha1 hk f) := by + ext n + simp only [expandingToSobolev_apply, lowerSobolevGenerator_apply] + ring + +theorem sobolevTorusFunction_expandingToSobolev (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (f : FourierL2) + (x : SchrodingerTorus) : + sobolevTorusFunction k (expandingToSobolev a k ha1 hk f) x = + expandingTorusFunction a k 1 f x := by + rw [sobolevTorusFunction_eq_tsum k (by linarith), + expandingTorusFunction_apply a k 1 ha ha1 hk le_rfl] + apply tsum_congr + intro n + rw [expandingToSobolev_coefficient] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSobolevStrong.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSobolevStrong.lean new file mode 100644 index 0000000000000000000000000000000000000000..03c4551c865c13a242d94d1a8c1d7b13fa6c5b88 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSobolevStrong.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingSobolevNonlinearity +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingNonlinearStrong + +namespace OAI + +/-! # The nonlinear moving-scale trajectory in the standard Sobolev space -/ + +open Set + +namespace DefocusingNLS + +/-- Changing the fixed Fourier weight preserves the reduced strong equation. -/ +theorem hasDerivAt_expandingSobolev_reduced (a b k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (m : ℕ) (w : ℝ → FourierL2) (t : ℝ) + (hw : HasDerivAt (fun s => lowerSobolevInclusion (w s)) + ((-(a : ℂ) + Complex.I * b) • lowerSobolevInclusion (w t) + + (L ^ (-2 : ℝ) * Real.exp (-t)) • lowerSobolevGenerator (w t) + + (-Complex.I) • lowerSobolevInclusion + (expandingOddPower a k 1 ha ha1 hk le_rfl m (w t))) t) : + let v := fun s => expandingToSobolev a k ha1 hk (w s) + HasDerivAt (fun s => lowerSobolevInclusion (v s)) + ((-(a : ℂ) + Complex.I * b) • lowerSobolevInclusion (v t) + + (L ^ (-2 : ℝ) * Real.exp (-t)) • lowerSobolevGenerator (v t) + + (-Complex.I) • lowerSobolevInclusion + (sobolevOddPower k (by linarith) m (v t))) t := by + intro v + have h := ((expandingToSobolev a k ha1 hk).restrictScalars ℝ).hasFDerivAt.comp_hasDerivAt t hw + change HasDerivAt (fun s => expandingToSobolev a k ha1 hk (lowerSobolevInclusion (w s))) + (expandingToSobolev a k ha1 hk + ((-(a : ℂ) + Complex.I * b) • lowerSobolevInclusion (w t) + + (L ^ (-2 : ℝ) * Real.exp (-t)) • lowerSobolevGenerator (w t) + + (-Complex.I) • lowerSobolevInclusion + (expandingOddPower a k 1 ha ha1 hk le_rfl m (w t)))) t at h + have hreal (c : ℝ) (f : FourierL2) : + expandingToSobolev a k ha1 hk (c • f) = c • expandingToSobolev a k ha1 hk f := + (expandingToSobolev a k ha1 hk).toLinearMap.map_smul_of_tower c f + simpa only [map_add, map_smul, hreal, expandingToSobolev_lowerInclusion, + expandingToSobolev_lowerGenerator, expandingToSobolev_oddPower, v] using h + +/-- Every constructed nonlinear Picard fixed point has the standard Sobolev strong equation. -/ +theorem hasDerivAt_expandingNonlinearMild_sobolev (a b k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) + (m : ℕ) (u : C(Icc (0 : ℝ) T, FourierL2)) (u₀ : FourierL2) + (hu : u = expandingPicard a b k L T ha hk hL hT + (expandingNonlinearReaction a k L T ha ha1 hk hL m) u₀ u) + (t : ℝ) (ht : t ∈ Ioo 0 T) : + let v := fun s => expandingToSobolev a k ha1 hk + (expandingPhysicalPath a k L T ha hk hL u (projIcc 0 T hT s)) + HasDerivAt (fun s => lowerSobolevInclusion (v s)) + ((-(a : ℂ) + Complex.I * b) • lowerSobolevInclusion (v t) + + (L ^ (-2 : ℝ) * Real.exp (-t)) • lowerSobolevGenerator (v t) + + (-Complex.I) • lowerSobolevInclusion + (sobolevOddPower k (by linarith) m (v t))) t := by + exact hasDerivAt_expandingSobolev_reduced a b k L ha ha1 hk m _ t + (hasDerivAt_expandingNonlinearMild a b k L T ha ha1 hk hL hT m u u₀ hu t ht) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSobolevWeights.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSobolevWeights.lean new file mode 100644 index 0000000000000000000000000000000000000000..ad4858019d78b0e6df7a5dc92012e1e7ea9edc5f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSobolevWeights.lean @@ -0,0 +1,139 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.SobolevTranslation +import Mathlib.Analysis.SpecialFunctions.ImproperIntegrals +import Mathlib.Analysis.SumIntegralComparisons + +namespace OAI + +/-! # Exact weights of the expanding-torus Sobolev norm + +The norm from manuscript (lin:YL), after extracting `(2π)^12`, has squared +Fourier weight `L^(2a) ⟨n⟩^(12-2a) + L^(12-2k) |n|^(2k)`. +The auxiliary one-dimensional weights will control its inverse sum. +-/ + +open Set MeasureTheory + +namespace DefocusingNLS + +noncomputable def expandingSobolevWeightSq (a k L : ℝ) (n : frequencyLattice) : ℝ := + L ^ (2 * a) * (1 + ‖n‖ ^ 2) ^ (6 - a) + L ^ (12 - 2 * k) * ‖n‖ ^ (2 * k) + +noncomputable def expandingOneDimWeight (a k L x : ℝ) : ℝ := + L ^ (a / 6) * (1 + x ^ 2) ^ ((6 - a) / 12) + + L ^ (1 - k / 6) * |x| ^ (k / 6) + +noncomputable def expandingOneDimKernel (a k L x : ℝ) : ℝ := + (expandingOneDimWeight a k L x)⁻¹ + +theorem expandingSobolevWeightSq_pos (a k L : ℝ) (hL : 1 ≤ L) (n : frequencyLattice) : + 0 < expandingSobolevWeightSq a k L n := by + unfold expandingSobolevWeightSq + exact add_pos_of_pos_of_nonneg (mul_pos (Real.rpow_pos_of_pos (by linarith) _) + (Real.rpow_pos_of_pos (by positivity) _)) (by positivity) + +theorem expandingOneDimWeight_pos (a k L x : ℝ) (hL : 1 ≤ L) : + 0 < expandingOneDimWeight a k L x := by + unfold expandingOneDimWeight + exact add_pos_of_pos_of_nonneg (mul_pos (Real.rpow_pos_of_pos (by linarith) _) + (Real.rpow_pos_of_pos (by positivity) _)) (by positivity) + +theorem expandingOneDimKernel_nonneg (a k L x : ℝ) (hL : 1 ≤ L) : + 0 ≤ expandingOneDimKernel a k L x := + (inv_pos.mpr (expandingOneDimWeight_pos a k L x hL)).le + +theorem expandingOneDimKernel_even (a k L x : ℝ) : + expandingOneDimKernel a k L (-x) = expandingOneDimKernel a k L x := by + simp [expandingOneDimKernel, expandingOneDimWeight] + +theorem expandingOneDimKernel_zero_le (a k L : ℝ) (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) : + expandingOneDimKernel a k L 0 ≤ 1 := by + have hz : expandingOneDimKernel a k L 0 = (L ^ (a / 6))⁻¹ := by + simp [expandingOneDimKernel, expandingOneDimWeight, + Real.zero_rpow (by linarith : k / 6 ≠ 0)] + rw [hz] + exact inv_le_one_of_one_le₀ (Real.one_le_rpow hL (show 0 ≤ a / 6 by linarith)) + +theorem expandingOneDimKernel_antitone (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) : + AntitoneOn (expandingOneDimKernel a k L) (Ici 0) := by + intro x hx y hy hxy + change 0 ≤ x at hx + change 0 ≤ y at hy + unfold expandingOneDimKernel + apply (inv_le_inv₀ (expandingOneDimWeight_pos a k L y hL) + (expandingOneDimWeight_pos a k L x hL)).mpr + unfold expandingOneDimWeight + simp only [abs_of_nonneg hx, abs_of_nonneg hy] + gcongr + linarith + +/-- Below the scale, the inverse weight is controlled by the locally integrable power. -/ +theorem expandingOneDimKernel_le_low (a k L x : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hL : 1 ≤ L) (hx : 0 < x) : + expandingOneDimKernel a k L x ≤ L ^ (-a / 6) * x ^ (a / 6 - 1) := by + have hpow : x ^ (1 - a / 6) ≤ (1 + x ^ 2) ^ ((6 - a) / 12) := by + calc + _ = (x ^ 2) ^ ((6 - a) / 12) := by + rw [← Real.rpow_natCast, ← Real.rpow_mul hx.le] + congr 1 + ring + _ ≤ _ := Real.rpow_le_rpow (by positivity) (by linarith) (by linarith) + have hden : L ^ (a / 6) * x ^ (1 - a / 6) ≤ expandingOneDimWeight a k L x := by + unfold expandingOneDimWeight + exact (mul_le_mul_of_nonneg_left hpow (by positivity)).trans (le_add_of_nonneg_right (by positivity)) + calc + expandingOneDimKernel a k L x ≤ (L ^ (a / 6) * x ^ (1 - a / 6))⁻¹ := + (inv_le_inv₀ (expandingOneDimWeight_pos a k L x hL) (by positivity)).mpr hden + _ = L ^ (-a / 6) * x ^ (a / 6 - 1) := by + rw [mul_inv_rev, ← Real.rpow_neg (by linarith : 0 ≤ L), ← Real.rpow_neg hx.le] + have h₁ : -(a / 6) = -a / 6 := by ring + have h₂ : -(1 - a / 6) = a / 6 - 1 := by ring + rw [h₁, h₂] + ring + +/-- Above the scale, the inverse weight has an integrable high-order tail. -/ +theorem expandingOneDimKernel_le_high (a k L x : ℝ) (hL : 1 ≤ L) (hx : 0 < x) : + expandingOneDimKernel a k L x ≤ L ^ (k / 6 - 1) * x ^ (-k / 6) := by + have hden : L ^ (1 - k / 6) * x ^ (k / 6) ≤ expandingOneDimWeight a k L x := by + unfold expandingOneDimWeight + rw [abs_of_pos hx] + exact le_add_of_nonneg_left (by positivity) + calc + expandingOneDimKernel a k L x ≤ (L ^ (1 - k / 6) * x ^ (k / 6))⁻¹ := + (inv_le_inv₀ (expandingOneDimWeight_pos a k L x hL) (by positivity)).mpr hden + _ = L ^ (k / 6 - 1) * x ^ (-k / 6) := by + rw [mul_inv_rev, ← Real.rpow_neg (by linarith : 0 ≤ L), ← Real.rpow_neg hx.le] + have h₁ : -(1 - k / 6) = k / 6 - 1 := by ring + have h₂ : -(k / 6) = -k / 6 := by ring + rw [h₁, h₂] + ring + +/-- The normalized weight is exactly the manuscript's volume-weighted Fourier density. -/ +theorem expandingSobolevWeightSq_original (a k L : ℝ) (hL : 1 ≤ L) (n : frequencyLattice) : + (2 * Real.pi * L) ^ 12 * + ((L ^ (-2 : ℝ) + (‖n‖ / L) ^ 2) ^ (6 - a) + (‖n‖ / L) ^ (2 * k)) = + (2 * Real.pi) ^ 12 * expandingSobolevWeightSq a k L n := by + have hLp : 0 < L := by linarith + have hbase : L ^ (-2 : ℝ) + (‖n‖ / L) ^ 2 = + L ^ (-2 : ℝ) * (1 + ‖n‖ ^ 2) := by + rw [Real.rpow_neg hLp.le, Real.rpow_two] + field_simp + have hlow : L ^ 12 * (L ^ (-2 : ℝ)) ^ (6 - a) = L ^ (2 * a) := by + rw [← Real.rpow_natCast, ← Real.rpow_mul hLp.le, ← Real.rpow_add hLp] + congr 1 + ring + have hhigh : L ^ 12 / L ^ (2 * k) = L ^ (12 - 2 * k) := by + rw [← Real.rpow_natCast, Real.rpow_sub hLp] + norm_num + rw [hbase, Real.mul_rpow (by positivity) (by positivity), + Real.div_rpow (norm_nonneg n) hLp.le, mul_pow] + unfold expandingSobolevWeightSq + calc + _ = (2 * Real.pi) ^ 12 * + ((L ^ 12 * (L ^ (-2 : ℝ)) ^ (6 - a)) * (1 + ‖n‖ ^ 2) ^ (6 - a) + + (L ^ 12 / L ^ (2 * k)) * ‖n‖ ^ (2 * k)) := by ring + _ = _ := by rw [hlow, hhigh] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSolutionContinuity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSolutionContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..6b047fb7b46c1618e6af13161fd75e62991550f4 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSolutionContinuity.lean @@ -0,0 +1,104 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPicardContinuity +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingWeightedLocal + +namespace OAI + +/-! # Continuity of bounded actual mild-solution families + +The local polynomial Lipschitz estimate is used only along the actual two +solutions. Exponential weighting gives a uniform pair contraction, so +continuity follows from continuity of the Picard map at a fixed path. No +globally Lipschitz extension of the reaction is introduced. +-/ + +open Set Filter Topology + +namespace DefocusingNLS + +attribute [local irreducible] expandingFreeStep expandingDuhamel expandingPicard + expandingBieleckiPicard expandingTimeWeight + +theorem continuous_fixed_family_of_pair_contraction + {P X : Type*} [TopologicalSpace P] [PseudoMetricSpace X] + (T : P → X → X) (z : P → X) + (hT : ∀ x, Continuous (fun p => T p x)) + (hz : ∀ p, T p (z p) = z p) + (hpair : ∀ p q, dist (T p (z p)) (T p (z q)) ≤ (1 / 2 : ℝ) * dist (z p) (z q)) : + Continuous z := by + rw [continuous_iff_continuousAt] + intro p + apply Metric.tendsto_nhds.mpr + intro ε hε + have he : ∀ᶠ q in 𝓝 p, dist (T q (z p)) (T p (z p)) < ε / 2 := + (hT (z p)).continuousAt.tendsto.eventually + (Metric.ball_mem_nhds _ (by linarith)) + filter_upwards [he] with q hq + have ht := dist_triangle (T q (z q)) (T q (z p)) (T p (z p)) + rw [hz q, hz p] at ht + have hp := hpair q p + rw [hz q] at hp + rw [hz p] at hq + linarith + +theorem continuous_expandingMild_family + {P : Type*} [TopologicalSpace P] (a b k T K : ℝ) + (ha : 0 < a) (hk : 8 < k) (hT : 0 ≤ T) (hK : 0 ≤ K) + (L : P → {L : ℝ // 1 ≤ L}) (hL : Continuous L) + (F : P → C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) + (hF : Continuous (fun z : P × ((Icc (0 : ℝ) T) × FourierL2) => F z.1 z.2)) + (u₀ : P → FourierL2) (hu₀ : Continuous u₀) + (u : P → C(Icc (0 : ℝ) T, FourierL2)) + (hu : ∀ p, u p = expandingPicard a b k (L p).1 T ha hk (L p).2 hT + (F p) (u₀ p) (u p)) + (hlocal : ∀ p q t, + ‖F p (t, u p t) - F p (t, u q t)‖ ≤ K * ‖u p t - u q t‖) : + Continuous u := by + let η := 2 * K + 1 + have hη : 0 < η := by dsimp [η]; linarith + let z : P → C(Icc (0 : ℝ) T, FourierL2) := + fun p => expandingTimeWeight T (-η) (u p) + let A : P → C(Icc (0 : ℝ) T, FourierL2) → C(Icc (0 : ℝ) T, FourierL2) := + fun p => expandingBieleckiPicard a b k (L p).1 T η ha hk (L p).2 hT (F p) (u₀ p) + have hA : ∀ x, Continuous (fun p => A p x) := by + intro x + dsimp only [A] + exact (continuous_expandingBieleckiPicard_family a b k T η ha hk hT L hL F hF + u₀ hu₀).comp (continuous_id.prodMk continuous_const) + have hfix : ∀ p, A p (z p) = z p := by + intro p + dsimp only [A, z] + rw [expandingBieleckiPicard] + rw [expandingTimeWeight_cancel, ← hu p] + have hpair : ∀ p q, dist (A p (z p)) (A p (z q)) ≤ + (1 / 2 : ℝ) * dist (z p) (z q) := by + intro p q + have hb := expandingBieleckiPicard_pair_dist_le a b k (L p).1 T η ha hk (L p).2 + hT hη (F p) (u₀ p) K hK (z p) (z q) (by + intro t + simpa only [z, expandingTimeWeight_cancel] using hlocal p q t) + exact hb.trans (mul_le_mul_of_nonneg_right + ((div_le_iff₀ hη).mpr (by dsimp [η]; linarith)) dist_nonneg) + have hz : Continuous z := continuous_fixed_family_of_pair_contraction A z hA hfix hpair + have hc := (continuous_expandingTimeWeight T η).comp hz + simpa only [Function.comp_def, z, expandingTimeWeight_cancel] using hc + +theorem continuous_expandingMild_bounded_family + {P : Type*} [TopologicalSpace P] (a b k T R K : ℝ) + (ha : 0 < a) (hk : 8 < k) (hT : 0 ≤ T) (hK : 0 ≤ K) + (L : P → {L : ℝ // 1 ≤ L}) (hL : Continuous L) + (F : P → C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) + (hF : Continuous (fun z : P × ((Icc (0 : ℝ) T) × FourierL2) => F z.1 z.2)) + (u₀ : P → FourierL2) (hu₀ : Continuous u₀) + (u : P → C(Icc (0 : ℝ) T, FourierL2)) + (hu : ∀ p, u p = expandingPicard a b k (L p).1 T ha hk (L p).2 hT + (F p) (u₀ p) (u p)) + (hub : ∀ p t, ‖u p t‖ ≤ R) + (hlocal : ∀ p t x y, ‖x‖ ≤ R → ‖y‖ ≤ R → + ‖F p (t, x) - F p (t, y)‖ ≤ K * ‖x - y‖) : + Continuous u := + continuous_expandingMild_family a b k T K ha hk hT hK L hL F hF u₀ hu₀ u hu + (fun p q t => hlocal p t (u p t) (u q t) (hub p t) (hub q t)) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSpacetimeObservation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSpacetimeObservation.lean new file mode 100644 index 0000000000000000000000000000000000000000..2427c587f54e65fdc686f3344755153cb2f02437 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingSpacetimeObservation.lean @@ -0,0 +1,61 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingContinuousRealization +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPhysicalTimeBound +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPhysicalSpaceBound + +namespace OAI + +/-! # Physical space-time realization of a moving Fourier path -/ + +open Set + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +attribute [local irreducible] expandingTorusFunction + +noncomputable def expandingSpacetimePath (a k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (u : C(Icc (0 : ℝ) T, FourierL2)) : C(Icc (0 : ℝ) T × E, ℂ) := + let obs : C(({R : ℝ // 1 ≤ R} × FourierL2) × E, ℂ) := + ⟨_, continuous_expandingPhysical_observation a k ha ha1 hk⟩ + let l := expandingRadiusCurve L T hL + let input : C(Icc (0 : ℝ) T × E, ({R : ℝ // 1 ≤ R} × FourierL2) × E) := + ⟨fun p => ((l p.1, u p.1), p.2), + ((l.continuous.comp continuous_fst).prodMk + (u.continuous.comp continuous_fst)).prodMk continuous_snd⟩ + obs.comp input + +@[simp] theorem expandingSpacetimePath_apply (a k L T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (u : C(Icc (0 : ℝ) T, FourierL2)) (p : Icc (0 : ℝ) T × E) : + expandingSpacetimePath a k L T ha ha1 hk hL u p = + expandingTorusFunction a k (expandingRadius L p.1) (u p.1) + (euclideanToTorus ((expandingRadius L p.1)⁻¹ • p.2)) := rfl + +theorem expandingSpacetimePath_norm_le (a k L T M : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (u : C(Icc (0 : ℝ) T, FourierL2)) (hu : ∀ t, ‖u t‖ ≤ M) + (p : Icc (0 : ℝ) T × E) : + ‖expandingSpacetimePath a k L T ha ha1 hk hL u p‖ ≤ expandingEmbeddingBound a k * M := by + exact ((expandingTorusFunction a k (expandingRadius L p.1) (u p.1)).norm_coe_le_norm _).trans + ((expandingTorusFunction_norm_le a k _ ha ha1 hk + (hL.trans (expandingRadius_ge L p.1 hL p.1.2.1)) _).trans + (mul_le_mul_of_nonneg_left (hu p.1) (by dsimp [expandingEmbeddingBound]; positivity))) + +theorem expandingSpacetimePath_space_bound (a k L T M : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (u : C(Icc (0 : ℝ) T, FourierL2)) (hu : ∀ t, ‖u t‖ ≤ M) + (t : Icc (0 : ℝ) T) (x y : E) : + ‖expandingSpacetimePath a (k + 2) L T ha ha1 (by linarith) hL u (t, x) - + expandingSpacetimePath a (k + 2) L T ha ha1 (by linarith) hL u (t, y)‖ ≤ + expandingJetBound a k * M * ‖x - y‖ := by + apply (expandingPhysical_space_bound a k (expandingRadius L t) ha ha1 hk + (hL.trans (expandingRadius_ge L t hL t.2.1)) (u t) x y).trans + exact mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_left (hu t) (by + dsimp [expandingJetBound, expandingEmbeddingBound]; positivity)) (norm_nonneg _) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingStableLimitEnergy.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingStableLimitEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..a9c71928d55a535d3d1410cb5ddfde1c23f1b40c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingStableLimitEnergy.lean @@ -0,0 +1,48 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingEscapedEnergy +import OAI.MathematicalPhysics.DefocusingNLS.Linear.SpacetimeStableObservation + +namespace OAI + +/-! # Escaped torus energy controlled by decay of its identified limit -/ + +open Set Filter Topology + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem expandingProfile_stable_limit_energy (a b k T Q M c C R A η : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hT : 0 ≤ T) + (hQ : 0 ≤ Q) (hM : 0 ≤ M) (hc : 0 ≤ c) (hC : 0 ≤ C) (m : ℕ) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) + (q : ℕ → C(Icc (0 : ℝ) T, FourierL2)) (hq : ∀ n s, ‖q n s‖ ≤ Q) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) + (henergy : ∀ n (s : Icc (0 : ℝ) T) (w : FourierL2), + let l := expandingRadiusCurve (L n) T (hL n) s; + -a * ‖expandingLowEnergy a k l.1 l.2 w‖ ^ 2 + + (6 - 2 * a - k) * ‖expandingHighEnergy a k l.1 l.2 w‖ ^ 2 + + 2 * inner ℝ w (expandingLinearizedPotential a k l.1 ha ha1 hk l.2 m (q n s) w) ≤ + -c * ‖w‖ ^ 2 + C * ‖expandingPhysicalBall a k l.1 R ha ha1 hk l.2 w‖ ^ 2) + (v : C(Icc (0 : ℝ) T × E, ℂ)) + (w : Icc (0 : ℝ) T → HomogeneousY a k) + (hw : ∀ t y, v (t, y) = homogeneousPhysicalCLM a k ha ha1 hk (w t) y) + (hA : 0 ≤ A) (hdecay : ∀ t, ‖w t‖ ≤ A * Real.exp (-η * (t : ℝ))) + (hv : Tendsto (fun n => expandingSpacetimePath a k (L n) T ha ha1 hk (hL n) + (expandingProfileTrajectory a b k (L n) T ha ha1 hk (hL n) hT m Q hQ (q n) (hq n) (f n))) + atTop (𝓝 v)) : + ∀ ε : ℝ, 0 < ε → ∀ᶠ n in atTop, + ‖expandingProfileTrajectory a b k (L n) T ha ha1 hk (hL n) hT m Q hQ (q n) (hq n) + (f n) ⟨T, hT, le_rfl⟩‖ ^ 2 ≤ Real.exp (-c * T) * M ^ 2 + + (C * (‖homogeneousPhysicalCLM a k ha ha1 hk‖ * A) ^ 2) * + observationDecayIntegral c (2 * η) T + ε := by + have hi := spacetime_stable_observation_integral_le a k T R C A η ha ha1 hk hT + hC hA c v w hw hdecay + intro ε hε + filter_upwards [expandingProfile_escaped_energy a b k T Q M c C R ha ha1 hk hT + hQ hM hc hC m L hL q hq f hf henergy v hv ε hε] with n hn + apply hn.trans + linarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingStableSequence.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingStableSequence.lean new file mode 100644 index 0000000000000000000000000000000000000000..3902a8fa1c3b747a0d43a0ee88ec0ab794085c1a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingStableSequence.lean @@ -0,0 +1,100 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingIdentifiedCompactness +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingStableLimitEnergy +import OAI.MathematicalPhysics.DefocusingNLS.Linear.WeakLinearCoordinates + +namespace OAI + +/-! # Stable whole-space decay forces contraction along every expanding sequence -/ + +open Set Filter Topology +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + +attribute [local irreducible] expandingProfileTrajectory + +theorem expandingProfile_stable_sequence (a b k T Q C₀ c C R D η β : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 10 < k) (hT : 0 ≤ T) + (hQ : 0 ≤ Q) (hC₀ : 0 ≤ C₀) (hc : 0 ≤ c) (hC : 0 ≤ C) (hD : 0 ≤ D) + (hβ : 0 < β) (m : ℕ) + (χ : 𝓢(E, ℂ)) (ρ : ℝ) (hρ : 0 < ρ) (hχ : ∀ y : E, ‖y‖ ≤ ρ → χ y = 1) + (hCb : ∀ (L : ℝ) (hL : 1 ≤ L) (f : FourierL2), + ‖homogeneousLocalizationCLM a k L ha ha1 (by linarith) hL χ f‖ ≤ C₀ * ‖f‖) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (hLinf : Tendsto L atTop atTop) + (q : ℕ → C(Icc (0 : ℝ) T, FourierL2)) (hq : ∀ n t, ‖q n t‖ ≤ Q) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ 1) (Q₀ : HomogeneousY a k) + (π : HomogeneousY a k →L[ℝ] F) + (hker : ∀ n, π (homogeneousLocalizationCLM a k (L n) ha ha1 (by linarith) + (hL n) χ (f n)) = 0) + (hqp : ∀ (s : Icc (0 : ℝ) T) (y : E), + Tendsto (fun n => expandingPhysicalContinuous a k (expandingRadius (L n) s) + ha ha1 (by linarith) ((hL n).trans (expandingRadius_ge (L n) s (hL n) s.2.1)) (q n s) y) + atTop (𝓝 (homogeneousPhysicalCLM a k ha ha1 (by linarith) Q₀ y))) + (henergy : ∀ n (s : Icc (0 : ℝ) T) (w : FourierL2), + let l := expandingRadiusCurve (L n) T (hL n) s; + -a * ‖expandingLowEnergy a k l.1 l.2 w‖ ^ 2 + + (6 - 2 * a - k) * ‖expandingHighEnergy a k l.1 l.2 w‖ ^ 2 + + 2 * inner ℝ w (expandingLinearizedPotential a k l.1 ha ha1 (by linarith) l.2 m (q n s) w) ≤ + -c * ‖w‖ ^ 2 + C * ‖expandingPhysicalBall a k l.1 R ha ha1 (by linarith) l.2 w‖ ^ 2) + (hdecay : ∀ u : HomogeneousY a k, π u = 0 → ∀ t : Icc (0 : ℝ) T, + ‖homogeneousLinearizedTrajectory a b k T ha ha1 (by linarith) hT m Q₀ u t‖ ≤ + D * Real.exp (-η * (t : ℝ)) * ‖u‖) + (hsmall : escapedEnergyBound c (2 * η) 1 + (C * (‖homogeneousPhysicalCLM a k ha ha1 (by linarith)‖ * (D * C₀)) ^ 2) T < β ^ 2) : + ∀ᶠ n in atTop, ‖expandingProfileTrajectory a b k (L n) T ha ha1 (by linarith) + (hL n) hT m Q hQ (q n) (hq n) (f n) ⟨T, hT, le_rfl⟩‖ < β := by + have hk8 : 8 < k := by linarith + by_contra h + obtain ⟨ψ, hψ, hbad⟩ := extraction_of_frequently_atTop (show ∃ᶠ n in atTop, + β ≤ ‖expandingProfileTrajectory a b k (L n) T ha ha1 hk8 + (hL n) hT m Q hQ (q n) (hq n) (f n) ⟨T, hT, le_rfl⟩‖ by + simpa only [not_eventually, not_lt] using h) + obtain ⟨φ, hφ, v, u₀, hu₀, hv, hphysical, hweak⟩ := + expandingProfile_exists_identified_limit a b k T Q 1 C₀ ha ha1 hk hT hQ + zero_le_one hC₀ m χ ρ hρ hχ hCb (fun n => L (ψ n)) (fun n => hL (ψ n)) + (hLinf.comp hψ.tendsto_atTop) (fun n => q (ψ n)) (fun n => hq (ψ n)) + (fun n => f (ψ n)) (fun n => hf (ψ n)) Q₀ + (fun t y => (hqp t y).comp hψ.tendsto_atTop) + let σ := fun n => ψ (φ n) + have hu0 : ‖u₀‖ ≤ C₀ := by simpa only [mul_one] using hu₀ + have hinitial : homogeneousLinearizedTrajectory a b k T ha ha1 hk8 hT m Q₀ u₀ + ⟨0, le_rfl, hT⟩ = u₀ := by + rw [homogeneousLinearizedTrajectory_eq] + simp only [homogeneousDuhamel, intervalIntegral.integral_same, add_zero, + homogeneousFreeOperator_zero] + have hw₀ (ℓ : HomogeneousY a k →L[ℝ] ℂ) : + Tendsto (fun n => ℓ (homogeneousLocalizationCLM a k (L (σ n)) ha ha1 hk8 + (hL (σ n)) χ (f (σ n)))) atTop (𝓝 (ℓ u₀)) := by + simpa only [expandingProfileTrajectory_initial, expandingRadius, zero_div, + Real.exp_zero, mul_one, hinitial] using hweak ⟨0, le_rfl, hT⟩ ℓ + have hπ : π u₀ = 0 := weakLimit_map_eq_zero π _ u₀ hw₀ (fun n => hker (σ n)) + have hd (t : Icc (0 : ℝ) T) : + ‖homogeneousLinearizedTrajectory a b k T ha ha1 hk8 hT m Q₀ u₀ t‖ ≤ + (D * C₀) * Real.exp (-η * (t : ℝ)) := by + calc + _ ≤ D * Real.exp (-η * (t : ℝ)) * ‖u₀‖ := hdecay u₀ hπ t + _ ≤ D * Real.exp (-η * (t : ℝ)) * C₀ := + mul_le_mul_of_nonneg_left hu0 (by positivity) + _ = _ := by ring + let B := escapedEnergyBound c (2 * η) 1 + (C * (‖homogeneousPhysicalCLM a k ha ha1 hk8‖ * (D * C₀)) ^ 2) T + have hB : B < β ^ 2 := hsmall + have heps : 0 < (β ^ 2 - B) / 2 := by linarith + have hb := expandingProfile_stable_limit_energy a b k T Q 1 c C R (D * C₀) η + ha ha1 hk8 hT hQ zero_le_one hc hC m (fun n => L (σ n)) (fun n => hL (σ n)) + (fun n => q (σ n)) (fun n => hq (σ n)) (fun n => f (σ n)) (fun n => hf (σ n)) + (fun n => henergy (σ n)) v + (fun t => homogeneousLinearizedTrajectory a b k T ha ha1 hk8 hT m Q₀ u₀ t) + hphysical (mul_nonneg hD hC₀) hd hv ((β ^ 2 - B) / 2) heps + obtain ⟨j, hj⟩ := hb.exists + have hbadj := pow_le_pow_left₀ hβ.le (hbad (φ j)) 2 + change _ ≤ B + (β ^ 2 - B) / 2 at hj + linarith + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingStepExistence.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingStepExistence.lean new file mode 100644 index 0000000000000000000000000000000000000000..674ef99843f87836333ff5b1b4f9835d66b2bebf --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingStepExistence.lean @@ -0,0 +1,73 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingPerturbationExistence + +namespace OAI + +/-! # A uniform small-data radius for a fixed nonlinear step + +Both the initial perturbation and the profile forcing may be chosen in a +single ball independent of the expanding torus radius. The resulting path +bound is linear in their sizes. +-/ + +open Set + +namespace DefocusingNLS + +theorem exists_expandingPerturbation_step_radius (a b k M : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hM : 0 ≤ M) + (m : ℕ) (R : ℝ) (hR : 0 ≤ R) : + ∃ δ A : ℝ, 0 < δ ∧ 0 < A ∧ A * δ ≤ 1 / 4 ∧ + ∀ (L : ℝ) (hL : 1 ≤ L) (q g : C(Icc (0 : ℝ) M, FourierL2)) (G : ℝ), + 0 ≤ G → G ≤ δ → (∀ t, ‖q t‖ ≤ R) → (∀ t, ‖g t‖ ≤ G) → + ∀ v₀ : FourierL2, ‖v₀‖ ≤ δ → + ∃ v : C(Icc (0 : ℝ) M, FourierL2), + v = expandingPicard a b k L M ha hk hL hM + (expandingPerturbationReaction a k L M ha ha1 hk hL m q g) v₀ v ∧ + ‖v‖ ≤ A * (‖v₀‖ + G) ∧ ‖v‖ ≤ 1 / 2 := by + obtain ⟨K, hK, hexists⟩ := exists_expandingPerturbation_finiteSlab a b k ha ha1 hk m R hR + let η := K + 1 + have hη : 0 < η := by dsimp [η]; linarith + have hη1 : 1 ≤ η := by dsimp [η]; linarith + let E := Real.exp (η * M) + have hE : 0 < E := Real.exp_pos _ + let δ := Real.exp (-η * M) / (4 * η) + let A := E * η + have hδ : 0 < δ := div_pos (Real.exp_pos _) (by positivity) + have hA : 0 < A := mul_pos hE hη + have hcancel : E * Real.exp (-η * M) = 1 := by + dsimp [E] + rw [← Real.exp_add, show η * M + -η * M = 0 by ring, Real.exp_zero] + have hAδ : A * δ = 1 / 4 := by + dsimp [A, δ] + calc + E * η * (Real.exp (-η * M) / (4 * η)) = + (E * Real.exp (-η * M)) / 4 := by field_simp [hη.ne'] + _ = 1 / 4 := by rw [hcancel] + have hδid : 2 * η * δ = Real.exp (-η * M) / 2 := by + dsimp [δ] + field_simp [hη.ne'] + ring + refine ⟨δ, A, hδ, hA, hAδ.le, ?_⟩ + intro L hL q g G hG hGδ hq hg v₀ hv₀ + have hsmall : η * ‖v₀‖ + G ≤ Real.exp (-η * M) := by + calc + η * ‖v₀‖ + G ≤ η * δ + δ := add_le_add + (mul_le_mul_of_nonneg_left hv₀ hη.le) hGδ + _ ≤ 2 * η * δ := by nlinarith [mul_le_mul_of_nonneg_right hη1 hδ.le] + _ = Real.exp (-η * M) / 2 := hδid + _ ≤ Real.exp (-η * M) := by linarith [Real.exp_pos (-η * M)] + obtain ⟨v, hv, hvbound, _⟩ := hexists L M hL hM q g v₀ G hG hq hg hsmall + have hlinear : ‖v‖ ≤ A * (‖v₀‖ + G) := by + apply hvbound.trans + change E * (η * ‖v₀‖ + G) ≤ E * η * (‖v₀‖ + G) + nlinarith [mul_nonneg (mul_nonneg hE.le (sub_nonneg.mpr hη1)) hG] + have hhalf : ‖v‖ ≤ 1 / 2 := by + calc + ‖v‖ ≤ A * (‖v₀‖ + G) := hlinear + _ ≤ A * (δ + δ) := mul_le_mul_of_nonneg_left (add_le_add hv₀ hGδ) hA.le + _ = 1 / 2 := by nlinarith [hAδ] + exact ⟨v, hv, hlinear, hhalf⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingStepLipschitz.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingStepLipschitz.lean new file mode 100644 index 0000000000000000000000000000000000000000..660cfc242be1349409f8bc026215113eb6f747cc --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingStepLipschitz.lean @@ -0,0 +1,64 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfileDifference + +namespace OAI + +/-! # Lipschitz remainder after a fixed nonlinear step + +Subtracting the homogeneous linearized difference leaves only the difference +of the quadratic sources. The resulting constant depends on the fixed step +length and profile bound, and is uniform in the starting torus radius. +-/ + +open Set + +namespace DefocusingNLS + +theorem exists_expandingNonlinearStep_difference_error (a b k M : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hM : 0 ≤ M) + (m : ℕ) (R : ℝ) (hR : 0 ≤ R) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ (L : ℝ) (hL : 1 ≤ L) + (q g u v w : C(Icc (0 : ℝ) M, FourierL2)) (u₀ v₀ : FourierL2) (d : ℝ), + 0 ≤ d → d ≤ 1 → (∀ t, ‖q t‖ ≤ R) → (∀ t, ‖u t‖ ≤ d) → (∀ t, ‖v t‖ ≤ d) → + u = expandingPicard a b k L M ha hk hL hM + (expandingPerturbationReaction a k L M ha ha1 hk hL m q g) u₀ u → + v = expandingPicard a b k L M ha hk hL hM + (expandingPerturbationReaction a k L M ha ha1 hk hL m q g) v₀ v → + (∀ t : Icc (0 : ℝ) M, w t = + expandingFreeStep a b k L t ha hk hL t.2.1 (u₀ - v₀) + + expandingDuhamel a b k L ha hk hL t + (expandingReactionHistory M hM + (expandingProfileReaction a k M ha ha1 hk m (expandingRadiusCurve L M hL) q 0) w)) → + dist (u - v) w ≤ C * d * dist u₀ v₀ := by + obtain ⟨A, hA, hresponse⟩ := exists_expandingProfile_response_bound a b k ha ha1 hk m R hR + obtain ⟨B, hB, hreaction⟩ := exists_expandingPerturbationReaction_local_lipschitz + a k ha ha1 hk m R hR + obtain ⟨D, hD, hsource⟩ := exists_expandingPerturbationSource_lipschitz a k ha ha1 hk m R hR + let C := Real.exp ((A + 1) * M) * (2 * D) * (Real.exp ((B + 1) * M) * (B + 1)) + refine ⟨C, by dsimp [C]; positivity, ?_⟩ + intro L hL q g u v w u₀ v₀ d hd hd1 hq hu_bound hv_bound hu hv hw + let F := expandingPerturbationReaction a k L M ha ha1 hk hL m q g + have hdist : dist u v ≤ Real.exp ((B + 1) * M) * ((B + 1) * dist u₀ v₀) := + expandingMild_finiteSlab_local_data_bound a b k L M ha hk hL hM F u₀ v₀ B hB u v + (fun t => hreaction L M hL q g hq t (u t) (v t) + ((hu_bound t).trans hd1) ((hv_bound t).trans hd1)) hu hv + let r := expandingPerturbationSource a k L M ha ha1 hk hL m q g u - + expandingPerturbationSource a k L M ha ha1 hk hL m q g v + let G := (2 * D * d) * dist u v + have hG : 0 ≤ G := by dsimp [G]; positivity + have hr : ∀ t, ‖r t‖ ≤ G := by + intro t + exact hsource L M hL q g u v d hd hd1 hq hu_bound hv_bound t + have hp := hresponse L M hL hM q r (u₀ - v₀) G hG hq hr (u - v) w + (expandingPerturbation_difference_linear_mild a b k L M ha ha1 hk hL hM m + q g u v u₀ v₀ hu hv) hw + calc + dist (u - v) w ≤ Real.exp ((A + 1) * M) * G := hp + _ ≤ Real.exp ((A + 1) * M) * + ((2 * D * d) * (Real.exp ((B + 1) * M) * ((B + 1) * dist u₀ v₀))) := by + exact mul_le_mul_of_nonneg_left + (mul_le_mul_of_nonneg_left hdist (by positivity)) (Real.exp_pos _).le + _ = C * d * dist u₀ v₀ := by dsimp [C]; ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingStepMap.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingStepMap.lean new file mode 100644 index 0000000000000000000000000000000000000000..f6b65ff064d3ca2aa31d118c13fad3202109862e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingStepMap.lean @@ -0,0 +1,122 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingStepLipschitz +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingStepExistence + +namespace OAI + +/-! # The actual nonlinear endpoint map and its small Lipschitz remainder + +For a bounded profile and small forcing, this constructs the nonlinear +step map on one uniform initial-data ball. Its linear part is the actual +profile-linearized evolution, with the quantitative remainder estimates +required in the manuscript's nonlinear iteration. +-/ + +open Set + +namespace DefocusingNLS + +theorem expandingPerturbation_unique_of_small (a b k L M : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (hM : 0 ≤ M) + (m : ℕ) (R : ℝ) (hR : 0 ≤ R) (q g u v : C(Icc (0 : ℝ) M, FourierL2)) + (v₀ : FourierL2) (hq : ∀ t, ‖q t‖ ≤ R) (hu_bound : ‖u‖ ≤ 1) (hv_bound : ‖v‖ ≤ 1) + (hu : u = expandingPicard a b k L M ha hk hL hM + (expandingPerturbationReaction a k L M ha ha1 hk hL m q g) v₀ u) + (hv : v = expandingPicard a b k L M ha hk hL hM + (expandingPerturbationReaction a k L M ha ha1 hk hL m q g) v₀ v) : u = v := by + obtain ⟨K, hK, hlip⟩ := exists_expandingPerturbationReaction_local_lipschitz + a k ha ha1 hk m R hR + have hb := expandingMild_finiteSlab_local_data_bound a b k L M ha hk hL hM + (expandingPerturbationReaction a k L M ha ha1 hk hL m q g) v₀ v₀ K hK u v + (fun t => hlip L M hL q g hq t (u t) (v t) + ((ContinuousMap.norm_coe_le_norm u t).trans hu_bound) + ((ContinuousMap.norm_coe_le_norm v t).trans hv_bound)) hu hv + simp only [dist_self, mul_zero] at hb + exact dist_eq_zero.mp (le_antisymm hb dist_nonneg) + +theorem exists_expandingNonlinear_stepMap (a b k M : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hM : 0 ≤ M) + (m : ℕ) (R : ℝ) (hR : 0 ≤ R) : + ∃ δ C : ℝ, 0 < δ ∧ 0 < C ∧ ∀ (L : ℝ) (hL : 1 ≤ L) + (q g : C(Icc (0 : ℝ) M, FourierL2)) (G : ℝ), + 0 ≤ G → G ≤ δ → (hq : ∀ t, ‖q t‖ ≤ R) → (∀ t, ‖g t‖ ≤ G) → + ∃ (V : {f : FourierL2 // ‖f‖ ≤ δ} → C(Icc (0 : ℝ) M, FourierL2)) + (h : {f : FourierL2 // ‖f‖ ≤ δ} → FourierL2), + (∀ f, V f = expandingPicard a b k L M ha hk hL hM + (expandingPerturbationReaction a k L M ha ha1 hk hL m q g) f.1 (V f)) ∧ + (∀ f, ‖V f‖ ≤ C * (‖f.1‖ + G)) ∧ + (∀ f, V f ⟨M, hM, le_rfl⟩ = + expandingProfileTrajectory a b k L M ha ha1 hk hL hM m R hR q hq f.1 + ⟨M, hM, le_rfl⟩ + h f) ∧ + (∀ z, z.1 = 0 → ‖h z‖ ≤ C * G) ∧ + (∀ (d : ℝ), 0 < d → d ≤ δ → ∀ f j, + ‖f.1‖ ≤ d → ‖j.1‖ ≤ d → ‖h f - h j‖ ≤ C * (d + G) * ‖f.1 - j.1‖) := by + obtain ⟨δ, A, hδ, hA, hAδ, hexists⟩ := + exists_expandingPerturbation_step_radius a b k M ha ha1 hk hM m R hR + obtain ⟨B, hB, herror⟩ := exists_expandingNonlinearStep_difference_error + a b k M ha ha1 hk hM m R hR + let C := A + B * A + have hC : 0 < C := by dsimp [C]; positivity + have hAC : A ≤ C := by dsimp [C]; nlinarith [mul_nonneg hB hA.le] + have hBC : B * A ≤ C := by dsimp [C]; linarith + refine ⟨δ, C, hδ, hC, ?_⟩ + intro L hL q g G hG hGδ hq hg + choose V hV hV_bound hV_half using + (fun f : {f : FourierL2 // ‖f‖ ≤ δ} => hexists L hL q g G hG hGδ hq hg f.1 f.2) + let S := expandingProfileTrajectory a b k L M ha ha1 hk hL hM m R hR q hq + let h : {f : FourierL2 // ‖f‖ ≤ δ} → FourierL2 := + fun f => V f ⟨M, hM, le_rfl⟩ - S f.1 ⟨M, hM, le_rfl⟩ + refine ⟨V, h, hV, ?_, ?_, ?_, ?_⟩ + · intro f + exact (hV_bound f).trans (mul_le_mul_of_nonneg_right hAC (by positivity)) + · intro f + dsimp [h, S] + abel + · intro z hz0 + have hz : S z.1 = 0 := by + rw [hz0] + exact expandingProfileTrajectory_zero a b k L M ha ha1 hk hL hM m R hR q hq + change ‖V z ⟨M, hM, le_rfl⟩ - S z.1 ⟨M, hM, le_rfl⟩‖ ≤ C * G + rw [hz] + simp only [ContinuousMap.zero_apply, sub_zero] + apply (ContinuousMap.norm_coe_le_norm (V z) _).trans + exact (hV_bound z).trans (by + simpa only [hz0, norm_zero, zero_add] using + mul_le_mul_of_nonneg_right hAC hG) + · intro d hd hdδ f j hf hj + let D := A * (d + G) + have hD : 0 ≤ D := by dsimp [D]; positivity + have hD1 : D ≤ 1 := by + have hl := mul_le_mul_of_nonneg_left (add_le_add hdδ hGδ) hA.le + dsimp [D] + nlinarith + have hf_bound : ∀ t, ‖V f t‖ ≤ D := by + intro t + exact (ContinuousMap.norm_coe_le_norm (V f) t).trans + ((hV_bound f).trans (mul_le_mul_of_nonneg_left (add_le_add hf le_rfl) hA.le)) + have hj_bound : ∀ t, ‖V j t‖ ≤ D := by + intro t + exact (ContinuousMap.norm_coe_le_norm (V j) t).trans + ((hV_bound j).trans (mul_le_mul_of_nonneg_left (add_le_add hj le_rfl) hA.le)) + have hb := herror L hL q g (V f) (V j) (S (f.1 - j.1)) f.1 j.1 D hD hD1 + hq hf_bound hj_bound (hV f) (hV j) + (expandingProfileTrajectory_eq a b k L M ha ha1 hk hL hM m R hR q hq (f.1 - j.1)) + have he : h f - h j = (V f - V j) ⟨M, hM, le_rfl⟩ - + S (f.1 - j.1) ⟨M, hM, le_rfl⟩ := by + dsimp [h, S] + rw [expandingProfileTrajectory_sub] + simp only [ContinuousMap.sub_apply] + abel + rw [he, ← dist_eq_norm] + apply (ContinuousMap.dist_apply_le_dist (f := V f - V j) (g := S (f.1 - j.1)) _).trans + apply hb.trans + rw [dist_eq_norm] + dsimp [D] + calc + B * (A * (d + G)) * ‖f.1 - j.1‖ = (B * A) * ((d + G) * ‖f.1 - j.1‖) := by ring + _ ≤ C * ((d + G) * ‖f.1 - j.1‖) := mul_le_mul_of_nonneg_right hBC + (mul_nonneg (add_nonneg hd.le hG) (norm_nonneg (f.1 - j.1))) + _ = C * (d + G) * ‖f.1 - j.1‖ := by ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingStepMapContinuity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingStepMapContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..2e35675e4ef2b84c4b82d5a185be8220164207ae --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingStepMapContinuity.lean @@ -0,0 +1,103 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfileContinuity +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingStepMap + +namespace OAI + +/-! # The continuous nonlinear endpoint map with its quantitative remainder + +This combines the exact nonlinear-step estimates and parameter continuity +for the same selected trajectories. Shrinking the input ball keeps every +selected trajectory inside the fixed state ball used by the local theory. +-/ + +open Set + +universe u + +namespace DefocusingNLS + +attribute [local irreducible] expandingPicard expandingPerturbationReaction + expandingProfileTrajectory + +theorem exists_expandingNonlinear_stepMap_continuous + (a b k T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hT : 0 ≤ T) + (m : ℕ) (R : ℝ) (hR : 0 ≤ R) : + ∃ δ C : ℝ, 0 < δ ∧ 0 < C ∧ ∀ (P : Type u) [TopologicalSpace P], ∀ + (L : P → {L : ℝ // 1 ≤ L}) (q g : P → C(Icc (0 : ℝ) T, FourierL2)) (G : P → ℝ), + Continuous L → Continuous q → Continuous g → (∀ p, 0 ≤ G p) → (∀ p, G p ≤ δ) → + (hq : ∀ p t, ‖q p t‖ ≤ R) → (∀ p t, ‖g p t‖ ≤ G p) → + ∃ (V : P × {f : FourierL2 // ‖f‖ ≤ δ} → C(Icc (0 : ℝ) T, FourierL2)) + (h : P × {f : FourierL2 // ‖f‖ ≤ δ} → FourierL2), + Continuous V ∧ Continuous h ∧ + (∀ z, V z = expandingPicard a b k (L z.1).1 T ha hk (L z.1).2 hT + (expandingPerturbationReaction a k (L z.1).1 T ha ha1 hk (L z.1).2 m + (q z.1) (g z.1)) z.2.1 (V z)) ∧ + (∀ z, ‖V z‖ ≤ C * (‖z.2.1‖ + G z.1)) ∧ + (∀ z, V z ⟨T, hT, le_rfl⟩ = + expandingProfileTrajectory a b k (L z.1).1 T ha ha1 hk (L z.1).2 hT + m R hR (q z.1) (hq z.1) z.2.1 ⟨T, hT, le_rfl⟩ + h z) ∧ + (∀ z, z.2.1 = 0 → ‖h z‖ ≤ C * G z.1) ∧ + (∀ d : ℝ, 0 < d → d ≤ δ → ∀ p f j, ‖f.1‖ ≤ d → ‖j.1‖ ≤ d → + ‖h (p, f) - h (p, j)‖ ≤ C * (d + G p) * ‖f.1 - j.1‖) := by + obtain ⟨δ₀, C, hδ₀, hC, hstep⟩ := + exists_expandingNonlinear_stepMap a b k T ha ha1 hk hT m R hR + let δ := min δ₀ (1 / (4 * C)) + have hδ : 0 < δ := lt_min hδ₀ (by positivity) + have hδle : δ ≤ δ₀ := min_le_left _ _ + have hCδ : C * δ ≤ 1 / 4 := by + calc + C * δ ≤ C * (1 / (4 * C)) := + mul_le_mul_of_nonneg_left (min_le_right _ _) hC.le + _ = 1 / 4 := by field_simp [hC.ne'] + refine ⟨δ, C, hδ, hC, ?_⟩ + intro P inst L q g G hL hq hg hG hGδ hqb hgb + choose V₀ h₀ hV₀ hVbound₀ hEnd₀ hZero₀ hLip₀ using + (fun p => hstep (L p).1 (L p).2 (q p) (g p) (G p) (hG p) + ((hGδ p).trans hδle) (hqb p) (hgb p)) + let lift : {f : FourierL2 // ‖f‖ ≤ δ} → {f : FourierL2 // ‖f‖ ≤ δ₀} := + fun f => ⟨f.1, f.2.trans hδle⟩ + let V : P × {f : FourierL2 // ‖f‖ ≤ δ} → C(Icc (0 : ℝ) T, FourierL2) := + fun z => V₀ z.1 (lift z.2) + let h : P × {f : FourierL2 // ‖f‖ ≤ δ} → FourierL2 := + fun z => h₀ z.1 (lift z.2) + have hV z : V z = expandingPicard a b k (L z.1).1 T ha hk (L z.1).2 hT + (expandingPerturbationReaction a k (L z.1).1 T ha ha1 hk (L z.1).2 m + (q z.1) (g z.1)) z.2.1 (V z) := hV₀ z.1 (lift z.2) + have hVbound z : ‖V z‖ ≤ C * (‖z.2.1‖ + G z.1) := hVbound₀ z.1 (lift z.2) + have hsmall z : ‖V z‖ ≤ 1 := by + apply (hVbound z).trans + have he := mul_le_mul_of_nonneg_left (add_le_add z.2.2 (hGδ z.1)) hC.le + nlinarith + have hu₀ : Continuous (fun z : P × {f : FourierL2 // ‖f‖ ≤ δ} => z.2.1) := + continuous_subtype_val.comp continuous_snd + have hcV : Continuous V := continuous_expandingPerturbation_family + (P := P × {f : FourierL2 // ‖f‖ ≤ δ}) a b k T R + ha ha1 hk hT m hR (fun z => L z.1) (hL.comp continuous_fst) + (fun z => q z.1) (fun z => g z.1) (hq.comp continuous_fst) (hg.comp continuous_fst) + (fun z => hqb z.1) (fun z => z.2.1) hu₀ V hV hsmall + have he (z : P × {f : FourierL2 // ‖f‖ ≤ δ}) : h z = V z ⟨T, hT, le_rfl⟩ - + expandingProfileTrajectory a b k (L z.1).1 T ha ha1 hk (L z.1).2 hT m R hR + (q z.1) (hqb z.1) z.2.1 ⟨T, hT, le_rfl⟩ := by + have hz := hEnd₀ z.1 (lift z.2) + change V z ⟨T, hT, le_rfl⟩ = _ + h z at hz + rw [hz] + abel + have hch : Continuous h := by + have hc := continuous_expandingStepRemainder_family + (P := P × {f : FourierL2 // ‖f‖ ≤ δ}) a b k T R ha ha1 hk hT m hR + (fun z => L z.1) (hL.comp continuous_fst) (fun z => q z.1) (fun z => g z.1) + (hq.comp continuous_fst) (hg.comp continuous_fst) (fun z => hqb z.1) + (fun z => z.2.1) hu₀ V hV hsmall + exact (funext he) ▸ hc + refine ⟨V, h, hcV, hch, hV, hVbound, ?_, ?_, ?_⟩ + · intro z + exact hEnd₀ z.1 (lift z.2) + · intro z hz + exact hZero₀ z.1 (lift z.2) hz + · intro d hd hdδ p f j hf hj + exact hLip₀ p d hd (hdδ.trans hδle) (lift f) (lift j) hf hj + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingStrongEquation.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingStrongEquation.lean new file mode 100644 index 0000000000000000000000000000000000000000..a1aeccebf579274596dde2c41e9ba42d92af2ac1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingStrongEquation.lean @@ -0,0 +1,58 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingModeEquation +import OAI.MathematicalPhysics.DefocusingNLS.Linear.FourierCoordinateDerivative + +namespace OAI + +/-! # Strong derivatives for the moving-torus equation + +The time-dependent Laplacian loses two Sobolev orders. After this loss, +continuity of the candidate derivative upgrades the Fourier-mode equation +to a strong Hilbert-space equation. +-/ + +open Set Filter Topology + +namespace DefocusingNLS + +noncomputable def expandingReducedField (a b L : ℝ) (u r : ℝ → FourierL2) (t : ℝ) : FourierL2 := + (-(a : ℂ) + Complex.I * b) • lowerSobolevInclusion (u t) + + (L ^ (-2 : ℝ) * Real.exp (-t)) • lowerSobolevGenerator (u t) + + lowerSobolevInclusion (r t) + +theorem continuousOn_expandingReducedField (a b L : ℝ) (u r : ℝ → FourierL2) + (J : Set ℝ) (hu : ContinuousOn u J) (hr : ContinuousOn r J) : + ContinuousOn (expandingReducedField a b L u r) J := by + have hlow := lowerSobolevInclusion.continuous.comp_continuousOn hu + have hgen := lowerSobolevGenerator.continuous.comp_continuousOn hu + have hsource := lowerSobolevInclusion.continuous.comp_continuousOn hr + have hcoef : Continuous (fun t : ℝ => L ^ (-2 : ℝ) * Real.exp (-t)) := by fun_prop + exact ((hlow.const_smul (-(a : ℂ) + Complex.I * b)).add + (hcoef.continuousOn.smul hgen)).add hsource + +/-- A continuous Fourier solution of the exact mode equations is a strong solution +in the space with two fewer Sobolev derivatives. -/ +theorem hasDerivAt_expandingReducedField (a b L A B : ℝ) (u r : ℝ → FourierL2) + (hu : ContinuousOn u (Ioo A B)) (hr : ContinuousOn r (Ioo A B)) + (hmode : ∀ t ∈ Ioo A B, ∀ n : frequencyLattice, + HasDerivAt (fun s => u s n) (expandingModeRate a b L t n * u t n + r t n) t) + (t : ℝ) (ht : t ∈ Ioo A B) : + HasDerivAt (fun s => lowerSobolevInclusion (u s)) + (expandingReducedField a b L u r t) t := by + apply hasDerivAt_fourierL2_of_coordinates _ _ A B t + (continuousOn_expandingReducedField a b L u r (Ioo A B) hu hr) _ ht + intro s hs n + have h := (hmode s hs n).const_mul ((((1 + ‖n‖ ^ 2)⁻¹ : ℝ) : ℂ)) + apply h.congr_deriv + change (((1 + ‖n‖ ^ 2)⁻¹ : ℝ) : ℂ) * + (expandingModeRate a b L s n * u s n + r s n) = + (-(a : ℂ) + Complex.I * b) • (lowerSobolevInclusion (u s) n) + + (L ^ (-2 : ℝ) * Real.exp (-s)) • (lowerSobolevGenerator (u s) n) + + lowerSobolevInclusion (r s) n + simp only [smul_eq_mul, Complex.real_smul, lowerSobolevInclusion_apply, + lowerSobolevGenerator_apply, expandingModeRate] + push_cast + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingTaylorRemainder.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingTaylorRemainder.lean new file mode 100644 index 0000000000000000000000000000000000000000..21156161bb2e33c326bd5825eb734dd9eba7ebfa --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingTaylorRemainder.lean @@ -0,0 +1,82 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingDerivativeBounds + +namespace OAI + +/-! # The quadratic remainder with constants uniform on expanding tori -/ + +open Set Metric + +namespace DefocusingNLS + +noncomputable def expandingNonlinearRemainder (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (m : ℕ) + (q v : FourierL2) : FourierL2 := + expandingOddPower a k L ha ha1 hk hL m (q + v) - + expandingOddPower a k L ha ha1 hk hL m q - + fderiv ℝ (expandingOddPower a k L ha ha1 hk hL m) q v + +@[simp] theorem expandingNonlinearRemainder_zero (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (m : ℕ) + (q : FourierL2) : expandingNonlinearRemainder a k L ha ha1 hk hL m q 0 = 0 := by + simp [expandingNonlinearRemainder] + +theorem hasFDerivAt_expandingNonlinearRemainder (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (m : ℕ) (q v : FourierL2) : + HasFDerivAt (expandingNonlinearRemainder a k L ha ha1 hk hL m q) + (fderiv ℝ (expandingOddPower a k L ha ha1 hk hL m) (q + v) - + fderiv ℝ (expandingOddPower a k L ha ha1 hk hL m) q) v := by + have hN := ((contDiff_expandingOddPower a k L ha ha1 hk hL m).differentiable + (by simp) (q + v)).hasFDerivAt + have hshift : HasFDerivAt (fun z : FourierL2 => q + z) + (ContinuousLinearMap.id ℝ FourierL2) v := (hasFDerivAt_id v).const_add q + have h := ((hN.comp v hshift).sub_const (expandingOddPower a k L ha ha1 hk hL m q)).sub + (fderiv ℝ (expandingOddPower a k L ha ha1 hk hL m) q).hasFDerivAt + convert h using 1 <;> ext z <;> rfl + +/-- One quadratic Lipschitz constant works on every torus with `L ≥ 1`. -/ +theorem exists_expandingNonlinearRemainder_lipschitz (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) (R : ℝ) (hR : 0 ≤ R) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ (L : ℝ) (hL : 1 ≤ L) (q v w : FourierL2), + ‖q‖ ≤ R → ‖v‖ ≤ 1 → ‖w‖ ≤ 1 → + ‖expandingNonlinearRemainder a k L ha ha1 hk hL m q v - + expandingNonlinearRemainder a k L ha ha1 hk hL m q w‖ ≤ + C * (‖v‖ + ‖w‖) * ‖v - w‖ := by + obtain ⟨C, hC, hCb⟩ := exists_expandingOddPower_derivative_lipschitz + a k ha ha1 hk m (R + 1) (by linarith) + refine ⟨C, hC, ?_⟩ + intro L hL q v w hq hv hw + let d := max ‖v‖ ‖w‖ + have hd : d ≤ 1 := max_le hv hw + have hdb : ∀ z ∈ closedBall (0 : FourierL2) d, + ‖fderiv ℝ (expandingOddPower a k L ha ha1 hk hL m) (q + z) - + fderiv ℝ (expandingOddPower a k L ha ha1 hk hL m) q‖ ≤ C * d := by + intro z hz + have hzn : ‖z‖ ≤ d := by simpa using hz + have hqz : ‖q + z‖ ≤ R + 1 := (norm_add_le q z).trans (by linarith) + have h := hCb L hL (q + z) q hqz (by linarith) + simp only [add_sub_cancel_left] at h + exact h.trans (mul_le_mul_of_nonneg_left hzn hC) + have hm := (convex_closedBall (0 : FourierL2) d).norm_image_sub_le_of_norm_hasFDerivWithin_le + (fun z hz => (hasFDerivAt_expandingNonlinearRemainder a k L ha ha1 hk hL m q z).hasFDerivWithinAt) + hdb (show w ∈ closedBall (0 : FourierL2) d by simp [d]) + (show v ∈ closedBall (0 : FourierL2) d by simp [d]) + have hd' : d ≤ ‖v‖ + ‖w‖ := max_le + (le_add_of_nonneg_right (norm_nonneg w)) (le_add_of_nonneg_left (norm_nonneg v)) + exact hm.trans (mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_left hd' hC) (norm_nonneg (v - w))) + +/-- The quadratic remainder estimate has no dependence on the expanding scale. -/ +theorem exists_expandingNonlinearRemainder_quadratic (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) (R : ℝ) (hR : 0 ≤ R) : + ∃ C : ℝ, 0 ≤ C ∧ ∀ (L : ℝ) (hL : 1 ≤ L) (q v : FourierL2), + ‖q‖ ≤ R → ‖v‖ ≤ 1 → + ‖expandingNonlinearRemainder a k L ha ha1 hk hL m q v‖ ≤ C * ‖v‖ ^ 2 := by + obtain ⟨C, hC, hb⟩ := exists_expandingNonlinearRemainder_lipschitz a k ha ha1 hk m R hR + refine ⟨C, hC, ?_⟩ + intro L hL q v hq hv + simpa only [expandingNonlinearRemainder_zero, norm_zero, add_zero, sub_zero, pow_two, mul_assoc] + using hb L hL q v 0 hq hv (by simp) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingTorus.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingTorus.lean new file mode 100644 index 0000000000000000000000000000000000000000..c9b046c54fa57bd10976ae99f893092eedc7ec47 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingTorus.lean @@ -0,0 +1,80 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFourier +import OAI.MathematicalPhysics.DefocusingNLS.Linear.SobolevMultiplication + +namespace OAI + +/-! # Uniform point observation for the expanding-torus norm + +Torus coordinates are normalized by the expanding scale. The coefficient norm +is exactly the volume-weighted `Y_L` norm, with no change of Fourier weight. +-/ + +open Filter Topology + +namespace DefocusingNLS + +noncomputable def expandingTorusTerm (a k L : ℝ) (f : FourierL2) + (n : frequencyLattice) : C(SchrodingerTorus, ℂ) := + expandingFourierCoefficient a k L f n • torusCharacter n + +theorem summable_expandingTorusTerm (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) : + Summable (expandingTorusTerm a k L f) := by + apply Summable.of_norm + simpa [expandingTorusTerm, norm_smul] using + summable_norm_expandingFourierCoefficient a k L ha ha1 hk hL f + +noncomputable def expandingTorusFunction (a k L : ℝ) (f : FourierL2) : + C(SchrodingerTorus, ℂ) := ∑' n, expandingTorusTerm a k L f n + +theorem expandingTorusFunction_apply (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (f : FourierL2) (x : SchrodingerTorus) : + expandingTorusFunction a k L f x = + ∑' n, expandingFourierCoefficient a k L f n * torusCharacter n x := by + have h := (summable_expandingTorusTerm a k L ha ha1 hk hL f).hasSum.mapL + (ContinuousMap.evalCLM (R := ℂ) x) + have h' : HasSum (fun n => expandingFourierCoefficient a k L f n * torusCharacter n x) + (expandingTorusFunction a k L f x) := by + simpa [expandingTorusTerm, expandingTorusFunction, smul_eq_mul] using h + exact h'.tsum_eq.symm + +/-- Uniform convergence of the actual Fourier polynomials in normalized coordinates. -/ +theorem tendstoUniformly_expandingFourierSeries (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) : + TendstoUniformly + (fun S : Finset frequencyLattice => fun x : SchrodingerTorus => + ∑ n ∈ S, expandingFourierCoefficient a k L f n * torusCharacter n x) + (expandingTorusFunction a k L f) atTop := by + have h := (ContinuousMap.isometryEquivBoundedOfCompact SchrodingerTorus ℂ).continuous.continuousAt.tendsto.comp + (summable_expandingTorusTerm a k L ha ha1 hk hL f).hasSum + have hu := BoundedContinuousFunction.tendsto_iff_tendstoUniformly.mp h + change TendstoUniformly + (fun S x => (∑ n ∈ S, expandingTorusTerm a k L f n) x) + (expandingTorusFunction a k L f) atTop at hu + simpa [expandingTorusTerm, ContinuousMap.sum_apply, ContinuousMap.smul_apply, + smul_eq_mul] using hu + +/-- The observation constant is independent of the torus radius. -/ +theorem expandingTorusFunction_norm_le (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (f : FourierL2) : + ‖expandingTorusFunction a k L f‖ ≤ expandingEmbeddingBound a k * ‖f‖ := by + have hs : Summable (fun n => ‖expandingTorusTerm a k L f n‖) := by + simpa [expandingTorusTerm, norm_smul] using + summable_norm_expandingFourierCoefficient a k L ha ha1 hk hL f + calc + _ ≤ ∑' n, ‖expandingTorusTerm a k L f n‖ := norm_tsum_le_tsum_norm hs + _ = ∑' n, ‖expandingFourierCoefficient a k L f n‖ := by + simp [expandingTorusTerm, norm_smul] + _ ≤ _ := tsum_norm_expandingFourierCoefficient_le a k L ha ha1 hk hL f + +theorem expandingTorusFunction_point_bound (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (f : FourierL2) (x : SchrodingerTorus) : + ‖expandingTorusFunction a k L f x‖ ≤ expandingEmbeddingBound a k * ‖f‖ := + (ContinuousMap.norm_coe_le_norm _ x).trans + (expandingTorusFunction_norm_le a k L ha ha1 hk hL f) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingTransferContinuity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingTransferContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..33735e844e41cc9344a4d5b8c77f05470458fb1f --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingTransferContinuity.lean @@ -0,0 +1,60 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingWeightContinuity + +namespace OAI + +/-! # Operator-norm continuity of the weight identification + +Only the positive weight identification is continuous in operator norm. +The free Schrödinger group continues to be used with strong continuity. +-/ + +open Filter Topology +open scoped ENNReal + +namespace DefocusingNLS + +/-- A frequency-independent modulus bounds the diagonal identification operators. -/ +theorem expandingScaleTransfer_from_one_sub_norm_le (a k L M : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hM : 1 ≤ M) : + ‖expandingScaleTransfer a k 1 L ha hk le_rfl hL - + expandingScaleTransfer a k 1 M ha hk le_rfl hM‖ ≤ + |L ^ a - M ^ a| + |L ^ (6 - k) - M ^ (6 - k)| := by + let D := |L ^ a - M ^ a| + |L ^ (6 - k) - M ^ (6 - k)| + have hD : 0 ≤ D := by dsimp [D]; positivity + apply ContinuousLinearMap.opNorm_le_bound _ hD + intro f + calc + _ ≤ ‖D • f‖ := by + apply lp.norm_mono (by norm_num : (2 : ℝ≥0∞) ≠ 0) + intro n + change ‖(expandingScaleRatio a k 1 L n : ℂ) * f n - + (expandingScaleRatio a k 1 M n : ℂ) * f n‖ ≤ ‖D • f n‖ + rw [← sub_mul, ← Complex.ofReal_sub, norm_mul, Complex.norm_real, + Real.norm_eq_abs, norm_smul, Real.norm_eq_abs, abs_of_nonneg hD] + exact mul_le_mul_of_nonneg_right + (expandingScaleRatio_difference_le a k L M hL hM n) (norm_nonneg _) + _ = D * ‖f‖ := by rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg hD] + +/-- Positive-weight identification with `Y_1` is operator-norm continuous in `L`. -/ +theorem continuous_expandingScaleTransfer_from_one (a k : ℝ) (ha : 0 < a) (hk : 8 < k) : + Continuous (fun L : {L : ℝ // 1 ≤ L} => + expandingScaleTransfer a k 1 L.1 ha hk le_rfl L.2) := by + have hlo : Continuous (fun L : {L : ℝ // 1 ≤ L} => L.1 ^ a) := + continuous_subtype_val.rpow_const (fun L => Or.inl (by linarith [L.2] : L.1 ≠ 0)) + have hhi : Continuous (fun L : {L : ℝ // 1 ≤ L} => L.1 ^ (6 - k)) := + continuous_subtype_val.rpow_const (fun L => Or.inl (by linarith [L.2] : L.1 ≠ 0)) + rw [continuous_iff_continuousAt] + intro L₀ + apply tendsto_iff_norm_sub_tendsto_zero.mpr + have hd : Tendsto (fun L : {L : ℝ // 1 ≤ L} => + |L.1 ^ a - L₀.1 ^ a| + |L.1 ^ (6 - k) - L₀.1 ^ (6 - k)|) (𝓝 L₀) (𝓝 0) := by + have hc : Continuous (fun L : {L : ℝ // 1 ≤ L} => + |L.1 ^ a - L₀.1 ^ a| + |L.1 ^ (6 - k) - L₀.1 ^ (6 - k)|) := + ((hlo.sub continuous_const).abs).add ((hhi.sub continuous_const).abs) + simpa only [sub_self, abs_zero, zero_add] using (hc.continuousAt (x := L₀)).tendsto + exact squeeze_zero (fun _ => norm_nonneg _) + (fun L => expandingScaleTransfer_from_one_sub_norm_le a k L.1 L₀.1 ha hk L.2 L₀.2) hd + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingWeakInitialBound.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingWeakInitialBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..3df163bf891a6c8030e280a35006ffa81cf74d75 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingWeakInitialBound.lean @@ -0,0 +1,38 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfileInitial +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousWeakNorm +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousLocalizationPhysical + +namespace OAI + +/-! # A slab-independent norm bound for the initial homogeneous limit -/ + +open Set Filter Topology +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem expandingProfile_weak_initial_norm (a b k T Q M C : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hT : 0 ≤ T) + (m : ℕ) (hQ : 0 ≤ Q) (hC : 0 ≤ C) (χ : 𝓢(E, ℂ)) + (hCb : ∀ (L : ℝ) (hL : 1 ≤ L) (f : FourierL2), + ‖homogeneousLocalizationCLM a k L ha ha1 hk hL χ f‖ ≤ C * ‖f‖) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) + (q : ℕ → C(Icc (0 : ℝ) T, FourierL2)) (hq : ∀ n t, ‖q n t‖ ≤ Q) + (f : ℕ → FourierL2) (hf : ∀ n, ‖f n‖ ≤ M) (v : HomogeneousY a k) + (hv : ∀ ℓ : HomogeneousY a k →L[ℝ] ℂ, + Tendsto (fun n => ℓ (homogeneousLocalizationCLM a k (L n) ha ha1 hk (hL n) χ + (expandingProfileTrajectory a b k (L n) T ha ha1 hk (hL n) hT m Q hQ (q n) + (hq n) (f n) ⟨0, le_rfl, hT⟩))) atTop (𝓝 (ℓ v))) : + ‖v‖ ≤ C * M := by + apply homogeneousY_norm_le_of_weak_limit a k (C * M) ha ha1 hk + (fun n => homogeneousLocalizationCLM a k (L n) ha ha1 hk (hL n) χ (f n)) v + · intro n + exact (hCb (L n) (hL n) (f n)).trans (mul_le_mul_of_nonneg_left (hf n) hC) + · intro ℓ + simpa only [expandingProfileTrajectory_initial] using hv ℓ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingWeakLimitPath.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingWeakLimitPath.lean new file mode 100644 index 0000000000000000000000000000000000000000..4d11bae2941d4613f70bccfc495955f80089cebb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingWeakLimitPath.lean @@ -0,0 +1,44 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingLimitRealization +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousPhysicalIntegrable + +namespace OAI + +/-! # The local space-time limit as a weakly continuous Bochner-measurable Y path -/ + +open Set Filter Topology MeasureTheory +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem expandingLimit_exists_weaklyContinuous_path (a k M T : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hT : 0 ≤ T) + (L : ℕ → ℝ) (hL : ∀ n, 1 ≤ L n) (hLinf : Tendsto L atTop atTop) + (χ : 𝓢(E, ℂ)) (ρ : ℝ) (hρ : 0 < ρ) (hχ : ∀ y : E, ‖y‖ ≤ ρ → χ y = 1) + (u : ℕ → C(Icc (0 : ℝ) T, FourierL2)) (hu : ∀ n t, ‖u n t‖ ≤ M) + (v : C(Icc (0 : ℝ) T × E, ℂ)) + (hv : Tendsto (fun n => expandingSpacetimePath a k (L n) T ha ha1 hk (hL n) (u n)) + atTop (𝓝 v)) : + ∃ C : ℝ, 0 ≤ C ∧ ∃ w : Icc (0 : ℝ) T → HomogeneousY a k, + (∀ t, ‖w t‖ ≤ C * M) ∧ + (∀ t y, homogeneousPhysicalCLM a k ha ha1 hk (w t) y = v (t, y)) ∧ + (∀ ℓ : HomogeneousY a k →L[ℝ] ℂ, Continuous (fun t => ℓ (w t))) ∧ + StronglyMeasurable (fun s : ℝ => w (projIcc 0 T hT s)) ∧ + (∀ (t : Icc (0 : ℝ) T) (ℓ : HomogeneousY a k →L[ℝ] ℂ), + Tendsto (fun n => ℓ (homogeneousLocalizationCLM a k (expandingRadius (L n) t) + ha ha1 hk ((hL n).trans (expandingRadius_ge (L n) t (hL n) t.2.1)) χ (u n t))) + atTop (𝓝 (ℓ (w t)))) := by + obtain ⟨C, hC, h⟩ := expandingLimit_exists_homogeneous_slices a k M T ha ha1 hk + L hL hLinf χ ρ hρ hχ u hu v hv + choose w hw hp hweak using h + have hc (y : E) : Continuous (fun t => homogeneousPhysicalCLM a k ha ha1 hk (w t) y) := + (v.continuous.comp (continuous_id.prodMk continuous_const)).congr + (fun t => (hp t y).symm) + refine ⟨C, hC, w, hw, hp, ?_, ?_, hweak⟩ + · exact fun ℓ => continuous_functional_of_physical a k (C * M) ha ha1 hk w hw hc ℓ + · exact stronglyMeasurable_homogeneous_clamped a k T ha ha1 hk hT w hc + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingWeightAddition.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingWeightAddition.lean new file mode 100644 index 0000000000000000000000000000000000000000..7ea5891484a76432887a0a2ff3ba521b82231ed1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingWeightAddition.lean @@ -0,0 +1,102 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingSobolevWeights +import OAI.MathematicalPhysics.DefocusingNLS.Linear.SobolevProductWeights + +namespace OAI + +/-! # The uniform weight inequality for multiplication in Y_L -/ + +namespace DefocusingNLS + +/-- The positive Fourier weight whose ℓ² norm is exactly the manuscript's `Y_L` norm. -/ +noncomputable def expandingSobolevWeight (a k L : ℝ) (n : frequencyLattice) : ℝ := + (2 * Real.pi) ^ 6 * Real.sqrt (expandingSobolevWeightSq a k L n) + +theorem expandingSobolevWeight_pos (a k L : ℝ) (hL : 1 ≤ L) (n : frequencyLattice) : + 0 < expandingSobolevWeight a k L n := by + unfold expandingSobolevWeight + exact mul_pos (pow_pos (by positivity) _) + (Real.sqrt_pos.2 (expandingSobolevWeightSq_pos a k L hL n)) + +theorem expandingSobolevWeight_sq (a k L : ℝ) (hL : 1 ≤ L) (n : frequencyLattice) : + expandingSobolevWeight a k L n ^ 2 = + (2 * Real.pi) ^ 12 * expandingSobolevWeightSq a k L n := by + unfold expandingSobolevWeight + rw [mul_pow, Real.sq_sqrt (expandingSobolevWeightSq_pos a k L hL n).le, ← pow_mul] + +private theorem norm_rpow_add_le (k : ℝ) (hk : 8 < k) (m n : frequencyLattice) : + ‖m + n‖ ^ (2 * k) ≤ 4 ^ k * (‖m‖ ^ (2 * k) + ‖n‖ ^ (2 * k)) := by + have hm : ‖m‖ ≤ max ‖m‖ ‖n‖ := le_max_left _ _ + have hn : ‖n‖ ≤ max ‖m‖ ‖n‖ := le_max_right _ _ + have hs : ‖m + n‖ ≤ 2 * max ‖m‖ ‖n‖ := by linarith [norm_add_le m n] + have he : 0 ≤ 2 * k := by linarith + calc + _ ≤ (2 * max ‖m‖ ‖n‖) ^ (2 * k) := + Real.rpow_le_rpow (norm_nonneg _) hs he + _ = 4 ^ k * max (‖m‖ ^ (2 * k)) (‖n‖ ^ (2 * k)) := by + rw [Real.mul_rpow (by norm_num) (by positivity), + Real.rpow_max (norm_nonneg _) (norm_nonneg _) he] + congr 1 + rw [Real.rpow_mul (by norm_num : 0 ≤ (2 : ℝ))] + norm_num + _ ≤ _ := mul_le_mul_of_nonneg_left (max_le + (le_add_of_nonneg_right (by positivity)) (le_add_of_nonneg_left (by positivity))) + (by positivity) + +/-- The squared weight has an addition constant independent of the growing torus scale. -/ +theorem expandingSobolevWeightSq_add_le (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (m n : frequencyLattice) : + expandingSobolevWeightSq a k L (m + n) ≤ + 4 ^ k * (expandingSobolevWeightSq a k L m + expandingSobolevWeightSq a k L n) := by + have hl := sobolevProductWeight_add_le (2 * (6 - a)) (by linarith) m n + have hl' : (1 + ‖m + n‖ ^ 2) ^ (6 - a) ≤ + 4 ^ (6 - a) * ((1 + ‖m‖ ^ 2) ^ (6 - a) + (1 + ‖n‖ ^ 2) ^ (6 - a)) := by + have he : 2 * (6 - a) / 2 = 6 - a := by ring + simpa only [sobolevProductWeight, he] using hl + have hc : (4 : ℝ) ^ (6 - a) ≤ 4 ^ k := + Real.rpow_le_rpow_of_exponent_le (by norm_num) (by linarith) + have hl'' : (1 + ‖m + n‖ ^ 2) ^ (6 - a) ≤ + 4 ^ k * ((1 + ‖m‖ ^ 2) ^ (6 - a) + (1 + ‖n‖ ^ 2) ^ (6 - a)) := + hl'.trans (mul_le_mul_of_nonneg_right hc (by positivity)) + have hh := norm_rpow_add_le k hk m n + unfold expandingSobolevWeightSq + calc + _ ≤ L ^ (2 * a) * (4 ^ k * + ((1 + ‖m‖ ^ 2) ^ (6 - a) + (1 + ‖n‖ ^ 2) ^ (6 - a))) + + L ^ (12 - 2 * k) * (4 ^ k * (‖m‖ ^ (2 * k) + ‖n‖ ^ (2 * k))) := + add_le_add (mul_le_mul_of_nonneg_left hl'' (by positivity)) + (mul_le_mul_of_nonneg_left hh (by positivity)) + _ = _ := by ring + +/-- The exact positive weight satisfies the two-term Young convolution inequality. -/ +theorem expandingSobolevWeight_add_le (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (m n : frequencyLattice) : + expandingSobolevWeight a k L (m + n) ≤ + Real.sqrt (4 ^ k) * (expandingSobolevWeight a k L m + expandingSobolevWeight a k L n) := by + have h := Real.sqrt_le_sqrt (expandingSobolevWeightSq_add_le a k L ha ha1 hk hL m n) + rw [Real.sqrt_mul (by positivity)] at h + have hm := (expandingSobolevWeightSq_pos a k L hL m).le + have hn := (expandingSobolevWeightSq_pos a k L hL n).le + have hsum : Real.sqrt (expandingSobolevWeightSq a k L m + expandingSobolevWeightSq a k L n) ≤ + Real.sqrt (expandingSobolevWeightSq a k L m) + + Real.sqrt (expandingSobolevWeightSq a k L n) := by + have hms := Real.sq_sqrt hm + have hns := Real.sq_sqrt hn + have hss := Real.sq_sqrt (add_nonneg hm hn) + have hmn := mul_nonneg (Real.sqrt_nonneg (expandingSobolevWeightSq a k L m)) + (Real.sqrt_nonneg (expandingSobolevWeightSq a k L n)) + nlinarith [Real.sqrt_nonneg (expandingSobolevWeightSq a k L m), + Real.sqrt_nonneg (expandingSobolevWeightSq a k L n), + Real.sqrt_nonneg (expandingSobolevWeightSq a k L m + expandingSobolevWeightSq a k L n)] + unfold expandingSobolevWeight + calc + _ ≤ (2 * Real.pi) ^ 6 * (Real.sqrt (4 ^ k) * + Real.sqrt (expandingSobolevWeightSq a k L m + expandingSobolevWeightSq a k L n)) := + mul_le_mul_of_nonneg_left h (by positivity) + _ ≤ (2 * Real.pi) ^ 6 * (Real.sqrt (4 ^ k) * + (Real.sqrt (expandingSobolevWeightSq a k L m) + + Real.sqrt (expandingSobolevWeightSq a k L n))) := by gcongr + _ = _ := by ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingWeightContinuity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingWeightContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..7746c05844e3528cc4bfc72e63705ea1f36e9754 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingWeightContinuity.lean @@ -0,0 +1,102 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingScaleTransfer + +namespace OAI + +/-! # Uniform continuity estimates for the exact expanding weights + +The weight is the Euclidean norm of two scalar power components. This gives +one frequency-independent modulus of continuity for the scale-transfer map. +-/ + +namespace DefocusingNLS + +private noncomputable def expandingWeightProfile (a k L : ℝ) (n : frequencyLattice) : ℂ := + ⟨L ^ a * Real.sqrt ((1 + ‖n‖ ^ 2) ^ (6 - a)), + L ^ (6 - k) * Real.sqrt (‖n‖ ^ (2 * k))⟩ + +private theorem norm_expandingWeightProfile (a k L : ℝ) (hL : 1 ≤ L) + (n : frequencyLattice) : + ‖expandingWeightProfile a k L n‖ = Real.sqrt (expandingSobolevWeightSq a k L n) := by + have hlow : (L ^ a) ^ 2 = L ^ (2 * a) := by + rw [← Real.rpow_natCast, ← Real.rpow_mul (by linarith : 0 ≤ L)] + congr 1 + ring + have hhigh : (L ^ (6 - k)) ^ 2 = L ^ (12 - 2 * k) := by + rw [← Real.rpow_natCast, ← Real.rpow_mul (by linarith : 0 ≤ L)] + congr 1 + ring + rw [Complex.norm_eq_sqrt_sq_add_sq] + congr 1 + change (L ^ a * Real.sqrt ((1 + ‖n‖ ^ 2) ^ (6 - a))) ^ 2 + + (L ^ (6 - k) * Real.sqrt (‖n‖ ^ (2 * k))) ^ 2 = _ + rw [mul_pow, mul_pow, hlow, hhigh, + Real.sq_sqrt (by positivity : 0 ≤ (1 + ‖n‖ ^ 2) ^ (6 - a)), + Real.sq_sqrt (by positivity : 0 ≤ ‖n‖ ^ (2 * k))] + rfl + +private theorem expandingSobolevWeight_eq_profile (a k L : ℝ) (hL : 1 ≤ L) + (n : frequencyLattice) : + expandingSobolevWeight a k L n = (2 * Real.pi) ^ 6 * ‖expandingWeightProfile a k L n‖ := by + rw [norm_expandingWeightProfile a k L hL n] + rfl + +/-- One modulus controls every Fourier weight relative to the radius-one weight. -/ +theorem expandingSobolevWeight_difference_le (a k L M : ℝ) + (hL : 1 ≤ L) (hM : 1 ≤ M) (n : frequencyLattice) : + |expandingSobolevWeight a k L n - expandingSobolevWeight a k M n| ≤ + (|L ^ a - M ^ a| + |L ^ (6 - k) - M ^ (6 - k)|) * + expandingSobolevWeight a k 1 n := by + let A := Real.sqrt ((1 + ‖n‖ ^ 2) ^ (6 - a)) + let B := Real.sqrt (‖n‖ ^ (2 * k)) + have hA : 0 ≤ A := Real.sqrt_nonneg _ + have hB : 0 ≤ B := Real.sqrt_nonneg _ + have hA1 : A ≤ ‖expandingWeightProfile a k 1 n‖ := by + have h := Complex.abs_re_le_norm (expandingWeightProfile a k 1 n) + have hre : (expandingWeightProfile a k 1 n).re = A := by + simp only [expandingWeightProfile, Real.one_rpow, one_mul]; rfl + rw [hre] at h + simpa only [abs_of_nonneg hA] using h + have hB1 : B ≤ ‖expandingWeightProfile a k 1 n‖ := by + have h := Complex.abs_im_le_norm (expandingWeightProfile a k 1 n) + have him : (expandingWeightProfile a k 1 n).im = B := by + simp only [expandingWeightProfile, Real.one_rpow, one_mul]; rfl + rw [him] at h + simpa only [abs_of_nonneg hB] using h + have hdiff : ‖expandingWeightProfile a k L n - expandingWeightProfile a k M n‖ ≤ + |L ^ a - M ^ a| * A + |L ^ (6 - k) - M ^ (6 - k)| * B := by + convert Complex.norm_le_abs_re_add_abs_im + (expandingWeightProfile a k L n - expandingWeightProfile a k M n) using 1 + simp only [expandingWeightProfile, Complex.sub_re, Complex.sub_im] + rw [← sub_mul, ← sub_mul, abs_mul, abs_mul, + abs_of_nonneg hA, abs_of_nonneg hB] + have hnorm : |‖expandingWeightProfile a k L n‖ - ‖expandingWeightProfile a k M n‖| ≤ + (|L ^ a - M ^ a| + |L ^ (6 - k) - M ^ (6 - k)|) * + ‖expandingWeightProfile a k 1 n‖ := by + apply (abs_norm_sub_norm_le _ _).trans (hdiff.trans _) + nlinarith [mul_le_mul_of_nonneg_left hA1 (abs_nonneg (L ^ a - M ^ a)), + mul_le_mul_of_nonneg_left hB1 (abs_nonneg (L ^ (6 - k) - M ^ (6 - k)))] + rw [expandingSobolevWeight_eq_profile a k L hL n, + expandingSobolevWeight_eq_profile a k M hM n, + expandingSobolevWeight_eq_profile a k 1 le_rfl n, ← mul_sub, abs_mul, + abs_of_nonneg (by positivity : 0 ≤ (2 * Real.pi) ^ 6)] + calc + _ ≤ (2 * Real.pi) ^ 6 * + ((|L ^ a - M ^ a| + |L ^ (6 - k) - M ^ (6 - k)|) * + ‖expandingWeightProfile a k 1 n‖) := + mul_le_mul_of_nonneg_left hnorm (by positivity) + _ = _ := by ring + +/-- The diagonal transfer coefficients have a common modulus in the scale. -/ +theorem expandingScaleRatio_difference_le (a k L M : ℝ) + (hL : 1 ≤ L) (hM : 1 ≤ M) (n : frequencyLattice) : + |expandingScaleRatio a k 1 L n - expandingScaleRatio a k 1 M n| ≤ + |L ^ a - M ^ a| + |L ^ (6 - k) - M ^ (6 - k)| := by + unfold expandingScaleRatio + rw [← sub_div, abs_div, + abs_of_pos (expandingSobolevWeight_pos a k 1 le_rfl n)] + apply (div_le_iff₀ (expandingSobolevWeight_pos a k 1 le_rfl n)).2 + exact expandingSobolevWeight_difference_le a k L M hL hM n + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingWeightIdentification.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingWeightIdentification.lean new file mode 100644 index 0000000000000000000000000000000000000000..9212473bd23b306a87993a58e00b2d22836b9a0e --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingWeightIdentification.lean @@ -0,0 +1,144 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingTransferContinuity +import Mathlib.Analysis.Normed.Ring.Units + +namespace OAI + +/-! # The two-sided identification between exact expanding Sobolev spaces + +The radius-one weight identifies every `Y_L`, `L ≥ 1`, with the same Hilbert +space. Both this identification and its inverse depend continuously on `L`. +-/ + +open Filter Topology +open scoped ENNReal + +namespace DefocusingNLS + +/-- The inverse identification loses at most the explicit high-frequency scale factor. -/ +theorem expandingSobolevWeight_one_le (a k L : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (n : frequencyLattice) : + expandingSobolevWeight a k 1 n ≤ L ^ (k - 6) * expandingSobolevWeight a k L n := by + have hLp : 0 < L := by linarith + have hcancel : L ^ (2 * k - 12) * L ^ (12 - 2 * k) = 1 := by + rw [← Real.rpow_add hLp, + show (2 * k - 12) + (12 - 2 * k) = 0 by ring, Real.rpow_zero] + have hlo : 1 ≤ L ^ (2 * k - 12) * L ^ (2 * a) := by + rw [← Real.rpow_add hLp] + exact Real.one_le_rpow hL (by linarith) + have hsq : expandingSobolevWeightSq a k 1 n ≤ + L ^ (2 * k - 12) * expandingSobolevWeightSq a k L n := by + unfold expandingSobolevWeightSq + simp only [Real.one_rpow, one_mul] + rw [mul_add, ← mul_assoc, ← mul_assoc, hcancel, one_mul] + exact add_le_add (le_mul_of_one_le_left (by positivity) hlo) le_rfl + have hp : (L ^ (k - 6)) ^ 2 = L ^ (2 * k - 12) := by + rw [← Real.rpow_natCast, ← Real.rpow_mul hLp.le] + congr 1 + ring + have hsqrt := Real.sqrt_le_sqrt hsq + rw [← hp, Real.sqrt_mul (sq_nonneg _), + Real.sqrt_sq (Real.rpow_nonneg hLp.le _)] at hsqrt + unfold expandingSobolevWeight + nlinarith [mul_le_mul_of_nonneg_left hsqrt + (show 0 ≤ (2 * Real.pi) ^ 6 by positivity)] + +noncomputable def expandingInverseRatio (a k L : ℝ) (n : frequencyLattice) : ℝ := + expandingSobolevWeight a k 1 n / expandingSobolevWeight a k L n + +theorem expandingInverseRatio_nonneg (a k L : ℝ) (hL : 1 ≤ L) (n : frequencyLattice) : + 0 ≤ expandingInverseRatio a k L n := by + exact (div_pos (expandingSobolevWeight_pos a k 1 le_rfl n) + (expandingSobolevWeight_pos a k L hL n)).le + +theorem expandingInverseRatio_le (a k L : ℝ) (ha : 0 < a) (hk : 8 < k) + (hL : 1 ≤ L) (n : frequencyLattice) : expandingInverseRatio a k L n ≤ L ^ (k - 6) := by + apply (div_le_iff₀ (expandingSobolevWeight_pos a k L hL n)).2 + exact expandingSobolevWeight_one_le a k L ha hk hL n + +noncomputable def expandingInverseVector (a k L : ℝ) (ha : 0 < a) (hk : 8 < k) + (hL : 1 ≤ L) (f : FourierL2) : FourierL2 := + ⟨fun n => (expandingInverseRatio a k L n : ℂ) * f n, by + apply (lp.memℓp ((L ^ (k - 6) : ℝ) • f)).mono' + intro n + simp only [lp.coeFn_smul, Pi.smul_apply, norm_smul, Real.norm_eq_abs, norm_mul, + Complex.norm_real, abs_of_nonneg (expandingInverseRatio_nonneg a k L hL n)] + exact mul_le_mul_of_nonneg_right ((expandingInverseRatio_le a k L ha hk hL n).trans + (le_abs_self _)) (norm_nonneg _)⟩ + +theorem expandingInverseVector_norm_le (a k L : ℝ) (ha : 0 < a) (hk : 8 < k) + (hL : 1 ≤ L) (f : FourierL2) : + ‖expandingInverseVector a k L ha hk hL f‖ ≤ L ^ (k - 6) * ‖f‖ := by + calc + _ ≤ ‖(L ^ (k - 6) : ℝ) • f‖ := by + apply lp.norm_mono (by norm_num : (2 : ℝ≥0∞) ≠ 0) + intro n + change ‖(expandingInverseRatio a k L n : ℂ) * f n‖ ≤ ‖(L ^ (k - 6) : ℝ) • f n‖ + rw [norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (expandingInverseRatio_nonneg a k L hL n), norm_smul, Real.norm_eq_abs] + exact mul_le_mul_of_nonneg_right ((expandingInverseRatio_le a k L ha hk hL n).trans + (le_abs_self _)) (norm_nonneg _) + _ = _ := by rw [norm_smul, Real.norm_eq_abs, + abs_of_nonneg (Real.rpow_nonneg (by linarith : 0 ≤ L) _)] + +noncomputable def expandingInverseTransfer (a k L : ℝ) (ha : 0 < a) (hk : 8 < k) + (hL : 1 ≤ L) : FourierL2 →L[ℂ] FourierL2 := + LinearMap.mkContinuous + { toFun := expandingInverseVector a k L ha hk hL + map_add' := by + intro f g + ext n + change (expandingInverseRatio a k L n : ℂ) * (f n + g n) = _ + simp only [mul_add] + rfl + map_smul' := by + intro c f + ext n + change (expandingInverseRatio a k L n : ℂ) * (c * f n) = + c * ((expandingInverseRatio a k L n : ℂ) * f n) + ring } + (L ^ (k - 6)) (expandingInverseVector_norm_le a k L ha hk hL) + +/-- Two-sided inverse of the canonical radius-one identification. -/ +noncomputable def expandingWeightUnit (a k L : ℝ) (ha : 0 < a) (hk : 8 < k) + (hL : 1 ≤ L) : (FourierL2 →L[ℂ] FourierL2)ˣ where + val := expandingScaleTransfer a k 1 L ha hk le_rfl hL + inv := expandingInverseTransfer a k L ha hk hL + val_inv := by + ext f n + change (expandingScaleRatio a k 1 L n : ℂ) * + ((expandingInverseRatio a k L n : ℂ) * f n) = f n + unfold expandingScaleRatio expandingInverseRatio + push_cast + have h1 := (Complex.ofReal_ne_zero.mpr (expandingSobolevWeight_pos a k 1 le_rfl n).ne') + have hL' := (Complex.ofReal_ne_zero.mpr (expandingSobolevWeight_pos a k L hL n).ne') + field_simp + inv_val := by + ext f n + change (expandingInverseRatio a k L n : ℂ) * + ((expandingScaleRatio a k 1 L n : ℂ) * f n) = f n + unfold expandingScaleRatio expandingInverseRatio + push_cast + have h1 := (Complex.ofReal_ne_zero.mpr (expandingSobolevWeight_pos a k 1 le_rfl n).ne') + have hL' := (Complex.ofReal_ne_zero.mpr (expandingSobolevWeight_pos a k L hL n).ne') + field_simp + +theorem continuous_expandingInverseTransfer (a k : ℝ) (ha : 0 < a) (hk : 8 < k) : + Continuous (fun L : {L : ℝ // 1 ≤ L} => expandingInverseTransfer a k L.1 ha hk L.2) := by + have heq (L : {L : ℝ // 1 ≤ L}) : + Ring.inverse (expandingScaleTransfer a k 1 L.1 ha hk le_rfl L.2) = + expandingInverseTransfer a k L.1 ha hk L.2 := + Ring.inverse_unit (expandingWeightUnit a k L.1 ha hk L.2) + have hc : Continuous (fun L : {L : ℝ // 1 ≤ L} => + Ring.inverse (expandingScaleTransfer a k 1 L.1 ha hk le_rfl L.2)) := by + rw [continuous_iff_continuousAt] + intro L + have hi : ContinuousAt (Ring.inverse : (FourierL2 →L[ℂ] FourierL2) → + (FourierL2 →L[ℂ] FourierL2)) + (expandingScaleTransfer a k 1 L.1 ha hk le_rfl L.2) := + NormedRing.inverse_continuousAt (expandingWeightUnit a k L.1 ha hk L.2) + exact hi.comp ((continuous_expandingScaleTransfer_from_one a k ha hk).continuousAt (x := L)) + simpa only [heq] using hc + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingWeightProduct.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingWeightProduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..78158fba1142892a839ebbc28801350ca8bc52da --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingWeightProduct.lean @@ -0,0 +1,164 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingOneDimensional +import Mathlib.Algebra.BigOperators.Ring.Finset + +namespace OAI + +/-! # A separable majorant for the expanding-torus inverse weight -/ + +open Set + +namespace DefocusingNLS + +theorem expandingOneDimWeight_coordinate_le (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) + (n : frequencyLattice) (j : Fin 12) : + expandingOneDimWeight a k L (frequencyCoordinates n j) ≤ + L ^ (a / 6) * (1 + ‖n‖ ^ 2) ^ ((6 - a) / 12) + + L ^ (1 - k / 6) * ‖n‖ ^ (k / 6) := by + have hs := frequencyCoordinates_sq_le n j + have hn : |(frequencyCoordinates n j : ℝ)| ≤ ‖n‖ := by + nlinarith [sq_abs (frequencyCoordinates n j : ℝ), norm_nonneg n, + abs_nonneg (frequencyCoordinates n j : ℝ)] + unfold expandingOneDimWeight + apply add_le_add + · exact mul_le_mul_of_nonneg_left + (Real.rpow_le_rpow (by positivity) (add_le_add le_rfl hs) (by linarith)) + (by positivity) + · exact mul_le_mul_of_nonneg_left + (Real.rpow_le_rpow (abs_nonneg _) hn (by linarith)) (by positivity) + +theorem expandingWeight_product_le (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (n : frequencyLattice) : + (∏ j : Fin 12, expandingOneDimWeight a k L (frequencyCoordinates n j)) ≤ + 2 ^ 12 * expandingSobolevWeightSq a k L n := by + let A := L ^ (a / 6) * (1 + ‖n‖ ^ 2) ^ ((6 - a) / 12) + let B := L ^ (1 - k / 6) * ‖n‖ ^ (k / 6) + have hA : 0 ≤ A := by dsimp [A]; positivity + have hB : 0 ≤ B := by dsimp [B]; positivity + have hAp : A ^ 12 = L ^ (2 * a) * (1 + ‖n‖ ^ 2) ^ (6 - a) := by + dsimp [A] + rw [mul_pow] + congr 1 + · rw [← Real.rpow_natCast, ← Real.rpow_mul (by linarith : 0 ≤ L)] + congr 1 + ring + · have he : ((6 - a) / 12) * (12 : ℝ) = 6 - a := by ring + rw [← Real.rpow_natCast] + have hh := (Real.rpow_mul (x := 1 + ‖n‖ ^ 2) (by positivity) ((6 - a) / 12) 12).symm + rw [he] at hh + exact hh + have hBp : B ^ 12 = L ^ (12 - 2 * k) * ‖n‖ ^ (2 * k) := by + dsimp [B] + rw [mul_pow] + congr 1 + · rw [← Real.rpow_natCast, ← Real.rpow_mul (by linarith : 0 ≤ L)] + congr 1 + ring + · have he : (k / 6) * (12 : ℝ) = 2 * k := by ring + rw [← Real.rpow_natCast] + have hh := (Real.rpow_mul (x := ‖n‖) (norm_nonneg n) (k / 6) 12).symm + rw [he] at hh + exact hh + have hpow : (A + B) ^ 12 ≤ (2 : ℝ) ^ 12 * (A ^ 12 + B ^ 12) := by + rcases le_total A B with h | h + · calc + _ ≤ (2 * B) ^ 12 := by gcongr; linarith + _ = (2 : ℝ) ^ 12 * B ^ 12 := mul_pow _ _ _ + _ ≤ _ := mul_le_mul_of_nonneg_left + (le_add_of_nonneg_left (pow_nonneg hA 12)) (by positivity) + · calc + _ ≤ (2 * A) ^ 12 := by gcongr; linarith + _ = (2 : ℝ) ^ 12 * A ^ 12 := mul_pow _ _ _ + _ ≤ _ := mul_le_mul_of_nonneg_left + (le_add_of_nonneg_right (pow_nonneg hB 12)) (by positivity) + calc + _ ≤ ∏ _ : Fin 12, (A + B) := by + apply Finset.prod_le_prod₀ + · intro j _ + exact (expandingOneDimWeight_pos a k L _ hL).le + · intro j _ + exact expandingOneDimWeight_coordinate_le a k L ha ha1 hk hL n j + _ = (A + B) ^ 12 := by simp + _ ≤ (2 : ℝ) ^ 12 * (A ^ 12 + B ^ 12) := hpow + _ = _ := by rw [hAp, hBp]; rfl + +/-- The inverse radial weight is dominated by a product with a uniform integer sum. -/ +theorem expandingSobolevWeight_inv_le_product (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (n : frequencyLattice) : + (expandingSobolevWeightSq a k L n)⁻¹ ≤ + 2 ^ 12 * ∏ j : Fin 12, expandingOneDimKernel a k L (frequencyCoordinates n j) := by + have hp : 0 < ∏ j : Fin 12, expandingOneDimWeight a k L (frequencyCoordinates n j) := + Finset.prod_pos (fun j _ => expandingOneDimWeight_pos a k L _ hL) + have h := (div_le_div_iff₀ (expandingSobolevWeightSq_pos a k L hL n) hp).mpr + (show (1 : ℝ) * (∏ j : Fin 12, expandingOneDimWeight a k L (frequencyCoordinates n j)) ≤ + 2 ^ 12 * expandingSobolevWeightSq a k L n by + simpa only [one_mul] using expandingWeight_product_le a k L ha ha1 hk hL n) + simpa only [one_div, one_mul, div_eq_mul_inv, Finset.prod_inv_distrib, expandingOneDimKernel] using h + +private theorem frequencyCoordinates_injective : Function.Injective frequencyCoordinates := by + intro n m h + apply Subtype.ext + ext j + have hc := congrFun h j + exact_mod_cast (frequencyCoordinates_coe n j).symm.trans + ((congrArg (fun z : ℤ => (z : ℝ)) hc).trans (frequencyCoordinates_coe m j)) + +/-- Summing the separable majorant uses only finite products and the one-dimensional sum. -/ +theorem sum_expandingKernel_product_le (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) (S : Finset frequencyLattice) : + (∑ n ∈ S, ∏ j : Fin 12, expandingOneDimKernel a k L (frequencyCoordinates n j)) ≤ + (1 + 2 * (1 / (a / 6) + 1 / (k / 6 - 1))) ^ 12 := by + classical + let K : ℤ → ℝ := fun z => expandingOneDimKernel a k L z + let U : Finset ℤ := S.biUnion (fun n => Finset.univ.image (frequencyCoordinates n)) + let T : Finset (Fin 12 → ℤ) := S.image frequencyCoordinates + have hTU : T ⊆ Fintype.piFinset (fun _ : Fin 12 => U) := by + intro p hp + obtain ⟨n, hn, rfl⟩ := Finset.mem_image.mp hp + simp only [Fintype.mem_piFinset] + intro j + exact Finset.mem_biUnion.mpr ⟨n, hn, Finset.mem_image.mpr ⟨j, Finset.mem_univ _, rfl⟩⟩ + obtain ⟨hKs, hKb⟩ := expandingOneDimKernel_integer_sum_bound a k L ha ha1 hk hL + have hU : (∑ z ∈ U, K z) ≤ 1 + 2 * (1 / (a / 6) + 1 / (k / 6 - 1)) := + (hKs.sum_le_tsum U (fun z _ => expandingOneDimKernel_nonneg a k L z hL)).trans hKb + have hUnonneg : 0 ≤ ∑ z ∈ U, K z := + Finset.sum_nonneg (fun z _ => expandingOneDimKernel_nonneg a k L z hL) + calc + _ = ∑ p ∈ T, ∏ j : Fin 12, K (p j) := by + rw [Finset.sum_image] + exact fun _ _ _ _ h => frequencyCoordinates_injective h + _ ≤ ∑ p ∈ Fintype.piFinset (fun _ : Fin 12 => U), ∏ j : Fin 12, K (p j) := + Finset.sum_le_sum_of_subset_of_nonneg hTU (fun _ _ _ => by + apply Finset.prod_nonneg + intro j _ + exact expandingOneDimKernel_nonneg a k L _ hL) + _ = (∑ z ∈ U, K z) ^ 12 := by + rw [Finset.sum_prod_piFinset] + simp + _ ≤ _ := by gcongr + +/-- The exact normalized inverse weights have a scale-independent summability bound. -/ +theorem summable_expandingSobolevWeight_inv (a k L : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hL : 1 ≤ L) : + Summable (fun n : frequencyLattice => (expandingSobolevWeightSq a k L n)⁻¹) ∧ + (∑' n : frequencyLattice, (expandingSobolevWeightSq a k L n)⁻¹) ≤ + 2 ^ 12 * (1 + 2 * (1 / (a / 6) + 1 / (k / 6 - 1))) ^ 12 := by + have hnon : ∀ n : frequencyLattice, 0 ≤ (expandingSobolevWeightSq a k L n)⁻¹ := + fun n => (inv_pos.mpr (expandingSobolevWeightSq_pos a k L hL n)).le + have hb (S : Finset frequencyLattice) : + (∑ n ∈ S, (expandingSobolevWeightSq a k L n)⁻¹) ≤ + 2 ^ 12 * (1 + 2 * (1 / (a / 6) + 1 / (k / 6 - 1))) ^ 12 := by + calc + _ ≤ ∑ n ∈ S, 2 ^ 12 * ∏ j : Fin 12, + expandingOneDimKernel a k L (frequencyCoordinates n j) := + Finset.sum_le_sum (fun n _ => expandingSobolevWeight_inv_le_product a k L ha ha1 hk hL n) + _ = 2 ^ 12 * (∑ n ∈ S, ∏ j : Fin 12, + expandingOneDimKernel a k L (frequencyCoordinates n j)) := by rw [Finset.mul_sum] + _ ≤ _ := mul_le_mul_of_nonneg_left (sum_expandingKernel_product_le a k L ha ha1 hk hL S) + (by positivity) + have hs := summable_of_sum_le hnon hb + exact ⟨hs, hs.tsum_le_of_sum_le hb⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingWeightedDuhamel.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingWeightedDuhamel.lean new file mode 100644 index 0000000000000000000000000000000000000000..4976e1f6c92611205dd1e2baad126e811f84590b --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingWeightedDuhamel.lean @@ -0,0 +1,51 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingDuhamel +import Mathlib.Analysis.SpecialFunctions.Integrals.Basic + +namespace OAI + +/-! # Exponentially weighted inhomogeneous estimates + +The Bielecki weight gives a contraction on any finite time slab. The +constant depends on the reaction bound, while the starting radius drops out. +-/ + +open Set MeasureTheory + +namespace DefocusingNLS + +private theorem integral_exp_mul_Icc (η t : ℝ) (hη : 0 < η) (ht : 0 ≤ t) : + (∫ τ in Icc 0 t, Real.exp (η * τ)) = η⁻¹ * (Real.exp (η * t) - 1) := by + rw [integral_Icc_eq_integral_Ioc, ← intervalIntegral.integral_of_le ht] + rw [intervalIntegral.integral_comp_mul_left Real.exp hη.ne', integral_exp] + simp only [mul_zero, Real.exp_zero, smul_eq_mul] + +/-- A forcing bounded by `C exp(η t)` has weighted response at most `C/η`. -/ +theorem expandingDuhamel_weighted_norm_le (a b k L η t C : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hη : 0 < η) (ht : 0 ≤ t) (hC : 0 ≤ C) + (r : ℝ → FourierL2) (hbound : ∀ τ ∈ Icc 0 t, ‖r τ‖ ≤ C * Real.exp (η * τ)) : + Real.exp (-η * t) * ‖expandingDuhamel a b k L ha hk hL t r‖ ≤ C / η := by + have hg : IntegrableOn (fun τ => C * Real.exp (η * τ)) (Icc 0 t) := + (continuous_const.mul (Real.continuous_exp.comp (continuous_const.mul continuous_id))).continuousOn.integrableOn_compact + isCompact_Icc + have hi : ‖expandingDuhamel a b k L ha hk hL t r‖ ≤ + ∫ τ in Icc 0 t, C * Real.exp (η * τ) := by + apply norm_integral_le_of_norm_le hg + filter_upwards [ae_restrict_mem measurableSet_Icc] with τ hτ + rw [expandingDuhamelIntegrand_of_mem _ _ _ _ _ _ _ _ _ _ hτ] + apply (expandingFreeStep_norm_bound a b k (expandingRadius L τ) (t - τ) ha hk + (hL.trans (expandingRadius_ge L τ hL hτ.1)) (sub_nonneg.mpr hτ.2) (r τ)).trans + exact (mul_le_of_le_one_left (norm_nonneg _) (Real.exp_le_one_iff.mpr (by + nlinarith [hτ.2]))).trans (hbound τ hτ) + rw [integral_const_mul, integral_exp_mul_Icc η t hη ht] at hi + have he : Real.exp (-η * t) * Real.exp (η * t) = 1 := by + rw [← Real.exp_add, show -η * t + η * t = 0 by ring, Real.exp_zero] + calc + _ ≤ Real.exp (-η * t) * (C * (η⁻¹ * (Real.exp (η * t) - 1))) := + mul_le_mul_of_nonneg_left hi (Real.exp_pos _).le + _ = (C / η) * (Real.exp (-η * t) * Real.exp (η * t) - Real.exp (-η * t)) := by ring + _ = (C / η) * (1 - Real.exp (-η * t)) := by rw [he] + _ ≤ C / η := mul_le_of_le_one_right (div_nonneg hC hη.le) (by linarith [Real.exp_pos (-η * t)]) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingWeightedLocal.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingWeightedLocal.lean new file mode 100644 index 0000000000000000000000000000000000000000..e46afe25637fe89bbfe358a4e0e6643c98a933c9 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/ExpandingWeightedLocal.lean @@ -0,0 +1,104 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingProfileResponse + +namespace OAI + +/-! # Local estimates for the exponentially weighted Picard map + +The Lipschitz estimate is needed only along the two paths being compared. +This permits the polynomial nonlinearity to be used on a bounded path ball +without replacing it by a globally Lipschitz map. +-/ + +open Set + +namespace DefocusingNLS + +attribute [local irreducible] expandingFreeStep + +theorem expandingBieleckiPicard_pair_dist_le (a b k L T η : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) (hη : 0 < η) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) (u₀ : FourierL2) + (K : ℝ) (hK : 0 ≤ K) (u v : C(Icc (0 : ℝ) T, FourierL2)) + (hF : ∀ t, + ‖F (t, expandingTimeWeight T η u t) - F (t, expandingTimeWeight T η v t)‖ ≤ + K * ‖expandingTimeWeight T η u t - expandingTimeWeight T η v t‖) : + dist (expandingBieleckiPicard a b k L T η ha hk hL hT F u₀ u) + (expandingBieleckiPicard a b k L T η ha hk hL hT F u₀ v) ≤ K / η * dist u v := by + apply (ContinuousMap.dist_le (mul_nonneg (div_nonneg hK hη.le) dist_nonneg)).2 + intro t + let ru := expandingBieleckiHistory T η hT F u + let rv := expandingBieleckiHistory T η hT F v + have hru : Continuous ru := continuous_expandingBieleckiHistory T η hT F u + have hrv : Continuous rv := continuous_expandingBieleckiHistory T η hT F v + have hbound : ∀ τ ∈ Icc (0 : ℝ) t, ‖ru τ - rv τ‖ ≤ (K * dist u v) * Real.exp (η * τ) := by + intro τ hτ + let τ' : Icc (0 : ℝ) T := ⟨τ, hτ.1, hτ.2.trans t.2.2⟩ + have hτT : τ ∈ Icc 0 T := τ'.2 + have hnorm : ‖expandingTimeWeight T η u (projIcc 0 T hT τ) - + expandingTimeWeight T η v (projIcc 0 T hT τ)‖ ≤ + Real.exp (η * τ) * dist u v := by + rw [projIcc_of_mem _ hτT] + change ‖Real.exp (η * τ) • u τ' - Real.exp (η * τ) • v τ'‖ ≤ _ + rw [← smul_sub, norm_smul, Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)] + exact mul_le_mul_of_nonneg_left + (by simpa only [dist_eq_norm] using ContinuousMap.dist_apply_le_dist (f := u) (g := v) τ') + (Real.exp_pos _).le + change ‖F (projIcc 0 T hT τ, _) - F (projIcc 0 T hT τ, _)‖ ≤ _ + calc + _ ≤ K * ‖expandingTimeWeight T η u (projIcc 0 T hT τ) - + expandingTimeWeight T η v (projIcc 0 T hT τ)‖ := hF _ + _ ≤ K * (Real.exp (η * τ) * dist u v) := mul_le_mul_of_nonneg_left hnorm hK + _ = _ := by ring + have hb := expandingDuhamel_weighted_norm_le a b k L η t (K * dist u v) + ha hk hL hη t.2.1 (mul_nonneg hK dist_nonneg) (fun τ => ru τ - rv τ) hbound + change dist + (Real.exp (-η * t) • (expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t ru)) + (Real.exp (-η * t) • (expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t rv)) ≤ _ + rw [dist_eq_norm, ← smul_sub, add_sub_add_left_eq_sub, norm_smul, Real.norm_eq_abs, + abs_of_pos (Real.exp_pos _), + ← expandingDuhamel_sub a b k L ha hk hL t ru rv hru.continuousOn hrv.continuousOn] + exact hb.trans_eq (by ring) + +@[simp] theorem expandingTimeWeight_zero (T η : ℝ) : + expandingTimeWeight T η (0 : C(Icc (0 : ℝ) T, FourierL2)) = 0 := by + apply ContinuousMap.ext + intro t + change Real.exp (η * t) • (0 : FourierL2) = 0 + exact smul_zero _ + +theorem expandingBieleckiPicard_zero_bound (a b k L T η : ℝ) + (ha : 0 < a) (hk : 8 < k) (hL : 1 ≤ L) (hT : 0 ≤ T) (hη : 0 < η) + (F : C((Icc (0 : ℝ) T) × FourierL2, FourierL2)) (u₀ : FourierL2) + (ε : ℝ) (hε : 0 ≤ ε) (hF : ∀ t, ‖F (t, 0)‖ ≤ ε) : + ‖expandingBieleckiPicard a b k L T η ha hk hL hT F u₀ 0‖ ≤ ‖u₀‖ + ε / η := by + apply (ContinuousMap.norm_le _ (add_nonneg (norm_nonneg _) (div_nonneg hε hη.le))).2 + intro t + change ‖Real.exp (-η * t) • + (expandingFreeStep a b k L t ha hk hL t.2.1 u₀ + + expandingDuhamel a b k L ha hk hL t + (expandingReactionHistory T hT F (expandingTimeWeight T η 0)))‖ ≤ _ + rw [expandingTimeWeight_zero, smul_add] + apply (norm_add_le _ _).trans + apply add_le_add + · rw [norm_smul, Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)] + apply (mul_le_mul_of_nonneg_left + (expandingFreeStep_norm_bound a b k L t ha hk hL t.2.1 u₀) (Real.exp_pos _).le).trans + have hfree : Real.exp (-a * (t : ℝ) / 2) ≤ 1 := + Real.exp_le_one_iff.mpr (by nlinarith [t.2.1]) + have hweight : Real.exp (-η * (t : ℝ)) ≤ 1 := + Real.exp_le_one_iff.mpr (by nlinarith [t.2.1]) + exact (mul_le_mul_of_nonneg_left + (mul_le_of_le_one_left (norm_nonneg _) hfree) (Real.exp_pos _).le).trans + (mul_le_of_le_one_left (norm_nonneg _) hweight) + · rw [norm_smul, Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)] + apply expandingDuhamel_weighted_norm_le a b k L η t ε ha hk hL hη t.2.1 hε + intro τ hτ + change ‖F (projIcc 0 T hT τ, 0)‖ ≤ _ + exact (hF _).trans (le_mul_of_one_le_right hε + (Real.one_le_exp_iff.mpr (mul_nonneg hη.le hτ.1))) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/FourierAbsolute.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/FourierAbsolute.lean new file mode 100644 index 0000000000000000000000000000000000000000..3f55ead300dd4fbaae638177ba1fdb90d74208b1 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/FourierAbsolute.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.SobolevEmbedding + +namespace OAI + +/-! # Absolute Fourier coefficients and the quantitative ℓ¹ embedding -/ + +open scoped ENNReal + +namespace DefocusingNLS + +/-- Replace each ℓ² coordinate by its nonnegative norm, embedded in ℂ. -/ +noncomputable def fourierAbsolute (f : FourierL2) : FourierL2 := + ⟨fun n => (‖f n‖ : ℂ), (lp.memℓp f).mono' (by intro n; simp)⟩ + +@[simp] theorem fourierAbsolute_apply (f : FourierL2) (n : frequencyLattice) : + fourierAbsolute f n = (‖f n‖ : ℂ) := rfl + +@[simp] theorem fourierAbsolute_norm (f : FourierL2) : ‖fourierAbsolute f‖ = ‖f‖ := by + apply le_antisymm + · exact lp.norm_mono (by norm_num : (2 : ℝ≥0∞) ≠ 0) (by intro n; simp) + · exact lp.norm_mono (by norm_num : (2 : ℝ≥0∞) ≠ 0) (by intro n; simp) + +lemma sobolevFourierCoefficient_absolute (k : ℝ) (f : FourierL2) (n : frequencyLattice) : + sobolevFourierCoefficient k (fourierAbsolute f) n = + (‖sobolevFourierCoefficient k f n‖ : ℂ) := by + unfold sobolevFourierCoefficient + change (((1 + ‖n‖ ^ 2) ^ (-k / 2) : ℝ) : ℂ) * (‖f n‖ : ℂ) = + (‖(((1 + ‖n‖ ^ 2) ^ (-k / 2) : ℝ) : ℂ) * f n‖ : ℂ) + rw [norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (Real.rpow_nonneg (by positivity) _), Complex.ofReal_mul] + +/-- The Sobolev-to-ℓ¹ estimate has the same constant as point evaluation. -/ +theorem tsum_norm_sobolevFourierCoefficient_le (k : ℝ) (hk : 6 < k) (f : FourierL2) : + (∑' n, ‖sobolevFourierCoefficient k f n‖) ≤ + ‖sobolevObservationVector k hk‖ * ‖f‖ := by + have h := hasSum_sobolevFourierCoefficient k hk (fourierAbsolute f) + change HasSum (fun n => sobolevFourierCoefficient k (fourierAbsolute f) n) _ at h + simp_rw [sobolevFourierCoefficient_absolute] at h + have hr := (summable_norm_sobolevFourierCoefficient k hk f).hasSum.mapL Complex.ofRealCLM + have hr' : HasSum (fun n => (‖sobolevFourierCoefficient k f n‖ : ℂ)) + (Complex.ofReal (∑' n, ‖sobolevFourierCoefficient k f n‖)) := by + simpa only [Complex.ofRealCLM_apply] using hr + have heq : sobolevCenterEvaluation k hk (fourierAbsolute f) = + Complex.ofReal (∑' n, ‖sobolevFourierCoefficient k f n‖) := h.unique hr' + have hb := sobolevCenterEvaluation_bound k hk (fourierAbsolute f) + rw [heq, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (tsum_nonneg (fun n => norm_nonneg _)), fourierAbsolute_norm] at hb + exact hb + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/FourierBoundedMultiplier.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/FourierBoundedMultiplier.lean new file mode 100644 index 0000000000000000000000000000000000000000..42f6e5e93cb2722ae77d118956e6f8562215cf03 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/FourierBoundedMultiplier.lean @@ -0,0 +1,66 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.ExpandingFourier + +namespace OAI + +/-! # Bounded Fourier multipliers in the exact normalized torus space -/ + +open scoped ENNReal + +namespace DefocusingNLS + +noncomputable def fourierMultiplierVector (c : ℝ) (hc : 0 ≤ c) + (w : frequencyLattice → ℂ) (hw : ∀ n, ‖w n‖ ≤ c) (f : FourierL2) : FourierL2 := + ⟨fun n => w n * f n, by + apply (lp.memℓp (c • f)).mono' + intro n + simp only [lp.coeFn_smul, Pi.smul_apply, norm_smul, Real.norm_eq_abs, + norm_mul, abs_of_nonneg hc] + exact mul_le_mul_of_nonneg_right (hw n) (norm_nonneg _)⟩ + +theorem fourierMultiplierVector_norm_le (c : ℝ) (hc : 0 ≤ c) + (w : frequencyLattice → ℂ) (hw : ∀ n, ‖w n‖ ≤ c) (f : FourierL2) : + ‖fourierMultiplierVector c hc w hw f‖ ≤ c * ‖f‖ := by + calc + _ ≤ ‖c • f‖ := by + apply lp.norm_mono (by norm_num : (2 : ℝ≥0∞) ≠ 0) + intro n + change ‖w n * f n‖ ≤ ‖c • f n‖ + rw [norm_mul, norm_smul, Real.norm_eq_abs, abs_of_nonneg hc] + exact mul_le_mul_of_nonneg_right (hw n) (norm_nonneg _) + _ = _ := by rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg hc] + +noncomputable def fourierBoundedMultiplier (c : ℝ) (hc : 0 ≤ c) + (w : frequencyLattice → ℂ) (hw : ∀ n, ‖w n‖ ≤ c) : FourierL2 →L[ℂ] FourierL2 := + LinearMap.mkContinuous + { toFun := fourierMultiplierVector c hc w hw + map_add' := by + intro f g + ext n + change w n * (f n + g n) = w n * f n + w n * g n + ring + map_smul' := by + intro z f + ext n + change w n * (z * f n) = z * (w n * f n) + ring } + c (fourierMultiplierVector_norm_le c hc w hw) + +@[simp] theorem fourierBoundedMultiplier_apply (c : ℝ) (hc : 0 ≤ c) + (w : frequencyLattice → ℂ) (hw : ∀ n, ‖w n‖ ≤ c) (f : FourierL2) (n : frequencyLattice) : + fourierBoundedMultiplier c hc w hw f n = w n * f n := rfl + +theorem fourierBoundedMultiplier_norm_le (c : ℝ) (hc : 0 ≤ c) + (w : frequencyLattice → ℂ) (hw : ∀ n, ‖w n‖ ≤ c) (f : FourierL2) : + ‖fourierBoundedMultiplier c hc w hw f‖ ≤ c * ‖f‖ := + fourierMultiplierVector_norm_le c hc w hw f + +theorem expandingFourierCoefficient_multiplier (a k L c : ℝ) (hc : 0 ≤ c) + (w : frequencyLattice → ℂ) (hw : ∀ n, ‖w n‖ ≤ c) (f : FourierL2) (n : frequencyLattice) : + expandingFourierCoefficient a k L (fourierBoundedMultiplier c hc w hw f) n = + w n * expandingFourierCoefficient a k L f n := by + simp only [expandingFourierCoefficient, fourierBoundedMultiplier_apply] + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/FourierConvolution.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/FourierConvolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..0ca708bd936f8a969523d07a178c32a623414f6d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/FourierConvolution.lean @@ -0,0 +1,79 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.SchrodingerGenerator + +namespace OAI + +/-! +# Young's inequality for the Fourier lattice + +An absolutely summable coefficient sequence convolves boundedly with an ℓ² +sequence. The proof sums translated ℓ² vectors, so no external convolution +estimate is assumed. +-/ + +open Filter Topology +open scoped ENNReal + +namespace DefocusingNLS + +/-- A Fourier vector with its indices shifted by `m`. -/ +noncomputable def fourierTranslateVector (m : frequencyLattice) (f : FourierL2) : FourierL2 := + ⟨fun n => f (n - m), by + apply memℓp_gen + exact (Equiv.subRight m).summable_iff.mpr + ((lp.memℓp f).summable (by norm_num : 0 < (2 : ℝ≥0∞).toReal))⟩ + +@[simp] theorem fourierTranslateVector_apply (m : frequencyLattice) (f : FourierL2) + (n : frequencyLattice) : fourierTranslateVector m f n = f (n - m) := rfl + +theorem fourierTranslateVector_norm (m : frequencyLattice) (f : FourierL2) : + ‖fourierTranslateVector m f‖ = ‖f‖ := by + have h1 := lp.norm_rpow_eq_tsum (p := 2) (by norm_num) (fourierTranslateVector m f) + have h2 := lp.norm_rpow_eq_tsum (p := 2) (by norm_num) f + simp only [ENNReal.toReal_ofNat, Real.rpow_two, fourierTranslateVector_apply] at h1 h2 + have heq : ‖fourierTranslateVector m f‖ ^ 2 = ‖f‖ ^ 2 := by + rw [h1, h2] + exact (Equiv.subRight m).tsum_eq (fun n => ‖f n‖ ^ 2) + nlinarith [norm_nonneg f, norm_nonneg (fourierTranslateVector m f)] + +/-- Translation of Fourier indices is a complex-linear isometry. -/ +noncomputable def fourierTranslation (m : frequencyLattice) : FourierL2 →ₗᵢ[ℂ] FourierL2 where + toFun := fourierTranslateVector m + map_add' f g := by ext n; rfl + map_smul' c f := by ext n; rfl + norm_map' := fourierTranslateVector_norm m + +@[simp] theorem fourierTranslation_apply (m : frequencyLattice) (f : FourierL2) + (n : frequencyLattice) : fourierTranslation m f n = f (n - m) := rfl + +/-- Discrete convolution, formed as an ℓ²-valued absolutely convergent series. -/ +noncomputable def fourierConvolution (a : frequencyLattice → ℂ) (f : FourierL2) : FourierL2 := + ∑' m, a m • fourierTranslation m f + +theorem summable_fourierConvolution_terms (a : frequencyLattice → ℂ) + (ha : Summable (fun m => ‖a m‖)) (f : FourierL2) : + Summable (fun m => a m • fourierTranslation m f) := by + apply Summable.of_norm + simpa only [norm_smul, LinearIsometry.norm_map] using ha.mul_right ‖f‖ + +/-- The ℓ²-valued construction agrees with the usual coefficient convolution. -/ +theorem fourierConvolution_apply (a : frequencyLattice → ℂ) + (ha : Summable (fun m => ‖a m‖)) (f : FourierL2) (n : frequencyLattice) : + fourierConvolution a f n = ∑' m, a m * f (n - m) := by + have h := (summable_fourierConvolution_terms a ha f).hasSum.mapL + (lp.evalCLM ℂ (fun _ : frequencyLattice => ℂ) 2 n) + exact h.tsum_eq.symm + +/-- Young's `ℓ¹ * ℓ² → ℓ²` inequality on the twelve-dimensional lattice. -/ +theorem fourierConvolution_norm_le (a : frequencyLattice → ℂ) + (ha : Summable (fun m => ‖a m‖)) (f : FourierL2) : + ‖fourierConvolution a f‖ ≤ (∑' m, ‖a m‖) * ‖f‖ := by + have hs : Summable (fun m => ‖a m • fourierTranslation m f‖) := by + simpa only [norm_smul, LinearIsometry.norm_map] using ha.mul_right ‖f‖ + calc + _ ≤ ∑' m, ‖a m • fourierTranslation m f‖ := norm_tsum_le_tsum_norm hs + _ = (∑' m, ‖a m‖) * ‖f‖ := by + simp only [norm_smul, LinearIsometry.norm_map, tsum_mul_right] + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/FourierCoordinateDerivative.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/FourierCoordinateDerivative.lean new file mode 100644 index 0000000000000000000000000000000000000000..17d16c60a7dd82b026c5c2ddb8b5084945be6cd2 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/FourierCoordinateDerivative.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Nonlinear.GaussianRealization +import Mathlib.MeasureTheory.Integral.IntervalIntegral.FundThmCalculus +import Mathlib.MeasureTheory.Integral.IntervalIntegral.IntegrationByParts +import Mathlib.MeasureTheory.Integral.Bochner.ContinuousLinearMap + +namespace OAI + +/-! # Recovering a strong Fourier-space derivative from continuous coordinates + +For the Schrödinger application the candidate derivative loses two Sobolev +orders. Once that derivative is a continuous Hilbert-space curve, its +coordinate identities imply the strong derivative by the fundamental +theorem of calculus. +-/ + +open Set Filter Topology MeasureTheory + +namespace DefocusingNLS + +theorem hasDerivAt_fourierL2_of_coordinates (u v : ℝ → FourierL2) (a b t : ℝ) + (hv : ContinuousOn v (Ioo a b)) + (hu : ∀ s ∈ Ioo a b, ∀ n : frequencyLattice, + HasDerivAt (fun x => u x n) (v s n) s) + (ht : t ∈ Ioo a b) : HasDerivAt u (v t) t := by + have hvt : ContinuousAt v t := (hv t ht).continuousAt (isOpen_Ioo.mem_nhds ht) + have hmeas := hv.stronglyMeasurableAtFilter (μ := volume) isOpen_Ioo t ht + have hi : IntervalIntegrable v volume t t := by simp + have hd := (intervalIntegral.integral_hasDerivAt_right hi hmeas hvt).const_add (u t) + have heq : u =ᶠ[𝓝 t] (fun s => u t + ∫ x in t..s, v x) := by + filter_upwards [isOpen_Ioo.mem_nhds ht] with s hs + have hseg : uIcc t s ⊆ Ioo a b := by + intro x hx + exact ⟨(lt_min ht.1 hs.1).trans_le hx.1, + hx.2.trans_lt (max_lt ht.2 hs.2)⟩ + have hvi : IntervalIntegrable v volume t s := (hv.mono hseg).intervalIntegrable + ext n + let E := lp.evalCLM ℂ (fun _ : frequencyLattice => ℂ) 2 n + have hvin : IntervalIntegrable (fun x => v x n) volume t s := + (E.continuous.comp_continuousOn (hv.mono hseg)).intervalIntegrable + have hn := intervalIntegral.integral_eq_sub_of_hasDerivAt + (f := fun x => u x n) (f' := fun x => v x n) + (fun x hx => hu x (hseg hx) n) hvin + have hE : (∫ x in t..s, v x) n = ∫ x in t..s, v x n := + (E.intervalIntegral_comp_comm hvi).symm + change u s n = u t n + (∫ x in t..s, v x) n + rw [hE, hn] + abel + simpa only [zero_add] using hd.congr_of_eventuallyEq heq + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HarmonicRadialLinearCombination.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HarmonicRadialLinearCombination.lean new file mode 100644 index 0000000000000000000000000000000000000000..1ec28675178944bcdcc9a797b52fc14369c34170 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HarmonicRadialLinearCombination.lean @@ -0,0 +1,67 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HarmonicRadialNonvanishing + +namespace OAI + +/-! # Linear combinations and uniqueness for the coupled radial equation -/ + +open Set +open scoped ContDiff + +namespace DefocusingNLS + +private theorem deriv_sub_mul_c2 (f g : ℝ → ℂ) + (hf : ContDiff ℝ 2 f) (hg : ContDiff ℝ 2 g) (c : ℂ) : + deriv (fun r => f r - c * g r) = (fun r => deriv f r - c * deriv g r) ∧ + deriv (deriv (fun r => f r - c * g r)) = + (fun r => deriv (deriv f) r - c * deriv (deriv g) r) := by + have hd : deriv (fun r => f r - c * g r) = + (fun r => deriv f r - c * deriv g r) := by + funext r + rw [deriv_fun_sub (hf.differentiable (by norm_num) r) + ((hg.differentiable (by norm_num) r).const_mul c), deriv_const_mul_field] + refine ⟨hd, ?_⟩ + rw [hd] + funext r + rw [deriv_fun_sub (hf.differentiable_deriv_two r) + ((hg.differentiable_deriv_two r).const_mul c), deriv_const_mul_field] + +theorem IsHarmonicRadialEigenpair.sub_mul {a b : ℝ} {m : ℕ} {Q : ℝ → ℂ} + {η lam : ℂ} {f g u v : ℝ → ℂ} + (hfg : IsHarmonicRadialEigenpair a b m Q η lam f g) + (huv : IsHarmonicRadialEigenpair a b m Q η lam u v) + (hf : ContDiff ℝ 2 f) (hg : ContDiff ℝ 2 g) + (hu : ContDiff ℝ 2 u) (hv : ContDiff ℝ 2 v) (c : ℂ) : + IsHarmonicRadialEigenpair a b m Q η lam + (fun r => f r - c * u r) (fun r => g r - c * v r) := by + obtain ⟨hfu, hfuu⟩ := deriv_sub_mul_c2 f u hf hu c + obtain ⟨hgv, hgvv⟩ := deriv_sub_mul_c2 g v hg hv c + intro r hr + obtain ⟨hf', hg'⟩ := hfg r hr + obtain ⟨hu', hv'⟩ := huv r hr + dsimp only + rw [hfuu, hgvv, hfu, hgv] + dsimp only + constructor + · linear_combination hf' - c * hu' + · linear_combination hg' - c * hv' + +theorem harmonicRadialEigenpair_eq_of_ball (a b : ℝ) (m : ℕ) (Q f g u v : ℝ → ℂ) + (η lam : ℂ) (hQ : ContinuousOn Q (Ioi 0)) + (hf : ContDiff ℝ 2 f) (hg : ContDiff ℝ 2 g) + (hu : ContDiff ℝ 2 u) (hv : ContDiff ℝ 2 v) + (hfg : IsHarmonicRadialEigenpair a b m Q η lam f g) + (huv : IsHarmonicRadialEigenpair a b m Q η lam u v) + (R : ℝ) (hR : 0 < R) (c : ℂ) + (he : ∀ r ∈ Ioc 0 R, f r = c * u r ∧ g r = c * v r) : + ∀ r : ℝ, 0 < r → f r = c * u r ∧ g r = c * v r := by + have hz := harmonicRadialEigenpair_zero_of_ball a b m Q + (fun r => f r - c * u r) (fun r => g r - c * v r) η lam hQ + (hf.sub (contDiff_const.mul hu)) (hg.sub (contDiff_const.mul hv)) + (hfg.sub_mul huv hf hg hu hv c) R hR (fun r hr => + ⟨sub_eq_zero.mpr (he r hr).1, sub_eq_zero.mpr (he r hr).2⟩) + intro r hr + exact ⟨sub_eq_zero.mp (hz r hr).1, sub_eq_zero.mp (hz r hr).2⟩ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HarmonicRadialNonvanishing.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HarmonicRadialNonvanishing.lean new file mode 100644 index 0000000000000000000000000000000000000000..3407c2c4cbcd3f576d0c8741a9d616fed9ff4538 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HarmonicRadialNonvanishing.lean @@ -0,0 +1,120 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousHarmonicSmoothness +import OAI.MathematicalPhysics.DefocusingNLS.Spectrum.SpectralRegularUniqueness + +namespace OAI + +/-! A nonzero classical harmonic eigenmode cannot vanish on an origin interval. -/ + +open Set Filter Topology +namespace DefocusingNLS +local notation "E₄" => (ℂ × ℂ) × (ℂ × ℂ) + +theorem spectralPhysicalCircularField_regular (νp νm η : ℂ) (m : ℕ) + (Q : ℂ) (r : ℝ) (Z : E₄) : + spectralPhysicalCircularField νp νm η m Q r Z= + spectralRegularField 11 (spectralDiagonalCoefficient m Q) (spectralCrossCoefficient m Q) + (-Complex.I*νp/2-η/(r : ℂ)^2) (Complex.I*νm/2-η/(r : ℂ)^2) r Z := by + apply Prod.ext <;> apply Prod.ext <;> + simp only [spectralPhysicalCircularField,spectralRegularField] <;> ring + +theorem spectralPhysicalCircularField_bounded_on (νp νm η : ℂ) (m : ℕ) + (Q : ℝ → ℂ) (L R : ℝ) (hL : 0 < L) (hQ : ContinuousOn Q (Icc L R)) : + ∃ C : ℝ, ∀ r ∈ Icc L R, ∀ Z : E₄, + ‖spectralPhysicalCircularField νp νm η m (Q r) r Z‖ ≤ C*‖Z‖ := by + have hr : ContinuousOn (fun r : ℝ => (r : ℂ)) (Icc L R) := Complex.continuous_ofReal.continuousOn + have hn (r : ℝ) (hr : r ∈ Icc L R) : (r : ℂ) ≠ 0 := by exact_mod_cast (hL.trans_le hr.1).ne' + have hk : ContinuousOn (fun r : ℝ => 11/(r : ℂ)) (Icc L R) := continuousOn_const.div hr hn + have hi : ContinuousOn (fun r : ℝ => Complex.I*(r : ℂ)/2) (Icc L R) := by fun_prop + have he : ContinuousOn (fun r : ℝ => η/(r : ℂ)^2) (Icc L R) := + continuousOn_const.div (hr.pow 2) (fun r hr => pow_ne_zero _ (hn r hr)) + have hD : ContinuousOn (fun r => spectralDiagonalCoefficient m (Q r)) (Icc L R) := by + unfold spectralDiagonalCoefficient + fun_prop + have hC : ContinuousOn (fun r => spectralCrossCoefficient m (Q r)) (Icc L R) := by + unfold spectralCrossCoefficient + fun_prop + have hb : ContinuousOn (fun r => spectralRegularFieldBound 11 + (spectralDiagonalCoefficient m (Q r)) (spectralCrossCoefficient m (Q r)) + (-Complex.I*νp/2-η/(r : ℂ)^2) (Complex.I*νm/2-η/(r : ℂ)^2) r) (Icc L R) := by + unfold spectralRegularFieldBound + exact ((((((continuousOn_const.add (hk.add hi).norm).add (hk.sub hi).norm).add + hD.norm).add hC.norm).add (continuousOn_const.sub he).norm).add + (continuousOn_const.sub he).norm) + obtain ⟨C,hC⟩ := isCompact_Icc.exists_bound_of_continuousOn hb + refine ⟨C,fun r hr Z => ?_⟩ + rw [spectralPhysicalCircularField_regular] + apply (spectralRegularField_norm 11 _ _ _ _ r Z).trans + apply mul_le_mul_of_nonneg_right _ (norm_nonneg _) + exact (le_abs_self _).trans (by simpa only [Real.norm_eq_abs] using hC r hr) + +theorem harmonicRadialState_zero_of_zero (a b : ℝ) (m : ℕ) (Q f g : ℝ → ℂ) + (η lam : ℂ) (hQ : ContinuousOn Q (Ioi 0)) (hf : ContDiff ℝ 2 f) (hg : ContDiff ℝ 2 g) + (he : IsHarmonicRadialEigenpair a b m Q η lam f g) + (t : ℝ) (ht : 0 < t) (hz : harmonicRadialState f g t=0) + (r : ℝ) (hr : 0 < r) : harmonicRadialState f g r=0 := by + let Z := harmonicRadialState f g + let A := spectralPhysicalCircularField (-2*(a : ℂ)+2*Complex.I*(b : ℂ)-2*lam) + (-2*(a : ℂ)-2*Complex.I*(b : ℂ)-2*lam) η m + have hd (x : ℝ) (hx : 0 < x) : HasDerivAt Z (A (Q x) x (Z x)) x := + harmonicRadialState_hasDerivAt a b m Q f g η lam hf hg he x hx + have hc : Continuous Z := + (hf.continuous.prodMk (hf.continuous_deriv (by norm_num))).prodMk + (hg.continuous.prodMk (hg.continuous_deriv (by norm_num))) + by_cases hrt : r ≤ t + · obtain ⟨C,hC⟩ := spectralPhysicalCircularField_bounded_on _ _ η m Q r t hr + (hQ.mono (fun x hx => hr.trans_le hx.1)) + exact spectral_zero_on_annulus Z (fun x => A (Q x) x (Z x)) r t C hc.continuousOn + (fun x hx => hd x (hr.trans_le hx.1)) (fun x hx => hC x hx (Z x)) hz r ⟨le_rfl,hrt⟩ + · have htr : t ≤ r := le_of_not_ge hrt + obtain ⟨C,hC⟩ := spectralPhysicalCircularField_bounded_on _ _ η m Q t r ht + (hQ.mono (fun x hx => ht.trans_le hx.1)) + exact eq_zero_of_abs_deriv_le_mul_abs_self_of_eq_zero_right hc.continuousOn + (fun x hx => (hd x (ht.trans_le hx.1)).hasDerivWithinAt) hz + (fun x hx => hC x ⟨hx.1,hx.2.le⟩ (Z x)) r ⟨htr,le_rfl⟩ + +theorem harmonicRadialEigenpair_nonzero_on_ball (a b : ℝ) (m : ℕ) (Q f g : ℝ → ℂ) + (η lam : ℂ) (hQ : ContinuousOn Q (Ioi 0)) (hf : ContDiff ℝ 2 f) (hg : ContDiff ℝ 2 g) + (he : IsHarmonicRadialEigenpair a b m Q η lam f g) + (hne : ∃ r : ℝ, 0 < r ∧ (f r ≠ 0 ∨ g r ≠ 0)) (R : ℝ) (hR : 0 < R) : + ∃ r ∈ Ioc 0 R, f r ≠ 0 ∨ g r ≠ 0 := by + by_contra h + push Not at h + have hzero (r : ℝ) (hr : r ∈ Ioc 0 R) : f r=0 ∧ g r=0 := by + have hh := h r hr + tauto + let t := R/2 + have ht : t ∈ Ioo 0 R := by dsimp [t]; constructor <;> linarith + have hfe : f =ᶠ[𝓝 t] (fun _ => 0) := by + filter_upwards [Ioo_mem_nhds ht.1 ht.2] with r hr + exact (hzero r ⟨hr.1,hr.2.le⟩).1 + have hge : g =ᶠ[𝓝 t] (fun _ => 0) := by + filter_upwards [Ioo_mem_nhds ht.1 ht.2] with r hr + exact (hzero r ⟨hr.1,hr.2.le⟩).2 + have hz : harmonicRadialState f g t=0 := by + simp only [harmonicRadialState,hfe.eq_of_nhds,hge.eq_of_nhds, + hfe.deriv_eq,hge.deriv_eq,deriv_const] + rfl + obtain ⟨r,hr,hn⟩ := hne + have hh := harmonicRadialState_zero_of_zero a b m Q f g η lam hQ hf hg he t ht.1 hz r hr + rcases hn with hn | hn + · exact hn (congrArg (fun Z : E₄ => Z.1.1) hh) + · exact hn (congrArg (fun Z : E₄ => Z.2.1) hh) + +theorem harmonicRadialEigenpair_zero_of_ball (a b : ℝ) (m : ℕ) (Q f g : ℝ → ℂ) + (η lam : ℂ) (hQ : ContinuousOn Q (Ioi 0)) (hf : ContDiff ℝ 2 f) (hg : ContDiff ℝ 2 g) + (he : IsHarmonicRadialEigenpair a b m Q η lam f g) + (R : ℝ) (hR : 0 < R) (hz : ∀ r ∈ Ioc 0 R, f r=0 ∧ g r=0) : + ∀ r : ℝ, 0 < r → f r=0 ∧ g r=0 := by + intro r hr + have hn : ¬(f r ≠ 0 ∨ g r ≠ 0) := by + intro hn + obtain ⟨t,ht,htn⟩ := harmonicRadialEigenpair_nonzero_on_ball a b m Q f g η lam + hQ hf hg he ⟨r,hr,hn⟩ R hR + rcases htn with htn | htn + · exact htn (hz t ht).1 + · exact htn (hz t ht).2 + tauto + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousAngularDimension.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousAngularDimension.lean new file mode 100644 index 0000000000000000000000000000000000000000..f706cb5f2b468c29ffb6573f6ab7741a5fa2404c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousAngularDimension.lean @@ -0,0 +1,78 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousHarmonicSeparation +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousPolynomialMoment + +namespace OAI + +/-! # The angular dimension bound from a single radial mode line -/ + +open Set MeasureTheory +open scoped ContDiff Laplacian +namespace DefocusingNLS +open ProfileCertificate +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem homogeneous_contour_eigenspace_dimension (n : ℕ) (z : ProfileMatchingBall) + (hX : HasRadialExterior (radialShootingNu (n + radialInnerShootingThreshold) z) + (n + radialInnerShootingThreshold) (radialShootingM z) (Real.log innerBoundaryRadius)) + (hz : radialMatchingMap n z = 0) (N : ℕ) + (ha : 0 < radialShootingA n) (ha1 : radialShootingA n < 1) (hk : 8 < (N : ℝ)) + (q : HomogeneousY (radialShootingA n) N) + (hq : ∀ x : E, homogeneousPhysicalCLM (radialShootingA n) N ha ha1 hk q x = + radialMatchedCartesian n z x) + (P : (HomogeneousY (radialShootingA n) N × HomogeneousY (radialShootingA n) N) →L[ℂ] + (HomogeneousY (radialShootingA n) N × HomogeneousY (radialShootingA n) N)) + (hcomm : ∀ t, Commute (homogeneousComplexLinearizedStep (radialShootingA n) + (radialShootingB (profileMatchingParameter z)) N ha ha1 hk + (n + radialInnerShootingThreshold) q t) P) + (hfin : FiniteDimensional ℂ P.range) (G : P.range →L[ℂ] P.range) + (hG : ∀ t, projectionSemigroupRestriction + (homogeneousComplexLinearizedStep (radialShootingA n) + (radialShootingB (profileMatchingParameter z)) N ha ha1 hk + (n + radialInnerShootingThreshold) q) P hcomm t = NormedSpace.exp ((t : ℝ) • G)) + (lam : ℂ) (ell₀ : ℕ) + (hclass : ∀ (ell : ℕ), Nonempty (RadialSpectralMode (radialShootingA n) + (radialShootingB (profileMatchingParameter z)) (n + radialInnerShootingThreshold) 9 + (radialMatchedProfile n z) ((ell : ℂ) * (ell + 10)) lam) → ell = ell₀) + (hline : RadialModeLine n z ell₀ 9 lam) + {J : Type*} [Fintype J] (p : J → PhysicalRealPolynomial) + (hspan : ∀ L : PhysicalRealPolynomial →ₗ[ℝ] ℂ, (∀ j, L (p j) = 0) → + ∀ q : PhysicalRealPolynomial, q.IsHomogeneous ell₀ → L q = 0) : + Module.finrank ℂ (Module.End.eigenspace G.toLinearMap lam) ≤ Fintype.card J := by + classical + let S := Module.End.eigenspace G.toLinearMap lam + by_cases hs : S = ⊥ + · change Module.finrank ℂ S ≤ _ + rw [hs] + simp + obtain ⟨w, hws, hw⟩ := Submodule.exists_mem_ne_zero_of_ne_bot hs + have he : G w = lam • w := Module.End.mem_eigenspace_iff.mp hws + obtain ⟨ell, ⟨u₀⟩⟩ := homogeneous_matched_contour_radialMode_fixed n z hX hz N ha ha1 hk + q hq P hcomm hfin G hG lam w hw he + have hel := hclass ell ⟨u₀⟩ + subst ell + obtain ⟨first, r₀, hr₀, hu₀⟩ := radialModeTrace_exists u₀ + let L : S →ₗ[ℂ] (J → ℂ) := LinearMap.pi fun j => + (homogeneousPairHarmonicMoment (radialShootingA n) N ha ha1 hk + (physicalHarmonicExtension (p j) ell₀) + (continuous_harmonicSphere _ (physicalHarmonicExtension_contDiffAt (p j) ell₀)) first r₀).comp + (P.range.subtype.comp S.subtype) + have hker : ∀ v : S, L v = 0 → v = 0 := by + intro v hv + apply Subtype.ext + apply homogeneous_contour_harmonic_trace_separates n z hX hz N ha ha1 hk q hq P hcomm + hfin G hG lam v.val (Module.End.mem_eigenspace_iff.mp v.property) + ell₀ hclass hline u₀ first r₀ hr₀ hu₀ + intro q hq _ + exact homogeneousPairPolynomialMoment_complete (radialShootingA n) N ha ha1 hk ell₀ + p hspan first r₀ v.val (fun j => congrFun hv j) q hq + have hinj : Function.Injective L := by + intro u v huv + apply sub_eq_zero.mp + apply hker + rw [map_sub, huv, sub_self] + simpa only [Module.finrank_pi, Module.finrank_self, Finset.sum_const, + Finset.card_univ, smul_eq_mul, mul_one] using L.finrank_le_finrank_of_injective hinj + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousAngularL2.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousAngularL2.lean new file mode 100644 index 0000000000000000000000000000000000000000..0ad7169ae2fd9c039aec0bac7259ce8b0e4c2964 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousAngularL2.lean @@ -0,0 +1,81 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousPolarL2 + +namespace OAI + +/-! # Angular projection preserves the radial L² condition + +This applies to every square-integrable angular test, hence in particular +to each normalized spherical harmonic. No angular eigenfunction equation +is assumed or used by the measure-theoretic estimate. +-/ + +open MeasureTheory + +namespace DefocusingNLS + +private theorem norm_sq_toLp {α : Type*} [MeasurableSpace α] (μ : Measure α) + (f : α → ℂ) (hf : MemLp f 2 μ) : + ‖hf.toLp f‖ ^ 2 = ∫ x, ‖f x‖ ^ 2 ∂μ := by + have h := real_inner_self_eq_norm_sq (hf.toLp f) + rw [L2.inner_def] at h + rw [← h] + apply integral_congr_ae + filter_upwards [hf.coeFn_toLp] with x hx + rw [hx, real_inner_self_eq_norm_sq] + +/-- Cauchy--Schwarz in the angular variable, with its exact L² constant. -/ +theorem angular_integral_norm_sq_le {α : Type*} [MeasurableSpace α] + (μ : Measure α) (h f : α → ℂ) (hh : MemLp h 2 μ) (hf : MemLp f 2 μ) : + ‖∫ x, inner ℂ (h x) (f x) ∂μ‖ ^ 2 ≤ + (∫ x, ‖h x‖ ^ 2 ∂μ) * (∫ x, ‖f x‖ ^ 2 ∂μ) := by + have heq : (∫ x, inner ℂ (h x) (f x) ∂μ) = + inner ℂ (hh.toLp h) (hf.toLp f) := by + rw [L2.inner_def] + apply integral_congr_ae + filter_upwards [hh.coeFn_toLp, hf.coeFn_toLp] with x hx hy + rw [hx, hy] + rw [heq, ← norm_sq_toLp μ h hh, ← norm_sq_toLp μ f hf] + calc + _ ≤ (‖hh.toLp h‖ * ‖hf.toLp f‖) ^ 2 := + pow_le_pow_left₀ (norm_nonneg _) (norm_inner_le_norm _ _) 2 + _ = _ := by ring + +/-- A fixed L² angular projection of an L² polar field is in L²(r^11 dr). -/ +theorem memLp_angularProjection (h : PhysicalUnitSphere → ℂ) + (hh : MemLp h 2 physicalSphereMeasure) + (F : PhysicalUnitSphere × PhysicalPositiveRadius → ℂ) + (hF : MemLp F 2 physicalPolarMeasure) : + MemLp (fun r => ∫ ω, inner ℂ (h ω) (F (ω, r)) ∂physicalSphereMeasure) + 2 physicalRadiusMeasure := by + have hsq : Integrable (fun p => ‖F p‖ ^ 2) physicalPolarMeasure := + (memLp_two_iff_integrable_sq_norm hF.aestronglyMeasurable).mp hF + have hmeas : AEStronglyMeasurable + (fun p : PhysicalUnitSphere × PhysicalPositiveRadius => + inner ℂ (h p.1) (F p)) physicalPolarMeasure := + hh.aestronglyMeasurable.comp_fst.inner hF.aestronglyMeasurable + have hproj := hmeas.prod_swap.integral_prod_right' + apply (memLp_two_iff_integrable_sq_norm hproj).mpr + apply (hsq.integral_norm_prod_right.const_mul + (∫ ω, ‖h ω‖ ^ 2 ∂physicalSphereMeasure)).mono' + · exact hproj.norm.pow 2 + filter_upwards [hF.aestronglyMeasurable.prodMk_right, hsq.prod_left_ae] with r hmr hir + have hr : MemLp (fun ω => F (ω, r)) 2 physicalSphereMeasure := + (memLp_two_iff_integrable_sq_norm hmr).mpr hir + simpa only [Function.comp_def, Prod.swap_prod_mk, Real.norm_eq_abs, abs_pow, abs_norm, Pi.pow_apply, + Real.norm_of_nonneg (sq_nonneg _)] using + angular_integral_norm_sq_le physicalSphereMeasure h (fun ω => F (ω, r)) hh hr + +/-- The angular component of each completed Cartesian top derivative satisfies +exactly the radial weighted L² condition used in spectral exclusion. -/ +theorem homogeneousPolarDerivative_angular_memLp (a : ℝ) (N : ℕ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < (N : ℝ)) (j : Fin N → Fin 12) + (h : PhysicalUnitSphere → ℂ) (hh : MemLp h 2 physicalSphereMeasure) + (u : HomogeneousY a N) : + MemLp (fun r => ∫ ω, inner ℂ (h ω) + (homogeneousPolarDerivative a N ha ha1 hk j u (ω, r)) ∂physicalSphereMeasure) + 2 physicalRadiusMeasure := + memLp_angularProjection h hh _ (Lp.memLp _) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousAngularProjection.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousAngularProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..39e7ef025abc762ddb263584688337de44e0e498 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousAngularProjection.lean @@ -0,0 +1,167 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousPhysicalC2 +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousPolarL2 +import Mathlib.Analysis.Calculus.ParametricIntegral +import Mathlib.Analysis.Calculus.ContDiff.Deriv + +namespace OAI + +/-! # Classical angular projections of the actual physical realization + +Only square integrability of the angular test is needed. Harmonicity and +the angular eigenvalue are deliberately absent from this calculus lemma. +-/ + +open MeasureTheory Set Filter Topology + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +private theorem integrable_sphere_pairing (h G : PhysicalUnitSphere → ℂ) + (hh : Integrable h physicalSphereMeasure) (hG : Continuous G) : + Integrable (fun ω => inner ℂ (h ω) (G ω)) physicalSphereMeasure := by + obtain ⟨B, hB⟩ := isCompact_univ.exists_bound_of_continuousOn hG.continuousOn + apply (hh.norm.const_mul (max B 0)).mono' + (hh.aestronglyMeasurable.inner hG.aestronglyMeasurable) + filter_upwards [] with ω + exact (norm_inner_le_norm _ _).trans (by + calc + ‖h ω‖ * ‖G ω‖ ≤ ‖h ω‖ * max B 0 := + mul_le_mul_of_nonneg_left ((hB ω (mem_univ _)).trans (le_max_left B 0)) + (norm_nonneg (h ω)) + _ = max B 0 * ‖h ω‖ := mul_comm _ _) + +private theorem continuous_sphere_pairing (h : PhysicalUnitSphere → ℂ) + (hh : Integrable h physicalSphereMeasure) (G : ℝ → PhysicalUnitSphere → ℂ) + (hG : Continuous (Function.uncurry G)) : + Continuous (fun r => ∫ ω, inner ℂ (h ω) (G r ω) ∂physicalSphereMeasure) := by + apply continuous_iff_continuousAt.mpr + intro r + obtain ⟨B, hB⟩ := (isCompact_Icc.prod isCompact_univ).exists_bound_of_continuousOn + (hG.continuousOn : ContinuousOn (Function.uncurry G) (Icc (r - 1) (r + 1) ×ˢ univ)) + apply continuousAt_of_dominated + (bound := fun ω => max B 0 * ‖h ω‖) + (Eventually.of_forall (fun t => hh.aestronglyMeasurable.inner + (hG.comp (continuous_const.prodMk continuous_id)).aestronglyMeasurable)) + ?_ (hh.norm.const_mul _) ?_ + · filter_upwards [Ioo_mem_nhds (by linarith : r - 1 < r) (by linarith : r < r + 1)] with t ht + filter_upwards [] with ω + exact (norm_inner_le_norm _ _).trans (by + calc + ‖h ω‖ * ‖G t ω‖ ≤ ‖h ω‖ * max B 0 := + mul_le_mul_of_nonneg_left + ((hB (t, ω) ⟨⟨ht.1.le, ht.2.le⟩, mem_univ _⟩).trans (le_max_left B 0)) + (norm_nonneg (h ω)) + _ = max B 0 * ‖h ω‖ := mul_comm _ _) + · exact Eventually.of_forall (fun ω => continuousAt_const.inner + (hG.comp (continuous_id.prodMk continuous_const)).continuousAt) + +private theorem hasDerivAt_sphere_pairing (h : PhysicalUnitSphere → ℂ) + (hh : Integrable h physicalSphereMeasure) (G Gd : ℝ → PhysicalUnitSphere → ℂ) + (hG : Continuous (Function.uncurry G)) (hGd : Continuous (Function.uncurry Gd)) + (hd : ∀ r ω, HasDerivAt (fun t => G t ω) (Gd r ω) r) (r : ℝ) : + HasDerivAt (fun t => ∫ ω, inner ℂ (h ω) (G t ω) ∂physicalSphereMeasure) + (∫ ω, inner ℂ (h ω) (Gd r ω) ∂physicalSphereMeasure) r := by + obtain ⟨B, hB⟩ := (isCompact_Icc.prod isCompact_univ).exists_bound_of_continuousOn + (hGd.continuousOn : ContinuousOn (Function.uncurry Gd) (Icc (r - 1) (r + 1) ×ˢ univ)) + exact (hasDerivAt_integral_of_dominated_loc_of_deriv_le + (F := fun t ω => inner ℂ (h ω) (G t ω)) + (F' := fun t ω => inner ℂ (h ω) (Gd t ω)) + (bound := fun ω => max B 0 * ‖h ω‖) + (Ioo_mem_nhds (by linarith : r - 1 < r) (by linarith : r < r + 1)) + (Eventually.of_forall (fun t => hh.aestronglyMeasurable.inner + (hG.comp (continuous_const.prodMk continuous_id)).aestronglyMeasurable)) + (integrable_sphere_pairing h (G r) hh (hG.comp (continuous_const.prodMk continuous_id))) + (hh.aestronglyMeasurable.inner + (hGd.comp (continuous_const.prodMk continuous_id)).aestronglyMeasurable) + (Eventually.of_forall (fun ω t ht => (norm_inner_le_norm _ _).trans (by + calc + ‖h ω‖ * ‖Gd t ω‖ ≤ ‖h ω‖ * max B 0 := + mul_le_mul_of_nonneg_left + ((hB (t, ω) ⟨⟨ht.1.le, ht.2.le⟩, mem_univ _⟩).trans (le_max_left B 0)) + (norm_nonneg (h ω)) + _ = max B 0 * ‖h ω‖ := mul_comm _ _))) + (hh.norm.const_mul _) (Eventually.of_forall (fun ω t _ => + ((innerSL ℂ (h ω)).restrictScalars ℝ).hasFDerivAt.comp_hasDerivAt t (hd t ω)))).2 + +noncomputable def homogeneousAngularProjection (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (h : PhysicalUnitSphere → ℂ) (u : HomogeneousY a k) (r : ℝ) : ℂ := + ∫ ω, inner ℂ (h ω) (homogeneousPhysicalCLM a k ha ha1 hk u (r • ω.1)) ∂physicalSphereMeasure + +/-- The first derivative of the angular component is the angular component +of the directional radial derivative. -/ +theorem hasDerivAt_homogeneousAngularProjection (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (h : PhysicalUnitSphere → ℂ) (hh : MemLp h 2 physicalSphereMeasure) + (u : HomogeneousY a k) (r : ℝ) : + HasDerivAt (homogeneousAngularProjection a k ha ha1 hk h u) + (∫ ω, inner ℂ (h ω) + (fderiv ℝ (homogeneousPhysicalCLM a k ha ha1 hk u) (r • ω.1) ω.1) + ∂physicalSphereMeasure) r := by + let f : E → ℂ := homogeneousPhysicalCLM a k ha ha1 hk u + have hf : ContDiff ℝ 2 f := contDiff_homogeneousPhysical a k ha ha1 hk u + have hfd : Continuous (fderiv ℝ f) := + ((contDiff_one_iff_fderiv.mp (hf.of_le (by norm_num))).2) + apply hasDerivAt_sphere_pairing h (hh.integrable (by norm_num)) + (fun r ω => f (r • ω.1)) (fun r ω => fderiv ℝ f (r • ω.1) ω.1) + · exact hf.continuous.comp (continuous_fst.smul continuous_snd.subtype_val) + · exact (hfd.comp (continuous_fst.smul continuous_snd.subtype_val)).clm_apply continuous_snd.subtype_val + · intro t ω + have hline : HasDerivAt (fun s : ℝ => s • ω.1) ω.1 t := by + simpa only [id_eq, one_smul] using (hasDerivAt_id t).smul_const ω.1 + simpa only [Function.comp_def] using + (hf.differentiable (by norm_num) _).hasFDerivAt.comp_hasDerivAt t hline + +/-- Every angular coefficient of an actual Y vector is C² in the radius. +No spherical harmonic equation is needed for this regularity. -/ +theorem contDiff_homogeneousAngularProjection (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (h : PhysicalUnitSphere → ℂ) (hh : MemLp h 2 physicalSphereMeasure) + (u : HomogeneousY a k) : + ContDiff ℝ 2 (homogeneousAngularProjection a k ha ha1 hk h u) := by + let f : E → ℂ := homogeneousPhysicalCLM a k ha ha1 hk u + let G₁ : ℝ → PhysicalUnitSphere → ℂ := fun r ω => fderiv ℝ f (r • ω.1) ω.1 + let G₂ : ℝ → PhysicalUnitSphere → ℂ := fun r ω => + fderiv ℝ (fderiv ℝ f) (r • ω.1) ω.1 ω.1 + have hf : ContDiff ℝ 2 f := contDiff_homogeneousPhysical a k ha ha1 hk u + have hfd : ContDiff ℝ 1 (fderiv ℝ f) := (contDiff_succ_iff_fderiv.mp hf).2.2 + have hffd : Continuous (fderiv ℝ (fderiv ℝ f)) := + (contDiff_one_iff_fderiv.mp hfd).2 + have hG₁ : Continuous (Function.uncurry G₁) := + (hfd.continuous.comp (continuous_fst.smul continuous_snd.subtype_val)).clm_apply + continuous_snd.subtype_val + have hG₂ : Continuous (Function.uncurry G₂) := + ((hffd.comp (continuous_fst.smul continuous_snd.subtype_val)).clm_apply + continuous_snd.subtype_val).clm_apply continuous_snd.subtype_val + have hd (r : ℝ) := hasDerivAt_homogeneousAngularProjection a k ha ha1 hk h hh u r + have hd₁ (r : ℝ) : HasDerivAt + (fun t => ∫ ω, inner ℂ (h ω) (G₁ t ω) ∂physicalSphereMeasure) + (∫ ω, inner ℂ (h ω) (G₂ r ω) ∂physicalSphereMeasure) r := by + apply hasDerivAt_sphere_pairing h (hh.integrable (by norm_num)) G₁ G₂ hG₁ hG₂ + intro t ω + have hline : HasDerivAt (fun s : ℝ => s • ω.1) ω.1 t := by + simpa only [id_eq, one_smul] using (hasDerivAt_id t).smul_const ω.1 + have he : HasDerivAt (fun s : ℝ => fderiv ℝ f (s • ω.1)) + (fderiv ℝ (fderiv ℝ f) (t • ω.1) ω.1) t := by + simpa only [Function.comp_def] using + (hfd.differentiable (by norm_num) (t • ω.1)).hasFDerivAt.comp_hasDerivAt t hline + change HasDerivAt (fun s : ℝ => (fderiv ℝ f (s • ω.1)) ω.1) + ((fderiv ℝ (fderiv ℝ f) (t • ω.1) ω.1) ω.1) t + exact (ContinuousLinearMap.apply ℝ ℂ ω.1).hasFDerivAt.comp_hasDerivAt t he + have hderiv : deriv (homogeneousAngularProjection a k ha ha1 hk h u) = + fun t => ∫ ω, inner ℂ (h ω) (G₁ t ω) ∂physicalSphereMeasure := + funext (fun r => (hd r).deriv) + rw [show (2 : WithTop ℕ∞) = 1 + 1 by rfl, contDiff_succ_iff_deriv] + refine ⟨fun r => (hd r).differentiableAt, by simp, ?_⟩ + rw [hderiv, contDiff_one_iff_deriv] + refine ⟨fun r => (hd₁ r).differentiableAt, ?_⟩ + have he : deriv (fun t => ∫ ω, inner ℂ (h ω) (G₁ t ω) ∂physicalSphereMeasure) = + fun t => ∫ ω, inner ℂ (h ω) (G₂ t ω) ∂physicalSphereMeasure := + funext (fun r => (hd₁ r).deriv) + rw [he] + exact continuous_sphere_pairing h (hh.integrable (by norm_num)) G₂ hG₂ + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousAngularUpper.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousAngularUpper.lean new file mode 100644 index 0000000000000000000000000000000000000000..cc457d25bdb16215109ed2b98eae70a104e23c5c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousAngularUpper.lean @@ -0,0 +1,72 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousGaugeAngular + +namespace OAI + +/-! # Actual bounded finite-energy radial eigenmodes have real part below four -/ + +open Set Filter Topology Asymptotics MeasureTheory +open scoped ContDiff +namespace DefocusingNLS +open ProfileCertificate + +theorem homogeneous_matched_angular_upper : + ∀ᶠ n : ℕ in atTop, ∀ z : ProfileMatchingBall, + HasRadialExterior (radialShootingNu (n + radialInnerShootingThreshold) z) + (n + radialInnerShootingThreshold) (radialShootingM z) (Real.log innerBoundaryRadius) → + radialMatchingMap n z = 0 → ∀ eta : ℝ, 0 ≤ eta → ∀ N : ℕ, 7 ≤ N → + ∀ lam : ℂ, 4 ≤ lam.re → ∀ F G : ℝ → ℂ, + ContDiff ℝ 2 F → ContDiff ℝ 2 G → + IsHarmonicRadialEigenpair (radialShootingA n) + (radialShootingB (profileMatchingParameter z)) (n + radialInnerShootingThreshold) + (radialMatchedProfile n z) (eta : ℂ) lam F G → + (∃ M : ℝ, 0 ≤ M ∧ ∀ r, ‖(F r, G r)‖ ≤ M) → + IntegrableOn (fun r => r ^ 11 * ‖iteratedDeriv N F r‖ ^ 2) (Ioi 0) → + IntegrableOn (fun r => r ^ 11 * ‖iteratedDeriv N G r‖ ^ 2) (Ioi 0) → + ∀ r, 0 ≤ r → F r = 0 ∧ G r = 0 := by + filter_upwards [radialMatched_angular_upper_exclusion] with n hn z hX hz eta heta N hN + lam hlam F G hF hG he hbounded hL2F hL2G + let ν := radialShootingNu (n + radialInnerShootingThreshold) z + have hm : 1 ≤ n + radialInnerShootingThreshold := by + have := radialShootingInner_power_pos n (profileMatchingParameter z) + omega + obtain ⟨Yp, hYp⟩ := canonical_holomorphic_circular_allOrders ν ν (star ν) (eta : ℂ) + (radialShootingM z) (n + radialInnerShootingThreshold) hm (Real.log innerBoundaryRadius) + hX (radialShootingM_ne_zero z) (1, 0) + obtain ⟨Ym, hYm⟩ := canonical_holomorphic_circular_allOrders ν ν (star ν) (eta : ℂ) + (radialShootingM z) (n + radialInnerShootingThreshold) hm (Real.log innerBoundaryRadius) + hX (radialShootingM_ne_zero z) (0, 1) + obtain ⟨f, g, hf, hg, u, _, _, _, _, hpair, _⟩ := + radialMatchedGaugeJet 2 (by norm_num) n 0 z hX hz 1 (by norm_num) F G hF hG + have hdec := homogeneous_matched_gauge_decay n z hX hz (eta : ℂ) N hN lam hlam + F G hF hG he hbounded hL2F hL2G Yp Ym hYp hYm f g hf hg hpair + have heq := homogeneousGauge_angular_system n z hX hz eta lam f g hf hg + (radialMatchedGauge_equation n z hX hz (eta : ℂ) lam F G f g hf hg hpair he) + have hc : ∀ j, ContDiff ℝ 2 (homogeneousGaugeRealChannels f g j) := by + intro j + fin_cases j + · exact Complex.reCLM.contDiff.comp hf + · exact Complex.imCLM.contDiff.comp hf + · exact Complex.reCLM.contDiff.comp hg + · exact Complex.imCLM.contDiff.comp hg + have hd : ∀ j, HasRadialEnergyDecay (homogeneousGaugeRealChannels f g j) := by + intro j + fin_cases j + · exact hdec.1 Complex.reCLM + · exact hdec.1 Complex.imCLM + · exact hdec.2 Complex.reCLM + · exact hdec.2 Complex.imCLM + have hzall := hn z hX hz eta lam.re lam.im heta hlam (homogeneousGaugeRealChannels f g) hc hd heq + intro r hr + have hfr : (f r).re = 0 := hzall 0 r hr + have hfi : (f r).im = 0 := hzall 1 r hr + have hgr : (g r).re = 0 := hzall 2 r hr + have hgi : (g r).im = 0 := hzall 3 r hr + have hf0 : f r = 0 := Complex.ext (by simpa using hfr) (by simpa using hfi) + have hg0 : g r = 0 := Complex.ext (by simpa using hgr) (by simpa using hgi) + have hp := hpair r + rw [hf0, hg0] at hp + simpa only [mul_zero, add_zero, sub_zero, Prod.mk.injEq, eq_comm] using hp + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousAnnulusBounds.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousAnnulusBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..38b0e89e797c05a5de0a93c9cf36c2a16f321a23 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousAnnulusBounds.lean @@ -0,0 +1,123 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousAnnulusScaling + +namespace OAI + +/-! # Uniform Schwartz estimates for normalized annular profile pieces -/ + +open scoped SchwartzMap ContDiff + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +noncomputable def homogeneousAnnulusPiece (a R : ℝ) (κ : 𝓢(E, ℂ)) + (hκ : HasCompactSupport (κ : E → ℂ)) (Q : E → ℂ) (hQ : ContDiff ℝ ∞ Q) : + 𝓢(E, ℂ) := + (hκ.mul_right (f' := normalizedPhysicalProfile a R Q)).toSchwartzMap + (κ.smooth'.mul (normalizedPhysicalProfile_contDiff a R Q hQ)) + +@[simp] theorem homogeneousAnnulusPiece_apply (a R : ℝ) (κ : 𝓢(E, ℂ)) + (hκ : HasCompactSupport (κ : E → ℂ)) (Q : E → ℂ) (hQ : ContDiff ℝ ∞ Q) (x : E) : + homogeneousAnnulusPiece a R κ hκ Q hQ x = + κ x * ((R ^ (2 * a) : ℝ) • Q (R • x)) := rfl + +theorem homogeneousAnnulusPiece_rescale (a R : ℝ) (hR : 0 < R) (κ : 𝓢(E, ℂ)) + (hκ : HasCompactSupport (κ : E → ℂ)) (Q : E → ℂ) (hQ : ContDiff ℝ ∞ Q) (y : E) : + (R ^ (-2 * a) : ℝ) * homogeneousAnnulusPiece a R κ hκ Q hQ (R⁻¹ • y) = + κ (R⁻¹ • y) * Q y := by + have hy : R • (R⁻¹ • y) = y := by rw [smul_smul, mul_inv_cancel₀ hR.ne', one_smul] + have hc : R ^ (-2 * a) * R ^ (2 * a) = 1 := by + rw [← Real.rpow_add hR] + have he : -2 * a + 2 * a = 0 := by ring + rw [he, Real.rpow_zero] + rw [homogeneousAnnulusPiece_apply, hy] + change (↑(R ^ (-2 * a)) : ℂ) * (κ (R⁻¹ • y) * + ((↑(R ^ (2 * a)) : ℂ) * Q y)) = _ + calc + _ = ((↑(R ^ (-2 * a)) : ℂ) * (↑(R ^ (2 * a)) : ℂ)) * + (κ (R⁻¹ • y) * Q y) := by ring + _ = _ := by rw [← Complex.ofReal_mul, hc]; simp + +noncomputable def homogeneousAnnulusCutoffConstant (κ : 𝓢(E, ℂ)) (N : ℕ) : ℝ := + ∑ n ∈ Finset.range (N + 1), ∑ i ∈ Finset.range (n + 1), + (n.choose i : ℝ) * SchwartzMap.seminorm ℝ 0 i κ + +theorem homogeneousAnnulusCutoffConstant_nonneg (κ : 𝓢(E, ℂ)) (N : ℕ) : + 0 ≤ homogeneousAnnulusCutoffConstant κ N := by + unfold homogeneousAnnulusCutoffConstant + positivity + +noncomputable def homogeneousAnnulusJetConstant (a : ℝ) (κ : 𝓢(E, ℂ)) (N : ℕ) : ℝ := + 3 ^ N * homogeneousAnnulusCutoffConstant κ N * (1 / 2 : ℝ) ^ (-2 * a - (N : ℝ)) + +theorem homogeneousAnnulusJetConstant_nonneg (a : ℝ) (κ : 𝓢(E, ℂ)) (N : ℕ) : + 0 ≤ homogeneousAnnulusJetConstant a κ N := by + unfold homogeneousAnnulusJetConstant + exact mul_nonneg (mul_nonneg (by positivity) + (homogeneousAnnulusCutoffConstant_nonneg κ N)) (Real.rpow_nonneg (by norm_num) _) + +theorem homogeneousAnnulusPiece_jet_bound (a R D : ℝ) (ha : 0 < a) + (hR : 0 < R) (hD : 0 ≤ D) (κ : 𝓢(E, ℂ)) + (hκ : HasCompactSupport (κ : E → ℂ)) + (hκann : ∀ x ∈ tsupport (κ : E → ℂ), (1 / 2 : ℝ) ≤ ‖x‖ ∧ ‖x‖ ≤ 2) + (Q : E → ℂ) (hQ : ContDiff ℝ ∞ Q) (N : ℕ) + (hsymbol : ∀ n ≤ N, ∀ y : E, y ≠ 0 → + ‖iteratedFDeriv ℝ n Q y‖ ≤ D * ‖y‖ ^ (-2 * a - (n : ℝ))) + (n : ℕ) (hn : n ≤ N) (x : E) : + (1 + ‖x‖) ^ N * ‖iteratedFDeriv ℝ n + (homogeneousAnnulusPiece a R κ hκ Q hQ) x‖ ≤ + homogeneousAnnulusJetConstant a κ N * D := by + let B := D * (1 / 2 : ℝ) ^ (-2 * a - (N : ℝ)) + have hB : 0 ≤ B := mul_nonneg hD (Real.rpow_nonneg (by norm_num) _) + by_cases hx : x ∈ tsupport (κ : E → ℂ) + · have hxann := hκann x hx + have hxs : x ≠ 0 := norm_pos_iff.mp (by linarith [hxann.1]) + have hj (j : ℕ) (hjN : j ≤ N) : + ‖iteratedFDeriv ℝ j (normalizedPhysicalProfile a R Q) x‖ ≤ B := by + apply normalizedPhysicalProfile_annulus_bound a R D ha hR hD Q hQ N j hjN x hxann.1 + exact hsymbol j hjN (R • x) (smul_ne_zero hR.ne' hxs) + have hprod : ‖iteratedFDeriv ℝ n + (homogeneousAnnulusPiece a R κ hκ Q hQ) x‖ ≤ + (∑ i ∈ Finset.range (n + 1), + (n.choose i : ℝ) * SchwartzMap.seminorm ℝ 0 i κ) * B := by + change ‖iteratedFDeriv ℝ n + (fun y => κ y * normalizedPhysicalProfile a R Q y) x‖ ≤ _ + refine (norm_iteratedFDeriv_mul_le κ.smooth' + (normalizedPhysicalProfile_contDiff a R Q hQ) x (by simp)).trans ?_ + rw [Finset.sum_mul] + apply Finset.sum_le_sum + intro i _hi + have hiN : n - i ≤ N := (Nat.sub_le n i).trans hn + exact mul_le_mul + (mul_le_mul_of_nonneg_left (SchwartzMap.norm_iteratedFDeriv_le_seminorm ℝ κ i x) + (Nat.cast_nonneg _)) + (hj (n - i) hiN) (norm_nonneg _) + (mul_nonneg (Nat.cast_nonneg _) (apply_nonneg _ _)) + have hsum : (∑ i ∈ Finset.range (n + 1), + (n.choose i : ℝ) * SchwartzMap.seminorm ℝ 0 i κ) ≤ + homogeneousAnnulusCutoffConstant κ N := by + unfold homogeneousAnnulusCutoffConstant + exact Finset.single_le_sum + (f := fun j : ℕ => ∑ i ∈ Finset.range (j + 1), + (j.choose i : ℝ) * SchwartzMap.seminorm ℝ 0 i κ) + (fun j _ => by positivity) + (Finset.mem_range.mpr (Nat.lt_succ_of_le hn)) + have hweight : (1 + ‖x‖) ^ N ≤ (3 : ℝ) ^ N := + pow_le_pow_left₀ (by positivity) (by linarith [hxann.2]) _ + calc + _ ≤ 3 ^ N * (homogeneousAnnulusCutoffConstant κ N * B) := + mul_le_mul hweight (hprod.trans (mul_le_mul_of_nonneg_right hsum hB)) + (norm_nonneg _) (by positivity) + _ = _ := by unfold homogeneousAnnulusJetConstant B; ring + · have hzero : iteratedFDeriv ℝ n + (homogeneousAnnulusPiece a R κ hκ Q hQ) x = 0 := by + by_contra hne + have hm : x ∈ tsupport (fun y => κ y * normalizedPhysicalProfile a R Q y) := + support_iteratedFDeriv_subset n hne + exact hx (tsupport_mul_subset_left hm) + rw [hzero, norm_zero, mul_zero] + exact mul_nonneg (homogeneousAnnulusJetConstant_nonneg a κ N) hD + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousAnnulusScaling.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousAnnulusScaling.lean new file mode 100644 index 0000000000000000000000000000000000000000..95f559fa48db2c51a991411cd0962ec9eb1cb022 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousAnnulusScaling.lean @@ -0,0 +1,86 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousSymbolBound +import Mathlib.Analysis.Calculus.ContDiff.Bounds + +namespace OAI + +/-! # Symbol estimates after normalization of a physical annulus + +These estimates use the actual decay order `2 * a` of the profile. The scale +factors cancel in every derivative, before applying a fixed annular cutoff. +-/ + +open scoped SchwartzMap ContDiff + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +noncomputable def normalizedPhysicalProfile (a R : ℝ) (Q : E → ℂ) : E → ℂ := + fun x => (R ^ (2 * a) : ℝ) • Q (R • x) + +theorem normalizedPhysicalProfile_contDiff (a R : ℝ) (Q : E → ℂ) + (hQ : ContDiff ℝ ∞ Q) : ContDiff ℝ ∞ (normalizedPhysicalProfile a R Q) := by + have hin : ContDiff ℝ ∞ (fun x : E => Q (R • x)) := + hQ.comp (contDiff_id.const_smul R) + exact hin.const_smul (R ^ (2 * a)) + +theorem normalizedPhysicalProfile_jet_norm (a R : ℝ) (hR : 0 < R) + (Q : E → ℂ) (hQ : ContDiff ℝ ∞ Q) (n : ℕ) (x : E) : + ‖iteratedFDeriv ℝ n (normalizedPhysicalProfile a R Q) x‖ = + R ^ (2 * a) * R ^ n * ‖iteratedFDeriv ℝ n Q (R • x)‖ := by + have hin : ContDiff ℝ ∞ (fun x : E => Q (R • x)) := + hQ.comp (contDiff_id.const_smul R) + unfold normalizedPhysicalProfile + rw [iteratedFDeriv_const_smul_apply' ((hin.of_le (by simp)).contDiffAt)] + rw [iteratedFDeriv_comp_const_smul R (hQ.of_le (by simp))] + simp only [norm_smul, Real.norm_eq_abs, abs_of_nonneg (Real.rpow_nonneg hR.le _), + abs_of_nonneg (pow_nonneg hR.le n)] + ring + +theorem normalizedPhysicalProfile_symbol_bound (a R D : ℝ) (hR : 0 < R) + (Q : E → ℂ) (hQ : ContDiff ℝ ∞ Q) (n : ℕ) (x : E) (hx : x ≠ 0) + (hD : ‖iteratedFDeriv ℝ n Q (R • x)‖ ≤ + D * ‖R • x‖ ^ (-2 * a - (n : ℝ))) : + ‖iteratedFDeriv ℝ n (normalizedPhysicalProfile a R Q) x‖ ≤ + D * ‖x‖ ^ (-2 * a - (n : ℝ)) := by + have hxp : 0 < ‖x‖ := norm_pos_iff.mpr hx + have hcancel : R ^ (2 * a) * R ^ n * ‖R • x‖ ^ (-2 * a - (n : ℝ)) = + ‖x‖ ^ (-2 * a - (n : ℝ)) := by + rw [norm_smul, Real.norm_eq_abs, abs_of_pos hR, + Real.mul_rpow hR.le hxp.le, ← Real.rpow_natCast] + calc + _ = (R ^ (2 * a) * R ^ (n : ℝ) * R ^ (-2 * a - (n : ℝ))) * + ‖x‖ ^ (-2 * a - (n : ℝ)) := by ring + _ = _ := by + rw [← Real.rpow_add hR, ← Real.rpow_add hR] + have he : 2 * a + (n : ℝ) + (-2 * a - (n : ℝ)) = 0 := by ring + rw [he, Real.rpow_zero, one_mul] + rw [normalizedPhysicalProfile_jet_norm a R hR Q hQ n x] + calc + _ ≤ R ^ (2 * a) * R ^ n * (D * ‖R • x‖ ^ (-2 * a - (n : ℝ))) := + mul_le_mul_of_nonneg_left hD (mul_nonneg (Real.rpow_nonneg hR.le _) (pow_nonneg hR.le n)) + _ = D * (R ^ (2 * a) * R ^ n * ‖R • x‖ ^ (-2 * a - (n : ℝ))) := by ring + _ = _ := by rw [hcancel] + +theorem normalizedPhysicalProfile_annulus_bound (a R D : ℝ) (ha : 0 < a) + (hR : 0 < R) (hD : 0 ≤ D) (Q : E → ℂ) (hQ : ContDiff ℝ ∞ Q) + (N n : ℕ) (hn : n ≤ N) (x : E) (hx : (1 / 2 : ℝ) ≤ ‖x‖) + (hsymbol : ‖iteratedFDeriv ℝ n Q (R • x)‖ ≤ + D * ‖R • x‖ ^ (-2 * a - (n : ℝ))) : + ‖iteratedFDeriv ℝ n (normalizedPhysicalProfile a R Q) x‖ ≤ + D * (1 / 2 : ℝ) ^ (-2 * a - (N : ℝ)) := by + have hxp : 0 < ‖x‖ := by linarith + have hn' : (n : ℝ) ≤ N := by exact_mod_cast hn + have hp : ‖x‖ ^ (-2 * a - (n : ℝ)) ≤ (1 / 2 : ℝ) ^ (-2 * a - (N : ℝ)) := by + calc + _ ≤ (1 / 2 : ℝ) ^ (-2 * a - (n : ℝ)) := + Real.rpow_le_rpow_of_nonpos (by norm_num) hx + (by have hn0 : 0 ≤ (n : ℝ) := Nat.cast_nonneg _; linarith) + _ ≤ _ := Real.rpow_le_rpow_of_exponent_ge (by norm_num) (by norm_num) + (by linarith) + exact (normalizedPhysicalProfile_symbol_bound a R D hR Q hQ n x + (norm_pos_iff.mp hxp) hsymbol).trans (mul_le_mul_of_nonneg_left hp hD) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousCanonicalContour.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousCanonicalContour.lean new file mode 100644 index 0000000000000000000000000000000000000000..078d0da03e09fe1559a35e1d195c92d3385572ea --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousCanonicalContour.lean @@ -0,0 +1,75 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousContourDecomposition + +namespace OAI + +/-! # Canonical identity and eigenvalue exclusion for the contour complement + +The identity retained here makes the already-constructed finite-dimensional +complement available for generator eigenvalue classification. +-/ + +namespace DefocusingNLS + +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] [CompleteSpace E] + +theorem contourComplement_eigenvector_modulus (T : E →L[ℂ] E) + {r : ℝ} (hr : 0 < r) + (hres : ∀ z : ℂ, ‖z‖ = r → z ∈ resolventSet ℂ T) + {lam : ℂ} {u : E} (hu : u ≠ 0) (heigen : T u = lam • u) + (hfix : (1 - circleResolventOperator T r) u = u) : r < ‖lam‖ := by + by_contra! hle + rcases lt_or_eq_of_le hle with hlt | heq + · have hP := circleResolventOperator_eigenvector_inside T hr hres heigen hlt + change u - circleResolventOperator T r u = u at hfix + rw [hP, sub_self] at hfix + exact hu hfix.symm + · let A : E →L[ℂ] E := algebraMap ℂ (E →L[ℂ] E) lam - T + have hA : IsUnit A := hres lam heq + have hinj := (ContinuousLinearMap.isUnit_iff_bijective.mp hA).1 + apply hu + apply hinj + change lam • u - T u = A 0 + rw [heigen, sub_self, map_zero] + +theorem finiteRank_canonical_contour_decomposition (B K : E →L[ℂ] E) + (hB : ‖B‖ < 1) + (hK : FiniteDimensional ℂ (LinearMap.range K.toLinearMap)) + (η : ℝ) (hη : η < 1) : + ∃ r : ℝ, η < r ∧ 0 < r ∧ r < 1 ∧ + (∀ z : ℂ, ‖z‖ = r → z ∈ resolventSet ℂ (B + K)) ∧ + ∃ Q : E →L[ℂ] E, Q = 1 - circleResolventOperator (B + K) r ∧ + IsIdempotentElem Q ∧ FiniteDimensional ℂ (LinearMap.range Q.toLinearMap) ∧ + (∀ U : E →L[ℂ] E, Commute U (B + K) → Commute U Q) ∧ + ∃ C : ℝ, 0 ≤ C ∧ ∀ n : ℕ, ∀ x : E, Q x = 0 → + ‖((B + K) ^ n) x‖ ≤ C * r ^ n * ‖x‖ := by + obtain ⟨r, hBr, hηr, hr1, hres⟩ := + finiteRank_exists_resolvent_circle B K hK hB η hη + have hr : 0 < r := (norm_nonneg B).trans_lt hBr + let P := circleResolventOperator (B + K) r + let Q : E →L[ℂ] E := 1 - P + have hP : P * P = P := circleResolventOperator_idempotent (B + K) hr hres + have hQ : IsIdempotentElem Q := by + change (1 - P) * (1 - P) = 1 - P + rw [mul_sub, mul_one, sub_mul, one_mul, hP, sub_self, sub_zero] + have hc : IsCompactOperator (show E →L[ℂ] E from P - 1) := by + have hcK : IsCompactOperator (B + K - B) := by + simpa only [add_sub_cancel_left] using finiteRange_isCompactOperator K hK + have hh := circleResolventOperator_sub_isCompact (B + K) B hcK hr.le hres + (fun z hz => norm_lt_mem_resolvent B (hBr.trans_le hz.ge)) + simpa only [circleResolventOperator_eq_one B hBr] using hh + have hcQ : IsCompactOperator Q := by + simpa only [← FunLike.coe_neg, neg_sub, Q] using hc.neg + obtain ⟨C, hC, hpow⟩ := powers_on_circleResolvent_fixedSpace (B + K) hr.le hres + refine ⟨r, hηr, hr, hr1, hres, Q, rfl, hQ, + finiteDimensional_range_of_compact_projection Q hQ hcQ, ?_, C, hC, ?_⟩ + · intro U hU + exact (Commute.one_right U).sub_right + (circleResolventOperator_commute_of_commute U (B + K) hU hr.le hres) + · intro n x hx + apply hpow n x + change x - P x = 0 at hx + exact (sub_eq_zero.mp hx).symm + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousCanonicalLogEstimates.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousCanonicalLogEstimates.lean new file mode 100644 index 0000000000000000000000000000000000000000..ff16650d55539e417ab47b9e6cec85cd2b9d1e6d --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousCanonicalLogEstimates.lean @@ -0,0 +1,74 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousOutgoingRobin + +namespace OAI + +/-! # Robin and derivative-row estimates for the canonical outgoing columns + +Both estimates follow from the already constructed all-order expansions. +The physical powers cancel between the value matrix and its inverse. +-/ + +open Set Filter Topology + +namespace DefocusingNLS + +local notation "V" => ℂ × ℂ +local notation "V₄" => (ℂ × ℂ) × (ℂ × ℂ) + +theorem homogeneous_canonical_outgoing_log_estimates + (ν νp νm eta b : ℂ) (m : ℕ) (L : ℝ) + (hX : HasRadialExterior ν m b L) (hν : νp.re = νm.re) + (Yp Ym : ℝ → V₄) + (hYp : ∀ t, 0 ≤ t → HasDerivAt Yp (circularLeadingField t (Yp t) + + circularBoundedField νp νm eta m (radialExteriorCanonical ν m b L t).1 (Yp t)) t) + (hYm : ∀ t, 0 ≤ t → HasDerivAt Ym (circularLeadingField t (Ym t) + + circularBoundedField νp νm eta m (radialExteriorCanonical ν m b L t).1 (Ym t)) t) + (hplim : Tendsto Yp atTop (𝓝 (((1 : ℂ), 0), (0, 0)))) + (hmlim : Tendsto Ym atTop (𝓝 (((0 : ℂ), 0), (1, 0)))) + (hpall : ∀ J : ℕ, ∃ j : ℕ, J ≤ j ∧ ∃ v : CircularTailSpace, ∀ t, 0 ≤ t → + Yp t = circularPolynomialJet + (spectralOutgoingPolynomial νp νm eta m (radialExteriorExpansion ν m b j) (1, 0) j) t + + circularUnweight (2 * (j : ℝ)) v t) + (hmall : ∀ J : ℕ, ∃ j : ℕ, J ≤ j ∧ ∃ v : CircularTailSpace, ∀ t, 0 ≤ t → + Ym t = circularPolynomialJet + (spectralOutgoingPolynomial νp νm eta m (radialExteriorExpansion ν m b j) (0, 1) j) t + + circularUnweight (2 * (j : ℝ)) v t) : + let Fp := homogeneousPhysicalLogColumn νp νm (fun t => (Yp t).1.1) (fun t => (Yp t).2.1) + let Fm := homogeneousPhysicalLogColumn νp νm (fun t => (Ym t).1.1) (fun t => (Ym t).2.1) + let Dp := homogeneousPhysicalLogDerivativeColumn νp νm + (fun t => (Yp t).1.1) (fun t => (Yp t).2.1) + let Dm := homogeneousPhysicalLogDerivativeColumn νp νm + (fun t => (Ym t).1.1) (fun t => (Ym t).2.1) + (∀ N : ℕ, ∃ K : ℝ, 0 ≤ K ∧ ∀ᶠ t in atTop, + spectralValueDet (Fp t) (Fm t) ≠ 0 ∧ + ‖spectralTwoColumns (homogeneousEulerDeriv Fp N t) (homogeneousEulerDeriv Fm N t) * + spectralValueInverse (Fp t) (Fm t)‖ ≤ K) ∧ + (∃ M : ℝ, 0 ≤ M ∧ ∀ᶠ t in atTop, + ‖spectralRobinOperator (Fp t) (Fm t) (Dp t) (Dm t) - + homogeneousDiagonal νp νm‖ ≤ M * Real.exp (-2 * t)) := by + intro Fp Fm Dp Dm + obtain ⟨hfp, hgp⟩ := homogeneous_canonical_circular_value_logJets + ν νp νm eta b m L hX Yp (1, 0) hYp hplim hpall + obtain ⟨hfm, hgm⟩ := homogeneous_canonical_circular_value_logJets + ν νp νm eta b m L hX Ym (0, 1) hYm hmlim hmall + have hp : Tendsto (fun t => ((Yp t).1.1, (Yp t).2.1)) atTop (𝓝 (1, 0)) := + hplim.fst_nhds.fst_nhds.prodMk_nhds hplim.snd_nhds.fst_nhds + have hm : Tendsto (fun t => ((Ym t).1.1, (Ym t).2.1)) atTop (𝓝 (0, 1)) := + hmlim.fst_nhds.fst_nhds.prodMk_nhds hmlim.snd_nhds.fst_nhds + constructor + · intro N + exact homogeneousOutgoingDerivativeRows_bound νp νm hν + _ _ _ _ hfp hgp hfm hgm hp hm N + · obtain ⟨hdp, hdp'⟩ := homogeneous_canonical_circular_positive_derivatives + ν νp νm eta b m L hX Yp (1, 0) hYp hplim hpall + obtain ⟨hdm, hdm'⟩ := homogeneous_canonical_circular_positive_derivatives + ν νp νm eta b m L hX Ym (0, 1) hYm hmlim hmall + apply homogeneousOutgoingRobin_error νp νm hν _ _ _ _ hp hm + · simpa only [iteratedDeriv_one] using hdp 1 zero_lt_one + · simpa only [iteratedDeriv_one] using hdp' 1 zero_lt_one + · simpa only [iteratedDeriv_one] using hdm 1 zero_lt_one + · simpa only [iteratedDeriv_one] using hdm' 1 zero_lt_one + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousCircleIdentity.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousCircleIdentity.lean new file mode 100644 index 0000000000000000000000000000000000000000..cb5a5aab9026a5da5fe365323207fae6f7ffaf72 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousCircleIdentity.lean @@ -0,0 +1,90 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousResolventMoments + +namespace OAI + +/-! # The full resolvent contour of the contracting remainder + +Outside the norm disk the resolvent contour equals the identity. The proof +uses its large-circle limit and the annulus theorem, without assuming a +spectral decomposition. +-/ + +open Complex Set Filter Topology Bornology + +namespace DefocusingNLS + +section + +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] [CompleteSpace E] + +theorem norm_lt_mem_resolvent (B : E →L[ℂ] E) {z : ℂ} (hz : ‖B‖ < ‖z‖) : + z ∈ resolventSet ℂ B := by + apply spectrum.mem_resolventSet_of_norm_lt_mul + exact (mul_le_of_le_one_right (norm_nonneg B) + (ContinuousLinearMap.norm_id_le (𝕜 := ℂ) (E := E))).trans_lt hz + +theorem circleResolventOperator_eq_one (B : E →L[ℂ] E) + {r : ℝ} (hr : ‖B‖ < r) : circleResolventOperator B r = 1 := by + have hr0 : 0 < r := (norm_nonneg B).trans_lt hr + apply sub_eq_zero.mp + apply norm_eq_zero.mp + apply le_antisymm _ (norm_nonneg _) + apply le_of_forall_pos_le_add + intro ε hε + have hlim : Tendsto (fun z : ℂ => B * resolvent B z) (cobounded ℂ) (𝓝 0) := by + simpa only [mul_zero] using + (tendsto_const_nhds (x := B)).mul (spectrum.resolvent_tendsto_cobounded B) + have hlimNorm : Tendsto (fun z : ℂ => ‖B * resolvent B z‖) + (cobounded ℂ) (𝓝 0) := by simpa only [norm_zero] using hlim.norm + have hsmall : ∀ᶠ z : ℂ in cobounded ℂ, ‖B * resolvent B z‖ < ε := + hlimNorm.eventually (gt_mem_nhds hε) + obtain ⟨M, -, hM⟩ := atTop_basis_Ioi.cobounded_of_norm.eventually_iff.mp hsmall + let R : ℝ := max (r + 1) (M + 1) + have hrR : r < R := lt_of_lt_of_le (by linarith) (le_max_left _ _) + have hMR : M < R := lt_of_lt_of_le (by linarith) (le_max_right _ _) + have hR0 : 0 < R := hr0.trans hrR + have hres (z : ℂ) (hz : ‖z‖ = R) : z ∈ resolventSet ℂ B := + norm_lt_mem_resolvent B (hr.trans (hrR.trans_le hz.ge)) + have hEq := circleResolventOperator_eq_of_annulus B hr0 hrR.le + (fun z hz _ => norm_lt_mem_resolvent B (hr.trans_le hz)) + have hsimple : (2 * Real.pi * I : ℂ)⁻¹ • + (∮ z in C(0, R), z⁻¹ • (1 : E →L[ℂ] E)) = 1 := by + rw [circleIntegral.integral_smul_const] + have hscalar : (∮ z in C(0, R), z⁻¹) = 2 * Real.pi * I := by + simpa only [sub_zero] using + (circleIntegral.integral_sub_inv_of_mem_ball + (c := (0 : ℂ)) (w := 0) (Metric.mem_ball_self hR0)) + rw [hscalar, inv_smul_smul₀ (by simp [Real.pi_ne_zero, I_ne_zero])] + have hi : CircleIntegrable (fun z : ℂ => z⁻¹ • (1 : E →L[ℂ] E)) 0 R := by + apply ContinuousOn.circleIntegrable hR0.le + intro z hz + have hzr : ‖z‖ = R := by simpa only [Metric.mem_sphere, dist_zero_right] using hz + have hz0 : z ≠ 0 := norm_pos_iff.mp (by rwa [hzr]) + exact ((continuousAt_id.inv₀ hz0).smul continuousAt_const).continuousWithinAt + have hdiff : circleResolventOperator B R - 1 = + (2 * Real.pi * I : ℂ)⁻¹ • + (∮ z in C(0, R), resolvent B z - z⁻¹ • (1 : E →L[ℂ] E)) := by + rw [circleIntegral.integral_sub (circleIntegrable_resolvent B hR0.le hres) hi, + smul_sub, hsimple] + rfl + have hnorm : ‖circleResolventOperator B R - 1‖ ≤ ε := by + rw [hdiff] + have hb : ‖(2 * Real.pi * I : ℂ)⁻¹ • + (∮ z in C(0, R), resolvent B z - z⁻¹ • (1 : E →L[ℂ] E))‖ ≤ R * (ε / R) := by + apply circleIntegral.norm_two_pi_i_inv_smul_integral_le_of_norm_le_const hR0.le + intro z hz + have hzr : ‖z‖ = R := by simpa only [Metric.mem_sphere, dist_zero_right] using hz + have hz0 : z ≠ 0 := norm_pos_iff.mp (by rwa [hzr]) + have he : resolvent B z - z⁻¹ • (1 : E →L[ℂ] E) = + z⁻¹ • (B * resolvent B z) := by + rw [operator_mul_resolvent B (hres z hzr), smul_sub, inv_smul_smul₀ hz0] + rw [he, norm_smul, norm_inv, hzr, div_eq_inv_mul] + exact mul_le_mul_of_nonneg_left (hM (x := z) (by change M < ‖z‖; simpa only [hzr] using hMR)).le (inv_nonneg.mpr hR0.le) + simpa only [mul_div_cancel₀ _ hR0.ne'] using hb + simpa only [zero_add, hEq] using hnorm + +end + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousCircleProjection.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousCircleProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..78c76c23a8dfd55acefda550fa045752e2631828 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousCircleProjection.lean @@ -0,0 +1,202 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousDoubleCircle +import Mathlib.Analysis.Normed.Operator.Compact.FiniteDimension +import Mathlib.Topology.Algebra.Module.ContinuousLinearMap.Idempotent + +namespace OAI + +/-! # Nested resolvent circles + +The product identity is obtained from the resolvent identity and two scalar +Cauchy integrals. It supplies idempotence once nearby resolvent circles are +identified by the annulus theorem. +-/ + +open Complex Set + +namespace DefocusingNLS + +private theorem circleIntegral_inverse_left_outside {A : Type*} + [NormedAddCommGroup A] [NormedSpace ℂ A] [CompleteSpace A] + {r : ℝ} (hr : 0 ≤ r) {w : ℂ} (hw : r < ‖w‖) (x : A) : + (∮ z in C(0, r), (w - z)⁻¹ • x) = 0 := by + have hn (z : ℂ) (hz : z ∈ Metric.closedBall (0 : ℂ) r) : w - z ≠ 0 := by + have hz' : ‖z‖ ≤ r := by simpa only [Metric.mem_closedBall, dist_zero_right] using hz + intro he + rw [← sub_eq_zero.mp he] at hz' + exact (not_le_of_gt hw) hz' + have hd : DifferentiableOn ℂ (fun z : ℂ => (w - z)⁻¹ • x) + (Metric.closedBall (0 : ℂ) r) := by + intro z hz + exact ((((differentiableAt_const w).sub differentiableAt_id).inv (hn z hz)).smul + (differentiableAt_const x)).differentiableWithinAt + exact (hd.diffContOnCl_ball (Subset.refl _)).circleIntegral_eq_zero hr + +section + +variable {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] [CompleteSpace E] + +omit [CompleteSpace E] in +theorem finiteDimensional_range_of_compact_projection (P : E →L[ℂ] E) + (hP : IsIdempotentElem P) (hc : IsCompactOperator P) : + FiniteDimensional ℂ P.range := by + have hclosed := ContinuousLinearMap.IsIdempotentElem.isClosed_range hP + have hkeep : ∀ x ∈ P.range, P.toLinearMap x ∈ P.range := + fun x _ => ⟨x, rfl⟩ + have hr := IsCompactOperator.restrict (f := P.toLinearMap) hc hkeep hclosed + apply FiniteDimensional.of_isCompactOperator_id (𝕜 := ℂ) + convert hr using 1 + funext x + apply Subtype.ext + obtain ⟨y, hy⟩ := x.property + change (x : E) = P (x : E) + rw [← hy] + exact (congrArg (fun L : E →L[ℂ] E => L y) hP).symm + +private theorem resolvent_continuousOn_circle (T : E →L[ℂ] E) {r : ℝ} + (hres : ∀ z : ℂ, ‖z‖ = r → z ∈ resolventSet ℂ T) : + ContinuousOn (resolvent T) (Metric.sphere (0 : ℂ) r) := by + intro z hz + exact ((spectrum.hasDerivAt_resolvent_const_left (hres z + (by simpa only [Metric.mem_sphere, dist_zero_right] using hz))).continuousAt).continuousWithinAt + +theorem circleResolventOperator_mul_nested (T : E →L[ℂ] E) + {r R : ℝ} (hr : 0 ≤ r) (hrR : r < R) + (hresr : ∀ z : ℂ, ‖z‖ = r → z ∈ resolventSet ℂ T) + (hresR : ∀ z : ℂ, ‖z‖ = R → z ∈ resolventSet ℂ T) : + circleResolventOperator T r * circleResolventOperator T R = + circleResolventOperator T r := by + let A := E →L[ℂ] E + let c : ℂ := 2 * Real.pi * I + let Qr : A := ∮ z in C(0, r), resolvent T z + let QR : A := ∮ w in C(0, R), resolvent T w + let H : ℂ → A := fun z => ∮ w in C(0, R), (w - z)⁻¹ • resolvent T w + have hR : 0 ≤ R := hr.trans hrR.le + have hcr := resolvent_continuousOn_circle T hresr + have hcR := resolvent_continuousOn_circle T hresR + have hir := circleIntegrable_resolvent T hr hresr + have hiR := circleIntegrable_resolvent T hR hresR + have hn {z w : ℂ} (hz : z ∈ Metric.sphere (0 : ℂ) r) + (hw : w ∈ Metric.sphere (0 : ℂ) R) : w ≠ z := by + have hzr : ‖z‖ = r := by simpa only [Metric.mem_sphere, dist_zero_right] using hz + have hwR : ‖w‖ = R := by simpa only [Metric.mem_sphere, dist_zero_right] using hw + intro he + rw [he, hzr] at hwR + exact hrR.ne hwR + have hinner (z : ℂ) (hz : z ∈ Metric.sphere (0 : ℂ) r) : + H z = c • resolvent T z - resolvent T z * QR := by + have hzr : ‖z‖ = r := by simpa only [Metric.mem_sphere, dist_zero_right] using hz + have hinv : ContinuousOn (fun w : ℂ => (w - z)⁻¹) (Metric.sphere 0 R) := + (continuousOn_id.sub continuousOn_const).inv₀ fun w hw => sub_ne_zero.mpr (hn hz hw) + have hif : CircleIntegrable (fun w : ℂ => (w - z)⁻¹ • resolvent T z) 0 R := + (hinv.smul continuousOn_const).circleIntegrable hR + have hig : CircleIntegrable (fun w : ℂ => (w - z)⁻¹ • resolvent T w) 0 R := + (hinv.smul hcR).circleIntegrable hR + have he : resolvent T z * QR = c • resolvent T z - H z := by + calc + resolvent T z * QR = ∮ w in C(0, R), resolvent T z * resolvent T w := by + have hmap := circleIntegral_map_clm + (ContinuousLinearMap.mul ℂ A (resolvent T z)) hiR + change (∮ w in C(0, R), resolvent T z * resolvent T w) = + resolvent T z * QR at hmap + exact hmap.symm + _ = ∮ w in C(0, R), (w - z)⁻¹ • resolvent T z - + (w - z)⁻¹ • resolvent T w := by + apply circleIntegral.integral_congr hR + intro w hw + have hwR : ‖w‖ = R := by simpa only [Metric.mem_sphere, dist_zero_right] using hw + dsimp only + rw [resolvent_first_identity T (hresr z hzr) (hresR w hwR) (hn hz hw), smul_sub] + _ = c • resolvent T z - H z := by + rw [circleIntegral.integral_sub hif hig, circleIntegral.integral_smul_const, + circleIntegral.integral_sub_inv_of_mem_ball + (by simpa only [Metric.mem_ball, dist_zero_right, hzr] using hrR)] + exact (eq_sub_iff_add_eq.mpr (by + have hh := eq_sub_iff_add_eq.mp he + simpa only [add_comm] using hh)) + have hgc : ContinuousOn (fun p : ℂ × ℂ => (p.2 - p.1)⁻¹ • resolvent T p.2) + (Metric.sphere (0 : ℂ) r ×ˢ Metric.sphere (0 : ℂ) R) := by + intro p hp + have hs : ContinuousAt (fun p : ℂ × ℂ => (p.2 - p.1)⁻¹) p := + (continuous_snd.sub continuous_fst).continuousAt.inv₀ + (sub_ne_zero.mpr (hn hp.1 hp.2)) + have hres : ContinuousAt (fun p : ℂ × ℂ => resolvent T p.2) p := + (spectrum.hasDerivAt_resolvent_const_left (hresR p.2 + (by simpa only [Metric.mem_sphere, dist_zero_right] using hp.2))).continuousAt.comp + continuous_snd.continuousAt + exact (hs.smul hres).continuousWithinAt + have hHzero : (∮ z in C(0, r), H z) = 0 := by + change (∮ z in C(0, r), ∮ w in C(0, R), (w - z)⁻¹ • resolvent T w) = 0 + rw [circleIntegral_swap hr hR hgc] + calc + (∮ w in C(0, R), ∮ z in C(0, r), (w - z)⁻¹ • resolvent T w) = + ∮ w in C(0, R), (0 : A) := by + apply circleIntegral.integral_congr hR + intro w hw + apply circleIntegral_inverse_left_outside hr + have hwR : ‖w‖ = R := by simpa only [Metric.mem_sphere, dist_zero_right] using hw + simpa only [hwR] using hrR + _ = 0 := by simp [circleIntegral] + have hic : CircleIntegrable (fun z => c • resolvent T z) 0 r := by + apply ContinuousOn.circleIntegrable hr + intro z hz + exact ((show ContinuousAt (fun _ : ℂ => c) z from continuousAt_const).smul + (spectrum.hasDerivAt_resolvent_const_left (hresr z + (by simpa only [Metric.mem_sphere, dist_zero_right] using hz))).continuousAt).continuousWithinAt + have hip : CircleIntegrable (fun z => resolvent T z * QR) 0 r := + (hcr.mul continuousOn_const).circleIntegrable hr + have he := circleIntegral.integral_congr hr hinner + have hmap := circleIntegral_map_clm ((ContinuousLinearMap.mul ℂ A).flip QR) hir + change (∮ z in C(0, r), resolvent T z * QR) = Qr * QR at hmap + rw [he, circleIntegral.integral_sub hic hip, circleIntegral.integral_smul, hmap] at hHzero + have hp : Qr * QR = c • Qr := (sub_eq_zero.mp hHzero).symm + have hc : c ≠ 0 := by simp [c, Real.pi_ne_zero, I_ne_zero] + change (c⁻¹ • Qr) * (c⁻¹ • QR) = c⁻¹ • Qr + rw [smul_mul_smul_comm, hp, smul_smul] + congr 1 + field_simp + +theorem circleResolventOperator_idempotent_of_annulus (T : E →L[ℂ] E) + {r R : ℝ} (hr : 0 < r) (hrR : r < R) + (hres : ∀ z : ℂ, r ≤ ‖z‖ → ‖z‖ ≤ R → z ∈ resolventSet ℂ T) : + circleResolventOperator T r * circleResolventOperator T r = + circleResolventOperator T r := by + have he := circleResolventOperator_eq_of_annulus T hr hrR.le hres + calc + circleResolventOperator T r * circleResolventOperator T r = + circleResolventOperator T r * circleResolventOperator T R := by rw [he] + _ = circleResolventOperator T r := circleResolventOperator_mul_nested T hr.le hrR + (fun z hz => hres z hz.ge (hz.le.trans hrR.le)) + (fun z hz => hres z (hrR.le.trans hz.ge) hz.le) + +/-- A compact spectrum disjoint from a circle is disjoint from a slightly +larger closed annulus as well. -/ +theorem exists_resolvent_annulus (T : E →L[ℂ] E) {r : ℝ} + (hres : ∀ z : ℂ, ‖z‖ = r → z ∈ resolventSet ℂ T) : + ∃ R : ℝ, r < R ∧ + ∀ z : ℂ, r ≤ ‖z‖ → ‖z‖ ≤ R → z ∈ resolventSet ℂ T := by + let S : Set ℝ := norm '' spectrum ℂ T + have hclosed : IsClosed S := ((spectrum.isCompact T).image continuous_norm).isClosed + have hrS : r ∉ S := by + rintro ⟨z, hz, hzr⟩ + exact (spectrum.notMem_iff.mpr (hres z hzr)) hz + obtain ⟨ε, hε, hball⟩ := Metric.mem_nhds_iff.mp (hclosed.isOpen_compl.mem_nhds hrS) + refine ⟨r + ε / 2, by linarith, fun z hz hR => ?_⟩ + apply spectrum.notMem_iff.mp + intro hspec + have hn : ‖z‖ ∈ Metric.ball r ε := by + rw [Metric.mem_ball, Real.dist_eq, abs_of_nonneg (sub_nonneg.mpr hz)] + linarith + exact hball hn ⟨z, hspec, rfl⟩ + +theorem circleResolventOperator_idempotent (T : E →L[ℂ] E) + {r : ℝ} (hr : 0 < r) + (hres : ∀ z : ℂ, ‖z‖ = r → z ∈ resolventSet ℂ T) : + IsIdempotentElem (circleResolventOperator T r) := by + obtain ⟨R, hrR, hR⟩ := exists_resolvent_annulus T hres + exact circleResolventOperator_idempotent_of_annulus T hr hrR hR + +end + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousClassicalGenerator.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousClassicalGenerator.lean new file mode 100644 index 0000000000000000000000000000000000000000..d71d26791700c92101555050dc3d181f37c70619 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousClassicalGenerator.lean @@ -0,0 +1,120 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousPhysicalGeneratorIntegral +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousPhysicalLaplacian + +namespace OAI + +/-! # The actual strong free generator is the classical differential operator -/ + +open Set MeasureTheory +open scoped RealInnerProductSpace Laplacian + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +private noncomputable def physicalPhase (x ξ : E) : ℂ := + Complex.exp (((⟪ξ, x⟫ : ℝ) : ℂ) * Complex.I) + +private theorem physicalPhase_norm (x ξ : E) : ‖physicalPhase x ξ‖ = 1 := by + simp [physicalPhase, Complex.norm_exp] + +private theorem physicalPhase_continuous (x : E) : Continuous (physicalPhase x) := by + unfold physicalPhase + fun_prop + +private theorem physicalGenerator_integrable (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (u : HomogeneousY a k) (x : E) : + Integrable (fun ξ : E => physicalPhase x ξ * u ξ) ∧ + Integrable (fun ξ : E => physicalPhase x ξ * (Complex.I * (⟪ξ, x⟫ : ℂ)) * u ξ) ∧ + Integrable (fun ξ : E => physicalPhase x ξ * (-(‖ξ‖ ^ 2 : ℝ) : ℂ) * u ξ) := by + have hu := (integrable_and_integral_norm_of_memLp_homogeneous a k ha ha1 hk (Lp.memLp u)).1 + have h₀ : Integrable (fun ξ : E => physicalPhase x ξ * u ξ) := by + apply hu.norm.mono' ((physicalPhase_continuous x).aestronglyMeasurable.mul hu.aestronglyMeasurable) + filter_upwards [] with ξ + simp only [Pi.mul_apply, norm_mul, physicalPhase_norm, one_mul] + exact le_rfl + have h₁ : Integrable (fun ξ : E => physicalPhase x ξ * (Complex.I * (⟪ξ, x⟫ : ℂ)) * u ξ) := by + have hm : AEStronglyMeasurable + (fun ξ : E => physicalPhase x ξ * (Complex.I * (⟪ξ, x⟫ : ℂ)) * u ξ) volume := by + apply AEStronglyMeasurable.mul _ hu.aestronglyMeasurable + apply Continuous.aestronglyMeasurable + unfold physicalPhase + fun_prop + apply ((integrable_homogeneousFourier_moment_le_two a k ha ha1 hk u 1 (by norm_num)).const_mul ‖x‖).mono' hm + filter_upwards [] with ξ + simp only [norm_mul, physicalPhase_norm, Complex.norm_I, Complex.norm_real, one_mul, pow_one] + calc + |⟪ξ, x⟫| * ‖u ξ‖ ≤ (‖ξ‖ * ‖x‖) * ‖u ξ‖ := + mul_le_mul_of_nonneg_right (abs_real_inner_le_norm ξ x) (norm_nonneg _) + _ = _ := by ring + have h₂ : Integrable (fun ξ : E => physicalPhase x ξ * (-(‖ξ‖ ^ 2 : ℝ) : ℂ) * u ξ) := by + have hm : AEStronglyMeasurable + (fun ξ : E => physicalPhase x ξ * (-(‖ξ‖ ^ 2 : ℝ) : ℂ) * u ξ) volume := by + apply AEStronglyMeasurable.mul _ hu.aestronglyMeasurable + apply Continuous.aestronglyMeasurable + unfold physicalPhase + fun_prop + apply (integrable_homogeneousFourier_secondMoment a k ha ha1 hk u).mono' hm + filter_upwards [] with ξ + simpa only [norm_mul, physicalPhase_norm, norm_neg, Complex.norm_real, + Real.norm_eq_abs, abs_of_nonneg (sq_nonneg ‖ξ‖), one_mul] using + (le_refl (‖ξ‖ ^ 2 * ‖u ξ‖)) + exact ⟨h₀, h₁, h₂⟩ + +theorem homogeneousFree_generator_classical (a b k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (u v : HomogeneousY a k) + (hu : HasDerivWithinAt (fun t : ℝ => homogeneousFreeOperator a b k t ha ha1 hk u) + v (Ici 0) 0) (x : E) : + homogeneousPhysicalCLM a k ha ha1 hk v x = + Complex.I * Δ (fun y : E => homogeneousPhysicalCLM a k ha ha1 hk u y) x - + (1 / 2 : ℂ) * fderiv ℝ (fun y : E => homogeneousPhysicalCLM a k ha ha1 hk u y) x x + + (-(a : ℂ) + Complex.I * (b : ℂ)) * homogeneousPhysicalCLM a k ha ha1 hk u x := by + let P := physicalPhase x + let F₀ : E → ℂ := fun ξ => P ξ * u ξ + let F₁ : E → ℂ := fun ξ => P ξ * (Complex.I * (⟪ξ, x⟫ : ℂ)) * u ξ + let F₂ : E → ℂ := fun ξ => P ξ * (-(‖ξ‖ ^ 2 : ℝ) : ℂ) * u ξ + let c : ℂ := -(a : ℂ) + Complex.I * (b : ℂ) + let N : ℂ := (((2 * Real.pi) ^ (12 : ℕ))⁻¹ : ℝ) + obtain ⟨h₀, h₁, h₂⟩ := physicalGenerator_integrable a k ha ha1 hk u x + change Integrable F₀ at h₀ + change Integrable F₁ at h₁ + change Integrable F₂ at h₂ + have hval : homogeneousPhysicalCLM a k ha ha1 hk u x = N * ∫ ξ, F₀ ξ := by + change inverseRadianFourier (u : E → ℂ) x = _ + simp only [inverseRadianFourier, radianFourierIntegral, inner_neg_right, neg_neg] + rfl + have hgrad : fderiv ℝ (fun y : E => homogeneousPhysicalCLM a k ha ha1 hk u y) x x = + N * ∫ ξ, F₁ ξ := by + simpa only [N, Complex.ofReal_inv, Complex.ofReal_pow, Complex.ofReal_mul, + Complex.ofReal_ofNat, F₁, P, physicalPhase] using + fderiv_homogeneousPhysical a k ha ha1 hk u x x + have hlap : Δ (fun y : E => homogeneousPhysicalCLM a k ha ha1 hk u y) x = + N * ∫ ξ, F₂ ξ := by + simpa only [N, Complex.ofReal_inv, Complex.ofReal_pow, Complex.ofReal_mul, + Complex.ofReal_ofNat, F₂, P, physicalPhase] using + laplacian_homogeneousPhysical a k ha ha1 hk u x + have hD : (fun ξ : E => homogeneousPhysicalFreeKernelDerivative a b 0 x ξ * u ξ) = + (fun ξ : E => c * F₀ ξ + Complex.I * F₂ ξ - (1 / 2 : ℂ) * F₁ ξ) := by + funext ξ + simp only [homogeneousPhysicalFreeKernelDerivative, homogeneousPhysicalFreeKernel, + homogeneousPhysicalAmplitude_eq, Complex.ofReal_zero, mul_zero, Complex.exp_zero, + neg_zero, zero_div, Real.exp_zero, sub_self, zero_mul, zero_add, one_mul, one_div, + F₀, F₁, F₂, P, physicalPhase, c] + push_cast + ring + have hadd : (∫ ξ, c * F₀ ξ + Complex.I * F₂ ξ) = + (∫ ξ, c * F₀ ξ) + ∫ ξ, Complex.I * F₂ ξ := by + simpa only [Pi.add_apply] using integral_add (h₀.const_mul c) (h₂.const_mul Complex.I) + have hsub : (∫ ξ, c * F₀ ξ + Complex.I * F₂ ξ - (1 / 2 : ℂ) * F₁ ξ) = + (∫ ξ, c * F₀ ξ + Complex.I * F₂ ξ) - ∫ ξ, (1 / 2 : ℂ) * F₁ ξ := by + simpa only [Pi.add_apply] using + integral_sub ((h₀.const_mul c).add (h₂.const_mul Complex.I)) (h₁.const_mul (1 / 2 : ℂ)) + rw [homogeneousFree_generator_physical_integral a b k ha ha1 hk u v hu x, hD, + hsub, hadd, integral_const_mul, integral_const_mul, integral_const_mul, hval, hgrad, hlap] + dsimp only [N, c] + push_cast + ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousClassicalGreen.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousClassicalGreen.lean new file mode 100644 index 0000000000000000000000000000000000000000..5e13fc1cbdefb41405f7c37ed7df86fdda6e62f3 --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousClassicalGreen.lean @@ -0,0 +1,119 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousHarmonicTestCalculus +import Mathlib.Analysis.Calculus.LineDeriv.IntegrationByParts +import Mathlib.Analysis.Distribution.SchwartzSpace.Deriv + +namespace OAI + +/-! # Compact-test Green identity for the actual C² physical realization + +The physical function need not decay or have globally integrable derivatives: +every integrand is localized by the compactly supported smooth test. +-/ + +open MeasureTheory Set Filter Topology +open scoped SchwartzMap LineDeriv Laplacian + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem continuous_laplacian_of_contDiff_two (F : E → ℂ) (hF : ContDiff ℝ 2 F) : + Continuous (Δ F) := by + rw [InnerProductSpace.laplacian_eq_iteratedFDeriv_orthonormalBasis _ + (EuclideanSpace.basisFun (Fin 12) ℝ)] + exact continuous_finsetSum _ (fun j _ => + (hF.continuous_iteratedFDeriv (by norm_num)).eval_const + ![(EuclideanSpace.basisFun (Fin 12) ℝ) j, (EuclideanSpace.basisFun (Fin 12) ℝ) j]) + +theorem hasCompactSupport_laplacian (F : E → ℂ) (hc : HasCompactSupport F) : + HasCompactSupport (Δ F) := by + apply hc.mono' + intro x hx + by_contra hnot + have he : F =ᶠ[𝓝 x] (fun _ => (0 : ℂ)) := notMem_tsupport_iff_eventuallyEq.mp hnot + have hl := InnerProductSpace.laplacian_congr_nhds he + have hz : Δ F x = 0 := by + simpa only [InnerProductSpace.laplacian_const, Pi.zero_apply] using hl.eq_of_nhds + exact hx hz + +private theorem compactSchwartz_mul_continuous (ψ : 𝓢(E, ℂ)) + (hc : HasCompactSupport ψ) (F : E → ℂ) (hF : Continuous F) : + Integrable (fun x => ψ x * F x) := + (ψ.continuous.mul hF).integrable_of_hasCompactSupport hc.mul_right + +theorem compactTest_second_directional_green (ψ : 𝓢(E, ℂ)) + (hc : HasCompactSupport ψ) (F : E → ℂ) (hF : ContDiff ℝ 2 F) (v : E) : + (∫ x : E, ψ x * iteratedFDeriv ℝ 2 F x ![v, v]) = + ∫ x : E, iteratedFDeriv ℝ 2 ψ x ![v, v] * F x := by + let ψ₁ : 𝓢(E, ℂ) := ∂_{v} ψ + let ψ₂ : 𝓢(E, ℂ) := ∂_{v} ψ₁ + let F₁ : E → ℂ := fun x => fderiv ℝ F x v + have hc₁ : HasCompactSupport ψ₁ := hc.of_isClosed_subset isClosed_closure + (SchwartzMap.tsupport_lineDerivOp_subset v ψ) + have hc₂ : HasCompactSupport ψ₂ := hc₁.of_isClosed_subset isClosed_closure + (SchwartzMap.tsupport_lineDerivOp_subset v ψ₁) + have hfd : ContDiff ℝ 1 (fderiv ℝ F) := (contDiff_succ_iff_fderiv.mp hF).2.2 + have hF₁ : ContDiff ℝ 1 F₁ := hfd.clm_apply contDiff_const + have hF₂ : Continuous (fun x => fderiv ℝ F₁ x v) := + (contDiff_one_iff_fderiv.mp hF₁).2.clm_apply continuous_const + have hψ₁ (x : E) : ψ₁ x = fderiv ℝ ψ x v := + SchwartzMap.lineDerivOp_apply_eq_fderiv v ψ x + have hψ₂ (x : E) : ψ₂ x = fderiv ℝ ψ₁ x v := + SchwartzMap.lineDerivOp_apply_eq_fderiv v ψ₁ x + have hfirst : (∫ x : E, ψ x * fderiv ℝ F₁ x v) = + -(∫ x : E, ψ₁ x * F₁ x) := by + simpa only [← hψ₁] using + (integral_mul_fderiv_eq_neg_fderiv_mul_of_integrable + (f := fun x => ψ x) (g := F₁) (v := v) + (by simpa only [← hψ₁] using compactSchwartz_mul_continuous ψ₁ hc₁ F₁ hF₁.continuous) + (compactSchwartz_mul_continuous ψ hc _ hF₂) + (compactSchwartz_mul_continuous ψ hc F₁ hF₁.continuous) + (fun x _ => ψ.differentiableAt) + (fun x _ => hF₁.differentiable one_ne_zero x)) + have hsecond : (∫ x : E, ψ₁ x * F₁ x) = -(∫ x : E, ψ₂ x * F x) := by + simpa only [F₁, ← hψ₂] using + (integral_mul_fderiv_eq_neg_fderiv_mul_of_integrable + (f := fun x => ψ₁ x) (g := F) (v := v) + (by simpa only [← hψ₂] using compactSchwartz_mul_continuous ψ₂ hc₂ F hF.continuous) + (compactSchwartz_mul_continuous ψ₁ hc₁ F₁ hF₁.continuous) + (compactSchwartz_mul_continuous ψ₁ hc₁ F hF.continuous) + (fun x _ => ψ₁.differentiableAt) + (fun x _ => hF.differentiable (by norm_num) x)) + have hleft (x : E) : iteratedFDeriv ℝ 2 F x ![v, v] = fderiv ℝ F₁ x v := + radial_second_directional_eq F x v hF.contDiffAt + have hright (x : E) : iteratedFDeriv ℝ 2 ψ x ![v, v] = ψ₂ x := by + rw [radial_second_directional_eq ψ x v (ψ.smooth 2).contDiffAt, hψ₂] + congr 2 + simp_rw [hleft, hright] + rw [hfirst, hsecond, neg_neg] + +/-- Green's identity against a compact smooth test, for a globally C² +physical function with no additional integrability hypothesis. -/ +theorem compactTest_laplacian_green (ψ : 𝓢(E, ℂ)) + (hc : HasCompactSupport ψ) (F : E → ℂ) (hF : ContDiff ℝ 2 F) : + (∫ x : E, ψ x * Δ F x) = ∫ x : E, Δ (fun y => ψ y) x * F x := by + let e := EuclideanSpace.basisFun (Fin 12) ℝ + have hli (j : Fin 12) : Integrable (fun x : E => + ψ x * iteratedFDeriv ℝ 2 F x ![e j, e j]) := by + apply compactSchwartz_mul_continuous ψ hc + exact (hF.continuous_iteratedFDeriv (by norm_num)).eval_const ![e j, e j] + have hri (j : Fin 12) : Integrable (fun x : E => + iteratedFDeriv ℝ 2 ψ x ![e j, e j] * F x) := by + let ψ₂ : 𝓢(E, ℂ) := ∂_{e j} (∂_{e j} ψ) + have hc₁ : HasCompactSupport (∂_{e j} ψ : 𝓢(E, ℂ)) := + hc.of_isClosed_subset isClosed_closure (SchwartzMap.tsupport_lineDerivOp_subset (e j) ψ) + have hc₂ : HasCompactSupport ψ₂ := hc₁.of_isClosed_subset isClosed_closure + (SchwartzMap.tsupport_lineDerivOp_subset (e j) (∂_{e j} ψ)) + have heq (x : E) : iteratedFDeriv ℝ 2 ψ x ![e j, e j] = ψ₂ x := by + exact (SchwartzMap.iteratedLineDerivOp_eq_iteratedFDeriv + (m := ![e j, e j]) (f := ψ) (x := x)).symm + simp_rw [heq] + exact compactSchwartz_mul_continuous ψ₂ hc₂ F hF.continuous + simp only [InnerProductSpace.laplacian_eq_iteratedFDeriv_orthonormalBasis _ e, + Finset.mul_sum, Finset.sum_mul] + rw [integral_finsetSum _ (fun j _ => hli j), integral_finsetSum _ (fun j _ => hri j)] + exact Finset.sum_congr rfl (fun j _ => compactTest_second_directional_green ψ hc F hF (e j)) + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousClassicalLinearization.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousClassicalLinearization.lean new file mode 100644 index 0000000000000000000000000000000000000000..4399421c905e258ed28dd6a3099b95d1c7b9a08c --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousClassicalLinearization.lean @@ -0,0 +1,52 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousClassicalGenerator +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousGeneratorCoordinates + +namespace OAI + +/-! # Classical equations for actual linearized generator vectors + +The potential here is the proved derivative of the odd-power nonlinearity +on the faithful Y space. Neither a spatial smoothness assumption nor an +independent differential-operator eigenvalue hypothesis is introduced. +-/ + +open Set +open scoped Laplacian ZeroAtInfty + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +theorem homogeneousLinearized_domain_classical (a b k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) + (q u v : HomogeneousY a k) + (hu : HasDerivWithinAt (fun t : ℝ => homogeneousFreeOperator a b k t ha ha1 hk u) + (v - homogeneousLinearizedPotential a k ha ha1 hk m q u) (Ici 0) 0) (x : E) : + homogeneousPhysicalCLM a k ha ha1 hk v x = + Complex.I * Δ (fun y : E => homogeneousPhysicalCLM a k ha ha1 hk u y) x - + (1 / 2 : ℂ) * fderiv ℝ (fun y : E => homogeneousPhysicalCLM a k ha ha1 hk u y) x x + + (-(a : ℂ) + Complex.I * (b : ℂ)) * homogeneousPhysicalCLM a k ha ha1 hk u x - + Complex.I * oddPowerDerivative m (homogeneousPhysicalCLM a k ha ha1 hk q x) + (homogeneousPhysicalCLM a k ha ha1 hk u x) := by + have h := homogeneousFree_generator_classical a b k ha ha1 hk u + (v - homogeneousLinearizedPotential a k ha ha1 hk m q u) hu x + rw [map_sub, ZeroAtInftyContinuousMap.sub_apply, homogeneousLinearizedPotential_physical] at h + linear_combination h + +theorem homogeneousLinearized_generator_classical (a b k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (m : ℕ) + (q u v : HomogeneousY a k) + (hu : HasDerivWithinAt (fun t : ℝ => + homogeneousLinearizedStep a b k ha ha1 hk m q t.toNNReal u) v (Ici 0) 0) (x : E) : + homogeneousPhysicalCLM a k ha ha1 hk v x = + Complex.I * Δ (fun y : E => homogeneousPhysicalCLM a k ha ha1 hk u y) x - + (1 / 2 : ℂ) * fderiv ℝ (fun y : E => homogeneousPhysicalCLM a k ha ha1 hk u y) x x + + (-(a : ℂ) + Complex.I * (b : ℂ)) * homogeneousPhysicalCLM a k ha ha1 hk u x - + Complex.I * oddPowerDerivative m (homogeneousPhysicalCLM a k ha ha1 hk q x) + (homogeneousPhysicalCLM a k ha ha1 hk u x) := + homogeneousLinearized_domain_classical a b k ha ha1 hk m q u v + (homogeneousFree_derivWithin_of_linearized a b k ha ha1 hk m q u v hu) x + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousCommutatorBound.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousCommutatorBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..ccc6e3b4f5702902018a1bb73f0398a6823d8fcb --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousCommutatorBound.lean @@ -0,0 +1,170 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousCommutatorFourier + +namespace OAI + +/-! # The high-frequency gain for the physical derivative commutator + +For a Schwartz input with frequencies above R, the actual commutator costs +only R⁻¹ times its top homogeneous energy. The coefficient is an explicit +integrable Fourier moment of the fixed Schwartz potential. +-/ + +open MeasureTheory +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +private theorem two_add_pow_le (N : ℕ) (r : ℝ) (hr : 0 ≤ r) : + (2 + r) ^ N ≤ 3 ^ N * (1 + r ^ N) := by + by_cases h : r ≤ 1 + · calc + _ ≤ (3 : ℝ) ^ N := pow_le_pow_left₀ (by positivity) (by linarith) N + _ ≤ _ := by nlinarith [pow_nonneg hr N, pow_nonneg (by norm_num : (0 : ℝ) ≤ 3) N] + · have h1 : 1 ≤ r := le_of_lt (lt_of_not_ge h) + calc + _ ≤ (3 * r) ^ N := pow_le_pow_left₀ (by positivity) (by linarith) N + _ = 3 ^ N * r ^ N := mul_pow _ _ _ + _ ≤ _ := by nlinarith [pow_nonneg (by norm_num : (0 : ℝ) ≤ 3) N] + +noncomputable def homogeneousCommutatorMoment (N : ℕ) (V : 𝓢(E, ℂ)) (ξ : E) : ℝ := + (N + 1 : ℕ) * (3 : ℝ) ^ N * (‖ξ‖ + ‖ξ‖ ^ (N + 1)) * ‖radianFourierKernel V ξ‖ + +theorem homogeneousCommutatorMoment_nonneg (N : ℕ) (V : 𝓢(E, ℂ)) (ξ : E) : + 0 ≤ homogeneousCommutatorMoment N V ξ := by + unfold homogeneousCommutatorMoment + positivity + +theorem homogeneousCommutatorMoment_integrable (N : ℕ) (V : 𝓢(E, ℂ)) : + Integrable (homogeneousCommutatorMoment N V) := by + have h := (((radianFourierKernel V).integrable_pow_mul volume 1).add + ((radianFourierKernel V).integrable_pow_mul volume (N + 1))).const_mul + ((N + 1 : ℕ) * (3 : ℝ) ^ N) + convert h using 1 + funext ξ + simp only [homogeneousCommutatorMoment, pow_one, Pi.add_apply] + ring + +private theorem commutator_integrand_high (N : ℕ) (j : Fin (N + 1) → Fin 12) + (V f : 𝓢(E, ℂ)) (R : ℝ) (hR : 1 ≤ R) + (hf : ∀ η : E, ‖η‖ < R → radianFourierKernel f η = 0) (ξ η : E) : + ‖(homogeneousOrderedSymbol (N + 1) j ξ - + homogeneousOrderedSymbol (N + 1) j (ξ - η)) * + radianFourierKernel V η * radianFourierKernel f (ξ - η)‖ ≤ + R⁻¹ * (homogeneousCommutatorMoment N V η * + homogeneousFourierMagnitude (N + 1) (radianFourierKernel f) (ξ - η)) := by + by_cases h : ‖ξ - η‖ < R + · rw [hf _ h, mul_zero, norm_zero] + exact mul_nonneg (inv_nonneg.mpr (by linarith : (0 : ℝ) ≤ R)) + (mul_nonneg (homogeneousCommutatorMoment_nonneg _ _ _) + (homogeneousFourierMagnitude_nonneg _ _ _)) + · have hs := homogeneousOrderedSymbol_highFrequency N j ξ (ξ - η) R hR (le_of_not_gt h) + rw [sub_sub_cancel] at hs + have ht := two_add_pow_le N ‖η‖ (norm_nonneg _) + have hm := mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_left ht (by positivity : 0 ≤ (N + 1 : ℕ) / R * ‖η‖)) + (pow_nonneg (norm_nonneg (ξ - η)) (N + 1))) + (mul_nonneg (norm_nonneg (radianFourierKernel V η)) + (norm_nonneg (radianFourierKernel f (ξ - η)))) + have hh := mul_le_mul_of_nonneg_right hs + (mul_nonneg (norm_nonneg (radianFourierKernel V η)) + (norm_nonneg (radianFourierKernel f (ξ - η)))) + rw [norm_mul, norm_mul] + calc + _ ≤ (((N + 1 : ℕ) / R) * ‖η‖ * (2 + ‖η‖) ^ N * ‖ξ - η‖ ^ (N + 1)) * + (‖radianFourierKernel V η‖ * ‖radianFourierKernel f (ξ - η)‖) := by + convert hh using 1; ring + _ ≤ (((N + 1 : ℕ) / R) * ‖η‖ * ((3 : ℝ) ^ N * (1 + ‖η‖ ^ N)) * + ‖ξ - η‖ ^ (N + 1)) * + (‖radianFourierKernel V η‖ * ‖radianFourierKernel f (ξ - η)‖) := hm + _ = _ := by + have hexp : ‖ξ - η‖ ^ (N + 1 : ℝ) = ‖ξ - η‖ ^ (N + 1 : ℕ) := by + simpa only [Nat.cast_add, Nat.cast_one] using Real.rpow_natCast ‖ξ - η‖ (N + 1) + simp only [homogeneousCommutatorMoment, homogeneousFourierMagnitude, hexp, + div_eq_mul_inv, pow_succ] + ring + +theorem homogeneousOrderedCommutator_high_pointwise (N : ℕ) + (j : Fin (N + 1) → Fin 12) (V f : 𝓢(E, ℂ)) (R : ℝ) (hR : 1 ≤ R) + (hf : ∀ η : E, ‖η‖ < R → radianFourierKernel f η = 0) (ξ : E) : + ‖radianFourierKernel (homogeneousOrderedCommutator (N + 1) j V f) ξ‖ ≤ + (((2 * Real.pi) ^ (12 : ℕ))⁻¹ / R) * + positiveFrequencyConvolution (homogeneousCommutatorMoment N V) + (homogeneousFourierMagnitude (N + 1) (radianFourierKernel f)) ξ := by + let K := homogeneousCommutatorMoment N V + let g := homogeneousFourierMagnitude (N + 1) (radianFourierKernel f) + obtain ⟨B, _hB, hB⟩ := homogeneousFourierMagnitude_bounded (N + 1) (by positivity) + (radianFourierKernel f) + have hi : Integrable (fun η : E => K η * g (ξ - η)) := by + apply (homogeneousCommutatorMoment_integrable N V).mul_bdd (c := B) + ((homogeneousFourierMagnitude_continuous (N + 1) (by positivity) + (radianFourierKernel f)).comp (continuous_const.sub continuous_id)).aestronglyMeasurable + filter_upwards [] with η + change ‖homogeneousFourierMagnitude (N + 1) (radianFourierKernel f) (ξ - η)‖ ≤ B + rw [Real.norm_eq_abs, abs_of_nonneg (homogeneousFourierMagnitude_nonneg _ _ _)] + exact hB _ + have hb := integral_mono_of_nonneg + (ae_of_all _ (fun η : E => norm_nonneg + ((homogeneousOrderedSymbol (N + 1) j ξ - homogeneousOrderedSymbol (N + 1) j (ξ - η)) * + radianFourierKernel V η * radianFourierKernel f (ξ - η)))) + (hi.const_mul R⁻¹) (ae_of_all _ (commutator_integrand_high N j V f R hR hf ξ)) + rw [integral_const_mul] at hb + rw [homogeneousOrderedCommutator_fourier, norm_mul, Complex.norm_real, + Real.norm_eq_abs, abs_of_pos (by positivity)] + calc + _ ≤ ((2 * Real.pi) ^ (12 : ℕ))⁻¹ * + ∫ η : E, ‖(homogeneousOrderedSymbol (N + 1) j ξ - + homogeneousOrderedSymbol (N + 1) j (ξ - η)) * + radianFourierKernel V η * radianFourierKernel f (ξ - η)‖ := + mul_le_mul_of_nonneg_left (norm_integral_le_integral_norm _) (by positivity) + _ ≤ ((2 * Real.pi) ^ (12 : ℕ))⁻¹ * (R⁻¹ * ∫ η : E, K η * g (ξ - η)) := + mul_le_mul_of_nonneg_left hb (by positivity) + _ = _ := by rw [div_eq_mul_inv, mul_assoc]; rfl + +theorem homogeneousOrderedCommutator_high_energy (N : ℕ) + (j : Fin (N + 1) → Fin 12) (V f : 𝓢(E, ℂ)) (R : ℝ) (hR : 1 ≤ R) + (hf : ∀ η : E, ‖η‖ < R → radianFourierKernel f η = 0) : + (∫ ξ : E, ‖radianFourierKernel (homogeneousOrderedCommutator (N + 1) j V f) ξ‖ ^ 2) ≤ + ((((2 * Real.pi) ^ (12 : ℕ))⁻¹ / R) * + ∫ ξ : E, homogeneousCommutatorMoment N V ξ) ^ 2 * + homogeneousFrequencyEnergy (N + 1) (radianFourierKernel f) := by + let c := ((2 * Real.pi) ^ (12 : ℕ))⁻¹ / R + let K := homogeneousCommutatorMoment N V + let g := homogeneousFourierMagnitude (N + 1) (radianFourierKernel f) + obtain ⟨B, hB0, hB⟩ := homogeneousFourierMagnitude_bounded (N + 1) (by positivity) + (radianFourierKernel f) + have hY := continuousYoung_nonnegative K g (homogeneousCommutatorMoment_integrable N V) + (homogeneousFourierMagnitude_continuous (N + 1) (by positivity) _) + (homogeneousCommutatorMoment_nonneg N V) (homogeneousFourierMagnitude_nonneg _ _) + (homogeneousFourierMagnitude_sq_integrable (N + 1) (by positivity) _) B hB0 hB + have hpoint (ξ : E) : + ‖radianFourierKernel (homogeneousOrderedCommutator (N + 1) j V f) ξ‖ ^ 2 ≤ + c ^ 2 * positiveFrequencyConvolution K g ξ ^ 2 := by + have hp := pow_le_pow_left₀ (norm_nonneg _) + (homogeneousOrderedCommutator_high_pointwise N j V f R hR hf ξ) 2 + change _ ≤ (c * positiveFrequencyConvolution K g ξ) ^ 2 at hp + simpa only [mul_pow] using hp + have hf2 := ((radianFourierKernel (homogeneousOrderedCommutator (N + 1) j V f)).memLp 2).integrable_norm_pow + (p := 2) (by norm_num) + have hi := integral_mono + hf2 (hY.1.const_mul (c ^ 2)) hpoint + rw [integral_const_mul] at hi + have he : (∫ ξ : E, g ξ ^ 2) = homogeneousFrequencyEnergy (N + 1) (radianFourierKernel f) := by + change (∫ ξ : E, g ξ ^ 2) = ∫ ξ : E, + ‖ξ‖ ^ (2 * (N + 1 : ℝ)) * ‖radianFourierKernel f ξ‖ ^ 2 + apply integral_congr_ae + filter_upwards [] with ξ + simp only [g, homogeneousFourierMagnitude, mul_pow, + ← Real.rpow_natCast, ← Real.rpow_mul (norm_nonneg _)] + congr 2 + ring + calc + _ ≤ c ^ 2 * ((∫ ξ : E, K ξ) ^ 2 * ∫ ξ : E, g ξ ^ 2) := + hi.trans (mul_le_mul_of_nonneg_left hY.2 (sq_nonneg c)) + _ = _ := by rw [he]; dsimp only [c, K]; ring + +end DefocusingNLS + +end OAI diff --git a/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousCommutatorCompact.lean b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousCommutatorCompact.lean new file mode 100644 index 0000000000000000000000000000000000000000..09d900d76c7e8254f96869fb39495ef2cf98928a --- /dev/null +++ b/lean/OAI/MathematicalPhysics/DefocusingNLS/Linear/HomogeneousCommutatorCompact.lean @@ -0,0 +1,107 @@ +import OAI.MathematicalPhysics.DefocusingNLS.Linear.HomogeneousCommutatorDecay +import Mathlib.MeasureTheory.Integral.DominatedConvergence +import Mathlib.MeasureTheory.Integral.Prod + +namespace OAI + +/-! # Compactness of the actual frequency-localized commutator + +The row functionals and the integrable Schwartz majorant give strong L² +convergence for every bounded weakly null sequence in the exact Y space. +-/ + +open MeasureTheory Filter Topology +open scoped SchwartzMap + +namespace DefocusingNLS + +local notation "E" => EuclideanSpace ℝ (Fin 12) + +private theorem row_norm_le_of_bound (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (N : ℕ) (j : Fin N → Fin 12) (V χ : 𝓢(E, ℂ)) (ξ : E) (A : ℝ) (hA : 0 ≤ A) + (hbound : ∀ η : E, ‖homogeneousCommutatorRowKernel N j V χ ξ η‖ ≤ A) + (u : HomogeneousY a k) : + ‖homogeneousCommutatorRow a k ha ha1 hk N j V χ ξ u‖ ≤ + A * Real.sqrt (∫ η : E, (homogeneousFourierWeight a k η)⁻¹) * ‖u‖ := by + have hu := integrable_and_integral_norm_of_memLp_homogeneous a k ha ha1 hk (Lp.memLp u) + have hn : Real.sqrt (∫ η : E, ‖u η‖ ^ 2 ∂homogeneousFourierMeasure a k) = ‖u‖ := by + rw [Lp.norm_def, (Lp.memLp u).eLpNorm_eq_integral_rpow_norm (by norm_num) (by norm_num)] + simp only [ENNReal.toReal_ofNat, Real.rpow_two] + rw [ENNReal.toReal_ofReal (by positivity), Real.sqrt_eq_rpow] + norm_num + rw [hn] at hu + have hm := integral_mono_of_nonneg (ae_of_all _ (fun η : E => norm_nonneg + (homogeneousCommutatorRowKernel N j V χ ξ η * u η))) + (hu.1.norm.const_mul A) (ae_of_all _ (fun η => by + change ‖homogeneousCommutatorRowKernel N j V χ ξ η * u η‖ ≤ A * ‖u η‖ + rw [norm_mul] + exact mul_le_mul_of_nonneg_right (hbound η) (norm_nonneg _))) + calc + _ ≤ ∫ η : E, ‖homogeneousCommutatorRowKernel N j V χ ξ η * u η‖ := + norm_integral_le_integral_norm _ + _ ≤ A * ∫ η : E, ‖u η‖ := hm.trans_eq (integral_const_mul _ _) + _ ≤ A * (Real.sqrt (∫ η : E, (homogeneousFourierWeight a k η)⁻¹) * ‖u‖) := + mul_le_mul_of_nonneg_left hu.2 hA + _ = _ := by ring + +private theorem row_aestronglyMeasurable (a k : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) + (N : ℕ) (j : Fin N → Fin 12) (V χ : 𝓢(E, ℂ)) (u : HomogeneousY a k) : + AEStronglyMeasurable + (fun ξ : E => homogeneousCommutatorRow a k ha ha1 hk N j V χ ξ u) volume := by + have hK : Continuous (fun p : E × E => homogeneousCommutatorRowKernel N j V χ p.1 p.2) := by + unfold homogeneousCommutatorRowKernel homogeneousOrderedSymbol + fun_prop + have hu : AEStronglyMeasurable (fun p : E × E => u p.2) (volume.prod volume) := + ((Lp.aestronglyMeasurable u).mono_ac + (volume_absolutelyContinuous_homogeneousFourierMeasure a k ha1 hk)).comp_snd + exact (hK.aestronglyMeasurable.mul hu).integral_prod_right' + +theorem tendsto_homogeneousCommutator_cutoff_L2 (a k M R : ℝ) + (ha : 0 < a) (ha1 : a < 1) (hk : 8 < k) (hR : 1 ≤ R) + (N : ℕ) (j : Fin N → Fin 12) (V χ : 𝓢(E, ℂ)) + (hχ : ∀ η : E, R < ‖η‖ → χ η = 0) + (u : ℕ → HomogeneousY a k) (hu : ∀ n, ‖u n‖ ≤ M) + (hweak : ∀ ℓ : HomogeneousY a k →L[ℝ] ℂ, + Tendsto (fun n => ℓ (u n)) atTop (𝓝 0)) : + Tendsto (fun n => ∫ ξ : E, + ‖homogeneousCommutatorRow a k ha ha1 hk N j V χ ξ (u n)‖ ^ 2) + atTop (𝓝 0) := by + obtain ⟨C, hC, hc⟩ := homogeneousCommutatorRow_decay N j V χ R hR hχ + let D := Real.sqrt (∫ η : E, (homogeneousFourierWeight a k η)⁻¹) + let B : E → ℝ := fun ξ => (C * D * M) ^ 2 * (1 + ‖ξ‖) ^ (-(28 : ℝ)) + have hD : 0 ≤ D := Real.sqrt_nonneg _ + have hM : 0 ≤ M := (norm_nonneg (u 0)).trans (hu 0) + have hpow (ξ : E) : (((1 + ‖ξ‖) ^ (14 : ℕ))⁻¹) ^ 2 = (1 + ‖ξ‖) ^ (-(28 : ℝ)) := by + rw [Real.rpow_neg (by positivity), Real.rpow_ofNat, ← inv_pow, ← pow_mul] + norm_num + have hb (n : ℕ) (ξ : E) : + ‖‖homogeneousCommutatorRow a k ha ha1 hk N j V χ ξ (u n)‖ ^ 2‖ ≤ B ξ := by + have hr := (row_norm_le_of_bound a k ha ha1 hk N j V χ ξ + (C * ((1 + ‖ξ‖) ^ (14 : ℕ))⁻¹) (by positivity) (hc ξ) (u n)).trans + (mul_le_mul_of_nonneg_left (hu n) (mul_nonneg (by positivity) hD)) + have hs := pow_le_pow_left₀ (norm_nonneg _) hr 2 + rw [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg _)] + apply hs.trans_eq + dsimp only [B, D] + rw [mul_pow, mul_pow, mul_pow, hpow] + ring + have hB : Integrable B := by + apply Integrable.const_mul + apply integrable_one_add_norm + norm_num + have hm (n : ℕ) : AEStronglyMeasurable + (fun ξ : E => ‖homogeneousCommutatorRow a k ha ha1 hk N j V χ ξ (u n)‖ ^ 2) volume := + (row_aestronglyMeasurable a k ha ha1 hk N j V χ (u n)).norm.pow 2 + have hp (ξ : E) : Tendsto + (fun n => ‖homogeneousCommutatorRow a k ha ha1 hk N j V χ ξ (u n)‖ ^ 2) + atTop (𝓝 0) := by + simpa only [norm_zero, zero_pow (by norm_num : (2 : ℕ) ≠ 0)] using + (tendsto_homogeneousCommutatorRow_of_weakNull a k ha ha1 hk N j V χ ξ u hweak).norm.pow 2 + simpa only [integral_zero] using tendsto_integral_of_dominated_convergence B hm hB + (fun n => ae_of_all _ (hb n)) (ae_of_all _ hp) + +end DefocusingNLS + +end OAI